mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-20 11:29:24 +00:00
ADd a trivial instcombine: load null -> null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12940 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
098e945fbd
commit
d9955aaa61
@ -2853,8 +2853,11 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
||||
Value *Op = LI.getOperand(0);
|
||||
if (LI.isVolatile()) return 0;
|
||||
|
||||
if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Op))
|
||||
Op = CPR->getValue();
|
||||
if (Constant *C = dyn_cast<Constant>(Op))
|
||||
if (C->isNullValue()) // load null -> 0
|
||||
return ReplaceInstUsesWith(LI, Constant::getNullValue(LI.getType()));
|
||||
else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C))
|
||||
Op = CPR->getValue();
|
||||
|
||||
// Instcombine load (constant global) into the value loaded...
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op))
|
||||
|
Loading…
Reference in New Issue
Block a user