This is an archive of the discontinued LLVM Phabricator instance.

[X86] Pre-commit test case showing bug in combineOr (X86ISelLowering.cpp)
ClosedPublic

Authored by bjope on Sep 29 2022, 9:26 AM.

Details

Summary

In combineOr (X86ISelLowering.cpp) there is a DAG combine that rewrite
a "(0 - SetCC) | C" pattern into something simpler given that a LEA
can be used. Another requirement is that C has some specific value,
for example 1 or 7. When doing that check it is using a 32-bit
unsigned variable to store the value of C. So for a 64-bit OR this
could miscompile in case any of the 32 most significant bits in C
are set.

This patch adds a test case to show this miscompile bug.

Diff Detail

Event Timeline

bjope created this revision.Sep 29 2022, 9:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2022, 9:26 AM
bjope requested review of this revision.Sep 29 2022, 9:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2022, 9:26 AM
RKSimon accepted this revision.Sep 29 2022, 12:22 PM
RKSimon added a subscriber: RKSimon.

LGTM

This revision is now accepted and ready to land.Sep 29 2022, 12:22 PM