aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-12-08 16:54:03 +0100
committerNikita Popov <npopov@redhat.com>2023-12-08 16:56:23 +0100
commitab8598e088dc406f0cd30f34aa8b08f98e73c652 (patch)
tree5d3dd8ac0ccca00d95861cf895146c76db585123
parent0c9a20b0a1c8343136cf105db2b389d53cc2aba1 (diff)
downloadllvm-ab8598e088dc406f0cd30f34aa8b08f98e73c652.zip
llvm-ab8598e088dc406f0cd30f34aa8b08f98e73c652.tar.gz
llvm-ab8598e088dc406f0cd30f34aa8b08f98e73c652.tar.bz2
[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.
-rw-r--r--llvm/lib/IR/Type.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 3d2e203..a185ca3 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 different 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
+ // different address spaces.
+ return false;
}
bool Type::isEmptyTy() const {