summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-12-25 00:31:02 +0000
committerDan Gohman <dan433584@gmail.com>2015-12-25 00:31:02 +0000
commit8887d1faedb890defbeee4f849a6a9a22bda4af5 (patch)
tree9159cca49461127efe975f761adbaf3e9a225e0b /llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
parent99d235329f0e26bd0a3df51069b91e84289ca31b (diff)
downloadbcm5719-llvm-8887d1faedb890defbeee4f849a6a9a22bda4af5.tar.gz
bcm5719-llvm-8887d1faedb890defbeee4f849a6a9a22bda4af5.zip
[WebAssembly] Fix handling of COPY instructions in WebAssemblyRegStackify.
Move RegStackify after coalescing and teach it to use LiveIntervals instead of depending on SSA form. This avoids a problem where a register in a COPY instruction is stackified and then subsequently coalesced with a register that is not stackified. This also puts it after the scheduler, which allows us to simplify the EXPR_STACK constraint, as we no longer have instructions being reordered after stackification and before coloring. llvm-svn: 256402
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
index 6ac53662359..e9671ee07e6 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -320,11 +320,12 @@ static void PlaceBlockMarker(MachineBasicBlock &MBB, MachineFunction &MF,
// the BLOCK needs to be above the LOOP.
InsertPos = Header->begin();
} else {
- // Otherwise, insert the BLOCK as late in Header as we can, but before any
- // existing BLOCKs.
+ // Otherwise, insert the BLOCK as late in Header as we can, but before the
+ // beginning of the local expression tree and any nested BLOCKs.
InsertPos = Header->getFirstTerminator();
while (InsertPos != Header->begin() &&
- prev(InsertPos)->getOpcode() == WebAssembly::BLOCK)
+ prev(InsertPos)->definesRegister(WebAssembly::EXPR_STACK) &&
+ prev(InsertPos)->getOpcode() != WebAssembly::LOOP)
--InsertPos;
}
OpenPOWER on IntegriCloud