[PATCH] D105009: [LSR] Handle case 1*reg => reg. PR50918

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 17:20:51 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:514
     return;
-  // So far we did not need this case. This is easy to implement but it is
-  // useless to maintain dead code. Beside it could hurt compile time.
----------------
Given the comment indicates an unimplemented case here, why not just implement it?

Adding the following code just above the assert appears to address your test case.

+
+  if (BaseRegs.empty() && ScaledReg && Scale == 1) {
+    BaseRegs.push_back(ScaledReg);
+    Scale = 0;
+    ScaledReg = nullptr;
+    return;
+  }

Any reason why this is a poor approach?


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

https://reviews.llvm.org/D105009



More information about the llvm-commits mailing list