This adds more poison folding optimizations to InstSimplify.
Since all binary operators propagate poison, these are fine.
Also, the precondition of select cond, undef, x -> x is relaxed to allow the case when x is undef.
Paths
| Differential D104661
[InstSimplify] Add more poison folding optimizations ClosedPublic Authored by aqjune on Jun 21 2021, 11:56 AM.
Details
Summary This adds more poison folding optimizations to InstSimplify. Since all binary operators propagate poison, these are fine. Also, the precondition of select cond, undef, x -> x is relaxed to allow the case when x is undef.
Diff Detail
Event Timeline
Comment Actions
Comment Actions LGTM
This revision is now accepted and ready to land.Jun 23 2021, 1:45 AM Closed by commit rG5af8bacc9402: [InstSimplify] Add more poison folding optimizations (authored by aqjune). · Explain WhyJun 23 2021, 4:25 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 353925 llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstCombine/and-narrow.ll
llvm/test/Transforms/InstCombine/getelementptr.ll
llvm/test/Transforms/InstCombine/select-binop-cmp.ll
llvm/test/Transforms/InstSimplify/ConstProp/poison.ll
llvm/test/Transforms/InstSimplify/and.ll
llvm/test/Transforms/InstSimplify/fcmp.ll
llvm/test/Transforms/InstSimplify/mul.ll
llvm/test/Transforms/InstSimplify/or.ll
llvm/test/Transforms/InstSimplify/select-inseltpoison.ll
llvm/test/Transforms/InstSimplify/select.ll
llvm/test/Transforms/InstSimplify/shift.ll
llvm/test/Transforms/InstSimplify/sub.ll
|
I'd prefer the PoisonValue checks to happen independently of the isUndefValue checks, because these are valid even if undef value folding is disabled (folding poison does not create an assumption for a specific undef value).