mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Partial fix for PR1678: correct some parts of constant
fold that were missed in the fix for PR1646. Probably this null/not-null logic should be factorized somewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
892c7e4a23
commit
7801644332
@ -1124,7 +1124,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
// icmp eq/ne(null,GV) -> false/true
|
||||
if (C1->isNullValue()) {
|
||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
|
||||
if (!GV->hasExternalWeakLinkage()) // External weak GV can be null
|
||||
// Don't try to evaluate aliases. External weak GV can be null.
|
||||
if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage())
|
||||
if (pred == ICmpInst::ICMP_EQ)
|
||||
return ConstantInt::getFalse();
|
||||
else if (pred == ICmpInst::ICMP_NE)
|
||||
@ -1132,7 +1133,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
// icmp eq/ne(GV,null) -> false/true
|
||||
} else if (C2->isNullValue()) {
|
||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1))
|
||||
if (!GV->hasExternalWeakLinkage()) // External weak GV can be null
|
||||
// Don't try to evaluate aliases. External weak GV can be null.
|
||||
if (!isa<GlobalAlias>(GV) && !GV->hasExternalWeakLinkage())
|
||||
if (pred == ICmpInst::ICMP_EQ)
|
||||
return ConstantInt::getFalse();
|
||||
else if (pred == ICmpInst::ICMP_NE)
|
||||
|
Loading…
Reference in New Issue
Block a user