[llvm] c4b1fe0 - [OpenMP][FIX] Use name + type checks not only name checks for calls
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 21 20:51:29 PDT 2021
Author: Johannes Doerfert
Date: 2021-07-21T22:51:05-05:00
New Revision: c4b1fe05dd62c81077a14750de0b6ae3366747e2
URL: https://github.com/llvm/llvm-project/commit/c4b1fe05dd62c81077a14750de0b6ae3366747e2
DIFF: https://github.com/llvm/llvm-project/commit/c4b1fe05dd62c81077a14750de0b6ae3366747e2.diff
LOG: [OpenMP][FIX] Use name + type checks not only name checks for calls
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. Since we will not set RFI.Declaration if the type doesn't
match we can use it (if it's not null) to determine if the signature is
as expected.
Differential Revision: https://reviews.llvm.org/D106341
Added:
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index c82fa696dcf2..2f2ad128891a 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -790,7 +790,8 @@ struct OpenMPOpt {
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;
}
@@ -801,7 +802,8 @@ struct OpenMPOpt {
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;
}
@@ -2463,7 +2465,8 @@ ChangeStatus AAExecutionDomainFunction::updateImpl(Attributor &A) {
// 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 =
More information about the llvm-commits
mailing list