Skip to content

Commit e1a61ba

Browse files
Artem Gindinsonigcbot
authored andcommitted
[LLVM16] Improve AA result queries for RT address space analysis
Address LLVM 16 API compatibility issues related to `RayTracingAddressSpaceAliasAnalysis`: - Improve `AAQueryInfo` wrapper by moving to the arg-less signature based on LLVM 14+ `SimpleAAQueryInfo`. Use that in `StackIDScheduling` to avoid explicit creation of argument objects per unstable API signatures. - Additionally, rename the `addAddressSpaceAAResult()` helper to underline the gathering of general & RT specific AA results - Clean up the pass pipeline configuration by utilizing `IGCExternalAAWrapper` (unused as of yet) instead of direct references to the emerged `addJointAddressSpaceAAResults()` callback.
1 parent e758184 commit e1a61ba

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSignature
475475
mpm.add(createRayTracingAddressSpaceAAWrapperPass());
476476
}
477477

478-
mpm.add(createExternalAAWrapperPass(&addAddressSpaceAAResult));
478+
mpm.add(createIGCExternalAAWrapper());
479479
mpm.add(createScopedNoAliasAAWrapperPass());
480480

481481
TODO("remove the following once all IGC passes are registered to PassRegistery in their constructor")
@@ -1386,7 +1386,7 @@ void OptimizeIR(CodeGenContext* const pContext)
13861386
mpm.add(createRayTracingAddressSpaceAAWrapperPass());
13871387
}
13881388

1389-
mpm.add(createExternalAAWrapperPass(&addAddressSpaceAAResult));
1389+
mpm.add(createIGCExternalAAWrapper());
13901390
mpm.add(createScopedNoAliasAAWrapperPass());
13911391

13921392
if (pContext->m_instrTypes.hasLoadStore)

IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,10 @@ ImmutablePass* IGC::createAddressSpaceAAWrapperPass() {
213213
return new AddressSpaceAAWrapperPass();
214214
}
215215

216-
void IGC::addAddressSpaceAAResult(Pass& P, Function&, AAResults& AAR) {
216+
void IGC::addJointAddressSpaceAAResults(Pass& P, Function& F, AAResults& AAR) {
217217
if (auto * WrapperPass = P.getAnalysisIfAvailable<AddressSpaceAAWrapperPass>())
218218
AAR.addAAResult(WrapperPass->getResult());
219-
if (auto * WrapperPass = P.getAnalysisIfAvailable<RayTracingAddressSpaceAAWrapperPass>())
220-
AAR.addAAResult(WrapperPass->getResult());
219+
addRayTracingAddressSpaceAAResult(P, F, AAR);
221220
}
222221

223222
// Wrapper around LLVM's ExternalAAWrapperPass so that the default constructor
@@ -226,9 +225,13 @@ class IGCExternalAAWrapper : public ExternalAAWrapperPass {
226225
public:
227226
static char ID;
228227

229-
IGCExternalAAWrapper() : ExternalAAWrapperPass(&addAddressSpaceAAResult) {}
228+
IGCExternalAAWrapper() : ExternalAAWrapperPass(&addJointAddressSpaceAAResults) {}
230229
};
231230

231+
ImmutablePass* IGC::createIGCExternalAAWrapper() {
232+
return new IGCExternalAAWrapper();
233+
}
234+
232235
char IGCExternalAAWrapper::ID = 0;
233236

234237
IGC_INITIALIZE_PASS_BEGIN(IGCExternalAAWrapper, "igc-aa-wrapper", "IGC Address space alias analysis Wrapper", PASS_CFG_ONLY, PASS_ANALYSIS)

IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ SPDX-License-Identifier: MIT
1818
namespace IGC {
1919

2020
llvm::ImmutablePass* createAddressSpaceAAWrapperPass();
21-
void addAddressSpaceAAResult(llvm::Pass&, llvm::Function&, llvm::AAResults&);
21+
llvm::ImmutablePass* createIGCExternalAAWrapper();
22+
void addJointAddressSpaceAAResults(llvm::Pass&, llvm::Function&, llvm::AAResults&);
2223

2324
} // End IGC namespace
2425

IGC/WrapperLLVM/include/llvmWrapper/Analysis/AliasAnalysis.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ namespace IGCLLVM
1919
#else
2020
using AliasResultEnum = llvm::AliasResult::Kind;
2121
#endif
22-
inline llvm::AAQueryInfo makeAAQueryInfo() {
23-
#if LLVM_VERSION_MAJOR >= 14
24-
return llvm::AAQueryInfo(new llvm::SimpleCaptureInfo());
22+
23+
using SimpleAAQueryInfo =
24+
#if LLVM_VERSION_MAJOR < 14
25+
llvm::AAQueryInfo;
2526
#else
26-
return llvm::AAQueryInfo();
27+
llvm::SimpleAAQueryInfo;
2728
#endif
2829
}
29-
}
3030

3131
#endif

0 commit comments

Comments
 (0)