62 lines · plain
1; RUN: opt < %s -passes=inline -inline-remark-attribute --inline-threshold=0 -S | FileCheck %s2 3; Test that the inliner adds inline remark attributes to non-inlined callsites.4 5declare void @ext();6 7define void @foo() {8 call void @bar(i1 true)9 ret void10}11 12define void @bar(i1 %p) {13 br i1 %p, label %bb1, label %bb214 15bb1:16 call void @foo()17 call void @ext()18 ret void19 20bb2:21 call void @bar(i1 true)22 ret void23}24 25;; Test 1 - Add different inline remarks to similar callsites.26define void @test1() {27; CHECK-LABEL: @test128; CHECK-NEXT: call void @bar(i1 true) [[ATTR1:#[0-9]+]]29; CHECK-NEXT: call void @bar(i1 false) [[ATTR2:#[0-9]+]]30 call void @bar(i1 true)31 call void @bar(i1 false)32 ret void33}34 35define void @noop() {36 ret void37}38 39;; Test 2 - Printed InlineResult messages are followed by InlineCost.40define void @test2(ptr) {41; CHECK-LABEL: @test242; CHECK-NEXT: call void @noop() [[ATTR3:#[0-9]+]] [ "CUSTOM_OPERAND_BUNDLE"() ]43; CHECK-NEXT: ret void44 call void @noop() ; extepected to be inlined45 call void @noop() [ "CUSTOM_OPERAND_BUNDLE"() ] ; cannot be inlined because of unsupported operand bundle46 ret void47}48 49;; Test 3 - InlineResult messages come from llvm::isInlineViable()50define void @test3() {51; CHECK-LABEL: @test352; CHECK-NEXT: call void @test3() [[ATTR4:#[0-9]+]]53; CHECK-NEXT: ret void54 call void @test3() alwaysinline55 ret void56}57 58; CHECK: attributes [[ATTR1]] = { "inline-remark"="(cost=25, threshold=0)" }59; CHECK: attributes [[ATTR2]] = { "inline-remark"="(cost=never): recursive" }60; CHECK: attributes [[ATTR3]] = { "inline-remark"="unsupported operand bundle; (cost={{.*}}, threshold={{.*}})" }61; CHECK: attributes [[ATTR4]] = { alwaysinline "inline-remark"="(cost=never): recursive call" }62