diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-01-29 19:19:08 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-01-29 19:19:08 +0000 |
commit | 3eb4f7e2dd98038f94e45d1c45ccff49e6659c87 (patch) | |
tree | 9ad9e9d474fae169ffb5303be1b8ff1336e6704e /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | |
parent | 01eba397936941f35dfb0995beace7ed03b847f2 (diff) |
Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
indices are safe if the result is known to be within the bounds of the
underlying object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index ae728ddecf..306ed6728b 100644 --- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -199,8 +199,8 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { // if (SelectInst *SI = dyn_cast<SelectInst>(Op)) { // load (select (Cond, &V1, &V2)) --> select(Cond, load &V1, load &V2). - if (isSafeToLoadUnconditionally(SI->getOperand(1), SI) && - isSafeToLoadUnconditionally(SI->getOperand(2), SI)) { + if (isSafeToLoadUnconditionally(SI->getOperand(1), SI, TD) && + isSafeToLoadUnconditionally(SI->getOperand(2), SI, TD)) { Value *V1 = Builder->CreateLoad(SI->getOperand(1), SI->getOperand(1)->getName()+".val"); Value *V2 = Builder->CreateLoad(SI->getOperand(2), |