Commit Graph

5721 Commits

Author SHA1 Message Date
Dan Gohman
865db4566e Add an extra example that shouldn't get an and instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 02:23:06 +00:00
Dan Gohman
8a1510d192 Re-introduce the 8-bit subreg zext-inreg patterns for x86-32,
this time using MOV32to32_ and MOV16to16_. Thanks to Evan for
suggesting this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:27:21 +00:00
Dan Gohman
4ce9627e97 Fix a shufflevector instcombine that was emitting invalid masks indices
when it meant to be emitting undef indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:17:32 +00:00
Evan Cheng
d756f8820a PR2535, not PR2355.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54416 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:06:48 +00:00
Evan Cheng
f5e25f32c7 Fix PR2355: bug in ChangeCompareStride. When the loop termination compare is the only use of its iv stride, the stride can be eliminated by moving it to another stride. If the scale is negative, swap the predicate instead of using a inverse predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:04:43 +00:00
Chris Lattner
46bbad217b optimize a common idiom generated by clang for bitfield access, PR2638.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 07:35:52 +00:00
Chris Lattner
5af5f463e1 Zap sitofp/fptoui pairs. In all cases when the sign difference
matters, the result is undefined anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 05:13:06 +00:00
Nick Lewycky
b30591ec64 Reinstate this optimization, but without the miscompile. Thanks to Bill for
tracking down that this was breaking llvm-gcc bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 04:54:03 +00:00
Bill Wendling
5226698f67 Just grep for through the LL code instead of the ASM code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 00:10:32 +00:00
Bill Wendling
201bf25f83 Add default architecture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 23:36:00 +00:00
Bill Wendling
0b101b0399 Testcase for PR2629.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 22:23:59 +00:00
Evan Cheng
e9d5035838 Fix PR2620: Fix X86cmppd selection code so it expects operands to be v2f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 22:19:15 +00:00
Evan Cheng
e3b8a48d32 Fix PR2596: out of bound reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:51:46 +00:00
Bill Wendling
021507be82 Revert r53282. This was causing a miscompile on Linux. Also, the transformation
looks bogus. Please see PR2629 for details on why this is breaking things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:23:45 +00:00
Owen Anderson
b6634e9e27 Update the remaining tests not to use -disable-correct-folding, and remove two
that couldn't be updated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:19:14 +00:00
Owen Anderson
551ddf718c One more -disable-correct-folding case removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:08:56 +00:00
Owen Anderson
2a1f07ea6a Remove another -disable-correct-folding use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:05:58 +00:00
Owen Anderson
d6db225800 Eliminate another use of -disable-correct-folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:03:01 +00:00
Owen Anderson
287b7b7ed7 This check is unnecessary, and getting rid of it removes a use of -disable-correct-folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 17:52:54 +00:00
Owen Anderson
3888aa0b7d Remove the need for -disable-correct-folding from this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 17:49:52 +00:00
Dan Gohman
c3be0fd8c3 Fix the AsmWriter to not print extra spaces after parameter attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 15:51:44 +00:00
Evan Cheng
068b4ff553 Fix PR2568: Fix bug that cause redudant kill marker after its live interval has been extended due to coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 07:10:38 +00:00
Owen Anderson
2b85dc3544 Update these tests to work by disabling the new correct CFG generation. This flag should ONLY be used to for tests like these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:55:29 +00:00
Eli Friedman
b42a626122 PR2621: Improvements to the SCEV AddRec binomial expansion. This
version uses a new algorithm for evaluating the binomial coefficients 
which is significantly more efficient for AddRecs of more than 2 terms 
(see the comments in the code for details on how the algorithm works).  
It also fixes some bugs: it removes the arbitrary length restriction for 
AddRecs, it fixes the silent generation of incorrect code for AddRecs 
which require a wide calculation width, and it fixes an issue where we 
were incorrectly truncating the iteration count too far when evaluating 
an AddRec expression narrower than the induction variable.

There are still a few related issues I know of: I think there's 
still an issue with the SCEVExpander expansion of AddRec in terms of
the width of the induction variable used.  The hack to avoid generating 
too-wide integers shouldn't be necessary; instead, the callers should be 
considering the cost of the expansion before expanding it (in addition 
to not expanding too-wide integers, we might not want to expand 
expressions that are really expensive, especially when optimizing for 
size; calculating an length-17 32-bit AddRec currently generates about 250 
instructions of straight-line code on X86).  Also, for long 32-bit 
AddRecs on X86, CodeGen really sucks at scheduling the code.  I'm planning on 
filing follow-up PRs for these issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:49:06 +00:00
Dan Gohman
6f498b0a8e Fix SDISel lowering of PHI nodes to use ComputeValueVTs.
This allows it to work correctly on aggregate values.
This fixes PR2623.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:42:46 +00:00
Dan Gohman
1f565bcff6 Fix SDISel lowering of zeroinitializer and undef to use ComputeValueVTs.
This allows it to work correctly on nested aggregate values.
This fixes PR2625.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:30:41 +00:00
Dale Johannesen
3b4c45203e Make sse2 explicit, for non-x86 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 20:16:33 +00:00
Dan Gohman
75dcf08243 Improve dagcombining for sext-loads and sext-in-reg nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 00:50:31 +00:00
Dan Gohman
90d33ee746 Don't look for leaf values to store when lowering stores of
empty structs. This fixes PR2612.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:36:51 +00:00
Dan Gohman
1053502486 I missed this file in r54223. movzbl is now used instead
of movzbw here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:23:34 +00:00
Dan Gohman
11ba3b1af6 Reapply r54147 with a constraint to only use the 8-bit
subreg form on x86-64, to avoid the problem with x86-32
having GPRs that don't have 8-bit subregs.

Also, change several 16-bit instructions to use 
equivalent 32-bit instructions. These have a smaller
encoding and avoid partial-register updates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:09:17 +00:00
Mon P Wang
e3b3a7241c Added support for overloading intrinsics (atomics) based on pointers
to different address spaces.  This alters the naming scheme for those
intrinsics, e.g., atomic.load.add.i32 => atomic.load.add.i32.p0i32


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 04:36:53 +00:00
Eli Friedman
1fbffe0cef Another SCEV issue from PR2607; essentially the same issue, but this
time applying to the implicit comparison in smin expressions. The 
correct way to transform an inequality into the opposite 
inequality, either signed or unsigned, is with a not expression.

I looked through the SCEV code, and I don't think there are any more 
occurrences of this issue.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 04:36:32 +00:00
Eli Friedman
068acc3caa Fix for PR2607: SCEV miscomputing the loop count for loops with an
SGT exit condition.  Essentially, the correct way to flip an inequality 
in 2's complement is the not operator, not the negation operator.  
That said, the difference only affects cases involving INT_MIN.

Also, enhance the pre-test search logic to be a bit smarter about 
inequalities flipped with a not operator, so it can eliminate the smax 
from the iteration count for simple loops.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:04:08 +00:00
Duncan Sands
68d4d1d49c Fix PR2609. If a label is deleted, then it needs
to be marked invalid regardless of whether it is
a debug, an exception handling or (hopefully) a
GC label.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 20:56:02 +00:00
Nate Begeman
5bc1ea0736 Add vector shifts to the IR, patch by Eli Friedman.
CodeGen & Clang work coming next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 15:49:41 +00:00
Matthijs Kooijman
75cf9cc527 Add -unroll-allow-partial command line option that enabled the loop unroller to
partially unroll a loop when fully unrolling would not fit under the threshold.

Patch by Mikael Lepistö.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 13:21:23 +00:00
Matthijs Kooijman
477f5a2f11 Restructure ArgumentPromotion a bit. Instead of just having a single boolean
that says "unconditional loads from this argument are safe", we now keep track
of the safety per set of indices from which loads happen. This prevents
ArgPromotion from promoting loads that aren't really valid. As an added effect,
this will now disregard the the type of the indices passed to a GEP, so
"load GEP %A, i32 1" and "load GEP %A, i64 1" will result in a single argument,
not two.

This fixes PR2598, for which a testcase has been added as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 10:00:13 +00:00
Dan Gohman
7ba145b0b4 Revert 54147.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 01:02:18 +00:00
Dan Gohman
b1e8cad61e Add x86 isel patterns to match what would be a ZERO_EXTEND_INREG operation,
which is represented in codegen as an 'and' operation. This matches them
with movz instructions, instead of leaving them to be matched by and
instructions with an immediate field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54147 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 22:18:25 +00:00
Duncan Sands
ecf4fa2744 Test this differently: I saw this test fail
because opt exited while llvm-as was still
writing to the pipe, causing it to get a
SIGPIPE.  It seems best to change things to
avoid the race altogether.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 19:09:01 +00:00
Dan Gohman
171f3dcff1 Fix a bashism in TestRunner.sh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 18:41:03 +00:00
Owen Anderson
8aa895b19a Add support for eliminating stores that store the same value that was just loaded.
This fixes PR2599.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 16:14:26 +00:00
Dan Gohman
6c4942641f Fix embedded CRLF characters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 18:37:58 +00:00
Nate Begeman
907f46a81f Fix test RUN line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:08:59 +00:00
Nate Begeman
fb8ead0c20 Disable mov{L, LP, HP, HLP, *DUP} shuffles for mmx
mmx needs its own fancy shuffle logic based on unpack; for now we get correct but awful code.

Also commit Mon Ping's VSETCC patch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:05:58 +00:00
Dan Gohman
1f335e3139 This test needs -aggressive-remat enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54015 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 15:25:32 +00:00
Evan Cheng
d1b3da621b Teach ARM isLegalAddressingMode to handle unknown type without crashing. This fixes pr2589.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:55:17 +00:00
Dan Gohman
6d69ba8a69 Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow
constants to be rematerialized in PIC mode -- the extra indirection is a
complication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:02:30 +00:00
Dan Gohman
3eee6542f5 Put the LICM of constant GlobalVariables, introduced in r53945, under a
command-line option, and disable it by default. It introduced performance
regressions because CodeGen is currently not able to remat such loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 23:57:25 +00:00
Dan Gohman
5444c30723 Add target triples so these tests behave as expected on non-darwin hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 18:08:01 +00:00
Evan Cheng
982a05955a Fix a catastrophic PPC64 ABI bug: i32 operands which are passed in memory (all of the parameter registers are used) are loaded from sp offsets that were off by 4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53979 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 08:17:07 +00:00
Evan Cheng
2d58bfac59 New test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 00:22:05 +00:00
Chris Lattner
967948b4e2 "Allow LICM to sink or lift loads from constant memory. Also add a test
case for this.

This allows instructions like loads from global variables declared to
be constant to be moved out of loops."

Patch by Stefanus Du Toit!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53945 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 05:06:28 +00:00
Dan Gohman
fc74abfba5 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:34:11 +00:00
Evan Cheng
5e6ebaf4d1 Fix PR2485: do all 4-element SSE shuffles in max. of 2 shuffle instructions.
Based on patch by Nicolas Capens.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:22:17 +00:00
Duncan Sands
11e56cb4dc LegalizeTypes support for VSETCC. Fixes PR2575.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 23:54:03 +00:00
Evan Cheng
2925786765 Fix pr2566: incorrect assumption about bit_convert. It doesn't not have to output a vector value. Patch by Nicolas Capens!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:42:56 +00:00
Evan Cheng
52672b813e Fix PR2574: implement v2f32 scalar_to_vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 18:39:19 +00:00
Dan Gohman
1d8973b499 Add the PR number to the test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53880 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:50:25 +00:00
Dan Gohman
7375fbcbf2 Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain that
leads into a cycle involving a different PHI, LSR got stuck running
around that cycle looking for the original PHI. To avoid this, keep
track of visited PHIs and stop searching if we see one more than once.
This fixes PR2570.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:45:02 +00:00
Wojciech Matyjewicz
de0f2382e4 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 15:55:14 +00:00
Bill Wendling
3180e20cda Fix for first part of PR2562. Generate the "pinsrw" instruction for inserts
into v4i16 vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 02:32:23 +00:00
Nick Lewycky
e637727bed XFAIL this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 15:52:06 +00:00
Wojciech Matyjewicz
5c779a46b0 While testing particular algorithms to compute loop iteration count the brute
force evaluation (ComputeIterationCountExhaustively) should be turned off.

It doesn't apply to trip-count2.ll because this file tests the brute force
evaluation.

The test for PR2364 (2008-05-25-NegativeStepToZero.ll) currently fails
showing that the patch for this bug doesn't work. I'll fix it in a few hours
with a patch for PR2088.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:26:15 +00:00
Anton Korobeynikov
33500e5882 Testcase for PR2549
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53785 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 06:31:12 +00:00
Duncan Sands
c3e26727c1 Softfloat support for FDIV. Patch by
Richard Pennington.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:18:48 +00:00
Dan Gohman
5a11abaf2c In the CBackend, use casts to force integer add, subtract, and
multiply to be done as unsigned, so that they have well defined
behavior on overflow. This fixes PR2408.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:43:12 +00:00
Evan Cheng
76a4d58998 Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:53 +00:00
Evan Cheng
d1718252b5 Add nounwind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:04 +00:00
Dan Gohman
e8be6c6391 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53728 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:10:17 +00:00
Duncan Sands
79ada108dd LegalizeTypes support for what seems to be the
only missing ppc long double operations: FNEG
and FP_EXTEND.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:35:14 +00:00
Duncan Sands
f00e74f4d6 Turn LegalizeTypes back off again for the moment:
it is breaking Darwin bootstrap due to missing
functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:06:03 +00:00
Matthijs Kooijman
bc1f989e3c Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 11:59:53 +00:00
Chris Lattner
d137ab4783 Fix PR2553
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 06:07:20 +00:00
Duncan Sands
95db39a9de Add support for promoting and expanding AssertZext
and AssertSext.  Needed when passing huge integer
parameters with the zeroext or signext attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:03:07 +00:00
Duncan Sands
836b3e63bd Test passing of integer parameters for integers
of all sizes from i1 to i256.  The code is not
always that great, for example (x86)
        movw    %di, %ax
        movw    %ax, i17_s
where the store could be directly from %di.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 13:37:36 +00:00
Duncan Sands
8b5e62f0db Test codegen of loads and stores of all integer
sizes from i1 to i256.  The generated code is
like one huge bug report of things that the DAG
combiner fails to simplify!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 13:10:20 +00:00
Matthijs Kooijman
d8b4d60490 Add a few cases to instcombine's extractvalue testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53675 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 12:57:25 +00:00
Matthijs Kooijman
5f0028e211 Un-XFAIL multdeadretval, since instcombine now properly handles the mess deadargelim leaves behind :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 12:56:52 +00:00
Duncan Sands
7f1d8aeef6 Turn on LegalizeTypes by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 11:36:51 +00:00
Duncan Sands
17991c3234 The atomic.cmp.swap promotion logic is wrong: it
simply does the atomic.cmp.swap on the larger type,
which means it blows away whatever is sitting in
the bytes just after the memory location, i.e.
causes a buffer overflow.  This really requires
target specific code, which is why LegalizeTypes
doesn't try to handle this case generically.  The
existing (wrong) code in LegalizeDAG will go away
automatically once the type legalization code is
removed from LegalizeDAG so I'm leaving it there
for the moment.  Meanwhile, don't test for this
feature.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53669 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 08:09:48 +00:00
Evan Cheng
be8efa54b6 Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 07:28:14 +00:00
Matthijs Kooijman
b79d2a6bfa XFAIL the multdeadretval test for now, I will be fixing instcombine to make it work again tomorrow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53614 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 16:05:09 +00:00
Duncan Sands
295a7cddbd LegalizeTypes support for fabs on ppc long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 15:02:44 +00:00
Matthijs Kooijman
790dd75b97 Remove a few tests which no longer hold for deadargelim (since it is now
allowed to canonicalize return values).

Add a test that checks if return value and function attributes are not removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53612 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:57:01 +00:00
Matthijs Kooijman
2439911ac5 Add a testcase for the canonicalizations now performed by deadargelim.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:42:58 +00:00
Matthijs Kooijman
eb32b453b3 Make deadargelim a bit less smart, so it doesn't choke on nested structs as
return values that are still (partially) live. Instead of updating all uses of
a call instruction after removing some elements, it now just rebuilds the
original struct (With undef gaps where the unused values were) and leaves it to
instcombine to clean this up.

The added testcase still fails currently, but this is due to instcombine which
isn't good enough yet. I will fix that part next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:03:10 +00:00
Matthijs Kooijman
ae15ddf61b Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 13:15:10 +00:00
Duncan Sands
c07e6e53f7 LegalizeTypes support for promotion of bswap.
In LegalizeDAG the value is zero-extended to
the new type before byte swapping.  It doesn't
matter how the extension is done since the new
bits are shifted off anyway after the swap, so
extend by any old rubbish bits.  This results
in the final assembler for the testcase being
one line shorter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:18:22 +00:00
Duncan Sands
8d56a6f4d8 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:14:24 +00:00
Chris Lattner
6157e383c4 Reimplement LinkFunctionProtos in terms of GetLinkageResult. This fixes
the second half of link-global-to-func.ll and causes some minor changes in
messages.

There are two TODOs here.  First, this causes a regression in 
2008-07-06-AliasWeakDest.ll, which is now failing (so I xfailed it).  Anton,
I would really appreciate it if you could take a look at this.  It should be
a matter of adding proper alias support to GetLinkageResult, and was probably
already a latent bug that would manifest with globals.

The second todo is to reimplement LinkAlias in the same pattern as 
function and global linking.  This should be pretty straight-forward for 
someone who knows aliases, but isn't a requirement for correctness.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 07:23:24 +00:00
Chris Lattner
d1ec48c641 implement linking of globals to functions, in one direction
(replacing a function with a global).  This is needed when building
llvm itself with LTO on darwin, because of the EXPLICIT_SYMBOL hack
in lib/system/DynamicLibrary.cpp.

Implementation of linking the other way will need to wait for a 
cleanup of LinkFunctionProtos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 06:49:45 +00:00
Chris Lattner
bbedb0e408 Fix a bunch of bugs handling vector compare constant expressions, fixing
PR2317.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 05:17:31 +00:00
Chris Lattner
fdb19e5887 Fix PR2506 by being a bit more careful about reverse fact propagation when
disproving a condition.  This actually compiles the existing testcase
(udiv_select_to_select_shift) to:

define i64 @test(i64 %X, i1 %Cond) {
entry:
	%divisor1.t = lshr i64 %X, 3		; <i64> [#uses=1]
	%quotient2 = lshr i64 %X, 3		; <i64> [#uses=1]
	%sum = add i64 %divisor1.t, %quotient2		; <i64> [#uses=1]
	ret i64 %sum
}

instead of:

define i64 @test(i64 %X, i1 %Cond) {
entry:
	%quotient1.v = select i1 %Cond, i64 3, i64 4		; <i64> [#uses=1]
	%quotient1 = lshr i64 %X, %quotient1.v		; <i64> [#uses=1]
	%quotient2 = lshr i64 %X, 3		; <i64> [#uses=1]
	%sum = add i64 %quotient1, %quotient2		; <i64> [#uses=1]
	ret i64 %sum
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:15:52 +00:00
Chris Lattner
093a438502 Fix mishandling of the infinite loop case when merging two blocks. This
fixes PR2540.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 22:23:11 +00:00
Nick Lewycky
59cff12f88 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 07:41:32 +00:00
Nick Lewycky
3ac9e109b2 Enhance analysis of srem.
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 05:04:38 +00:00
Evan Cheng
79a796c2b1 Fix PR2536: a nasty spiller bug. If a two-address instruction uses a register but the use portion of its live range is not part of its liveinterval, it must be defined by an implicit_def. In that case, do not spill the use. e.g.
8   %reg1024<def> = IMPLICIT_DEF
12  %reg1024<def> = INSERT_SUBREG %reg1024<kill>, %reg1025, 2

The live range [12, 14) are not part of the r1024 live interval since it's defined by an implicit def. It will not conflicts with live interval of r1025. Now suppose both registers are spilled, you can easily see a situation where both registers are reloaded before the INSERT_SUBREG and both target registers that would overlap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:56:02 +00:00
Duncan Sands
edfba7e707 Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:54:57 +00:00
Nick Lewycky
4bf1e59819 Add another optimization from PR2330. Also catch some missing cases that are
similar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:20:53 +00:00
Bill Wendling
71ca353ae6 The frame address on an x86-64 box needs to be offset by -8, not -4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53450 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:18:52 +00:00
Chris Lattner
85b5eb0505 Fix folding of icmp's of i1 where the comparison is signed. The code
was using the algorithm for folding unsigned comparisons which is
completely wrong.  This has been broken since the signless types change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 04:20:58 +00:00
Chris Lattner
f299184565 Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
This cause a regression in InstCombine/JavaCompare, which was doing the right
thing on accident.  To handle the missed case, generalize the comparisons based
on masked bits a little bit to handle comparisons against the max value. For 
example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4)




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 04:09:09 +00:00
Chris Lattner
99672cb130 make this condition more precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 03:54:57 +00:00
Chris Lattner
d15990189d Implement PR2538
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 00:30:06 +00:00
Bill Wendling
bbcec684e3 Put CPPBackend tests into their own directory and run them only if they're
supported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 22:35:32 +00:00
Chris Lattner
85e7ac0353 Fix an altivec constant miscompilation that Duncan found through
his work on legalizetypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 16:33:38 +00:00
Matthijs Kooijman
d16918f843 Restructure dead argument elimination, try #3 :-)
Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

The pass now looks properly inside returned structs, but only at the first
level (ie, not inside nested structs).

This version fixed a few more bugs and was cleaned up a bit. It now passes all
of LLVM's testing, and should still pass SPEC2006. There is still a minor bug
with regard to returning nested structs. Since there is currently nothing that
emits such IR, I will fix that in a seperate commit (partly because it requires
a non-trivial fix).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 10:24:08 +00:00
Nick Lewycky
5dcc41f5b3 Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 05:51:40 +00:00
Evan Cheng
331e2bd942 Fix for PR2472. Use movss to set lower 32-bits of a zero XMM vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53386 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 01:08:23 +00:00
Chris Lattner
fea85c46c0 Fix a case where vector comparison constant folding would cause an
infinite recursion.  part of PR2529


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 00:29:28 +00:00
Chris Lattner
330e7e4d25 elementwise comparison of vector constants was completely wrong. Fix
it for PR2529


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 00:08:17 +00:00
Anton Korobeynikov
091be59220 Testcase for PR2024
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53327 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 14:09:41 +00:00
Nick Lewycky
9ee863ecc0 Fold (a < 8) && (b < 8) into (a|b) < 8 for unsigned less or greater than.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53282 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 07:29:11 +00:00
Nick Lewycky
d1f77bf931 Fold ((1 << a) & 1) to (a == 0).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53276 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:20:13 +00:00
Chris Lattner
2782ed1f14 Fix a broken test. Neither load is eliminable without changing the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53273 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:01:02 +00:00
Nick Lewycky
b4d1bc989e Reduce x - y to -y when we know the 'x' part will get masked off anyways.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 04:32:37 +00:00
Devang Patel
a5e27f8028 If loop induction variable's start value is less then its exit value then do not split the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 00:12:01 +00:00
Dale Johannesen
62b9b6e38c Testcase for debug info from data-only files.
This one is x86-32-Darwin specific.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 21:57:56 +00:00
Chris Lattner
d038c27516 'Optimize' test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 18:33:33 +00:00
Chris Lattner
895860e27b new testcase for PR2496
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 17:18:05 +00:00
Duncan Sands
4a497a2757 Testcase for PR2520.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 10:11:36 +00:00
Chris Lattner
155a490258 Fix three bugs:
1) evaluate [v]fcmp true/false with undefs to true or false instead
   of undef.
2) fix vector comparisons with undef to return a vector result instead 
   of i1
3) fix vector comparisons with evaluatable results to return vector
   true/false instead of i1 true/false (PR2529)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 05:46:34 +00:00
Dan Gohman
95d110920e Refactor the tablegen DAGISelEmitter code for outputing calls to
getTargetNode and SelectNodeTo to reduce duplication, and to
make some of the getTargetNode code available to SelectNodeTo.
Use SelectNodeTo instead of getTargetNode in several new
interesting cases, as it mutates nodes in place instead of
creating new ones.

This triggers some scheduling behavior differences due to nodes
being presented to the scheduler in a different order. Some of the
arbitrary scheduling decisions it makes are now arbitrarily made
differently. This is visible in CodeGen/PowerPC/LargeAbsoluteAddr.ll,
where a trivial scheduling difference led to a trivial register
allocation difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53203 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 21:00:17 +00:00
Evan Cheng
1ce75dcbbc Fix two serious LSR bugs.
1. LSR runOnLoop is always returning false regardless if any transformation is made.
2. AddUsersIfInteresting can create new instructions that are added to DeadInsts. But there is a later early exit which prevents them from being freed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53193 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 19:51:32 +00:00
Anton Korobeynikov
7ab23c4297 Testcase for PR2463
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 23:33:40 +00:00
Anton Korobeynikov
e56ac813e6 Testcase for PR2146
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53155 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 23:03:46 +00:00
Nick Lewycky
b8cd6a49b5 Fix missed optimization opportunity when analyzing cast of mul and select.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 21:19:34 +00:00
Owen Anderson
9da02b844f Remove the ability for ADCE to remove unreachable blocks in loop nests, because, as Eli pointed out, SimplifyCFG already does this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 17:21:41 +00:00
Owen Anderson
77d76b7ef7 Add support to ADCE for pruning unreachable blocks. This addresses the final
part of PR2509.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:05:19 +00:00
Owen Anderson
f2aa160b35 A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53032 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 17:20:16 +00:00
Dale Johannesen
ecdc82a643 Considering predecessors of exit blocks gets
us a little more tail merging.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52986 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 21:50:49 +00:00
Chris Lattner
80c1a5622a Implement split and scalarize for SELECT_CC, fixing PR2504
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 02:43:01 +00:00
Duncan Sands
3921266559 Regression test for PR2443.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52826 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 14:22:20 +00:00
Duncan Sands
accdef219f Use the c modifier to tell llvm-ar not to issue a
warning when creating the archive (the warning
causes the test to fail).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 10:52:12 +00:00
Chris Lattner
bd2acd736d test doesn't need eh info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 03:14:20 +00:00
Chris Lattner
a534b0f7bf when linking globals, make sure to preserve the address space of the global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 03:10:24 +00:00
Evan Cheng
a7e4cc9263 XFAIL for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 22:09:29 +00:00
Owen Anderson
3987f8e1ac Use the -enable-pre flag so this test doesn't fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 17:03:28 +00:00
Matthijs Kooijman
f512281d61 Make LLVM compile on DragonFly BSD (PR2499).
Patch by Hasso Tepper!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 10:36:58 +00:00
Dale Johannesen
4e97790682 Allow for rounding up of stack frame.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 01:55:32 +00:00
Chris Lattner
cda8875433 when we know the signbit of an input to uint_to_fp is zero,
change it to sint_to_fp on targets where that is cheaper (and
visaversa of course).  This allows us to compile uint_to_fp to:

_test:
	movl	4(%esp), %eax
	shrl	$23, %eax
	cvtsi2ss	%eax, %xmm0
	movl	8(%esp), %eax
	movss	%xmm0, (%eax)
	ret

instead of:

	.align	3
LCPI1_0:					##  double
	.long	0	## double least significant word 4.5036e+15
	.long	1127219200	## double most significant word 4.5036e+15
	.text
	.align	4,0x90
	.globl	_test
_test:
	subl	$12, %esp
	movl	16(%esp), %eax
	shrl	$23, %eax
	movl	%eax, (%esp)
	movl	$1127219200, 4(%esp)
	movsd	(%esp), %xmm0
	subsd	LCPI1_0, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movl	20(%esp), %eax
	movss	%xmm0, (%eax)
	addl	$12, %esp
	ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52747 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 00:16:49 +00:00
Evan Cheng
ab26227c8c - Fix a x86 vector isel bug: illegal transformation of a vector_shuffle into a
shift.
- Add a readme entry for a missing vector_shuffle optimization that results in
  awful codegen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52740 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 20:52:59 +00:00
Chris Lattner
21b9d283ea simplify shell syntax to work better on solaris, patch by
Nathan Keynes!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 16:03:42 +00:00
Mon P Wang
2887310630 Added MemOperands to Atomic operations since Atomics touches memory.
Added abstract class MemSDNode for any Node that have an associated MemOperand
Changed atomic.lcs => atomic.cmp.swap, atomic.las => atomic.load.add, and
atomic.lss => atomic.load.sub


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 08:15:39 +00:00
Chris Lattner
aa0bf52625 Fix PR2488, a case where we deleted stack restores too aggressively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 05:59:28 +00:00
Evan Cheng
601ca4b434 Enable two-address remat by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 01:16:38 +00:00
Dale Johannesen
4a103e6d7e v2f32 is now a valid (MMX) type which breaks this
test (doesn't work for any MMX vector types, it's
not me).  Rewritten to use v2i16 which is generic
and going to stay that way; I think that preserves
the point of the test.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:03:36 +00:00
Dan Gohman
8dbe7f832e Revert 52645, the loop unroller changes. It caused a regression in 252.eon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 20:44:42 +00:00
Matthijs Kooijman
1d9a277761 Commit the new DeadArgElim pass again, this time with the gcc bootstrap failures fixed.
Also add a testcase to reproduce the gcc bootstrap failure in very much reduced form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 16:30:26 +00:00
Evan Cheng
9ef4ca2e81 If it's determined safe, remat MOV32r0 (i.e. xor r, r) and others as it is instead of using the longer MOV32ri instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 07:10:51 +00:00
Bill Wendling
ebcba612b5 This situation can occur:
,------.
    |      |
    |      v
    |   t2 = phi ... t1 ...
    |      |
    |      v
    |   t1 = ...
    |  ... = ... t1 ...
    |      |
    `------'

where there is a use in a PHI node that's a predecessor to the defining
block. We don't want to mark all predecessors as having the value "alive" in
this case. Also, the assert was too restrictive and didn't handle this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 23:41:14 +00:00
Dan Gohman
55e283c71e Revamp the loop unroller, extending it to correctly update PHI nodes
in the presence of out-of-loop users of in-loop values and the trip
count is not a known multiple of the unroll count, and to be a bit
simpler overall. This fixes PR2253.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 21:29:41 +00:00
Bill Wendling
04eeefb32a Make test work on non-x86 machines (like my G4 PPC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 06:16:31 +00:00
Dan Gohman
cbfe5bbe88 Improve LSR's dead-phi detection to handle use-def cycles
with more than two nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 20:44:02 +00:00
Chris Lattner
963a97f1a3 Fix PR2369 by making scalarrepl more careful about promoting
structures.  Its default threshold is to promote things that are
smaller than 128 bytes, which is sane.  However, it is not sane
to do this for things that turn into 128 *registers*.  Add a cap
on the number of registers introduced, defaulting to 128/4=32.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 17:46:21 +00:00
Eli Friedman
5c1f172213 Fix for PR2479: correctly optimize expressions like (a > 13) & (a ==
15).

See also PR1800, which is about the signed case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 23:36:13 +00:00
Duncan Sands
befc9c16fa This file is empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:26:50 +00:00
Duncan Sands
53ebe352ab Turn off llvm-gcc warnings when running "make check".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52595 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:22:58 +00:00
Duncan Sands
a1ace76c70 Support for load/store of expanded float types. I
don't know if a truncating store is possible here,
but added support for it anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52577 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 17:00:47 +00:00
Evan Cheng
c3417609ae Undo spill weight tweak. Need to investigate the performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 06:45:54 +00:00
Evan Cheng
9f99b7c595 Back out Matthijs' DAE patches. It's miscompiling gcc driver.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52570 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 00:31:44 +00:00
Matthijs Kooijman
63691f13b6 Add testcase that checks that DeadArgElim doesn't touch stuff it shouldn't touch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 15:38:22 +00:00
Matthijs Kooijman
c95e44b4e0 Recommit r52459, rewriting of the dead argument elimination pass.
This is a fixed version that no longer uses multimap::equal_range, which
resulted in a pointer invalidation problem.

Also, DAE::InspectedFunctions was not really necessary, so it got removed.

Lastly, this version no longer applies the extra arg hack on functions who did
not have any arguments to start with.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 09:36:16 +00:00
Chris Lattner
a3de6e9ab8 Fix a warning, closing PR2452
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52529 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:33:29 +00:00
Chris Lattner
3e64ff6832 Fix a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:31:04 +00:00
Chris Lattner
ec91ccba3c Fix an error handling redefinition of linkonce functions where the
types differ.  Patch by Nathan Keynes!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:29:39 +00:00
Chris Lattner
6624602197 fix a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:28:56 +00:00
Chris Lattner
2de3fec61c Fix PR2471, which is a bug involving an invalid promotion from a conditional load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:12:56 +00:00
Evan Cheng
c8af52c898 ISD::UNDEF should be expanded recursively / iteratively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 22:01:11 +00:00
Matthijs Kooijman
3d2ff5f939 Modify some ipconstprop tests to also test with invokes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52491 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 09:27:44 +00:00
Eli Friedman
2c8e64d3e4 Fix a bug with <8 x i16> shuffle lowering on X86 where parts of the
shuffle could be skipped.  The check is invalid because the loop index i 
doesn't correspond to the element actually inserted. The correct check is
already done a few lines earlier, for whether the element is already in 
the right spot, so this shouldn't have any effect on the codegen for 
code that was already correct.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 06:09:51 +00:00
Evan Cheng
0d46d753f9 New test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:50:24 +00:00
Evan Cheng
72d255aff9 This also got better (55 - 51 instructions). But doing one more re-materialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:50:13 +00:00
Evan Cheng
81d39e63e2 This got better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:46:43 +00:00
Owen Anderson
93d606a9b3 Remove this test until the corresponding patch is reapplied because it's causing make check to crash for some people.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52473 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 22:37:31 +00:00
Owen Anderson
b230372437 Add local PRE to GVN. This only operates in cases where it would not increase code size, namely when the instantiated expression
would only need to be created in one predecessor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 21:41:49 +00:00
Matthijs Kooijman
ca85d65277 Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

The pass now looks properly inside returned structs, but only at the first                                                                                     
level (ie, not inside nested structs).

Also add a testcase for testing various variations of (multiple) dead rerturn
values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 11:12:53 +00:00
Matthijs Kooijman
c2afe89019 Reapply r52397 (make IPConstProp promote returned arguments), but fixed this
time. Sorry for the trouble!

This time, also add a testcase, which I should have done in the first place...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52455 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 08:30:37 +00:00
Matthijs Kooijman
8b0fcf38ef Reapply r52396, it was unrelated to the breakage (that was caused by r52397, my
commit after this).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 08:09:27 +00:00
Chris Lattner
0521e3cdc1 implement some simple bswap optimizations, rdar://5992453
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 04:33:20 +00:00
Chris Lattner
a2eec61607 temporarily revert this testcase since its patch was reverted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 04:03:23 +00:00
Chris Lattner
8114b718c9 make truncate/sext elimination capable of changing phi's. This
implements rdar://6013816 and the testcase in Transforms/InstCombine/sext-misc.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52440 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 04:00:49 +00:00
Devang Patel
64cd658223 Preserve dominance frontier while trivially unswitching loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 02:16:38 +00:00
Matthijs Kooijman
906e423724 Learn IPConstProp to look at individual return values and propagate them
individually.

Also learn IPConstProp how returning first class aggregates work, in addition
to old style multiple return instructions.

Modify the return-constants testscase to confirm this behaviour.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 12:02:52 +00:00
Evan Cheng
c3de802ad9 Do not issue identity copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 22:52:53 +00:00
Dan Gohman
9b93dd1f1a Refine the change in r52258 for avoiding use-before-def conditions
when changing the stride of a comparison so that it's slightly
more precise, by having it scan the instruction list to determine
if there is a use of the condition after the point where the
condition will be inserted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 22:34:15 +00:00
Evan Cheng
6bd9567a6a - Add "Commutative" property to intrinsics. This allows tblgen to generate the commuted variants for dagisel matching code.
- Mark lots of X86 intrinsics as "Commutative" to allow load folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 20:29:38 +00:00
Matthijs Kooijman
d47e6aeb93 Make testcase check for extractvalue instead of extractelement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52317 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 13:03:44 +00:00
Matthijs Kooijman
cdbada613e Store the result of multiple identical run lines in a temporary file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 12:21:25 +00:00
Matthijs Kooijman
d38a89287d Fix PR numbers, I accidentally switched two digits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 09:38:23 +00:00
Chris Lattner
845f0d2f0f If we are checking to see if the result of a call aliases a
pointer derived from a local allocation, if the local allocation
never escapes, the pointers can't alias.  This implements PR2436


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52301 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:19:11 +00:00
Chris Lattner
5db5bf425d this is unneeded now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:25:39 +00:00
Chris Lattner
5465cc59f0 resolve PR2453 by adding a run line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:22:39 +00:00
Wojciech Matyjewicz
8a08769bad Fix PR2434. When scanning for exising binary operator to reuse don't
take into account the instrucion pointed by InsertPt. Thanks to it, 
returning the new value of InsertPt to the InsertBinop() caller can be 
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't 
correctly handling changes of InsertPt. There shouldn't be any 
performance regression, as -gvn pass (run after -indvars) removes any 
redundant binops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 19:07:39 +00:00
Evan Cheng
87bb991aa8 Teach the spiller to commute instructions in order to fold a reload. This hits 410 times on 444.namd and 122 times on 252.eon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 23:58:02 +00:00
Eli Friedman
6100119620 Remove unnecessary target lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:12:16 +00:00
Eli Friedman
6783cdcbd2 Remove unnecessary target lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52260 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:10:32 +00:00
Eli Friedman
6903a24f32 Don't skip over instructions other than loads that might read memory
when trying to sink stores.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:02:12 +00:00