Fix a bug in GlobalOpt's handling of DIExpressions.
This patch adds support for fragment expressions
TryToShrinkGlobalToBoolean() which were previously just dropped.
Thanks to Reid Kleckner for providing me a reproducer!
llvm-svn: 331086
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index fe57aa7..f1ad72d 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -785,12 +785,12 @@
if (DerefAfter)
Ops.push_back(dwarf::DW_OP_deref);
- return doPrepend(Expr, Ops, StackValue);
+ return prependOpcodes(Expr, Ops, StackValue);
}
-DIExpression *DIExpression::doPrepend(const DIExpression *Expr,
- SmallVectorImpl<uint64_t> &Ops,
- bool StackValue) {
+DIExpression *DIExpression::prependOpcodes(const DIExpression *Expr,
+ SmallVectorImpl<uint64_t> &Ops,
+ bool StackValue) {
if (Expr)
for (auto Op : Expr->expr_ops()) {
// A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.