[PATCH] D81225: Correctly report modified status for LoopDistribute
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 00:30:40 PDT 2020
serge-sans-paille created this revision.
serge-sans-paille added reviewers: anemet, nikic, foad, jdoerfert.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
serge-sans-paille retitled this revision from "Correctlt report modified status for LoopDistribute" to "Correctly report modified status for LoopDistribute".
Related to https://reviews.llvm.org/D80916
https://reviews.llvm.org/D81225
Files:
llvm/lib/Transforms/Scalar/LoopDistribute.cpp
Index: llvm/lib/Transforms/Scalar/LoopDistribute.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopDistribute.cpp
+++ llvm/lib/Transforms/Scalar/LoopDistribute.cpp
@@ -785,6 +785,8 @@
return fail("HeuristicDisabled", "distribution heuristic disabled");
LLVM_DEBUG(dbgs() << "\nDistributing loop: " << *L << "\n");
+
+ bool Modified = false;
// We're done forming the partitions set up the reverse mapping from
// instructions to partitions.
Partitions.setupPartitionIdOnInstructions();
@@ -792,8 +794,10 @@
// To keep things simple have an empty preheader before we version or clone
// the loop. (Also split if this has no predecessor, i.e. entry, because we
// rely on PH having a predecessor.)
- if (!PH->getSinglePredecessor() || &*PH->begin() != PH->getTerminator())
+ if (!PH->getSinglePredecessor() || &*PH->begin() != PH->getTerminator()) {
+ Modified = true;
SplitBlock(PH, PH->getTerminator(), DT, LI);
+ }
// If we need run-time checks, version the loop now.
auto PtrToPartition = Partitions.computePartitionSetForPointers(*LAI);
@@ -804,7 +808,8 @@
if (LAI->hasConvergentOp() && !Checks.empty()) {
return fail("RuntimeCheckWithConvergent",
- "may not insert runtime check with convergent operation");
+ "may not insert runtime check with convergent operation",
+ Modified);
}
if (!Pred.isAlwaysTrue() || !Checks.empty()) {
@@ -835,6 +840,7 @@
// Create identical copies of the original loop for each partition and hook
// them up sequentially.
Partitions.cloneLoops();
+ Modified = true;
// Now, we remove the instruction from each loop that don't belong to that
// partition.
@@ -854,11 +860,11 @@
L->getHeader())
<< "distributed loop";
});
- return true;
+ return Modified;
}
- /// Provide diagnostics then \return with false.
- bool fail(StringRef RemarkName, StringRef Message) {
+ /// Provide diagnostics then \return with Modified.
+ bool fail(StringRef RemarkName, StringRef Message, bool Modified=false) {
LLVMContext &Ctx = F->getContext();
bool Forced = isForced().getValueOr(false);
@@ -887,7 +893,7 @@
*F, L->getStartLoc(), "loop not distributed: failed "
"explicitly specified loop distribution"));
- return false;
+ return Modified;
}
/// Return if distribution forced to be enabled/disabled for the loop.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81225.268676.patch
Type: text/x-patch
Size: 2615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/9186b6b9/attachment.bin>
More information about the llvm-commits
mailing list