summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorstozer <stephen.tozer@sony.com>2019-12-17 09:37:17 +0000
committerstozer <stephen.tozer@sony.com>2019-12-18 11:09:18 +0000
commitbb1b0bc4e57428ce364d3d6c075ff03cb8973462 (patch)
tree94b07c626e27d7f5000cf1c316dfc6d6c600c8e4 /llvm/lib/IR
parentbc5b7e21e32b23603f4d6148adeb88cd34dd287e (diff)
downloadbcm5719-llvm-bb1b0bc4e57428ce364d3d6c075ff03cb8973462.tar.gz
bcm5719-llvm-bb1b0bc4e57428ce364d3d6c075ff03cb8973462.zip
[DebugInfo] Correctly handle salvaged casts and split fragments at ISel
Previously, LLVM had no functional way of performing casts inside of a DIExpression(), which made salvaging cast instructions other than Noop casts impossible. This patch enables the salvaging of casts by using the DW_OP_LLVM_convert operator for SExt and Trunc instructions. There is another issue which is exposed by this fix, in which fragment DIExpressions (which are preserved more readily by this patch) for values that must be split across registers in ISel trigger an assertion, as the 'split' fragments extend beyond the bounds of the fragment DIExpression causing an error. This patch also fixes this issue by checking the fragment status of DIExpressions which are to be split, and dropping fragments that are invalid.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 9b42a5a0e1b..8970fc15576 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -1196,13 +1196,18 @@ bool DIExpression::isConstant() const {
return true;
}
+DIExpression::ExtOps DIExpression::getExtOps(unsigned FromSize, unsigned ToSize,
+ bool Signed) {
+ dwarf::TypeKind TK = Signed ? dwarf::DW_ATE_signed : dwarf::DW_ATE_unsigned;
+ DIExpression::ExtOps Ops({dwarf::DW_OP_LLVM_convert, FromSize, TK,
+ dwarf::DW_OP_LLVM_convert, ToSize, TK});
+ return Ops;
+}
+
DIExpression *DIExpression::appendExt(const DIExpression *Expr,
unsigned FromSize, unsigned ToSize,
bool Signed) {
- dwarf::TypeKind TK = Signed ? dwarf::DW_ATE_signed : dwarf::DW_ATE_unsigned;
- uint64_t Ops[] = {dwarf::DW_OP_LLVM_convert, FromSize, TK,
- dwarf::DW_OP_LLVM_convert, ToSize, TK};
- return appendToStack(Expr, Ops);
+ return appendToStack(Expr, getExtOps(FromSize, ToSize, Signed));
}
DIGlobalVariableExpression *
OpenPOWER on IntegriCloud