[flang-commits] [flang] [flang][debug] Keep the bounds of variables in stack slots at -O0. (PR #229876)

via flang-commits flang-commits at lists.llvm.org
Thu Oct 8 09:56:37 PDT 2026


================
@@ -397,7 +398,7 @@ static void InsertFakeUseForDebugVar(mlir::OpBuilder &builder, Op declOp,
                 mlir::dyn_cast<mlir::func::ReturnOp>(block.getTerminator())) {
           mlir::OpBuilder::InsertionGuard guard(builder);
           builder.setInsertionPoint(returnOp);
-          if (!fir::getIntIfConstant(var))
+          if (!fir::getIntIfConstant(var) && !fir::getDebugBoundSlot(var))
----------------
jiel-nv wrote:

Would it be better to move the `fir::getDebugBoundSlot(var)` check above the per-block search loop?

https://github.com/llvm/llvm-project/pull/229876


More information about the flang-commits mailing list