[PATCH] D63337: [AMDGPU] Don't constrain callees with inlinehint from inlining on MaxBB check to prevent link failure
Valery Pykhtin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 09:13:57 PDT 2019
vpykhtin updated this revision to Diff 204783.
vpykhtin added a comment.
updated description
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63337/new/
https://reviews.llvm.org/D63337
Files:
llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
llvm/test/CodeGen/AMDGPU/inline-maxbb.ll
Index: llvm/test/CodeGen/AMDGPU/inline-maxbb.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/inline-maxbb.ll
+++ llvm/test/CodeGen/AMDGPU/inline-maxbb.ll
@@ -31,3 +31,38 @@
store volatile i32 %res, i32 addrspace(1)* undef
ret void
}
+
+
+; inlinehint
+define i32 @callee_hint(i32 %x) #0 {
+entry:
+ %cc = icmp eq i32 %x, 1
+ br i1 %cc, label %ret_res, label %mulx
+
+mulx:
+ %mul1 = mul i32 %x, %x
+ %mul2 = mul i32 %mul1, %x
+ %mul3 = mul i32 %mul1, %mul2
+ %mul4 = mul i32 %mul3, %mul2
+ %mul5 = mul i32 %mul4, %mul3
+ br label %ret_res
+
+ret_res:
+ %r = phi i32 [ %mul5, %mulx ], [ %x, %entry ]
+ ret i32 %r
+}
+
+; INL-LABEL: @caller_hint
+; NOINL-LABEL: @caller_hint
+; INL: mul i32
+; INL-NOT: call i32
+; NOINL: mul i32
+; NOINL-NOT: call i32
+
+define amdgpu_kernel void @caller_hint(i32 %x) {
+ %res = call i32 @callee_hint(i32 %x)
+ store volatile i32 %res, i32 addrspace(1)* undef
+ ret void
+}
+
+attributes #0 = { inlinehint }
Index: llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
@@ -218,7 +218,7 @@
LocalParams, TTI, GetAssumptionCache, None, PSI,
RemarksEnabled ? &ORE : nullptr);
- if (IC && !IC.isAlways()) {
+ if (IC && !IC.isAlways() && !Callee->hasFnAttribute(Attribute::InlineHint)) {
// Single BB does not increase total BB amount, thus subtract 1
size_t Size = Caller->size() + Callee->size() - 1;
if (MaxBB && Size > MaxBB)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63337.204783.patch
Type: text/x-patch
Size: 1650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190614/b6bdd0b3/attachment.bin>
More information about the llvm-commits
mailing list