[llvm] r319158 - [TailRecursionElimination] Skip debug intrinsics.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 01:32:25 PST 2017
Author: fhahn
Date: Tue Nov 28 01:32:25 2017
New Revision: 319158
URL: http://llvm.org/viewvc/llvm-project?rev=319158&view=rev
Log:
[TailRecursionElimination] Skip debug intrinsics.
Summary:
I think we do not need to analyze debug intrinsics here, as they should
not impact codegen. This has 2 benefits: 1) slightly less work to do and
2) avoiding generating optimization remarks for converting calls to
debug intrinsics to tail calls, which are not really helpful for users.
Based on work by Sander de Smalen.
Reviewers: davide, trentxintong, aprantl
Reviewed By: aprantl
Subscribers: llvm-commits, JDevlieghere
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D40440
Modified:
llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
llvm/trunk/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll
Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=319158&r1=319157&r2=319158&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Tue Nov 28 01:32:25 2017
@@ -230,7 +230,7 @@ static bool markTails(Function &F, bool
Escaped = ESCAPED;
CallInst *CI = dyn_cast<CallInst>(&I);
- if (!CI || CI->isTailCall())
+ if (!CI || CI->isTailCall() || isa<DbgInfoIntrinsic>(&I))
continue;
bool IsNoTail = CI->isNoTailCall() || CI->hasOperandBundles();
Modified: llvm/trunk/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll?rev=319158&r1=319157&r2=319158&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll (original)
+++ llvm/trunk/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll Tue Nov 28 01:32:25 2017
@@ -96,8 +96,8 @@ define i32 @maxB(i32 %x, i32 %y) !dbg !3
; OPTIMIZATION_LEVEL_2: define i32 @maxB(i32 %x, i32 %y)
; OPTIMIZATION_LEVEL_2-NEXT: entry:
-; OPTIMIZATION_LEVEL_2-NEXT: tail call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
-; OPTIMIZATION_LEVEL_2-NEXT: tail call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
+; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
+; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y) #{{[0-9]+}}, !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: ret i32 %0, !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: }
More information about the llvm-commits
mailing list