mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
Since 'load null' is undefined, we can make it do whatever we want. Returning
a zero value is the most likely way to cause further simplification, so we do it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f8338c4375
commit
c76d80342e
@ -713,6 +713,12 @@ void SCCP::visitLoadInst(LoadInst &I) {
|
||||
if (PtrVal.isUndefined()) return; // The pointer is not resolved yet!
|
||||
if (PtrVal.isConstant() && !I.isVolatile()) {
|
||||
Value *Ptr = PtrVal.getConstant();
|
||||
if (isa<ConstantPointerNull>(Ptr)) {
|
||||
// load null -> null
|
||||
markConstant(IV, &I, Constant::getNullValue(I.getType()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr))
|
||||
Ptr = CPR->getValue();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user