[llvm] [llvm] Fix behavior of llvm.objectsize in presence of negative / large offset (PR #115504)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 12:06:49 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff d74127e78aa7f8ab07b0926d25920444dde6c73c 3bdf857555d4abe1084102365a93524ce4a48dca --extensions cpp,h -- llvm/include/llvm/Analysis/MemoryBuiltins.h llvm/lib/Analysis/MemoryBuiltins.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index 3ec204f904..cd8594d670 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -757,9 +757,9 @@ OffsetSpan ObjectSizeOffsetVisitor::computeImpl(Value *V) {
 
   // We end up pointing on a location that's outside of the original object.
   // This is UB, and we'd rather return an empty location then.
-  if(ORT.knownBefore() && ORT.Before.isNegative()) {
-      ORT.Before = APInt::getZero(ORT.Before.getBitWidth());
-      ORT.After = APInt::getZero(ORT.Before.getBitWidth());
+  if (ORT.knownBefore() && ORT.Before.isNegative()) {
+    ORT.Before = APInt::getZero(ORT.Before.getBitWidth());
+    ORT.After = APInt::getZero(ORT.Before.getBitWidth());
   }
   return ORT;
 }

``````````

</details>


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


More information about the llvm-commits mailing list