summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
index cab21007d3f..5a8ddadb0c9 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -143,9 +143,9 @@ static void PlaceBlockMarker(
}
// Add the BLOCK.
- MachineInstr *Begin = BuildMI(*Header, InsertPos, DebugLoc(),
+ MachineInstr *Begin = BuildMI(*Header, InsertPos, MBB.findDebugLoc(InsertPos),
TII.get(WebAssembly::BLOCK))
- .addImm(int64_t(WebAssembly::ExprType::Void));
+ .addImm(int64_t(WebAssembly::ExprType::Void));
// Mark the end of the block.
InsertPos = MBB.begin();
@@ -153,7 +153,7 @@ static void PlaceBlockMarker(
InsertPos->getOpcode() == WebAssembly::END_LOOP &&
LoopTops[&*InsertPos]->getParent()->getNumber() >= Header->getNumber())
++InsertPos;
- MachineInstr *End = BuildMI(MBB, InsertPos, DebugLoc(),
+ MachineInstr *End = BuildMI(MBB, InsertPos, MBB.findPrevDebugLoc(InsertPos),
TII.get(WebAssembly::END_BLOCK));
BlockTops[End] = Begin;
@@ -193,12 +193,14 @@ static void PlaceLoopMarker(
while (InsertPos != MBB.end() &&
InsertPos->getOpcode() == WebAssembly::END_LOOP)
++InsertPos;
- MachineInstr *Begin = BuildMI(MBB, InsertPos, DebugLoc(),
+ MachineInstr *Begin = BuildMI(MBB, InsertPos, MBB.findDebugLoc(InsertPos),
TII.get(WebAssembly::LOOP))
- .addImm(int64_t(WebAssembly::ExprType::Void));
+ .addImm(int64_t(WebAssembly::ExprType::Void));
- // Mark the end of the loop.
- MachineInstr *End = BuildMI(*AfterLoop, AfterLoop->begin(), DebugLoc(),
+ // Mark the end of the loop (using arbitrary debug location that branched
+ // to the loop end as its location).
+ DebugLoc EndDL = (*AfterLoop->pred_rbegin())->findBranchDebugLoc();
+ MachineInstr *End = BuildMI(*AfterLoop, AfterLoop->begin(), EndDL,
TII.get(WebAssembly::END_LOOP));
LoopTops[End] = Begin;
@@ -276,7 +278,8 @@ static void FixEndsAtEndOfFunction(
static void AppendEndToFunction(
MachineFunction &MF,
const WebAssemblyInstrInfo &TII) {
- BuildMI(MF.back(), MF.back().end(), DebugLoc(),
+ BuildMI(MF.back(), MF.back().end(),
+ MF.back().findPrevDebugLoc(MF.back().end()),
TII.get(WebAssembly::END_FUNCTION));
}
OpenPOWER on IntegriCloud