[PATCH] D101720: [InstCombine] generalize select + select/and/or folding using implied conditions

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 2 06:39:11 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1881
+  if (SI0 && SI0->getCondition()->getType() == Op1->getType()) {
+    if (auto *I = foldAndOrOfSelectUsingImpliedCond(Op1, *SI0, true))
+      return I;
----------------
`/* IsAnd */ true` etc


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2596
+  assert(SI.getType() == CondVal->getType() &&
+         "foldAndOrOfSelectUsingImpliedCond deals with i1 typed operands only");
+
----------------
I'm not sure about this assert. Can't you end up with an  i1 CondVal, but an <n x i1> SI here?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2628
+  }
+  llvm_unreachable("unreachable code");
+}
----------------
Don't think we need this.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2757
+        if (auto *I = foldAndOrOfSelectUsingImpliedCond(CondVal, *Op1SI, IsAnd))
+        return I;
     }
----------------
Missing indent


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101720/new/

https://reviews.llvm.org/D101720



More information about the llvm-commits mailing list