[PATCH] D113798: Add loop unrolling and peeling preferences for RISCV

Michael Berg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 09:10:32 PST 2021


mcberg2021 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:204
+    for (auto &I : *BB) {
+      // Don't unroll vectorized loop. Vectorization does not benefit from it as
+      // much as scalar code.
----------------
frasercrmck wrote:
> Is this truly checking "vectorized loops" or just loops containing vector instructions? We've already checked that the loop isn't vectorized according to metadata. What about code written using RVV intrinsics, or with OpenCL/SYCL/etc? We might want to unroll those loops, right?
I think for now I am going to mark this with a TODO for more tuning, I updated the comment for vectorized instructions, it will be uploaded soon...


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:217
+
+      SmallVector<const Value *, 4> Operands(I.operand_values());
+      Cost +=
----------------
frasercrmck wrote:
> Does the explicit size of `4` help much or should we just use `SmallVector<const Value*>`?
This setting mirrors SLP's generic vector operand setting, which we utilize, so it does seem appropriate.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113798/new/

https://reviews.llvm.org/D113798



More information about the llvm-commits mailing list