[llvm] 4c27ca2 - [NFC][SimplifyCFG] SinkCommonCodeFromPredecessors(): reword comment about PR30244
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 28 15:01:19 PDT 2021
Author: Roman Lebedev
Date: 2021-04-29T01:01:00+03:00
New Revision: 4c27ca21d9e5a99d49b7791795ff9dd7d312f760
URL: https://github.com/llvm/llvm-project/commit/4c27ca21d9e5a99d49b7791795ff9dd7d312f760
DIFF: https://github.com/llvm/llvm-project/commit/4c27ca21d9e5a99d49b7791795ff9dd7d312f760.diff
LOG: [NFC][SimplifyCFG] SinkCommonCodeFromPredecessors(): reword comment about PR30244
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 3bf5463efe16..6f19453aba03 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2041,11 +2041,11 @@ static bool SinkCommonCodeFromPredecessors(BasicBlock *BB,
};
if (Cond) {
- // Check if we would actually sink anything first! This mutates the CFG and
- // adds an extra block. The goal in doing this is to allow instructions that
- // couldn't be sunk before to be sunk - obviously, speculatable instructions
- // (such as trunc, add) can be sunk and predicated already. So we check that
- // we're going to sink at least one non-speculatable instruction.
+ // It is always legal to sink common instructions from unconditional
+ // predecessors. However, if not all predecessors are unconditional,
+ // this transformation might be pessimizing. So as a rule of thumb,
+ // don't do it unless we'd sink at least one non-speculatable instruction.
+ // See https://bugs.llvm.org/show_bug.cgi?id=30244
LRI.reset();
unsigned Idx = 0;
bool Profitable = false;
More information about the llvm-commits
mailing list