[llvm-bugs] [Bug 42612] New: loop-instsimplify crashes: Assertion `I->getParent()->getParent() == Q.CxtI->getParent()->getParent() && "Got assumption for the wrong function!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 12 23:05:31 PDT 2019


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

            Bug ID: 42612
           Summary: loop-instsimplify crashes: Assertion
                    `I->getParent()->getParent() ==
                    Q.CxtI->getParent()->getParent() && "Got assumption
                    for the wrong function!"' 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 22240
  --> https://bugs.llvm.org/attachment.cgi?id=22240&action=edit
.bc file of the source code

$clang -v
clang version 9.0.0 (trunk 363125)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build1/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-simplify -gvn -lowerswitch -simplifycfg -instcombine -hotcoldsplit
-loop-instsimplify small.bc -o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/lib/Analysis/ValueTracking.cpp:590:
void computeKnownBitsFromAssume(const llvm::Value*, llvm::KnownBits&, unsigned
int, const {anonymous}::Query&): Assertion `I->getParent()->getParent() ==
Q.CxtI->getParent()->getParent() && "Got assumption for the wrong function!"'
failed.
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt -loop-simplify
-gvn -lowerswitch -simplifycfg -instcombine -hotcoldsplit -loop-instsimplify
small.bc -o small-opt.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Loop Pass Manager' on function '@m'
3.      Running pass 'Simplify instructions in loops' on basic block
'%for.cond13'
 #0 0x000055d7393ef0ca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x25ce0ca)
 #1 0x000055d7393ecd84 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x25cbd84)
 #2 0x000055d7393ecec2 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x25cbec2)
 #3 0x00007f71787f1890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f71774a3e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f71774a5801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f717749539a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f7177495412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x000055d73886945e computeKnownBitsFromAssume(llvm::Value const*,
llvm::KnownBits&, unsigned int, (anonymous namespace)::Query const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x1a4845e)
 #9 0x000055d738869a98 computeKnownBits(llvm::Value const*, llvm::KnownBits&,
unsigned int, (anonymous namespace)::Query const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x1a48a98)
#10 0x000055d738871732 llvm::computeKnownBits(llvm::Value const*,
llvm::DataLayout const&, unsigned int, llvm::AssumptionCache*,
llvm::Instruction const*, llvm::DominatorTree const*,
llvm::OptimizationRemarkEmitter*, bool)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x1a50732)
#11 0x000055d7386fc809 llvm::SimplifyInstruction(llvm::Instruction*,
llvm::SimplifyQuery const&, llvm::OptimizationRemarkEmitter*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x18db809)
#12 0x000055d7391e7d78 simplifyLoopInst(llvm::Loop&, llvm::DominatorTree&,
llvm::LoopInfo&, llvm::AssumptionCache&, llvm::TargetLibraryInfo const&,
llvm::MemorySSAUpdater*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x23c6d78)
#13 0x000055d7391e9f3b (anonymous
namespace)::LoopInstSimplifyLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (.part.112)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x23c8f3b)
#14 0x000055d73874c17b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x192b17b)
#15 0x000055d738d9a939 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x1f79939)
#16 0x000055d738d9aa31 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x1f79a31)
#17 0x000055d738d99b91 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x1f78b91)
#18 0x000055d73764a694 main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x829694)
#19 0x00007f7177486b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x000055d7376d042a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm2/build2/bin/opt+0x8af42a)
Aborted (core dumped)

-------------------------------------------------
long(a);
int b, c, d, e, f, g;
short h;
unsigned *i;
char *j;
void(k)();
int(l)();
void m() {
  unsigned **n = &i;
  int o, p = l(), q;
  *j = g;
  k();
  int *r[] = {&q, &b, &d, &d, &e, &d, &d, &d, &e, &p, &o, &c, &d};
  if (n == 0)
    for (;;) {
      int s;
      for (;; h++) {
        int t;
        if (f)
          break;
      }
      *n = &s;
      if (a)
        break;
    }
}

-- 
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/20190713/454a999e/attachment.html>


More information about the llvm-bugs mailing list