[llvm] 7f5c71e - InterleavedLoadCombine: Correctly query PM for TargetTransformInfo (#93103)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 22:07:19 PDT 2024
Author: Matt Arsenault
Date: 2024-05-23T07:07:16+02:00
New Revision: 7f5c71efc441083282a5365d245acfe6afcd0dd5
URL: https://github.com/llvm/llvm-project/commit/7f5c71efc441083282a5365d245acfe6afcd0dd5
DIFF: https://github.com/llvm/llvm-project/commit/7f5c71efc441083282a5365d245acfe6afcd0dd5.diff
LOG: InterleavedLoadCombine: Correctly query PM for TargetTransformInfo (#93103)
Added:
Modified:
llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
index a9b59e738c00b..fc4be84bca109 100644
--- a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
+++ b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
@@ -64,10 +64,10 @@ struct VectorInfo;
struct InterleavedLoadCombineImpl {
public:
InterleavedLoadCombineImpl(Function &F, DominatorTree &DT, MemorySSA &MSSA,
+ const TargetTransformInfo &TTI,
const TargetMachine &TM)
: F(F), DT(DT), MSSA(MSSA),
- TLI(*TM.getSubtargetImpl(F)->getTargetLowering()),
- TTI(TM.getTargetTransformInfo(F)) {}
+ TLI(*TM.getSubtargetImpl(F)->getTargetLowering()), TTI(TTI) {}
/// Scan the function for interleaved load candidates and execute the
/// replacement if applicable.
@@ -87,7 +87,7 @@ struct InterleavedLoadCombineImpl {
const TargetLowering &TLI;
/// Target Transform Information
- const TargetTransformInfo TTI;
+ const TargetTransformInfo &TTI;
/// Find the instruction in sets LIs that dominates all others, return nullptr
/// if there is none.
@@ -1329,6 +1329,7 @@ struct InterleavedLoadCombine : public FunctionPass {
return InterleavedLoadCombineImpl(
F, getAnalysis<DominatorTreeWrapperPass>().getDomTree(),
getAnalysis<MemorySSAWrapperPass>().getMSSA(),
+ getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F),
TPC->getTM<TargetMachine>())
.run();
}
@@ -1336,6 +1337,7 @@ struct InterleavedLoadCombine : public FunctionPass {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<MemorySSAWrapperPass>();
AU.addRequired<DominatorTreeWrapperPass>();
+ AU.addRequired<TargetTransformInfoWrapperPass>();
FunctionPass::getAnalysisUsage(AU);
}
@@ -1348,7 +1350,8 @@ InterleavedLoadCombinePass::run(Function &F, FunctionAnalysisManager &FAM) {
auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
auto &MemSSA = FAM.getResult<MemorySSAAnalysis>(F).getMSSA();
- bool Changed = InterleavedLoadCombineImpl(F, DT, MemSSA, *TM).run();
+ auto &TTI = FAM.getResult<TargetIRAnalysis>(F);
+ bool Changed = InterleavedLoadCombineImpl(F, DT, MemSSA, TTI, *TM).run();
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
}
@@ -1360,6 +1363,7 @@ INITIALIZE_PASS_BEGIN(
false, false)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
INITIALIZE_PASS_END(
InterleavedLoadCombine, DEBUG_TYPE,
"Combine interleaved loads into wide loads and shufflevector instructions",
More information about the llvm-commits
mailing list