diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -2026,11 +2026,14 @@ // DI cannot produce a valid DBG_VALUE, so produce an undef DBG_VALUE to // terminate any prior location. MIRBuilder.buildIndirectDbgValue(0, DI.getVariable(), DI.getExpression()); - } else if (const auto *CI = dyn_cast(V)) { + return true; + } + if (const auto *CI = dyn_cast(V)) { MIRBuilder.buildConstDbgValue(*CI, DI.getVariable(), DI.getExpression()); - } else if (auto *AI = dyn_cast(V); - AI && AI->isStaticAlloca() && - DI.getExpression()->startsWithDeref()) { + return true; + } + if (auto *AI = dyn_cast(V); + AI && AI->isStaticAlloca() && DI.getExpression()->startsWithDeref()) { // If the value is an alloca and the expression starts with a // dereference, track a stack slot instead of a register, as registers // may be clobbered. @@ -2039,14 +2042,14 @@ DIExpression::get(AI->getContext(), ExprOperands.drop_front()); MIRBuilder.buildFIDbgValue(getOrCreateFrameIndex(*AI), DI.getVariable(), ExprDerefRemoved); - } else { - for (Register Reg : getOrCreateVRegs(*V)) { - // FIXME: This does not handle register-indirect values at offset 0. The - // direct/indirect thing shouldn't really be handled by something as - // implicit as reg+noreg vs reg+imm in the first place, but it seems - // pretty baked in right now. - MIRBuilder.buildDirectDbgValue(Reg, DI.getVariable(), DI.getExpression()); - } + return true; + } + for (Register Reg : getOrCreateVRegs(*V)) { + // FIXME: This does not handle register-indirect values at offset 0. The + // direct/indirect thing shouldn't really be handled by something as + // implicit as reg+noreg vs reg+imm in the first place, but it seems + // pretty baked in right now. + MIRBuilder.buildDirectDbgValue(Reg, DI.getVariable(), DI.getExpression()); } return true; }