This is an archive of the discontinued LLVM Phabricator instance.

[X86] Update MachineLoopInfo in CMOV conversion.
ClosedPublic

Authored by tianqing on Jun 21 2021, 1:46 AM.

Details

Summary

If a CMOV is in a loop and is converted to branches, CMOV conversion wouldn't
add newly created basic blocks to loop info. Since the candidates is collected
based on loops, instructions in these basic blocks will be ignored.

Diff Detail

Event Timeline

tianqing created this revision.Jun 21 2021, 1:46 AM
tianqing requested review of this revision.Jun 21 2021, 1:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2021, 1:46 AM
xbolva00 added inline comments.
llvm/test/CodeGen/X86/x86-cmov-converter.ll
494

Full checks? Use script to generate checks

pengfei added inline comments.Jun 21 2021, 5:50 AM
llvm/lib/Target/X86/X86CmovConversion.cpp
854

Is it possible the MBB is in more than one loop, e.g. nested?

llvm/test/CodeGen/X86/x86-cmov-converter.ll
494

Maybe you can commit the test first, then show the diff in this patch.

tianqing added inline comments.Jun 21 2021, 11:47 PM
llvm/lib/Target/X86/X86CmovConversion.cpp
854

addBasicBlockToLoop() already handles nested loop.

llvm/test/CodeGen/X86/x86-cmov-converter.ll
494

See D104692.

pengfei accepted this revision.Jun 29 2021, 1:41 AM

LGTM.

This revision is now accepted and ready to land.Jun 29 2021, 1:41 AM
tianqing updated this revision to Diff 355759.Jun 30 2021, 8:23 PM

Update test.

Matt added a subscriber: Matt.Jul 1 2021, 10:42 AM
This revision was automatically updated to reflect the committed changes.