HomePhabricator

Fix an offset underflow bug in DwarfExpression when describing small values…

Authored by aprantl on Nov 20 2019, 1:02 PM.

Description

Fix an offset underflow bug in DwarfExpression when describing small values with subregisters

DwarfExpression::addMachineReg() knows how to build a larger register
that isn't expressible in DWARF by combining multiple
subregisters. However, if the entire value fits into just one
subregister, it would still emit the other subregisters, leading to
all sorts of inconsistencies down the line.

This patch fixes that by moving an already existing(!) check whether
the subregister's offset is before the end of the value to the right
place.

rdar://problem/57294211

Differential Revision: https://reviews.llvm.org/D70508