Debian Codegraph @

build/build-clang/revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_21.patch

raw
1 From cf00b30288c4c81b2c6a5af01c38f236148777a0 Mon Sep 17 00:00:00 2001
2 From: Mike Hommey <[email protected]>
3 Date: Tue, 28 Mar 2023 06:13:36 +0900
4 Subject: [PATCH] Revert "[Passes][VectorCombine] enable early run generally
5 and try load folds"
6
7 This reverts commit 163bb6d64e5f1220777c3ec2a8b58c0666a74d91.
8 It causes various reftest regressions.
9 ---
10 llvm/lib/Passes/PassBuilderPipelines.cpp | 7 ++++---
11 llvm/lib/Transforms/Vectorize/VectorCombine.cpp | 8 ++------
12 llvm/test/Other/new-pm-defaults.ll | 2 +-
13 .../Other/new-pm-thinlto-postlink-defaults.ll | 1 -
14 .../Other/new-pm-thinlto-postlink-pgo-defaults.ll | 1 -
15 .../new-pm-thinlto-postlink-samplepgo-defaults.ll | 1 -
16 .../Other/new-pm-thinlto-prelink-pgo-defaults.ll | 1 -
17 .../new-pm-thinlto-prelink-samplepgo-defaults.ll | 1 -
18 .../PhaseOrdering/X86/vec-load-combine.ll | 15 +++++++++++----
19 9 files changed, 18 insertions(+), 19 deletions(-)
20
21 diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
22 index 07db107325f0..40045629af06 100644
23 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp
24 +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
25 @@ -729,9 +729,10 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
26 // Delete small array after loop unroll.
27 FPM.addPass(SROAPass(SROAOptions::ModifyCFG));
28
29 - // Try vectorization/scalarization transforms that are both improvements
30 - // themselves and can allow further folds with GVN and InstCombine.
31 - FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
32 + // The matrix extension can introduce large vector operations early, which can
33 + // benefit from running vector-combine early on.
34 + if (EnableMatrix)
35 + FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
36
37 // Eliminate redundancies.
38 FPM.addPass(MergedLoadStoreMotionPass());
39 diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
40 index 019d79567b4a..b3e0f4cf0514 100644
41 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
42 +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
43 @@ -3500,23 +3500,6 @@ bool VectorCombine::run() {
44
45 LLVM_DEBUG(dbgs() << "VC: Visiting: " << I << '\n');
46
47 - // These folds should be beneficial regardless of when this pass is run
48 - // in the optimization pipeline.
49 - // The type checking is for run-time efficiency. We can avoid wasting time
50 - // dispatching to folding functions if there's no chance of matching.
51 - if (IsFixedVectorType) {
52 - switch (Opcode) {
53 - case Instruction::InsertElement:
54 - MadeChange |= vectorizeLoadInsert(I);
55 - break;
56 - case Instruction::ShuffleVector:
57 - MadeChange |= widenSubvectorLoad(I);
58 - break;
59 - default:
60 - break;
61 - }
62 - }
63 -
64 // This transform works with scalable and fixed vectors
65 // TODO: Identify and allow other scalable transforms
66 if (IsVectorType) {
67 @@ -3540,11 +3523,13 @@ bool VectorCombine::run() {
68 if (IsFixedVectorType) {
69 switch (Opcode) {
70 case Instruction::InsertElement:
71 + MadeChange |= vectorizeLoadInsert(I);
72 MadeChange |= foldInsExtFNeg(I);
73 MadeChange |= foldInsExtBinop(I);
74 MadeChange |= foldInsExtVectorToShuffle(I);
75 break;
76 case Instruction::ShuffleVector:
77 + MadeChange |= widenSubvectorLoad(I);
78 MadeChange |= foldPermuteOfBinops(I);
79 MadeChange |= foldShuffleOfBinops(I);
80 MadeChange |= foldShuffleOfSelects(I);
81 diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll
82 index c554fdbf4c79..e02bbec7312e 100644
83 --- a/llvm/test/Other/new-pm-defaults.ll
84 +++ b/llvm/test/Other/new-pm-defaults.ll
85 @@ -198,7 +198,7 @@
86 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
87 ; CHECK-EP-LOOP-END-NEXT: Running pass: NoOpLoopPass
88 ; CHECK-O-NEXT: Running pass: SROAPass on foo
89 -; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
90 +; CHECK-MATRIX: Running pass: VectorCombinePass
91 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
92 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
93 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
94 diff --git a/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
95 index ed13402e1c4b..5d8712841801 100644
96 --- a/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
97 +++ b/llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
98 @@ -124,7 +124,6 @@
99 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
100 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
101 ; CHECK-O-NEXT: Running pass: SROAPass on foo
102 -; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
103 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
104 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
105 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
106 diff --git a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
107 index c82c34f7ff01..c6f95b393170 100644
108 --- a/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
109 +++ b/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
110 @@ -110,7 +110,6 @@
111 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
112 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
113 ; CHECK-O-NEXT: Running pass: SROAPass on foo
114 -; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
115 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
116 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
117 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
118 diff --git a/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
119 index d375747547d6..b17556bc528a 100644
120 --- a/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
121 +++ b/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
122 @@ -119,7 +119,6 @@
123 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
124 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
125 ; CHECK-O-NEXT: Running pass: SROAPass on foo
126 -; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
127 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
128 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
129 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
130 diff --git a/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
131 index f6a940659680..8551ea2bc998 100644
132 --- a/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
133 +++ b/llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
134 @@ -159,7 +159,6 @@
135 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
136 ; CHECK-O-NEXT: Running pass: LoopFullUnrollPass
137 ; CHECK-O-NEXT: Running pass: SROAPass on foo
138 -; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
139 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
140 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
141 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
142 diff --git a/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll b/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
143 index 48a9433d2499..531dc0361873 100644
144 --- a/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
145 +++ b/llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
146 @@ -123,7 +123,6 @@
147 ; CHECK-O-NEXT: Running pass: IndVarSimplifyPass
148 ; CHECK-O-NEXT: Running pass: LoopDeletionPass
149 ; CHECK-O-NEXT: Running pass: SROAPass on foo
150 -; CHECK-O23SZ-NEXT: Running pass: VectorCombinePass
151 ; CHECK-O23SZ-NEXT: Running pass: MergedLoadStoreMotionPass
152 ; CHECK-O23SZ-NEXT: Running pass: GVNPass
153 ; CHECK-O23SZ-NEXT: Running analysis: MemoryDependenceAnalysis
154 diff --git a/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll b/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll
155 index 85f6fceb5bdb..2d20250dfd81 100644
156 --- a/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll
157 +++ b/llvm/test/Transforms/PhaseOrdering/X86/vec-load-combine.ll
158 @@ -12,13 +12,20 @@ $getAt = comdat any
159 define dso_local noundef <4 x float> @ConvertVectors_ByRef(ptr noundef nonnull align 16 dereferenceable(16) %0) #0 {
160 ; SSE-LABEL: @ConvertVectors_ByRef(
161 ; SSE-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[TMP0:%.*]], align 16
162 -; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
163 -; SSE-NEXT: ret <4 x float> [[TMP3]]
164 +; SSE-NEXT: [[TMP3:%.*]] = getelementptr inbounds [4 x float], ptr [[TMP0]], i64 0, i64 1
165 +; SSE-NEXT: [[TMP4:%.*]] = load <2 x float>, ptr [[TMP3]], align 4
166 +; SSE-NEXT: [[TMP5:%.*]] = shufflevector <2 x float> [[TMP4]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
167 +; SSE-NEXT: [[TMP6:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> [[TMP5]], <4 x i32> <i32 0, i32 4, i32 5, i32 undef>
168 +; SSE-NEXT: [[TMP7:%.*]] = shufflevector <4 x float> [[TMP6]], <4 x float> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 5>
169 +; SSE-NEXT: ret <4 x float> [[TMP7]]
170 ;
171 ; AVX-LABEL: @ConvertVectors_ByRef(
172 ; AVX-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[TMP0:%.*]], align 16
173 -; AVX-NEXT: [[TMP3:%.*]] = shufflevector <4 x float> [[TMP2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
174 -; AVX-NEXT: ret <4 x float> [[TMP3]]
175 +; AVX-NEXT: [[TMP3:%.*]] = getelementptr inbounds [4 x float], ptr [[TMP0]], i64 0, i64 2
176 +; AVX-NEXT: [[TMP4:%.*]] = load float, ptr [[TMP3]], align 8
177 +; AVX-NEXT: [[TMP5:%.*]] = insertelement <4 x float> [[TMP2]], float [[TMP4]], i64 2
178 +; AVX-NEXT: [[TMP6:%.*]] = insertelement <4 x float> [[TMP5]], float [[TMP4]], i64 3
179 +; AVX-NEXT: ret <4 x float> [[TMP6]]
180 ;
181 %2 = alloca ptr, align 8
182 %3 = alloca <4 x float>, align 16
183 --
184 2.47.0.1.g59ce1bf855
185