Skip to content

Commit 7304315

Browse files
author
Leon Clark
committed
Add VectorCombine transform and update tests.
1 parent 2a1f883 commit 7304315

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
@@ -142,6 +142,7 @@ class VectorCombine {
142142
bool foldInterleaveIntrinsics(Instruction &I);
143143
bool shrinkType(Instruction &I);
144144
bool shrinkLoadForShuffles(Instruction &I);
145+
bool shrinkPhiOfShuffles(Instruction &I);
145146

146147
void replaceValue(Value &Old, Value &New) {
147148
LLVM_DEBUG(dbgs() << "VC: Replacing: " << Old << '\n');
@@ -3994,6 +3995,109 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {
39943995
return false;
39953996
}
39963997

3998+
// Attempt to narrow a phi of shufflevector instructions where the two incoming
3999+
// values have the same operands but different masks. If the two shuffle masks
4000+
// are offsets of one another we can use one branch to rotate the incoming
4001+
// vector and perform one larger shuffle after the phi.
4002+
bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
4003+
auto *Phi = dyn_cast<PHINode>(&I);
4004+
if (!Phi || Phi->getNumIncomingValues() != 2u)
4005+
return false;
4006+
4007+
auto *Shuf0 = dyn_cast<ShuffleVectorInst>(Phi->getOperand(0u));
4008+
auto *Shuf1 = dyn_cast<ShuffleVectorInst>(Phi->getOperand(1u));
4009+
if (!Shuf0 || !Shuf1)
4010+
return false;
4011+
4012+
if (!Shuf0->hasOneUse() && !Shuf1->hasOneUse())
4013+
return false;
4014+
4015+
auto *Shuf0Op0 = Shuf0->getOperand(0u);
4016+
auto *Shuf0Op1 = Shuf0->getOperand(1u);
4017+
auto *Shuf1Op0 = Shuf1->getOperand(0u);
4018+
auto *Shuf1Op1 = Shuf1->getOperand(1u);
4019+
4020+
auto IsPoison = [](Value *Val) -> bool {
4021+
return isa<PoisonValue>(Val) || isa<UndefValue>(Val);
4022+
};
4023+
4024+
if (Shuf0Op0 != Shuf1Op0 || !IsPoison(Shuf0Op1) || !IsPoison(Shuf1Op1))
4025+
return false;
4026+
4027+
// Ensure result vectors are wider than the argument vector.
4028+
auto *InputVT = cast<FixedVectorType>(Shuf0Op0->getType());
4029+
auto *ResultVT = cast<FixedVectorType>(Shuf0->getType());
4030+
auto const InputNumElements = InputVT->getNumElements();
4031+
4032+
if (InputNumElements >= ResultVT->getNumElements())
4033+
return false;
4034+
4035+
// Take the difference of the two shuffle masks at each index. Ignore poison
4036+
// values at the same index in both masks.
4037+
auto Mask0 = Shuf0->getShuffleMask();
4038+
auto Mask1 = Shuf1->getShuffleMask();
4039+
auto NewMask0 = std::vector<int>();
4040+
NewMask0.reserve(Mask0.size());
4041+
4042+
for (auto I = 0u; I < Mask0.size(); ++I) {
4043+
if (Mask0[I] >= 0 && Mask1[I] >= 0)
4044+
NewMask0.push_back(Mask0[I] - Mask1[I]);
4045+
else if (Mask0[I] == -1 && Mask1[I] == -1)
4046+
continue;
4047+
else
4048+
return false;
4049+
}
4050+
4051+
if (NewMask0.empty() ||
4052+
!std::equal(NewMask0.begin() + 1u, NewMask0.end(), NewMask0.begin()))
4053+
return false;
4054+
4055+
// Create new mask using difference of the two incoming masks.
4056+
auto MaskOffset = NewMask0[0u];
4057+
if (!Shuf0->hasOneUse()) {
4058+
std::swap(Shuf0, Shuf1);
4059+
std::swap(Mask0, Mask1);
4060+
MaskOffset *= -1;
4061+
}
4062+
4063+
auto Index = (InputNumElements - MaskOffset) % InputNumElements;
4064+
NewMask0.clear();
4065+
4066+
for (auto I = 0u; I < InputNumElements; ++I) {
4067+
NewMask0.push_back(Index);
4068+
Index = (Index + 1u) % InputNumElements;
4069+
}
4070+
4071+
// Calculate costs for worst cases and compare.
4072+
auto const Kind = TTI::SK_PermuteSingleSrc;
4073+
auto OldCost = std::max(TTI.getShuffleCost(Kind, InputVT, ResultVT, Mask0, CostKind),
4074+
TTI.getShuffleCost(Kind, InputVT, ResultVT, Mask1, CostKind));
4075+
auto NewCost = TTI.getShuffleCost(Kind, InputVT, InputVT, NewMask0, CostKind) +
4076+
TTI.getShuffleCost(Kind, InputVT, ResultVT, Mask1, CostKind);
4077+
4078+
if (NewCost > OldCost)
4079+
return false;
4080+
4081+
// Create new shuffles and narrowed phi.
4082+
auto Builder = IRBuilder(&I);
4083+
Builder.SetInsertPoint(Shuf0);
4084+
Builder.SetCurrentDebugLocation(Shuf0->getDebugLoc());
4085+
auto *NewShuf0 = Builder.CreateShuffleVector(Shuf0Op0, Shuf0Op1, NewMask0);
4086+
4087+
Builder.SetInsertPoint(Phi);
4088+
Builder.SetCurrentDebugLocation(Phi->getDebugLoc());
4089+
auto *NewPhi = Builder.CreatePHI(NewShuf0->getType(), 2u);
4090+
NewPhi->addIncoming(NewShuf0, Phi->getIncomingBlock(0u));
4091+
NewPhi->addIncoming(Shuf1Op0, Phi->getIncomingBlock(1u));
4092+
4093+
Builder.SetInsertPoint(*NewPhi->getInsertionPointAfterDef());
4094+
auto *NewPoison = PoisonValue::get(NewPhi->getType());
4095+
auto *NewShuf2 = Builder.CreateShuffleVector(NewPhi, NewPoison, Mask1);
4096+
4097+
replaceValue(*Phi, *NewShuf2);
4098+
return true;
4099+
}
4100+
39974101
/// This is the entry point for all transforms. Pass manager differences are
39984102
/// handled in the callers of this function.
39994103
bool VectorCombine::run() {
@@ -4081,6 +4185,9 @@ bool VectorCombine::run() {
40814185
case Instruction::Xor:
40824186
MadeChange |= foldBitOpOfCastops(I);
40834187
break;
4188+
case Instruction::PHI:
4189+
MadeChange |= shrinkPhiOfShuffles(I);
4190+
break;
40844191
default:
40854192
MadeChange |= shrinkType(I);
40864193
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)