mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	Fix a bug in InstCombine where we would incorrectly attempt to construct a
bitcast between pointers of two different address spaces if they happened to have the same pointer size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203862 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -335,6 +335,13 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
 | 
			
		||||
        NewLoad->setAlignment(LI.getAlignment());
 | 
			
		||||
        NewLoad->setAtomic(LI.getOrdering(), LI.getSynchScope());
 | 
			
		||||
        // Now cast the result of the load.
 | 
			
		||||
        PointerType *OldTy = dyn_cast<PointerType>(NewLoad->getType());
 | 
			
		||||
        PointerType *NewTy = dyn_cast<PointerType>(LI.getType());
 | 
			
		||||
        if (OldTy && NewTy &&
 | 
			
		||||
            OldTy->getAddressSpace() != NewTy->getAddressSpace()) {
 | 
			
		||||
          return new AddrSpaceCastInst(NewLoad, LI.getType());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new BitCastInst(NewLoad, LI.getType());
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user