mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[ValueTracking] fix library to intrinsic mapping to respect 'nobuiltin' attribute
This is another problem raised in: http://bugs.llvm.org/PR46627
This commit is contained in:
parent
b78cee1e03
commit
7363126966
@ -3133,21 +3133,14 @@ Intrinsic::ID llvm::getIntrinsicForCallSite(const CallBase &CB,
|
||||
if (F->isIntrinsic())
|
||||
return F->getIntrinsicID();
|
||||
|
||||
if (!TLI)
|
||||
return Intrinsic::not_intrinsic;
|
||||
|
||||
// We are going to infer semantics of a library function based on mapping it
|
||||
// to an LLVM intrinsic. Check that the library function is available from
|
||||
// this callbase and in this environment.
|
||||
LibFunc Func;
|
||||
// We're going to make assumptions on the semantics of the functions, check
|
||||
// that the target knows that it's available in this environment and it does
|
||||
// not have local linkage.
|
||||
if (!F || F->hasLocalLinkage() || !TLI->getLibFunc(*F, Func))
|
||||
if (F->hasLocalLinkage() || !TLI || !TLI->getLibFunc(CB, Func) ||
|
||||
!CB.onlyReadsMemory())
|
||||
return Intrinsic::not_intrinsic;
|
||||
|
||||
if (!CB.onlyReadsMemory())
|
||||
return Intrinsic::not_intrinsic;
|
||||
|
||||
// Otherwise check if we have a call to a function that can be turned into a
|
||||
// vector intrinsic.
|
||||
switch (Func) {
|
||||
default:
|
||||
break;
|
||||
|
@ -1039,12 +1039,13 @@ define i32 @call_undef_musttail() {
|
||||
ret i32 %x
|
||||
}
|
||||
|
||||
; FIXME: This is not the builtin fmax, so we don't know anything about its behavior.
|
||||
; This is not the builtin fmax, so we don't know anything about its behavior.
|
||||
|
||||
define float @nobuiltin_fmax() {
|
||||
; CHECK-LABEL: @nobuiltin_fmax(
|
||||
; CHECK-NEXT: [[M:%.*]] = call float @fmaxf(float 0.000000e+00, float 1.000000e+00) #3
|
||||
; CHECK-NEXT: ret float [[M]]
|
||||
; CHECK-NEXT: [[R:%.*]] = call float @llvm.fabs.f32(float [[M]])
|
||||
; CHECK-NEXT: ret float [[R]]
|
||||
;
|
||||
%m = call float @fmaxf(float 0.0, float 1.0) #0
|
||||
%r = call float @llvm.fabs.f32(float %m)
|
||||
|
Loading…
Reference in New Issue
Block a user