mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
[TLI] isdigit / isascii / toascii param type should match return type (PR30484)
We crash in LibCallSimplifier if we don't check the validity of the function signature properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282278 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f8e3a5168e
commit
c5ddf50801
@ -957,11 +957,14 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy,
|
||||
case LibFunc::ffs:
|
||||
case LibFunc::ffsl:
|
||||
case LibFunc::ffsll:
|
||||
return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) &&
|
||||
FTy.getParamType(0)->isIntegerTy());
|
||||
|
||||
case LibFunc::isdigit:
|
||||
case LibFunc::isascii:
|
||||
case LibFunc::toascii:
|
||||
return (NumParams == 1 && FTy.getReturnType()->isIntegerTy(32) &&
|
||||
FTy.getParamType(0)->isIntegerTy());
|
||||
FTy.getReturnType() == FTy.getParamType(0));
|
||||
|
||||
case LibFunc::fls:
|
||||
case LibFunc::flsl:
|
||||
|
@ -141,5 +141,40 @@ define void @test9(i8* %x) {
|
||||
ret void
|
||||
}
|
||||
|
||||
; PR30484 - https://llvm.org/bugs/show_bug.cgi?id=30484
|
||||
; These aren't the library functions you're looking for...
|
||||
|
||||
declare i32 @isdigit(i8)
|
||||
declare i32 @isascii(i8)
|
||||
declare i32 @toascii(i8)
|
||||
|
||||
define i32 @fake_isdigit(i8 %x) {
|
||||
; CHECK-LABEL: @fake_isdigit(
|
||||
; CHECK-NEXT: [[Y:%.*]] = call i32 @isdigit(i8 %x)
|
||||
; CHECK-NEXT: ret i32 [[Y]]
|
||||
;
|
||||
%y = call i32 @isdigit(i8 %x)
|
||||
ret i32 %y
|
||||
}
|
||||
|
||||
define i32 @fake_isascii(i8 %x) {
|
||||
; CHECK-LABEL: @fake_isascii(
|
||||
; CHECK-NEXT: [[Y:%.*]] = call i32 @isascii(i8 %x)
|
||||
; CHECK-NEXT: ret i32 [[Y]]
|
||||
;
|
||||
%y = call i32 @isascii(i8 %x)
|
||||
ret i32 %y
|
||||
}
|
||||
|
||||
define i32 @fake_toascii(i8 %x) {
|
||||
; CHECK-LABEL: @fake_toascii(
|
||||
; CHECK-NEXT: [[Y:%.*]] = call i32 @toascii(i8 %x)
|
||||
; CHECK-NEXT: ret i32 [[Y]]
|
||||
;
|
||||
%y = call i32 @toascii(i8 %x)
|
||||
ret i32 %y
|
||||
}
|
||||
|
||||
|
||||
attributes #0 = { nobuiltin }
|
||||
attributes #1 = { builtin }
|
||||
|
Loading…
Reference in New Issue
Block a user