aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms
AgeCommit message (Collapse)Author
2010-08-30Combine these two tests, and make sure there's a newline at the end of the file.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112554 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30Correct bogus module triple specifications.Duncan Sands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29LICM does get dead instructions input to it. Instead of sinking themChris Lattner
out of loops, just delete them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28remove the ABCD and SSI passes. They don't have any clients thatChris Lattner
I'm aware of, aren't maintained, and LVI will be replacing their value. nlewycky approved this on irc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28handle the constant case of vector insertion. For somethingChris Lattner
like this: struct S { float A, B, C, D; }; struct S g; struct S bar() { struct S A = g; ++A.B; A.A = 42; return A; } we now generate: _bar: ## @bar ## BB#0: ## %entry movq _g@GOTPCREL(%rip), %rax movss 12(%rax), %xmm0 pshufd $16, %xmm0, %xmm0 movss 4(%rax), %xmm2 movss 8(%rax), %xmm1 pshufd $16, %xmm1, %xmm1 unpcklps %xmm0, %xmm1 addss LCPI1_0(%rip), %xmm2 pshufd $16, %xmm2, %xmm2 movss LCPI1_1(%rip), %xmm0 pshufd $16, %xmm0, %xmm0 unpcklps %xmm2, %xmm0 ret instead of: _bar: ## @bar ## BB#0: ## %entry movq _g@GOTPCREL(%rip), %rax movss 12(%rax), %xmm0 pshufd $16, %xmm0, %xmm0 movss 4(%rax), %xmm2 movss 8(%rax), %xmm1 pshufd $16, %xmm1, %xmm1 unpcklps %xmm0, %xmm1 addss LCPI1_0(%rip), %xmm2 movd %xmm2, %eax shlq $32, %rax addq $1109917696, %rax ## imm = 0x42280000 movd %rax, %xmm0 ret git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112345 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28optimize bitcasts from large integers to vector into vectorChris Lattner
element insertion from the pieces that feed into the vector. This handles a pattern that occurs frequently due to code generated for the x86-64 abi. We now compile something like this: struct S { float A, B, C, D; }; struct S g; struct S bar() { struct S A = g; ++A.A; ++A.C; return A; } into all nice vector operations: _bar: ## @bar ## BB#0: ## %entry movq _g@GOTPCREL(%rip), %rax movss LCPI1_0(%rip), %xmm1 movss (%rax), %xmm0 addss %xmm1, %xmm0 pshufd $16, %xmm0, %xmm0 movss 4(%rax), %xmm2 movss 12(%rax), %xmm3 pshufd $16, %xmm2, %xmm2 unpcklps %xmm2, %xmm0 addss 8(%rax), %xmm1 pshufd $16, %xmm1, %xmm1 pshufd $16, %xmm3, %xmm2 unpcklps %xmm2, %xmm1 ret instead of icky integer operations: _bar: ## @bar movq _g@GOTPCREL(%rip), %rax movss LCPI1_0(%rip), %xmm1 movss (%rax), %xmm0 addss %xmm1, %xmm0 movd %xmm0, %ecx movl 4(%rax), %edx movl 12(%rax), %esi shlq $32, %rdx addq %rcx, %rdx movd %rdx, %xmm0 addss 8(%rax), %xmm1 movd %xmm1, %eax shlq $32, %rsi addq %rax, %rsi movd %rsi, %xmm1 ret This resolves rdar://8360454 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Add a prototype of a new peephole optimizing pass that uses LazyValue info ↵Owen Anderson
to simplify PHIs and select's. This pass addresses the missed optimizations from PR2581 and PR4420. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112325 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27tidy up test.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112321 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Enhance the shift propagator to handle the case when you have:Chris Lattner
A = shl x, 42 ... B = lshr ..., 38 which can be transformed into: A = shl x, 4 ... iff we can prove that the would-be-shifted-in bits are already zero. This eliminates two shifts in the testcase and allows eliminate of the whole i128 chain in the real example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Implement a pretty general logical shift propagationChris Lattner
framework, which is good at ripping through bitfield operations. This generalize a bunch of the existing xforms that instcombine does, such as (x << c) >> c -> and to handle intermediate logical nodes. This is useful for ripping up the "promote to large integer" code produced by SRoA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27merge and filecheckize testChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27merge two testsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112288 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27teach the truncation optimization that an entire chain ofChris Lattner
computation can be truncated if it is fed by a sext/zext that doesn't have to be exactly equal to the truncation result type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Add an instcombine to clean up a common pattern producedChris Lattner
by the SRoA "promote to large integer" code, eliminating some type conversions like this: %94 = zext i16 %93 to i32 ; <i32> [#uses=2] %96 = lshr i32 %94, 8 ; <i32> [#uses=1] %101 = trunc i32 %96 to i8 ; <i8> [#uses=1] This also unblocks other xforms from happening, now clang is able to compile: struct S { float A, B, C, D; }; float foo(struct S A) { return A.A + A.B+A.C+A.D; } into: _foo: ## @foo ## BB#0: ## %entry pshufd $1, %xmm0, %xmm2 addss %xmm0, %xmm2 movdqa %xmm1, %xmm3 addss %xmm2, %xmm3 pshufd $1, %xmm1, %xmm0 addss %xmm3, %xmm0 ret on x86-64, instead of: _foo: ## @foo ## BB#0: ## %entry movd %xmm0, %rax shrq $32, %rax movd %eax, %xmm2 addss %xmm0, %xmm2 movapd %xmm1, %xmm3 addss %xmm2, %xmm3 movd %xmm1, %rax shrq $32, %rax movd %eax, %xmm0 addss %xmm3, %xmm0 ret This seems pretty close to optimal to me, at least without using horizontal adds. This also triggers in lots of other code, including SPEC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Use LVI to eliminate conditional branches where we've tested a related ↵Owen Anderson
condition previously. Update tests for this change. This fixes PR5652. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26filecheckizeChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26rename test.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26optimize "integer extraction out of the middle of a vector" as producedChris Lattner
by SRoA. This is part of rdar://7892780, but needs another xform to expose this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26optimize bitcast(trunc(bitcast(x))) where the result is a float and 'x'Chris Lattner
is a vector to be a vector element extraction. This allows clang to compile: struct S { float A, B, C, D; }; float foo(struct S A) { return A.A + A.B+A.C+A.D; } into: _foo: ## @foo ## BB#0: ## %entry movd %xmm0, %rax shrq $32, %rax movd %eax, %xmm2 addss %xmm0, %xmm2 movapd %xmm1, %xmm3 addss %xmm2, %xmm3 movd %xmm1, %rax shrq $32, %rax movd %eax, %xmm0 addss %xmm3, %xmm0 ret instead of: _foo: ## @foo ## BB#0: ## %entry movd %xmm0, %rax movd %eax, %xmm0 shrq $32, %rax movd %eax, %xmm2 addss %xmm0, %xmm2 movd %xmm1, %rax movd %eax, %xmm1 addss %xmm2, %xmm1 shrq $32, %rax movd %eax, %xmm0 addss %xmm1, %xmm0 ret ... eliminating half of the horribleness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26filecheckizeChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26rename testChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26Make JumpThreading smart enough to properly thread StrSwitch when it's ↵Owen Anderson
compiled with clang++. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112198 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25DIGlobalVariable can be used to encode debug info for globals that are ↵Devang Patel
directly folded into a constant by FE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25In the default address space, any GEP off of null results in a trap value if ↵Owen Anderson
you try to load it. Thus, any load in the default address space that completes implies that the base value that it GEP'd from was not null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112015 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Re-apply r111568 with a fix for the clang self-host.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19Previous revert failed to remove this file.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19Revert r111568 to unbreak clang self-host.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111571 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19When a set of bitmask operations, typically from a bitfield initialization, ↵Owen Anderson
only modifies the low bytes of a value, we can narrow the store to only over-write the affected bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111568 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19Fixed and reactivated a partial specialization testKenneth Uildriks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18Fix PR7755: knowing something about an inval for a predChris Lattner
from the LHS should disable reconsidering that pred on the RHS. However, knowing something about the pred on the RHS shouldn't disable subsequent additions on the RHS from happening. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111349 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17Temporarily revert r110987 as it's causing some miscompares inEric Christopher
vector heavy code. I'll re-enable when we've tracked down the problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111318 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17When rotating loops, put the original header at the bottom of theDan Gohman
loop, making the resulting loop significantly less ugly. Also, zap its trivial PHI nodes, since it's easy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Instead, teach SimplifyCFG to trim non-address-taken blocks fromDan Gohman
indirectbr destination lists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14LoopSimplify shouldn't split loop backedges that use indirectbr. PR7867.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14Teach SimplifyCFG how to simplify indirectbr instructions.Dan Gohman
- Eliminate redundant successors. - Convert an indirectbr with one successor into a direct branch. Also, generalize SimplifyCFG to be able to be run on a function entry block. It knows quite a few simplifications which are applicable to the entry block, and it only needs a few checks to avoid trouble with the entry block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13Reapply this transformation now that it is passing the external test which ↵Nate Begeman
it previously failed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12fix PR7876: If ipsccp decides that a function's address is takenChris Lattner
before it rewrites the code, we need to use that in the post-rewrite pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Temporarily revert 110737 and 110734, they were causing failuresEric Christopher
in an external testsuite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10Add test for recent instcombine vector shuffle enhancementNate Begeman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09PR7853: fix a silly mistake introduced in r101899, and add a test to make sureEli Friedman
it doesn't regress again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110597 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Move x86-specific tests out of test/Transforms/LoopStrengthReduce andDan Gohman
into test/CodeGen/X86, so that they aren't run when the x86 target is not enabled. Fix uglygep.ll to not be x86-specific. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Make instcombine set explicit alignments on load or storeDan Gohman
instructions with alignment 0, so that subsequent passes don't need to bother checking the TargetData ABI size manually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110128 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Add an atomic lowering passPeter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Re-apply the infamous r108614, with a fix pointed out by Dirk Steinke.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-31Speculatively revert r108614, "Another attempt at getting the clang self-host toDaniel Dunbar
like my instcombine patch.", in an attempt to fix Clang i386 bootstrap. - Also PR7719. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26Fix a test with malformed IR. Not sure why this didn't fail before.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26Fix SCEVExpander::visitAddRecExpr so that it remembers the induction variableDan Gohman
it inserted rather than using LoopInfo::getCanonicalInductionVariable to rediscover it, since that doesn't work on non-canonical loops. This fixes infinite recurrsion on such loops; PR7562. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26Avoid depending on LCSSA implicitly pulling in LoopSimplify.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19Testcase for r108687.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108689 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-17Another attempt at getting the clang self-host to like my instcombine patch.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108614 91177308-0d34-0410-b5e6-96231b3b80d8