llvm.org GIT mirror llvm / f425efd
PartiallyInlineLibCalls: Check sqrt result type before transforming it. Some configure scripts declare this with the wrong prototype, which can lead to an assertion failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214593 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 5 years ago
2 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
107107 if (Call->onlyReadsMemory())
108108 return false;
109109
110 // The call must have the expected result type.
111 if (!Call->getType()->isFloatingPointTy())
112 return false;
113
110114 // Do the following transformation:
111115 //
112116 // (before)
0 ; RUN: opt -S -partially-inline-libcalls < %s | FileCheck %s
1
2 target triple = "x86_64-unknown-linux-gnu"
3
4 declare i32 @sqrt()
5
6 ; CHECK-LABEL: @foo
7 define i32 @foo() {
8 ; CHECK: call{{.*}}@sqrt
9 ; CHECK-NOT: call{{.*}}@sqrt
10 %r = call i32 @sqrt()
11 ret i32 %r
12 }