[Openmp-commits] [PATCH] D106845: [OpenMP] Try to simplify all loads in device code
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jul 26 20:29:00 PDT 2021
jdoerfert created this revision.
jdoerfert added reviewers: jhuber6, tianshilei1992, ggeorgakoudis.
Herald added subscribers: ormris, okura, kuter, guansong, bollu, hiraditya, yaxunl.
jdoerfert requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added subscribers: llvm-commits, bbn, sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.
Eliminating loads/stores in the device code is worth the extra effort,
especially for the new device runtime.
At the same time we do not compute AAExecutionDomain for non-device code
anymore, there is no point.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106845
Files:
llvm/include/llvm/Transforms/IPO/Attributor.h
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
@@ -3863,11 +3863,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<AAExecutionDomain>(IRPosition::function(*F));
- if (isOpenMPDevice(M))
- A.getOrCreateAAFor<AAHeapToStack>(IRPosition::function(*F));
+ if (F->isDeclaration())
+ continue;
+
+ A.getOrCreateAAFor<AAExecutionDomain>(IRPosition::function(*F));
+ A.getOrCreateAAFor<AAHeapToStack>(IRPosition::function(*F));
+
+ for (auto &I : instructions(*F)) {
+ if (auto *LI = dyn_cast<LoadInst>(&I)) {
+ bool UsedAssumedInformation = false;
+ A.getAssumedSimplified(IRPosition::value(*LI), /* AA */ nullptr,
+ UsedAssumedInformation);
+ }
+ }
}
}
Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1547,6 +1547,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<Value *> 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
@@ -1564,13 +1571,6 @@
DenseMap<IRPosition, SmallVector<SimplifictionCallbackTy, 1>>
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<Value *> getAssumedSimplified(const IRPosition &V,
- const AbstractAttribute *AA,
- bool &UsedAssumedInformation);
-
public:
/// Translate \p V from the callee context into the call site context.
Optional<Value *>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106845.361891.patch
Type: text/x-patch
Size: 2693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210727/24d258e5/attachment.bin>
More information about the Openmp-commits
mailing list