diff options
author | Nikita Popov <npopov@redhat.com> | 2023-07-14 10:32:43 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-07-14 10:32:43 +0200 |
commit | 06807957c5fc88f8dd482482772bb2a8b6823a06 (patch) | |
tree | 09c8fd9c866cced08f6af09cdd8e8e0a504d6907 /llvm/lib/IR/Constants.cpp | |
parent | 61e0822efab14dd922f9c3ee479a0a51952526d9 (diff) | |
download | llvm-06807957c5fc88f8dd482482772bb2a8b6823a06.zip llvm-06807957c5fc88f8dd482482772bb2a8b6823a06.tar.gz llvm-06807957c5fc88f8dd482482772bb2a8b6823a06.tar.bz2 |
[llvm] Remove uses of hasSameElemenTypeAs() (NFC)
Always returns true with opaque pointers.
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 1d9808e..23af3c4 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -2226,21 +2226,6 @@ Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy, bool OnlyIfReduced) { assert(CastInst::castIsValid(Instruction::AddrSpaceCast, C, DstTy) && "Invalid constantexpr addrspacecast!"); - - // Canonicalize addrspacecasts between different pointer types by first - // bitcasting the pointer type and then converting the address space. - PointerType *SrcScalarTy = cast<PointerType>(C->getType()->getScalarType()); - PointerType *DstScalarTy = cast<PointerType>(DstTy->getScalarType()); - if (!SrcScalarTy->hasSameElementTypeAs(DstScalarTy)) { - Type *MidTy = PointerType::getWithSamePointeeType( - DstScalarTy, SrcScalarTy->getAddressSpace()); - if (VectorType *VT = dyn_cast<VectorType>(DstTy)) { - // Handle vectors of pointers. - MidTy = FixedVectorType::get(MidTy, - cast<FixedVectorType>(VT)->getNumElements()); - } - C = getBitCast(C, MidTy); - } return getFoldedCast(Instruction::AddrSpaceCast, C, DstTy, OnlyIfReduced); } |