[PATCH] D43163: [Utils] Salvage the debug info of DCE'ed ‘and’ instructions

Petar Jovanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 05:12:41 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL325119: [Utils] Salvage the debug info of DCE'ed 'and' instructions (authored by petarj, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43163?vs=134012&id=134199#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43163

Files:
  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
  llvm/trunk/lib/IR/DebugInfoMetadata.cpp
  llvm/trunk/lib/Transforms/Utils/Local.cpp
  llvm/trunk/test/Transforms/InstCombine/debuginfo-variables.ll


Index: llvm/trunk/test/Transforms/InstCombine/debuginfo-variables.ll
===================================================================
--- llvm/trunk/test/Transforms/InstCombine/debuginfo-variables.ll
+++ llvm/trunk/test/Transforms/InstCombine/debuginfo-variables.ll
@@ -87,6 +87,13 @@
   ret void
 }
 
+define void @test_and(i64 %A) {
+; CHECK-LABEL: @test_and(
+; CHECK-NEXT:  call void @llvm.dbg.value(metadata i64 %A, metadata !72, metadata !DIExpression(DW_OP_constu, 256, DW_OP_and, DW_OP_stack_value)), !dbg !73
+  %1 = and i64 %A, 256
+  ret void
+}
+
 ; CHECK: !8 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !9)
 ; CHECK: !10 = !DILocalVariable(name: "2", scope: !5, file: !1, line: 2, type: !11)
 ; CHECK: !12 = !DILocation(line: 2, column: 1, scope: !5)
@@ -124,3 +131,6 @@
 
 ; CHECK: !67 = !DILocalVariable(name: "13", scope: !65, file: !1, line: 24, type: !11)
 ; CHECK: !68 = !DILocation(line: 24, column: 1, scope: !65)
+
+; CHECK: !72 = !DILocalVariable(name: "14", scope: !70, file: !1, line: 26, type: !11)
+; CHECK: !73 = !DILocation(line: 26, column: 1, scope: !70)
Index: llvm/trunk/lib/IR/DebugInfoMetadata.cpp
===================================================================
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp
@@ -711,6 +711,7 @@
     case dwarf::DW_OP_div:
     case dwarf::DW_OP_mod:
     case dwarf::DW_OP_or:
+    case dwarf::DW_OP_and:
     case dwarf::DW_OP_xor:
     case dwarf::DW_OP_shl:
     case dwarf::DW_OP_shr:
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -352,6 +352,7 @@
     case dwarf::DW_OP_div:
     case dwarf::DW_OP_mod:
     case dwarf::DW_OP_or:
+    case dwarf::DW_OP_and:
     case dwarf::DW_OP_xor:
     case dwarf::DW_OP_shl:
     case dwarf::DW_OP_shr:
Index: llvm/trunk/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp
@@ -1564,6 +1564,9 @@
       case Instruction::Or:
         applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_or});
         break;
+      case Instruction::And:
+        applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_and});
+        break;
       case Instruction::Xor:
         applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_xor});
         break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43163.134199.patch
Type: text/x-patch
Size: 2566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180214/4c73542e/attachment.bin>


More information about the llvm-commits mailing list