6 years agoRelease script: correctly symlink clang-tools-extra into the build (PR22765)
Hans Wennborg [Tue, 18 Aug 2015 21:10:17 +0000 (21:10 +0000)]
Release script: correctly symlink clang-tools-extra into the build (PR22765)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245355 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][AVX] Added shuffle concatenation tests
Simon Pilgrim [Tue, 18 Aug 2015 20:51:15 +0000 (20:51 +0000)]
[X86][AVX] Added shuffle concatenation tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245351 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDAGCombiner: Improve DAGCombiner select normalization
Matthias Braun [Tue, 18 Aug 2015 20:48:36 +0000 (20:48 +0000)]
DAGCombiner: Improve DAGCombiner select normalization

The current code normalizes select(C0, x, select(C1, x, y)) towards
select(C0|C1, x, y) if the targets prefers that form. This patch adds an
additional rule that if the select(C1, x, y) part already exists in the
function then we want to normalize into the other direction because the
effects of reusing the existing value are bigger than transforming into
the target preferred form.

This addresses regressions following r238793, see also:

Differential Revision: http://reviews.llvm.org/D11616

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245350 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDAGCombiner: Optimize SELECTs first before turning them into SELECT_CC
Matthias Braun [Tue, 18 Aug 2015 20:48:29 +0000 (20:48 +0000)]
DAGCombiner: Optimize SELECTs first before turning them into SELECT_CC

This is part of http://reviews.llvm.org/D11616 - I just decided to split
this up into a separate commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245349 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdated constants to give more useful min/max constant folding tests
Simon Pilgrim [Tue, 18 Aug 2015 20:46:48 +0000 (20:46 +0000)]
Updated constants to give more useful min/max constant folding tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245348 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM/AA] Add using declarations to avoid hiding virtual overloads.
Chandler Carruth [Tue, 18 Aug 2015 20:28:40 +0000 (20:28 +0000)]
[PM/AA] Add using declarations to avoid hiding virtual overloads.

Note that this actually has no functional change -- we never call these
methods using the derived type. But it is still cleaner and fixes a GCC

Spotted by Dave in code review and the warning spotted by Joerg on IRC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245341 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEH] Calculate state numbers for the new EH representation
David Majnemer [Tue, 18 Aug 2015 19:07:12 +0000 (19:07 +0000)]
[WinEH] Calculate state numbers for the new EH representation

State numbers are calculated by performing a walk from the innermost
funclet to the outermost funclet.   Rudimentary support for the new EH
constructs has been added to the assembly printer, just enough to test
the new machinery.

Differential Revision: http://reviews.llvm.org/D12098

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245331 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMachineRegisterInfo: Introduce isPhysRegUsed()
Matthias Braun [Tue, 18 Aug 2015 18:54:27 +0000 (18:54 +0000)]
MachineRegisterInfo: Introduce isPhysRegUsed()

This method checks whether a physical regiser or any of its aliases are
used in the function.

Using this function in SIRegisterInfo::findUnusedReg() should also fix
this reported failure:


The report doesn't come with a testcase and I don't know enough about
AMDGPU to create one myself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245329 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LPM] Cleanup some loops to be range based for loops before hacking on
Chandler Carruth [Tue, 18 Aug 2015 18:41:53 +0000 (18:41 +0000)]
[LPM] Cleanup some loops to be range based for loops before hacking on
this code. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245327 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LPM] Group the addPreserved template with the non-template variants,
Chandler Carruth [Tue, 18 Aug 2015 18:18:37 +0000 (18:18 +0000)]
[LPM] Group the addPreserved template with the non-template variants,

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245324 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Kaleidoscope] Start C++11'ifying the kaleidoscope tutorials.
Lang Hames [Tue, 18 Aug 2015 18:11:06 +0000 (18:11 +0000)]
[Kaleidoscope] Start C++11'ifying the kaleidoscope tutorials.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245322 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM/AA] Remove the last relics of the separate IPA library from LLVM,
Chandler Carruth [Tue, 18 Aug 2015 17:51:53 +0000 (17:51 +0000)]
[PM/AA] Remove the last relics of the separate IPA library from LLVM,
folding the code into the main Analysis library.

There already wasn't much of a distinction between Analysis and IPA.
A number of the passes in Analysis are actually IPA passes, and there
doesn't seem to be any advantage to separating them.

Moreover, it makes it hard to have interactions between analyses that
are both local and interprocedural. In trying to make the Alias Analysis
infrastructure work with the new pass manager, it becomes particularly
awkward to navigate this split.

I've tried to find all the places where we referenced this, but I may
have missed some. I have also adjusted the C API to continue to be
equivalently functional after this change.

Differential Revision: http://reviews.llvm.org/D12075

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245318 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIR Parser: Implicit register verifier should accept unexpected implicit
Alex Lorenz [Tue, 18 Aug 2015 17:17:13 +0000 (17:17 +0000)]
MIR Parser: Implicit register verifier should accept unexpected implicit
subregister operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245315 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LVI] Use a SmallDenseMap instead of std::map for ValueCacheEntryTy
Bruno Cardoso Lopes [Tue, 18 Aug 2015 16:54:36 +0000 (16:54 +0000)]
[LVI] Use a SmallDenseMap instead of std::map for ValueCacheEntryTy

Historically there seems to be some resistance regarding the change to DenseMap
(r147980). However, I couldn't find cases of iterator invalidation for
ValueCacheEntryTy, but only for ValueCache, which I left untouched.

This reduces 20s on an internal testcase. Follow up from r245309.

Differential Revision: http://reviews.llvm.org/D11651


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245314 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agouse minSize wrapper; NFCI
Sanjay Patel [Tue, 18 Aug 2015 16:44:23 +0000 (16:44 +0000)]
use minSize wrapper; NFCI

These were missed when other uses were switched over:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245311 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LVI] Improve LazyValueInfo compile time performance
Bruno Cardoso Lopes [Tue, 18 Aug 2015 16:34:27 +0000 (16:34 +0000)]
[LVI] Improve LazyValueInfo compile time performance

Changes in LoopUnroll in the past six months exposed scalability
issues in LazyValueInfo when used from JumpThreading. One internal test
that used to take 20s under -O2 now takes 6min.

This commit change the OverDefinedCache from
DenseSet<std::pair<AssertingVH<BasicBlock>, Value*>> to
DenseMap<AssertingVH<BasicBlock>, SmallPtrSet<Value *, 4>>
and reduces compile time down to 1m40s.

Differential Revision: http://reviews.llvm.org/D11651


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245309 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Simplify the logic for computing in bounds offset. NFC.
Chad Rosier [Tue, 18 Aug 2015 16:20:03 +0000 (16:20 +0000)]
[AArch64] Simplify the logic for computing in bounds offset. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245307 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Expand JAL instructions when PIC is enabled.
Daniel Sanders [Tue, 18 Aug 2015 16:18:09 +0000 (16:18 +0000)]
[mips] Expand JAL instructions when PIC is enabled.

Summary: This is the correct way to handle JAL instructions when PIC is enabled.

Patch by Toma Tabacu

Reviewers: seanbruno, tomatabacu

Subscribers: brooks, seanbruno, emaste, llvm-commits

Differential Revision: http://reviews.llvm.org/D6231

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245305 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MC] Convert another bunch of tests from macho-dump to llvm-readobj.
Davide Italiano [Tue, 18 Aug 2015 16:05:13 +0000 (16:05 +0000)]
[MC] Convert another bunch of tests from macho-dump to llvm-readobj.

This is (almost) everything under MC/MachO/ARM. There are still some
cases missing, because llvm-readobj doesn't (yet) support some features,
that macho-dump provides. I plan to reduce the gap between them shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245302 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips][microMIPS] Implement DDIV, DMOD, DDIVU and DMODU instructions
Zoran Jovanovic [Tue, 18 Aug 2015 14:40:43 +0000 (14:40 +0000)]
[mips][microMIPS] Implement DDIV, DMOD, DDIVU and DMODU instructions
Differential Revision: http://reviews.llvm.org/D10953

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245297 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips][microMIPS] Implement SW and SWE instructions
Zoran Jovanovic [Tue, 18 Aug 2015 12:53:08 +0000 (12:53 +0000)]
[mips][microMIPS] Implement SW and SWE instructions
Differential Revision: http://reviews.llvm.org/D10869

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245293 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Make the MipsAsmParser capable of knowing whether PIC mode is enabled or not.
Daniel Sanders [Tue, 18 Aug 2015 12:33:54 +0000 (12:33 +0000)]
[mips] Make the MipsAsmParser capable of knowing whether PIC mode is enabled or not.

This information is needed to decide whether we do the PIC-only JAL expansions or not. It's also needed for an upcoming patch which implements the .cprestore assembler directive (which can only be used effectively in PIC mode).

By making this information available to the MipsAsmParser, we will know when to insert the instructions mandated by the .cprestore assembler directive and we will be able to give some useful warnings when we encounter a potential misuse of this directive.

Patch by Toma Tabacu

Reviewers: dsanders, seanbruno

Subscribers: brooks, seanbruno, rafael, llvm-commits

Differential Revision: http://reviews.llvm.org/D5626

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245291 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Support] On Windows, generate PDF files for graphs and open with associated viewer
Michael Kruse [Tue, 18 Aug 2015 12:17:37 +0000 (12:17 +0000)]
[Support] On Windows, generate PDF files for graphs and open with associated viewer

Summary: Windows system rarely have good PostScript viewers installed, but PDF viewers are common. So for viewing graphs, generate PDF files and open with the associated PDF viewer using cmd.exe's start command.

Reviewers: Bigcheese, aaron.ballman

Subscribers: aaron.ballman, JakeVanAdrighem, dwiberg, llvm-commits

Differential Revision: http://reviews.llvm.org/D11877

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245290 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Support] Always wait for GraphViz before opening the viewer
Michael Kruse [Tue, 18 Aug 2015 12:13:57 +0000 (12:13 +0000)]
[Support] Always wait for GraphViz before opening the viewer

When calling DisplayGraph and a PS viewer is chosen, two programs are executed: The GraphViz generator and the PostScript viewer. Always for the generator to finish to ensure that the .ps file is written before opening the viewer for that file. DisplayGraph's wait parameter refers to whether to wait until the user closes the viewer.

This happened on Windows and if none of the options to open the .dot file directly applies, also on Linux.

Reviewers: Bigcheese, chandlerc, aaron.ballman

Subscribers: dwiberg, aaron.ballman, llvm-commits

Differential Revision: http://reviews.llvm.org/D11876

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245289 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Correct -Woverflow warning in r245208 without changing signedness of the constant.
Daniel Sanders [Tue, 18 Aug 2015 09:55:57 +0000 (09:55 +0000)]
[mips] Correct -Woverflow warning in r245208 without changing signedness of the constant.

This was supposed to have been committed as part of r245208

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245285 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFixed max/min typo in test names
Simon Pilgrim [Tue, 18 Aug 2015 09:02:51 +0000 (09:02 +0000)]
Fixed max/min typo in test names

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245278 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE} Added constant SMAX/SMIN/UMAX/UMIN tests
Simon Pilgrim [Tue, 18 Aug 2015 08:52:43 +0000 (08:52 +0000)]
[X86][SSE} Added constant SMAX/SMIN/UMAX/UMIN tests

Constant folding patch to follow soon

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245276 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] Added extra vector truncation tests.
Simon Pilgrim [Tue, 18 Aug 2015 08:37:09 +0000 (08:37 +0000)]
[X86][SSE] Added extra vector truncation tests.

Including cases for PR14866

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245274 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd unit test for isLayoutIdentical(empty, empty).
Yaron Keren [Tue, 18 Aug 2015 07:59:09 +0000 (07:59 +0000)]
Add unit test for isLayoutIdentical(empty, empty).
It was previously asserting in Visual C++ debug mode on a null
iterator passed to std::equal.

Test by Hans Wennborg!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245270 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Constant propagation after hiting llvm.assume"
Justin Bogner [Tue, 18 Aug 2015 07:00:34 +0000 (07:00 +0000)]
Revert "Constant propagation after hiting llvm.assume"

This was also failing bootstrap:


This reverts r245265.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245269 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoConstant propagation after hiting llvm.assume
Piotr Padlewski [Tue, 18 Aug 2015 03:55:30 +0000 (03:55 +0000)]
Constant propagation after hiting llvm.assume

After hitting @llvm.assume(X) we can:
- propagate equality that X == true
- if X is icmp/fcmp (with eq operation), and one of operand
  is constant we can change all variables with constants in the same BasicBlock


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245265 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDoxygen: add build option to use svg instead of png files for graphs
Hans Wennborg [Mon, 17 Aug 2015 23:24:17 +0000 (23:24 +0000)]
Doxygen: add build option to use svg instead of png files for graphs

Differential Revision: http://reviews.llvm.org/D11994

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245256 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd an exposed variable for which c++ compiler we're using for our
Eric Christopher [Mon, 17 Aug 2015 22:46:26 +0000 (22:46 +0000)]
Add an exposed variable for which c++ compiler we're using for our

Patch by Chris Bieneman!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245255 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Don't default to ELF in the triple.
Dan Gohman [Mon, 17 Aug 2015 22:37:56 +0000 (22:37 +0000)]
[WebAssembly] Don't default to ELF in the triple.

WebAssembly doesn't yet have a specified binary format, and it may not
end up being ELF, so we don't want the Triple class defaulting to ELF
for it at this time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245254 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAlign SP adjustment in function getSPAdjust
Guozhi Wei [Mon, 17 Aug 2015 22:36:27 +0000 (22:36 +0000)]
Align SP adjustment in function getSPAdjust

This commit adds a new function TargetFrameLowering::alignSPAdjust
and calls it from TargetInstrInfo::getSPAdjust. It fixes PR24142.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245253 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Make getArchTypePrefix return "wasm".
Dan Gohman [Mon, 17 Aug 2015 22:35:40 +0000 (22:35 +0000)]
[WebAssembly] Make getArchTypePrefix return "wasm".

The arch prefix string isn't currently being used for anything on
WebAssembly, but if it were to be used, it makes sense to use the
same arch prefix string for wasm32 and wasm64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245252 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIR Serialization: Serialize the local offsets for the stack objects.
Alex Lorenz [Mon, 17 Aug 2015 22:17:42 +0000 (22:17 +0000)]
MIR Serialization: Serialize the local offsets for the stack objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245249 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIR Serialization: Serialize the memory operand's range metadata node.
Alex Lorenz [Mon, 17 Aug 2015 22:09:52 +0000 (22:09 +0000)]
MIR Serialization: Serialize the memory operand's range metadata node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245247 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIR Serialization: Serialize the memory operand's noalias metadata node.
Alex Lorenz [Mon, 17 Aug 2015 22:08:02 +0000 (22:08 +0000)]
MIR Serialization: Serialize the memory operand's noalias metadata node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245246 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIR Serialization: Serialize the memory operand's alias scope metadata node.
Alex Lorenz [Mon, 17 Aug 2015 22:06:40 +0000 (22:06 +0000)]
MIR Serialization: Serialize the memory operand's alias scope metadata node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245245 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIR Serialization: Serialize the memory operand's TBAA metadata node.
Alex Lorenz [Mon, 17 Aug 2015 22:05:15 +0000 (22:05 +0000)]
MIR Serialization: Serialize the memory operand's TBAA metadata node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245244 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEHPrepare] Replace unreasonable funclet terminators with unreachable
David Majnemer [Mon, 17 Aug 2015 20:56:39 +0000 (20:56 +0000)]
[WinEHPrepare] Replace unreasonable funclet terminators with unreachable

It is possible to be in a situation where more than one funclet token is
a valid SSA value.  If we see a terminator which exits a funclet which
doesn't use the funclet's token, replace it with unreachable.

Differential Revision: http://reviews.llvm.org/D12074

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245238 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SPARC]: recognize '.' as the start of an assembler expression.
Douglas Katzman [Mon, 17 Aug 2015 19:55:01 +0000 (19:55 +0000)]
[SPARC]: recognize '.' as the start of an assembler expression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245232 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Fix crash when targetting CPU without NEON
James Molloy [Mon, 17 Aug 2015 19:37:12 +0000 (19:37 +0000)]
[ARM] Fix crash when targetting CPU without NEON

We emulate a scalar vmin/vmax with NEON instructions as they don't exist in the VFP ISA. So only mark these as legal when NEON is available.

Found here: https://code.google.com/p/chromium/issues/detail?id=521671

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245231 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ScalarEvolutionExpander] Reuse findExistingExpansion during expansion cost calculati...
Igor Laevsky [Mon, 17 Aug 2015 16:37:04 +0000 (16:37 +0000)]
[ScalarEvolutionExpander] Reuse findExistingExpansion during expansion cost calculation for division

Primary purpose of this change is to reuse existing code inside findExistingExpansion. However it introduces very slight semantic change - findExistingExpansion now looks into exiting blocks instead of a loop latches. Originally heuristic was based on the fact that we want to look at the loop exit conditions. And since all exiting latches will be listed in the ExitingBlocks, heuristic stays roughly the same.

Differential Revision: http://reviews.llvm.org/D12008

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245227 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CostModel][AArch64] Increase cost of vector insert element and add missing cast...
Silviu Baranga [Mon, 17 Aug 2015 16:05:09 +0000 (16:05 +0000)]
[CostModel][AArch64] Increase cost of vector insert element and add missing cast costs

Increase the estimated costs for insert/extract element operations on
AArch64. This is motivated by results from benchmarking interleaved

Add missing costs for zext/sext/trunc instructions and some integer to
floating point conversions. These costs were previously calculated
by scalarizing these operation and were affected by the cost increase of
the insert/extract element operations.

Reviewers: rengolin

Subscribers: mcrosier, aemerson, rengolin, llvm-commits

Differential Revision: http://reviews.llvm.org/D11939

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245226 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CostModel][ARM] Increase cost of insert/extract operations
Silviu Baranga [Mon, 17 Aug 2015 15:57:05 +0000 (15:57 +0000)]
[CostModel][ARM] Increase cost of insert/extract operations

This change limits the minimum cost of an insert/extract
element operation to 2 in cases where this would result
in mixing of NEON and VFP code.

Reviewers: rengolin

Subscribers: mssimpso, aemerson, llvm-commits, rengolin

Differential Revision: http://reviews.llvm.org/D12030

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245225 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[BasicAliasAnalysis] Do not check ModRef table for intrinsics
Igor Laevsky [Mon, 17 Aug 2015 15:56:56 +0000 (15:56 +0000)]
[BasicAliasAnalysis] Do not check ModRef table for intrinsics

All possible ModRef behaviours can be completely represented using existing LLVM IR attributes.

Differential Revision: http://reviews.llvm.org/D12033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245224 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTake alignment into account in isSafeToSpeculativelyExecute and isSafeToLoadUnconditi...
Artur Pilipenko [Mon, 17 Aug 2015 15:54:26 +0000 (15:54 +0000)]
Take alignment into account in isSafeToSpeculativelyExecute and isSafeToLoadUnconditionally.

Reviewed By: hfinkel, sanjoy, MatzeB

Differential Revision: http://reviews.llvm.org/D9791

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245223 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoExtend MCAsmLexer so that it can peek forward several tokens
Benjamin Kramer [Mon, 17 Aug 2015 14:35:25 +0000 (14:35 +0000)]
Extend MCAsmLexer so that it can peek forward several tokens

This commit adds a virtual `peekTokens()` function to `MCAsmLexer`
which can peek forward an arbitrary number of tokens.

It also makes the `peekTok()` method call `peekTokens()` method, but
only requesting one token.

The idea is to better support targets which more more ambiguous
assembly syntaxes.

Patch by Dylan McKay!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245221 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCorrecting a -Woverflow warning where 0xFFFF was overflowing an implicit constant...
Aaron Ballman [Mon, 17 Aug 2015 14:25:57 +0000 (14:25 +0000)]
Correcting a -Woverflow warning where 0xFFFF was overflowing an implicit constant conversion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245220 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WinEHPrepare] Fix catchret successor phi demotion
Joseph Tremoulet [Mon, 17 Aug 2015 13:51:37 +0000 (13:51 +0000)]
[WinEHPrepare] Fix catchret successor phi demotion

When demoting an SSA value that has a use on a phi and one of the phi's
predecessors terminates with catchret, the edge needs to be split and the
load inserted in the new block, else we'll still have a cross-funclet SSA

Add a test for this, and for the similar case where a def to be spilled is
on and invoke and a critical edge, which was already implemented but
missing a test.

Reviewers: majnemer

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12065

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245218 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Disable targetdatalayoutcheck"
Tobias Grosser [Mon, 17 Aug 2015 10:58:03 +0000 (10:58 +0000)]
Revert "Disable targetdatalayoutcheck"

I committed by accident a local hack that should not have made it upstream.
Sorry for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245212 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDisable targetdatalayoutcheck
Tobias Grosser [Mon, 17 Aug 2015 10:56:35 +0000 (10:56 +0000)]
Disable targetdatalayoutcheck

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245210 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] [IAS] Add support for the DLA pseudo-instruction and fix problems with DLI
Daniel Sanders [Mon, 17 Aug 2015 10:11:55 +0000 (10:11 +0000)]
[mips] [IAS] Add support for the DLA pseudo-instruction and fix problems with DLI

Summary: It is the same as LA, except that it can also load 64-bit addresses and it only works on 64-bit MIPS architectures.

Reviewers: tomatabacu, seanbruno, vkalintiris

Subscribers: brooks, seanbruno, emaste, llvm-commits

Differential Revision: http://reviews.llvm.org/D9524

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245208 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GMR] isNonEscapingGlobalNoAlias() should look through Bitcasts/GEPs when looking...
Michael Kuperstein [Mon, 17 Aug 2015 10:06:08 +0000 (10:06 +0000)]
[GMR] isNonEscapingGlobalNoAlias() should look through Bitcasts/GEPs when looking at loads.

This fixes yet another case from PR24288.

Differential Revision: http://reviews.llvm.org/D12064

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245207 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove hand-rolled matching for fmin and fmax.
James Molloy [Mon, 17 Aug 2015 07:13:20 +0000 (07:13 +0000)]
Remove hand-rolled matching for fmin and fmax.

SDAGBuilder now does this all for us.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245198 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRip out hand-rolled matching code for VMIN, VMAX, VMINNM and VMAXNM
James Molloy [Mon, 17 Aug 2015 07:13:15 +0000 (07:13 +0000)]
Rip out hand-rolled matching code for VMIN, VMAX, VMINNM and VMAXNM

This is no longer needed - SDAGBuilder will do this for us.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245197 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoGenerate FMINNAN/FMINNUM/FMAXNAN/FMAXNUM from SDAGBuilder.
James Molloy [Mon, 17 Aug 2015 07:13:10 +0000 (07:13 +0000)]

These only get generated if the target supports them. If one of the variants is not legal and the other is, and it is safe to do so, the other variant will be emitted.

For example on AArch32 (V8), we have scalar fminnm but not fmin.

Fix up a couple of tests while we're here - one now produces better code, and the other was just plain wrong to start with.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245196 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix PR24469 resulting from r245025 and re-enable dead store elimination across basicb...
Karthik Bhat [Mon, 17 Aug 2015 05:51:39 +0000 (05:51 +0000)]
Fix PR24469 resulting from r245025 and re-enable dead store elimination across basicblocks.
PR24469 resulted because DeleteDeadInstruction in handleNonLocalStoreDeletion was
deleting the next basic block iterator. Fixed the same by resetting the basic block iterator
post call to DeleteDeadInstruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245195 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[InstCombinePHI] Partial simplification of identity operations."
David Majnemer [Mon, 17 Aug 2015 03:11:26 +0000 (03:11 +0000)]
Revert "[InstCombinePHI] Partial simplification of identity operations."

This reverts commit r244887, it caused PR24470.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245194 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM] Port ScalarEvolution to the new pass manager.
Chandler Carruth [Mon, 17 Aug 2015 02:08:17 +0000 (02:08 +0000)]
[PM] Port ScalarEvolution to the new pass manager.

This change makes ScalarEvolution a stand-alone object and just produces
one from a pass as needed. Making this work well requires making the
object movable, using references instead of overwritten pointers in
a number of places, and other refactorings.

I've also wired it up to the new pass manager and added a RUN line to
a test to exercise it under the new pass manager. This includes basic
printing support much like with other analyses.

But there is a big and somewhat scary change here. Prior to this patch
ScalarEvolution was never *actually* invalidated!!! Re-running the pass
just re-wired up the various other analyses and didn't remove any of the
existing entries in the SCEV caches or clear out anything at all. This
might seem OK as everything in SCEV that can uses ValueHandles to track
updates to the values that serve as SCEV keys. However, this still means
that as we ran SCEV over each function in the module, we kept
accumulating more and more SCEVs into the cache. At the end, we would
have a SCEV cache with every value that we ever needed a SCEV for in the
entire module!!! Yowzers. The releaseMemory routine would dump all of
this, but that isn't realy called during normal runs of the pipeline as
far as I can see.

To make matters worse, there *is* actually a key that we don't update
with value handles -- there is a map keyed off of Loop*s. Because
LoopInfo *does* release its memory from run to run, it is entirely
possible to run SCEV over one function, then over another function, and
then lookup a Loop* from the second function but find an entry inserted
for the first function! Ouch.

To make matters still worse, there are plenty of updates that *don't*
trip a value handle. It seems incredibly unlikely that today GVN or
another pass that invalidates SCEV can update values in *just* such
a way that a subsequent run of SCEV will incorrectly find lookups in
a cache, but it is theoretically possible and would be a nightmare to

With this refactoring, I've fixed all this by actually destroying and
recreating the ScalarEvolution object from run to run. Technically, this
could increase the amount of malloc traffic we see, but then again it is
also technically correct. ;] I don't actually think we're suffering from
tons of malloc traffic from SCEV because if we were, the fact that we
never clear the memory would seem more likely to have come up as an
actual problem before now. So, I've made the simple fix here. If in fact
there are serious issues with too much allocation and deallocation,
I can work on a clever fix that preserves the allocations (while
clearing the data) between each run, but I'd prefer to do that kind of
optimization with a test case / benchmark that shows why we need such
cleverness (and that can test that we actually make it faster). It's
possible that this will make some things faster by making the SCEV
caches have higher locality (due to being significantly smaller) so
until there is a clear benchmark, I think the simple change is best.

Differential Revision: http://reviews.llvm.org/D12063

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245193 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ADT] Teach FoldingSet to be movable.
Chandler Carruth [Sun, 16 Aug 2015 23:17:27 +0000 (23:17 +0000)]
[ADT] Teach FoldingSet to be movable.

This is a very minimal move support - it leaves the moved-from object in
a zombie state that is only valid for destruction and move assignment.
This seems fine to me, and leaving it in the default constructed state
would require adding more state to the object and potentially allocating
memory (!!!) and so seems like a Bad Idea.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245192 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[TableGen] Use range-based for loop.
Craig Topper [Sun, 16 Aug 2015 21:27:10 +0000 (21:27 +0000)]
[TableGen] Use range-based for loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245191 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[TableGen] Move the ConversionRow vector into the ConversionTable instead of copying.
Craig Topper [Sun, 16 Aug 2015 21:27:08 +0000 (21:27 +0000)]
[TableGen] Move the ConversionRow vector into the ConversionTable instead of copying.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245190 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SimplifyLibCalls] Drop default template args. No functional change.
Benjamin Kramer [Sun, 16 Aug 2015 21:16:37 +0000 (21:16 +0000)]
[SimplifyLibCalls] Drop default template args. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245189 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IR] Simplify code. No functionality change.
Benjamin Kramer [Sun, 16 Aug 2015 21:16:26 +0000 (21:16 +0000)]
[IR] Simplify code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245188 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agotransform fmin/fmax calls when possible (PR24314)
Sanjay Patel [Sun, 16 Aug 2015 20:18:19 +0000 (20:18 +0000)]
transform fmin/fmax calls when possible (PR24314)

If we can ignore NaNs, fmin/fmax libcalls can become compare and select
(this is what we turn std::min / std::max into).

This IR should then be optimized in the backend to whatever is best for
any given target. Eg, x86 can use minss/maxss instructions.

This should solve PR24314:

Differential Revision: http://reviews.llvm.org/D11866

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245187 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LSR][NFC] Don’t duplicate entity name at the beginning of the comment.
Sanjoy Das [Sun, 16 Aug 2015 18:22:46 +0000 (18:22 +0000)]
[LSR][NFC] Don’t duplicate entity name at the beginning of the comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245183 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LSR][NFC] Use camelCase for method names in Formula and RegUseTracker.
Sanjoy Das [Sun, 16 Aug 2015 18:22:43 +0000 (18:22 +0000)]
[LSR][NFC] Use camelCase for method names in Formula and RegUseTracker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245182 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agouse SDValue bool operator; NFCI
Sanjay Patel [Sun, 16 Aug 2015 17:54:28 +0000 (17:54 +0000)]
use SDValue bool operator; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245181 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd missing include guard.
Yaron Keren [Sun, 16 Aug 2015 07:55:08 +0000 (07:55 +0000)]
Add missing include guard.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245173 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Add support for cross block dse. This patch enables dead stroe elimination...
David Majnemer [Sun, 16 Aug 2015 07:11:59 +0000 (07:11 +0000)]
Revert "Add support for cross block dse. This patch enables dead stroe elimination across basicblocks."

This reverts commit r245025, it caused PR24469.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245172 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Replace an and+icmp with a trunc+icmp
David Majnemer [Sun, 16 Aug 2015 07:09:17 +0000 (07:09 +0000)]
[InstCombine] Replace an and+icmp with a trunc+icmp

Bitwise arithmetic can obscure a simple sign-test.  If replacing the
mask with a truncate is preferable if the type is legal because it
permits us to rephrase the comparison more explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245171 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r244127: [PM] Remove a failed attempt to port the CallGraph
Chandler Carruth [Sun, 16 Aug 2015 06:35:19 +0000 (06:35 +0000)]
Revert r244127: [PM] Remove a failed attempt to port the CallGraph
analysis ...

It turns out that we *do* need the old CallGraph ported to the new pass
manager. There are times where this model of a call graph is really
superior to the one provided by the LazyCallGraph. For example,
GlobalsModRef very specifically needs the model provided by CallGraph.

While here, I've tried to make the move semantics actually work. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245170 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Widen the 'AND' mask if doing so shrinks the encoding size
David Majnemer [Sun, 16 Aug 2015 04:52:11 +0000 (04:52 +0000)]
[X86] Widen the 'AND' mask if doing so shrinks the encoding size

We can set additional bits in a mask given that we know the other
operand of an AND already has some bits set to zero.  This can be more
efficient if doing so allows us to use an instruction which implicitly
sign extends the immediate.

This fixes PR24085.

Differential Revision: http://reviews.llvm.org/D11289

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245169 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.
NAKAMURA Takumi [Sun, 16 Aug 2015 02:41:23 +0000 (02:41 +0000)]
MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.

Don't assume second would be ordered in the module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245168 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTry to appease VS 2015 warnings from http://reviews.llvm.org/D11890
Yaron Keren [Sat, 15 Aug 2015 19:06:14 +0000 (19:06 +0000)]
Try to appease VS 2015 warnings from reviews.llvm.org/D11890
ByteSize and BitSize should not be size_t but unsigned, considering

1) They are at most 2^16 and 2^19, respectively.
2) BitSize is an argument to Type::getIntNTy which takes unsigned.

Also, use the correct utostr instead itostr and cache the string result.

Thanks to James Touton for reporting this!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245167 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] enable machine combiner reassociations for scalar single-precision minimums
Sanjay Patel [Sat, 15 Aug 2015 17:01:54 +0000 (17:01 +0000)]
[x86] enable machine combiner reassociations for scalar single-precision minimums

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245166 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdated broadcast stack folding test to avoid use of broadcast intrinsics.
Simon Pilgrim [Sat, 15 Aug 2015 16:54:18 +0000 (16:54 +0000)]
Updated broadcast stack folding test to avoid use of broadcast intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245165 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agofix typos; NFC
Sanjay Patel [Sat, 15 Aug 2015 16:53:08 +0000 (16:53 +0000)]
fix typos; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245164 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoadd test case to show current codegen
Sanjay Patel [Sat, 15 Aug 2015 16:49:50 +0000 (16:49 +0000)]
add test case to show current codegen

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245163 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSilence VS2015 warning.
Yaron Keren [Sat, 15 Aug 2015 14:54:43 +0000 (14:54 +0000)]
Silence VS2015 warning.
Patch by James Touton!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245161 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAGCombiner] Attempt to mask vectors before zero extension instead of after.
Simon Pilgrim [Sat, 15 Aug 2015 13:27:30 +0000 (13:27 +0000)]
[DAGCombiner] Attempt to mask vectors before zero extension instead of after.

For cases where we TRUNCATE and then ZERO_EXTEND to a larger size (often from vector legalization), see if we can mask the source data and then ZERO_EXTEND (instead of after a ANY_EXTEND). This can help avoid having to generate a larger mask, and possibly applying it to several sub-vectors.

(zext (truncate x)) -> (zext (and(x, m))

Includes a minor patch to SystemZ to better recognise 8/16-bit zero extension patterns from RISBG bit-extraction code.

This is the first of a number of minor patches to help improve the conversion of byte masks to clear mask shuffles.

Differential Revision: http://reviews.llvm.org/D11764

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245160 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM/AA] Delete the LibCallAliasAnalysis and all the associated
Chandler Carruth [Sat, 15 Aug 2015 09:22:21 +0000 (09:22 +0000)]
[PM/AA] Delete the LibCallAliasAnalysis and all the associated

This AA was never used in tree. It's infrastructure also completely
overlaps that of TargetLibraryInfo which is used heavily by BasicAA to
achieve similar goals to those stated for this analysis.

As has come up in several discussions, the use case here is still really
important, but this code isn't helping move toward that use case. Any
progress on better supporting rich AA information for runtime library
environments would likely be better off starting from scratch or
starting from TargetLibraryInfo than from this base.

Differential Revision: http://reviews.llvm.org/D12028

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245155 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IR] Update CreateCatchRet to take a return value
David Majnemer [Sat, 15 Aug 2015 03:19:29 +0000 (03:19 +0000)]
[IR] Update CreateCatchRet to take a return value

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245152 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/SI: Only look at live out SGPR defs
Matt Arsenault [Sat, 15 Aug 2015 02:58:49 +0000 (02:58 +0000)]
AMDGPU/SI: Only look at live out SGPR defs

When trying to fix SGPR live ranges, skip defs that are
killed in the same block as the def. I don't think
we need to worry about these cases as long as the
live ranges of the SGPRs in dominating blocks are

This reduces the number of elements the second
loop over the function needs to look at, and makes
it generally easier to understand. The second loop
also only considers if the live range is live
in to a block, which logically means it
must have been live out from another.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245150 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IR] Give catchret an optional 'return value' operand
David Majnemer [Sat, 15 Aug 2015 02:46:08 +0000 (02:46 +0000)]
[IR] Give catchret an optional 'return value' operand

Some personality routines require funclet exit points to be clearly
marked, this is done by producing a token at the funclet pad and
consuming it at the corresponding ret instruction.  CleanupReturnInst
already had a spot for this operand but CatchReturnInst did not.
Other personality routines don't need to use this which is why it has
been made optional.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245149 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove redundant TargetFrameLowering::getFrameIndexOffset virtual
James Y Knight [Sat, 15 Aug 2015 02:32:35 +0000 (02:32 +0000)]
Remove redundant TargetFrameLowering::getFrameIndexOffset virtual

This was the same as getFrameIndexReference, but without the FrameReg

Differential Revision: http://reviews.llvm.org/D12042

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245148 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Add Relooper
JF Bastien [Sat, 15 Aug 2015 01:23:28 +0000 (01:23 +0000)]
[WebAssembly] Add Relooper

This is just an initial checkin of an implementation of the Relooper algorithm, in preparation for WebAssembly codegen to utilize. It doesn't do anything yet by itself.

The Relooper algorithm takes an arbitrary control flow graph and generates structured control flow from that, utilizing a helper variable when necessary to handle irreducibility. The WebAssembly backend will be able to use this in order to generate an AST for its binary format.

Author: azakai

Reviewers: jfb, sunfish

Subscribers: jevinskie, arsenm, jroelofs, llvm-commits

Differential revision: http://reviews.llvm.org/D11691

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245142 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAccelerate MergeFunctions with hashing
JF Bastien [Sat, 15 Aug 2015 01:18:18 +0000 (01:18 +0000)]
Accelerate MergeFunctions with hashing

This patch makes the Merge Functions pass faster by calculating and comparing
a hash value which captures the essential structure of a function before
performing a full function comparison.

The hash is calculated by hashing the function signature, then walking the basic
blocks of the function in the same order as the main comparison function. The
opcode of each instruction is hashed in sequence, which means that different
functions according to the existing total order cannot have the same hash, as
the comparison requires the opcodes of the two functions to be the same order.

The hash function is a static member of the FunctionComparator class because it
is tightly coupled to the exact comparison function used. For example, functions
which are equivalent modulo a single variant callsite might be merged by a more
aggressive MergeFunctions, and the hash function would need to be insensitive to
these differences in order to exploit this.

The hashing function uses a utility class which accumulates the values into an
internal state using a standard bit-mixing function. Note that this is a different interface
than a regular hashing routine, because the values to be hashed are scattered
amongst the properties of a llvm::Function, not linear in memory. This scheme is
fast because only one word of state needs to be kept, and the mixing function is
a few instructions.

The main runOnModule function first computes the hash of each function, and only
further processes functions which do not have a unique function hash. The hash
is also used to order the sorted function set. If the hashes differ, their
values are used to order the functions, otherwise the full comparison is done.

Both of these are helpful in speeding up MergeFunctions. Together they result in
speedups of 9% for mysqld (a mostly C application with little redundancy), 46%
for libxul in Firefox, and 117% for Chromium. (These are all LTO builds.) In all
three cases, the new speed of MergeFunctions is about half that of the module
verifier, making it relatively inexpensive even for large LTO builds with
hundreds of thousands of functions. The same functions are merged, so this
change is free performance.

Author: jrkoenig

Reviewers: nlewycky, dschuff, jfb

Subscribers: llvm-commits, aemerson

Differential revision: http://reviews.llvm.org/D11923

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245140 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMIRLangRef: Describe the syntax that is used to represent machine basic blocks.
Alex Lorenz [Sat, 15 Aug 2015 01:06:06 +0000 (01:06 +0000)]
MIRLangRef: Describe the syntax that is used to represent machine basic blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245138 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoLoopStrengthReduce: Try to pass address space to isLegalAddressingMode
Matt Arsenault [Sat, 15 Aug 2015 00:53:06 +0000 (00:53 +0000)]
LoopStrengthReduce: Try to pass address space to isLegalAddressingMode

This seems to only work some of the time. In some situations,
this seems to use a nonsensical type and isn't actually aware of the
memory being accessed. e.g. if branch condition is an icmp of a pointer,
it checks the addressing mode of i1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245137 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/SI: Fix printing useless info with amdhsa
Matt Arsenault [Sat, 15 Aug 2015 00:12:39 +0000 (00:12 +0000)]
AMDGPU/SI: Fix printing useless info with amdhsa

The comments at the bottom would all report 0 if
amdhsa was used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245135 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/SI: Update LiveVariables
Matt Arsenault [Sat, 15 Aug 2015 00:12:37 +0000 (00:12 +0000)]
AMDGPU/SI: Update LiveVariables

This is simple but won't work if/when this pass
is moved to be post-SSA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245134 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges
Matt Arsenault [Sat, 15 Aug 2015 00:12:35 +0000 (00:12 +0000)]
AMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges

Does not mark SlotIndexes as reserved, although I think
that might be OK.

LiveVariables still need to be handled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245133 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Remove unnecessary assert
Matt Arsenault [Sat, 15 Aug 2015 00:12:32 +0000 (00:12 +0000)]
AMDGPU: Remove unnecessary assert

These shouldn't ever be null. The number of successors
was already asserted to be 2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245132 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/SI: Make comments more precise.
Matt Arsenault [Sat, 15 Aug 2015 00:12:30 +0000 (00:12 +0000)]
AMDGPU/SI: Make comments more precise.

True branch instructions do behave as expected with liveness.

Avoid the phrasing "branch decision is based on a value in an SGPR"
because this could be misleading. A VALU compare instruction's
result is still based on an SGPR, even though that condition
may be divergent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245131 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agomake current codegen visible in the checks, so we can decide if it's right
Sanjay Patel [Fri, 14 Aug 2015 23:03:01 +0000 (23:03 +0000)]
make current codegen visible in the checks, so we can decide if it's right

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245120 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix a crash where a utility function wasn't aware of fcmp vectors and created a value...
Nick Lewycky [Fri, 14 Aug 2015 22:46:49 +0000 (22:46 +0000)]
Fix a crash where a utility function wasn't aware of fcmp vectors and created a value with the wrong type. Fixes PR24458!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245119 91177308-0d34-0410-b5e6-96231b3b80d8