File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
test/Transforms/SLPVectorizer/X86 Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -10768,17 +10768,21 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
10768
10768
std::optional<DenseMap<Value *, unsigned>> ValueToExtUses;
10769
10769
DenseMap<const TreeEntry *, DenseSet<Value *>> ExtractsCount;
10770
10770
for (ExternalUser &EU : ExternalUses) {
10771
+ // Uses by ephemeral values are free (because the ephemeral value will be
10772
+ // removed prior to code generation, and so the extraction will be
10773
+ // removed as well) as well as uses in unreachable blocks or in landing pads
10774
+ // (rarely executed).
10775
+ if (EphValues.count(EU.User) ||
10776
+ (EU.User &&
10777
+ (!DT->isReachableFromEntry(cast<Instruction>(EU.User)->getParent()) ||
10778
+ cast<Instruction>(EU.User)->getParent()->isLandingPad())))
10779
+ continue;
10780
+
10771
10781
// We only add extract cost once for the same scalar.
10772
10782
if (!isa_and_nonnull<InsertElementInst>(EU.User) &&
10773
10783
!ExtractCostCalculated.insert(EU.Scalar).second)
10774
10784
continue;
10775
10785
10776
- // Uses by ephemeral values are free (because the ephemeral value will be
10777
- // removed prior to code generation, and so the extraction will be
10778
- // removed as well).
10779
- if (EphValues.count(EU.User))
10780
- continue;
10781
-
10782
10786
// No extract cost for vector "scalar"
10783
10787
if (isa<FixedVectorType>(EU.Scalar->getType()))
10784
10788
continue;
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ define void @test(i32 %arg) {
5
5
; CHECK-LABEL: define void @test(
6
6
; CHECK-SAME: i32 [[ARG:%.*]]) {
7
7
; CHECK-NEXT: bb:
8
- ; CHECK-NEXT: [[TMP2:%.*]] = zext i32 [[ARG]] to i64
9
8
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> <i32 poison, i32 0>, i32 [[ARG]], i32 0
10
9
; CHECK-NEXT: br label [[BB2:%.*]]
11
10
; CHECK: bb2:
@@ -15,6 +14,8 @@ define void @test(i32 %arg) {
15
14
; CHECK-NEXT: i32 1, label [[BB4:%.*]]
16
15
; CHECK-NEXT: ]
17
16
; CHECK: bb3:
17
+ ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i32> [[TMP0]], i32 0
18
+ ; CHECK-NEXT: [[TMP2:%.*]] = zext i32 [[TMP1]] to i64
18
19
; CHECK-NEXT: switch i32 0, label [[BB10]] [
19
20
; CHECK-NEXT: i32 18, label [[BB7:%.*]]
20
21
; CHECK-NEXT: i32 1, label [[BB7]]
You can’t perform that action at this time.
0 commit comments