mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[ValueTracking] isGuaranteedNotToBePoison should return true on undef
This is a one-line fix to isGuaranteedNotToBePoison to return true if undef is given.
This commit is contained in:
parent
8309f8b873
commit
abd383d357
@ -4888,7 +4888,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
|
||||
|
||||
if (auto *C = dyn_cast<Constant>(V)) {
|
||||
if (isa<UndefValue>(C))
|
||||
return PoisonOnly;
|
||||
return PoisonOnly && !isa<PoisonValue>(C);
|
||||
|
||||
if (isa<ConstantInt>(C) || isa<GlobalVariable>(C) || isa<ConstantFP>(V) ||
|
||||
isa<ConstantPointerNull>(C) || isa<Function>(C))
|
||||
|
@ -884,6 +884,10 @@ TEST_F(ValueTrackingTest, isGuaranteedNotToBeUndefOrPoison) {
|
||||
" ret void\n"
|
||||
"}\n");
|
||||
EXPECT_EQ(isGuaranteedNotToBeUndefOrPoison(A), true);
|
||||
EXPECT_EQ(isGuaranteedNotToBeUndefOrPoison(UndefValue::get(IntegerType::get(Context, 8))), false);
|
||||
EXPECT_EQ(isGuaranteedNotToBeUndefOrPoison(PoisonValue::get(IntegerType::get(Context, 8))), false);
|
||||
EXPECT_EQ(isGuaranteedNotToBePoison(UndefValue::get(IntegerType::get(Context, 8))), true);
|
||||
EXPECT_EQ(isGuaranteedNotToBePoison(PoisonValue::get(IntegerType::get(Context, 8))), false);
|
||||
}
|
||||
|
||||
TEST_F(ValueTrackingTest, isGuaranteedNotToBeUndefOrPoison_assume) {
|
||||
|
Loading…
Reference in New Issue
Block a user