[PATCH] D45648: [WebAssembly] Fix bugs in MachineBasicBlock::findDebugLoc() call

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 16:57:24 PDT 2018


aheejin updated this revision to Diff 142495.
aheejin added a comment.

comment fix


Repository:
  rL LLVM

https://reviews.llvm.org/D45648

Files:
  lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp


Index: lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -147,9 +147,12 @@
   }
 
   // Add the BLOCK.
-  MachineInstr *Begin = BuildMI(*Header, InsertPos, MBB.findDebugLoc(InsertPos),
-                                TII.get(WebAssembly::BLOCK))
-                            .addImm(int64_t(WebAssembly::ExprType::Void));
+  DebugLoc DL = InsertPos != Header->end()
+                    ? Header->findDebugLoc(InsertPos)
+                    : Header->findPrevDebugLoc(InsertPos);
+  MachineInstr *Begin =
+      BuildMI(*Header, InsertPos, DL, TII.get(WebAssembly::BLOCK))
+          .addImm(int64_t(WebAssembly::ExprType::Void));
 
   // Mark the end of the block.
   InsertPos = MBB.begin();
@@ -197,8 +200,10 @@
   while (InsertPos != MBB.end() &&
          InsertPos->getOpcode() == WebAssembly::END_LOOP)
     ++InsertPos;
-  MachineInstr *Begin = BuildMI(MBB, InsertPos, MBB.findDebugLoc(InsertPos),
-                                TII.get(WebAssembly::LOOP))
+
+  DebugLoc DL = InsertPos != MBB.end() ? MBB.findDebugLoc(InsertPos)
+                                       : MBB.findPrevDebugLoc(InsertPos);
+  MachineInstr *Begin = BuildMI(MBB, InsertPos, DL, TII.get(WebAssembly::LOOP))
                             .addImm(int64_t(WebAssembly::ExprType::Void));
 
   // Mark the end of the loop (using arbitrary debug location that branched


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45648.142495.patch
Type: text/x-patch
Size: 1531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180413/dbbe9c0a/attachment.bin>


More information about the llvm-commits mailing list