aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorShubham Sandeep Rastogi <srastogi22@apple.com>2024-02-05 15:30:35 -0800
committerShubham Sandeep Rastogi <srastogi22@apple.com>2024-02-05 15:33:21 -0800
commit6ce03ff3fef8fb6fa9afe8eb22c6d98bced26d48 (patch)
tree472afc99e6540b0675b4b56b172cd7aefc6fc291 /llvm/lib/IR/DebugInfo.cpp
parenta7bc9cb6ffa91ff0ebabc45c0c7263c7c2c3a4de (diff)
downloadllvm-6ce03ff3fef8fb6fa9afe8eb22c6d98bced26d48.zip
llvm-6ce03ff3fef8fb6fa9afe8eb22c6d98bced26d48.tar.gz
llvm-6ce03ff3fef8fb6fa9afe8eb22c6d98bced26d48.tar.bz2
Revert "[IR] Use range-based for loops (NFC)"
This reverts commit e8512786fedbfa6ddba70ceddc29d7122173ba5e. This revert is done because llvm::drop_begin over an empty ArrayRef doesn't return an empty range, and therefore can lead to an invalid address returned instead. See discussion in https://github.com/llvm/llvm-project/pull/80737 for more context.
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 2cf8829..d8c1b0d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -400,8 +400,8 @@ static MDNode *updateLoopMetadataDebugLocationsImpl(
// Save space for the self-referential LoopID.
SmallVector<Metadata *, 4> MDs = {nullptr};
- for (const MDOperand &MDO : llvm::drop_begin(OrigLoopID->operands())) {
- Metadata *MD = MDO;
+ for (unsigned i = 1; i < OrigLoopID->getNumOperands(); ++i) {
+ Metadata *MD = OrigLoopID->getOperand(i);
if (!MD)
MDs.push_back(nullptr);
else if (Metadata *NewMD = Updater(MD))