forked from OSchip/llvm-project
[PartiallyInlineLibCalls] Disable sqrt expansion for strictfp.
This pass emits a floating point compare and a conditional branch, but if strictfp is enabled we don't emit a constrained compare intrinsic. The backend also won't expand the readonly sqrt call this pass inserts to a sqrt instruction under strictfp. So we end up with 2 libcalls as seen here. https://godbolt.org/z/oax5zMEWd Fix these things by disabling the pass. Differential Revision: https://reviews.llvm.org/D104479
This commit is contained in:
parent
8441b993bd
commit
99e95856fb
|
@ -121,7 +121,7 @@ static bool runPartiallyInlineLibCalls(Function &F, TargetLibraryInfo *TLI,
|
|||
if (!Call || !(CalledFunc = Call->getCalledFunction()))
|
||||
continue;
|
||||
|
||||
if (Call->isNoBuiltin())
|
||||
if (Call->isNoBuiltin() || Call->isStrictFP())
|
||||
continue;
|
||||
|
||||
// Skip if function either has local linkage or is not a known library
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
; RUN: opt -S -partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||
; RUN: opt -S -passes=partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||
|
||||
define float @f(float %val) strictfp {
|
||||
; CHECK-LABEL: @f
|
||||
; CHECK: call{{.*}}@sqrtf
|
||||
; CHECK-NOT: call{{.*}}@sqrtf
|
||||
%res = tail call float @sqrtf(float %val) strictfp
|
||||
ret float %res
|
||||
}
|
||||
|
||||
declare float @sqrtf(float)
|
Loading…
Reference in New Issue