This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Handle ssubo always overflow
ClosedPublic

Authored by nikic on Apr 10 2019, 9:18 AM.

Details

Summary

Followup to D60483 and D60497: Handle always overflow for ssubo. This it the last case we can handle right now.

Diff Detail

Event Timeline

nikic created this revision.Apr 10 2019, 9:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2019, 9:18 AM
This revision is now accepted and ready to land.Apr 10 2019, 9:26 AM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.Apr 12 2019, 3:29 PM
nikic added inline comments.
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
4016 ↗(On Diff #194536)

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.

Hmm

llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
4016 ↗(On Diff #194536)
----------------------------------------
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!