[llvm-bugs] [Bug 48306] New: consthoist pass crashes: Assertion `UsesNum == (ReBasesNum + NotRebasedNum) && "Not all uses are rebased"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 25 22:48:45 PST 2020


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

            Bug ID: 48306
           Summary: consthoist pass crashes: Assertion `UsesNum ==
                    (ReBasesNum + NotRebasedNum) && "Not all uses are
                    rebased"' 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 24214
  --> https://bugs.llvm.org/attachment.cgi?id=24214&action=edit
small.bc

$clang -v
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
f6970503d291b7cae70fe583bed392387f93f9e4)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/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.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.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 -mem2reg -consthoist -licm -jump-threading -consthoist
small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:915:
bool llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable*):
Assertion `UsesNum == (ReBasesNum + NotRebasedNum) && "Not all uses are
rebased"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt
-loop-rotate -mem2reg -consthoist -licm -jump-threading -consthoist small.bc -o
small-opt.bc
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Constant Hoisting' on function '@e'
 #0 0x000055cbb6c674ac llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2caa4ac)
 #1 0x000055cbb6c65064 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2ca8064)
 #2 0x000055cbb6c651d3 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2ca81d3)
 #3 0x00007fe02a64d8a0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x00007fe0292fff47 raise
/build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007fe0293018b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007fe0292f142a __assert_fail_base
/build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
 #7 0x00007fe0292f14a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
 #8 0x000055cbb692c926
llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x296f926)
 #9 0x000055cbb692d58a llvm::ConstantHoistingPass::runImpl(llvm::Function&,
llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*,
llvm::BasicBlock&, llvm::ProfileSummaryInfo*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x297058a)
#10 0x000055cbb692d798 (anonymous
namespace)::ConstantHoistingLegacyPass::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x2970798)
#11 0x000055cbb646f4f8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x24b24f8)
#12 0x000055cbb646fff9 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x24b2ff9)
#13 0x000055cbb646ed76 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x24b1d76)
#14 0x000055cbb485db34 main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x8a0b34)
#15 0x00007fe0292e2b97 __libc_start_main
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
#16 0x000055cbb491012a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm-project/build/bin/opt+0x95312a)
Aborted (core dumped)

$cat small.c
char a=0, b=0, c=0;
int d=0;
int e() {
  long f = 8166192007;
g:
  for (; 0;)
    for (;;)
      ;
  for (; c;) {
    if (b) {
      char h = 10;
      if (h)
        break;
      f < 0;
      for (; a;)
        for (; d;)
          ;
    } else
      return 0;
    for (; 0;)
      goto g;
  }
  0 & f;
}

-- 
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/20201126/3120201c/attachment-0001.html>


More information about the llvm-bugs mailing list