Commit Graph

11957 Commits

Author SHA1 Message Date
Eric Christopher
48eec43fdb Revert the testcase from the previous reverted commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123227 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 09:20:44 +00:00
Chris Lattner
86099ba2b5 merge tests into one crash.ll test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123220 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 07:50:07 +00:00
Chris Lattner
93767fdb61 remove a bogus assertion: the latch block of a loop is not
neccesarily an uncond branch to the header.  This fixes 
PR8955 (the assertion tripping).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123219 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 07:47:59 +00:00
Chandler Carruth
15ed90c859 Teach constant folding to perform conversions from constant floating
point values to their integer representation through the SSE intrinsic
calls. This is the last part of a README.txt entry for which I have real
world examples.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123206 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 01:07:24 +00:00
Chandler Carruth
f7b0047f5f FileCheck-ize a test, and move a no-longer calling test case to another
file and make it actually test something...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123205 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 01:07:20 +00:00
Owen Anderson
da1c122da5 Fix a random missed optimization by making InstCombine more aggressive when determining which bits are demanded by
a comparison against a constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 00:36:45 +00:00
Eric Christopher
94bb7b561c Even if we don't have 7 bytes of stack space we may need to save and
restore the stack pointer from the frame pointer on thumbv6.

Fixes rdar://8819685


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123196 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 00:16:04 +00:00
Dale Johannesen
97fd9a58de Fix PR 8916 (qv for analysis), at least the immediate problem.
There's an inherent tension in DAGCombine between assuming
that things will be put in canonical form, and the Depth
mechanism that disables transformations when recursion gets
too deep.  It would not surprise me if there's a lot of little
bugs like this one waiting to be discovered.  The mechanism
seems fragile and I'd suggest looking at it from a design viewpoint.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123191 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 21:53:07 +00:00
Daniel Dunbar
8ab1112bdc McARM: Flush out hard coded known non-predicated mnemonic list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 21:01:03 +00:00
Chandler Carruth
9cc9f50abc Teach instcombine about the rest of the SSE and SSE2 conversion
intrinsics element dependencies. Reviewed by Nick.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123161 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 07:19:37 +00:00
Chandler Carruth
fdc8f2d260 Fold two related tests into the newly FileCheck-ized test, migrating
them to FileCheck as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123154 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 02:53:58 +00:00
Chandler Carruth
548e581dcb Clean up and FileCheck-ize a test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123153 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 02:53:54 +00:00
Chris Lattner
f86c75da4d fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123148 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 02:33:34 +00:00
Chris Lattner
a806be66c1 another (more) aggressive attempt to bring llvm-gcc-i386-linux-selfhost
back to life.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123146 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 00:47:34 +00:00
Chris Lattner
d8408270f3 temporarily disable memset formation from memsets in an effort to restore buildbot stability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123144 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 23:52:48 +00:00
Chris Lattner
e70d7c2201 add a testcase I missed in previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123143 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 23:52:31 +00:00
Tobias Grosser
aa2be84356 Instcombine: Fix pattern where the sext did not dominate the icmp using it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123121 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 16:00:11 +00:00
Chris Lattner
6d5a2411aa teach SCEV analysis of PHI nodes that PHI recurences formed
with GEP instructions are always NUW, because PHIs cannot wrap
the end of the address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 02:28:48 +00:00
Chris Lattner
f1859891b7 reduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec's
that have the bit set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-09 02:16:18 +00:00
Chris Lattner
d90a192279 Merge memsets followed by neighboring memsets and other stores into
larger memsets.  Among other things, this fixes rdar://8760394 and
allows us to handle "Example 2" from http://blog.regehr.org/archives/320,
compiling it into a single 4096-byte memset:

_mad_synth_mute:                        ## @mad_synth_mute
## BB#0:                                ## %entry
	pushq	%rax
	movl	$4096, %esi             ## imm = 0x1000
	callq	___bzero
	popq	%rax
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123089 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 21:19:19 +00:00
Chris Lattner
9fa11e94b5 fix an issue in IsPointerOffset that prevented us from recognizing that
P and P+1 are relative to the same base pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123087 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 21:07:56 +00:00
Chris Lattner
06511264f8 enhance memcpyopt to merge a store and a subsequent
memset into a single larger memset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123086 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:54:51 +00:00
Chris Lattner
355f5778aa merge two tests and filecheckify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123082 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:27:22 +00:00
Chris Lattner
5d37370a6f When loop rotation happens, it is *very* common for the duplicated condbr
to be foldable into an uncond branch.  When this happens, we can make a
much simpler CFG for the loop, which is important for nested loop cases
where we want the outer loop to be aggressively optimized.

Handle this case more aggressively.  For example, previously on
phi-duplicate.ll we would get this:


define void @test(i32 %N, double* %G) nounwind ssp {
entry:
  %cmp1 = icmp slt i64 1, 1000
  br i1 %cmp1, label %bb.nph, label %for.end

bb.nph:                                           ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %bb.nph, %for.cond
  %j.02 = phi i64 [ 1, %bb.nph ], [ %inc, %for.cond ]
  %arrayidx = getelementptr inbounds double* %G, i64 %j.02
  %tmp3 = load double* %arrayidx
  %sub = sub i64 %j.02, 1
  %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
  %tmp7 = load double* %arrayidx6
  %add = fadd double %tmp3, %tmp7
  %arrayidx10 = getelementptr inbounds double* %G, i64 %j.02
  store double %add, double* %arrayidx10
  %inc = add nsw i64 %j.02, 1
  br label %for.cond

for.cond:                                         ; preds = %for.body
  %cmp = icmp slt i64 %inc, 1000
  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge

for.cond.for.end_crit_edge:                       ; preds = %for.cond
  br label %for.end

for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry
  ret void
}

Now we get the much nicer:

define void @test(i32 %N, double* %G) nounwind ssp {
entry:
  br label %for.body

for.body:                                         ; preds = %entry, %for.body
  %j.01 = phi i64 [ 1, %entry ], [ %inc, %for.body ]
  %arrayidx = getelementptr inbounds double* %G, i64 %j.01
  %tmp3 = load double* %arrayidx
  %sub = sub i64 %j.01, 1
  %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
  %tmp7 = load double* %arrayidx6
  %add = fadd double %tmp3, %tmp7
  %arrayidx10 = getelementptr inbounds double* %G, i64 %j.01
  store double %add, double* %arrayidx10
  %inc = add nsw i64 %j.01, 1
  %cmp = icmp slt i64 %inc, 1000
  br i1 %cmp, label %for.body, label %for.end

for.end:                                          ; preds = %for.body
  ret void
}

With all of these recent changes, we are now able to compile:

void foo(char *X) {
 for (int i = 0; i != 100; ++i) 
   for (int j = 0; j != 100; ++j)
     X[j+i*100] = 0;
}

into a single memset of 10000 bytes.  This series of changes
should also be helpful for other nested loop scenarios as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123079 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 19:59:06 +00:00
Chris Lattner
0e4a1543ab Three major changes:
1. Rip out LoopRotate's domfrontier updating code.  It isn't
   needed now that LICM doesn't use DF and it is super complex
   and gross.
2. Make DomTree updating code a lot simpler and faster.  The 
   old loop over all the blocks was just to find a block??
3. Change the code that inserts the new preheader to just use
   SplitCriticalEdge instead of doing an overcomplex 
   reimplementation of it.

No behavior change, except for the name of the inserted preheader.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123072 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 18:52:51 +00:00
Rafael Espindola
bea4626f93 First step in fixing PR8927:
Add a unnamed_addr bit to global variables and functions. This will be used
to indicate that the address is not significant and therefore the constant
or function can be merged with others.

If an optimization pass can show that an address is not used, it can set this.

Examples of things that can have this set by the FE are globals created to
hold string literals and C++ constructors.

Adding unnamed_addr to a non-const global should have no effect unless
an optimization can transform that global into a constant.

Aliases are not allowed to have unnamed_addr since I couldn't figure
out any use for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 16:42:36 +00:00
Frits van Bommel
b686eb9186 Fix a bug in r123034 (trying to sext/zext non-integers) and clean up a little.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123061 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 10:51:36 +00:00
Chris Lattner
d9ec3572f3 Have loop-rotate simplify instructions (yay instsimplify!) as it clones
them into the loop preheader, eliminating silly instructions like
"icmp i32 0, 100" in fixed tripcount loops.  This also better exposes the 
bigger problem with loop rotate that I'd like to fix: once this has been
folded, the duplicated conditional branch *often* turns into an uncond branch.

Not aggressively handling this is pessimizing later loop optimizations 
somethin' fierce by making "dominates all exit blocks" checks fail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123060 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 08:24:46 +00:00
Evan Cheng
55d4200336 Recognize inline asm 'rev /bin/bash, ' as a bswap intrinsic call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123048 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 01:24:27 +00:00
Evan Cheng
c36b7069b4 Do not model all INLINEASM instructions as having unmodelled side effects.
Instead encode llvm IR level property "HasSideEffects" in an operand (shared
with IsAlignStack). Added MachineInstrs::hasUnmodeledSideEffects() to check
the operand when the instruction is an INLINEASM.

This allows memory instructions to be moved around INLINEASM instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123044 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 23:50:32 +00:00
Devang Patel
51a666f0e5 Speculatively revert r123032.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123039 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 22:33:41 +00:00
Bob Wilson
11a1dfffc8 Lower some BUILD_VECTORS using VEXT+shuffle.
Patch by Tim Northover.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:37:30 +00:00
Tobias Grosser
46431d7a93 InstCombine: Match min/max hidden by sext/zext
X = sext x; x >s c ? X : C+1 --> X = sext x; X <s C+1 ? C+1 : X
X = sext x; x <s c ? X : C-1 --> X = sext x; X >s C-1 ? C-1 : X
X = zext x; x >u c ? X : C+1 --> X = zext x; X <u C+1 ? C+1 : X
X = zext x; x <u c ? X : C-1 --> X = zext x; X >u C-1 ? C-1 : X
X = sext x; x >u c ? X : C+1 --> X = sext x; X <u C+1 ? C+1 : X
X = sext x; x <u c ? X : C-1 --> X = sext x; X >u C-1 ? C-1 : X

Instead of calculating this with mixed types promote all to the
larger type. This enables scalar evolution to analyze this
expression. PR8866

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123034 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:33:14 +00:00
Devang Patel
1dea232624 Appropriately truncate debug info range in dwarf output.
Enable live debug variables pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 21:30:41 +00:00
Benjamin Kramer
eaff66a895 Revert 122959, it needs more thought. Add it back to README.txt with additional notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123030 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 20:42:20 +00:00
Evan Cheng
a5e1362f96 Revert r122955. It seems using movups to lower memcpy can cause massive regression (even on Nehalem) in edge cases. I also didn't see any real performance benefit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123015 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 19:35:30 +00:00
David Greene
1434f66b2e Rename lisp-like functions as suggested by Gabor Greif as loooong time
ago.  This is both easier to learn and easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123001 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 17:05:37 +00:00
Benjamin Kramer
50dd09bd85 Try to unbreak the arm buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122999 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 11:35:21 +00:00
Bob Wilson
8a644f4f6f Add testcases for PR8411 (vget_low and vget_high implemented as shuffles).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122997 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 06:44:14 +00:00
Bob Wilson
5e8b833707 Add ARM patterns to match EXTRACT_SUBVECTOR nodes.
Also fix an off-by-one in SelectionDAGBuilder that was preventing shuffle
vectors from being translated to EXTRACT_SUBVECTOR.
Patch by Tim Northover.

The test changes are needed to keep those spill-q tests from testing aligned
spills and restores.  If the only aligned stack objects are spill slots, we
no longer realign the stack frame.  Prior to this patch, an EXTRACT_SUBVECTOR
was legalized by loading from the stack, which created an aligned frame index.
Now, however, there is nothing except the spill slot in the stack frame, so
I added an aligned alloca.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 04:59:04 +00:00
Duncan Sands
d9aa80038f Fix the other problem reported in PR8582. Testcase and patch by
Nadav Rotem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122983 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 23:45:22 +00:00
Duncan Sands
1f2b00c710 Add a testcase for PR8582, which mysteriously fixed itself, in case the problem
comes back some day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122982 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 23:04:29 +00:00
Bob Wilson
6819dbb6f8 PR8921: LDM/POP do not support interworking prior to v5t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 19:24:41 +00:00
Rafael Espindola
2f867a63da Correctly disassemble truncated asm.
Patch by Richard Simth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 16:48:42 +00:00
Benjamin Kramer
8143a84c46 InstCombine: Turn _chk functions into the "unsafe" variant if length and max langth are equal.
This happens when we take the (non-constant) length from a malloc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 14:22:52 +00:00
Benjamin Kramer
240d42d185 InstCombine: If we call llvm.objectsize on a malloc call we can replace it with the size passed to malloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122959 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 13:11:05 +00:00
Benjamin Kramer
783a5c2b69 InstCombine: Teach llvm.objectsize folding to look through GEPs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 13:07:49 +00:00
Evan Cheng
461f1fc359 Use movups to lower memcpy and memset even if it's not fast (like corei7).
The theory is it's still faster than a pair of movq / a quad of movl. This
will probably hurt older chips like P4 but should run faster on current
and future Intel processors. rdar://8817010


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122955 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 07:58:36 +00:00
Evan Cheng
0521928ae7 Re-implement r122936 with proper target hooks. Now getMaxStoresPerMemcpy
etc. takes an option OptSize. If OptSize is true, it would return
the inline limit for functions with attribute OptSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:52:41 +00:00
Chris Lattner
8cd4efb6a5 implement constant folding support for an exotic constant expr:
ret i64 ptrtoint (i8* getelementptr ([1000 x i8]* @X, i64 1, i64 sub (i64 0, i64 ptrtoint ([1000 x i8]* @X to i64))) to i64)

to "ret i64 1000".  This allows us to correctly compute the trip count
on a loop in PR8883, which occurs with std::fill on a char array.  This
allows us to transform it into a memset with a constant size.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122950 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 06:19:46 +00:00