mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
fix incorrect folding of icmp with undef, PR6481.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97659 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -194,11 +194,10 @@ Value *llvm::SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
|
||||
const Type *ITy = GetCompareTy(LHS);
|
||||
|
||||
// icmp X, X -> true/false
|
||||
if (LHS == RHS)
|
||||
// X icmp undef -> true/false. For example, icmp ugt %X, undef -> false
|
||||
// because X could be 0.
|
||||
if (LHS == RHS || isa<UndefValue>(RHS))
|
||||
return ConstantInt::get(ITy, CmpInst::isTrueWhenEqual(Pred));
|
||||
|
||||
if (isa<UndefValue>(RHS)) // X icmp undef -> undef
|
||||
return UndefValue::get(ITy);
|
||||
|
||||
// icmp <global/alloca*/null>, <global/alloca*/null> - Global/Stack value
|
||||
// addresses never equal each other! We already know that Op0 != Op1.
|
||||
|
||||
Reference in New Issue
Block a user