Skip to content

Commit 7349924

Browse files
committed
fixup! Use integer rather than string to represent tail folding MD value
1 parent 15120e6 commit 7349924

11 files changed

+15
-22
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
@@ -80,7 +80,7 @@ exit: ; preds = %loop
8080
;.
8181
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
8282
; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
83-
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
83+
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
8484
; CHECK: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
8585
; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
8686
;.

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
@@ -115,7 +115,7 @@ exit:
115115
; CHECK: [[META4]] = distinct !{[[META4]], [[META2]]}
116116
; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META6:![0-9]+]], [[META7:![0-9]+]], [[META8:![0-9]+]]}
117117
; CHECK: [[META6]] = !{!"llvm.loop.isvectorized", i32 1}
118-
; CHECK: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
118+
; CHECK: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
119119
; CHECK: [[META8]] = !{!"llvm.loop.unroll.runtime.disable"}
120120
; CHECK: [[LOOP9]] = distinct !{[[LOOP9]], [[META6]]}
121121
;.

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
@@ -1746,7 +1746,7 @@ finish.loopexit:
17461746
;.
17471747
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
17481748
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
1749-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
1749+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
17501750
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
17511751
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META1]]}
17521752
; 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
@@ -1048,7 +1048,7 @@ declare i32 @llvm.abs.i32(i32, i1 immarg)
10481048
;.
10491049
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
10501050
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
1051-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
1051+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
10521052
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
10531053
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META1]]}
10541054
; 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
@@ -1056,7 +1056,7 @@ exit:
10561056
; IF-EVL: [[META4]] = distinct !{[[META4]], [[META2]]}
10571057
; IF-EVL: [[LOOP5]] = distinct !{[[LOOP5]], [[META6:![0-9]+]], [[META7:![0-9]+]], [[META8:![0-9]+]]}
10581058
; IF-EVL: [[META6]] = !{!"llvm.loop.isvectorized", i32 1}
1059-
; IF-EVL: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
1059+
; IF-EVL: [[META7]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
10601060
; IF-EVL: [[META8]] = !{!"llvm.loop.unroll.runtime.disable"}
10611061
; IF-EVL: [[LOOP9]] = distinct !{[[LOOP9]], [[META6]]}
10621062
; 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
@@ -928,7 +928,7 @@ for.end:
928928
;.
929929
; IF-EVL-OUTLOOP: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
930930
; IF-EVL-OUTLOOP: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
931-
; IF-EVL-OUTLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
931+
; IF-EVL-OUTLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
932932
; IF-EVL-OUTLOOP: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
933933
; IF-EVL-OUTLOOP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
934934
; IF-EVL-OUTLOOP: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}
@@ -938,7 +938,7 @@ for.end:
938938
;.
939939
; IF-EVL-INLOOP: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
940940
; IF-EVL-INLOOP: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
941-
; IF-EVL-INLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
941+
; IF-EVL-INLOOP: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
942942
; IF-EVL-INLOOP: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
943943
; IF-EVL-INLOOP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
944944
; 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
@@ -392,7 +392,7 @@ exit:
392392
;.
393393
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
394394
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
395-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
395+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
396396
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
397397
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
398398
; 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
@@ -633,7 +633,7 @@ for.end:
633633
;.
634634
; IF-EVL: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
635635
; IF-EVL: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
636-
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
636+
; IF-EVL: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
637637
; IF-EVL: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
638638
; IF-EVL: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
639639
; 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
@@ -285,7 +285,7 @@ for.end:
285285
; IF-EVL-OUTLOOP: [[META2]] = distinct !{[[META2]], !"LVerDomain"}
286286
; IF-EVL-OUTLOOP: [[LOOP3]] = distinct !{[[LOOP3]], [[META4:![0-9]+]], [[META5:![0-9]+]], [[META6:![0-9]+]]}
287287
; IF-EVL-OUTLOOP: [[META4]] = !{!"llvm.loop.isvectorized", i32 1}
288-
; IF-EVL-OUTLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
288+
; IF-EVL-OUTLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
289289
; IF-EVL-OUTLOOP: [[META6]] = !{!"llvm.loop.unroll.runtime.disable"}
290290
; IF-EVL-OUTLOOP: [[META7]] = !{[[META8:![0-9]+]]}
291291
; IF-EVL-OUTLOOP: [[META8]] = distinct !{[[META8]], [[META2]]}
@@ -296,7 +296,7 @@ for.end:
296296
; IF-EVL-INLOOP: [[META2]] = distinct !{[[META2]], !"LVerDomain"}
297297
; IF-EVL-INLOOP: [[LOOP3]] = distinct !{[[LOOP3]], [[META4:![0-9]+]], [[META5:![0-9]+]], [[META6:![0-9]+]]}
298298
; IF-EVL-INLOOP: [[META4]] = !{!"llvm.loop.isvectorized", i32 1}
299-
; IF-EVL-INLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
299+
; IF-EVL-INLOOP: [[META5]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
300300
; IF-EVL-INLOOP: [[META6]] = !{!"llvm.loop.unroll.runtime.disable"}
301301
; IF-EVL-INLOOP: [[META7]] = !{[[META8:![0-9]+]]}
302302
; 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
@@ -229,7 +229,7 @@ exit:
229229
;.
230230
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]], [[META3:![0-9]+]]}
231231
; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
232-
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", !"evl"}
232+
; CHECK: [[META2]] = !{!"llvm.loop.isvectorized.tailfoldingstyle", i32 0}
233233
; CHECK: [[META3]] = !{!"llvm.loop.unroll.runtime.disable"}
234234
; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]], [[META1]]}
235235
; CHECK: [[LOOP5]] = distinct !{[[LOOP5]], [[META1]], [[META2]], [[META3]]}

0 commit comments

Comments
 (0)