1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Remove a redundant null-check in DIExpression::prepend, NFC

Code outside of an `if (Expr)` block dereferenced `Expr`, so the null
check was redundant.

llvm-svn: 336465
This commit is contained in:
Vedant Kumar 2018-07-06 21:06:20 +00:00
parent 9243b281e0
commit 0bce44c380

View File

@ -819,24 +819,25 @@ DIExpression *DIExpression::prepend(const DIExpression *Expr, bool DerefBefore,
DIExpression *DIExpression::prependOpcodes(const DIExpression *Expr,
SmallVectorImpl<uint64_t> &Ops,
bool StackValue) {
assert(Expr && "Can't prepend ops to this expression");
// If there are no ops to prepend, do not even add the DW_OP_stack_value.
if (Ops.empty())
StackValue = false;
if (Expr)
for (auto Op : Expr->expr_ops()) {
// A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
if (StackValue) {
if (Op.getOp() == dwarf::DW_OP_stack_value)
StackValue = false;
else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
Ops.push_back(dwarf::DW_OP_stack_value);
StackValue = false;
}
for (auto Op : Expr->expr_ops()) {
// A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
if (StackValue) {
if (Op.getOp() == dwarf::DW_OP_stack_value)
StackValue = false;
else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
Ops.push_back(dwarf::DW_OP_stack_value);
StackValue = false;
}
Ops.push_back(Op.getOp());
for (unsigned I = 0; I < Op.getNumArgs(); ++I)
Ops.push_back(Op.getArg(I));
}
Ops.push_back(Op.getOp());
for (unsigned I = 0; I < Op.getNumArgs(); ++I)
Ops.push_back(Op.getArg(I));
}
if (StackValue)
Ops.push_back(dwarf::DW_OP_stack_value);
return DIExpression::get(Expr->getContext(), Ops);