[llvm] 127d955 - [ConstantFold] Drop unused function (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 3 01:14:59 PST 2022


Author: Nikita Popov
Date: 2022-01-03T10:14:52+01:00
New Revision: 127d955441649e97411cc1299f39d37aa743c073

URL: https://github.com/llvm/llvm-project/commit/127d955441649e97411cc1299f39d37aa743c073
DIFF: https://github.com/llvm/llvm-project/commit/127d955441649e97411cc1299f39d37aa743c073.diff

LOG: [ConstantFold] Drop unused function (NFC)

isMaybeZeroSizeType() is no longer used after
5afbfe33e7d6ce40af0ad6d99421b443c45b351b.

Added: 
    

Modified: 
    llvm/lib/IR/ConstantFold.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 36d27beff814..c3f3d3c4b4c1 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1299,23 +1299,6 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
   return nullptr;
 }
 
-/// This type is zero-sized if it's an array or structure of zero-sized types.
-/// The only leaf zero-sized type is an empty structure.
-static bool isMaybeZeroSizedType(Type *Ty) {
-  if (StructType *STy = dyn_cast<StructType>(Ty)) {
-    if (STy->isOpaque()) return true;  // Can't say.
-
-    // If all of elements have zero size, this does too.
-    for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i)
-      if (!isMaybeZeroSizedType(STy->getElementType(i))) return false;
-    return true;
-
-  } else if (ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
-    return isMaybeZeroSizedType(ATy->getElementType());
-  }
-  return false;
-}
-
 /// This function determines if there is anything we can decide about the two
 /// constants provided. This doesn't need to handle simple things like
 /// ConstantFP comparisons, but should instead handle ConstantExprs.


        


More information about the llvm-commits mailing list