[PATCH] D60518: [InstCombine] Handle ssubo always overflow

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 23:25:37 PDT 2019


lebedev.ri added subscribers: nlopes, spatel.
lebedev.ri added a comment.

Hmm



================
Comment at: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp:4016
     if (isa<UndefValue>(RHS))
       return SetResult(RHS, UndefValue::get(Builder.getInt1Ty()), false);
 
----------------
nikic wrote:
> Not related to this patch, but this fold looks buggy to me. X * undef should be {0, false}, as that's the only results that's possible for all values of X (including X=0). IIRC not even undef * undef can result in {undef, undef} for all bitwidths.
```
----------------------------------------
Name: D60518
  %r = mul i8 %X, undef
=>
  %r = undef

ERROR: Value mismatch for i8 %r

Example:
i8 %X = #x00 (0)
Source value: #x00 (0)
Target value: #x80 (128)


----------------------------------------
Name: D60518
  %r = mul i8 %X, undef
=>
  %r = i8 0

Done: 1
Optimization is correct!

----------------------------------------
Name: D60518
  %r = mul i8 %X, undef
=>
  %r = i8 %X

Done: 1
Optimization is correct!

```


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60518





More information about the llvm-commits mailing list