Skip to content

Commit e414ba3

Browse files
committed
[ValueTracking] Shufflevector produces poison rather than undef
Shufflevector semantics have changed so that poison mask elements return poison rather than undef. Reflect this in the canCreateUndefOrPoison() implementation.
1 parent 5992ce9 commit e414ba3

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6674,9 +6674,6 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
66746674
return false;
66756675
}
66766676
case Instruction::ShuffleVector: {
6677-
// shufflevector may return undef.
6678-
if (PoisonOnly)
6679-
return false;
66806677
ArrayRef<int> Mask = isa<ConstantExpr>(Op)
66816678
? cast<ConstantExpr>(Op)->getShuffleMask()
66826679
: cast<ShuffleVectorInst>(Op)->getShuffleMask();

llvm/unittests/Analysis/ValueTrackingTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,12 +1177,12 @@ TEST(ValueTracking, canCreatePoisonOrUndef) {
11771177
{{false, false},
11781178
"shufflevector <4 x i32> %vx, <4 x i32> %vx2, "
11791179
"<4 x i32> <i32 0, i32 1, i32 2, i32 3>"},
1180-
{{false, true},
1180+
{{true, false},
11811181
"shufflevector <4 x i32> %vx, <4 x i32> %vx2, "
1182-
"<4 x i32> <i32 0, i32 1, i32 2, i32 undef>"},
1183-
{{false, true},
1182+
"<4 x i32> <i32 0, i32 1, i32 2, i32 poison>"},
1183+
{{true, false},
11841184
"shufflevector <vscale x 4 x i32> %svx, "
1185-
"<vscale x 4 x i32> %svx, <vscale x 4 x i32> undef"},
1185+
"<vscale x 4 x i32> %svx, <vscale x 4 x i32> poison"},
11861186
{{true, false}, "call i32 @g(i32 %x)"},
11871187
{{false, false}, "call noundef i32 @g(i32 %x)"},
11881188
{{true, false}, "fcmp nnan oeq float %fx, %fy"},

0 commit comments

Comments
 (0)