[llvm] ab8598e - [IR] Remove unnecessary pointer type check (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 07:56:31 PST 2023


Author: Nikita Popov
Date: 2023-12-08T16:56:23+01:00
New Revision: ab8598e088dc406f0cd30f34aa8b08f98e73c652

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

LOG: [IR] Remove unnecessary pointer type check (NFC)

With opaque pointers, the address spaces will only be the same if
the types are the same, in which case this would have been handled
at the start of the method already.

Added: 
    

Modified: 
    llvm/lib/IR/Type.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 3d2e203a20dac..a185ca3fb8dc1 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -141,16 +141,9 @@ bool Type::canLosslesslyBitCastTo(Type *Ty) const {
       Ty->getPrimitiveSizeInBits().getFixedValue() == 8192)
     return true;
 
-  // At this point we have only various mismatches of the first class types
-  // remaining and ptr->ptr. Just select the lossless conversions. Everything
-  // else is not lossless. Conservatively assume we can't losslessly convert
-  // between pointers with 
diff erent address spaces.
-  if (auto *PTy = dyn_cast<PointerType>(this)) {
-    if (auto *OtherPTy = dyn_cast<PointerType>(Ty))
-      return PTy->getAddressSpace() == OtherPTy->getAddressSpace();
-    return false;
-  }
-  return false;  // Other types have no identity values
+  // Conservatively assume we can't losslessly convert between pointers with
+  // 
diff erent address spaces.
+  return false;
 }
 
 bool Type::isEmptyTy() const {


        


More information about the llvm-commits mailing list