[PATCH] D84327: [SCEVExpander] Add helper to clean up instrs inserted while expanding.
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 12:52:29 PDT 2020
rupprecht added a comment.
Here's as far as I could get with a repro. Sorry it's weird:
$ cat /tmp/repro.cc
template <typename bm>
class b {
public:
b(bm d) : bn(d) {}
template <typename bo>
void operator=(bo d) {
bh(bn, d);
}
bm bn;
};
template <typename>
class c;
template <typename a>
class e {
public:
b<a> ai() { return *static_cast<a *>(this); }
c<a> ag(long d) { return c<a>(a(), d); }
};
template <typename ax, typename bg>
void bh(ax d, bg g) {
float *h = d.al(), *k = g.al();
for (long f; f; ++f) h[f] = k[f];
}
class n : public e<n> {
public:
float *al();
};
class o : public e<c<int> > {
public:
float *al() { return ak; }
o(float *d) : ak(d) {}
float *ak;
};
template <typename aj>
class c : public o {
public:
c(aj d, long g) : o(d.al() + g) {}
};
n l, m;
void by() {
for (int j = 0, i = 0;; ++j, i += j) m.ag(i).ai() = l;
}
$ clang -O1 -fexperimental-new-pass-manager -c /tmp/repro.cc -o /tmp/repro.o
clang: /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:2663: llvm::SCEVExpanderCleaner::~SCEVExpanderCleaner(): Assertion `all_of(I->users(), [&InsertedSet](Value *U) { return InsertedSet.contains(cast<Instruction>(U)); }) && "removed instruction should only be used by instructions inserted " "during expansion"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: bin/clang -O1 -fexperimental-new-pass-manager -c /tmp/repro.cc -o /tmp/repro.o
1. <eof> parser at end of file
2. Optimizer
....
#12 0x0000000008d6eac0 llvm::SCEVExpanderCleaner::~SCEVExpanderCleaner() /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:2665:5
#13 0x00000000088ebc6e (anonymous namespace)::LoopIdiomRecognize::processLoopStoreOfLoopLoad(llvm::StoreInst*, llvm::SCEV const*) /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1174:1
#14 0x00000000088e9e0d (anonymous namespace)::LoopIdiomRecognize::runOnLoopBlock(llvm::BasicBlock*, llvm::SCEV const*, llvm::SmallVectorImpl<llvm::BasicBlock*>&) /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:589:19
#15 0x00000000088e99f1 (anonymous namespace)::LoopIdiomRecognize::runOnCountableLoop() /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:366:19
#16 0x00000000088e91ce (anonymous namespace)::LoopIdiomRecognize::runOnLoop(llvm::Loop*) /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:326:7
#17 0x00000000088e8e26 llvm::LoopIdiomRecognizePass::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:274:7
#18 0x000000000a70b885 llvm::detail::PassModel<llvm::Loop, llvm::LoopIdiomRecognizePass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:17
#19 0x000000000a892f8c llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Scalar/LoopPassManager.cpp:45:14
#20 0x000000000a70d83a llvm::FunctionToLoopPassAdaptor<llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h:335:16
#21 0x000000000a70d445 llvm::detail::PassModel<llvm::Function, llvm::FunctionToLoopPassAdaptor<llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&> >, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:17
#22 0x000000000814afc0 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManager.h:517:16
#23 0x000000000a719ff8 llvm::CGSCCToFunctionPassAdaptor<llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> > >::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) /home/rupprecht/src/llvm-project/llvm/include/llvm/Analysis/CGSCCPassManager.h:508:16
#24 0x000000000a719d05 llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::CGSCCToFunctionPassAdaptor<llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> > >, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:17
#25 0x0000000008209465 llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) /home/rupprecht/src/llvm-project/llvm/lib/Analysis/CGSCCPassManager.cpp:84:14
#26 0x0000000008364046 llvm::DevirtSCCRepeatedPass<llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&> >::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) /home/rupprecht/src/llvm-project/llvm/include/llvm/Analysis/CGSCCPassManager.h:641:11
#27 0x0000000008363787 llvm::ModuleToPostOrderCGSCCPassAdaptor<llvm::DevirtSCCRepeatedPass<llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&> > >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/Analysis/CGSCCPassManager.h:902:20
#28 0x0000000008362ed5 llvm::detail::PassModel<llvm::Module, llvm::ModuleToPostOrderCGSCCPassAdaptor<llvm::DevirtSCCRepeatedPass<llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&> > >, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:17
#29 0x0000000008149d9d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManager.h:517:16
#30 0x0000000008350706 llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/lib/Transforms/IPO/Inliner.cpp:1072:3
#31 0x000000000a71a835 llvm::detail::PassModel<llvm::Module, llvm::ModuleInlinerWrapperPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:17
#32 0x0000000008149d9d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManager.h:517:16
#33 0x000000000a7340f5 llvm::detail::PassModel<llvm::Module, llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:17
#34 0x0000000008149d9d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/rupprecht/src/llvm-project/llvm/include/llvm/IR/PassManager.h:517:16
#35 0x0000000009015591 (anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) /home/rupprecht/src/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1460:5
#36 0x00000000090122e5 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) /home/rupprecht/src/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1685:5
#37 0x0000000009cb0155 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/rupprecht/src/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:335:7
#38 0x000000000c2b1658 clang::ParseAST(clang::Sema&, bool, bool) /home/rupprecht/src/llvm-project/clang/lib/Parse/ParseAST.cpp:178:12
#39 0x0000000009add31d clang::ASTFrontendAction::ExecuteAction() /home/rupprecht/src/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1059:1
#40 0x0000000009cac47f clang::CodeGenAction::ExecuteAction() /home/rupprecht/src/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1183:1
#41 0x0000000009adcce8 clang::FrontendAction::Execute() /home/rupprecht/src/llvm-project/clang/lib/Frontend/FrontendAction.cpp:954:7
#42 0x0000000009a0b5fc clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/rupprecht/src/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:984:23
#43 0x0000000009c981ed clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/rupprecht/src/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:8
#44 0x0000000005ae603c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/rupprecht/src/llvm-project/clang/tools/driver/cc1_main.cpp:240:13
...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84327/new/
https://reviews.llvm.org/D84327
More information about the llvm-commits
mailing list