[llvm] [SPIR-V] Simplify i1 comparisons before expanding to logical ops (PR #214638)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 05:01:50 PDT 2026


================
@@ -175,6 +176,13 @@ static void runLowerI1Comparisons(Function &F) {
     Value *P = Cmp->getOperand(0);
     Value *Q = Cmp->getOperand(1);
 
+    const DataLayout &DL = F.getDataLayout();
+    if (Value *Simplified = simplifyICmpInst(Pred, P, Q, SimplifyQuery(DL))) {
+      Cmp->replaceAllUsesWith(Simplified);
+      Cmp->eraseFromParent();
+      continue;
+    }
----------------
MrSidims wrote:

We can do it only if `F` has no `optnone` attribute. Also we should preserve debug information.

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


More information about the llvm-commits mailing list