From b0cdf530c393a6c3bb3f165d626c2e7a25f93f3b Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 27 Jun 2014 05:32:09 +0000 Subject: [PATCH] ArgumentPromotion: Propagate debug locations on calls for which arguments are promoted. llvm-svn: 211872 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | 1 + llvm/test/Transforms/ArgumentPromotion/dbg.ll | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 llvm/test/Transforms/ArgumentPromotion/dbg.ll diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 377fa15..4618c26 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -741,6 +741,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F, if (cast(Call)->isTailCall()) cast(New)->setTailCall(); } + New->setDebugLoc(Call->getDebugLoc()); Args.clear(); AttributesVec.clear(); diff --git a/llvm/test/Transforms/ArgumentPromotion/dbg.ll b/llvm/test/Transforms/ArgumentPromotion/dbg.ll new file mode 100644 index 0000000..a991bbc --- /dev/null +++ b/llvm/test/Transforms/ArgumentPromotion/dbg.ll @@ -0,0 +1,17 @@ +; RUN: opt < %s -argpromotion -S | FileCheck %s +; CHECK: call void @test(), !dbg !1 +target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" +define internal void @test(i32* %X) { + ret void +} + +define void @caller() { + call void @test(i32* null), !dbg !1 + ret void +} + +!llvm.module.flags = !{!3} + +!1 = metadata !{i32 8, i32 0, metadata !2, null} +!2 = metadata !{} +!3 = metadata !{i32 2, metadata !"Debug Info Version", i32 1} -- 2.7.4