[llvm] [LoopIdiom] Support 'shift until less-than' idiom (PR #95002)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 07:55:02 PDT 2024


================
@@ -1517,6 +1524,34 @@ static Value *matchCondition(BranchInst *BI, BasicBlock *LoopEntry,
   return nullptr;
 }
 
+/// Check if the given conditional branch is based on an unsigned less-than
+/// comparison between a variable and a constant, and if the comparison is false
+/// the control yields to the loop entry. If the branch matches the behaviour,
+/// the variable involved in the comparison is returned.
+static Value *matchShiftULTCondition(BranchInst *BI, BasicBlock *LoopEntry,
+                                     unsigned &Threshold) {
----------------
david-arm wrote:

Should this be `uint64_t &Threshold` instead because `CmpConst->getZExtValue()` returns uint64_t?

https://github.com/llvm/llvm-project/pull/95002


More information about the llvm-commits mailing list