[PATCH] D101375: [InstCombine] Add a few more patterns for folding select of select

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 10:38:05 PDT 2021


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2732
+        replaceOperand(SI, AIdx, A);
+        replaceOperand(SI, 3 - AIdx, B);
+        return &SI;
----------------
aqjune wrote:
> nikic wrote:
> > This is pretty hard to understand, I think it will be more obvious if you match both patterns separately and use Builder.CreateSelect here instead of modifying all three operands in place.
> Hope this new code addresses the concern.
Don't need to use the Builder?
  return SelectInst::Create(C1, A, B);
  ...
  return SelectInst::Create(C2, B, A);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101375



More information about the llvm-commits mailing list