[llvm-bugs] [Bug 43176] New: licm crashes: Assertion `L->isLCSSAForm(*DT) && "Loop is not in LCSSA form."' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 30 03:06:34 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43176

            Bug ID: 43176
           Summary: licm crashes: Assertion `L->isLCSSAForm(*DT) && "Loop
                    is not in LCSSA form."' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22452
  --> https://bugs.llvm.org/attachment.cgi?id=22452&action=edit
.bc file of the source code

$clang -v
clang version 10.0.0 (trunk 370163)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$clang -O3 -c -emit-llvm -femit-all-decls -mllvm -disable-llvm-optzns small.c

$opt -loop-rotate -break-crit-edges -mem2reg -loop-reduce -loop-rotate -ipsccp
-licm -loop-interchange -licm small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Transforms/Scalar/LICM.cpp:331:
bool {anonymous}::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*,
llvm::AliasAnalysis*, llvm::LoopInfo*, llvm::DominatorTree*,
llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*, llvm::ScalarEvolution*,
llvm::MemorySSA*, llvm::OptimizationRemarkEmitter*, bool): Assertion
`L->isLCSSAForm(*DT) && "Loop is not in LCSSA form."' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt -loop-rotate
-break-crit-edges -mem2reg -loop-reduce -loop-rotate -ipsccp -licm
-loop-interchange -licm small.bc -o small-opt.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Loop Pass Manager' on function '@d'
3.      Running pass 'Loop Invariant Code Motion' on basic block '%for.body'
 #0 0x0000564f5ddf07fa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x27277fa)
 #1 0x0000564f5ddee4d4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x27254d4)
 #2 0x0000564f5ddee612 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2725612)
 #3 0x00007f4344101890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f4342db3e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f4342db5801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f4342da539a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f4342da5412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000564f5dbb988f (anonymous
namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo*,
llvm::TargetTransformInfo*, llvm::ScalarEvolution*, llvm::MemorySSA*,
llvm::OptimizationRemarkEmitter*, bool)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x24f088f)
 #9 0x0000564f5dbb9c3a (anonymous
namespace)::LegacyLICMPass::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x24f0c3a)
#10 0x0000564f5d0f0ceb llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x1a27ceb)
#11 0x0000564f5d74d909 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2084909)
#12 0x0000564f5d74da01 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2084a01)
#13 0x0000564f5d74cb61 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2083b61)
#14 0x0000564f5bf4a32f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x88132f)
#15 0x00007f4342d96b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#16 0x0000564f5bfc0b7a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x8f7b7a)
Aborted (core dumped)

By using bugpoint, the optimization sequences can be further reduced.

$opt bugpoint-reduced-simplified.bc -loop-interchange -licm
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Transforms/Scalar/LICM.cpp:331:
bool {anonymous}::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*,
llvm::AliasAnalysis*, llvm::LoopInfo*, llvm::DominatorTree*,
llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*, llvm::ScalarEvolution*,
llvm::MemorySSA*, llvm::OptimizationRemarkEmitter*, bool): Assertion
`L->isLCSSAForm(*DT) && "Loop is not in LCSSA form."' failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt
bugpoint-reduced-simplified.bc -loop-interchange -licm 
1.      Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.bc'.
2.      Running pass 'Loop Pass Manager' on function '@d'
3.      Running pass 'Loop Invariant Code Motion' on basic block '%for.body'
 #0 0x000055b1839db7fa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x27277fa)
 #1 0x000055b1839d94d4 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x27254d4)
 #2 0x000055b1839d9612 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2725612)
 #3 0x00007f905c353890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f905b005e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f905b007801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f905aff739a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f905aff7412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x000055b1837a488f (anonymous
namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo*,
llvm::TargetTransformInfo*, llvm::ScalarEvolution*, llvm::MemorySSA*,
llvm::OptimizationRemarkEmitter*, bool)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x24f088f)
 #9 0x000055b1837a4c3a (anonymous
namespace)::LegacyLICMPass::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x24f0c3a)
#10 0x000055b182cdbceb llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x1a27ceb)
#11 0x000055b183338909 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2084909)
#12 0x000055b183338a01 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2084a01)
#13 0x000055b183337b61 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x2083b61)
#14 0x000055b181b3532f main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x88132f)
#15 0x00007f905afe8b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#16 0x000055b181babb7a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build6/bin/opt+0x8f7b7a)
Aborted (core dumped)


-------------------------------------------------------------
int a, c;
int b[5];
void d() {
  for (; a; a++) {
    int e = 0;
    for (; e < 4; e++)
      ;
    b[a] &= c;
  }
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190830/79bbd6b8/attachment.html>


More information about the llvm-bugs mailing list