[llvm-dev] llvm.trap() from -O1 optimization
Ashay Rane via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 13 21:31:58 PST 2016
Hello,
This is likely to be some small issue, but I am unable to figure out
the solution. The following code, when run through `opt' with the -O1
flag, replaces the call to foo() with a call to llvm.trap() followed
by an `unreachable' instruction.
=====================
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "armv7-unknown-linux-gnu"
define arm_aapcs_vfpcc void @foo() {
entry:
ret void
}
define arm_aapcs_vfpcc void @bar() {
entry:
call void @foo()
ret void
}
=====================
If I drop the "arm_aapcs_vfpcc" for foo(), then the `unreachable'
instruction and the call to trap() are no longer introduced in the
code.
I am running `opt' on a 64-bit x86 machine. I have synced llvm, clang,
and compiler-rt to the latest commits, but that did not help.
$ clang --version
clang version 4.0.0 (https://github.com/llvm-mirror/clang.git
631f1e728a6903f320a40e7b5035a63acd0acdc7)
(https://github.com/llvm-mirror/llvm.git
23156f19246677a896ffbda72eadbcbbc1c47964)
Any ideas on how to prevent the unreachable instruction? Thanks!
Ashay
More information about the llvm-dev
mailing list