Skip to content

Commit 4a6a0f2

Browse files
author
Leon Clark
committed
Add VectorCombine transform and update tests.
1 parent f331e87 commit 4a6a0f2

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
@@ -131,6 +131,7 @@ class VectorCombine {
131131
bool foldSelectShuffle(Instruction &I, bool FromReduction = false);
132132
bool foldInterleaveIntrinsics(Instruction &I);
133133
bool shrinkType(Instruction &I);
134+
bool shrinkPhiOfShuffles(Instruction &I);
134135

135136
void replaceValue(Value &Old, Value &New) {
136137
LLVM_DEBUG(dbgs() << "VC: Replacing: " << Old << '\n');
@@ -3483,6 +3484,109 @@ bool VectorCombine::foldInterleaveIntrinsics(Instruction &I) {
34833484
return true;
34843485
}
34853486

3487+
// Attempt to narrow a phi of shufflevector instructions where the two incoming
3488+
// values have the same operands but different masks. If the two shuffle masks
3489+
// are offsets of one another we can use one branch to rotate the incoming
3490+
// vector and perform one larger shuffle after the phi.
3491+
bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
3492+
auto *Phi = dyn_cast<PHINode>(&I);
3493+
if (!Phi || Phi->getNumIncomingValues() != 2u)
3494+
return false;
3495+
3496+
auto *Shuf0 = dyn_cast<ShuffleVectorInst>(Phi->getOperand(0u));
3497+
auto *Shuf1 = dyn_cast<ShuffleVectorInst>(Phi->getOperand(1u));
3498+
if (!Shuf0 || !Shuf1)
3499+
return false;
3500+
3501+
if (!Shuf0->hasOneUse() && !Shuf1->hasOneUse())
3502+
return false;
3503+
3504+
auto *Shuf0Op0 = Shuf0->getOperand(0u);
3505+
auto *Shuf0Op1 = Shuf0->getOperand(1u);
3506+
auto *Shuf1Op0 = Shuf1->getOperand(0u);
3507+
auto *Shuf1Op1 = Shuf1->getOperand(1u);
3508+
3509+
auto IsPoison = [](Value *Val) -> bool {
3510+
return isa<PoisonValue>(Val) || isa<UndefValue>(Val);
3511+
};
3512+
3513+
if (Shuf0Op0 != Shuf1Op0 || !IsPoison(Shuf0Op1) || !IsPoison(Shuf1Op1))
3514+
return false;
3515+
3516+
// Ensure result vectors are wider than the argument vector.
3517+
auto *InputVT = cast<FixedVectorType>(Shuf0Op0->getType());
3518+
auto *ResultVT = cast<FixedVectorType>(Shuf0->getType());
3519+
auto const InputNumElements = InputVT->getNumElements();
3520+
3521+
if (InputNumElements >= ResultVT->getNumElements())
3522+
return false;
3523+
3524+
// Take the difference of the two shuffle masks at each index. Ignore poison
3525+
// values at the same index in both masks.
3526+
auto Mask0 = Shuf0->getShuffleMask();
3527+
auto Mask1 = Shuf1->getShuffleMask();
3528+
auto NewMask0 = std::vector<int>();
3529+
NewMask0.reserve(Mask0.size());
3530+
3531+
for (auto I = 0u; I < Mask0.size(); ++I) {
3532+
if (Mask0[I] >= 0 && Mask1[I] >= 0)
3533+
NewMask0.push_back(Mask0[I] - Mask1[I]);
3534+
else if (Mask0[I] == -1 && Mask1[I] == -1)
3535+
continue;
3536+
else
3537+
return false;
3538+
}
3539+
3540+
if (NewMask0.empty() ||
3541+
!std::equal(NewMask0.begin() + 1u, NewMask0.end(), NewMask0.begin()))
3542+
return false;
3543+
3544+
// Create new mask using difference of the two incoming masks.
3545+
auto MaskOffset = NewMask0[0u];
3546+
if (!Shuf0->hasOneUse()) {
3547+
std::swap(Shuf0, Shuf1);
3548+
std::swap(Mask0, Mask1);
3549+
MaskOffset *= -1;
3550+
}
3551+
3552+
auto Index = (InputNumElements - MaskOffset) % InputNumElements;
3553+
NewMask0.clear();
3554+
3555+
for (auto I = 0u; I < InputNumElements; ++I) {
3556+
NewMask0.push_back(Index);
3557+
Index = (Index + 1u) % InputNumElements;
3558+
}
3559+
3560+
// Calculate costs for worst cases and compare.
3561+
auto const Kind = TTI::SK_PermuteSingleSrc;
3562+
auto OldCost = std::max(TTI.getShuffleCost(Kind, InputVT, Mask0, CostKind),
3563+
TTI.getShuffleCost(Kind, InputVT, Mask1, CostKind));
3564+
auto NewCost = TTI.getShuffleCost(Kind, InputVT, NewMask0, CostKind) +
3565+
TTI.getShuffleCost(Kind, InputVT, Mask1, CostKind);
3566+
3567+
if (NewCost > OldCost)
3568+
return false;
3569+
3570+
// Create new shuffles and narrowed phi.
3571+
auto Builder = IRBuilder(&I);
3572+
Builder.SetInsertPoint(Shuf0);
3573+
Builder.SetCurrentDebugLocation(Shuf0->getDebugLoc());
3574+
auto *NewShuf0 = Builder.CreateShuffleVector(Shuf0Op0, Shuf0Op1, NewMask0);
3575+
3576+
Builder.SetInsertPoint(Phi);
3577+
Builder.SetCurrentDebugLocation(Phi->getDebugLoc());
3578+
auto *NewPhi = Builder.CreatePHI(NewShuf0->getType(), 2u);
3579+
NewPhi->addIncoming(NewShuf0, Phi->getIncomingBlock(0u));
3580+
NewPhi->addIncoming(Shuf1Op0, Phi->getIncomingBlock(1u));
3581+
3582+
Builder.SetInsertPoint(*NewPhi->getInsertionPointAfterDef());
3583+
auto *NewPoison = PoisonValue::get(NewPhi->getType());
3584+
auto *NewShuf2 = Builder.CreateShuffleVector(NewPhi, NewPoison, Mask1);
3585+
3586+
replaceValue(*Phi, *NewShuf2);
3587+
return true;
3588+
}
3589+
34863590
/// This is the entry point for all transforms. Pass manager differences are
34873591
/// handled in the callers of this function.
34883592
bool VectorCombine::run() {
@@ -3561,6 +3665,9 @@ bool VectorCombine::run() {
35613665
case Instruction::BitCast:
35623666
MadeChange |= foldBitcastShuffle(I);
35633667
break;
3668+
case Instruction::PHI:
3669+
MadeChange |= shrinkPhiOfShuffles(I);
3670+
break;
35643671
default:
35653672
MadeChange |= shrinkType(I);
35663673
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)