mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 21:47:07 +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. llvm-svn: 12197
This commit is contained in:
parent
0179360703
commit
ca3b90f308
@ -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