diff options
author | Heejin Ahn <aheejin@gmail.com> | 2021-05-11 22:46:52 -0700 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2021-05-14 03:48:19 -0700 |
commit | 71fbfb499aaaefbb2b24e5652df5525684766bfc (patch) | |
tree | 94968cfab62cc50a24b6d2fe8e519ad568c981eb /llvm/unittests/Support/MathExtrasTest.cpp | |
parent | 8e35a18e4ad416c48c8e48492676fb189ee2c720 (diff) | |
download | llvm-71fbfb499aaaefbb2b24e5652df5525684766bfc.zip llvm-71fbfb499aaaefbb2b24e5652df5525684766bfc.tar.gz llvm-71fbfb499aaaefbb2b24e5652df5525684766bfc.tar.bz2 |
[WebAssembly] Omit DBG_VALUE after terminator
When a stackified variable has an associated `DBG_VALUE` instruction,
DebugFixup pass adds a `DBG_VALUE` instruction after the stackified
value's last use to clear the variable's debug range info. But when the
last use instruction is a terminator, it can cause a verification
failure (when run with `-verify-machineinstrs`) because there are no
instructions allowed after a terminator.
For example:
```
%myvar = ...
DBG_VALUE target-index(wasm-operand-stack), $noreg, !"myvar", ...
BR_IF 0, %myvar, ...
DBG_VALUE $noreg, $noreg, !"myvar", ...
```
In this test, `%myvar` is stackified, so the first `DBG_VALUE`
instruction's first operand has changed to `wasm-operand-stack` to
denote it. And an additional `DBG_VALUE` instruction is added after its
last use, `BR_IF`, to signal variable `myvar` is not in the operand
stack anymore. But because the `DBG_VALUE` instruction is added after
the `BR_IF`, a terminator, it fails MachineVerifier.
`DBG_VALUE` instructions are used in `DbgEntityHistoryCalculator` to
compute value ranges to emit DWARF info, and it turns out the
`DbgEntityHistoryCalculator` terminates ranges at the end of a BB, so we
don't need to emit `DBG_VALUE` after a terminator.
Fixes https://bugs.llvm.org/show_bug.cgi?id=50175.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D102309
Diffstat (limited to 'llvm/unittests/Support/MathExtrasTest.cpp')
0 files changed, 0 insertions, 0 deletions