[PATCH] D83392: Strlen loop idiom recognition

Muhammad Usman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 07:32:33 PDT 2020


musman marked an inline comment as done.
musman added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1657
+  // Find the 'sub' instruction that computes the strlen. First we need
+  // the base pointer to check the operands of the 'sub'.
+  auto *BasePtrSCEV = dyn_cast<SCEVUnknown>(SE->getPointerBase(LoadEv));
----------------
efriedma wrote:
> I don't understand what you're doing here.
> 
> Probably the simplest thing to do here would be to directly expand LCSSAPHI based on the result of strlen, instead of trying to dig into the exit block and find a subtraction operation.
I was thinking the subtraction operation was needed in order to do replaceAllUsesWith on it, is there a way to do that without needing the subtract?
Also, to expand the LCSSAPHI would you take the incoming value and check if it's an AddRec, then expand that?
Thanks again.


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

https://reviews.llvm.org/D83392



More information about the llvm-commits mailing list