File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
llvm/lib/Transforms/InstCombine Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2906,8 +2906,10 @@ Instruction *InstCombinerImpl::visitAddrSpaceCast(AddrSpaceCastInst &CI) {
2906
2906
Value *Src = CI.getOperand (0 );
2907
2907
PointerType *SrcTy = cast<PointerType>(Src->getType ()->getScalarType ());
2908
2908
PointerType *DestTy = cast<PointerType>(CI.getType ()->getScalarType ());
2909
+ bool isni = DL.isNonIntegralAddressSpace (SrcTy->getAddressSpace ()) ||
2910
+ DL.isNonIntegralAddressSpace (DestTy->getAddressSpace ());
2909
2911
2910
- if (!SrcTy->hasSameElementTypeAs (DestTy)) {
2912
+ if (!SrcTy->hasSameElementTypeAs (DestTy) && !isni ) {
2911
2913
Type *MidTy =
2912
2914
PointerType::getWithSamePointeeType (DestTy, SrcTy->getAddressSpace ());
2913
2915
// Handle vectors of pointers.
You can’t perform that action at this time.
0 commit comments