[PATCH] D153963: [InstCombine] Fold binop of select and cast of select condition

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 13:22:29 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:932
+    return SelectInst::Create(CondVal, NewFoldedConst(true, TrueVal),
+                              NewFoldedConst(false, FalseVal));
+
----------------
Think the follow is cleaner:
```
if(CondVal == A || match(...)) {
bool IsInvertedByNot = CondVal != A;
return SelectInst::Create(CondVal, NewFoldedConst(IsInvertedByNot, TrueVal),
                              NewFoldedConst(IsInvertedByNot, FalseVal));
}
```


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

https://reviews.llvm.org/D153963



More information about the llvm-commits mailing list