[PATCH] D71569: [LoopFusion] Ensure that both loops are guarded or neither are guarded.
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 09:54:09 PST 2020
Meinersbur added a comment.
LGTM. @Whitney?
================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:738-739
// Ensure that FC0 and FC1 have identical guards.
- // If one (or both) are not guarded, this check is not necessary.
- if (FC0->GuardBranch && FC1->GuardBranch &&
- !haveIdenticalGuards(*FC0, *FC1)) {
- LLVM_DEBUG(dbgs() << "Fusion candidates do not have identical "
- "guards. Not Fusing.\n");
- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,
- NonIdenticalGuards);
- continue;
- }
+ if (FC0->GuardBranch || FC1->GuardBranch)
+ if (!haveIdenticalGuards(*FC0, *FC1)) {
+ LLVM_DEBUG(dbgs() << "Fusion candidates do not have identical "
----------------
[style] `(FC0->GuardBranch || FC1->GuardBranch) && !haveIdenticalGuards(*FC0, *FC1)`
================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:1069-1070
+ // guard.
+ if (!((FC0.GuardBranch && FC1.GuardBranch) ||
+ (!FC0.GuardBranch && !FC1.GuardBranch)))
+ return false;
----------------
The check can still make sense for defensive programming (or replaced by an assertion).
[style] `!FC0.GuardBranch != !FC1.GuardBranch`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71569/new/
https://reviews.llvm.org/D71569
More information about the llvm-commits
mailing list