[PATCH] D65464: [LoopFusion] Add ability to fuse guarded loops

Kit Barton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 12:30:05 PDT 2019


kbarton marked 6 inline comments as done.
kbarton added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:1057
+        if (FC0CmpInst->isIdenticalTo(FC1CmpInst))
+          return true;
+
----------------
Whitney wrote:
> what if FC0 guard first successor is FC0 Loop, but FC1 guard second successor is FC1 Loop? 
Then this check will fail.
This isn't meant to be exhaustive, but a first pass. If we run into situations where the guards are logically equivalent, and not identical, then we can extend this at that point. 


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:1089
+  bool isEmptyExitBlock(const FusionCandidate &FC) const {
+    return FC.ExitBlock->size() == 1;
+  }
----------------
Whitney wrote:
> Do we need to assert FC.ExitBlock != nullptr?
This should never be null, otherwise the FusionCandidate is not valid. However, it doesn't hurt to check just to be sure.
I've added a similar check to isEmptyPreheader above as well. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65464





More information about the llvm-commits mailing list