Re: [klee-dev] Phi nodes and LLVM11

2021-06-30 Thread Nowack, Martin
Hi Alastair,

On 28. Jun 2021, at 15:02, Alastair Reid 
mailto:adr...@google.com>> wrote:

Hi,


Instruction does not dominate all uses!
  %.i0385 = phi i64 [ ,  ], [ %.i0664, %2236 ], [ %.i0381, 
%2227 ], !dbg !30427
  %.upto04194 = insertelement <4 x i64> undef, i64 %.i0385, i32 0

This looks like that the basic block containing the value has been removed 
without updating the phi node.

It is with `—optimize`, I guess?

It’s fine if you just open an issue with the bc file attached and the KLEE 
parameters you used.

In case you want to debug this, add a `createVerifierPass()` 
(https://github.com/klee/klee/blob/292600cf54d5fd73278f67a4f98c2f955cbdaa10/lib/Module/KModule.cpp#L371)
 as part of different pass manager invocations to narrow down the optimisation 
pass that lead to this.

I hope that helps.

Best,
Martin


terminating in the following message and stack dump.

PHI nodes not grouped at top of basic block!
  %.i0345 = phi i64 [ ,  ], [ %.i0679, %2236 ], [ %.i0341, 
%2227 ]
label %2370
in function _ZN4test9run_tests17h3c40b1ee8455d4dbE
LLVM ERROR: Broken function found, compilation aborted!
 #0 0x7efc61604f8f llvm::sys::PrintStackTrace(llvm::raw_ostream&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xbd0f8f)
 #1 0x7efc616032c2 llvm::sys::RunSignalHandlers() 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xbcf2c2)
 #2 0x7efc61605465 (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xbd1465)
 #3 0x7efc60597d60 (/lib/x86_64-linux-gnu/libc.so.6+0x3bd60)
 #4 0x7efc60597ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x7efc60581537 abort ./stdlib/abort.c:81:7
 #6 0x7efc61554d68 (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xb20d68)
 #7 0x7efc61554b88 (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xb20b88)
 #8 0x7efc61781b8f (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xd4db8f)
 #9 0x7efc61714059 llvm::FPPassManager::runOnFunction(llvm::Function&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xce0059)
#10 0x7efc61719603 llvm::FPPassManager::runOnModule(llvm::Module&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xce5603)
#11 0x7efc61714670 llvm::legacy::PassManagerImpl::run(llvm::Module&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xce0670)
#12 0x56428d2b590b klee::KModule::checkModule() 
/usr/local/google/home/adreid/rust/klee/lib/Module/KModule.cpp:378:3
#13 0x56428d260f50 std::__uniq_ptr_impl >::_M_ptr() const 
/usr/include/c++/10/bits/unique_ptr.h:173:58
#14 0x56428d260f50 std::unique_ptr >::get() const 
/usr/include/c++/10/bits/unique_ptr.h:422:27
#15 0x56428d260f50 std::unique_ptr >::operator->() const 
/usr/include/c++/10/bits/unique_ptr.h:416:12
#16 0x56428d260f50 
klee::Executor::setModule(std::vector >, 
std::allocator 
> > >&, klee::Interpreter::ModuleOptions const&) 
/usr/local/google/home/adreid/rust/klee/lib/Core/Executor.cpp:567:20
#17 0x56428d23fbe0 main 
/usr/local/google/home/adreid/rust/klee/tools/klee/main.cpp:1415:46
#18 0x7efc60582d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#19 0x56428d24f56a _start (bin/klee+0x3a56a)
Aborted


___
klee-dev mailing list
klee-dev@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev

___
klee-dev mailing list
klee-dev@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev


Re: [klee-dev] Phi nodes and LLVM11

2021-06-30 Thread Frank Busse
Hi,


On Wed, 30 Jun 2021 11:19:35 +0100
Cristian Cadar  wrote:

> I think your suspicions are reasonable, but perhaps the first thing 
> would be to report a small code example that triggers this issue.
> Have you tried C-Reduce?

Do you mean llvm-reduce? I don't think C-Reduce works on Rust code.


@Alastair

> What I am seeing is a large number of error reports like this:
> 
> Instruction does not dominate all uses!
>    %.i0385 = phi i64 [ ,  ], [ %.i0664, 
> [...]
> PHI nodes not grouped at top of basic block!

I'd start looking at that LLVM IR. Seems like there is a PHI node after
some other instruction in the basic block or the value/label arguments
are invalid.


Kind regards,

Frank

___
klee-dev mailing list
klee-dev@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev


Re: [klee-dev] Phi nodes and LLVM11

2021-06-30 Thread Cristian Cadar

Hi Alastair,

I think your suspicions are reasonable, but perhaps the first thing 
would be to report a small code example that triggers this issue.  Have 
you tried C-Reduce?


Best,
Cristian

On 28/06/2021 15:02, Alastair Reid wrote:

Hi,

I am seeing KLEE crash on a large example generated by the Rust compiler 
with LLVM11 and wonder if you could help suggest some ways to narrow 
down what is going wrong so that I can submit a usable bug report.


Given the repeated mention of phi nodes in the error output (below), I 
wonder if I should be looking in the PhiCleaner pass?
Or, given the mention of insertelement, I wonder if I should be looking 
at the Scalarizer pass (because I know that rustc and LLVM11 are 
aggressively using LLVM11's generic vector intrinsics.

Any thoughts?



What I am seeing is a large number of error reports like this:

Instruction does not dominate all uses!
   %.i0385 = phi i64 [ ,  ], [ %.i0664, %2236 ], [ 
%.i0381, %2227 ], !dbg !30427

   %.upto04194 = insertelement <4 x i64> undef, i64 %.i0385, i32 0

terminating in the following message and stack dump.

PHI nodes not grouped at top of basic block!
   %.i0345 = phi i64 [ ,  ], [ %.i0679, %2236 ], [ 
%.i0341, %2227 ]

label %2370
in function _ZN4test9run_tests17h3c40b1ee8455d4dbE
LLVM ERROR: Broken function found, compilation aborted!
  #0 0x7efc61604f8f llvm::sys::PrintStackTrace(llvm::raw_ostream&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xbd0f8f)
  #1 0x7efc616032c2 llvm::sys::RunSignalHandlers() 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xbcf2c2)

  #2 0x7efc61605465 (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xbd1465)
  #3 0x7efc60597d60 (/lib/x86_64-linux-gnu/libc.so.6+0x3bd60)
  #4 0x7efc60597ce1 raise 
./signal/../sysdeps/unix/sysv/linux/raise.c:51:1

  #5 0x7efc60581537 abort ./stdlib/abort.c:81:7
  #6 0x7efc61554d68 (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xb20d68)
  #7 0x7efc61554b88 (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xb20b88)
  #8 0x7efc61781b8f (/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xd4db8f)
  #9 0x7efc61714059 
llvm::FPPassManager::runOnFunction(llvm::Function&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xce0059)
#10 0x7efc61719603 llvm::FPPassManager::runOnModule(llvm::Module&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xce5603)
#11 0x7efc61714670 llvm::legacy::PassManagerImpl::run(llvm::Module&) 
(/usr/lib/llvm-11/lib/libLLVM-11.so.1+0xce0670)
#12 0x56428d2b590b klee::KModule::checkModule() 
/usr/local/google/home/adreid/rust/klee/lib/Module/KModule.cpp:378:3
#13 0x56428d260f50 std::__uniq_ptr_implstd::default_delete >::_M_ptr() const 
/usr/include/c++/10/bits/unique_ptr.h:173:58
#14 0x56428d260f50 std::unique_ptrstd::default_delete >::get() const 
/usr/include/c++/10/bits/unique_ptr.h:422:27
#15 0x56428d260f50 std::unique_ptrstd::default_delete >::operator->() const 
/usr/include/c++/10/bits/unique_ptr.h:416:12
#16 0x56428d260f50 
klee::Executor::setModule(std::vectorstd::default_delete >, 
std::allocatorstd::default_delete > > >&, 
klee::Interpreter::ModuleOptions const&) 
/usr/local/google/home/adreid/rust/klee/lib/Core/Executor.cpp:567:20
#17 0x56428d23fbe0 main 
/usr/local/google/home/adreid/rust/klee/tools/klee/main.cpp:1415:46

#18 0x7efc60582d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#19 0x56428d24f56a _start (bin/klee+0x3a56a)
Aborted



___
klee-dev mailing list
klee-dev@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev



___
klee-dev mailing list
klee-dev@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev