This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] visitSIGN_EXTEND_INREG should fold sext_vector_inreg(undef) to 0 not undef.
ClosedPublic

Authored by craig.topper on Jul 4 2020, 12:42 PM.

Details

Summary

We need to ensure that the sign bits of the result all match
so we can't fold to undef.

Similar to PR46585.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 4 2020, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 4 2020, 12:42 PM
lebedev.ri accepted this revision.Jul 4 2020, 12:57 PM

Would be good to have a test case, but it's obviously broken, yes.

----------------------------------------
Name: zz
  %r = sext i8 undef to i32
  ret i32 %r
=>
  %r = i32 undef
  ret i32 %r

ERROR: Value mismatch for i32 %r

Example:
Source value: #x00000000 (0)    [based on undef value]
Target value: #x00008000 (32768)
This revision is now accepted and ready to land.Jul 4 2020, 12:57 PM
This revision was automatically updated to reflect the committed changes.