mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 22:30:33 +00:00
PartiallyInlineLibCalls: Check sqrt result type before transforming it.
Some configure scripts declare this with the wrong prototype, which can lead to an assertion failure. llvm-svn: 214593
This commit is contained in:
parent
3116b2db7f
commit
ca6ae41998
@ -108,6 +108,10 @@ bool PartiallyInlineLibCalls::optimizeSQRT(CallInst *Call,
|
||||
if (Call->onlyReadsMemory())
|
||||
return false;
|
||||
|
||||
// The call must have the expected result type.
|
||||
if (!Call->getType()->isFloatingPointTy())
|
||||
return false;
|
||||
|
||||
// Do the following transformation:
|
||||
//
|
||||
// (before)
|
||||
|
13
test/Transforms/PartiallyInlineLibCalls/bad-prototype.ll
Normal file
13
test/Transforms/PartiallyInlineLibCalls/bad-prototype.ll
Normal file
@ -0,0 +1,13 @@
|
||||
; RUN: opt -S -partially-inline-libcalls < %s | FileCheck %s
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
declare i32 @sqrt()
|
||||
|
||||
; CHECK-LABEL: @foo
|
||||
define i32 @foo() {
|
||||
; CHECK: call{{.*}}@sqrt
|
||||
; CHECK-NOT: call{{.*}}@sqrt
|
||||
%r = call i32 @sqrt()
|
||||
ret i32 %r
|
||||
}
|
Loading…
Reference in New Issue
Block a user