1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Reduce/remove-attributes-from-intrinsics.ll
Roman Lebedev 892d28a558 [llvm-reduce] Reducing attributes
Summary:
This handles all three places where attributes could currently be - `GlobalVariable`, `Function` and `CallBase`.
For last two, it correctly handles all three possible attribute locations (return value, arguments and function itself)

There was a previous attempt at it D73853,
which was committed in rGfc62b36a000681c01e993242b583c5ec4ab48a3c,
but then reverted all the way back in rGb12176d2aafa0ccb2585aa218fc3b454ba84f2a9
due to some (osx?) test failures.

Reviewers: nickdesaulniers, dblaikie, diegotf, george.burgess.iv, jdoerfert, Tyker, arsenm

Reviewed By: nickdesaulniers

Subscribers: wdng, MaskRay, arsenm, llvm-commits, mgorny

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83351
2020-07-09 23:10:43 +03:00

39 lines
1.2 KiB
LLVM

; We can't actually put attributes on intrinsic declarations, only on call sites.
;
; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL %s
define i32 @t(i32 %a) {
; CHECK-ALL-LABEL: @t(
; CHECK-INTERESTINGNESS: %r =
; CHECK-INTERESTINGNESS-SAME: call
; CHECK-INTERESTINGNESS-SAME: "arg0"
; CHECK-INTERESTINGNESS-SAME: i32 @llvm.uadd.sat.i32(i32
; CHECK-INTERESTINGNESS-SAME: "arg3"
; CHECK-INTERESTINGNESS-SAME: %a
; CHECK-INTERESTINGNESS-SAME: i32
; CHECK-INTERESTINGNESS-SAME: %a
; CHECK-INTERESTINGNESS-SAME: #1
; CHECK-FINAL: %r = call "arg0" i32 @llvm.uadd.sat.i32(i32 "arg3" %a, i32 %a) #1
; CHECK-ALL: ret i32 %r
%r = call "arg0" "arg1" i32 @llvm.uadd.sat.i32(i32 "arg2" "arg3" %a, i32 %a) "arg4" "arg5"
ret i32 %r
}
; CHECK-ALL: declare i32 @llvm.uadd.sat.i32(i32, i32) #0
declare i32 @llvm.uadd.sat.i32(i32, i32) #0
; CHECK-ALL: attributes #0 = { nounwind readnone speculatable willreturn }
; CHECK-INTERESTINGNESS: attributes #1 = {
; CHECK-INTERESTINGNESS-SAME: "arg4"
; CHECK-FINAL: attributes #1 = { "arg4" }
; CHECK-ALL-NOT: attributes #
attributes #0 = { "arg6" "arg7" }