forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AsmParser] Support calling intrinsics without mangling suffix (llvm#…
…89172) This adds proper support for calling intrinsics without mangling suffix when parsing textual IR. This already worked (mostly by accident) when only a single mangling suffix was in use. This patch extends support to the case where the intrinsic is used with multiple signatures, and as such multiple different intrinsic declarations have to be inserted. The final IR will have intrinsics with mangling suffix as usual. Motivated by the discussion at: https://discourse.llvm.org/t/recent-improvements-to-the-ir-parser/77366
- Loading branch information
Showing
7 changed files
with
107 additions
and
55 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
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
9 changes: 4 additions & 5 deletions
9
llvm/test/Assembler/implicit-intrinsic-declaration-invalid.ll
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
; RUN: not llvm-as < %s 2>&1 | FileCheck %s | ||
|
||
; Check that intrinsics do not get automatically declared if they are used | ||
; with different function types. | ||
; Use of intrinsic without mangling suffix and invalid signature should | ||
; be rejected. | ||
|
||
; CHECK: error: use of undefined value '@llvm.umax' | ||
; CHECK: error: invalid intrinsic signature | ||
define void @test() { | ||
call i8 @llvm.umax(i8 0, i8 1) | ||
call i16 @llvm.umax(i16 0, i16 1) | ||
call i8 @llvm.umax(i8 0, i16 1) | ||
ret void | ||
} |
11 changes: 11 additions & 0 deletions
11
llvm/test/Assembler/implicit-intrinsic-declaration-invalid2.ll
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,11 @@ | ||
; RUN: not llvm-as < %s 2>&1 | FileCheck %s | ||
|
||
; Use of intrinsic as non-callee should be rejected. | ||
|
||
; CHECK: error: intrinsic can only be used as callee | ||
define void @test() { | ||
call void @foo(ptr @llvm.umax) | ||
ret void | ||
} | ||
|
||
declare void @foo(ptr) |
9 changes: 9 additions & 0 deletions
9
llvm/test/Assembler/implicit-intrinsic-declaration-invalid3.ll
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,9 @@ | ||
; RUN: not llvm-as < %s 2>&1 | FileCheck %s | ||
|
||
; Use of unknown intrinsic without declaration should be rejected. | ||
|
||
; CHECK: error: use of undefined value '@llvm.foobar' | ||
define void @test() { | ||
call i8 @llvm.foobar(i8 0, i16 1) | ||
ret void | ||
} |
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