This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fold `__kmpc_is_generic_main_thread_id` if possible
ClosedPublic

Authored by jhuber6 on Jul 21 2021, 7:00 AM.

Details

Summary

This patch adds the ability to fold __kmpc_is_generic_main_thread_id if we
know for a fact that it is executed by the initial thread using
AAExecutionDomain. This combined with folding __kmpc_is_spmd_exec_mode will
allow us to fully fold __kmpc_is_generic_main_thread.

Depends on D106438 D106437

Diff Detail

Event Timeline

jhuber6 created this revision.Jul 21 2021, 7:00 AM
jhuber6 requested review of this revision.Jul 21 2021, 7:00 AM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
jhuber6 updated this revision to Diff 360449.Jul 21 2021, 7:33 AM

Fixing hang caused by folding call to an undefined value.

jdoerfert added inline comments.Jul 21 2021, 7:42 AM
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
3580
llvm/test/Transforms/OpenMP/fold_generic_main_thread.ll
39

Shouldn't this be folded?

jhuber6 added inline comments.Jul 21 2021, 7:45 AM
llvm/test/Transforms/OpenMP/fold_generic_main_thread.ll
39

It should be folded. I have CHECK-NOT because the only way that call can be removed is through the folding because it's only a declaration in the module. I couldn't decide if I should just use the automatic test script for this, personally I prefer tests like this to be narrow if possible.

jdoerfert added inline comments.Jul 21 2021, 7:51 AM
llvm/test/Transforms/OpenMP/fold_generic_main_thread.ll
39

check-not like above is really easy to break. Let's assume the type is changed, the name of the argument, etc.
If you want it narrow, check for %pred = icmp eq i8 1, 1 or br i1 true, label %if.then, label %if.end

jhuber6 updated this revision to Diff 360461.Jul 21 2021, 7:56 AM

Running test script on test and indicate pessimistic fixpoint.

This revision is now accepted and ready to land.Jul 21 2021, 7:58 AM
This revision was landed with ongoing or failed builds.Jul 21 2021, 6:18 PM
This revision was automatically updated to reflect the committed changes.