mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-31 09:25:42 +00:00
Constant fold x == undef to undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1817,8 +1817,15 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
return Constant::getAllOnesValue(ResultTy);
|
||||
|
||||
// Handle some degenerate cases first
|
||||
if (isa<UndefValue>(C1) || isa<UndefValue>(C2))
|
||||
if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
|
||||
// For EQ and NE, we can always pick a value for the undef to make the
|
||||
// predicate pass or fail, so we can return undef.
|
||||
if (ICmpInst::isEquality(ICmpInst::Predicate(pred)))
|
||||
return UndefValue::get(ResultTy);
|
||||
// Otherwise, pick the same value as the non-undef operand, and fold
|
||||
// it to true or false.
|
||||
return ConstantInt::get(ResultTy, CmpInst::isTrueWhenEqual(pred));
|
||||
}
|
||||
|
||||
// No compile-time operations on this type yet.
|
||||
if (C1->getType()->isPPC_FP128Ty())
|
||||
|
Reference in New Issue
Block a user