This is an archive of the discontinued LLVM Phabricator instance.

[X86FixupLEAs] Sub register usage of LEA dest should block LEA/SUB optimization
ClosedPublic

Authored by Carrot on Jun 8 2021, 12:11 PM.

Details

Summary

In function searchALUInst, sub register usage of LEA dest should also block LEA/SUB optimization, otherwise the sub register usage gets an undefined value.

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=50615.

Diff Detail

Event Timeline

Carrot created this revision.Jun 8 2021, 12:11 PM
Carrot requested review of this revision.Jun 8 2021, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2021, 12:11 PM
RKSimon added inline comments.Jun 8 2021, 1:18 PM
llvm/test/CodeGen/X86/lea-opt2.ll
186

Please can you reference PR50615 in the comment for future reference

Carrot updated this revision to Diff 350703.Jun 8 2021, 1:36 PM
Carrot marked an inline comment as done.

I confirm that the initial miscompile we found gets fixed by this patch. I can't approve the patch because I'm not familiar with the component though.

RKSimon accepted this revision.Jun 11 2021, 1:29 AM

LGTM - cheers

This revision is now accepted and ready to land.Jun 11 2021, 1:29 AM
This revision was landed with ongoing or failed builds.Jun 11 2021, 9:46 AM
This revision was automatically updated to reflect the committed changes.