This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Attributor] Move allocas converted from __kmpc_alloc_shared to entry block
ClosedPublic

Authored by doru1004 on Sep 26 2022, 6:57 PM.

Details

Summary

Move allocas converted from __kmpc_alloc_shared to entry block. This patch fixes an issue that occurs when inlined functions lead to conversions to allocs from __kmpc_alloc_shared calls to not be moved to the entry block of the function hence failing to be passed as arguments to other non-inlined functions.

Diff Detail

Event Timeline

doru1004 created this revision.Sep 26 2022, 6:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
doru1004 requested review of this revision.Sep 26 2022, 6:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
doru1004 edited the summary of this revision. (Show Details)Sep 26 2022, 6:58 PM
jdoerfert added inline comments.Sep 26 2022, 7:08 PM
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
6371

Why do the check above if we overwrite the result anyway?

doru1004 updated this revision to Diff 463077.Sep 26 2022, 7:42 PM
doru1004 updated this revision to Diff 463215.Sep 27 2022, 6:30 AM
jdoerfert accepted this revision.Sep 27 2022, 6:39 AM

We still need the size check, see the change suggestion.

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
6364–6366
This revision is now accepted and ready to land.Sep 27 2022, 6:39 AM
doru1004 updated this revision to Diff 463216.Sep 27 2022, 6:41 AM
doru1004 updated this revision to Diff 463218.Sep 27 2022, 6:48 AM

FWIW, "then move it to the entry block." is not really true, see my comment suggestion.

FWIW, "then move it to the entry block." is not really true, see my comment suggestion.

Yes already made the changes locally just haven't updated the diff! Thanks a lot for pointing it out!

doru1004 updated this revision to Diff 463266.Sep 27 2022, 9:57 AM