Skip to content

opt crashed with "-licm": Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed. #47875

@llvmbot

Description

@llvmbot
Bugzilla Link 48531
Version trunk
OS Linux
Attachments bc file pased to opt
Reporter LLVM Bugzilla Contributor

Extended Description


OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux


Program:
int a, d;
short b;
long c;
void e() {
f : {
int g;
for (; 1; d++)
;
if (g) {
if (a)
goto h;
i:
if (b)
h:
goto f;
}
if (c)
goto i;
}
}
int main() {}


clang version:
$ clang -v
clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang cee1e7d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
Found candidate GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64


Command Lines:
$ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc
$ opt -licm a.bc -o a.opt.bc
opt: /home/suocy/src/llvm-dev/llvm-project/llvm/lib/Analysis/MemorySSAUpdater.cpp:508: void llvm::MemorySSAUpdater::fixupDefs(const llvm::SmallVectorImplllvm::WeakVH&): Assertion `MSSA->dominates(NewDef, FirstDef) && "Should have dominated the new access"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/suocy/bin/llvm-dev/bin/opt -licm a.bc -o a.opt.bc

  1.  Running pass 'Function Pass Manager' on module 'a.bc'.
    
  2.  Running pass 'Loop Pass Manager' on function '@e'
    
  3.  Running pass 'Loop Invariant Code Motion' on basic block '%for.cond'
    

#​0 0x0000000002aa662c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/suocy/bin/llvm-dev/bin/opt+0x2aa662c)
#​1 0x0000000002aa44a4 llvm::sys::RunSignalHandlers() (/home/suocy/bin/llvm-dev/bin/opt+0x2aa44a4)
#​2 0x0000000002aa4603 SignalHandler(int) (/home/suocy/bin/llvm-dev/bin/opt+0x2aa4603)
#​3 0x00007faffc316630 __restore_rt (/lib64/libpthread.so.0+0xf630)
#​4 0x00007faffaf04387 raise (/lib64/libc.so.6+0x36387)
#​5 0x00007faffaf05a78 abort (/lib64/libc.so.6+0x37a78)
#​6 0x00007faffaefd1a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
#​7 0x00007faffaefd252 (/lib64/libc.so.6+0x2f252)
#​8 0x0000000001b866d8 llvm::MemorySSAUpdater::fixupDefs(llvm::SmallVectorImplllvm::WeakVH const&) (/home/suocy/bin/llvm-dev/bin/opt+0x1b866d8)
#​9 0x0000000001b869de llvm::MemorySSAUpdater::insertDef(llvm::MemoryDef*, bool) (/home/suocy/bin/llvm-dev/bin/opt+0x1b869de)
#​10 0x000000000281649a (anonymous namespace)::LoopPromoter::doExtraRewritesBeforeFinalDeletion() (/home/suocy/bin/llvm-dev/bin/opt+0x281649a)
#​11 0x0000000002be7d67 llvm::LoadAndStorePromoter::run(llvm::SmallVectorImplllvm::Instruction* const&) (/home/suocy/bin/llvm-dev/bin/opt+0x2be7d67)
#​12 0x0000000002814bbf llvm::promoteLoopAccessesToScalars(llvm::SmallSetVector<llvm::Value*, 8u> const&, llvm::SmallVectorImplllvm::BasicBlock*&, llvm::SmallVectorImplllvm::Instruction*&, llvm::SmallVectorImplllvm::MemoryAccess*&, llvm::PredIteratorCache&, llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo const*, llvm::Loop*, llvm::AliasSetTracker*, llvm::MemorySSAUpdater*, llvm::ICFLoopSafetyInfo*, llvm::OptimizationRemarkEmitter*) (/home/suocy/bin/llvm-dev/bin/opt+0x2814bbf)
#​13 0x000000000281fe77 (anonymous namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*, llvm::ScalarEvolution*, llvm::MemorySSA*, llvm::OptimizationRemarkEmitter*) (.part.767) (/home/suocy/bin/llvm-dev/bin/opt+0x281fe77)
#​14 0x0000000002820bbd (anonymous namespace)::LegacyLICMPass::runOnLoop(llvm::Loop*, llvm::LPPassManager&) (/home/suocy/bin/llvm-dev/bin/opt+0x2820bbd)
#​15 0x0000000001b452b3 llvm::LPPassManager::runOnFunction(llvm::Function&) (/home/suocy/bin/llvm-dev/bin/opt+0x1b452b3)
#​16 0x00000000022cdb58 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/suocy/bin/llvm-dev/bin/opt+0x22cdb58)
#​17 0x00000000022ce5f9 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/suocy/bin/llvm-dev/bin/opt+0x22ce5f9)
#​18 0x00000000022cd403 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/suocy/bin/llvm-dev/bin/opt+0x22cd403)
#​19 0x000000000071abdb main (/home/suocy/bin/llvm-dev/bin/opt+0x71abdb)
#​20 0x00007faffaef0555 __libc_start_main (/lib64/libc.so.6+0x22555)
#​21 0x00000000007cd705 _start (/home/suocy/bin/llvm-dev/bin/opt+0x7cd705)
Aborted

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacrashPrefer [crash-on-valid] or [crash-on-invalid]loopoptim

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions