2012-05-28 17:45:43 +02:00
|
|
|
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
|
2014-08-19 23:08:27 +02:00
|
|
|
; RUN: verify-uselistorder < %s
|
2012-05-28 17:45:43 +02:00
|
|
|
; PR12696
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f1(i8 zeroext %0)
|
|
|
|
; CHECK: define void @f1(i8 zeroext %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f2(i8 signext %0)
|
|
|
|
; CHECK: define void @f2(i8 signext %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f3() noreturn
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f3() #0
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f4(i8 inreg %0)
|
|
|
|
; CHECK: define void @f4(i8 inreg %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2020-11-20 20:07:11 +01:00
|
|
|
define void @f5(i8* sret(i8) %0)
|
2020-09-29 15:33:55 +02:00
|
|
|
; CHECK: define void @f5(i8* sret(i8) %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f6() nounwind
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f6() #1
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f7(i8* noalias %0)
|
|
|
|
; CHECK: define void @f7(i8* noalias %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2020-11-20 16:52:27 +01:00
|
|
|
define void @f8(i8* byval(i8) %0)
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define void @f8(i8* byval(i8) %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f9(i8* nest %0)
|
|
|
|
; CHECK: define void @f9(i8* nest %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f10() readnone
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f10() #2
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f11() readonly
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f11() #3
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f12() noinline
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f12() #4
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f13() alwaysinline
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f13() #5
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f14() optsize
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f14() #6
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f15() ssp
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f15() #7
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f16() sspreq
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f16() #8
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2020-09-08 17:10:36 +02:00
|
|
|
define void @f17(i8* align 4 %0)
|
|
|
|
; CHECK: define void @f17(i8* align 4 %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f18(i8* nocapture %0)
|
|
|
|
; CHECK: define void @f18(i8* nocapture %0)
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f19() noredzone
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f19() #9
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f20() noimplicitfloat
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f20() #10
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f21() naked
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f21() #11
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f22() inlinehint
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f22() #12
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f23() alignstack(4)
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f23() #13
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f24() returns_twice
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f24() #14
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f25() uwtable
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f25() #15
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f26() nonlazybind
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f26() #16
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2013-02-26 07:58:09 +01:00
|
|
|
define void @f27() sanitize_address
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f27() #17
|
2012-05-28 17:45:43 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
2013-02-26 07:58:09 +01:00
|
|
|
define void @f28() sanitize_thread
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f28() #18
|
2013-02-11 09:13:54 +01:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
2013-02-26 07:58:09 +01:00
|
|
|
define void @f29() sanitize_memory
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f29() #19
|
2013-02-11 09:13:54 +01:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
2013-02-12 10:14:20 +01:00
|
|
|
|
|
|
|
define void @f30() "cpu"="cortex-a8"
|
2013-02-20 08:21:42 +01:00
|
|
|
; CHECK: define void @f30() #20
|
2013-02-12 10:14:20 +01:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2013-07-18 00:13:44 +02:00
|
|
|
define i8 @f31(i8 returned %A)
|
|
|
|
; CHECK: define i8 @f31(i8 returned %A)
|
|
|
|
{
|
|
|
|
ret i8 %A;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f32() sspstrong
|
|
|
|
; CHECK: define void @f32() #21
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @f33() minsize
|
|
|
|
; CHECK: define void @f33() #22
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @nobuiltin()
|
|
|
|
|
|
|
|
define void @f34()
|
|
|
|
; CHECK: define void @f34()
|
|
|
|
{
|
[Attributor] Deduce "nosync" function attribute.
Introduce and deduce "nosync" function attribute to indicate that a function
does not synchronize with another thread in a way that other thread might free memory.
Reviewers: jdoerfert, jfb, nhaehnle, arsenm
Subscribers: wdng, hfinkel, nhaenhle, mehdi_amini, steven_wu,
dexonsmith, arsenm, uenoku, hiraditya, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D62766
llvm-svn: 365830
2019-07-11 23:37:40 +02:00
|
|
|
call void @nobuiltin() nobuiltin
|
2020-04-30 18:49:01 +02:00
|
|
|
; CHECK: call void @nobuiltin() #[[NOBUILTIN:[0-9]+]]
|
2013-08-23 13:53:55 +02:00
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2013-11-18 22:44:03 +01:00
|
|
|
define void @f35() optnone noinline
|
2013-08-23 13:53:55 +02:00
|
|
|
; CHECK: define void @f35() #23
|
|
|
|
{
|
2013-07-18 00:13:44 +02:00
|
|
|
ret void;
|
2013-12-19 03:14:12 +01:00
|
|
|
}
|
|
|
|
|
2021-03-29 14:42:23 +02:00
|
|
|
define void @f36(i8* inalloca(i8) %0) {
|
|
|
|
; CHECK: define void @f36(i8* inalloca(i8) %0) {
|
2013-12-19 03:14:12 +01:00
|
|
|
ret void
|
2014-05-20 03:23:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
define nonnull i8* @f37(i8* nonnull %a) {
|
|
|
|
; CHECK: define nonnull i8* @f37(i8* nonnull %a) {
|
|
|
|
ret i8* %a
|
2013-07-18 00:13:44 +02:00
|
|
|
}
|
|
|
|
|
2014-06-05 21:29:43 +02:00
|
|
|
define void @f38() unnamed_addr jumptable {
|
|
|
|
; CHECK: define void @f38() unnamed_addr #24
|
|
|
|
call void bitcast (void (i8*)* @f36 to void ()*)()
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
2014-07-18 17:51:28 +02:00
|
|
|
define dereferenceable(2) i8* @f39(i8* dereferenceable(1) %a) {
|
|
|
|
; CHECK: define dereferenceable(2) i8* @f39(i8* dereferenceable(1) %a) {
|
|
|
|
ret i8* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define dereferenceable(18446744073709551606) i8* @f40(i8* dereferenceable(18446744073709551615) %a) {
|
|
|
|
; CHECK: define dereferenceable(18446744073709551606) i8* @f40(i8* dereferenceable(18446744073709551615) %a) {
|
|
|
|
ret i8* %a
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
define void @f41(i8* align 32 %0, double* align 64 %1) {
|
|
|
|
; CHECK: define void @f41(i8* align 32 %0, double* align 64 %1) {
|
2014-07-22 18:58:55 +02:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-04-16 22:29:50 +02:00
|
|
|
; CHECK: define dereferenceable_or_null(8) i8* @f42(i8* dereferenceable_or_null(8) %foo)
|
|
|
|
define dereferenceable_or_null(8) i8* @f42(i8* dereferenceable_or_null(8) %foo) {
|
|
|
|
entry:
|
|
|
|
ret i8* %foo
|
|
|
|
}
|
|
|
|
|
2015-05-27 01:48:40 +02:00
|
|
|
; CHECK: define void @f43() #25
|
|
|
|
define void @f43() convergent {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-07-11 12:30:36 +02:00
|
|
|
define void @f44() argmemonly
|
|
|
|
; CHECK: define void @f44() #26
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define "string_attribute" void @f45(i32 "string_attribute" %0)
|
|
|
|
define "string_attribute" void @f45(i32 "string_attribute" %0) {
|
2015-08-03 16:31:49 +02:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value" %0)
|
|
|
|
define "string_attribute_with_value"="value" void @f46(i32 "string_attribute_with_value"="value" %0) {
|
2015-08-03 16:31:49 +02:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-11-06 11:32:53 +01:00
|
|
|
; CHECK: define void @f47() #27
|
|
|
|
define void @f47() norecurse {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-12-16 17:16:19 +01:00
|
|
|
; CHECK: define void @f48() #28
|
|
|
|
define void @f48() inaccessiblememonly {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: define void @f49() #29
|
|
|
|
define void @f49() inaccessiblemem_or_argmemonly {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define void @f50(i8* swiftself %0)
|
|
|
|
define void @f50(i8* swiftself %0)
|
2016-03-29 19:37:21 +02:00
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define i32 @f51(i8** swifterror %0)
|
|
|
|
define i32 @f51(i8** swifterror %0)
|
2016-04-01 23:41:15 +02:00
|
|
|
{
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define i32 @f52(i32 %0, i8** swifterror %1)
|
|
|
|
define i32 @f52(i32 %0, i8** swifterror %1)
|
2016-04-01 23:41:15 +02:00
|
|
|
{
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
%swift_error = type {i64, i8}
|
|
|
|
declare float @foo(%swift_error** swifterror %error_ptr_ref)
|
|
|
|
|
|
|
|
; CHECK: define float @f53
|
|
|
|
; CHECK: alloca swifterror
|
|
|
|
define float @f53(i8* %error_ref) {
|
|
|
|
entry:
|
|
|
|
%error_ptr_ref = alloca swifterror %swift_error*
|
|
|
|
store %swift_error* null, %swift_error** %error_ptr_ref
|
|
|
|
%call = call float @foo(%swift_error** swifterror %error_ptr_ref)
|
|
|
|
ret float 1.0
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define i8* @f54(i32 %0) #30
|
|
|
|
define i8* @f54(i32 %0) allocsize(0) {
|
2016-04-12 03:05:35 +02:00
|
|
|
ret i8* null
|
|
|
|
}
|
|
|
|
|
2019-08-03 16:28:34 +02:00
|
|
|
; CHECK: define i8* @f55(i32 %0, i32 %1) #31
|
|
|
|
define i8* @f55(i32 %0, i32 %1) allocsize(0, 1) {
|
2016-04-12 03:05:35 +02:00
|
|
|
ret i8* null
|
|
|
|
}
|
|
|
|
|
2016-07-04 10:01:29 +02:00
|
|
|
; CHECK: define void @f56() #32
|
|
|
|
define void @f56() writeonly
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-04-28 22:25:27 +02:00
|
|
|
; CHECK: define void @f57() #33
|
|
|
|
define void @f57() speculatable {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-12-09 01:21:41 +01:00
|
|
|
; CHECK: define void @f58() #34
|
|
|
|
define void @f58() sanitize_hwaddress
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2018-04-03 22:10:40 +02:00
|
|
|
; CHECK: define void @f59() #35
|
|
|
|
define void @f59() shadowcallstack
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2019-06-27 17:51:40 +02:00
|
|
|
; CHECK: define void @f60() #36
|
|
|
|
define void @f60() willreturn
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2019-07-08 17:57:56 +02:00
|
|
|
; CHECK: define void @f61() #37
|
|
|
|
define void @f61() nofree {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
[Attributor] Deduce "nosync" function attribute.
Introduce and deduce "nosync" function attribute to indicate that a function
does not synchronize with another thread in a way that other thread might free memory.
Reviewers: jdoerfert, jfb, nhaehnle, arsenm
Subscribers: wdng, hfinkel, nhaenhle, mehdi_amini, steven_wu,
dexonsmith, arsenm, uenoku, hiraditya, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D62766
llvm-svn: 365830
2019-07-11 23:37:40 +02:00
|
|
|
; CHECK: define void @f62() #38
|
|
|
|
define void @f62() nosync
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues
using armv8.5 Memory Tagging Extension.
It is similar in principle to HWASan, which is a software implementation
of the same idea, but there are enough differencies to warrant a new
sanitizer type IMHO. It is also expected to have very different
performance properties.
The new sanitizer does not have a runtime library (it may grow one
later, along with a "debugging" mode). Similar to SafeStack and
StackProtector, the instrumentation pass (in a follow up change) will be
inserted in all cases, but will only affect functions marked with the
new sanitize_memtag attribute.
Reviewers: pcc, hctim, vitalybuka, ostannard
Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64169
llvm-svn: 366123
2019-07-15 22:02:23 +02:00
|
|
|
; CHECK: define void @f63() #39
|
|
|
|
define void @f63() sanitize_memtag
|
|
|
|
{
|
2020-02-14 23:16:53 +01:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: define void @f64(i32* preallocated(i32) %a)
|
|
|
|
define void @f64(i32* preallocated(i32) %a)
|
|
|
|
{
|
|
|
|
ret void
|
ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues
using armv8.5 Memory Tagging Extension.
It is similar in principle to HWASan, which is a software implementation
of the same idea, but there are enough differencies to warrant a new
sanitizer type IMHO. It is also expected to have very different
performance properties.
The new sanitizer does not have a runtime library (it may grow one
later, along with a "debugging" mode). Similar to SafeStack and
StackProtector, the instrumentation pass (in a follow up change) will be
inserted in all cases, but will only affect functions marked with the
new sanitize_memtag attribute.
Reviewers: pcc, hctim, vitalybuka, ostannard
Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64169
llvm-svn: 366123
2019-07-15 22:02:23 +02:00
|
|
|
}
|
|
|
|
|
2020-04-25 12:57:07 +02:00
|
|
|
; CHECK: define void @f65() #40
|
|
|
|
define void @f65() null_pointer_is_valid
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2020-07-08 19:22:48 +02:00
|
|
|
; CHECK: define noundef i32 @f66(i32 noundef %a)
|
|
|
|
define noundef i32 @f66(i32 noundef %a)
|
|
|
|
{
|
|
|
|
ret i32 %a
|
|
|
|
}
|
|
|
|
|
IR: Define byref parameter attribute
This allows tracking the in-memory type of a pointer argument to a
function for ABI purposes. This is essentially a stripped down version
of byval to remove some of the stack-copy implications in its
definition.
This includes the base IR changes, and some tests for places where it
should be treated similarly to byval. Codegen support will be in a
future patch.
My original attempt at solving some of these problems was to repurpose
byval with a different address space from the stack. However, it is
technically permitted for the callee to introduce a write to the
argument, although nothing does this in reality. There is also talk of
removing and replacing the byval attribute, so a new attribute would
need to take its place anyway.
This is intended avoid some optimization issues with the current
handling of aggregate arguments, as well as fixes inflexibilty in how
frontends can specify the kernel ABI. The most honest representation
of the amdgpu_kernel convention is to expose all kernel arguments as
loads from constant memory. Today, these are raw, SSA Argument values
and codegen is responsible for turning these into loads.
Background:
There currently isn't a satisfactory way to represent how arguments
for the amdgpu_kernel calling convention are passed. In reality,
arguments are passed in a single, flat, constant memory buffer
implicitly passed to the function. It is also illegal to call this
function in the IR, and this is only ever invoked by a driver of some
kind.
It does not make sense to have a stack passed parameter in this
context as is implied by byval. It is never valid to write to the
kernel arguments, as this would corrupt the inputs seen by other
dispatches of the kernel. These argumets are also not in the same
address space as the stack, so a copy is needed to an alloca. From a
source C-like language, the kernel parameters are invisible.
Semantically, a copy is always required from the constant argument
memory to a mutable variable.
The current clang calling convention lowering emits raw values,
including aggregates into the function argument list, since using
byval would not make sense. This has some unfortunate consequences for
the optimizer. In the aggregate case, we end up with an aggregate
store to alloca, which both SROA and instcombine turn into a store of
each aggregate field. The optimizer never pieces this back together to
see that this is really just a copy from constant memory, so we end up
stuck with expensive stack usage.
This also means the backend dictates the alignment of arguments, and
arbitrarily picks the LLVM IR ABI type alignment. By allowing an
explicit alignment, frontends can make better decisions. For example,
there's real no advantage to an aligment higher than 4, so a frontend
could choose to compact the argument layout. Similarly, there is a
high penalty to using an alignment lower than 4, so a frontend could
opt into more padding for small arguments.
Another design consideration is when it is appropriate to expose the
fact that these arguments are all really passed in adjacent
memory. Currently we have a late IR optimization pass in codegen to
rewrite the kernel argument values into explicit loads to enable
vectorization. In most programs, unrelated argument loads can be
merged together. However, exposing this property directly from the
frontend has some disadvantages. We still need a way to track the
original argument sizes and alignments to report to the driver. I find
using some side-channel, metadata mechanism to track this
unappealing. If the kernel arguments were exposed as a single buffer
to begin with, alias analysis would be unaware that the padding bits
betewen arguments are meaningless. Another family of problems is there
are still some gaps in replacing all of the available parameter
attributes with metadata equivalents once lowered to loads.
The immediate plan is to start using this new attribute to handle all
aggregate argumets for kernels. Long term, it makes sense to migrate
all kernel arguments, including scalars, to be passed indirectly in
the same manner.
Additional context is in D79744.
2020-06-05 22:58:47 +02:00
|
|
|
; CHECK: define void @f67(i32* byref(i32) %a)
|
|
|
|
define void @f67(i32* byref(i32) %a)
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2020-10-20 08:48:18 +02:00
|
|
|
; CHECK: define void @f68() #41
|
|
|
|
define void @f68() mustprogress
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2020-12-17 00:05:35 +01:00
|
|
|
; CHECK; define void @f69() #42
|
|
|
|
define void @f69() nocallback
|
2020-12-14 22:56:11 +01:00
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2020-12-18 02:30:41 +01:00
|
|
|
; CHECK: define void @f70() #43
|
|
|
|
define void @f70() cold
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: define void @f71() #44
|
|
|
|
define void @f71() hot
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2021-03-03 14:53:30 +01:00
|
|
|
; CHECK: define void @f72() #45
|
|
|
|
define void @f72() vscale_range(8)
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: define void @f73() #46
|
|
|
|
define void @f73() vscale_range(1,8)
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: define void @f74() #47
|
|
|
|
define void @f74() vscale_range(1,0)
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: define void @f75()
|
|
|
|
; CHECK-NOT: define void @f75() #
|
|
|
|
define void @f75() vscale_range(0,0)
|
|
|
|
{
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2021-01-20 11:14:03 +01:00
|
|
|
; CHECK: define void @f76(i8* swiftasync %0)
|
|
|
|
define void @f76(i8* swiftasync %0)
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2021-05-25 12:29:00 +02:00
|
|
|
; CHECK: define void @f77() #48
|
|
|
|
define void @f77() nosanitize_coverage
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2021-06-27 20:59:57 +02:00
|
|
|
; CHECK: define void @f78() #49
|
|
|
|
define void @f78() noprofile
|
|
|
|
{
|
|
|
|
ret void;
|
|
|
|
}
|
|
|
|
|
2013-02-12 10:14:20 +01:00
|
|
|
; CHECK: attributes #0 = { noreturn }
|
|
|
|
; CHECK: attributes #1 = { nounwind }
|
|
|
|
; CHECK: attributes #2 = { readnone }
|
|
|
|
; CHECK: attributes #3 = { readonly }
|
|
|
|
; CHECK: attributes #4 = { noinline }
|
|
|
|
; CHECK: attributes #5 = { alwaysinline }
|
|
|
|
; CHECK: attributes #6 = { optsize }
|
|
|
|
; CHECK: attributes #7 = { ssp }
|
|
|
|
; CHECK: attributes #8 = { sspreq }
|
|
|
|
; CHECK: attributes #9 = { noredzone }
|
|
|
|
; CHECK: attributes #10 = { noimplicitfloat }
|
|
|
|
; CHECK: attributes #11 = { naked }
|
|
|
|
; CHECK: attributes #12 = { inlinehint }
|
|
|
|
; CHECK: attributes #13 = { alignstack=4 }
|
|
|
|
; CHECK: attributes #14 = { returns_twice }
|
|
|
|
; CHECK: attributes #15 = { uwtable }
|
|
|
|
; CHECK: attributes #16 = { nonlazybind }
|
2013-02-26 07:58:09 +01:00
|
|
|
; CHECK: attributes #17 = { sanitize_address }
|
|
|
|
; CHECK: attributes #18 = { sanitize_thread }
|
|
|
|
; CHECK: attributes #19 = { sanitize_memory }
|
2013-02-12 10:14:20 +01:00
|
|
|
; CHECK: attributes #20 = { "cpu"="cortex-a8" }
|
2013-07-18 00:13:44 +02:00
|
|
|
; CHECK: attributes #21 = { sspstrong }
|
|
|
|
; CHECK: attributes #22 = { minsize }
|
2013-11-18 22:44:03 +01:00
|
|
|
; CHECK: attributes #23 = { noinline optnone }
|
2014-06-05 21:29:43 +02:00
|
|
|
; CHECK: attributes #24 = { jumptable }
|
2015-05-27 01:48:40 +02:00
|
|
|
; CHECK: attributes #25 = { convergent }
|
2015-07-11 12:30:36 +02:00
|
|
|
; CHECK: attributes #26 = { argmemonly }
|
2015-11-06 11:32:53 +01:00
|
|
|
; CHECK: attributes #27 = { norecurse }
|
2015-12-16 17:16:19 +01:00
|
|
|
; CHECK: attributes #28 = { inaccessiblememonly }
|
|
|
|
; CHECK: attributes #29 = { inaccessiblemem_or_argmemonly }
|
2016-04-12 03:05:35 +02:00
|
|
|
; CHECK: attributes #30 = { allocsize(0) }
|
|
|
|
; CHECK: attributes #31 = { allocsize(0,1) }
|
2016-07-04 10:01:29 +02:00
|
|
|
; CHECK: attributes #32 = { writeonly }
|
2017-04-28 22:25:27 +02:00
|
|
|
; CHECK: attributes #33 = { speculatable }
|
2017-12-09 01:21:41 +01:00
|
|
|
; CHECK: attributes #34 = { sanitize_hwaddress }
|
2018-04-03 22:10:40 +02:00
|
|
|
; CHECK: attributes #35 = { shadowcallstack }
|
2019-06-27 17:51:40 +02:00
|
|
|
; CHECK: attributes #36 = { willreturn }
|
2019-07-08 17:57:56 +02:00
|
|
|
; CHECK: attributes #37 = { nofree }
|
[Attributor] Deduce "nosync" function attribute.
Introduce and deduce "nosync" function attribute to indicate that a function
does not synchronize with another thread in a way that other thread might free memory.
Reviewers: jdoerfert, jfb, nhaehnle, arsenm
Subscribers: wdng, hfinkel, nhaenhle, mehdi_amini, steven_wu,
dexonsmith, arsenm, uenoku, hiraditya, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D62766
llvm-svn: 365830
2019-07-11 23:37:40 +02:00
|
|
|
; CHECK: attributes #38 = { nosync }
|
ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues
using armv8.5 Memory Tagging Extension.
It is similar in principle to HWASan, which is a software implementation
of the same idea, but there are enough differencies to warrant a new
sanitizer type IMHO. It is also expected to have very different
performance properties.
The new sanitizer does not have a runtime library (it may grow one
later, along with a "debugging" mode). Similar to SafeStack and
StackProtector, the instrumentation pass (in a follow up change) will be
inserted in all cases, but will only affect functions marked with the
new sanitize_memtag attribute.
Reviewers: pcc, hctim, vitalybuka, ostannard
Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64169
llvm-svn: 366123
2019-07-15 22:02:23 +02:00
|
|
|
; CHECK: attributes #39 = { sanitize_memtag }
|
2020-04-25 12:57:07 +02:00
|
|
|
; CHECK: attributes #40 = { null_pointer_is_valid }
|
2020-10-20 08:48:18 +02:00
|
|
|
; CHECK: attributes #41 = { mustprogress }
|
2020-12-14 22:56:11 +01:00
|
|
|
; CHECK: attributes #42 = { nocallback }
|
2020-12-18 02:30:41 +01:00
|
|
|
; CHECK: attributes #43 = { cold }
|
|
|
|
; CHECK: attributes #44 = { hot }
|
2021-03-03 14:53:30 +01:00
|
|
|
; CHECK: attributes #45 = { vscale_range(8,8) }
|
|
|
|
; CHECK: attributes #46 = { vscale_range(1,8) }
|
|
|
|
; CHECK: attributes #47 = { vscale_range(1,0) }
|
2021-05-25 12:29:00 +02:00
|
|
|
; CHECK: attributes #48 = { nosanitize_coverage }
|
2021-06-27 20:59:57 +02:00
|
|
|
; CHECK: attributes #49 = { noprofile }
|
2020-04-30 18:49:01 +02:00
|
|
|
; CHECK: attributes #[[NOBUILTIN]] = { nobuiltin }
|