[llvm] 1d12731 - Minor style tweaks following fb93659

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 09:32:37 PST 2022


Author: Philip Reames
Date: 2022-01-10T09:32:29-08:00
New Revision: 1d127315e7453d13be6a960dc1d8ed6562121831

URL: https://github.com/llvm/llvm-project/commit/1d127315e7453d13be6a960dc1d8ed6562121831
DIFF: https://github.com/llvm/llvm-project/commit/1d127315e7453d13be6a960dc1d8ed6562121831.diff

LOG: Minor style tweaks following fb93659

Added: 
    

Modified: 
    llvm/lib/Analysis/MemoryBuiltins.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index 08bf1729bf27..213fdc5aacee 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -255,15 +255,6 @@ bool llvm::isAlignedAllocLikeFn(
   return getAllocationData(V, AlignedAllocLike, GetTLI)
       .hasValue();
 }
-/// Gets the alignment argument for an aligned_alloc-like function
-Value *llvm::getAllocAlignment(const CallBase *V,
-                               const TargetLibraryInfo *TLI) {
-  const Optional<AllocFnsTy> FnData = getAllocationData(V, AnyAlloc, TLI);
-  if (!FnData.hasValue() || FnData->AlignParam < 0) {
-    return nullptr;
-  }
-  return V->getOperand(FnData->AlignParam);
-}
 
 /// Tests if a value is a call or invoke to a library function that
 /// allocates zero-filled memory (such as calloc).
@@ -307,6 +298,18 @@ bool llvm::isStrdupLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
   return getAllocationData(V, StrDupLike, TLI).hasValue();
 }
 
+
+Value *llvm::getAllocAlignment(const CallBase *V,
+                               const TargetLibraryInfo *TLI) {
+  assert(isAllocationFn(V, TLI));
+
+  const Optional<AllocFnsTy> FnData = getAllocationData(V, AnyAlloc, TLI);
+  if (!FnData.hasValue() || FnData->AlignParam < 0) {
+    return nullptr;
+  }
+  return V->getOperand(FnData->AlignParam);
+}
+
 Constant *llvm::getInitialValueOfAllocation(const CallBase *Alloc,
                                             const TargetLibraryInfo *TLI,
                                             Type *Ty) {


        


More information about the llvm-commits mailing list