mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-04 03:17:51 +00:00
[NVPTX] Run NVVMReflect at the beginning of IR passes.
Summary: Currently the NVVMReflect pass is run at the beginning of our backend passes. But really, it should be run as early as possible, as it's simply resolving an "if" statement in code. So copy it into TargetMachine::addEarlyAsPossiblePasses. We still run it at the beginning of the backend passes, since it's needed for correctness when lowering to nvptx. (Specifically, NVVMReflect changes each call to the __nvvm_reflect function or llvm.nvvm.reflect intrinsic into an integer constant, based on the pass's configuration. Clearly we miss many optimization opportunities if we perform this transformation at the beginning of codegen.) Reviewers: rnk Subscribers: tra, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D18616 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267765 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ae889d3672
commit
bd4ea6e77b
@ -167,6 +167,10 @@ TargetPassConfig *NVPTXTargetMachine::createPassConfig(PassManagerBase &PM) {
|
||||
return new NVPTXPassConfig(this, PM);
|
||||
}
|
||||
|
||||
void NVPTXTargetMachine::addEarlyAsPossiblePasses(PassManagerBase &PM) {
|
||||
PM.add(createNVVMReflectPass());
|
||||
}
|
||||
|
||||
TargetIRAnalysis NVPTXTargetMachine::getTargetIRAnalysis() {
|
||||
return TargetIRAnalysis([this](const Function &F) {
|
||||
return TargetTransformInfo(NVPTXTTIImpl(this, F));
|
||||
@ -228,7 +232,12 @@ void NVPTXPassConfig::addIRPasses() {
|
||||
disablePass(&FuncletLayoutID);
|
||||
disablePass(&PatchableFunctionID);
|
||||
|
||||
// NVVMReflectPass is added in addEarlyAsPossiblePasses, so hopefully running
|
||||
// it here does nothing. But since we need it for correctness when lowering
|
||||
// to NVPTX, run it here too, in case whoever built our pass pipeline didn't
|
||||
// call addEarlyAsPossiblePasses.
|
||||
addPass(createNVVMReflectPass());
|
||||
|
||||
if (getOptLevel() != CodeGenOpt::None)
|
||||
addPass(createNVPTXImageOptimizerPass());
|
||||
addPass(createNVPTXAssignValidGlobalNamesPass());
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
return TLOF.get();
|
||||
}
|
||||
|
||||
void addEarlyAsPossiblePasses(PassManagerBase &PM) override;
|
||||
TargetIRAnalysis getTargetIRAnalysis() override;
|
||||
|
||||
}; // NVPTXTargetMachine.
|
||||
|
Loading…
x
Reference in New Issue
Block a user