Commit Graph

5812 Commits

Author SHA1 Message Date
Nick Lewycky 53b44029d6 Consider the case where xor by -1 and xor by 128 have been combined already to
produce an xor by 127.

llvm-svn: 54906
2008-08-17 19:58:24 +00:00
Evan Cheng 8ec334f45e Didn't mean to change this.
llvm-svn: 54904
2008-08-17 19:25:28 +00:00
Evan Cheng ab35bfdf18 Fix a (u)comiss intrinsic lowering bug. It was using anyext which can return junk in higher bits. Patch by Nate Begeman.
llvm-svn: 54903
2008-08-17 19:22:34 +00:00
Gordon Henriksen d930f913e6 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

llvm-svn: 54899
2008-08-17 18:44:35 +00:00
Nick Lewycky 18f50b2637 Xor'ing both sides of icmp by sign-bit is equivalent to swapping signedness of
the predicate.

Also, make this optz'n apply in more cases where it's safe to do so.

llvm-svn: 54876
2008-08-17 07:34:14 +00:00
Owen Anderson 2a6adfa4f0 Remove GCSE and LoadVN from the testsuite.
llvm-svn: 54832
2008-08-16 00:00:54 +00:00
Devang Patel f2a03d5a4b Reapply 54786. Add overflow and number of mantissa bits checks.
llvm-svn: 54821
2008-08-15 21:21:34 +00:00
Evan Cheng 86834d29f3 Revert 54786. It's not checking for overflows, etc.
llvm-svn: 54813
2008-08-15 08:12:11 +00:00
Bill Wendling 74e87c2c1e Renaming LLVMC/dg.exp to LLVM/llvmc.exp
llvm-svn: 54809
2008-08-14 23:37:58 +00:00
Devang Patel fdee7034b3 The pass manager is not able to schedule -loop-deletion -loop-index-split.
The loop-deletion pass does not preserve dom frontier, which is required by
loop-index-split. When the PM checks dom frontier for loop-index-split, it has
already verified that lcssa is availalble. However, new dom frontier forces new
loop pass manager, which does not  have lcssa yet.

The PM should recheck availability of required analysis passes in such cases.

llvm-svn: 54805
2008-08-14 23:07:48 +00:00
Devang Patel 054a833dd4 If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation.
llvm-svn: 54786
2008-08-14 20:58:31 +00:00
Dan Gohman 550c9af91f Improve support for vector casts in LLVM IR and CodeGen.
llvm-svn: 54784
2008-08-14 20:04:46 +00:00
Dan Gohman 6134fbccef Fix a bogus srem rule - a negative value srem'd by a power-of-2
can have a non-negative result; for example, -16%16 is 0. Also,
clarify the related comments. This fixes PR2670.

llvm-svn: 54767
2008-08-13 23:12:35 +00:00
Dan Gohman 7e3c392248 Allow SelectionDAG to create EXTRACT_VECTOR_ELT nodes with
non-constant indices. Only a few of the peephole checks require
a constant index.

llvm-svn: 54764
2008-08-13 21:51:37 +00:00
Dan Gohman 8ded5d5884 Fix SCCP's handling of struct value loads and stores. SCCP doesn't
track individual leaf values in such cases, so it needs to treat
struct values as normal values in this case.

llvm-svn: 54760
2008-08-13 21:22:48 +00:00
Duncan Sands ea68a6ccdf Teach constant folding that an inttoptr of a
ptrtoint can be turned into a bitcast if the
integer is at least as wide as a pointer.

llvm-svn: 54752
2008-08-13 20:20:35 +00:00
Devang Patel 97387e6615 Check sign to detect overflow before changing compare stride.
llvm-svn: 54710
2008-08-13 02:05:14 +00:00
Dan Gohman 2a62fd96a6 Extend ScalarEvolution's executesAtLeastOnce logic to be able to
continue past the first conditional branch when looking for a
relevant test. This helps it avoid using MAX expressions in
loop trip counts in more cases.

llvm-svn: 54697
2008-08-12 20:17:31 +00:00
Chris Lattner 2aa0ff27aa Implement support for simplifying vector comparisons by 0.0 and 1.0 like we
do for scalars.  Patch contributed by Nicolas Capens

This also generalizes the previous xforms to work on long double, now that 
isExactlyValue works for long double.

llvm-svn: 54653
2008-08-11 22:06:05 +00:00
Dan Gohman c82ad79c64 Improve the grep commands for this test to be tolerant of ABI
differences, and to be more specific.

llvm-svn: 54648
2008-08-11 20:10:41 +00:00
Dan Gohman 127bb03b8c Take the FrameOffset into account when computing the alignment
of stack objects. This fixes PR2656.

llvm-svn: 54646
2008-08-11 18:27:03 +00:00
Gordon Henriksen 2862ab967d [PR-2610] Adding Ocaml bindings for Switch::addCase.
llvm-svn: 54571
2008-08-09 01:55:52 +00:00
Dan Gohman 4e2f3ace2c Add an EXTRACTPSmr pattern to match the pattern that
X86ISelLowering creates.

llvm-svn: 54544
2008-08-08 18:30:21 +00:00
Nick Lewycky 248559aaa5 Testcase for r54520.
llvm-svn: 54521
2008-08-08 07:00:26 +00:00
Evan Cheng 655fa0fec4 It's not legal to output a GV in a coalesced section if it's used in an ARM PIC relative constantpool.
llvm-svn: 54519
2008-08-08 06:56:16 +00:00
Nick Lewycky 42a19b6933 Don't crash printing the asm for a ConstantExpr PtrToInt just because the int
is narrower than the pointer. This testcase emits:

  .byte (((17) - 16) & 255)

llvm-svn: 54517
2008-08-08 06:34:07 +00:00
Bruno Cardoso Lopes 93da7e6924 Support added for ctlz intrinsic, test case added.
llvm-svn: 54516
2008-08-08 06:16:31 +00:00
Bruno Cardoso Lopes 6067b44985 [Last] Batch 7 of Mips CodeGen tests
llvm-svn: 54512
2008-08-08 04:12:42 +00:00
Bruno Cardoso Lopes b60eebbab8 Batch 6 of Mips CodeGen tests
llvm-svn: 54511
2008-08-08 04:11:30 +00:00
Bruno Cardoso Lopes 9c8b9d4606 Batch 5 of Mips CodeGen tests
llvm-svn: 54510
2008-08-08 04:09:57 +00:00
Bruno Cardoso Lopes 32d4b5a44e Batch 4 of Mips CodeGen tests
llvm-svn: 54509
2008-08-08 04:08:30 +00:00
Bruno Cardoso Lopes 118a9e4813 Batch 3 of Mips CodeGen tests
llvm-svn: 54508
2008-08-08 04:05:51 +00:00
Bruno Cardoso Lopes 6b9077a5e4 Batch 2 of Mips CodeGen tests
llvm-svn: 54507
2008-08-08 04:03:25 +00:00
Bruno Cardoso Lopes 98ab9b334b Batch 1 of Mips CodeGen tests, more coming...
I had a lot of simple local codegen tests and they are now ready to be placed
in test/CodeGen. 

llvm-svn: 54506
2008-08-08 03:58:34 +00:00
Dale Johannesen 3b45982c78 Testcases for 54503. One derived from PR 2533, the
other from Python.

llvm-svn: 54505
2008-08-08 03:37:11 +00:00
Duncan Sands d7911bfa44 Use correct compiler component names for objc
and objc++.

llvm-svn: 54474
2008-08-07 17:59:54 +00:00
Duncan Sands dee8e7a233 Move tests of the ObjC++ front-end to their own
directory: some people (guess who!) may build llvm-gcc
with support for objc but not with support for objc++.

llvm-svn: 54471
2008-08-07 17:48:08 +00:00
Matthijs Kooijman d705b2be1f Add a basic test for the SRETPromotion pass.
llvm-svn: 54466
2008-08-07 15:55:18 +00:00
Matthijs Kooijman 0620096c18 Move two tests from SRETPromotion to Inline, since they only call opt -inline.
llvm-svn: 54465
2008-08-07 15:36:46 +00:00
Anton Korobeynikov 9dbbd75068 Print section flags ok on platforms, which use '@' as comment string. Fix test.
llvm-svn: 54460
2008-08-07 09:55:06 +00:00
Dan Gohman 527ca7e253 Re-enable elimination of unnecessary SUBREG_TO_REG instructions in
LowerSubregs, and fix an x86-64 isel bug that this exposed.

SUBREG_TO_REG for x86-64 implicit zero extension is only safe for
isel to generate when the source is known to always have zeros in
the high 32 bits. The EXTRACT_SUBREG instruction does not clear
the high 32 bits.

llvm-svn: 54444
2008-08-07 02:54:50 +00:00
Dan Gohman a8dbaeb1df Add an extra example that shouldn't get an and instruction.
llvm-svn: 54443
2008-08-07 02:23:06 +00:00
Dan Gohman 91c2c432c0 Re-introduce the 8-bit subreg zext-inreg patterns for x86-32,
this time using MOV32to32_ and MOV16to16_. Thanks to Evan for
suggesting this.

llvm-svn: 54418
2008-08-06 18:27:21 +00:00
Dan Gohman ac22cfcae9 Fix a shufflevector instcombine that was emitting invalid masks indices
when it meant to be emitting undef indices.

llvm-svn: 54417
2008-08-06 18:17:32 +00:00
Evan Cheng 2bd97afb99 PR2535, not PR2355.
llvm-svn: 54416
2008-08-06 18:06:48 +00:00
Evan Cheng 907dc2bc37 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.
llvm-svn: 54415
2008-08-06 18:04:43 +00:00
Chris Lattner f5b353c1fd optimize a common idiom generated by clang for bitfield access, PR2638.
llvm-svn: 54408
2008-08-06 07:35:52 +00:00
Chris Lattner 7bdaecb7f4 Zap sitofp/fptoui pairs. In all cases when the sign difference
matters, the result is undefined anyway.

llvm-svn: 54396
2008-08-06 05:13:06 +00:00
Nick Lewycky bf42893567 Reinstate this optimization, but without the miscompile. Thanks to Bill for
tracking down that this was breaking llvm-gcc bootstrap on Linux.

llvm-svn: 54394
2008-08-06 04:54:03 +00:00
Bill Wendling 0e966d3e2c Just grep for through the LL code instead of the ASM code
llvm-svn: 54389
2008-08-06 00:10:32 +00:00
Bill Wendling bc6786e7ee Add default architecture.
llvm-svn: 54384
2008-08-05 23:36:00 +00:00
Bill Wendling 3dfa168d22 Testcase for PR2629.
llvm-svn: 54377
2008-08-05 22:23:59 +00:00
Evan Cheng 7823a411d5 Fix PR2620: Fix X86cmppd selection code so it expects operands to be v2f64.
llvm-svn: 54376
2008-08-05 22:19:15 +00:00
Evan Cheng aa33b932bd Fix PR2596: out of bound reference.
llvm-svn: 54375
2008-08-05 21:51:46 +00:00
Bill Wendling ee12a7aeff 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.

llvm-svn: 54372
2008-08-05 21:23:45 +00:00
Owen Anderson b358c8f482 Update the remaining tests not to use -disable-correct-folding, and remove two
that couldn't be updated.

llvm-svn: 54359
2008-08-05 18:19:14 +00:00
Owen Anderson 8ccb8d35c4 One more -disable-correct-folding case removed.
llvm-svn: 54358
2008-08-05 18:08:56 +00:00
Owen Anderson ae0af127a6 Remove another -disable-correct-folding use.
llvm-svn: 54357
2008-08-05 18:05:58 +00:00
Owen Anderson 31a0dea5c0 Eliminate another use of -disable-correct-folding.
llvm-svn: 54356
2008-08-05 18:03:01 +00:00
Owen Anderson 04c047ddca This check is unnecessary, and getting rid of it removes a use of -disable-correct-folding.
llvm-svn: 54355
2008-08-05 17:52:54 +00:00
Owen Anderson 252fa16db1 Remove the need for -disable-correct-folding from this test.
llvm-svn: 54354
2008-08-05 17:49:52 +00:00
Dan Gohman 1a70bcc388 Fix the AsmWriter to not print extra spaces after parameter attributes.
llvm-svn: 54351
2008-08-05 15:51:44 +00:00
Evan Cheng 0ca10c9572 Fix PR2568: Fix bug that cause redudant kill marker after its live interval has been extended due to coalescing.
llvm-svn: 54346
2008-08-05 07:10:38 +00:00
Owen Anderson 5018bd032a Update these tests to work by disabling the new correct CFG generation. This flag should ONLY be used to for tests like these.
llvm-svn: 54334
2008-08-04 23:55:29 +00:00
Eli Friedman 61f67624c3 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.

llvm-svn: 54332
2008-08-04 23:49:06 +00:00
Dan Gohman 90c724cadc Fix SDISel lowering of PHI nodes to use ComputeValueVTs.
This allows it to work correctly on aggregate values.
This fixes PR2623.

llvm-svn: 54331
2008-08-04 23:42:46 +00:00
Dan Gohman 6e023e63cd Fix SDISel lowering of zeroinitializer and undef to use ComputeValueVTs.
This allows it to work correctly on nested aggregate values.
This fixes PR2625.

llvm-svn: 54330
2008-08-04 23:30:41 +00:00
Dale Johannesen 962178e77e Make sse2 explicit, for non-x86 hosts.
llvm-svn: 54251
2008-07-31 20:16:33 +00:00
Dan Gohman 345d63ccf2 Improve dagcombining for sext-loads and sext-in-reg nodes.
llvm-svn: 54239
2008-07-31 00:50:31 +00:00
Dan Gohman 2fe4352691 Don't look for leaf values to store when lowering stores of
empty structs. This fixes PR2612.

llvm-svn: 54226
2008-07-30 18:36:51 +00:00
Dan Gohman f8cc0aa87d I missed this file in r54223. movzbl is now used instead
of movzbw here.

llvm-svn: 54224
2008-07-30 18:23:34 +00:00
Dan Gohman 86b06335aa 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.

llvm-svn: 54223
2008-07-30 18:09:17 +00:00
Mon P Wang 2c839d4b1e 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

llvm-svn: 54195
2008-07-30 04:36:53 +00:00
Eli Friedman 4736916aa6 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.

llvm-svn: 54194
2008-07-30 04:36:32 +00:00
Eli Friedman 5ae90441c4 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.

llvm-svn: 54184
2008-07-30 00:04:08 +00:00
Duncan Sands fa4120530e 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.

llvm-svn: 54172
2008-07-29 20:56:02 +00:00
Nate Begeman fecbc8cff1 Add vector shifts to the IR, patch by Eli Friedman.
CodeGen & Clang work coming next.

llvm-svn: 54161
2008-07-29 15:49:41 +00:00
Matthijs Kooijman 98b5c16e3b 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ö.

llvm-svn: 54160
2008-07-29 13:21:23 +00:00
Matthijs Kooijman fd3070459b 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.

llvm-svn: 54159
2008-07-29 10:00:13 +00:00
Dan Gohman 43105328d3 Revert 54147.
llvm-svn: 54148
2008-07-29 01:02:18 +00:00
Dan Gohman 26ec56c75c 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.

llvm-svn: 54147
2008-07-28 22:18:25 +00:00
Duncan Sands ced7c7220e 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.

llvm-svn: 54138
2008-07-28 19:09:01 +00:00
Dan Gohman c9fe8b64ed Fix a bashism in TestRunner.sh.
llvm-svn: 54134
2008-07-28 18:41:03 +00:00
Owen Anderson 3f3389745d Add support for eliminating stores that store the same value that was just loaded.
This fixes PR2599.

llvm-svn: 54133
2008-07-28 16:14:26 +00:00
Dan Gohman 108c58aef4 Fix embedded CRLF characters.
llvm-svn: 54125
2008-07-27 18:37:58 +00:00
Nate Begeman 59063cb315 Fix test RUN line
llvm-svn: 54040
2008-07-25 19:08:59 +00:00
Nate Begeman 283b2da27a 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

llvm-svn: 54039
2008-07-25 19:05:58 +00:00
Dan Gohman 4e6a25ac45 This test needs -aggressive-remat enabled.
llvm-svn: 54015
2008-07-25 15:25:32 +00:00
Evan Cheng c90a11256e Teach ARM isLegalAddressingMode to handle unknown type without crashing. This fixes pr2589.
llvm-svn: 54004
2008-07-25 00:55:17 +00:00
Dan Gohman 09b0448dbc 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.

llvm-svn: 54000
2008-07-25 00:02:30 +00:00
Dan Gohman 5f36a32e7b 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.

llvm-svn: 53997
2008-07-24 23:57:25 +00:00
Dan Gohman d9f9e2e260 Add target triples so these tests behave as expected on non-darwin hosts.
llvm-svn: 53991
2008-07-24 18:08:01 +00:00
Evan Cheng 0f0aee213f 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.
llvm-svn: 53979
2008-07-24 08:17:07 +00:00
Evan Cheng c353a5f3b3 New test case.
llvm-svn: 53971
2008-07-24 00:22:05 +00:00
Chris Lattner 8a8fb908dc "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!

llvm-svn: 53945
2008-07-23 05:06:28 +00:00
Dan Gohman fa1211f69b 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.

llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Evan Cheng a2b4b4ad99 Fix PR2485: do all 4-element SSE shuffles in max. of 2 shuffle instructions.
Based on patch by Nicolas Capens.

llvm-svn: 53939
2008-07-23 00:22:17 +00:00
Duncan Sands 775e509525 LegalizeTypes support for VSETCC. Fixes PR2575.
llvm-svn: 53938
2008-07-22 23:54:03 +00:00
Evan Cheng b8ff223f26 Fix pr2566: incorrect assumption about bit_convert. It doesn't not have to output a vector value. Patch by Nicolas Capens!
llvm-svn: 53932
2008-07-22 20:42:56 +00:00
Evan Cheng 0384670141 Fix PR2574: implement v2f32 scalar_to_vector.
llvm-svn: 53927
2008-07-22 18:39:19 +00:00
Dan Gohman 60bae3faaf Add the PR number to the test.
llvm-svn: 53880
2008-07-21 21:50:25 +00:00
Dan Gohman 7ad3cd8c9d 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.

llvm-svn: 53879
2008-07-21 21:45:02 +00:00
Wojciech Matyjewicz f0d21cdd19 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.

llvm-svn: 53810
2008-07-20 15:55:14 +00:00
Bill Wendling 75840e6435 Fix for first part of PR2562. Generate the "pinsrw" instruction for inserts
into v4i16 vectors.

llvm-svn: 53807
2008-07-20 02:32:23 +00:00
Nick Lewycky 82510bf0e3 XFAIL this test.
llvm-svn: 53793
2008-07-19 15:52:06 +00:00
Wojciech Matyjewicz a78669c2cf 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.

llvm-svn: 53792
2008-07-19 13:26:15 +00:00
Anton Korobeynikov 74d3fa165c Testcase for PR2549
llvm-svn: 53785
2008-07-19 06:31:12 +00:00
Duncan Sands 6b418e750d Softfloat support for FDIV. Patch by
Richard Pennington.

llvm-svn: 53773
2008-07-18 21:18:48 +00:00
Dan Gohman 44dfd7bf56 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.

llvm-svn: 53767
2008-07-18 18:43:12 +00:00
Evan Cheng cefd6e62fa Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
llvm-svn: 53734
2008-07-17 19:48:53 +00:00
Evan Cheng c5add64f0a Add nounwind.
llvm-svn: 53733
2008-07-17 19:48:04 +00:00
Dan Gohman 1705968102 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.

llvm-svn: 53728
2008-07-17 19:10:17 +00:00
Duncan Sands 7e5edf1a1f LegalizeTypes support for what seems to be the
only missing ppc long double operations: FNEG
and FP_EXTEND.

llvm-svn: 53723
2008-07-17 17:35:14 +00:00
Duncan Sands d9256a7ceb Turn LegalizeTypes back off again for the moment:
it is breaking Darwin bootstrap due to missing
functionality.

llvm-svn: 53721
2008-07-17 17:06:03 +00:00
Matthijs Kooijman 8b69d77a7a Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
llvm-svn: 53716
2008-07-17 11:59:53 +00:00
Chris Lattner c600c53d1f Fix PR2553
llvm-svn: 53715
2008-07-17 06:07:20 +00:00
Duncan Sands 2d28e281e9 Add support for promoting and expanding AssertZext
and AssertSext.  Needed when passing huge integer
parameters with the zeroext or signext attributes.

llvm-svn: 53684
2008-07-16 16:03:07 +00:00
Duncan Sands 5b2c2975b8 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.

llvm-svn: 53677
2008-07-16 13:37:36 +00:00
Duncan Sands 5efef246ed 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!

llvm-svn: 53676
2008-07-16 13:10:20 +00:00
Matthijs Kooijman f22f34f0cc Add a few cases to instcombine's extractvalue testcase.
llvm-svn: 53675
2008-07-16 12:57:25 +00:00
Matthijs Kooijman c9d4e06f3a Un-XFAIL multdeadretval, since instcombine now properly handles the mess deadargelim leaves behind :-)
llvm-svn: 53674
2008-07-16 12:56:52 +00:00
Duncan Sands c359055fa9 Turn on LegalizeTypes by default.
llvm-svn: 53671
2008-07-16 11:36:51 +00:00
Duncan Sands a0b1ab3c0b 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.

llvm-svn: 53669
2008-07-16 08:09:48 +00:00
Evan Cheng c97094552c Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
llvm-svn: 53666
2008-07-16 07:28:14 +00:00
Matthijs Kooijman af3594cca1 XFAIL the multdeadretval test for now, I will be fixing instcombine to make it work again tomorrow.
llvm-svn: 53614
2008-07-15 16:05:09 +00:00
Duncan Sands 0f1a1cdcf8 LegalizeTypes support for fabs on ppc long double.
llvm-svn: 53613
2008-07-15 15:02:44 +00:00
Matthijs Kooijman 121a206292 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.

llvm-svn: 53612
2008-07-15 14:57:01 +00:00
Matthijs Kooijman d881fb0a5b Add a testcase for the canonicalizations now performed by deadargelim.
llvm-svn: 53611
2008-07-15 14:42:58 +00:00
Matthijs Kooijman c1da874478 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.

llvm-svn: 53608
2008-07-15 14:03:10 +00:00
Matthijs Kooijman d337446b8e Fix typo.
llvm-svn: 53605
2008-07-15 13:15:10 +00:00
Duncan Sands 6162e0377c 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.

llvm-svn: 53604
2008-07-15 10:18:22 +00:00
Duncan Sands 202225cdf8 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
llvm-svn: 53603
2008-07-15 10:14:24 +00:00
Chris Lattner 0ead7a50b2 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.

llvm-svn: 53548
2008-07-14 07:23:24 +00:00
Chris Lattner 34fc5a0eaa 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.

llvm-svn: 53546
2008-07-14 06:49:45 +00:00
Chris Lattner eab49263b5 Fix a bunch of bugs handling vector compare constant expressions, fixing
PR2317.

llvm-svn: 53544
2008-07-14 05:17:31 +00:00
Chris Lattner 16395e51f4 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
}

llvm-svn: 53534
2008-07-14 00:15:52 +00:00
Chris Lattner 80b03a1b49 Fix mishandling of the infinite loop case when merging two blocks. This
fixes PR2540.

llvm-svn: 53533
2008-07-13 22:23:11 +00:00
Nick Lewycky b5688ccf57 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).

llvm-svn: 53508
2008-07-12 07:41:32 +00:00
Nick Lewycky f76aa23b54 Enhance analysis of srem.
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.

llvm-svn: 53506
2008-07-12 05:04:38 +00:00
Evan Cheng e0a352e8e7 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.

llvm-svn: 53503
2008-07-12 01:56:02 +00:00
Duncan Sands d9948110a6 Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.

llvm-svn: 53459
2008-07-11 16:54:57 +00:00
Nick Lewycky f95b64acaa Add another optimization from PR2330. Also catch some missing cases that are
similar.

llvm-svn: 53451
2008-07-11 07:20:53 +00:00
Bill Wendling 5774466a33 The frame address on an x86-64 box needs to be offset by -8, not -4.
llvm-svn: 53450
2008-07-11 07:18:52 +00:00
Chris Lattner 6af608b8ce 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.

llvm-svn: 53444
2008-07-11 04:20:58 +00:00
Chris Lattner 4fa8bb3430 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)

llvm-svn: 53443
2008-07-11 04:09:09 +00:00
Chris Lattner 1be09d9e21 make this condition more precise.
llvm-svn: 53442
2008-07-11 03:54:57 +00:00
Chris Lattner 61622615ae Implement PR2538
llvm-svn: 53438
2008-07-11 00:30:06 +00:00
Bill Wendling 33d58e7657 Put CPPBackend tests into their own directory and run them only if they're
supported.

llvm-svn: 53427
2008-07-10 22:35:32 +00:00
Chris Lattner 5e718e7431 Fix an altivec constant miscompilation that Duncan found through
his work on legalizetypes.

llvm-svn: 53410
2008-07-10 16:33:38 +00:00
Matthijs Kooijman e0f3ab82c4 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).

llvm-svn: 53400
2008-07-10 10:24:08 +00:00
Nick Lewycky 6193a564ab Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!
llvm-svn: 53393
2008-07-10 05:51:40 +00:00
Evan Cheng 71b7398463 Fix for PR2472. Use movss to set lower 32-bits of a zero XMM vector.
llvm-svn: 53386
2008-07-10 01:08:23 +00:00
Chris Lattner 67136cff7b Fix a case where vector comparison constant folding would cause an
infinite recursion.  part of PR2529

llvm-svn: 53383
2008-07-10 00:29:28 +00:00
Chris Lattner b69689e18b elementwise comparison of vector constants was completely wrong. Fix
it for PR2529

llvm-svn: 53380
2008-07-10 00:08:17 +00:00
Anton Korobeynikov dad7a35acf Testcase for PR2024
llvm-svn: 53327
2008-07-09 14:09:41 +00:00
Nick Lewycky f9c27c343a Fold (a < 8) && (b < 8) into (a|b) < 8 for unsigned less or greater than.
llvm-svn: 53282
2008-07-09 07:29:11 +00:00
Nick Lewycky 364661c43e Fold ((1 << a) & 1) to (a == 0).
llvm-svn: 53276
2008-07-09 05:20:13 +00:00
Chris Lattner 7212e2014c Fix a broken test. Neither load is eliminable without changing the CFG.
llvm-svn: 53273
2008-07-09 05:01:02 +00:00
Nick Lewycky 0d3645e673 Reduce x - y to -y when we know the 'x' part will get masked off anyways.
llvm-svn: 53271
2008-07-09 04:32:37 +00:00
Devang Patel 51cbf928ab If loop induction variable's start value is less then its exit value then do not split the loop.
llvm-svn: 53265
2008-07-09 00:12:01 +00:00
Dale Johannesen 07f5db0318 Testcase for debug info from data-only files.
This one is x86-32-Darwin specific.

llvm-svn: 53255
2008-07-08 21:57:56 +00:00
Chris Lattner 4f1a9ffc09 'Optimize' test
llvm-svn: 53242
2008-07-08 18:33:33 +00:00
Chris Lattner 855d2c38ec new testcase for PR2496
llvm-svn: 53239
2008-07-08 17:18:05 +00:00
Duncan Sands acf0189b4b Testcase for PR2520.
llvm-svn: 53230
2008-07-08 10:11:36 +00:00
Chris Lattner d137a08b0d 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)

llvm-svn: 53220
2008-07-08 05:46:34 +00:00
Dan Gohman d6ec05077f 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.

llvm-svn: 53203
2008-07-07 21:00:17 +00:00
Evan Cheng 03001cb820 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.

llvm-svn: 53193
2008-07-07 19:51:32 +00:00
Anton Korobeynikov 6ef6af2cec Testcase for PR2463
llvm-svn: 53157
2008-07-05 23:33:40 +00:00
Anton Korobeynikov 62117b7296 Testcase for PR2146
llvm-svn: 53155
2008-07-05 23:03:46 +00:00
Nick Lewycky 9f1a4dc672 Fix missed optimization opportunity when analyzing cast of mul and select.
llvm-svn: 53151
2008-07-05 21:19:34 +00:00
Owen Anderson d57cdc3c60 Remove the ability for ADCE to remove unreachable blocks in loop nests, because, as Eli pointed out, SimplifyCFG already does this.
llvm-svn: 53104
2008-07-03 17:21:41 +00:00
Owen Anderson 323b5755a6 Add support to ADCE for pruning unreachable blocks. This addresses the final
part of PR2509.

llvm-svn: 53038
2008-07-02 18:05:19 +00:00
Owen Anderson b22a640fe4 A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks.
llvm-svn: 53032
2008-07-02 17:20:16 +00:00
Dale Johannesen 3bfe3b0e76 Considering predecessors of exit blocks gets
us a little more tail merging.

llvm-svn: 52986
2008-07-01 21:50:49 +00:00
Chris Lattner 9d3740ed1c Implement split and scalarize for SELECT_CC, fixing PR2504
llvm-svn: 52887
2008-06-30 02:43:01 +00:00
Duncan Sands 0690fdbef2 Regression test for PR2443.
llvm-svn: 52826
2008-06-27 14:22:20 +00:00
Duncan Sands 8269d5ca0a Use the c modifier to tell llvm-ar not to issue a
warning when creating the archive (the warning
causes the test to fail).

llvm-svn: 52824
2008-06-27 10:52:12 +00:00
Chris Lattner 501c0b82d6 test doesn't need eh info
llvm-svn: 52811
2008-06-27 03:14:20 +00:00
Chris Lattner b32a9ef00f when linking globals, make sure to preserve the address space of the global.
llvm-svn: 52810
2008-06-27 03:10:24 +00:00
Evan Cheng f79a4a1f01 XFAIL for now.
llvm-svn: 52795
2008-06-26 22:09:29 +00:00
Owen Anderson 1fb47ad928 Use the -enable-pre flag so this test doesn't fail.
llvm-svn: 52784
2008-06-26 17:03:28 +00:00
Matthijs Kooijman f61fd54237 Make LLVM compile on DragonFly BSD (PR2499).
Patch by Hasso Tepper!

llvm-svn: 52781
2008-06-26 10:36:58 +00:00
Dale Johannesen 0e28b3b9ee Allow for rounding up of stack frame.
llvm-svn: 52751
2008-06-26 01:55:32 +00:00
Chris Lattner b1e66ce3bb 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

llvm-svn: 52747
2008-06-26 00:16:49 +00:00
Evan Cheng 3fc2372d3a - 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.

llvm-svn: 52740
2008-06-25 20:52:59 +00:00
Chris Lattner 99fea6f405 simplify shell syntax to work better on solaris, patch by
Nathan Keynes!

llvm-svn: 52721
2008-06-25 16:03:42 +00:00
Mon P Wang 6a490371c9 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

llvm-svn: 52706
2008-06-25 08:15:39 +00:00
Chris Lattner c9c81fb0df Fix PR2488, a case where we deleted stack restores too aggressively.
llvm-svn: 52702
2008-06-25 05:59:28 +00:00
Evan Cheng 73db52ebf8 Enable two-address remat by default.
llvm-svn: 52701
2008-06-25 01:16:38 +00:00
Dale Johannesen 6316bc705e 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.

llvm-svn: 52692
2008-06-24 22:03:36 +00:00
Dan Gohman 04c8bd7e11 Revert 52645, the loop unroller changes. It caused a regression in 252.eon.
llvm-svn: 52688
2008-06-24 20:44:42 +00:00
Matthijs Kooijman c702e1d32f 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.

llvm-svn: 52677
2008-06-24 16:30:26 +00:00
Evan Cheng 3f2ceac565 If it's determined safe, remat MOV32r0 (i.e. xor r, r) and others as it is instead of using the longer MOV32ri instruction.
llvm-svn: 52670
2008-06-24 07:10:51 +00:00
Bill Wendling c44659b92a 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.

llvm-svn: 52655
2008-06-23 23:41:14 +00:00
Dan Gohman 48c5c7e860 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.

llvm-svn: 52645
2008-06-23 21:29:41 +00:00
Bill Wendling 559067c55c Make test work on non-x86 machines (like my G4 PPC).
llvm-svn: 52619
2008-06-23 06:16:31 +00:00
Dan Gohman 5ca5e02480 Improve LSR's dead-phi detection to handle use-def cycles
with more than two nodes.

llvm-svn: 52617
2008-06-22 20:44:02 +00:00
Chris Lattner 6ff85681e4 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.

llvm-svn: 52611
2008-06-22 17:46:21 +00:00
Eli Friedman d3449df326 Fix for PR2479: correctly optimize expressions like (a > 13) & (a ==
15).

See also PR1800, which is about the signed case.

llvm-svn: 52608
2008-06-21 23:36:13 +00:00
Duncan Sands c7ef3cb43f This file is empty.
llvm-svn: 52596
2008-06-21 20:26:50 +00:00
Duncan Sands 2649ff8672 Turn off llvm-gcc warnings when running "make check".
llvm-svn: 52595
2008-06-21 20:22:58 +00:00
Duncan Sands 3bb8999719 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.

llvm-svn: 52577
2008-06-21 17:00:47 +00:00
Evan Cheng f593a65497 Undo spill weight tweak. Need to investigate the performance regressions.
llvm-svn: 52572
2008-06-21 06:45:54 +00:00
Evan Cheng 33067210d1 Back out Matthijs' DAE patches. It's miscompiling gcc driver.
llvm-svn: 52570
2008-06-21 00:31:44 +00:00
Matthijs Kooijman 48b282f03b Add testcase that checks that DeadArgElim doesn't touch stuff it shouldn't touch.
llvm-svn: 52540
2008-06-20 15:38:22 +00:00
Matthijs Kooijman 8d32dee428 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.

llvm-svn: 52532
2008-06-20 09:36:16 +00:00
Chris Lattner 54d26c6b12 Fix a warning, closing PR2452
llvm-svn: 52529
2008-06-20 05:33:29 +00:00
Chris Lattner 65ee4e3a5c Fix a warning.
llvm-svn: 52528
2008-06-20 05:31:04 +00:00
Chris Lattner d53bd2da98 Fix an error handling redefinition of linkonce functions where the
types differ.  Patch by Nathan Keynes!

llvm-svn: 52527
2008-06-20 05:29:39 +00:00
Chris Lattner ba00c761b7 fix a warning.
llvm-svn: 52526
2008-06-20 05:28:56 +00:00
Chris Lattner f3ecd2d290 Fix PR2471, which is a bug involving an invalid promotion from a conditional load.
llvm-svn: 52525
2008-06-20 05:12:56 +00:00
Evan Cheng be0429c558 ISD::UNDEF should be expanded recursively / iteratively.
llvm-svn: 52508
2008-06-19 22:01:11 +00:00
Matthijs Kooijman a087b73dba Modify some ipconstprop tests to also test with invokes.
llvm-svn: 52491
2008-06-19 09:27:44 +00:00
Eli Friedman 8d66e98c92 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.

llvm-svn: 52486
2008-06-19 06:09:51 +00:00
Evan Cheng b139ee95b4 New test case.
llvm-svn: 52483
2008-06-19 01:50:24 +00:00
Evan Cheng d6d9cfa72a This also got better (55 - 51 instructions). But doing one more re-materialization.
llvm-svn: 52482
2008-06-19 01:50:13 +00:00
Evan Cheng 1d1907d778 This got better.
llvm-svn: 52481
2008-06-19 01:46:43 +00:00
Owen Anderson 83c6a9d7c1 Remove this test until the corresponding patch is reapplied because it's causing make check to crash for some people.
llvm-svn: 52473
2008-06-18 22:37:31 +00:00
Owen Anderson 6a903bc601 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.

llvm-svn: 52471
2008-06-18 21:41:49 +00:00
Matthijs Kooijman 964557fdf5 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.

llvm-svn: 52459
2008-06-18 11:12:53 +00:00
Matthijs Kooijman fd17357643 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...

llvm-svn: 52455
2008-06-18 08:30:37 +00:00
Matthijs Kooijman 97034598b1 Reapply r52396, it was unrelated to the breakage (that was caused by r52397, my
commit after this).

llvm-svn: 52453
2008-06-18 08:09:27 +00:00
Chris Lattner ef36dcd10b implement some simple bswap optimizations, rdar://5992453
llvm-svn: 52442
2008-06-18 04:33:20 +00:00
Chris Lattner 466e1f8dd2 temporarily revert this testcase since its patch was reverted.
llvm-svn: 52441
2008-06-18 04:03:23 +00:00
Chris Lattner b5ee8b3e89 make truncate/sext elimination capable of changing phi's. This
implements rdar://6013816 and the testcase in Transforms/InstCombine/sext-misc.ll.

llvm-svn: 52440
2008-06-18 04:00:49 +00:00
Devang Patel cd6b697945 Preserve dominance frontier while trivially unswitching loop.
llvm-svn: 52438
2008-06-18 02:16:38 +00:00
Matthijs Kooijman f03c1ae407 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.

llvm-svn: 52396
2008-06-17 12:02:52 +00:00
Evan Cheng 1cde1f8d5e Do not issue identity copies.
llvm-svn: 52373
2008-06-16 22:52:53 +00:00
Dan Gohman ab0dccba6b 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.

llvm-svn: 52371
2008-06-16 22:34:15 +00:00
Evan Cheng 49bad4c9e1 - 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.

llvm-svn: 52353
2008-06-16 20:29:38 +00:00
Matthijs Kooijman ac5bc8a3dd Make testcase check for extractvalue instead of extractelement.
llvm-svn: 52317
2008-06-16 13:03:44 +00:00
Matthijs Kooijman bcd4047dd4 Store the result of multiple identical run lines in a temporary file.
llvm-svn: 52314
2008-06-16 12:21:25 +00:00
Matthijs Kooijman 261e976fba Fix PR numbers, I accidentally switched two digits.
llvm-svn: 52311
2008-06-16 09:38:23 +00:00
Chris Lattner b35d9b5e07 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

llvm-svn: 52301
2008-06-16 06:19:11 +00:00
Chris Lattner f5c1170702 this is unneeded now.
llvm-svn: 52298
2008-06-16 04:25:39 +00:00
Chris Lattner 0701828be3 resolve PR2453 by adding a run line.
llvm-svn: 52296
2008-06-16 04:22:39 +00:00
Wojciech Matyjewicz ae9753b29d 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.

llvm-svn: 52291
2008-06-15 19:07:39 +00:00
Evan Cheng fb79059b85 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.
llvm-svn: 52266
2008-06-13 23:58:02 +00:00
Eli Friedman 2c580f0323 Remove unnecessary target lines.
llvm-svn: 52261
2008-06-13 22:12:16 +00:00
Eli Friedman 795749845d Remove unnecessary target lines.
llvm-svn: 52260
2008-06-13 22:10:32 +00:00
Eli Friedman 5de0a77a9b Don't skip over instructions other than loads that might read memory
when trying to sink stores.

llvm-svn: 52259
2008-06-13 22:02:12 +00:00
Dan Gohman 9ad8c54aab Protect ChangeCompareStride from situations in which it is possible
for it to generate use-before-def IR, such as in this testcase.

llvm-svn: 52258
2008-06-13 21:43:41 +00:00
Eli Friedman 9833a1b407 Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct.
Fixes PR2435.

llvm-svn: 52257
2008-06-13 21:17:49 +00:00
Duncan Sands 8651e9c584 Disable some DAG combiner optimizations that may be
wrong for volatile loads and stores.  In fact this
is almost all of them!  There are three types of
problems: (1) it is wrong to change the width of
a volatile memory access.  These may be used to
do memory mapped i/o, in which case a load can have
an effect even if the result is not used.  Consider
loading an i32 but only using the lower 8 bits.  It
is wrong to change this into a load of an i8, because
you are no longer tickling the other three bytes.  It
is also unwise to make a load/store wider.  For
example, changing an i16 load into an i32 load is
wrong no matter how aligned things are, since the
fact of loading an additional 2 bytes can have
i/o side-effects.  (2) it is wrong to change the
number of volatile load/stores: they may be counted
by the hardware.  (3) it is wrong to change a volatile
load/store that requires one memory access into one
that requires several.  For example on x86-32, you
can store a double in one processor operation, but to
store an i64 requires two (two i32 stores).  In a
multi-threaded program you may want to bitcast an i64
to a double and store as a double because that will
occur atomically, and be indivisible to other threads.
So it would be wrong to convert the store-of-double
into a store of an i64, because this will become two
i32 stores - no longer atomic.  My policy here is
to say that the number of processor operations for
an illegal operation is undefined.  So it is alright
to change a store of an i64 (requires at least two
stores; but could be validly lowered to memcpy for
example) into a store of double (one processor op).
In short, if the new store is legal and has the same
size then I say that the transform is ok.  It would
also be possible to say that transforms are always
ok if before they were illegal, whether after they
are illegal or not, but that's more awkward to do
and I doubt it buys us anything much.
However this exposed an interesting thing - on x86-32
a store of i64 is considered legal!  That is because
operations are marked legal by default, regardless of
whether the type is legal or not.  In some ways this
is clever: before type legalization this means that
operations on illegal types are considered legal;
after type legalization there are no illegal types
so now operations are only legal if they really are.
But I consider this to be too cunning for mere mortals.
Better to do things explicitly by testing AfterLegalize.
So I have changed things so that operations with illegal
types are considered illegal - indeed they can never
map to a machine operation.  However this means that
the DAG combiner is more conservative because before
it was "accidentally" performing transforms where the
type was illegal because the operation was nonetheless
marked legal.  So in a few such places I added a check
on AfterLegalize, which I suppose was actually just
forgotten before.  This causes the DAG combiner to do
slightly more than it used to, which resulted in the X86
backend blowing up because it got a slightly surprising
node it wasn't expecting, so I tweaked it.

llvm-svn: 52254
2008-06-13 19:07:40 +00:00
Matthijs Kooijman c5d12eb318 XFAIL some tests that became failing due to the extra error reporting recently. PR's are created for these.
llvm-svn: 52250
2008-06-13 16:52:35 +00:00
Nick Lewycky ed169d531d Crash less. The i64 restriction in BinomialCoefficient caused some problems
with code that was expecting different bit widths for different values.

Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.

llvm-svn: 52248
2008-06-13 04:38:55 +00:00
Evan Cheng 2d788ce3fb Fix some tests.
llvm-svn: 52245
2008-06-12 21:23:38 +00:00
Evan Cheng 70fe16353a Revert 52223.
llvm-svn: 52243
2008-06-12 20:55:39 +00:00
Matthijs Kooijman bf29ca681c Don't try to compile tests for the ev56 alpha subtarget, which hasn't been
supported since r33492.

llvm-svn: 52237
2008-06-12 13:44:26 +00:00
Matthijs Kooijman 48e8f0e50f Pass -silence-passes to bugpoint in testcases, this makes two out of three bugpoint testcases work again.
llvm-svn: 52236
2008-06-12 13:12:11 +00:00