diff options
| author | Dan Gohman <dan433584@gmail.com> | 2016-01-25 16:48:44 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2016-01-25 16:48:44 +0000 |
| commit | 899cb5ab7b26afccb3d455a1af9609699ab13425 (patch) | |
| tree | be4af7b92e4d2793b05a029ce683468bd75fcbd2 /llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp | |
| parent | 619db96d5e0c5607ca6e1a3f0454bdaa032ec0d5 (diff) | |
| download | bcm5719-llvm-899cb5ab7b26afccb3d455a1af9609699ab13425.tar.gz bcm5719-llvm-899cb5ab7b26afccb3d455a1af9609699ab13425.zip | |
[WebAssembly] Fix unbalanced register stack code in the case of late DCE.
Instructions can be DCE'd after the RegStackify pass. If the instruction which
would be the pop for what would be a push is removed, don't use a push.
llvm-svn: 258694
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp index 88c50a098dc..a76cb81b34f 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp @@ -92,6 +92,9 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) { unsigned CurReg = MFI.getParams().size(); for (unsigned VRegIdx = 0; VRegIdx < NumVRegs; ++VRegIdx) { unsigned VReg = TargetRegisterInfo::index2VirtReg(VRegIdx); + // Skip unused registers. + if (MRI.use_empty(VReg)) + continue; // Handle stackified registers. if (MFI.isVRegStackified(VReg)) { DEBUG(dbgs() << "VReg " << VReg << " -> WAReg " @@ -99,9 +102,6 @@ bool WebAssemblyRegNumbering::runOnMachineFunction(MachineFunction &MF) { MFI.setWAReg(VReg, INT32_MIN | NumStackRegs++); continue; } - // Skip unused registers. - if (MRI.use_empty(VReg)) - continue; if (MFI.getWAReg(VReg) == WebAssemblyFunctionInfo::UnusedReg) { DEBUG(dbgs() << "VReg " << VReg << " -> WAReg " << CurReg << "\n"); MFI.setWAReg(VReg, CurReg++); |

