[llvm] a969bdc - [InstCombine] Remove unnecessary addres space check (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 21 11:14:33 PDT 2021
Author: Nikita Popov
Date: 2021-06-21T20:11:39+02:00
New Revision: a969bdc56f66a3c059f6d70e574d11fda8354e2a
URL: https://github.com/llvm/llvm-project/commit/a969bdc56f66a3c059f6d70e574d11fda8354e2a
DIFF: https://github.com/llvm/llvm-project/commit/a969bdc56f66a3c059f6d70e574d11fda8354e2a.diff
LOG: [InstCombine] Remove unnecessary addres space check (NFC)
It's not possible to bitcast between different address spaces,
and this is ensured by the IR verifier. As such, this bitcast to
addrspacecast canonicalization can never be hit.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index a7fae64a0620..9b38eb6ab24d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2621,12 +2621,6 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst &CI) {
Type *DstElTy = DstPTy->getElementType();
Type *SrcElTy = SrcPTy->getElementType();
- // Casting pointers between the same type, but with
diff erent address spaces
- // is an addrspace cast rather than a bitcast.
- if ((DstElTy == SrcElTy) &&
- (DstPTy->getAddressSpace() != SrcPTy->getAddressSpace()))
- return new AddrSpaceCastInst(Src, DestTy);
-
// If we are casting a alloca to a pointer to a type of the same
// size, rewrite the allocation instruction to allocate the "right" type.
// There is no need to modify malloc calls because it is their bitcast that
More information about the llvm-commits
mailing list