[llvm] [X86][SimplifyCFG] Support hoisting load/store with conditional faulting (PR #96878)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 30 21:48:51 PDT 2024
dtcxzyw wrote:
> > Crash reproducer:
> > ```
> > ; bin/opt -passes=simplifycfg -mattr=+cf reduced.ll -S
> > target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
> > target triple = "x86_64-pc-linux-gnu"
> >
> > define i64 @vm_exec_core(i1 %0) {
> > br i1 %0, label %2, label %common.ret
> >
> > common.ret: ; preds = %2, %1
> > ret i64 0
> >
> > 2: ; preds = %1
> > br label %common.ret
> > }
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ```
> > PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
> > Stack dump:
> > 0. Program arguments: bin/opt -passes=simplifycfg -mattr=+cf reduced.ll
> > 1. Running pass "function(simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>)" on module "reduced.ll"
> > 2. Running pass "simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>" on function "vm_exec_core"
> > #0 0x000076ec91614410 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x214410)
> > #1 0x000076ec9161141f llvm::sys::RunSignalHandlers() (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x21141f)
> > #2 0x000076ec91611575 SignalHandler(int) Signals.cpp:0:0
> > #3 0x000076ec91042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
> > #4 0x000076ec8c0b7873 (anonymous namespace)::SimplifyCFGOpt::hoistLoadStoreWithCondFaultingFromSuccessors(llvm::BranchInst*, llvm::BasicBlock*) SimplifyCFG.cpp:0:0
> > #5 0x000076ec8c0bcdea llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&, llvm::ArrayRef<llvm::WeakVH>) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMTransformUtils.so.19.0git+0x2bcdea)
> > #6 0x000076ec8cba8a43 iterativelySimplifyCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&) SimplifyCFGPass.cpp:0:0
> > #7 0x000076ec8cba96ba simplifyFunctionCFGImpl(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DominatorTree*, llvm::SimplifyCFGOptions const&) SimplifyCFGPass.cpp:0:0
> > #8 0x000076ec8cbaa4f5 simplifyFunctionCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DominatorTree*, llvm::SimplifyCFGOptions const&) SimplifyCFGPass.cpp:0:0
> > #9 0x000076ec8cbaa6b0 llvm::SimplifyCFGPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMScalarOpts.so.19.0git+0x3aa6b0)
> > #10 0x000076ec8e0c79e6 llvm::detail::PassModel<llvm::Function, llvm::SimplifyCFGPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMPasses.so.19.0git+0xc79e6)
> > #11 0x000076ec8b14ba1b llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMCore.so.19.0git+0x34ba1b)
> > #12 0x000076ec906d5096 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMX86CodeGen.so.19.0git+0xd5096)
> > #13 0x000076ec8b14a7e7 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMCore.so.19.0git+0x34a7e7)
> > #14 0x000076ec906d59b6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMX86CodeGen.so.19.0git+0xd59b6)
> > #15 0x000076ec8b148d0b llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/../lib/libLLVMCore.so.19.0git+0x348d0b)
> > #16 0x000076ec91a3b6b4 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMOptDriver.so.19.0git+0x2d6b4)
> > #17 0x000076ec91a4878a optMain (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMOptDriver.so.19.0git+0x3a78a)
> > #18 0x000076ec91029d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
> > #19 0x000076ec91029e40 call_init ./csu/../csu/libc-start.c:128:20
> > #20 0x000076ec91029e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
> > #21 0x0000612682610095 _start (bin/opt+0x1095)
> > Segmentation fault (core dumped)
> > ```
>
> Not able to reproduce with latest PR. Probably fixed by [12ea4a1](https://github.com/llvm/llvm-project/commit/12ea4a1eb3ee64d4aed10978f9b50cfc4d14007d)
Can you check this reproducer again (at the top of 8598bcb9934dca16ea16d87304e00defc85d986c)?
https://github.com/llvm/llvm-project/pull/96878
More information about the llvm-commits
mailing list