Skip to content

Commit 6a31a9a

Browse files
committed
[AMDGPU][NFC] Skip processing intrinsics that do not become real instructions
Reviewers: rampitec Reviewed By: rampitec Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81260
1 parent e9de9e3 commit 6a31a9a

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,9 @@ bool AMDGPUSimplifyLibCalls::runOnFunction(Function &F) {
17301730
// Ignore non-calls.
17311731
CallInst *CI = dyn_cast<CallInst>(I);
17321732
++I;
1733-
if (!CI) continue;
1733+
// Ignore intrinsics that do not become real instructions.
1734+
if (!CI || isa<DbgInfoIntrinsic>(CI) || CI->isLifetimeStartOrEnd())
1735+
continue;
17341736

17351737
// Ignore indirect calls.
17361738
Function *Callee = CI->getCalledFunction();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; REQUIRES: asserts
2+
; RUN: opt -S -amdgpu-simplifylib -debug-only=amdgpu-simplifylib -mtriple=amdgcn-unknown-amdhsa -disable-output < %s 2>&1 | FileCheck %s
3+
4+
; CHECK-NOT: AMDIC: try folding call void @llvm.lifetime.start.p0i8
5+
; CHECK-NOT: AMDIC: try folding call void @llvm.lifetime.end.p0i8
6+
; CHECK-NOT: AMDIC: try folding call void @llvm.dbg.value
7+
8+
define void @foo(i32 %i) {
9+
call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
10+
call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
11+
call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(name: "1", scope: !2), metadata !DIExpression()), !dbg !3
12+
ret void
13+
}
14+
15+
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
16+
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
17+
declare void @llvm.dbg.value(metadata, metadata, metadata)
18+
19+
!llvm.module.flags = !{!1}
20+
21+
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !DIFile(filename: "1", directory: "1"))
22+
!1 = !{i32 2, !"Debug Info Version", i32 3}
23+
!2 = distinct !DISubprogram(unit: !0)
24+
!3 = !DILocation(line: 1, column: 1, scope: !2)

0 commit comments

Comments
 (0)