Debug info: Use DW_OP_bit_piece instead of DW_OP_piece in the

intermediate representation. This
- increases consistency by using the same granularity everywhere
- allows for pieces < 1 byte
- DW_OP_piece didn't actually allow storing an offset.

Part of PR22495.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-02-09 23:57:15 +00:00
parent 76419c0533
commit 4f1b7f3100
18 changed files with 80 additions and 83 deletions
+5 -5
View File
@@ -4175,15 +4175,15 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
// Create a piece expression describing the new partition or reuse AI's
// expression if there is only one partition.
DIExpression PieceExpr = Expr;
if (IsSplit || Expr.isVariablePiece()) {
if (IsSplit || Expr.isBitPiece()) {
// If this alloca is already a scalar replacement of a larger aggregate,
// Piece.Offset describes the offset inside the scalar.
unsigned Offset = Expr.isVariablePiece() ? Expr.getPieceOffset() : 0;
unsigned Offset = Expr.isBitPiece() ? Expr.getBitPieceOffset() : 0;
assert((Offset == 0 ||
Offset+Piece.Offset+Piece.Size <=
Expr.getPieceOffset()+Expr.getPieceSize()) &&
Offset+Piece.Offset+Piece.Size*8 <=
Expr.getBitPieceOffset()+Expr.getBitPieceSize()) &&
"inner piece is not inside original alloca");
PieceExpr = DIB.createPieceExpression(Offset+Piece.Offset, Piece.Size);
PieceExpr = DIB.createBitPieceExpression(Offset+Piece.Offset*8, Piece.Size*8);
}
// Remove any existing dbg.declare intrinsic describing the same alloca.