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

Hari Limaye via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 06:02:00 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) {
----------------
hazzlim wrote:

Ah good point, I've changed this.

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


More information about the llvm-commits mailing list