[llvm] 12ec215 - [IR] Update docstring for stripAndAccumulateConstantOffset (#180365)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 9 07:12:42 PST 2026
Author: Aiden Grossman
Date: 2026-02-09T15:12:32Z
New Revision: 12ec215e8ab74510ddd6b43b8e7c0422fbc16cfb
URL: https://github.com/llvm/llvm-project/commit/12ec215e8ab74510ddd6b43b8e7c0422fbc16cfb
DIFF: https://github.com/llvm/llvm-project/commit/12ec215e8ab74510ddd6b43b8e7c0422fbc16cfb.diff
LOG: [IR] Update docstring for stripAndAccumulateConstantOffset (#180365)
Make it clear that the returned object in the case where a variable
offset is found is the first value to introduce a non-constant offset,
not necessarily the actual underlying object.
Found while investigating #180361.
Added:
Modified:
llvm/include/llvm/IR/Value.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index 4a15251f0b945..a22c324189b9a 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -732,9 +732,10 @@ class Value {
///
/// Note that this function will never return a nullptr. It will also never
/// manipulate the \p Offset in a way that would not match the
diff erence
- /// between the underlying value and the returned one. Thus, if no constant
- /// offset was found, the returned value is the underlying one and \p Offset
- /// is unchanged.
+ /// between the underlying value and the returned one. Thus, if a variable
+ /// offset is encountered during traversal, the returned value is the first
+ /// traversed Value that introduces a non-constant offset and \p Offset is the
+ /// accumulated constant offset up to that point.
LLVM_ABI const Value *stripAndAccumulateConstantOffsets(
const DataLayout &DL, APInt &Offset, bool AllowNonInbounds,
bool AllowInvariantGroup = false,
More information about the llvm-commits
mailing list