[Openmp-commits] [PATCH] D106341: [OpenMP][FIX] Use name + type checks not only name checks for calls
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jul 19 20:39:41 PDT 2021
jdoerfert created this revision.
jdoerfert added reviewers: jhuber6, tianshilei1992, ggeorgakoudis, ye-luo.
Herald added subscribers: ormris, guansong, bollu, hiraditya, yaxunl.
jdoerfert requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106341
Files:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Index: llvm/lib/Transforms/IPO/OpenMPOpt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -769,7 +769,8 @@
Use &U, OMPInformationCache::RuntimeFunctionInfo *RFI = nullptr) {
CallInst *CI = dyn_cast<CallInst>(U.getUser());
if (CI && CI->isCallee(&U) && !CI->hasOperandBundles() &&
- (!RFI || CI->getCalledFunction() == RFI->Declaration))
+ (!RFI ||
+ (RFI->Declaration && CI->getCalledFunction() == RFI->Declaration)))
return CI;
return nullptr;
}
@@ -780,7 +781,8 @@
Value &V, OMPInformationCache::RuntimeFunctionInfo *RFI = nullptr) {
CallInst *CI = dyn_cast<CallInst>(&V);
if (CI && !CI->hasOperandBundles() &&
- (!RFI || CI->getCalledFunction() == RFI->Declaration))
+ (!RFI ||
+ (RFI->Declaration && CI->getCalledFunction() == RFI->Declaration)))
return CI;
return nullptr;
}
@@ -2494,7 +2496,8 @@
// Match: -1 == __kmpc_target_init (for non-SPMD kernels only!)
if (C->isAllOnesValue()) {
auto *CB = dyn_cast<CallBase>(Cmp->getOperand(0));
- if (!CB || CB->getCalledFunction() != RFI.Declaration)
+ CB = CB ? OpenMPOpt::getCallIfRegularCall(*CB, &RFI) : nullptr;
+ if (!CB)
return false;
const int InitIsSPMDArgNo = 1;
auto *IsSPMDModeCI =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106341.360000.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210720/e4e87d36/attachment.bin>
More information about the Openmp-commits
mailing list