[llvm] 6a31a9a - [AMDGPU][NFC] Skip processing intrinsics that do not become real instructions
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 17:45:49 PDT 2020
Author: dfukalov
Date: 2020-06-09T03:45:33+03:00
New Revision: 6a31a9a5431f60111d97f751d221d30efb14ba6f
URL: https://github.com/llvm/llvm-project/commit/6a31a9a5431f60111d97f751d221d30efb14ba6f
DIFF: https://github.com/llvm/llvm-project/commit/6a31a9a5431f60111d97f751d221d30efb14ba6f.diff
LOG: [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
Added:
llvm/test/CodeGen/AMDGPU/simplify-libcalls2.ll
Modified:
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index 0ef858693027..e81a68c86546 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1730,7 +1730,9 @@ bool AMDGPUSimplifyLibCalls::runOnFunction(Function &F) {
// Ignore non-calls.
CallInst *CI = dyn_cast<CallInst>(I);
++I;
- if (!CI) continue;
+ // Ignore intrinsics that do not become real instructions.
+ if (!CI || isa<DbgInfoIntrinsic>(CI) || CI->isLifetimeStartOrEnd())
+ continue;
// Ignore indirect calls.
Function *Callee = CI->getCalledFunction();
diff --git a/llvm/test/CodeGen/AMDGPU/simplify-libcalls2.ll b/llvm/test/CodeGen/AMDGPU/simplify-libcalls2.ll
new file mode 100644
index 000000000000..16150d0dd7c3
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/simplify-libcalls2.ll
@@ -0,0 +1,24 @@
+; REQUIRES: asserts
+; RUN: opt -S -amdgpu-simplifylib -debug-only=amdgpu-simplifylib -mtriple=amdgcn-unknown-amdhsa -disable-output < %s 2>&1 | FileCheck %s
+
+; CHECK-NOT: AMDIC: try folding call void @llvm.lifetime.start.p0i8
+; CHECK-NOT: AMDIC: try folding call void @llvm.lifetime.end.p0i8
+; CHECK-NOT: AMDIC: try folding call void @llvm.dbg.value
+
+define void @foo(i32 %i) {
+ call void @llvm.lifetime.start.p0i8(i64 1, i8* undef)
+ call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
+ call void @llvm.dbg.value(metadata i32 undef, metadata !DILocalVariable(name: "1", scope: !2), metadata !DIExpression()), !dbg !3
+ ret void
+}
+
+declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
+declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+!llvm.module.flags = !{!1}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !DIFile(filename: "1", directory: "1"))
+!1 = !{i32 2, !"Debug Info Version", i32 3}
+!2 = distinct !DISubprogram(unit: !0)
+!3 = !DILocation(line: 1, column: 1, scope: !2)
More information about the llvm-commits
mailing list