[PATCH] D55851: Implement basic loop fusion pass
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 06:14:20 PST 2019
dmgreen added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:929
+ // defined in that loop, and we likely don't want to disturb it.
+ PHINode *DefPHI = dyn_cast<PHINode>(Def);
+ if (DefPHI)
----------------
I think that you can just do something like
if (Instruction *Def = dyn_cast<Instruction>(Op))
if (FC0.L->contains(Def->getParent()))
return false;
Providing there are no lcssa phis, this should rule out anything that depends on the first loop.
================
Comment at: llvm/test/Transforms/LoopFusion/cannot_fuse.ll:283
+bb6: ; preds = %bb9, %bb
+ %indvars.iv3 = phi i64 [ %indvars.iv.next4, %bb9 ], [ 0, %bb ]
+ %.01 = phi i32 [ 0, %bb ], [ %tmp11, %bb9 ]
----------------
You can run something like -loop-rotate to make this into a more simply structured loop. -instcombine will remove any lcssa nodes, and -simplify-cfg can clean things up too.
I guess that will depend on what types of loops you want to test, ones that have been cleanup up or ones that are a little less structured. It's good to test both, but which is more important will depend on where in the pass pipeline this ends up.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55851/new/
https://reviews.llvm.org/D55851
More information about the llvm-commits
mailing list