This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][FIX] Use name + type checks not only name checks for calls
ClosedPublic

Authored by jdoerfert on Jul 19 2021, 8:39 PM.

Details

Summary

A call that is analyzed in an optimization needs to be verified against
the name and type of the runtime function to avoid that we look at
arguments that do not exist (anymore). This can happen if the signature
was rewritten.

Diff Detail

Event Timeline

jdoerfert created this revision.Jul 19 2021, 8:39 PM
jdoerfert requested review of this revision.Jul 19 2021, 8:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2021, 8:39 PM

I didn’t get the idea in the description from the code clearly. The old comparison is still address based. In what scenario that RFI->Declaration can be nullptr? The only difference might be when CB->getCalledFunction() and RFI.Declarion are both nullptr, which will fail the check now.

I didn’t get the idea in the description from the code clearly. The old comparison is still address based. In what scenario that RFI->Declaration can be nullptr? The only difference might be when CB->getCalledFunction() and RFI.Declarion are both nullptr, which will fail the check now.

Yes. We do not set RFI.Declaration if the type doesn't match what we expect. getCallIfRegularCall should have always checked RFI has a declaration, now it does and that makes sure we see a call to the right function with the right type when we access the operand.

tianshilei1992 accepted this revision.Jul 20 2021, 9:44 AM

LGTM. Probably good to put the explanation in description as well.

This revision is now accepted and ready to land.Jul 20 2021, 9:44 AM
This revision was landed with ongoing or failed builds.Jul 21 2021, 8:51 PM
This revision was automatically updated to reflect the committed changes.