[llvm] Handle llvm.dbg.values in SROA. (PR #94070)
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 09:15:43 PDT 2024
================
@@ -0,0 +1,263 @@
+; This test was obtained from swift source code and then automatically reducing it via Delta.
+; The swift source code was from the test test/DebugInfo/debug_scope_distinct.swift.
+
+; RUN: opt %s -S -p=sroa -o - | FileCheck %s
+; CHECK: [[SROA_5_SROA_21:%.*]] = alloca [7 x i8], align 8
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_21]], metadata [[META59:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 72, 56)), !dbg [[DBG72:![0-9]+]]
+; CHECK-NEXT: [[SROA_5_SROA_14:%.*]] = alloca [7 x i8], align 8
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_14]], metadata [[META68:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 72, 56)), !dbg [[DBG72]]
+; CHECK-NEXT: [[SROA_5_SROA_7:%.*]] = alloca [7 x i8], align 8
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_7]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 72, 56)), !dbg [[DBG74:![0-9]+]]
+; CHECK-NEXT: [[SROA_5_SROA_0:%.*]] = alloca [7 x i8], align 8
+
+; CHECK: tail call void @llvm.dbg.value(metadata ptr [[REG2:%[0-9]+]], metadata [[META54:![0-9]+]], metadata !DIExpression(DW_OP_deref)), !dbg [[DBG78:![0-9]+]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[REG2:%[0-9]+]], metadata [[META56:![0-9]+]], metadata !DIExpression(DW_OP_deref)), !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i64 0, metadata [[META57:![0-9]+]], metadata !DIExpression()), !dbg [[DBG78]]
+
+; CHECK: [[SROA_418_SROA_COPYLOAD:%.*]] = load i8, ptr [[SROA_418_0_U1_IDX:%.*]], align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_418_SROA_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG72]]
+
+; CHECK: [[SROA_5_SROA_322_COPYLOAD:%.*]] = load ptr, ptr [[SROA_5_322_SROA_5_U1_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_322_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 128, 64)), !dbg [[DBG72]]
+
+; CHECK: [[SROA_5_SROA_423_COPYLOAD:%.*]] = load i8, ptr [[SROA_5_423_SROA_5_U1_IDX_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_423_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg [[DBG72]]
+
+; CHECK: [[SROA_10_0_COPYLOAD:%.*]] = load ptr, ptr [[U11:%.*]], align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_10_0_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG72]]
+
+; CHECK: [[SROA_411_0_COPYLOAD:%.*]] = load i8, ptr [[SROA_411_U11_IDX:%.*]], align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_411_0_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG72]]
+
+; CHECK: [[SROA_5_SROA_315_COPYLOAD:%.*]] = load ptr, ptr [[SROA_5_SROA_311_U1_IDX_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_315_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 128, 64)), !dbg [[DBG72]]
+
+; CHECK: [[SROA_5_SROA_416_COPYLOAD:%.*]] = load i8, ptr [[SROA_5_SROA_411_U11_IDX_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_416_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg [[DBG72]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_322_COPYLOAD]], metadata [[META79:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG92:![0-9]+]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_423_COPYLOAD]], metadata [[META79]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG92]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_315_COPYLOAD]], metadata [[META88:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG92]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_416_COPYLOAD]], metadata [[META88]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG92]]
+
+; CHECK: [[SROA_3_0_COPYLOAD:%.*]] = load ptr, ptr [[U2:%.*]], align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_3_0_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_44_0_COPYLOAD:%.*]] = load i8, ptr [[SROA_44_U2_IDX:%.*]] align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_44_0_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_5_SROA_38_COPYLOAD:%.*]] = load ptr, ptr [[SROA_5_SROA_38_U2_IDX_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_38_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 128, 64)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_5_SROA_49_COPYLOAD:%.*]] = load i8, ptr [[SROA_5_SROA_49_U2_IDX_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_49_COPYLOAD]], metadata [[META59]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_0_0_COPYLOAD:%.*]] = load ptr, ptr [[U26:%.*]], align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_0_0_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_4_0_COPYLOAD:%.*]] = load i8, ptr [[SROA_4_0_IDX:%.*]], align 8, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_4_0_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_5_SROA_3_COPYLOAD:%.*]] = load ptr, ptr [[SROA_5_SROA_3_SROA_5_U26_IDX_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_3_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 128, 64)), !dbg [[DBG74]]
+
+; CHECK: [[SROA_5_SROA_4_COPYLOAD:%.*]] = load i8, ptr [[SROA_5_SROA_4_SROA_5_U26_IDX:%.*]], align 1, !dbg [[DBG78]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_4_COPYLOAD]], metadata [[META68]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg [[DBG74]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_38_COPYLOAD]], metadata [[META79]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG94:![0-9]+]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_49_COPYLOAD]], metadata [[META79]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG94]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata ptr [[SROA_5_SROA_3_COPYLOAD]], metadata [[META88]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg [[DBG94]]
+; CHECK-NEXT: tail call void @llvm.dbg.value(metadata i8 [[SROA_5_SROA_4_COPYLOAD]], metadata [[META88]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg [[DBG94]]
+
+%T4main1TV13TangentVectorV = type <{ %T4main1UV13TangentVectorV, [7 x i8], %T4main1UV13TangentVectorV }>
+%T4main1UV13TangentVectorV = type <{ %T1M1SVySfG, [7 x i8], %T4main1VV13TangentVectorV }>
+%T1M1SVySfG = type <{ ptr, %Ts4Int8V }>
+%Ts4Int8V = type <{ i8 }>
+%T4main1VV13TangentVectorV = type <{ %T1M1SVySfG }>
+define hidden swiftcc void @"$s4main1TV13TangentVectorV1poiyA2E_AEtFZ"(ptr noalias nocapture sret(%T4main1TV13TangentVectorV) %0, ptr noalias nocapture dereferenceable(57) %1, ptr noalias nocapture dereferenceable(57) %2) #0 !dbg !44 {
+entry:
+ %3 = alloca %T4main1VV13TangentVectorV, align 8
+ tail call void @llvm.dbg.value(metadata ptr %3, metadata !59, metadata !DIExpression()), !dbg !72
+ %4 = alloca %T4main1UV13TangentVectorV, align 8
----------------
adrian-prantl wrote:
Do we need all of these allocas to test the functionality, or would one be sufficient?
https://github.com/llvm/llvm-project/pull/94070
More information about the llvm-commits
mailing list