[PATCH] D155461: [InstCombine] Keep !unpredictable when combining select+add
Paweł Bylica via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 03:05:12 PDT 2023
chfast added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:540
Value *NewSel = Builder.CreateSelect(SI.getCondition(), Swapped ? C : OOp,
- Swapped ? OOp : C);
+ Swapped ? OOp : C, "", &SI);
if (isa<FPMathOperator>(&SI))
----------------
goldstein.w.n wrote:
> chfast wrote:
> > goldstein.w.n wrote:
> > > chfast wrote:
> > > > I believe there are more case in the file where metadata copy is missed. I will try to identify them and create more tests cases. Can be in this review on later, depending on reviewers' suggestion.
> > > Are there any other binops you want to preserve this flag for?
> > I think it make sense for any binop because the condition of the select in this transformation remains unchanged (i.e. `!unpredictable` is still applicable).
> I think you have this in the right place for most binops, but you should probably add additional tests for things like:
> `sub`, `or`, `xor`, `and`, `mul`, `div`, `rem`, `llvm.min`, `llvm.max`, etc...
>
> you probably don't need all but some variety of those (like 1/2 bitwise, div or rem, a few intrinsics) should provide better coverage.
I added tests for most instructions from `getSelectFoldableOperands`. There are no any intrinsics there.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155461/new/
https://reviews.llvm.org/D155461
More information about the llvm-commits
mailing list