[llvm] [WIP][Assume] Generic assume-based uniformity optimization (PR #160670)

Teja Alaghari via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 5 04:28:34 PDT 2025


================
@@ -3540,6 +3540,79 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
       }
     }
 
+    // Basic assume equality optimization: assume(x == c) -> replace dominated uses of x with c
+    if (auto *ICmp = dyn_cast<ICmpInst>(IIOperand)) {
+      if (ICmp->getPredicate() == ICmpInst::ICMP_EQ) {
----------------
TejaX-Alaghari wrote:

Currently using `PatternMatch.h` (`m_SpecificICmp`, `m_Value`, `m_AllOnes`). Are you aware of higher-level utilities that could simplify this? Happy to refactor if there's a better approach!

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


More information about the llvm-commits mailing list