Skip to content

Commit 23dbed1

Browse files
author
Leon Clark
committed
Add VectorCombine transform and update tests.
1 parent 7c380e0 commit 23dbed1

File tree

2 files changed

+134
-27
lines changed

2 files changed

+134
-27
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class VectorCombine {
137137
bool foldSelectShuffle(Instruction &I, bool FromReduction = false);
138138
bool foldInterleaveIntrinsics(Instruction &I);
139139
bool shrinkType(Instruction &I);
140+
bool shrinkPhiOfShuffles(Instruction &I);
140141

141142
void replaceValue(Value &Old, Value &New) {
142143
LLVM_DEBUG(dbgs() << "VC: Replacing: " << Old << '\n');
@@ -3691,6 +3692,109 @@ bool VectorCombine::foldInterleaveIntrinsics(Instruction &I) {
36913692
return true;
36923693
}
36933694

3695+
// Attempt to narrow a phi of shufflevector instructions where the two incoming
3696+
// values have the same operands but different masks. If the two shuffle masks
3697+
// are offsets of one another we can use one branch to rotate the incoming
3698+
// vector and perform one larger shuffle after the phi.
3699+
bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
3700+
auto *Phi = dyn_cast<PHINode>(&I);
3701+
if (!Phi || Phi->getNumIncomingValues() != 2u)
3702+
return false;
3703+
3704+
auto *Shuf0 = dyn_cast<ShuffleVectorInst>(Phi->getOperand(0u));
3705+
auto *Shuf1 = dyn_cast<ShuffleVectorInst>(Phi->getOperand(1u));
3706+
if (!Shuf0 || !Shuf1)
3707+
return false;
3708+
3709+
if (!Shuf0->hasOneUse() && !Shuf1->hasOneUse())
3710+
return false;
3711+
3712+
auto *Shuf0Op0 = Shuf0->getOperand(0u);
3713+
auto *Shuf0Op1 = Shuf0->getOperand(1u);
3714+
auto *Shuf1Op0 = Shuf1->getOperand(0u);
3715+
auto *Shuf1Op1 = Shuf1->getOperand(1u);
3716+
3717+
auto IsPoison = [](Value *Val) -> bool {
3718+
return isa<PoisonValue>(Val) || isa<UndefValue>(Val);
3719+
};
3720+
3721+
if (Shuf0Op0 != Shuf1Op0 || !IsPoison(Shuf0Op1) || !IsPoison(Shuf1Op1))
3722+
return false;
3723+
3724+
// Ensure result vectors are wider than the argument vector.
3725+
auto *InputVT = cast<FixedVectorType>(Shuf0Op0->getType());
3726+
auto *ResultVT = cast<FixedVectorType>(Shuf0->getType());
3727+
auto const InputNumElements = InputVT->getNumElements();
3728+
3729+
if (InputNumElements >= ResultVT->getNumElements())
3730+
return false;
3731+
3732+
// Take the difference of the two shuffle masks at each index. Ignore poison
3733+
// values at the same index in both masks.
3734+
auto Mask0 = Shuf0->getShuffleMask();
3735+
auto Mask1 = Shuf1->getShuffleMask();
3736+
auto NewMask0 = std::vector<int>();
3737+
NewMask0.reserve(Mask0.size());
3738+
3739+
for (auto I = 0u; I < Mask0.size(); ++I) {
3740+
if (Mask0[I] >= 0 && Mask1[I] >= 0)
3741+
NewMask0.push_back(Mask0[I] - Mask1[I]);
3742+
else if (Mask0[I] == -1 && Mask1[I] == -1)
3743+
continue;
3744+
else
3745+
return false;
3746+
}
3747+
3748+
if (NewMask0.empty() ||
3749+
!std::equal(NewMask0.begin() + 1u, NewMask0.end(), NewMask0.begin()))
3750+
return false;
3751+
3752+
// Create new mask using difference of the two incoming masks.
3753+
auto MaskOffset = NewMask0[0u];
3754+
if (!Shuf0->hasOneUse()) {
3755+
std::swap(Shuf0, Shuf1);
3756+
std::swap(Mask0, Mask1);
3757+
MaskOffset *= -1;
3758+
}
3759+
3760+
auto Index = (InputNumElements - MaskOffset) % InputNumElements;
3761+
NewMask0.clear();
3762+
3763+
for (auto I = 0u; I < InputNumElements; ++I) {
3764+
NewMask0.push_back(Index);
3765+
Index = (Index + 1u) % InputNumElements;
3766+
}
3767+
3768+
// Calculate costs for worst cases and compare.
3769+
auto const Kind = TTI::SK_PermuteSingleSrc;
3770+
auto OldCost = std::max(TTI.getShuffleCost(Kind, InputVT, Mask0, CostKind),
3771+
TTI.getShuffleCost(Kind, InputVT, Mask1, CostKind));
3772+
auto NewCost = TTI.getShuffleCost(Kind, InputVT, NewMask0, CostKind) +
3773+
TTI.getShuffleCost(Kind, InputVT, Mask1, CostKind);
3774+
3775+
if (NewCost > OldCost)
3776+
return false;
3777+
3778+
// Create new shuffles and narrowed phi.
3779+
auto Builder = IRBuilder(&I);
3780+
Builder.SetInsertPoint(Shuf0);
3781+
Builder.SetCurrentDebugLocation(Shuf0->getDebugLoc());
3782+
auto *NewShuf0 = Builder.CreateShuffleVector(Shuf0Op0, Shuf0Op1, NewMask0);
3783+
3784+
Builder.SetInsertPoint(Phi);
3785+
Builder.SetCurrentDebugLocation(Phi->getDebugLoc());
3786+
auto *NewPhi = Builder.CreatePHI(NewShuf0->getType(), 2u);
3787+
NewPhi->addIncoming(NewShuf0, Phi->getIncomingBlock(0u));
3788+
NewPhi->addIncoming(Shuf1Op0, Phi->getIncomingBlock(1u));
3789+
3790+
Builder.SetInsertPoint(*NewPhi->getInsertionPointAfterDef());
3791+
auto *NewPoison = PoisonValue::get(NewPhi->getType());
3792+
auto *NewShuf2 = Builder.CreateShuffleVector(NewPhi, NewPoison, Mask1);
3793+
3794+
replaceValue(*Phi, *NewShuf2);
3795+
return true;
3796+
}
3797+
36943798
/// This is the entry point for all transforms. Pass manager differences are
36953799
/// handled in the callers of this function.
36963800
bool VectorCombine::run() {
@@ -3775,6 +3879,9 @@ bool VectorCombine::run() {
37753879
case Instruction::Xor:
37763880
MadeChange |= foldBitOpOfBitcasts(I);
37773881
break;
3882+
case Instruction::PHI:
3883+
MadeChange |= shrinkPhiOfShuffles(I);
3884+
break;
37783885
default:
37793886
MadeChange |= shrinkType(I);
37803887
break;

llvm/test/Transforms/VectorCombine/AMDGPU/narrow-phi-of-shuffles.ll

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,15 @@ define <4 x i32> @shuffle_v4i32(<3 x i32> %arg0, i1 %cond) {
392392
; CHECK-NEXT: [[ENTRY:.*:]]
393393
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
394394
; CHECK: [[THEN]]:
395-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
395+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <3 x i32> <i32 1, i32 2, i32 0>
396396
; CHECK-NEXT: tail call void @func0()
397397
; CHECK-NEXT: br label %[[FINALLY:.*]]
398398
; CHECK: [[ELSE]]:
399-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
400399
; CHECK-NEXT: tail call void @func1()
401400
; CHECK-NEXT: br label %[[FINALLY]]
402401
; CHECK: [[FINALLY]]:
403-
; CHECK-NEXT: [[VAL3:%.*]] = phi <4 x i32> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
402+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x i32> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
403+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
404404
; CHECK-NEXT: ret <4 x i32> [[VAL3]]
405405
;
406406
entry:
@@ -427,15 +427,15 @@ define <8 x i32> @shuffle_v8i32(<3 x i32> %arg0, i1 %cond) {
427427
; CHECK-NEXT: [[ENTRY:.*:]]
428428
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
429429
; CHECK: [[THEN]]:
430-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
430+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <3 x i32> <i32 1, i32 2, i32 0>
431431
; CHECK-NEXT: tail call void @func0()
432432
; CHECK-NEXT: br label %[[FINALLY:.*]]
433433
; CHECK: [[ELSE]]:
434-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
435434
; CHECK-NEXT: tail call void @func1()
436435
; CHECK-NEXT: br label %[[FINALLY]]
437436
; CHECK: [[FINALLY]]:
438-
; CHECK-NEXT: [[VAL3:%.*]] = phi <8 x i32> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
437+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x i32> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
438+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> poison, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
439439
; CHECK-NEXT: ret <8 x i32> [[VAL3]]
440440
;
441441
entry:
@@ -462,15 +462,15 @@ define <16 x i32> @shuffle_v16i32(<3 x i32> %arg0, i1 %cond) {
462462
; CHECK-NEXT: [[ENTRY:.*:]]
463463
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
464464
; CHECK: [[THEN]]:
465-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
465+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <3 x i32> <i32 1, i32 2, i32 0>
466466
; CHECK-NEXT: tail call void @func0()
467467
; CHECK-NEXT: br label %[[FINALLY:.*]]
468468
; CHECK: [[ELSE]]:
469-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
470469
; CHECK-NEXT: tail call void @func1()
471470
; CHECK-NEXT: br label %[[FINALLY]]
472471
; CHECK: [[FINALLY]]:
473-
; CHECK-NEXT: [[VAL3:%.*]] = phi <16 x i32> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
472+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x i32> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
473+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
474474
; CHECK-NEXT: ret <16 x i32> [[VAL3]]
475475
;
476476
entry:
@@ -497,15 +497,15 @@ define <32 x i32> @shuffle_v32i32(<3 x i32> %arg0, i1 %cond) {
497497
; CHECK-NEXT: [[ENTRY:.*:]]
498498
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
499499
; CHECK: [[THEN]]:
500-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <32 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
500+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <3 x i32> <i32 1, i32 2, i32 0>
501501
; CHECK-NEXT: tail call void @func0()
502502
; CHECK-NEXT: br label %[[FINALLY:.*]]
503503
; CHECK: [[ELSE]]:
504-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x i32> [[ARG0]], <3 x i32> poison, <32 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
505504
; CHECK-NEXT: tail call void @func1()
506505
; CHECK-NEXT: br label %[[FINALLY]]
507506
; CHECK: [[FINALLY]]:
508-
; CHECK-NEXT: [[VAL3:%.*]] = phi <32 x i32> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
507+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x i32> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
508+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x i32> [[TMP1]], <3 x i32> poison, <32 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
509509
; CHECK-NEXT: ret <32 x i32> [[VAL3]]
510510
;
511511
entry:
@@ -1092,15 +1092,15 @@ define <4 x float> @shuffle_v4f32(<3 x float> %arg0, i1 %cond) {
10921092
; CHECK-NEXT: [[ENTRY:.*:]]
10931093
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
10941094
; CHECK: [[THEN]]:
1095-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
1095+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <3 x i32> <i32 1, i32 2, i32 0>
10961096
; CHECK-NEXT: tail call void @func0()
10971097
; CHECK-NEXT: br label %[[FINALLY:.*]]
10981098
; CHECK: [[ELSE]]:
1099-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
11001099
; CHECK-NEXT: tail call void @func1()
11011100
; CHECK-NEXT: br label %[[FINALLY]]
11021101
; CHECK: [[FINALLY]]:
1103-
; CHECK-NEXT: [[VAL3:%.*]] = phi <4 x float> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
1102+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x float> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
1103+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
11041104
; CHECK-NEXT: ret <4 x float> [[VAL3]]
11051105
;
11061106
entry:
@@ -1127,15 +1127,15 @@ define <6 x float> @shuffle_v6f32(<3 x float> %arg0, i1 %cond) {
11271127
; CHECK-NEXT: [[ENTRY:.*:]]
11281128
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
11291129
; CHECK: [[THEN]]:
1130-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <6 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1130+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <3 x i32> <i32 1, i32 2, i32 0>
11311131
; CHECK-NEXT: tail call void @func0()
11321132
; CHECK-NEXT: br label %[[FINALLY:.*]]
11331133
; CHECK: [[ELSE]]:
1134-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <6 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
11351134
; CHECK-NEXT: tail call void @func1()
11361135
; CHECK-NEXT: br label %[[FINALLY]]
11371136
; CHECK: [[FINALLY]]:
1138-
; CHECK-NEXT: [[VAL3:%.*]] = phi <6 x float> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
1137+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x float> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
1138+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <6 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
11391139
; CHECK-NEXT: ret <6 x float> [[VAL3]]
11401140
;
11411141
entry:
@@ -1162,15 +1162,15 @@ define <8 x float> @shuffle_v8f32(<3 x float> %arg0, i1 %cond) {
11621162
; CHECK-NEXT: [[ENTRY:.*:]]
11631163
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
11641164
; CHECK: [[THEN]]:
1165-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1165+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <3 x i32> <i32 1, i32 2, i32 0>
11661166
; CHECK-NEXT: tail call void @func0()
11671167
; CHECK-NEXT: br label %[[FINALLY:.*]]
11681168
; CHECK: [[ELSE]]:
1169-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
11701169
; CHECK-NEXT: tail call void @func1()
11711170
; CHECK-NEXT: br label %[[FINALLY]]
11721171
; CHECK: [[FINALLY]]:
1173-
; CHECK-NEXT: [[VAL3:%.*]] = phi <8 x float> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
1172+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x float> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
1173+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
11741174
; CHECK-NEXT: ret <8 x float> [[VAL3]]
11751175
;
11761176
entry:
@@ -1197,15 +1197,15 @@ define <16 x float> @shuffle_v16f32(<3 x float> %arg0, i1 %cond) {
11971197
; CHECK-NEXT: [[ENTRY:.*:]]
11981198
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
11991199
; CHECK: [[THEN]]:
1200-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1200+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <3 x i32> <i32 1, i32 2, i32 0>
12011201
; CHECK-NEXT: tail call void @func0()
12021202
; CHECK-NEXT: br label %[[FINALLY:.*]]
12031203
; CHECK: [[ELSE]]:
1204-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
12051204
; CHECK-NEXT: tail call void @func1()
12061205
; CHECK-NEXT: br label %[[FINALLY]]
12071206
; CHECK: [[FINALLY]]:
1208-
; CHECK-NEXT: [[VAL3:%.*]] = phi <16 x float> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
1207+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x float> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
1208+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
12091209
; CHECK-NEXT: ret <16 x float> [[VAL3]]
12101210
;
12111211
entry:
@@ -1232,15 +1232,15 @@ define <32 x float> @shuffle_v32f32(<3 x float> %arg0, i1 %cond) {
12321232
; CHECK-NEXT: [[ENTRY:.*:]]
12331233
; CHECK-NEXT: br i1 [[COND]], label %[[THEN:.*]], label %[[ELSE:.*]]
12341234
; CHECK: [[THEN]]:
1235-
; CHECK-NEXT: [[VAL1:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <32 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
1235+
; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <3 x i32> <i32 1, i32 2, i32 0>
12361236
; CHECK-NEXT: tail call void @func0()
12371237
; CHECK-NEXT: br label %[[FINALLY:.*]]
12381238
; CHECK: [[ELSE]]:
1239-
; CHECK-NEXT: [[VAL2:%.*]] = shufflevector <3 x float> [[ARG0]], <3 x float> poison, <32 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
12401239
; CHECK-NEXT: tail call void @func1()
12411240
; CHECK-NEXT: br label %[[FINALLY]]
12421241
; CHECK: [[FINALLY]]:
1243-
; CHECK-NEXT: [[VAL3:%.*]] = phi <32 x float> [ [[VAL1]], %[[THEN]] ], [ [[VAL2]], %[[ELSE]] ]
1242+
; CHECK-NEXT: [[TMP1:%.*]] = phi <3 x float> [ [[TMP0]], %[[THEN]] ], [ [[ARG0]], %[[ELSE]] ]
1243+
; CHECK-NEXT: [[VAL3:%.*]] = shufflevector <3 x float> [[TMP1]], <3 x float> poison, <32 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>
12441244
; CHECK-NEXT: ret <32 x float> [[VAL3]]
12451245
;
12461246
entry:

0 commit comments

Comments
 (0)