diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -1544,6 +1544,13 @@ UsedAssumedInformation); } + /// If \p V is assumed simplified, return it, if it is unclear yet, + /// return None, otherwise return `nullptr`. Same as the public version + /// except that it can be used without recording dependences on any \p AA. + Optional getAssumedSimplified(const IRPosition &V, + const AbstractAttribute *AA, + bool &UsedAssumedInformation); + /// Register \p CB as a simplification callback. /// `Attributor::getAssumedSimplified` will use these callbacks before /// we it will ask `AAValueSimplify`. It is important to ensure this @@ -1561,13 +1568,6 @@ DenseMap> SimplificationCallbacks; - /// If \p V is assumed simplified, return it, if it is unclear yet, - /// return None, otherwise return `nullptr`. Same as the public version - /// except that it can be used without recording dependences on any \p AA. - Optional getAssumedSimplified(const IRPosition &V, - const AbstractAttribute *AA, - bool &UsedAssumedInformation); - public: /// Translate \p V from the callee context into the call site context. Optional diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -3991,11 +3991,23 @@ // Create an ExecutionDomain AA for every function and a HeapToStack AA for // every function if there is a device kernel. + if (!isOpenMPDevice(M)) + return; + for (auto *F : SCC) { - if (!F->isDeclaration()) - A.getOrCreateAAFor(IRPosition::function(*F)); - if (isOpenMPDevice(M)) - A.getOrCreateAAFor(IRPosition::function(*F)); + if (F->isDeclaration()) + continue; + + A.getOrCreateAAFor(IRPosition::function(*F)); + A.getOrCreateAAFor(IRPosition::function(*F)); + + for (auto &I : instructions(*F)) { + if (auto *LI = dyn_cast(&I)) { + bool UsedAssumedInformation = false; + A.getAssumedSimplified(IRPosition::value(*LI), /* AA */ nullptr, + UsedAssumedInformation); + } + } } }