From db3bbdcd4f25d6e85a23cb7a64ee8d82d99eea70 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 20 Jun 2023 16:44:16 +0200 Subject: [PATCH] [DebugInfo] Convert tests to opaque pointers (NFC) --- .../DebugInfo/Generic/mem2reg-promote-alloca-3.ll | 36 +++++++++++----------- llvm/test/DebugInfo/X86/bitcast-di.ll | 22 ++++++------- llvm/test/DebugInfo/X86/undef-type-md.ll | 10 +++--- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-3.ll b/llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-3.ll index b42af36..6552001 100644 --- a/llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-3.ll +++ b/llvm/test/DebugInfo/Generic/mem2reg-promote-alloca-3.ll @@ -1,4 +1,4 @@ -; RUN: opt -opaque-pointers=0 -passes=mem2reg %s -S -o - | FileCheck %s +; RUN: opt -passes=mem2reg %s -S -o - | FileCheck %s ;; Check that mem2reg removes dbg.value(%local, DIExpression(DW_OP_deref...)) ;; that instcombine LowerDbgDeclare inserted before the call to 'esc' when @@ -7,7 +7,7 @@ ;; throughout after inlining. ;; ;; $ clang reduce.c -O2 -g -emit-llvm -S -o tmp.ll -Xclang -disable-llvm-passes -;; $ opt -opaque-pointers=0 tmp.ll -o - -instcombine -inline -S +;; $ opt tmp.ll -o - -instcombine -inline -S ;; $ cat reduce.c ;; __attribute__((__always_inline__)) ;; static void esc(unsigned char **c) { @@ -20,30 +20,30 @@ ; CHECK: define dso_local void @fun() ; CHECK-NEXT: entry: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* null, metadata ![[LOCAL:[0-9]+]], metadata !DIExpression()) +; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr null, metadata ![[LOCAL:[0-9]+]], metadata !DIExpression()) ; CHECK-NOT: call void @llvm.dbg.value({{.*}}, metadata ![[LOCAL]] ; CHECK: ![[LOCAL]] = !DILocalVariable(name: "local", define dso_local void @fun() !dbg !7 { entry: - %local = alloca i8*, align 8 - %0 = bitcast i8** %local to i8*, !dbg !14 - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0) #3, !dbg !14 - call void @llvm.dbg.value(metadata i8* null, metadata !11, metadata !DIExpression()), !dbg !15 - store i8* null, i8** %local, align 8, !dbg !16 - call void @llvm.dbg.value(metadata i8** %local, metadata !11, metadata !DIExpression(DW_OP_deref)), !dbg !15 - call void @llvm.dbg.value(metadata i8** %local, metadata !21, metadata !DIExpression()), !dbg !27 - call void @llvm.dbg.value(metadata i8** %local, metadata !21, metadata !DIExpression()), !dbg !27 - %1 = load i8*, i8** %local, align 8, !dbg !29 - %add.ptr.i = getelementptr inbounds i8, i8* %1, i64 4, !dbg !29 - store i8* %add.ptr.i, i8** %local, align 8, !dbg !29 - %2 = bitcast i8** %local to i8*, !dbg !30 - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %2) #3, !dbg !30 + %local = alloca ptr, align 8 + %0 = bitcast ptr %local to ptr, !dbg !14 + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %0) #3, !dbg !14 + call void @llvm.dbg.value(metadata ptr null, metadata !11, metadata !DIExpression()), !dbg !15 + store ptr null, ptr %local, align 8, !dbg !16 + call void @llvm.dbg.value(metadata ptr %local, metadata !11, metadata !DIExpression(DW_OP_deref)), !dbg !15 + call void @llvm.dbg.value(metadata ptr %local, metadata !21, metadata !DIExpression()), !dbg !27 + call void @llvm.dbg.value(metadata ptr %local, metadata !21, metadata !DIExpression()), !dbg !27 + %1 = load ptr, ptr %local, align 8, !dbg !29 + %add.ptr.i = getelementptr inbounds i8, ptr %1, i64 4, !dbg !29 + store ptr %add.ptr.i, ptr %local, align 8, !dbg !29 + %2 = bitcast ptr %local to ptr, !dbg !30 + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3, !dbg !30 ret void, !dbg !30 } -declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) -declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) +declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) +declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) declare void @llvm.dbg.value(metadata, metadata, metadata) !llvm.dbg.cu = !{!0} diff --git a/llvm/test/DebugInfo/X86/bitcast-di.ll b/llvm/test/DebugInfo/X86/bitcast-di.ll index 6874ada..f599cc9 100644 --- a/llvm/test/DebugInfo/X86/bitcast-di.ll +++ b/llvm/test/DebugInfo/X86/bitcast-di.ll @@ -1,4 +1,4 @@ -; RUN: opt -opaque-pointers=0 -mtriple=x86_64-unknown-linux-gnu -S -debugify -codegenprepare < %s | FileCheck %s +; RUN: opt -mtriple=x86_64-unknown-linux-gnu -S -debugify -codegenprepare < %s | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" @@ -7,20 +7,20 @@ target triple = "x86_64-unknown-linux-gnu" declare void @foo(i32) -declare void @slowpath(i32, i32*) +declare void @slowpath(i32, ptr) ; Is DI maintained after sinking bitcast? -define void @test(i1 %cond, i64* %base) { +define void @test(i1 %cond, ptr %base) { ; CHECK-LABEL: @test entry: - %addr = getelementptr inbounds i64, i64* %base, i64 5 - %casted = bitcast i64* %addr to i32* + %addr = getelementptr inbounds i64, ptr %base, i64 5 + %casted = bitcast ptr %addr to ptr br i1 %cond, label %if.then, label %fallthrough if.then: ; CHECK-LABEL: if.then: -; CHECK: bitcast i64* %addr to i32*, !dbg ![[castLoc:[0-9]+]] - %v1 = load i32, i32* %casted, align 4 +; CHECK: bitcast ptr %addr to ptr, !dbg ![[castLoc:[0-9]+]] + %v1 = load i32, ptr %casted, align 4 call void @foo(i32 %v1) %cmp = icmp eq i32 %v1, 0 br i1 %cmp, label %rare.1, label %fallthrough @@ -30,8 +30,8 @@ fallthrough: rare.1: ; CHECK-LABEL: rare.1: -; CHECK: bitcast i64* %addr to i32*, !dbg ![[castLoc]] - call void @slowpath(i32 %v1, i32* %casted) ;; NOT COLD +; CHECK: bitcast ptr %addr to ptr, !dbg ![[castLoc]] + call void @slowpath(i32 %v1, ptr %casted) ;; NOT COLD br label %fallthrough } @@ -39,8 +39,8 @@ rare.1: define void @test2() { ; CHECK-LABEL: @test2 load.i145: -; CHECK: bitcast [1 x [2 x <4 x float>]]* @x to [2 x <4 x float>]*, !dbg ![[castLoc2:[0-9]+]] - %x_offset = getelementptr [1 x [2 x <4 x float>]], [1 x [2 x <4 x float>]]* @x, i32 0, i64 0 +; CHECK: bitcast ptr @x to ptr, !dbg ![[castLoc2:[0-9]+]] + %x_offset = getelementptr [1 x [2 x <4 x float>]], ptr @x, i32 0, i64 0 ret void } diff --git a/llvm/test/DebugInfo/X86/undef-type-md.ll b/llvm/test/DebugInfo/X86/undef-type-md.ll index e7e079c..7841963 100644 --- a/llvm/test/DebugInfo/X86/undef-type-md.ll +++ b/llvm/test/DebugInfo/X86/undef-type-md.ll @@ -1,7 +1,7 @@ -; RUN: opt -opaque-pointers=0 -S -passes=ipsccp %S/undef-type-md.ll | FileCheck %s +; RUN: opt -S -passes=ipsccp %S/undef-type-md.ll | FileCheck %s ; CHECK: llvm.nondebug.metadata = !{[[NONDEBUG_METADATA:![0-9]+]]} -; CHECK: [[NONDEBUG_METADATA]] = distinct !{null} -; CHECK: !DITemplateValueParameter({{.*}} value: %class.1 addrspace(1)* undef) +; CHECK: [[NONDEBUG_METADATA]] = !{ptr addrspace(1) @extern_const} +; CHECK: !DITemplateValueParameter({{.*}} value: ptr addrspace(1) @extern_const) ; ModuleID = '' source_filename = "test.cpp" @@ -31,6 +31,6 @@ entry: !6 = !DISubroutineType(types: !7) !7 = !{null} !8 = !{!9} -!9 = !DITemplateValueParameter(name: "S", type: !10, value: %"class.1" addrspace(1)* bitcast ({ { float, i32, i8 } } addrspace(1)* @extern_const to %"class.1" addrspace(1)*)) +!9 = !DITemplateValueParameter(name: "S", type: !10, value: ptr addrspace(1) @extern_const) !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!11 = !{%"class.1" addrspace(1)* bitcast ({ { float, i32, i8 } } addrspace(1)* @extern_const to %"class.1" addrspace(1)*)} +!11 = !{ptr addrspace(1) @extern_const} -- 2.7.4