[PATCH] D98299: [InstSimplify] Simplify smul.fix and smul.fix.sat

Simonas Kazlauskas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 15:44:03 PST 2021


nagisa added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:5765
+    if (Q.isUndefValue(Op1))
+      return Constant::getNullValue(ReturnType);
+
----------------
Wouldn't this fail to trigger if the intrinsic call starts as follows?

```
lang=llvm
%res = call i16 @llvm.smul.fix.i16(i16 42, i16 undef, i32 ...)
```

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)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98299



More information about the llvm-commits mailing list