Skip to content

Commit 7f5c71e

Browse files
authored
InterleavedLoadCombine: Correctly query PM for TargetTransformInfo (llvm#93103)
1 parent 896bceb commit 7f5c71e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ struct VectorInfo;
6464
struct InterleavedLoadCombineImpl {
6565
public:
6666
InterleavedLoadCombineImpl(Function &F, DominatorTree &DT, MemorySSA &MSSA,
67+
const TargetTransformInfo &TTI,
6768
const TargetMachine &TM)
6869
: F(F), DT(DT), MSSA(MSSA),
69-
TLI(*TM.getSubtargetImpl(F)->getTargetLowering()),
70-
TTI(TM.getTargetTransformInfo(F)) {}
70+
TLI(*TM.getSubtargetImpl(F)->getTargetLowering()), TTI(TTI) {}
7171

7272
/// Scan the function for interleaved load candidates and execute the
7373
/// replacement if applicable.
@@ -87,7 +87,7 @@ struct InterleavedLoadCombineImpl {
8787
const TargetLowering &TLI;
8888

8989
/// Target Transform Information
90-
const TargetTransformInfo TTI;
90+
const TargetTransformInfo &TTI;
9191

9292
/// Find the instruction in sets LIs that dominates all others, return nullptr
9393
/// if there is none.
@@ -1329,13 +1329,15 @@ struct InterleavedLoadCombine : public FunctionPass {
13291329
return InterleavedLoadCombineImpl(
13301330
F, getAnalysis<DominatorTreeWrapperPass>().getDomTree(),
13311331
getAnalysis<MemorySSAWrapperPass>().getMSSA(),
1332+
getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F),
13321333
TPC->getTM<TargetMachine>())
13331334
.run();
13341335
}
13351336

13361337
void getAnalysisUsage(AnalysisUsage &AU) const override {
13371338
AU.addRequired<MemorySSAWrapperPass>();
13381339
AU.addRequired<DominatorTreeWrapperPass>();
1340+
AU.addRequired<TargetTransformInfoWrapperPass>();
13391341
FunctionPass::getAnalysisUsage(AU);
13401342
}
13411343

@@ -1348,7 +1350,8 @@ InterleavedLoadCombinePass::run(Function &F, FunctionAnalysisManager &FAM) {
13481350

13491351
auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
13501352
auto &MemSSA = FAM.getResult<MemorySSAAnalysis>(F).getMSSA();
1351-
bool Changed = InterleavedLoadCombineImpl(F, DT, MemSSA, *TM).run();
1353+
auto &TTI = FAM.getResult<TargetIRAnalysis>(F);
1354+
bool Changed = InterleavedLoadCombineImpl(F, DT, MemSSA, TTI, *TM).run();
13521355
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
13531356
}
13541357

@@ -1360,6 +1363,7 @@ INITIALIZE_PASS_BEGIN(
13601363
false, false)
13611364
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
13621365
INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
1366+
INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
13631367
INITIALIZE_PASS_END(
13641368
InterleavedLoadCombine, DEBUG_TYPE,
13651369
"Combine interleaved loads into wide loads and shufflevector instructions",

0 commit comments

Comments
 (0)