mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[OpenMP] Try to simplify all loads in device code
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. Differential Revision: https://reviews.llvm.org/D106845
This commit is contained in:
parent
756885168c
commit
e9073c9b78
@ -1544,6 +1544,13 @@ struct Attributor {
|
||||
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
|
||||
@ -1561,13 +1568,6 @@ private:
|
||||
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 *>
|
||||
|
@ -3991,11 +3991,23 @@ void OpenMPOpt::registerAAs(bool IsModulePass) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user