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 | 7c42b9d51e7a05c6b2019f0481eb041a8dd1c1a1 (patch) | |
| tree | a5e7e7e8dd1774873dd7e9d44683884617331197 /llvm/lib/Transforms/InstCombine | |
| parent | 65eb86e91252791cea630e6ebcae8a5099aa24cf (diff) | |
| download | bcm5719-llvm-7c42b9d51e7a05c6b2019f0481eb041a8dd1c1a1.tar.gz bcm5719-llvm-7c42b9d51e7a05c6b2019f0481eb041a8dd1c1a1.zip | |
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.
llvm-svn: 94829
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index ae728ddecfd..306ed6728bc 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/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), |

