1; RUN: opt < %s -S -passes=forceattrs | FileCheck %s --check-prefix=CHECK-CONTROL 2; RUN: opt < %s -S -passes=forceattrs -force-attribute foo:noinline | FileCheck %s --check-prefix=CHECK-FOO 3; RUN: opt < %s -S -passes=forceattrs -force-remove-attribute goo:cold | FileCheck %s --check-prefix=REMOVE-COLD 4; RUN: opt < %s -S -passes=forceattrs -force-remove-attribute goo:noinline | FileCheck %s --check-prefix=REMOVE-NOINLINE 5; RUN: opt < %s -S -passes=forceattrs -force-attribute goo:cold -force-remove-attribute goo:noinline | FileCheck %s --check-prefix=ADD-COLD-REMOVE-NOINLINE 6; RUN: opt < %s -S -passes=forceattrs -force-attribute goo:noinline -force-remove-attribute goo:noinline | FileCheck %s --check-prefix=ADD-NOINLINE-REMOVE-NOINLINE 7; RUN: opt < %s -S -passes=forceattrs -force-attribute optsize | FileCheck %s --check-prefix=CHECK-ADD-ALL 8; RUN: opt < %s -S -passes=forceattrs -force-remove-attribute noinline | FileCheck %s --check-prefix=CHECK-REMOVE-ALL 9 10; CHECK-CONTROL: define void @foo() { 11; CHECK-FOO: define void @foo() #0 { 12define void @foo() { 13 ret void 14} 15 16; Ignore `cold` which does not exist before. 17; REMOVE-COLD: define void @goo() #0 { 18 19; Remove `noinline` attribute. 20; REMOVE-NOINLINE: define void @goo() { 21 22; Add `cold` and remove `noinline` leaving `cold` only. 23; ADD-COLD-REMOVE-NOINLINE: define void @goo() #0 { 24 25; `force-remove` takes precedence over `force`. 26; `noinline` is removed. 27; ADD-NOINLINE-REMOVE-NOINLINE: define void @goo() { 28 29define void @goo() #0 { 30 ret void 31} 32attributes #0 = { noinline } 33 34; CHECK-FOO: attributes #0 = { noinline } 35; REMOVE-COLD: attributes #0 = { noinline } 36; ADD-COLD-REMOVE-NOINLINE: attributes #0 = { cold } 37 38; When passing an attribute without specifying a function, the attribute 39; should be added to all functions in the module. 40; CHECK-ADD-ALL: define void @foo() #0 { 41; CHECK-ADD-ALL: define void @goo() #1 { 42; CHECK-ADD-ALL: attributes #0 = { optsize } 43; CHECK-ADD-ALL: attributes #1 = { noinline optsize } 44 45; When passing an attribute to be removed without specifying a function, 46; the attribute should be removed from all functions in the module that 47; have it. 48; CHECK-REMOVE-ALL: define void @foo() { 49; CHECK-REMOVE-ALL: define void @goo() { 50; CHECK-REMOVE-ALL-NOT: attributes #0 51 52