[llvm] [WIP][InstCombine] Add assume-based optimizations for equality and AMDGPU ballot patterns (PR #160670)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 04:22:49 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
----------------
ssahasra wrote:

Ouch! I totally missed that. Now I see that `isValidAssumeForContext()` actually checks dominance to make sure that the assume applies at the use of `x`.

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


More information about the llvm-commits mailing list