This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Check if branches use the same MBB in matchOptBrCondByInvertingCond
ClosedPublic

Authored by paquette on Feb 2 2021, 2:26 PM.

Details

Summary

If the G_BR + G_BRCOND in this combine use the same MBB, then it will infinite loop. Don't allow that to happen.

Diff Detail

Event Timeline

paquette created this revision.Feb 2 2021, 2:26 PM
paquette requested review of this revision.Feb 2 2021, 2:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2021, 2:26 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Feb 2 2021, 2:49 PM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
975

I would check this first (also reformat as return X || Y)

paquette updated this revision to Diff 320918.Feb 2 2021, 2:55 PM

Simplify logic

arsenm accepted this revision.Feb 2 2021, 3:13 PM
This revision is now accepted and ready to land.Feb 2 2021, 3:13 PM