Add simplification of smul.fix and smul.fix.sat according to
X * 0 -> 0 X * undef -> 0 X * (1 << scale) -> X
This includes the commuted patterns and splatted vectors.
Paths
| Differential D98299
[InstSimplify] Simplify smul.fix and smul.fix.sat ClosedPublic Authored by bjope on Mar 9 2021, 3:15 PM.
Details
Summary Add simplification of smul.fix and smul.fix.sat according to X * 0 -> 0 X * undef -> 0 X * (1 << scale) -> X This includes the commuted patterns and splatted vectors.
Diff Detail
Event TimelineThis revision is now accepted and ready to land.Mar 10 2021, 12:13 PM nagisa added inline comments.
Closed by commit rG529c8e8dc6e9: [InstSimplify] Simplify smul.fix and smul.fix.sat (authored by bjope). · Explain WhyMar 12 2021, 12:11 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 330166 llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/smul_fix.ll
|
Wouldn't this fail to trigger if the intrinsic call starts as follows?
If I understand it correctly, the canonicalization step above would swap the two operands, making the Op0 = undef and Op1 = 42, thus preventing this simplification from happening.
(This does not appear to be an issue for 0, it seems there's code somewhere else that const-evaluates this operation if both operands are constant)