1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/test/Verifier/frameescape.ll
Matt Arsenault 01d726ce5c IR: Add immarg attribute
This indicates an intrinsic parameter is required to be a constant,
and should not be replaced with a non-constant value.

Add the attribute to all AMDGPU and generic intrinsics that comments
indicate it should apply to. I scanned other target intrinsics, but I
don't see any obvious comments indicating which arguments are intended
to be only immediates.

This breaks one questionable testcase for the autoupgrade. I'm unclear
on whether the autoupgrade is supposed to really handle declarations
which were never valid. The verifier fails because the attributes now
refer to a parameter past the end of the argument list.

llvm-svn: 355981
2019-03-12 21:02:54 +00:00

73 lines
2.0 KiB
LLVM

; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
declare void @llvm.localescape(...)
declare i8* @llvm.localrecover(i8*, i8*, i32)
define internal void @f() {
%a = alloca i8
call void (...) @llvm.localescape(i8* %a)
call void (...) @llvm.localescape(i8* %a)
ret void
}
; CHECK: multiple calls to llvm.localescape in one function
define internal void @g() {
entry:
%a = alloca i8
br label %not_entry
not_entry:
call void (...) @llvm.localescape(i8* %a)
ret void
}
; CHECK: llvm.localescape used outside of entry block
define internal void @h() {
call i8* @llvm.localrecover(i8* null, i8* null, i32 0)
ret void
}
; CHECK: llvm.localrecover first argument must be function defined in this module
@global = constant i8 0
declare void @declaration()
define internal void @i() {
call i8* @llvm.localrecover(i8* @global, i8* null, i32 0)
ret void
}
; CHECK: llvm.localrecover first argument must be function defined in this module
define internal void @j() {
call i8* @llvm.localrecover(i8* bitcast(void()* @declaration to i8*), i8* null, i32 0)
ret void
}
; CHECK: llvm.localrecover first argument must be function defined in this module
define internal void @k(i32 %n) {
call i8* @llvm.localrecover(i8* bitcast(void()* @f to i8*), i8* null, i32 %n)
ret void
}
; CHECK: immarg operand has non-immediate parameter
; CHECK-NEXT: i32 %n
; CHECK-NEXT: %1 = call i8* @llvm.localrecover(i8* bitcast (void ()* @f to i8*), i8* null, i32 %n)
define internal void @l(i8* %b) {
%a = alloca i8
call void (...) @llvm.localescape(i8* %a, i8* %b)
ret void
}
; CHECK: llvm.localescape only accepts static allocas
define internal void @m() {
%a = alloca i8
call void (...) @llvm.localescape(i8* %a)
ret void
}
define internal void @n(i8* %fp) {
call i8* @llvm.localrecover(i8* bitcast(void ()* @m to i8*), i8* %fp, i32 1)
ret void
}
; CHECK: all indices passed to llvm.localrecover must be less than the number of arguments passed to llvm.localescape in the parent function