mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
CodeGenPrepare: Don't match addressing modes through addrspacecast
This was resulting in the addrspacecast being removed and incorrectly replaced with a ptrtoint when sinking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2672,7 +2672,6 @@ bool AddressingModeMatcher::MatchOperationAddr(User *AddrInst, unsigned Opcode,
|
||||
return MatchAddr(AddrInst->getOperand(0), Depth);
|
||||
return false;
|
||||
case Instruction::BitCast:
|
||||
case Instruction::AddrSpaceCast:
|
||||
// BitCast is always a noop, and we can handle it as long as it is
|
||||
// int->int or pointer->pointer (we don't want int<->fp or something).
|
||||
if ((AddrInst->getOperand(0)->getType()->isPointerTy() ||
|
||||
@@ -2683,6 +2682,14 @@ bool AddressingModeMatcher::MatchOperationAddr(User *AddrInst, unsigned Opcode,
|
||||
AddrInst->getOperand(0)->getType() != AddrInst->getType())
|
||||
return MatchAddr(AddrInst->getOperand(0), Depth);
|
||||
return false;
|
||||
case Instruction::AddrSpaceCast: {
|
||||
unsigned SrcAS
|
||||
= AddrInst->getOperand(0)->getType()->getPointerAddressSpace();
|
||||
unsigned DestAS = AddrInst->getType()->getPointerAddressSpace();
|
||||
if (TLI.isNoopAddrSpaceCast(SrcAS, DestAS))
|
||||
return MatchAddr(AddrInst->getOperand(0), Depth);
|
||||
return false;
|
||||
}
|
||||
case Instruction::Add: {
|
||||
// Check to see if we can merge in the RHS then the LHS. If so, we win.
|
||||
ExtAddrMode BackupAddrMode = AddrMode;
|
||||
|
Reference in New Issue
Block a user