Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instruction does not dominate all uses! #842

Open
regehr opened this issue Jun 6, 2021 · 0 comments
Open

Instruction does not dominate all uses! #842

regehr opened this issue Jun 6, 2021 · 0 comments

Comments

@regehr
Copy link
Collaborator

regehr commented Jun 6, 2021

this input triggers a souper bug:

; ModuleID = 'foo.ll'
source_filename = "small.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@a = external dso_local local_unnamed_addr global i32, align 4

define dso_local i32 @d() local_unnamed_addr {
cont.lr.ph.lr.ph:
  %0 = load i32, i32* @a, align 4, !tbaa !0
  %1 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %0, i32 %0)
  %2 = extractvalue { i32, i1 } %1, 0
  %3 = extractvalue { i32, i1 } %1, 1
  %4 = xor i1 %3, true
  br label %cont.lr.ph

cont.lr.ph:                                       ; preds = %cont.lr.ph.lr.ph
  br label %while.body.lr.ph

while.body.lr.ph:                                 ; preds = %cont.lr.ph
  br label %while.body

trap.loopexit:                                    ; preds = %if.end, %while.body
  ret i32 undef

cont:                                             ; preds = %if.end
  %5 = phi i32 [ %2, %if.end ]
  %e.17 = phi i32 [ undef, %if.end ]
  %tobool = icmp ne i32 %5, 0
  br i1 %tobool, label %while.body, label %cont.while.end_crit_edge, !llvm.loop !4

while.body:                                       ; preds = %cont, %while.body.lr.ph
  %e.1716 = phi i32 [ undef, %while.body.lr.ph ], [ %e.17, %cont ]
  %6 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %e.1716, i32 1), !nosanitize !6
  %7 = extractvalue { i32, i1 } %6, 1, !nosanitize !6
  %8 = xor i1 %7, true, !nosanitize !6
  br i1 %8, label %cont1, label %trap.loopexit, !nosanitize !6

cont1:                                            ; preds = %while.body
  br label %if.end

if.end:                                           ; preds = %cont1
  br i1 %4, label %cont, label %trap.loopexit, !llvm.loop !4, !nosanitize !6

cont.while.end_crit_edge:                         ; preds = %cont
  ret i32 undef
}

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) #0

attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }

!0 = !{!1, !1, i64 0}
!1 = !{!"int", !2, i64 0}
!2 = !{!"omnipotent char", !3, i64 0}
!3 = !{!"Simple C/C++ TBAA"}
!4 = distinct !{!4, !5}
!5 = !{!"llvm.loop.mustprogress"}
!6 = !{}
regehr@home:~$ /home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt -load /home/regehr/souper-regehr/build/libsouperPass.so -souper-enumerative-synthesis-max-instructions=1 -S -o - -souper foo.ll
Instruction does not dominate all uses!
  %4 = add i32 %0, %0
  %tobool = icmp ne i32 %4, 0
in function d
LLVM ERROR: Broken function found, compilation aborted!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt -load /home/regehr/souper-regehr/build/libsouperPass.so -souper-enumerative-synthesis-max-instructions=1 -S -o - -souper foo.ll
1.	Running pass 'Function Pass Manager' on module 'foo.ll'.
2.	Running pass 'Module Verifier' on function '@d'
 #0 0x0000000002801963 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x2801963)
 #1 0x00000000027ff69e llvm::sys::RunSignalHandlers() (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x27ff69e)
 #2 0x0000000002801e2a SignalHandler(int) (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x2801e2a)
 #3 0x00007fdb878a71f0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x141f0)
 #4 0x00007fdb87306fbb raise ./signal/../sysdeps/unix/sysv/linux/raise.c:50:1
 #5 0x00007fdb872ec864 abort ./stdlib/abort.c:81:7
 #6 0x0000000002784ee9 (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x2784ee9)
 #7 0x0000000002784d06 (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x2784d06)
 #8 0x00000000020b7d2f (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x20b7d2f)
 #9 0x000000000202f938 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x202f938)
#10 0x00000000020361b1 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x20361b1)
#11 0x000000000202ffec llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x202ffec)
#12 0x000000000073659a main (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x73659a)
#13 0x00007fdb872ee565 __libc_start_main ./csu/../csu/libc-start.c:332:16
#14 0x000000000071fd7e _start (/home/regehr/souper-regehr/third_party/llvm-Release-install/bin/opt+0x71fd7e)
Aborted (core dumped)
regehr@home:~$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant