This is an archive of the discontinued LLVM Phabricator instance.

[StructurizeCFG] Fix boolean not bug
ClosedPublic

Authored by foad on Feb 22 2022, 2:07 AM.

Details

Summary

D118623 added code to fold not-of-compare into a compare
with the inverted predicate, if the compare had no other
uses. This relies on accurate use lists in the IR but it
was run before setPhiValues, when some phi inputs are still
stored in a data structure on the side, instead of being
real uses in the IR. The effect was that a phi that should
be using the original compare result would now get an
inverted result instead.

Fix this by moving simplifyConditions after setPhiValues.

Diff Detail

Event Timeline

foad created this revision.Feb 22 2022, 2:07 AM
foad requested review of this revision.Feb 22 2022, 2:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2022, 2:07 AM
arsenm accepted this revision.Feb 22 2022, 8:46 AM
This revision is now accepted and ready to land.Feb 22 2022, 8:46 AM
This revision was landed with ongoing or failed builds.Feb 22 2022, 9:38 AM
This revision was automatically updated to reflect the committed changes.

@arsenm @foad Can we backport it to LLVM 14? LLVM 14 is unusable because of this bug.

Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 12:09 PM

@arsenm @foad Can we backport it to LLVM 14? LLVM 14 is unusable because of this bug.

I'm not sure if any more llvm 14 stable releases are planned but I opened https://github.com/llvm/llvm-project/issues/57012