[PATCH] D84327: [SCEVExpander] Add helper to clean up instrs inserted while expanding.

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 09:23:04 PDT 2020


jroelofs added a comment.

Good call. This is definitely a better place for that to live.



================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1119
   if (!SI->isAtomic() && !LI->isAtomic())
     NewCall = Builder.CreateMemCpy(StoreBasePtr, SI->getAlign(), LoadBasePtr,
                                    LI->getAlign(), NumBytes);
----------------
I think the interface between SCEVExpanderCleaner and SCEVExpander should be a subscriber/consumer model, and the cleaner should own the tracking of what gets added, rather than the expander. Then SCEVExpanderCleaner can hook into IRBuilderCallbackInserter to track these too.


================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:1246
       InsertedValues.insert(AddRecPhiMatch);
+      InsertedInstructions.push_back(AddRecPhiMatch);
       // Remember the increment.
----------------
Where does `InsertedValues` differ from `InsertedInstructions`? Should the former be re-used with an appropriate `isa<Instruction>()` filter, rather than keeping two separate lists?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84327





More information about the llvm-commits mailing list