mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
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
This commit is contained in:
@@ -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),
|
||||
|
Reference in New Issue
Block a user