[PATCH] D147355: [LV] Optimize trip count SCEV.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 31 13:27:17 PDT 2023
craig.topper created this revision.
craig.topper added reviewers: reames, nikic, fhahn.
Herald added subscribers: luke, StephenFan, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, javed.absar, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, vkmr, MaskRay.
Herald added a project: LLVM.
To calculate the trip count we need to add 1 to the backedge
taken count. If we need to widen the backedge count, it's better
to do the add before the widening if we can guarantee it won't
overflow.
The code is here is based on similar code I found in
LoopIdiomRecognize.
This is the vectorizer version of this InstCombine patch D142783 <https://reviews.llvm.org/D142783>.
Looking at the IR diffs, this does look like it gets more cases
than the InstCombine patch.
I'm not an expert on SCEV so perhaps this should be handled somewhere
else so that LoopIdiomRecognize can share.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147355
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/test/Transforms/LoopVectorize/RISCV/riscv-unroll.ll
llvm/test/Transforms/LoopVectorize/X86/conversion-cost.ll
llvm/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll
llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147355.510117.patch
Type: text/x-patch
Size: 97460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230331/1f251232/attachment-0001.bin>
More information about the llvm-commits
mailing list