Commit Graph

40399 Commits

Author SHA1 Message Date
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 9f515394d3 Remove unneeded iteration. Thanks to Dan for the feedback.
llvm-svn: 54337
2008-08-05 00:30:10 +00:00
Owen Anderson bbeb8f0807 This option doesn't need to be a target option. It can be in SDISel instead.
llvm-svn: 54336
2008-08-05 00:27:28 +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
Owen Anderson a102290bdc - Fix SelectionDAG to generate correct CFGs.
- Add a basic machine-level dead block eliminator.

These two have to go together, since many other parts of the code generator are unable to handle the unreachable blocks otherwise created.

llvm-svn: 54333
2008-08-04 23:54:43 +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
Dan Gohman 8ef79ebd5f Add an assert to catch invalid VECTOR_SHUFFLE mask indices.
llvm-svn: 54329
2008-08-04 23:09:15 +00:00
Bruno Cardoso Lopes a01ede2f11 Mips ISelLowering cleanup : Removed old LowerCALL and FORMAL_ARGS helpers, they
aren't used anyway, they also used to broke compiling when fastcc was specified for a
function, but not anymore.

llvm-svn: 54316
2008-08-04 07:12:52 +00:00
Bruno Cardoso Lopes 2ca70df58b Handle i32->f32 bitconvert results.
llvm-svn: 54315
2008-08-04 06:44:31 +00:00
Andrew Lenharth 77e3e86e70 Add atomic sub for other sizes
llvm-svn: 54314
2008-08-03 20:17:34 +00:00
Chris Lattner 796e9be3b1 Emit saveri with the correct operand order, patch by Richard Pennington!
llvm-svn: 54313
2008-08-03 18:16:14 +00:00
Bruno Cardoso Lopes 3e667cfe21 Fix PR2615
llvm-svn: 54312
2008-08-03 15:37:43 +00:00
Bruno Cardoso Lopes 3d4bdcc1a6 Improved asm inline for hi,lo results
Added hi,lo registers to be used,def implicitly. This provides better handle of
instructions which use hi/lo.
Fixes a small BranchAnalysis bug

llvm-svn: 54274
2008-08-02 19:42:36 +00:00
Bruno Cardoso Lopes 3397298b65 Apply the same pattern used in 'and' lowering for 'or'
llvm-svn: 54273
2008-08-02 19:37:33 +00:00
Duncan Sands c1e48b582d Fix comment typos.
llvm-svn: 54266
2008-08-01 12:23:49 +00:00
Bill Wendling a113655c79 Removed unused parameters.
llvm-svn: 54262
2008-08-01 05:50:13 +00:00
Dale Johannesen 962178e77e Make sse2 explicit, for non-x86 hosts.
llvm-svn: 54251
2008-07-31 20:16:33 +00:00
Bruno Cardoso Lopes e4798c83d0 Expand fcopysign
llvm-svn: 54250
2008-07-31 18:50:54 +00:00
Bruno Cardoso Lopes 23471047be Handle more SELECT corner cases considering legalize types, probabily wont work with
the default legalizer.

llvm-svn: 54249
2008-07-31 18:31:28 +00:00
Dale Johannesen c31eb205c1 Add a flag to disable jump table generation (all
switches use the binary search algorithm) for
environments that don't support it.  PPC64 JIT
is such an environment; turn the flag on for that.

llvm-svn: 54248
2008-07-31 18:13:12 +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
Bruno Cardoso Lopes 2d7ddea240 Added pattern for floating point zero immediate (avoiding a constant pool
access).
Added pattern to match bitconvert node.
Fixed MTC1 asm string bug.

llvm-svn: 54229
2008-07-30 19:00:31 +00:00
Dan Gohman 88e0df0c91 Move SelectionDAG::viewGraph() out of line; as an inline function
it isn't always visible to gdb.

llvm-svn: 54228
2008-07-30 18:48:53 +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
Owen Anderson c818c01539 Use existing LiveInterval methods to simplify live interval merging. Thanks to Evan for pointing these out.
llvm-svn: 54225
2008-07-30 18:27:35 +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
Owen Anderson 7b5f535590 Value numbers whose def index is a special sentinel value should not be remapped.
llvm-svn: 54218
2008-07-30 17:42:47 +00:00
Bruno Cardoso Lopes a950422221 Fixed bug in global address lowering for functions and in Brcond lowering
llvm-svn: 54215
2008-07-30 17:06:13 +00:00
Bruno Cardoso Lopes 57e17f0e14 Removed small section flag for mips, the assembler doesnt support this flag
llvm-svn: 54214
2008-07-30 17:04:04 +00:00
Bruno Cardoso Lopes f714e25f7e Added new features to represent specific instructions groups
llvm-svn: 54213
2008-07-30 17:01:06 +00:00
Bruno Cardoso Lopes 89e2b163fb Instruction definition cleanup
llvm-svn: 54212
2008-07-30 16:58:59 +00:00
Matthijs Kooijman be31571ca5 Document BasicBlock::Create.
llvm-svn: 54210
2008-07-30 12:53:14 +00:00
Matthijs Kooijman ca4ffaabcd Not that using stream headers other than iostream is allowed.
llvm-svn: 54209
2008-07-30 12:14:10 +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
Owen Anderson e9a0bae238 More fixes for corner cases when remapping live range indices.
llvm-svn: 54186
2008-07-30 00:22:56 +00:00
Owen Anderson 1aebe49ae7 When merging live intervals, we also need to merge in any live ranges that are inputs to two-address instructions
that themselves define a range we already care about.

llvm-svn: 54185
2008-07-30 00:21:16 +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
Owen Anderson 6b1cc46fee When merging a PHI operand's live interval into the PHI's live interval, we need to merge over all liveranges in
the operand's interval that share the relevant value number, not just the range that immediately precedes the PHI.

llvm-svn: 54174
2008-07-29 21:17:08 +00:00
Owen Anderson 2532e75933 Don't decrement the BB remap when we don't need to.
llvm-svn: 54173
2008-07-29 21:15:44 +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
Bruno Cardoso Lopes 2a24157364 Changed some methods order.
llvm-svn: 54169
2008-07-29 19:29:50 +00:00
Nate Begeman 82f1925708 Fix broken CellSPU lowering, re-instate braces in Legalize
llvm-svn: 54168
2008-07-29 19:07:27 +00:00
Bruno Cardoso Lopes e683bbabc7 Added floating point lowering for select.
llvm-svn: 54167
2008-07-29 19:05:28 +00:00
Duncan Sands 078791bab3 Set the executable bit - means it can actually
be run when installing on sparc sun.  Set the
mime type to text/x-sh while there.

llvm-svn: 54165
2008-07-29 18:31:42 +00:00
Nate Begeman d63495ff25 Disable a fix in the previous patch, since it breaks CellSPU.
The CellSPU codegen is broken, but needs to be fixed before we can
put this back in.

llvm-svn: 54164
2008-07-29 18:28:31 +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
Matthijs Kooijman 3d5d6f90e0 Improve bugpoint output a bit by outputting the actual instructions instead of
just it's name, which is often empty. Also remove a newline from the output
that wasn't really needed.

llvm-svn: 54158
2008-07-29 08:55:30 +00:00
Matthijs Kooijman 0446862796 Add a GetElementPtrInst::getIndexedType that accepts uint64_t's instead of just Value*'s.
llvm-svn: 54157
2008-07-29 08:46:11 +00:00
Evan Cheng bf83579b30 Fix for PR2578. Do not split off a block whose size is less than FreeRangeHeader::getMinBlockSize(). Patch by Damien.
llvm-svn: 54152
2008-07-29 07:38:32 +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
Dan Gohman 804c95df52 Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.

Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.

Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.

llvm-svn: 54146
2008-07-28 21:51:04 +00:00
Owen Anderson 813bf7af7f Don't remove volatile loads. Thanks to Duncan for noticing this one.
llvm-svn: 54144
2008-07-28 20:52:42 +00:00
Bill Wendling c5d24d64cf Remove extra lines
llvm-svn: 54143
2008-07-28 20:50:25 +00:00
Bruno Cardoso Lopes 98bda587e1 Disable gp_rel relocation for constant pools access for now.
llvm-svn: 54142
2008-07-28 19:26:25 +00:00
Duncan Sands 87c83704d3 Since build_vector is a variadic node, the number
of operands should be -1 not 0.

llvm-svn: 54141
2008-07-28 19:17:21 +00:00
Bruno Cardoso Lopes bcaf6e5243 Added floating point lowering for setcc and brcond.
Fixed COMM asm directive usage.
ConstantPool using custom FourByteConstantSection.

llvm-svn: 54139
2008-07-28 19:11:24 +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
Bill Wendling ac3cf6657b Don't build with 4.0.
llvm-svn: 54137
2008-07-28 18:45:36 +00:00
Dan Gohman 24b3ce1db6 Fix a typo in a comment.
llvm-svn: 54136
2008-07-28 18:43:51 +00:00
Dan Gohman 42912d1a1e Reword a comment to be less ambiguous.
llvm-svn: 54135
2008-07-28 18:42:57 +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
Owen Anderson d70cf1d5ae Fix a subtle bug when removing instructions from memdep. In very specific
circumstances we could end up remapping a dependee to the same instruction 
that we're trying to remove.  Handle this properly by just falling back to
a conservative solution.

llvm-svn: 54132
2008-07-28 16:00:58 +00:00
Bill Wendling d4c8cbd776 Remove <iostream> include.
llvm-svn: 54131
2008-07-27 23:18:30 +00:00
Dan Gohman 41a0f71c05 Don't use reinterpret_cast when it isn't needed.
llvm-svn: 54130
2008-07-27 23:12:19 +00:00
Dan Gohman 68e45a361b Make the ScheduleDAG's GraphRoot edge be blue and dashed too, like
the SelectionDAG's.

llvm-svn: 54129
2008-07-27 22:46:49 +00:00
Dan Gohman 2ce6f2ad5e Rename SDOperand to SDValue.
llvm-svn: 54128
2008-07-27 21:46:04 +00:00
Dan Gohman 91e5dcb680 Tidy SDNode::use_iterator, and complete the transition to have it
parallel its analogue, Value::value_use_iterator. The operator* method
now returns the user, rather than the use.

llvm-svn: 54127
2008-07-27 20:43:25 +00:00
Dan Gohman 108c58aef4 Fix embedded CRLF characters.
llvm-svn: 54125
2008-07-27 18:37:58 +00:00
Dan Gohman bb5f43ed4d Rename isOnlyUseOf to isOnlyUserOf.
llvm-svn: 54124
2008-07-27 18:06:42 +00:00
Dan Gohman b7a791b793 Improve comments for SDNode use-count methods. No functionality change.
llvm-svn: 54123
2008-07-27 17:44:52 +00:00
Duncan Sands d9374421ea Some binary operations were being treated as
unary operations!  Add support for softening
some additional unary operations like fp_to_sint.

llvm-svn: 54122
2008-07-27 12:28:43 +00:00
Owen Anderson 54912b3e8d Fix the issues originally addressed in r54070. After thinking about it some more, I realized that the right thing to do
is to have StrongPHIElimination use its knowledge of the PHIs before they're erased to update the intervals appropriate.  This is
both simpler and more accurate than the alternative, which was having LIA figure it out when it renumbered things, plus it's just
the right thing to do!

llvm-svn: 54077
2008-07-25 23:38:08 +00:00
Owen Anderson 7a45b168ac Revert my previous patch. In retrospect, this is completely the wrong way to fix this problem.
llvm-svn: 54072
2008-07-25 23:06:59 +00:00
Owen Anderson 074f9db2fd Special cases are needed in renumbering when dealing with renumbering after a PHI has been removed. The interval previously defined
by the PHI needs to be extended to the beginning of its basic block, and the intervals that were inputs need to be trimmed to the end 
of their basic blocks.

llvm-svn: 54070
2008-07-25 22:32:01 +00:00
Owen Anderson 0346aba5c2 In order to avoid reprocessing a register more than once, we need to add it
to the handled set so it will get filtered out in future iterations.

llvm-svn: 54065
2008-07-25 21:35:43 +00:00
Owen Anderson d9c8711d70 Remove live interval entries for an interval if we're eliminating its only VN.
llvm-svn: 54062
2008-07-25 21:08:41 +00:00
Owen Anderson 88499a3503 Properly remap live ranges whose end indices are the end of the function.
llvm-svn: 54061
2008-07-25 21:07:13 +00:00
Dan Gohman 685fd8081d Rename the version of CreateRet that's a convenience method for creating
multiple-valued return values, so that the name CreateRet is just for
creating plain ret statements.

llvm-svn: 54053
2008-07-25 20:36:15 +00:00
Owen Anderson c7d53fd331 Make the remapping of interval indices (particularly ending indices) more robust.
This is tricky business, and will probably take a few more iterations to get
the last kinks out of it.

llvm-svn: 54043
2008-07-25 19:50:48 +00:00
Duncan Sands 082af393ff Fix error: ‘std::ostream’ has not been declared
when compiling with gcc 4.3.

llvm-svn: 54041
2008-07-25 19:29:14 +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
Nate Begeman 098cc6f22c Remove unnecessary implicit argument
llvm-svn: 54031
2008-07-25 17:56:27 +00:00
Nate Begeman c96e2e4968 Fix minor issues with VICmp/VFCmp constant expressions
llvm-svn: 54030
2008-07-25 17:35:37 +00:00
Nate Begeman 6559ada908 Fit in 80 cols
llvm-svn: 54029
2008-07-25 17:34:41 +00:00
Nate Begeman fd7b2be8e3 Allow verifier to be run on partially materialized modules.
llvm-svn: 54028
2008-07-25 17:28:23 +00:00
Nate Begeman 5f0cfd0968 Add predicate for GhostLinkage, used by the JIT
llvm-svn: 54027
2008-07-25 17:26:48 +00:00
Nate Begeman 628ab8c673 Remove dead PatLeaf; there are a number of issues around MMX movl that need to be fixed.
llvm-svn: 54026
2008-07-25 17:25:04 +00:00
Nate Begeman 8a4afd921e Tab removal
llvm-svn: 54025
2008-07-25 17:24:13 +00:00
Dan Gohman a55fd4021e Add a #include for the uses of uint64_t.
llvm-svn: 54016
2008-07-25 15:39:12 +00:00
Dan Gohman 4e6a25ac45 This test needs -aggressive-remat enabled.
llvm-svn: 54015
2008-07-25 15:25:32 +00:00
Dan Gohman 394ec3ab5a Disable the new aggressive remat logic introduced in 54000; it causes some
regressions, such as PR2595. Also, there is a significant code-quality
issue in SPEC 464.h264ref and a few others.

llvm-svn: 54014
2008-07-25 15:08:37 +00:00