Skip to content

Commit 0ffcd14

Browse files
committed
fixup! Use integer rather than string to represent tail folding MD value
1 parent 1bb72c3 commit 0ffcd14

12 files changed

+16
-23
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,14 @@ void LoopVectorizeHints::setAlreadyVectorized() {
190190
}
191191

192192
void LoopVectorizeHints::setVectorizedTailFoldingStyle(TailFoldingKind Kind) {
193-
LLVMContext &Context = TheLoop->getHeader()->getContext();
194-
Metadata *ValueMD = nullptr;
195-
196-
switch (Kind) {
197-
case TFK_Unspecified:
193+
if (Kind == TFK_Unspecified)
198194
return;
199-
case TFK_EVL:
200-
ValueMD = MDString::get(Context, "evl");
201-
break;
202-
}
203195

196+
LLVMContext &Context = TheLoop->getHeader()->getContext();
204197
MDNode *TailFoldingMD = MDNode::get(
205198
Context,
206199
{MDString::get(Context, "llvm.loop.isvectorized.tailfoldingstyle"),
207-
ValueMD});
200+
ConstantAsMetadata::get(ConstantInt::get(Context, APInt(32, Kind)))});
208201
MDNode *LoopID = TheLoop->getLoopID();
209202
MDNode *NewLoopID =
210203
makePostTransformationMetadata(Context, LoopID, {}, {TailFoldingMD});

llvm/test/Transforms/LoopVectorize/RISCV/truncate-to-minimal-bitwidth-evl-crash.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ exit: ; preds = %loop
7979
;.
8080
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
8181
; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
82-
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
82+
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
8383
; CHECK: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
8484
; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
8585
;.

llvm/test/Transforms/LoopVectorize/RISCV/type-info-cache-evl-crash.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ exit:
116116
; CHECK: [[META4]] = distinct !{[[META4]], [[META2]]}
117117
; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META6:![0-9]+]], [[META7:![0-9]+]], [[META8:![0-9]+]]}
118118
; CHECK: [[META6]] = !{!"llvm.loop.isvectorized", i32 1}
119-
; CHECK: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
119+
; CHECK: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
120120
; CHECK: [[META8]] = !{!"llvm.loop.unroll.runtime.disable"}
121121
; CHECK: [[LOOP9]] = distinct !{[[LOOP9]], [[META6]]}
122122
;.

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-bin-unary-ops-args.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ finish.loopexit:
17641764
;.
17651765
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
17661766
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
1767-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
1767+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
17681768
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
17691769
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META1]]}
17701770
; IF-EVL: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-call-intrinsics.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ declare i32 @llvm.abs.i32(i32, i1 immarg)
10571057
;.
10581058
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
10591059
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
1060-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
1060+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
10611061
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
10621062
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META1]]}
10631063
; IF-EVL: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-cast-intrinsics.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ exit:
10661066
; IF-EVL: [[META4]] = distinct !{[[META4]], [[META2]]}
10671067
; IF-EVL: [[LOOP5]] = distinct !{[[LOOP5]], [[META6:![0-9]+]], [[META7:![0-9]+]], [[META8:![0-9]+]]}
10681068
; IF-EVL: [[META6]] = !{!"llvm.loop.isvectorized", i32 1}
1069-
; IF-EVL: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
1069+
; IF-EVL: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
10701070
; IF-EVL: [[META8]] = !{!"llvm.loop.unroll.runtime.disable"}
10711071
; IF-EVL: [[LOOP9]] = distinct !{[[LOOP9]], [[META6]]}
10721072
; IF-EVL: [[META10]] = !{[[META11:![0-9]+]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-cond-reduction.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ for.end:
940940
;.
941941
; IF-EVL-OUTLOOP: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
942942
; IF-EVL-OUTLOOP: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
943-
; IF-EVL-OUTLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
943+
; IF-EVL-OUTLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
944944
; IF-EVL-OUTLOOP: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
945945
; IF-EVL-OUTLOOP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
946946
; IF-EVL-OUTLOOP: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}
@@ -950,7 +950,7 @@ for.end:
950950
;.
951951
; IF-EVL-INLOOP: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
952952
; IF-EVL-INLOOP: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
953-
; IF-EVL-INLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
953+
; IF-EVL-INLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
954954
; IF-EVL-INLOOP: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
955955
; IF-EVL-INLOOP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
956956
; IF-EVL-INLOOP: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-div.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ exit:
396396
;.
397397
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
398398
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
399-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
399+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
400400
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
401401
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
402402
; IF-EVL: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-fixed-order-recurrence.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ for.end:
640640
;.
641641
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
642642
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
643-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
643+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
644644
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
645645
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
646646
; IF-EVL: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-intermediate-store.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ for.end:
289289
; IF-EVL-OUTLOOP: [[META2]] = distinct !{[[META2]], !"LVerDomain"}
290290
; IF-EVL-OUTLOOP: [[LOOP3]] = distinct !{[[LOOP3]], [[META4:![0-9]+]], [[META5:![0-9]+]], [[META6:![0-9]+]]}
291291
; IF-EVL-OUTLOOP: [[META4]] = !{!"llvm.loop.isvectorized", i32 1}
292-
; IF-EVL-OUTLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
292+
; IF-EVL-OUTLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
293293
; IF-EVL-OUTLOOP: [[META6]] = !{!"llvm.loop.unroll.runtime.disable"}
294294
; IF-EVL-OUTLOOP: [[META7]] = !{[[META8:![0-9]+]]}
295295
; IF-EVL-OUTLOOP: [[META8]] = distinct !{[[META8]], [[META2]]}
@@ -300,7 +300,7 @@ for.end:
300300
; IF-EVL-INLOOP: [[META2]] = distinct !{[[META2]], !"LVerDomain"}
301301
; IF-EVL-INLOOP: [[LOOP3]] = distinct !{[[LOOP3]], [[META4:![0-9]+]], [[META5:![0-9]+]], [[META6:![0-9]+]]}
302302
; IF-EVL-INLOOP: [[META4]] = !{!"llvm.loop.isvectorized", i32 1}
303-
; IF-EVL-INLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
303+
; IF-EVL-INLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
304304
; IF-EVL-INLOOP: [[META6]] = !{!"llvm.loop.unroll.runtime.disable"}
305305
; IF-EVL-INLOOP: [[META7]] = !{[[META8:![0-9]+]]}
306306
; IF-EVL-INLOOP: [[META8]] = distinct !{[[META8]], [[META2]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-known-no-overflow.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ exit:
232232
;.
233233
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
234234
; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
235-
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
235+
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
236236
; CHECK: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
237237
; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
238238
; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-uniform-store.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ exit:
8686
;.
8787
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
8888
; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
89-
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
89+
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
9090
; CHECK: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
9191
; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
9292
;.

0 commit comments

Comments
 (0)