summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Instead, teach SimplifyCFG to trim non-address-taken blocks fromDan Gohman2010-08-161-2/+3
| | | | | | indirectbr destination lists. llvm-svn: 111122
* Teach SimplifyCFG how to simplify indirectbr instructions.Dan Gohman2010-08-141-13/+40
| | | | | | | | | | | - Eliminate redundant successors. - Convert an indirectbr with one successor into a direct branch. Also, generalize SimplifyCFG to be able to be run on a function entry block. It knows quite a few simplifications which are applicable to the entry block, and it only needs a few checks to avoid trouble with the entry block. llvm-svn: 111060
* pass dereferenced iterator to dyn_castGabor Greif2010-07-221-1/+1
| | | | llvm-svn: 109098
* Remove unneeded check, and correct style.Owen Anderson2010-07-151-3/+2
| | | | llvm-svn: 108427
* Extend SimplifyCFG's common-destination folding heuristic to allow a singleOwen Anderson2010-07-141-5/+67
| | | | | | | | | | "bonus" instruction to be speculatively executed. Add a heuristic to ensure we're not tripping up out-of-order execution by checking that this bonus instruction only uses values that were already guaranteed to be available. This allows us to eliminate the short circuit in (x&1)&&(x&2). llvm-svn: 108351
* cache dereferenced iteratorsGabor Greif2010-07-121-4/+6
| | | | llvm-svn: 108133
* cache result of operator*Gabor Greif2010-07-091-2/+3
| | | | llvm-svn: 107974
* Fix a grammaro.Dan Gohman2010-03-301-1/+1
| | | | llvm-svn: 99917
* fix two cases where the arguments were extracted from the wrong range out of ↵Gabor Greif2010-03-301-3/+3
| | | | | | | | the InvokeInst spotted by baldrick -- thanks\! llvm-svn: 99914
* Make returns more consistent with others.Bill Wendling2010-03-141-2/+2
| | | | llvm-svn: 98490
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-5/+5
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* Uniformize the names of type predicates: rather than having isFloatTy andDuncan Sands2010-02-151-1/+1
| | | | | | isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! llvm-svn: 96223
* Teach SimplifyCFG about magic pointer constants.Jakob Stoklund Olesen2010-02-051-33/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Weird code sometimes uses pointer constants other than null. This patch teaches SimplifyCFG to build switch instructions in those cases. Code like this: void f(const char *x) { if (!x) puts("null"); else if ((uintptr_t)x == 1) puts("one"); else if (x == (char*)2 || x == (char*)3) puts("two"); else if ((intptr_t)x == 4) puts("four"); else puts(x); } Now becomes a switch: define void @f(i8* %x) nounwind ssp { entry: %magicptr23 = ptrtoint i8* %x to i64 ; <i64> [#uses=1] switch i64 %magicptr23, label %if.else16 [ i64 0, label %if.then i64 1, label %if.then2 i64 2, label %if.then9 i64 3, label %if.then9 i64 4, label %if.then14 ] Note that LLVM's own DenseMap uses magic pointers. llvm-svn: 95439
* Convert a ton of simple integer type equality tests to the new predicate.Benjamin Kramer2010-01-051-1/+1
| | | | llvm-svn: 92760
* Avoid going through the LLVMContext for type equality where it's safe to ↵Benjamin Kramer2010-01-051-1/+1
| | | | | | dereference the type pointer. llvm-svn: 92726
* Change errs() to dbgs().David Greene2010-01-051-13/+13
| | | | llvm-svn: 92604
* Remove dead debug info intrinsics.Devang Patel2010-01-051-7/+0
| | | | | | | | | | Intrinsic::dbg_stoppoint Intrinsic::dbg_region_start Intrinsic::dbg_region_end Intrinsic::dbg_func_start AutoUpgrade simply ignores these intrinsics now. llvm-svn: 92557
* Move EliminateDuplicatePHINodes() from SimplifyCFG.cpp to Local.cppJim Grosbach2009-12-021-63/+0
| | | | llvm-svn: 90324
* Make EliminateDuplicatePHINodes() available as a utility functionJim Grosbach2009-11-191-1/+1
| | | | llvm-svn: 89297
* refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.Chris Lattner2009-11-101-164/+2
| | | | llvm-svn: 86666
* remove a bunch of extraneous LLVMContext argumentsChris Lattner2009-11-061-1/+1
| | | | | | from various APIs, addressing PR5325. llvm-svn: 86231
* Add a comment about a missed opportunity.Dan Gohman2009-10-301-0/+5
| | | | llvm-svn: 85635
* Teach SimplifyCFG how to eliminate duplicate PHI nodes within a block.Dan Gohman2009-10-301-0/+61
| | | | | | | This reduces codesize on a variety of codes by 1-2% on x86-64. It also helps clean up after SSAUpdater. llvm-svn: 85626
* change simplifycfg to not duplicate 'unwind' instructions. HopefullyChris Lattner2009-10-131-12/+5
| | | | | | | this will increase the likelihood of common code getting sunk towards the unwind. llvm-svn: 83996
* Instruction::clone does not need to take an LLVMContext&. Remove that andNick Lewycky2009-09-271-7/+5
| | | | | | update all the callers. llvm-svn: 82889
* Rename Instruction::isIdenticalTo to Instruction::isIdenticalToWhenDefined,Dan Gohman2009-08-251-2/+4
| | | | | | | | | | | | | | | | and introduce a new Instruction::isIdenticalTo which tests for full identity, including the SubclassOptionalData flags. Also, fix the Instruction::clone implementations to preserve the SubclassOptionalData flags. Finally, teach several optimizations how to handle SubclassOptionalData correctly, given these changes. This fixes the counterintuitive behavior of isIdenticalTo not comparing the full value, and clone not returning an identical clone, as well as some subtle bugs that could be caused by these. Thanks to Nick Lewycky for reporting this, and for an initial patch! llvm-svn: 80038
* Fix -Asserts warnings.Daniel Dunbar2009-08-231-0/+3
| | | | llvm-svn: 79849
* eliminate the "Value" printing methods that print to a std::ostream.Chris Lattner2009-08-231-21/+20
| | | | | | This required converting a bunch of stuff off DOUT and other cleanups. llvm-svn: 79819
* Fix for PR3016: detect the tricky case, where there are Eli Friedman2009-08-161-59/+37
| | | | | | | | | | | | | | | | unfoldable references to a PHI node in the block being folded, and disable the transformation in that case. The correct transformation of such PHI nodes depends on whether BB dominates Succ, and dominance is expensive to compute here. (Alternatively, it's possible to check whether any uses are live, but that's also essentially a dominance calculation. Another alternative is to use reg2mem, but it probably isn't a good idea to use that in simplifycfg.) Also, remove some incorrect code from CanPropagatePredecessorsForPHIs which is made unnecessary with this patch: it didn't consider the case where a PHI node in BB has multiple uses. llvm-svn: 79174
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-13/+17
| | | | llvm-svn: 78948
* Remove a bunch more now-unnecessary Context arguments.Dan Gohman2009-08-121-6/+4
| | | | llvm-svn: 78809
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-3/+1
| | | | llvm-svn: 77635
* Remove Value::getName{Start,End}, the last of the old Name APIs.Daniel Dunbar2009-07-261-12/+12
| | | | llvm-svn: 77152
* More migration to raw_ostream, the water has dried up around the iostream hole.Daniel Dunbar2009-07-251-2/+3
| | | | | | | | | | - Some clients which used DOUT have moved to DEBUG. We are deprecating the "magic" DOUT behavior which avoided calling printing functions when the statement was disabled. In addition to being unnecessary magic, it had the downside of leaving code in -Asserts builds, and of hiding potentially unnecessary computations. llvm-svn: 77019
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-241-2/+2
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* Get rid of the Pass+Context magic.Owen Anderson2009-07-221-13/+13
| | | | llvm-svn: 76702
* Replace isTrapping with a new, similar method called Eli Friedman2009-07-171-17/+6
| | | | | | | | | | isSafeToSpeculativelyExecute. The new method is a bit closer to what the callers actually care about in that it rejects more things callers don't want. It also adds more precise handling for integer division, and unifies code for analyzing the legality of a speculative load. llvm-svn: 76150
* Move more functionality over to LLVMContext.Owen Anderson2009-07-131-3/+4
| | | | llvm-svn: 75497
* This started as a small change, I swear. Unfortunately, lots of things call ↵Owen Anderson2009-07-091-4/+4
| | | | | | the [I|F]CmpInst constructors. Who knew!? llvm-svn: 75200
* "LLVMContext* " --> "LLVMContext *"Owen Anderson2009-07-061-3/+3
| | | | llvm-svn: 74878
* Thread LLVMContext through the constant folding APIs, which touches a lot of ↵Owen Anderson2009-07-061-1/+2
| | | | | | files. llvm-svn: 74844
* More LLVMContext-ification.Owen Anderson2009-07-051-3/+7
| | | | llvm-svn: 74807
* Teach LoopSimplify how to merge multiple loop exits into a single exit,Dan Gohman2009-06-271-1/+1
| | | | | | | | | | | | | | | | when one of them can be converted to a trivial icmp and conditional branch. This addresses what is essentially a phase ordering problem. SimplifyCFG knows how to do this transformation, but it doesn't do so if the primary block has any instructions in it other than an icmp and a branch. In the given testcase, the block contains other instructions, however they are loop-invariant and can be hoisted. SimplifyCFG doesn't have LoopInfo though, so it can't hoist them. And, it's important that the blocks be merged before LoopRotation, as it doesn't support multiple-exit loops. llvm-svn: 74396
* Fix the crash in this test. This is basically the sameDale Johannesen2009-06-151-2/+27
| | | | | | | | problem addressed in 31284, but the patch there only addressed the case where an invoke is the first thing in a block. llvm-svn: 73416
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-6/+2
| | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt llvm-svn: 72897
* Reuse existing getUnderlyingObject instead ofDale Johannesen2009-05-141-24/+6
| | | | | | adding another copy. llvm-svn: 71783
* Handle some additonal cases of external weak globals.Dale Johannesen2009-05-131-4/+22
| | | | llvm-svn: 71717
* Don't generate a select whose operand is load of a weakDale Johannesen2009-05-131-0/+6
| | | | | | | external. These may have address 0 and are not safe to execute unconditionally. llvm-svn: 71688
* Simplify code by using SmallVector's pop_back_val() instead ofDan Gohman2009-05-061-6/+3
| | | | | | separate back() and pop_back() calls. llvm-svn: 71089
* Fix comment typo.Dale Johannesen2009-03-191-1/+1
| | | | llvm-svn: 67307
OpenPOWER on IntegriCloud