[PATCH] D125016: [LV] Widen freeze instead of scalarizing it
lizhijin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 10:25:11 PDT 2022
lizhijin updated this revision to Diff 430441.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125016/new/
https://reviews.llvm.org/D125016
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/vector-freeze.ll
Index: llvm/test/Transforms/LoopVectorize/vector-freeze.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/LoopVectorize/vector-freeze.ll
@@ -0,0 +1,26 @@
+; RUN: opt -loop-vectorize -force-vector-width=16 -force-vector-interleave=1 -S < %s | FileCheck %s
+; RUN: opt -loop-vectorize -scalable-vectorization=on -force-target-supports-scalable-vectors=true -force-vector-width=16 -force-vector-interleave=1 -S < %s | FileCheck %s --check-prefix=SVE
+
+define i64 @test(ptr noalias readonly %addr) {
+; CHECK-LABEL: @test(
+; CHECK: vector.body:
+; CHECK: freeze <16 x i64>
+
+; SVE-LABEL: @test(
+; SVE: vector.body:
+; SVE: freeze <vscale x 16 x i64>
+
+entry:
+ br label %loop
+
+exit:
+ ret i64 %tmp4
+
+loop:
+ %tmp3 = phi ptr [ %tmp6, %loop ], [ %addr, %entry ]
+ %tmp4 = freeze i64 0
+ %tmp5 = add i64 0, 0
+ %tmp6 = getelementptr inbounds ptr, ptr %tmp3, i64 1
+ %tmp7 = icmp eq ptr %tmp6, null
+ br i1 %tmp7, label %exit, label %loop
+}
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8444,6 +8444,7 @@
case Instruction::URem:
case Instruction::Xor:
case Instruction::ZExt:
+ case Instruction::Freeze:
return true;
}
return false;
@@ -9367,6 +9368,17 @@
break;
}
+ case Instruction::Freeze: {
+ State.ILV->setDebugLocFromInst(&I);
+
+ for (unsigned Part = 0; Part < State.UF; ++Part) {
+ Value *Op = State.get(getOperand(0), Part);
+
+ Value *Freeze = Builder.CreateFreeze(Op);
+ State.set(this, Freeze, Part);
+ }
+ break;
+ }
case Instruction::ICmp:
case Instruction::FCmp: {
// Widen compares. Generate vector compares.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125016.430441.patch
Type: text/x-patch
Size: 1889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220518/8551b18a/attachment.bin>
More information about the llvm-commits
mailing list