This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Fix] Properly inherit calling convention
ClosedPublic

Authored by jhuber6 on Jan 24 2022, 11:09 AM.

Details

Summary

Previously in OpenMPOpt we did not correctly inherit the calling
convention of the callee when creating new OpenMP runtime calls. This
created issues when the calling convention was changed during
GlobalOpt but a new call was creating without the correct calling
convention. This lead to the call being replaced with a poison value in
InstCombine due to undefined behaviour and causing large portions of
the program to be incorrectly eliminated. This patch correctly inherits
the existing calling convention from the callee.

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 24 2022, 11:09 AM
jhuber6 requested review of this revision.Jan 24 2022, 11:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2022, 11:09 AM
This revision is now accepted and ready to land.Jan 24 2022, 11:12 AM

are there any other createCall calls we might need to update?

llvm/lib/Transforms/IPO/OpenMPOpt.cpp
3254–3256

Unrelated: don't we need debug loc here too?

are there any other createCall calls we might need to update?

There are other locations we should probably include, places where we call CallInst::Create directly.

llvm/lib/Transforms/IPO/OpenMPOpt.cpp
3254–3256

Could probably include it.

jhuber6 updated this revision to Diff 402642.Jan 24 2022, 1:15 PM

Add more functions that should inherit their calling convention.

jdoerfert accepted this revision.Jan 24 2022, 1:28 PM
This revision was landed with ongoing or failed builds.Jan 24 2022, 5:38 PM
This revision was automatically updated to reflect the committed changes.