-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InlineCost] Check that function types match
Retain the behavior we get without opaque pointers: A call to a known function with different function type is considered an indirect call. This fixes the crash reported in https://reviews.llvm.org/D123300#3444772.
- Loading branch information
Showing
2 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -S -inline < %s | FileCheck %s | ||
|
||
define void @test(ptr %p1, ptr %p2) { | ||
; CHECK-LABEL: @test( | ||
; CHECK-NEXT: ret void | ||
; | ||
ret void | ||
} | ||
|
||
define void @test1() { | ||
; CHECK-LABEL: @test1( | ||
; CHECK-NEXT: [[CALL_I:%.*]] = call i32 @test(ptr null) | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @test2(ptr @test) | ||
ret void | ||
} | ||
|
||
define void @test2(ptr %i) { | ||
; CHECK-LABEL: @test2( | ||
; CHECK-NEXT: [[CALL:%.*]] = call i32 [[I:%.*]](ptr null) | ||
; CHECK-NEXT: ret void | ||
; | ||
%call = call i32 %i(ptr null) | ||
ret void | ||
} |