Commit Graph

19396 Commits

Author SHA1 Message Date
Chris Lattner f852e339b6 Fix CodeGen/X86/inline-asm-x-scalar.ll:test4, by retaining regclass info
for tied register constraints.

llvm-svn: 37601
2007-06-15 19:11:01 +00:00
Evan Cheng 234a90e83e MachineInstr::isPredicable() is no longer needed.
llvm-svn: 37599
2007-06-15 19:06:07 +00:00
Duncan Sands 92bf2c628c Workaround for PR1508.
llvm-svn: 37597
2007-06-15 19:04:19 +00:00
Dan Gohman 203a035251 Use SCEVConstant::get instead of SCEVUnknown::get to create an
integer constant SCEV.

llvm-svn: 37596
2007-06-15 18:00:55 +00:00
Owen Anderson acaed06827 Fix test/Transforms/GVNPRE/2007-06-15-Looping.ll
llvm-svn: 37595
2007-06-15 17:55:15 +00:00
Evan Cheng cd5f5e3ecd Extra edges are deleted later if needed.
llvm-svn: 37593
2007-06-15 17:34:48 +00:00
Dan Gohman cb9e09ad57 Add a SCEV class and supporting code for sign-extend expressions.
This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.

llvm-svn: 37591
2007-06-15 14:38:12 +00:00
Evan Cheng 92fb5453c3 Allow small blocks to be duplicated to enable if-conversion.
llvm-svn: 37590
2007-06-15 07:36:12 +00:00
Chris Lattner 373389260f Generalize many transforms to work on ~ of vectors in addition to ~ of
integer ops.  This implements Transforms/InstCombine/and-or-not.ll
test3/test4, and finishes off PR1510

llvm-svn: 37589
2007-06-15 06:23:19 +00:00
Chris Lattner 72e3958003 add a Constant::getAllOnesValue helper function, which works on integers
AND vectors.

llvm-svn: 37586
2007-06-15 06:10:53 +00:00
Chris Lattner 1edec381a5 Enhance BinaryOperator::isNot to support vector not.
llvm-svn: 37585
2007-06-15 06:04:24 +00:00
Chris Lattner 481e28b1f5 Implement two xforms:
1. ~(~X | Y) === (X & ~Y)
2. (A|B) & ~(A&B) -> A^B

This allows us to transform  ~(~(a|b) | (a&b)) -> a^b.

This implements PR1510 for scalar values.

llvm-svn: 37584
2007-06-15 05:58:24 +00:00
Chris Lattner f14e5175ed delete some obviously dead vector operations, which deletes a few thousand
operations from Duraids example.

llvm-svn: 37582
2007-06-15 05:26:55 +00:00
Evan Cheng add977670f No really, clear predcessors states.
llvm-svn: 37581
2007-06-14 23:34:09 +00:00
Evan Cheng 9fc56c079d If BB is predicated, invalidate its predecessor(s) which would if-convert it. It needs to be re-analyzed.
llvm-svn: 37580
2007-06-14 23:13:19 +00:00
Dan Gohman 5c4413120f Rename MVT::getVectorBaseType to MVT::getVectorElementType.
llvm-svn: 37579
2007-06-14 22:58:02 +00:00
Dale Johannesen 616627b002 Do not treat FP_REG_KILL as terminator in branch analysis (X86).
llvm-svn: 37578
2007-06-14 22:03:45 +00:00
Evan Cheng e08f0eefa6 Fix typo.
llvm-svn: 37577
2007-06-14 21:26:08 +00:00
Dan Gohman 4a4a8eb00e Add a target hook to allow loads from constant pools to be rematerialized, and an
implementation for x86.

llvm-svn: 37576
2007-06-14 20:50:44 +00:00
Evan Cheng 1e6f08b2a2 Fix some stupid bugs that have effectively disabled if-conversion.
llvm-svn: 37575
2007-06-14 20:28:52 +00:00
Dan Gohman 3a8e2a8b2f Eliminate some redundant newlines in asm output.
llvm-svn: 37574
2007-06-14 15:00:27 +00:00
Christopher Lamb f274efef9f Add support to tablegen for specifying subregister classes on a per register class basis.
llvm-svn: 37572
2007-06-13 22:20:15 +00:00
Dale Johannesen c68554683d Handle blocks with 2 unconditional branches in AnalyzeBranch.
llvm-svn: 37571
2007-06-13 17:59:52 +00:00
Duncan Sands 7413736a7e Only correctly lower exception handing intrinsics if exception handling is
turned on.  Likewise for scanning of invokes to mark landing pads.

llvm-svn: 37570
2007-06-13 16:53:21 +00:00
Dan Gohman 26455c4ae0 Introduce new SelectionDAG node opcodes VEXTRACT_SUBVECTOR and
VCONCAT_VECTORS. Use these for CopyToReg and CopyFromReg legalizing in
the case that the full register is to be split into subvectors instead
of scalars. This replaces uses of VBIT_CONVERT to present values as
vector-of-vector types in order to make whole subvectors accessible via
BUILD_VECTOR and EXTRACT_VECTOR_ELT.

This is in preparation for adding extended ValueType values, where
having vector-of-vector types is undesirable.

llvm-svn: 37569
2007-06-13 15:12:02 +00:00
Dan Gohman cbd51c8b60 When creating CopyFromReg nodes, always use legal types. And use the
correct types for the result vector, even though it is currently bitcasted
to a different type immediately.

llvm-svn: 37568
2007-06-13 14:55:16 +00:00
Duncan Sands 97f7236e70 The fix that was applied for PR1224 stops the compiler
crashing but breaks exception handling.  The problem
described in PR1224 is that invoke is a terminator that
can produce a value.  The value may be needed in other
blocks.  The code that writes to registers values needed
in other blocks runs before terminators are lowered (in
this case invoke) so asserted because the value was not
yet available.  The fix that was applied was to do invoke
lowering earlier, before writing values to registers.

The problem this causes is that the code to copy values
to registers can be output after the invoke call.  If
an exception is raised and control is passed to the
landing pad then this copy-code will never execute.  If
the value is needed in some code path reached via the
landing pad then that code will get something bogus.

So revert the original fix and simply skip invoke values
in the general copying to registers code.  Instead copy
the invoke value to a register in the invoke lowering code.

llvm-svn: 37567
2007-06-13 05:51:31 +00:00
Evan Cheng cbaaff58bf Typo
llvm-svn: 37566
2007-06-13 00:04:00 +00:00
Evan Cheng 9acfa7b063 Now if-converting all 4 variants of triangles.
llvm-svn: 37565
2007-06-12 23:54:05 +00:00
Owen Anderson 4036ad485f Fix test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll
llvm-svn: 37564
2007-06-12 22:43:57 +00:00
Devang Patel 149a7616dc isReachableFromEntry() is not suitable for post dominator.
llvm-svn: 37562
2007-06-12 17:50:25 +00:00
Devang Patel 47419ee142 Remove redundant check.
llvm-svn: 37561
2007-06-12 17:35:20 +00:00
Devang Patel dcf0c03ff7 Check A dominates B and vise versa first while searching for nearest
common dominator.

llvm-svn: 37559
2007-06-12 17:17:57 +00:00
Owen Anderson 4276984012 Refactor some code, and fix test/Transforms/GVNPRE/2007-06-12-NoExit.ll by being more careful when using
post-dominator information.

llvm-svn: 37556
2007-06-12 16:57:50 +00:00
Dale Johannesen edfec0b515 Sink CmpInst's to their uses to reduce register pressure.
llvm-svn: 37554
2007-06-12 16:50:17 +00:00
Devang Patel a6ff5bf9ba Break DominatorTree from ETNode.
Remove unused PostETForest.

llvm-svn: 37551
2007-06-12 00:54:38 +00:00
Owen Anderson a75dd4dc56 Fix a few more bugs, including an instance of walking in reverse topological rather than topological order. This
fixes a testcase extracted from llvm-test.

llvm-svn: 37550
2007-06-12 00:50:47 +00:00
Devang Patel d324360352 Use SmallPtrSet instaed of std::set
llvm-svn: 37548
2007-06-12 00:40:51 +00:00
Devang Patel 9576fac800 Check immediate dominators first while searching for nearset common dominator.
Fix 80 col violations.

llvm-svn: 37547
2007-06-12 00:35:38 +00:00
Devang Patel 88ea2dbc68 Maintain DFS number in DomTreeNode itself.
This means now ETNodes are not useful anymore.

llvm-svn: 37546
2007-06-12 00:14:41 +00:00
Devang Patel 78b9c68164 Add and use DominatorTreeBase::findNearestCommonDominator().
llvm-svn: 37545
2007-06-11 23:31:22 +00:00
Lauro Ramos Venancio 4c2f003971 Fix a typo in bswap lowering.
llvm-svn: 37544
2007-06-11 23:16:16 +00:00
Evan Cheng 4dd31a7b1b Restructure code to reduce ifcvt compile time cost.
llvm-svn: 37543
2007-06-11 22:26:22 +00:00
Devang Patel 536ac4dca7 Simplify.
llvm-svn: 37542
2007-06-11 21:45:31 +00:00
Devang Patel d18054afcf simplify
llvm-svn: 37541
2007-06-11 21:25:31 +00:00
Devang Patel ab2eee89a4 Simplify. Dominator Tree is required so always available.
llvm-svn: 37540
2007-06-11 21:18:00 +00:00
Owen Anderson d184c18074 Handle functions with multiple exit blocks properly.
llvm-svn: 37539
2007-06-11 16:25:17 +00:00
Devang Patel c43f32b935 Use DominatorTree instead of ETForest.
llvm-svn: 37538
2007-06-11 15:40:48 +00:00
Reid Spencer 14b62a553e Fix the build.
llvm-svn: 37537
2007-06-10 00:19:17 +00:00
Owen Anderson 223718c40e Perform PRE of comparison operators.
llvm-svn: 37536
2007-06-09 18:35:31 +00:00
Chris Lattner 75372ad603 fix x86-64 mmx calling convention for real, which passes in integer gprs.
llvm-svn: 37534
2007-06-09 05:08:10 +00:00
Chris Lattner a4a49e37ab fix mmx handling bug
llvm-svn: 37533
2007-06-09 05:01:50 +00:00
Nick Lewycky d18b16034a Fix edge case.
llvm-svn: 37532
2007-06-09 04:20:33 +00:00
Evan Cheng 2117d1f20e Don't change CFG during analysis stage. Do so during ifcvt and invalidate predecessors accordingly.
llvm-svn: 37531
2007-06-09 01:03:43 +00:00
Owen Anderson 7d76b2a774 Collect statistics from GVN-PRE.
llvm-svn: 37530
2007-06-08 22:02:36 +00:00
Evan Cheng 288f1545a6 Carefully remove extraneous CFG edges after each ifcvt.
llvm-svn: 37529
2007-06-08 22:01:07 +00:00
Evan Cheng 5514bbef46 Add a utility routine to check for unpredicated terminator instruction.
llvm-svn: 37528
2007-06-08 21:59:56 +00:00
Lauro Ramos Venancio c7ebbaa10e Define AsmTransCBE for ARM.
llvm-svn: 37527
2007-06-08 21:06:23 +00:00
Owen Anderson b232efaf48 Fix typo in a comment.
llvm-svn: 37526
2007-06-08 20:57:08 +00:00
Owen Anderson 55994f2453 Fix a bug that was causing the elimination phase not to replace values when it should be.
With this patch, GVN-PRE now correctly optimizes the example from the thesis.

Many thanks to Daniel Berlin for helping me find errors in this.

llvm-svn: 37525
2007-06-08 20:44:02 +00:00
Evan Cheng df1a42935b Correct transfer predicate information.
llvm-svn: 37524
2007-06-08 19:17:12 +00:00
Evan Cheng e93ccc013f Hidden options to help debugging ifcvt issues.
llvm-svn: 37523
2007-06-08 19:10:51 +00:00
David Greene 02f6e9b621 Factor live variable analysis so it does not do register coalescing
simultaneously.  Move that pass to SimpleRegisterCoalescing.

This makes it easier to implement alternative register allocation and
coalescing strategies while maintaining reuse of the existing live
interval analysis.

llvm-svn: 37520
2007-06-08 17:18:56 +00:00
Evan Cheng 7783f82e21 Allow more cmp / bcc to be predicated; clean up triangle ifcvt checking code.
llvm-svn: 37518
2007-06-08 09:36:04 +00:00
Evan Cheng 6740da9407 Fix ARM condition code subsumission check.
llvm-svn: 37517
2007-06-08 09:14:47 +00:00
Evan Cheng f62a5afb98 tBcc is not a barrier.
llvm-svn: 37516
2007-06-08 09:13:23 +00:00
Duncan Sands dc8fc1550e Use more realistically sized vectors. Reserve capacity if we know in advance
how much will be used.

llvm-svn: 37515
2007-06-08 08:59:11 +00:00
Owen Anderson 2e5efc30c2 Small bugfix, and const-ify some methods (Thanks, Bill).
llvm-svn: 37513
2007-06-08 01:52:45 +00:00
Devang Patel becc466451 Update LoopSimplify to require and preserve DominatorTree only.
Now LoopSimplify does not require nor preserve ETForest.

llvm-svn: 37512
2007-06-08 01:50:32 +00:00
Dale Johannesen 86798e5e11 Make throttle a hidden parameter, per review.
llvm-svn: 37511
2007-06-08 01:08:52 +00:00
Owen Anderson be80240b29 Add partial redundancy elimination.
llvm-svn: 37510
2007-06-08 01:03:01 +00:00
Dale Johannesen 52fcf022f7 Throttle tail merging; handling blocks with large numbers of predecessors
is too slow.

llvm-svn: 37509
2007-06-08 00:34:27 +00:00
Devang Patel aee309e353 Use DominatorTree instead of ETForest.
llvm-svn: 37507
2007-06-08 00:17:13 +00:00
Devang Patel 8ecffa996a Do not preserve ETForest.
llvm-svn: 37506
2007-06-08 00:02:08 +00:00
Devang Patel 31257adce9 Use DominatorTree instead of ETForest.
llvm-svn: 37505
2007-06-07 23:53:38 +00:00
Devang Patel 46d92cae96 Add instruction level dominates(A,B) interface.
llvm-svn: 37504
2007-06-07 23:52:40 +00:00
Evan Cheng 1236ef7bcc Only remove the edge from entry to false if false block is merged.
llvm-svn: 37503
2007-06-07 22:31:28 +00:00
Devang Patel 3f4c6fe7e8 Do not require ETForest. Now it is unused by LICM.
llvm-svn: 37502
2007-06-07 22:21:15 +00:00
Devang Patel cf470e5255 Do not use ETForest as well as DomiantorTree. DominatorTree is sufficient.
llvm-svn: 37501
2007-06-07 22:17:16 +00:00
Devang Patel fc7fdef7d2 Use DominatorTree instead of ETForest.
This allows faster immediate domiantor walk.

llvm-svn: 37500
2007-06-07 21:57:03 +00:00
Devang Patel df6355ccf8 Use DominatorTree instead of ETForest.
llvm-svn: 37499
2007-06-07 21:42:15 +00:00
Devang Patel fb582f8dda Use DominatorTree instead of ETForest.
llvm-svn: 37498
2007-06-07 21:35:27 +00:00
Dale Johannesen 9a4d987a5f Do not change the size of function arguments. PR 1489.
llvm-svn: 37496
2007-06-07 21:07:15 +00:00
Devang Patel 5b8a5516e4 Use DominatorTree instead of ETForest.
llvm-svn: 37495
2007-06-07 18:45:06 +00:00
Devang Patel 593e766fb5 Use DominatorTree instead of ETForest.
llvm-svn: 37494
2007-06-07 18:40:55 +00:00
Devang Patel af41e4a192 Maintain ETNode as part of DomTreeNode.
This adds redundancy for now.

llvm-svn: 37492
2007-06-07 17:47:21 +00:00
Tanya Lattner 5801c23e05 Formating fixes.
llvm-svn: 37491
2007-06-07 17:12:16 +00:00
Evan Cheng d3f3f0adad ifcvt a triangle: don't merge ifcvt block with rejoin block if it can fall through to it. If merged, the resulting block is not a candidate for iterative ifcvting since it contains both predicated and non-predicated code.
llvm-svn: 37487
2007-06-07 08:13:00 +00:00
Zhou Sheng 0ae22e99c8 Add assert to check if the attributes ZExt/SExt, NoAlias are apply to the
correct type of parameters.

llvm-svn: 37486
2007-06-07 06:12:03 +00:00
Evan Cheng be9859eea2 Lots of bug fixes. Now finally in a reasonable state.
llvm-svn: 37485
2007-06-07 02:12:15 +00:00
Evan Cheng 842be09d86 Stupid cut-n-paste bug caused me soooo much grief. Why wasn't there a compilation warning? I blame it on the FE folks.
llvm-svn: 37484
2007-06-07 01:37:54 +00:00
Lauro Ramos Venancio 85703e3796 Propagate alignment, section name and visibility when linking "appending
global values".
Fix noinline linkage.

llvm-svn: 37482
2007-06-06 22:01:12 +00:00
Tanya Lattner cb90f1d881 Instruct the inliner to obey the noinline attribute. Add test case.
llvm-svn: 37481
2007-06-06 21:59:26 +00:00
Chris Lattner 34404e3247 simplify this code and fix PR1493, now that llvm-gcc3 is dead.
llvm-svn: 37478
2007-06-06 20:51:41 +00:00
Devang Patel def2d9790a Add new dominator tree node into dominator tree node map.
llvm-svn: 37475
2007-06-06 20:08:11 +00:00
Lauro Ramos Venancio 368e8872db Fix PR1499.
llvm-svn: 37472
2007-06-06 17:08:48 +00:00
Owen Anderson cfb6f40424 Quick patch to fix the build, based on what it appears Evan meant to write.
Evan, please check that this is in fact correct.

llvm-svn: 37471
2007-06-06 16:22:00 +00:00
Duncan Sands 29d1dc6f1a Fold the exception actions table harder: if two typeid lists start the
same, only output one copy of the common part.

llvm-svn: 37470
2007-06-06 15:37:31 +00:00
Nick Lewycky df543f4b84 Optimize this test. Firstly, only Instructions may use other Instructions.
Secondly, checking whether removal succeeded tells you whether it was in
the map to begin with.

llvm-svn: 37469
2007-06-06 11:26:20 +00:00
Evan Cheng e8c3cbf971 Mark these instructions clobbersPred. They modify the condition code register.
llvm-svn: 37468
2007-06-06 10:17:05 +00:00
Evan Cheng 9030b98aca Lots of bug fixes.
llvm-svn: 37467
2007-06-06 10:16:17 +00:00
Evan Cheng d04409154f Added clobbersPred.
llvm-svn: 37466
2007-06-06 10:15:28 +00:00
Duncan Sands 61166501a1 Additional fix for PR1422: make sure the landing pad label is placed in the
correct machine basic block - do not rely on the eh.exception intrinsic
being in the landing pad: the loop optimizers can move it out.

llvm-svn: 37463
2007-06-06 10:05:18 +00:00
Bruno Cardoso Lopes 35e43c49b0 Initial Mips support, here we go! =)
- Modifications from the last patch included
  (issues pointed by Evan Cheng are now fixed).
- Added more MipsI instructions.
- Added more patterns to match branch instructions.

llvm-svn: 37461
2007-06-06 07:42:06 +00:00
Nick Lewycky 3e84212897 Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll
llvm-svn: 37459
2007-06-06 04:12:20 +00:00
Nick Lewycky 91ed6efc24 Inform ScalarEvolutions that we're deleting Values.
This is the obviously correct part of the fix for PR1487.

llvm-svn: 37457
2007-06-06 03:51:56 +00:00
Evan Cheng e4ec918be0 If a unconditional branch is added to branch to the false path during ifcvt, the predicated block cannot be iteratively ifcvted.
llvm-svn: 37456
2007-06-06 02:08:52 +00:00
Owen Anderson 634a063c1d Add simple full redundancy elimination.
llvm-svn: 37455
2007-06-06 01:27:49 +00:00
Chris Lattner 1b7b6e76ec Fix PR1495 and CodeGen/X86/2007-06-05-LSR-Dominator.ll
llvm-svn: 37454
2007-06-06 01:23:55 +00:00
Evan Cheng b30a89457c Minor statistics counting bug.
llvm-svn: 37451
2007-06-06 01:12:44 +00:00
Evan Cheng 30565998bb Fix a couple of typos and be smarter about order of blocks when ifcvt a diamond.
llvm-svn: 37449
2007-06-06 00:57:55 +00:00
Devang Patel 506310d3dd Avoid non-trivial loop unswitching while optimizing for size.
llvm-svn: 37446
2007-06-06 00:21:03 +00:00
Chris Lattner 31f82dff21 Fix a user-reported error building with GCC 3.4.4 on Cygwin.
llvm-svn: 37445
2007-06-05 23:49:06 +00:00
Evan Cheng 7948422b78 Fix diamond shape ifcvt bugs.
llvm-svn: 37444
2007-06-05 23:46:14 +00:00
Owen Anderson ddbe430732 Fix a misunderstanding of the algorithm. Really, we should be tracking values
and expression separately.  We can get around this, however, by only keeping
opaque values in TMP_GEN.

llvm-svn: 37443
2007-06-05 23:46:12 +00:00
Owen Anderson c84720913a Don't leak memory.
llvm-svn: 37442
2007-06-05 22:11:49 +00:00
Evan Cheng c1a0b8ce1d ReplaceUsesOfBlockWith() can modify the predecessors list.
llvm-svn: 37441
2007-06-05 22:03:53 +00:00
Evan Cheng 3e5bf0827c Do not ifcvt if either true / false path is a backedge. Not profitable in almost all cases.
llvm-svn: 37440
2007-06-05 20:38:42 +00:00
Devang Patel 3e6519e9fa Fix PR 1497
Use separate pass id for CFGOnlyPrinter.

llvm-svn: 37439
2007-06-05 20:24:36 +00:00
Evan Cheng 5c48958a61 Print predicate of the second instruction of the two-piece constant MI.
llvm-svn: 37437
2007-06-05 18:55:18 +00:00
Owen Anderson 9b89e4b561 Fix a small bug, some 80 cols violations, and add some more debugging output.
llvm-svn: 37436
2007-06-05 17:31:23 +00:00
Dan Gohman 151169df1e Allow insertelement, extractelement, and shufflevector to be hoisted/sunk
by LICM.

llvm-svn: 37435
2007-06-05 16:05:55 +00:00
Evan Cheng 252695f0f6 PIC label asm printing cosmetic changes.
llvm-svn: 37434
2007-06-05 07:36:38 +00:00
Evan Cheng 2c1acd6d9e I had a senior moment.
llvm-svn: 37433
2007-06-05 07:05:25 +00:00
Zhou Sheng 2444a9adeb Commit first round work of PR1373. "noalias" is now fully supported in
VMCore, BitCode, and Assembly. Documentation and test case paramattrs.ll
updated also.

llvm-svn: 37432
2007-06-05 05:28:26 +00:00
Evan Cheng 6e4babe8cc If the predicated block requires an early exit, end the block there and add a unconditional branch to false block. AnalyzeBranch() does not understand early exits.
llvm-svn: 37430
2007-06-05 01:31:40 +00:00
Evan Cheng 17aad8164e Fix some subtle bugs: bug during succeessor copying; incorrectly updating states of ifcvted blocks.
llvm-svn: 37429
2007-06-05 00:07:37 +00:00
Bill Wendling 6357bf20fa Patches by Chuck Rose to unbreak V Studio builds.
Thanks Chuck!

llvm-svn: 37428
2007-06-04 23:52:59 +00:00
Dale Johannesen 0558dda319 Tail merging wasn't working for predecessors of landing pads. PR 1496.
llvm-svn: 37427
2007-06-04 23:52:54 +00:00
Devang Patel b3adb9876a s/ETNode::getChildren/ETNode::getETNodeChildren/g
llvm-svn: 37426
2007-06-04 23:45:02 +00:00
Owen Anderson 3c9d8eef21 Don't use std::set_difference when the two sets are sorted differently. Compute
the difference manually instead.

This allows GVNPRE to produce correct analysis for the example in the GVNPRE
paper.

llvm-svn: 37425
2007-06-04 23:34:56 +00:00
Owen Anderson 3df5299f94 Fix a bunch of small bugs, and improve the debugging output significantly.
llvm-svn: 37424
2007-06-04 23:28:33 +00:00
Chris Lattner d7897d40b6 When rebuilding constant structs, make sure to honor the isPacked bit.
This fixes PR1491 and GlobalOpt/2007-06-04-PackedStruct.ll

llvm-svn: 37423
2007-06-04 22:23:42 +00:00
Evan Cheng 53ce7de03b Global ctors / dtors alignment shouldn't be hard-coded at 4. e.g. It could be 8 for 64-bit targets.
llvm-svn: 37421
2007-06-04 20:39:18 +00:00
Evan Cheng 91233153bf Forgot to check for if iterator reached the end.
llvm-svn: 37420
2007-06-04 20:33:36 +00:00
Evan Cheng 59ca6a846f Misuse of hasExternalLinkage(), should be checking isDeclaration().
llvm-svn: 37419
2007-06-04 18:54:57 +00:00
Owen Anderson 38b6b22a41 Make phi_translate correct.
llvm-svn: 37418
2007-06-04 18:05:26 +00:00
Devang Patel 4a7c2830d4 Add FIXMEs.
llvm-svn: 37417
2007-06-04 17:38:00 +00:00
Devang Patel ebc5b96735 s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
llvm-svn: 37415
2007-06-04 16:43:25 +00:00
Devang Patel a89566aefd Add basic block level interface to change immediate dominator
and create new node.

llvm-svn: 37414
2007-06-04 16:22:33 +00:00
Dan Gohman b4c2690446 Pass the DAG to SDNode::dump to let it do more detailed dumps in some cases.
llvm-svn: 37413
2007-06-04 16:17:33 +00:00
Dan Gohman 92a7f3a65e Resolve implicit alignment before computing the FoldingSet information so
that the CSE map always contains explicit alignment information. This allows
more loads to be CSE'd when there is a mix of explicit-alignment loads and
implicit-alignment loads.

Also, in SelectionDAG::FindModifiedNodeSlot, add the operands to the
FoldingSetNodeID before the load/store information instead of after, so
that it matches what is done elsewhere.

llvm-svn: 37411
2007-06-04 15:49:41 +00:00
Devang Patel d609374ab3 Fix LLVM build on NetBSD. Patch by Neil Booth.
llvm-svn: 37410
2007-06-04 15:28:57 +00:00
Evan Cheng 312b723af2 Let IfConverter loose. Allow more aggressive subsumptions; reorder basic blocks to expose more ifcvt opportunities; code clean up and fixes.
llvm-svn: 37409
2007-06-04 06:47:22 +00:00
Evan Cheng df75785594 Move ReplaceUsesOfBlockWith() out of BranchFolding into a MachineBasicBlock general facility.
llvm-svn: 37408
2007-06-04 06:44:01 +00:00
Devang Patel bdd1aaef10 s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
llvm-svn: 37407
2007-06-04 00:32:22 +00:00
Owen Anderson 0eca9aad10 Don't use the custom comparator where it's not necessary.
llvm-svn: 37406
2007-06-03 22:02:14 +00:00
Anton Korobeynikov b781886de7 Add comments to fallsthrough cases. Also, this fixes PR1492
llvm-svn: 37405
2007-06-03 19:20:49 +00:00
Anton Korobeynikov 8c32c1114f Check arguments & return types of main(). Abort in case of no match.
llvm-svn: 37404
2007-06-03 19:17:35 +00:00
Devang Patel 0e8aa7b69a s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
llvm-svn: 37403
2007-06-03 06:26:14 +00:00
Owen Anderson 46499645db Remove an unused method.
llvm-svn: 37402
2007-06-03 05:58:25 +00:00
Owen Anderson 0b68cda302 There's no need to have an Expression class... Value works just as well! This simplifies a lot of code.
llvm-svn: 37401
2007-06-03 05:55:58 +00:00
Chris Lattner 446548d2a3 update this entry, now that Anton implemented shift/and lowering for
switches.  There is one really easy isel thing here with tst we are not
getting.

llvm-svn: 37400
2007-06-02 18:45:14 +00:00
Duncan Sands f708f73a1b The semantics of invoke require that we always jump to the unwind block
(landing pad) when an exception unwinds through the call.  This doesn't
quite match the way the dwarf unwinder works: by default it only jumps to
the landing pad if the catch or filter specification matches, and otherwise
it keeps on unwinding.  There are two ways of specifying to the unwinder
that it should "always" (more on why there are quotes here later) jump to
the landing pad: follow the specification by a 0 typeid, or follow it by
the typeid for the NULL typeinfo.  GCC does the first, and this patch makes
LLVM do the same as gcc.  However there is a problem: the unwinder performs
optimizations based on C++ semantics (it only expects destructors to be
run if the 0 typeid fires - known as "cleanups"), meaning it assumes that no
exceptions will be raised and that the raised exception will be reraised
at the end of the cleanup code.  So if someone writes their own LLVM code
using the exception intrinsics they will get a nasty surprise if they don't
follow these rules.  The other possibility of using the typeid corresponding
to NULL (catch-all) causes the unwinder to make no assumptions, so this is
probably what we should use in the long-run.  However since we are still
having trouble getting exception handling working properly, for the moment
it seems best to closely imitate GCC.

llvm-svn: 37399
2007-06-02 17:16:06 +00:00
Duncan Sands c063f5f362 Integrate exception filter support and exception catch support. This
simplifies the code in DwarfWriter, allows for multiple filters and
makes it trivial to specify filters accompanied by cleanups or catch-all
specifications (see next patch).  What a deal!  Patch blessed by Anton.

llvm-svn: 37398
2007-06-02 16:53:42 +00:00
Zhou Sheng 0a0ae932ca Make LowerCTPOP() support arbitrary bitwidth integer type.
llvm-svn: 37397
2007-06-02 04:10:33 +00:00
Dale Johannesen 6e7cdce773 Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.
llvm-svn: 37394
2007-06-02 00:08:15 +00:00
Dale Johannesen 9746e3a22b Fancier algorithm in tail-merge comment implemented, so remove comment.
llvm-svn: 37393
2007-06-01 23:04:28 +00:00
Dale Johannesen 3c0a13762d Implement smarter algorithm for choosing which blocks to tail-merge.
See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well;
shaves another 10K off our favorite benchmark.  I was hesitant about
this because of compile speed, but seems to do OK on a bootstrap.

llvm-svn: 37392
2007-06-01 23:02:45 +00:00
Reid Spencer ff38cf8880 For PR1486:
Avoid overwriting the APInt instance with 0 bytes which causes the bitwidth
to be set to 0 (illegal) producing a subsequent assert.

llvm-svn: 37391
2007-06-01 22:23:29 +00:00
Devang Patel ac54a62fd2 Insert new instructions in AliasSet.
llvm-svn: 37390
2007-06-01 22:15:31 +00:00
Owen Anderson 48e93f2ce9 clean() needs to process things in topological order.
llvm-svn: 37389
2007-06-01 22:00:37 +00:00
Evan Cheng 9aa5fc8577 Opcode modifier s comes after condition code. e.g. addlts, not addslt.
llvm-svn: 37388
2007-06-01 20:51:29 +00:00
Evan Cheng 4dcf1e8582 Correctly mark early-exit on the false path.
llvm-svn: 37387
2007-06-01 20:29:21 +00:00
Owen Anderson 4c89142466 Fix Expression comparison, which in turn fixes a value numbering error.
llvm-svn: 37386
2007-06-01 17:34:47 +00:00
Evan Cheng 256144de4a Set ARM ifcvt duplication limit to 3 for now.
llvm-svn: 37385
2007-06-01 08:28:59 +00:00
Duncan Sands 706421e712 Since TypeInfos are passed as i8 pointers, a NULL TypeInfo should be passed
as a null i8 pointer not as a 0 i32.

llvm-svn: 37383
2007-06-01 08:18:30 +00:00
Evan Cheng 6a2cf070cc Ifcvt triangle: don't ifcvt 'true' BB if it has other predecessors; don't merge 'false' BB if it has other predecessors.
llvm-svn: 37382
2007-06-01 07:41:07 +00:00
Evan Cheng a2ab4e5feb Make jumptable non-predicable for now.
llvm-svn: 37381
2007-06-01 00:56:15 +00:00
Evan Cheng 95c7917d92 Remove a bogus check. Even terminators in a ifcvt need to be predicated. Unconditional branches can usually be converted to conditional ones.
llvm-svn: 37380
2007-06-01 00:55:26 +00:00
Evan Cheng 20e05997f5 Allow multiple ifcvt candidates to share children blocks; add some debugging code.
llvm-svn: 37379
2007-06-01 00:12:12 +00:00
Owen Anderson 331bf6a959 Add a topological sort function.
llvm-svn: 37376
2007-05-31 22:44:11 +00:00
Dale Johannesen 1a401e68a8 Arrange for only 1 of multiple branches to landing pad to be kept.
Do not remove empty landing pads (EH table needs to be updated)

llvm-svn: 37375
2007-05-31 21:54:00 +00:00
Evan Cheng e6ccb6c5ed Fix a typo.
llvm-svn: 37374
2007-05-31 20:53:33 +00:00
Chris Lattner 3e3ff30aa2 Fix the asmprinter so that a globalvalue can specify an explicit alignment
smaller than the preferred alignment, but so that the target can actually
specify a minimum alignment if needed.  This fixes some objc protocol
failures Devang tracked down.

llvm-svn: 37373
2007-05-31 18:57:45 +00:00
Lauro Ramos Venancio 5b0757a401 Fix PR1424.
When a function has FP, the register scavenging spill slot offset already
was calculated.

llvm-svn: 37371
2007-05-31 18:27:58 +00:00
Owen Anderson 81d156e16f Attempt to fix up phi_translate.
llvm-svn: 37366
2007-05-31 00:42:15 +00:00
Evan Cheng 905a8f4940 Change traversal order to bottom up in preparation for more aggressive if-conversion.
llvm-svn: 37365
2007-05-30 19:49:19 +00:00
Chris Lattner 397c4d9ef6 Fix CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll, and PR1473.
llvm-svn: 37362
2007-05-30 16:30:06 +00:00
Devang Patel 9b3b35d14f Fix typo.
llvm-svn: 37360
2007-05-30 15:29:37 +00:00
Chris Lattner 8767920f20 Fix Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll and the second
half of PR1421, by not decimating structs with holes that are the source and
destination of a memcpy.

llvm-svn: 37358
2007-05-30 06:11:23 +00:00
Dale Johannesen d14ad078c6 Changed per review comment.
llvm-svn: 37355
2007-05-30 00:32:01 +00:00
Dale Johannesen a69ebdbebc Make stable_sort in tail merging actually be stable (it never was, but didn't
matter until my last change).  Reenable tail merging by default.

llvm-svn: 37354
2007-05-29 23:47:50 +00:00
Evan Cheng 20f7d30f92 Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion.
llvm-svn: 37353
2007-05-29 23:37:20 +00:00
Evan Cheng 19eeee41ca For VFP2 fldm, fstm instructions, the condition code is printed after the address mode and size specifier. e.g. fstmiaseq, not fstmeqias.
llvm-svn: 37351
2007-05-29 23:34:19 +00:00
Owen Anderson 4b0c1859fd Fix a typo
llvm-svn: 37350
2007-05-29 23:34:14 +00:00
Evan Cheng a6e9a4ce07 For ldrb, strh, etc., the condition code is before the width specifier. e.g. streqh, not strheq.
llvm-svn: 37349
2007-05-29 23:32:06 +00:00
Owen Anderson 0c4230724c Re-fix a bug, where I was now being too aggressive.
llvm-svn: 37348
2007-05-29 23:26:30 +00:00
Owen Anderson 4a6ec8fb57 Use proper debugging facilities so other people don't have to look at my commented-out
debugging lines.

llvm-svn: 37347
2007-05-29 23:15:21 +00:00
Owen Anderson f11bdc7637 Comment debug code out that I accidentally uncommented last time.
llvm-svn: 37346
2007-05-29 22:43:03 +00:00
Owen Anderson ac83a3e4ff Add a place where I missed using the maximal set. Note that using the maximal
set this way is _SLOW_.  Somewhere down the line, I'll look at speeding it up.

llvm-svn: 37345
2007-05-29 22:35:41 +00:00
Evan Cheng c2237ce217 If there is an empty block between a source and its successor block, it still requires a unconditional branch.
llvm-svn: 37344
2007-05-29 22:31:16 +00:00
Owen Anderson 5fba6c19b2 Very first part of a GVN-PRE implementation. It currently performs a bunch of analysis, and nothing more. It is also quite slow for the moment. However,
it should give a sense of what's going on.

llvm-svn: 37343
2007-05-29 21:53:49 +00:00
Evan Cheng 2d91a4fd6a Add missing const qualifiers.
llvm-svn: 37342
2007-05-29 18:42:18 +00:00
Evan Cheng 5983bdbb2c Add missing const qualifiers.
llvm-svn: 37341
2007-05-29 18:35:22 +00:00
Nicolas Geoffray cff3e122b0 Implementation of compilation callback in PPC ELF32
llvm-svn: 37340
2007-05-29 16:33:18 +00:00
Zhou Sheng d7dc1ed64c Correct the logic in LowerPartSet which cleared the bits from 0 to low-1.
llvm-svn: 37331
2007-05-26 03:43:13 +00:00
Chris Lattner 4698083b96 tighten up recursion depth again
llvm-svn: 37330
2007-05-25 02:19:06 +00:00
Evan Cheng 13f5f7df95 Silly boog.
llvm-svn: 37328
2007-05-25 00:59:01 +00:00
Chris Lattner 80c94a4a04 Fix PR1446 by not scalarrepl'ing giant structures.
llvm-svn: 37326
2007-05-24 18:43:04 +00:00
Dale Johannesen 1409b6a59b Blocks that cond-br and uncond-br/fallthrough to same block should have
only one successor.

llvm-svn: 37324
2007-05-24 18:31:55 +00:00
Dale Johannesen 1af8c870c7 Fix for PR1444: do not create two successors to the same block.
Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll
by exposing an unrelated latent problem; working on that.

llvm-svn: 37323
2007-05-24 17:39:32 +00:00
Zhou Sheng 8ff9ff7975 Compute the correct word number.
llvm-svn: 37322
2007-05-24 15:03:18 +00:00
Dan Gohman 30978078bf Minor comment cleanups.
llvm-svn: 37321
2007-05-24 14:36:04 +00:00
Dan Gohman 703e0f8608 Add explicit qualification for namespace MVT members.
llvm-svn: 37320
2007-05-24 14:33:05 +00:00
Dan Gohman 5d4bb4f230 Add cases for v2f32.
llvm-svn: 37319
2007-05-24 14:29:12 +00:00
Evan Cheng a4d187b8ce Fix a typo that caused combiner to create mal-formed pre-indexed store where value store is the same as the base pointer.
llvm-svn: 37318
2007-05-24 02:35:39 +00:00
Dale Johannesen f4a77d2481 Two tail merging improvements:
When considering blocks with more than 2 predecessors, merge the block with
the largest number of matching insns, rather than the first block found.
Considering that 1 matching insn is enough to show a win for candidates that
already end with a branch.

llvm-svn: 37315
2007-05-23 21:07:20 +00:00
Devang Patel d50859e87b Add dump() routines for debugging assistance.
llvm-svn: 37314
2007-05-23 19:55:36 +00:00
Anton Korobeynikov 3b327826db Mark all calls as "could throw", when exceptions are enabled. Emit necessary LP info too. This fixes PR1439
llvm-svn: 37311
2007-05-23 11:08:31 +00:00
Chris Lattner 6509c0673f prevent exponential recursion in isNegatibleForFree
llvm-svn: 37310
2007-05-23 07:35:22 +00:00
Evan Cheng d0e669199b Preliminary iterative if-conversion support.
llvm-svn: 37309
2007-05-23 07:23:16 +00:00
Evan Cheng 1d764eca98 Hooks for predication support.
llvm-svn: 37308
2007-05-23 07:22:05 +00:00
Evan Cheng c972de8c8b Rename a parameter.
llvm-svn: 37307
2007-05-23 07:21:11 +00:00
Chris Lattner 688b2807df when merging two alias sets together, be sure to propagate the volatility of
the inner set.  This fixes PR1435 and Transforms/LICM/2007-05-22-VolatileSink.ll

llvm-svn: 37305
2007-05-23 06:36:35 +00:00
Devang Patel 4d01a7b1b5 If user wants to run instcombine twice, do not block it.
llvm-svn: 37301
2007-05-23 05:08:52 +00:00
Chris Lattner f79577d314 fix a miscompilation when passing a float through varargs
llvm-svn: 37297
2007-05-23 01:17:04 +00:00
Reid Spencer bdf03b4174 Reinstate the patch for escaping non-printing characters and allow for
\\ to escape \. All these cases are now handled by the AsmParser.

llvm-svn: 37295
2007-05-22 19:27:35 +00:00
Reid Spencer c5cec2a4e8 Regenerate.
llvm-svn: 37294
2007-05-22 19:08:16 +00:00
Reid Spencer 0f656c39e1 Don't allow the UnEscape code to read or write beyond the end of yytext.
Make sure we convert \\ into \.

llvm-svn: 37293
2007-05-22 19:07:45 +00:00
Reid Spencer acfe667eab Regenerate.
llvm-svn: 37292
2007-05-22 18:52:55 +00:00
Reid Spencer 3b208cca84 Implement full unescaping of escaped hex characters in all quoted identifiers
and strings.

llvm-svn: 37291
2007-05-22 18:52:21 +00:00
Dale Johannesen f9cbdc676c name change requested by review of previous patch
llvm-svn: 37289
2007-05-22 18:31:04 +00:00
Owen Anderson 0ae7eb5e7c Silence a warning.
llvm-svn: 37288
2007-05-22 18:13:40 +00:00
Dale Johannesen 82810c8a13 Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.

llvm-svn: 37285
2007-05-22 17:14:46 +00:00
Chris Lattner 83d7dd419a temporarily revert reid's asmwriter patch, it is missing the asmparser piece
that decodes the escape sequences, thus breaking all cases that use them.

This fixes test/Assembler/2007-05-21-Escape.ll

llvm-svn: 37284
2007-05-22 07:00:50 +00:00
Chris Lattner 77119f43af update comment
llvm-svn: 37282
2007-05-22 06:56:32 +00:00
Chris Lattner 31ab0ed37f regenerate
llvm-svn: 37281
2007-05-22 06:47:55 +00:00
Chris Lattner 9111cd6b8a simplify code
llvm-svn: 37280
2007-05-22 06:47:11 +00:00
Bill Wendling 3fb7fdfded We only need to specify the most-implied feature for an architecture.
llvm-svn: 37275
2007-05-22 05:15:37 +00:00
Evan Cheng 8c8afb27d7 Fix some -march=thumb regressions. tBR_JTr is not predicable.
llvm-svn: 37272
2007-05-21 23:17:32 +00:00
Dale Johannesen d1de276c16 Use AXI3 not AXI2 for appropriate PIC PC-relative loads and stores. Cosmetic.
llvm-svn: 37271
2007-05-21 22:42:04 +00:00
Evan Cheng e26c0916a3 If-convert early exit blocks (returns, etc.); bug fixes, etc.
llvm-svn: 37270
2007-05-21 22:22:58 +00:00
Dale Johannesen 7d55f3733e Add some patterns for PIC PC-relative loads and stores.
llvm-svn: 37269
2007-05-21 22:14:33 +00:00
Evan Cheng 147b334b6a BlockHasNoFallThrough() now returns true if block ends with a return instruction; AnalyzeBranch() should ignore predicated instructionsd.
llvm-svn: 37268
2007-05-21 18:56:31 +00:00
Duncan Sands 34e82a4508 Only emit one entry in the exception action table for each action, even if
it occurs for multiple landing pads.

llvm-svn: 37267
2007-05-21 18:50:28 +00:00
Evan Cheng fc94eb66d2 BlockHasNoFallThrough() now returns true if block ends with a return instruction.
llvm-svn: 37266
2007-05-21 18:44:17 +00:00
Reid Spencer e44b45e757 Get the order of the hext digits right!
llvm-svn: 37261
2007-05-19 14:44:42 +00:00
Reid Spencer 6473fb7916 Adjust how LLVM names are produced:
1. Always use % for local and @ for global.
2. Replace NameNeedsQuotes with QuoteNameIfNeeded so that any adjustments
   to the name can be done in one pass.
3. Implement generation of hex escapes so we don't get "wonky" characters
   in the output.

llvm-svn: 37260
2007-05-19 07:25:21 +00:00
Reid Spencer 21526d6b56 Regenerate
llvm-svn: 37258
2007-05-19 07:22:10 +00:00
Reid Spencer aba0cc7173 Make the %"..." syntax legal for local name. This just makes it symmetric
with global names which can already be @"..."

llvm-svn: 37257
2007-05-19 07:21:26 +00:00
Chris Lattner a655a157a0 Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates
objc code due to the way the FE lowers objc message sends.

llvm-svn: 37256
2007-05-19 06:51:32 +00:00
Reid Spencer 80fcb754d9 On Linux platforms and at optimization levels -O1 and above, llvm-gcc can
turn "putchar" calls into _IO_putc calls which is a lower-level interface.
This patch allows these calls to be executed by lli in interpreter mode.

llvm-svn: 37254
2007-05-19 01:36:17 +00:00
Chris Lattner e8bd53c36a Handle negative strides much more optimally. This compiles X86/lsr-negative-stride.ll
into:

_t:
        movl 8(%esp), %ecx
        movl 4(%esp), %eax
        cmpl %ecx, %eax
        je LBB1_3       #bb17
LBB1_1: #bb
        cmpl %ecx, %eax
        jg LBB1_4       #cond_true
LBB1_2: #cond_false
        subl %eax, %ecx
        cmpl %ecx, %eax
        jne LBB1_1      #bb
LBB1_3: #bb17
        ret
LBB1_4: #cond_true
        subl %ecx, %eax
        cmpl %ecx, %eax
        jne LBB1_1      #bb
        jmp LBB1_3      #bb17

instead of:

_t:
        subl $4, %esp
        movl %esi, (%esp)
        movl 12(%esp), %ecx
        movl 8(%esp), %eax
        cmpl %ecx, %eax
        je LBB1_4       #bb17
LBB1_1: #bb.outer
        movl %ecx, %edx
        negl %edx
LBB1_2: #bb
        cmpl %ecx, %eax
        jle LBB1_5      #cond_false
LBB1_3: #cond_true
        addl %edx, %eax
        cmpl %ecx, %eax
        jne LBB1_2      #bb
LBB1_4: #bb17
        movl (%esp), %esi
        addl $4, %esp
        ret
LBB1_5: #cond_false
        movl %ecx, %edx
        subl %eax, %edx
        movl %eax, %esi
        addl %esi, %esi
        cmpl %ecx, %esi
        je LBB1_4       #bb17
LBB1_6: #cond_false.bb.outer_crit_edge
        movl %edx, %ecx
        jmp LBB1_1      #bb.outer

llvm-svn: 37252
2007-05-19 01:22:21 +00:00
Chris Lattner 1fa8276e70 same patch as the previous one, but the symmetric case
llvm-svn: 37249
2007-05-19 00:46:51 +00:00
Chris Lattner b08cbbd737 Disable the (A == (B-A)) -> 2*A == B xform when the sub has multiple uses (in
this case, the xform introduces an extra operation).  This compiles
PowerPC/compare-duplicate.ll into:

_test:
        subf r2, r3, r4
        cmplw cr0, r2, r3
        bne cr0, LBB1_2 ;F

instead of:

_test:
        slwi r2, r3, 1
        subf r3, r3, r4
        cmplw cr0, r4, r2
        bne cr0, LBB1_2 ;F

This is target independent of course.

llvm-svn: 37246
2007-05-19 00:43:44 +00:00
Reid Spencer b6af1aae35 Fix an assertion introduced by my last change to the toString method. We
can't use getZExtValue() to extract the low order bits for each digit.
Instead, we need to access the low order word directly.

llvm-svn: 37242
2007-05-19 00:29:55 +00:00
Dan Gohman c12dd5207d Apply this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070514/049845.html

llvm-svn: 37240
2007-05-18 23:21:46 +00:00
Chris Lattner 7ea2df6e2a add a note
llvm-svn: 37239
2007-05-18 20:18:14 +00:00
Evan Cheng 018cffbca4 Clean up.
llvm-svn: 37237
2007-05-18 19:32:08 +00:00
Evan Cheng faaf716540 Change to depth-first traversal.
llvm-svn: 37236
2007-05-18 19:26:33 +00:00
Dale Johannesen dafda82755 Document an inefficiency in tail merging.
llvm-svn: 37235
2007-05-18 18:46:40 +00:00
Dan Gohman eefa83e67b Use MVT::FIRST_VECTOR_VALUETYPE and MVT::LAST_VECTOR_VALUETYPE.
llvm-svn: 37234
2007-05-18 18:44:07 +00:00
Dan Gohman b539df3389 Qualify calls to getTypeForValueType with MVT:: too.
llvm-svn: 37233
2007-05-18 18:41:29 +00:00
Evan Cheng 2e82cefd24 Some restructuring in preparation for most aggressive if-conversion.
llvm-svn: 37231
2007-05-18 18:14:37 +00:00
Dan Gohman 1796f1f8e9 Qualify several calls to functions in the MVT namespace, for consistency.
llvm-svn: 37230
2007-05-18 17:52:13 +00:00
Evan Cheng f25d3a5d73 Watch out for blocks that end with a return.
llvm-svn: 37227
2007-05-18 17:06:53 +00:00
Chris Lattner 9eeada9470 Fix PR1434 and test/Linker/link-archive.ll, this is a regression from 1.9.
llvm-svn: 37204
2007-05-18 04:02:46 +00:00
Evan Cheng 478b805956 If true / false blocks fallthrough before ifcvt, add unconditional branches to ifcvt'd block.
llvm-svn: 37200
2007-05-18 01:55:58 +00:00
Evan Cheng 4ae1840d21 Mark calls non-predicable for now. Need to ensure it's the last instruction in the if-converted block or make sure it preserve condition code.
llvm-svn: 37199
2007-05-18 01:53:54 +00:00
Dale Johannesen f8956178af Remove some unneeded branches. (spotted by Evan, thanks)
llvm-svn: 37198
2007-05-18 01:28:58 +00:00
Evan Cheng ea623560f8 Silence some compilation warnings.
llvm-svn: 37197
2007-05-18 01:19:57 +00:00
Evan Cheng 0f745da4fe Make use of target specific block size limits; bug fixes.
llvm-svn: 37195
2007-05-18 00:20:58 +00:00
Evan Cheng 6addd65914 Set ARM if-conversion block size threshold to 10 instructions for now.
llvm-svn: 37194
2007-05-18 00:19:34 +00:00
Evan Cheng e20dd92792 RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted.
llvm-svn: 37193
2007-05-18 00:18:17 +00:00
Evan Cheng 99be49dd9b RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted.
llvm-svn: 37192
2007-05-18 00:05:48 +00:00
Evan Cheng a92b2b38ff Move isSuccessor() offline, change it to use std::find.
llvm-svn: 37190
2007-05-17 23:58:53 +00:00
Devang Patel 2c30a37a5c Fix PR1431
Test case at Transformations/SCCP/2007-05-16-InvokeCrash.ll

llvm-svn: 37185
2007-05-17 22:10:15 +00:00
Dale Johannesen 58698d2534 More effective breakdown of memcpy into repeated load/store. These are now
in the order lod;lod;lod;sto;sto;sto which means the load-store optimizer
has a better chance of producing ldm/stm.  Ideally you would get cooperation
from the RA as well but this is not there yet.

llvm-svn: 37179
2007-05-17 21:31:21 +00:00
Reid Spencer 5c138133b7 Get rid of leading zeros in the output of toString.
llvm-svn: 37175
2007-05-17 19:23:02 +00:00
Evan Cheng afa1cb6da3 Fix a bogus check that prevented folding VECTOR_SHUFFLE to UNDEF; add an optimization to fold VECTOR_SHUFFLE to a zero vector.
llvm-svn: 37173
2007-05-17 18:45:50 +00:00
Evan Cheng 632c3f01ed Added missing patterns for UNPCKH* and PUNPCKH*.
llvm-svn: 37172
2007-05-17 18:44:37 +00:00
Chris Lattner 0184f88deb disable MaskedValueIsZero, ComputeMaskedBits, and SimplifyDemandedBits for
i128 integers.  The 64-bit masks are not wide enough to represent the results.
These should be converted to APInt someday.

llvm-svn: 37169
2007-05-17 18:19:23 +00:00
Chris Lattner 2135bc08d6 add expand support for ADDC/SUBC/ADDE/SUBE so we can codegen 128-bit add/sub on 32-bit (or less) targets
llvm-svn: 37168
2007-05-17 18:15:41 +00:00
Chris Lattner dade607f19 This is the correct fix for PR1427. This fixes mmx-shuffle.ll and doesn't
cause other regressions.

llvm-svn: 37160
2007-05-17 17:13:13 +00:00
Anton Korobeynikov 1ad4618715 Revert patch for PR1427. It breaks almost all vector tests.
llvm-svn: 37159
2007-05-17 07:50:14 +00:00
Chris Lattner 3e549e9d5f add support for 128-bit add/sub on ppc64
llvm-svn: 37158
2007-05-17 06:52:46 +00:00
Reid Spencer 07ae5465cd Print integer values as both decimal and hexadecimal for convenience
of verifying result values when debugging.

llvm-svn: 37156
2007-05-17 06:47:54 +00:00
Chris Lattner 13f4bf5c5e add support for 128-bit integer add/sub
llvm-svn: 37154
2007-05-17 06:35:11 +00:00
Reid Spencer fffdf10566 For lshr by 0 bits, just return *this as a short cut. This also prevents
undefined behavior when the width > 64 bits.

llvm-svn: 37153
2007-05-17 06:26:29 +00:00
Chris Lattner 6a5a46322f Fix PR1427 and test/CodeGen/X86/mmx-shuffle.ll
llvm-svn: 37141
2007-05-17 03:29:42 +00:00
Evan Cheng 2db22024cf Remove. Not needed.
llvm-svn: 37139
2007-05-17 00:11:35 +00:00
Evan Cheng 733b4bd8ae Default implementation of TargetInstrInfo::getBlockSize().
llvm-svn: 37138
2007-05-16 23:53:44 +00:00
Evan Cheng 429178d727 Add target hook to specify block size limit for if-conversion.
llvm-svn: 37134
2007-05-16 23:45:53 +00:00
Dale Johannesen 7a6c175e7a Don't fold bitconvert(load) for preinc/postdec loads. Likewise stores.
llvm-svn: 37130
2007-05-16 22:45:30 +00:00
Evan Cheng af71610429 isBlockPredicable() always ignore terminal instructions; add comments.
llvm-svn: 37126
2007-05-16 21:54:37 +00:00
Evan Cheng 1634e7186b ARM::tB is also predicable.
llvm-svn: 37125
2007-05-16 21:53:43 +00:00
Evan Cheng dcff2eb0e8 PredicateInstruction returns true if the operation was successful.
llvm-svn: 37124
2007-05-16 21:53:07 +00:00
Evan Cheng 973c3739b0 Add default implementation of PredicateInstruction().
llvm-svn: 37123
2007-05-16 21:20:37 +00:00
Evan Cheng 5ea933a009 Rename M_PREDICATED to M_PREDICABLE; Moved isPredicable() to MachineInstr.
llvm-svn: 37121
2007-05-16 20:56:08 +00:00
Evan Cheng 4423687831 Move if-conversion after all passes that may use register scavenger.
llvm-svn: 37120
2007-05-16 20:52:46 +00:00
Evan Cheng e2762c3d68 Removed isPredicable().
llvm-svn: 37119
2007-05-16 20:50:23 +00:00
Evan Cheng dcd6cdf896 Make ARM::B isPredicable; Make Bcc and MOVCC condition option a normal operand so they are not predicable.
llvm-svn: 37118
2007-05-16 20:50:01 +00:00
Evan Cheng cc33218607 Added isPredicable bit to class Instruction.
llvm-svn: 37117
2007-05-16 20:47:01 +00:00
Reid Spencer a93c981f66 Fix a bug in the "fromString" method where radix 2,8 and 16 values were
not being generated correctly because the shl operator does not mutate its
object but returns a new value. Also, make the distinction between radix
16 and the others more clear.

llvm-svn: 37111
2007-05-16 19:18:22 +00:00
Reid Spencer 1925c537f2 Avoid a "loss of precision" error in gcc 4.1.3.
llvm-svn: 37105
2007-05-16 16:39:29 +00:00
Duncan Sands 59ae77486c Output exception call-sites in address order, as required by the unwinding
runtime.

llvm-svn: 37104
2007-05-16 12:12:23 +00:00
Evan Cheng 01a4227ed1 Conditional branch is not a barrier.
llvm-svn: 37103
2007-05-16 07:45:54 +00:00
Chris Lattner 48fb92f75d Use a ptr set instead of a linear search to unique TokenFactor operands.
This fixes PR1423

llvm-svn: 37102
2007-05-16 06:37:59 +00:00
Chris Lattner 888653cdba implement the missing maskmovq mmx intrinsic that akor hit.
llvm-svn: 37100
2007-05-16 06:08:17 +00:00
Evan Cheng c95f95b6da Fix comment.
llvm-svn: 37098
2007-05-16 05:14:06 +00:00
Evan Cheng 35fc2119b0 Devang points out that we need an assertion here.
llvm-svn: 37097
2007-05-16 05:11:10 +00:00
Reid Spencer 65ba7501fc Implement printing of instruction result values when debug info is turned
on. This helps to speed up the debugging time by showing computational
results as the program executes.

llvm-svn: 37095
2007-05-16 02:05:13 +00:00
Evan Cheng 288f133c71 Bug fix: should check ABI alignment, not pref. alignment.
llvm-svn: 37094
2007-05-16 02:04:50 +00:00
Evan Cheng ad3aac71ce Hooks for predication support.
llvm-svn: 37093
2007-05-16 02:01:49 +00:00
Evan Cheng f5e53a58db Initial commit of (very basic) if converter.
llvm-svn: 37092
2007-05-16 02:00:57 +00:00
Dale Johannesen 420a85d0cf Remove extra CFG edges before doing these passes; it makes them happier.
llvm-svn: 37089
2007-05-15 21:19:17 +00:00
Lauro Ramos Venancio 3f142cbca2 Fix an infinite recursion in GetNegatedExpression.
llvm-svn: 37086
2007-05-15 17:05:43 +00:00
Duncan Sands 750e8c5d4d The index into the actions table is a ULEB128 not a SLEB128.
llvm-svn: 37084
2007-05-15 13:54:14 +00:00
Chris Lattner 66ad6fac2f selects can also reach here
llvm-svn: 37081
2007-05-15 06:42:04 +00:00
Chris Lattner a6f88ced8b implement the ModuleProvider::dematerializeFunction hook
llvm-svn: 37080
2007-05-15 06:29:44 +00:00
Reid Spencer daed139420 Un-brain-dead-ify the lowering of part set for the reverse case.
llvm-svn: 37071
2007-05-15 02:26:52 +00:00
Chris Lattner c7596efdad Fix some subtle issues handling immediate values. This fixes
test/CodeGen/ARM/2007-05-14-InlineAsmCstCrash.ll

llvm-svn: 37069
2007-05-15 01:33:58 +00:00
Chris Lattner 0b7472da6f fix some subtle inline asm selection issues
llvm-svn: 37067
2007-05-15 01:31:05 +00:00
Evan Cheng 0f7cbe8370 Add PredicateOperand to all ARM instructions that have the condition field.
llvm-svn: 37066
2007-05-15 01:29:07 +00:00
Chris Lattner c8798d085c fix subtle bugs in inline asm operand selection
llvm-svn: 37065
2007-05-15 01:28:08 +00:00
Evan Cheng 4d728b0419 Added getNumExplicitOperands and findFirstPredOperand.
llvm-svn: 37064
2007-05-15 01:26:09 +00:00
Chris Lattner 234f96daa8 Fix Transforms/InstCombine/2007-05-14-Crash.ll
llvm-svn: 37057
2007-05-15 00:16:00 +00:00
Lauro Ramos Venancio 1b8d46ab21 Fix previous patch. GOTOFF can be used only when the symbol has internal
linkage or hidden visibility.

llvm-svn: 37055
2007-05-14 23:20:21 +00:00
Chris Lattner e49c974a7c implement a simple fneg optimization/propagation thing. This compiles:
CodeGen/PowerPC/fneg.ll into:

_t4:
        fmul f0, f3, f4
        fmadd f1, f1, f2, f0
        blr

instead of:

_t4:
        fneg f0, f3
        fmul f0, f0, f4
        fmsub f1, f1, f2, f0
        blr

llvm-svn: 37054
2007-05-14 22:04:50 +00:00
Evan Cheng e1595b6859 Only worry about intervening kill if there are more than one live ranges in the interval.
llvm-svn: 37052
2007-05-14 21:23:51 +00:00
Evan Cheng c690cba7d9 Fix for PR1406:
v1 =
r2 = move v1
   = op r2<kill>
...
r2 = move v1
   = op r2<kill>

Clear the first r2 kill if v1 and r2 are joined.

llvm-svn: 37050
2007-05-14 21:10:05 +00:00
Evan Cheng fc2377d4ed When marking a register as being implicitly defined, make sure to clear its partial use info as well.
llvm-svn: 37046
2007-05-14 20:39:18 +00:00
Lauro Ramos Venancio d705f5d51d Optimize PIC implementation. GOTOFF can be used when the symbol is defined
and used in the same module.

llvm-svn: 37044
2007-05-14 18:46:23 +00:00
Lauro Ramos Venancio 3551928a2b Enable aliases on arm-linux.
llvm-svn: 37042
2007-05-14 18:32:56 +00:00
Reid Spencer 764ae2a21b Give names to the final result values of the part_set computations. This
just aids in readability and debugability of the output. No functional change.

llvm-svn: 37037
2007-05-14 17:21:17 +00:00
Dan Gohman 8d40e4d965 Correct a few comments.
llvm-svn: 37034
2007-05-14 14:31:17 +00:00
Dan Gohman 90d97ac1e6 Add passes -view-cfg and -view-cfg-only that are like -print-cfg and
-print-cfg-only except they use the ViewCFG function, which displays the
CFG rendered with graphviz with gv.

llvm-svn: 37033
2007-05-14 14:25:08 +00:00
Reid Spencer 98ed7db7ab Make the results for the rotate functions correct when rotateAmt == 0.
llvm-svn: 37026
2007-05-14 00:15:28 +00:00
Reid Spencer 4c50b52f63 Add some things needed by the llvm-gcc version supporting bit accurate integer
types:
1. Functions to compute div/rem at the same time.
2. Further assurance that an APInt with 0 bitwidth cannot be constructed.
3. Left and right rotate operations.
4. An exactLogBase2 function which requires an exact power of two or it
   returns -1.

llvm-svn: 37025
2007-05-13 23:44:59 +00:00
Chris Lattner 1904e45d0c Fix PR1413
llvm-svn: 37023
2007-05-13 22:19:27 +00:00
Chris Lattner cea37beb52 Fix Transforms/GlobalOpt/2007-05-13-Crash.ll
llvm-svn: 37020
2007-05-13 21:28:07 +00:00
Anton Korobeynikov 1ee0c8d563 Emit function debug frames in one atom. This will prevent us from generating incorrect assembler in case of both
debug information & exception information presented.

llvm-svn: 37019
2007-05-13 17:30:11 +00:00
Anton Korobeynikov bbaf55448b Emit multiple common EH frames for multiple (including blank) personality
functions. This partly fixes PR1414: now we're restricted only to one
personality function per eh frame, not per module. Further work on
"multiple personalities" topic needs representative example.

llvm-svn: 37018
2007-05-13 15:42:26 +00:00
Anton Korobeynikov 13da17843c More DWARF-related things cleanup:
1. Fix PR1380
2. Apply Duncan's patch from PR1410
3. Insert workaround for "one personality function per module" as noted in PR1414
4. Emit correct debug frames for x86/linux. This partly fixes DebugInfo/2006-11-06-StackTrace.cpp: stack trace is
shown correctly, but arguments for function on top of stack are displayed incorrectly.

llvm-svn: 37015
2007-05-12 22:36:25 +00:00
Reid Spencer 81ee020f64 Fix shl to produce the correct result when the bitwidth is > 64 and the
shift amount is 0. Previously this code would do a lshr by the bit width
which can lead to incorrect results.

llvm-svn: 37010
2007-05-12 18:01:57 +00:00
Reid Spencer bf283708f7 Get the size of auto arrays right, regardless of its changing size.
llvm-svn: 37006
2007-05-12 11:07:40 +00:00
Chris Lattner a26153143e allow partially materialized modules to be written out, which just strips out
the functions which haven't been read.

llvm-svn: 36999
2007-05-11 23:51:59 +00:00
Devang Patel 79a71ec3ad Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049516.html
llvm-svn: 36998
2007-05-11 23:14:43 +00:00
Chris Lattner 1480e16596 significantly improve debug output of lsr
llvm-svn: 36996
2007-05-11 22:40:34 +00:00
Dan Gohman fead7979f7 Update comments to say "vector" instead of "packed".
llvm-svn: 36995
2007-05-11 21:43:24 +00:00
Dan Gohman b5650ebd6a Fix typos.
llvm-svn: 36994
2007-05-11 21:10:54 +00:00
Dan Gohman 2980d9da45 This patch extends the LoopUnroll pass to be able to unroll loops
with unknown trip counts. This is left off by default, and a
command-line option enables it. It also begins to separate loop
unrolling into a utility routine; eventually it might be made usable
from other passes.

It currently works by inserting conditional branches between each
unrolled iteration, unless it proves that the trip count is a
multiple of a constant integer > 1, which it currently only does in
the rare case that the trip count expression is a Mul operator with
a ConstantInt operand. Eventually this information might be provided
by other sources, for example by a pass that peels/splits the loop
for this purpose.

llvm-svn: 36990
2007-05-11 20:53:41 +00:00
Chris Lattner 600db3eb96 fix regressions from my previous checking, including
Transforms/InstCombine/2006-12-08-ICmp-Combining.ll

llvm-svn: 36989
2007-05-11 16:58:45 +00:00
Anton Korobeynikov 67286b1266 Perform correct actions numbers/sizes computation
llvm-svn: 36988
2007-05-11 08:47:35 +00:00
Anton Korobeynikov 00d02442b0 Fix action No calculation in multiple-invoke-one-LP mode
llvm-svn: 36987
2007-05-11 08:23:57 +00:00
Chris Lattner fe2b44de9f fix Transforms/InstCombine/2007-05-10-icmp-or.ll
llvm-svn: 36984
2007-05-11 05:55:56 +00:00
Chris Lattner 436370bac8 fix a memory leak
llvm-svn: 36981
2007-05-11 00:43:26 +00:00
Chris Lattner fd96905f12 Fix a bug where the bcreader could crash on .bc files that were an exact
multiple of the page size, due to a bug in MappedFile

llvm-svn: 36980
2007-05-11 00:00:27 +00:00
Dale Johannesen cc8f571bc8 Do not generate branches to entry block. This fixes several test suite
failures on PPC (can happen only when prologue code is null)

llvm-svn: 36979
2007-05-10 23:59:23 +00:00