[llvm] [Analysis] Add Scalable field in MemoryLocation.h (PR #69716)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 04:02:47 PDT 2023


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 47747da6340b00e301d3656f95ecf9b04a6ec2bb ccb7181a8ac419e3f60a905379546433c8414845 -- llvm/include/llvm/Analysis/MemoryLocation.h llvm/lib/Analysis/BasicAliasAnalysis.cpp llvm/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/lib/CodeGen/StackProtector.cpp llvm/lib/Transforms/IPO/AttributorAttributes.cpp llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 3932f1c7eac1..dc74c262e903 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -103,9 +103,8 @@ bool BasicAAResult::invalidate(Function &Fn, const PreservedAnalyses &PA,
 /// Returns the size of the object specified by V or UnknownSize if unknown.
 /// getObjectSize does not support scalable Value
 static TypeSize getObjectSize(const Value *V, const DataLayout &DL,
-                                  const TargetLibraryInfo &TLI,
-                                  bool NullIsValidLoc,
-                                  bool RoundToAlign = false) {
+                              const TargetLibraryInfo &TLI, bool NullIsValidLoc,
+                              bool RoundToAlign = false) {
   uint64_t Size;
   ObjectSizeOpts Opts;
   Opts.RoundToAlign = RoundToAlign;
@@ -153,7 +152,7 @@ static bool isObjectSmallerThan(const Value *V, LocationSize Size,
   // This function needs to use the aligned object size because we allow
   // reads a bit past the end given sufficient alignment.
   TypeSize ObjectSize = getObjectSize(V, DL, TLI, NullIsValidLoc,
-                                          /*RoundToAlign*/ true);
+                                      /*RoundToAlign*/ true);
 
   // Bail on comparing V and Size if Size is scalable
   return ObjectSize != MemoryLocation::UnknownSize && !Size.isScalable() &&
@@ -186,8 +185,7 @@ static LocationSize getMinimalExtentFrom(const Value &V,
 static bool isObjectSize(const Value *V, TypeSize Size, const DataLayout &DL,
                          const TargetLibraryInfo &TLI, bool NullIsValidLoc) {
   TypeSize ObjectSize = getObjectSize(V, DL, TLI, NullIsValidLoc);
-  return ObjectSize != MemoryLocation::UnknownSize &&
-         ObjectSize == Size;
+  return ObjectSize != MemoryLocation::UnknownSize && ObjectSize == Size;
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 87d96faa5c30..69d47046537c 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -1107,7 +1107,7 @@ bool MemoryDependenceResults::getNonLocalPointerDepFromBB(
         ThrowOutEverything =
             CacheInfo->Size.isPrecise() != Loc.Size.isPrecise() ||
             !TypeSize::isKnownGE(CacheInfo->Size.getValue(),
-                                Loc.Size.getValue());
+                                 Loc.Size.getValue());
       } else {
         // For our purposes, unknown size > all others.
         ThrowOutEverything = !Loc.Size.hasValue();
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index fdb79ff1bcb1..07a00036ba6c 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -206,8 +206,8 @@ static bool isShortenableAtTheBeginning(Instruction *I) {
 }
 
 static TypeSize getPointerSize(const Value *V, const DataLayout &DL,
-                                   const TargetLibraryInfo &TLI,
-                                   const Function *F) {
+                               const TargetLibraryInfo &TLI,
+                               const Function *F) {
   uint64_t Size;
   ObjectSizeOpts Opts;
   Opts.NullIsUnknownSize = NullPointerIsDefined(F);
@@ -951,8 +951,7 @@ struct DSEState {
     // case the size/offset of the dead store does not matter.
     if (DeadUndObj == KillingUndObj && KillingLocSize.isPrecise() &&
         isIdentifiedObject(KillingUndObj)) {
-      TypeSize KillingUndObjSize =
-          getPointerSize(KillingUndObj, DL, TLI, &F);
+      TypeSize KillingUndObjSize = getPointerSize(KillingUndObj, DL, TLI, &F);
       if (KillingUndObjSize != MemoryLocation::UnknownSize &&
           KillingUndObjSize == KillingLocSize.getValue())
         return OW_Complete;

``````````

</details>


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


More information about the llvm-commits mailing list