| Issue |
63340
|
| Summary |
Clang crash: Assertion `!verifyFunction(*L->getHeader()->getParent(), &dbgs())' failed.
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
shao-hua-li
|
For the following code, clang at -O3 fails on the assertion trunk. `opt-bisect-limit` to `LoopVectorizePass`.
I think the first few lines of messages are crucial **"Instruction does not dominate all uses!"**
Compiler explorer: https://godbolt.org/z/T86G397nM
```console
% cat a.c
int a;
char b, c;
static int d = -720791665;
int g(int h) {
int e = h;
char *f = &b;
do
f++;
while (e /= 10);
a = f - &b;
return a;
}
void j() {
int i;
for (; i < 6; i++)
d = 0;
for (; c; c = g(d - 3574175626) + c)
;
}
int main() {}
%
% clang-tk -O3 a.c
Instruction does not dominate all uses!
%f.0.i = phi ptr [ @b, %for.inc3 ]
%3 = getelementptr inbounds i8, ptr %f.0.i, i64 1
Instruction does not dominate all uses!
%f.0.i = phi ptr [ @b, %for.inc3 ]
%9 = getelementptr inbounds i8, ptr %f.0.i, i64 1
clang-17: /zdata/shaoli/compilers/ccbuilder-repos/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10572: bool llvm::LoopVectorizePass::processLoop(llvm::Loop*): Assertion `!verifyFunction(*L->getHeader()->getParent(), &dbgs())' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name reduced.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/zdata/shaoli/realsmith/work70/work/wrong -resource-dir /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17 -internal-isystem /zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir=/zdata/shaoli/realsmith/work70/work/wrong -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/reduced-dceabd.o -x c reduced.c
1. <eof> parser at end of file
2. Optimizer
#0 0x000055c9bd30327f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3b4627f)
#1 0x000055c9bd3009d4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f6683ea4420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f66838f500b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f66838d4859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f66838d4729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f66838e5fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x000055c9be9e651d llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x522951d)
#8 0x000055c9be9e680d llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AssumptionCache&, llvm::LoopAccessInfoManager&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x522980d)
#9 0x000055c9be9e7a50 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x522aa50)
#10 0x000055c9be5f56c6 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4e386c6)
#11 0x000055c9babc619d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x140919d)
#12 0x000055c9bccb7acd llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x34faacd)
#13 0x000055c9baba9876 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x13ec876)
#14 0x000055c9bccb5a4d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x34f8a4d)
#15 0x000055c9bd583c4e (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#16 0x000055c9bd586ca9 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x3dc9ca9)
#17 0x000055c9be593f72 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4dd6f72)
#18 0x000055c9bf7101e9 clang::ParseAST(clang::Sema&, bool, bool) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x5f531e9)
#19 0x000055c9be592578 clang::CodeGenAction::ExecuteAction() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4dd5578)
#20 0x000055c9bdde2d79 clang::FrontendAction::Execute() (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4625d79)
#21 0x000055c9bdd67c86 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x45aac86)
#22 0x000055c9bdec5326 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x4708326)
#23 0x000055c9ba81e0f4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x10610f4)
#24 0x000055c9ba819e1a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#25 0x000055c9ba81b3ec clang_main(int, char**, llvm::ToolContext const&) (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x105e3ec)
#26 0x000055c9ba730165 main (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0xf73165)
#27 0x00007f66838d6083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#28 0x000055c9ba814bfe _start (/zdata/shaoli/compilers/ccbuilder-compilers/clang-assertion/bin/clang-17+0x1057bfe)
clang-tk: error: unable to execute command: Aborted
clang-tk: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 53d405762219d798286b99c297098a14643440fe)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
clang-tk: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-tk: note: diagnostic msg: /tmp/reduced-f13111.c
clang-tk: note: diagnostic msg: /tmp/reduced-f13111.sh
clang-tk: note: diagnostic msg:
********************
%
% clang-tk -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 53d405762219d798286b99c297098a14643440fe)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
%
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs