diff options
author | Eli Bendersky <eliben@google.com> | 2014-05-22 00:02:52 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2014-05-22 00:02:52 +0000 |
commit | f13a05607c10a5b695b95f82c14a890c50ec25ff (patch) | |
tree | f5a0d570b6bcc3dc83357a12e686e42cf95c6808 /llvm/lib/CodeGen | |
parent | 3470bbbd54e8e841ddac233df24ad086afe5521a (diff) | |
download | bcm5719-llvm-f13a05607c10a5b695b95f82c14a890c50ec25ff.tar.gz bcm5719-llvm-f13a05607c10a5b695b95f82c14a890c50ec25ff.zip |
Similar to bitcast, treat addrspacecast as a foldable operand.
Added a test sink-addrspacecast.ll to verify this change.
Patch by Jingyue Wu.
llvm-svn: 209343
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index dc5f67b8c0b..6aa60c66b7e 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -1640,6 +1640,7 @@ bool AddressingModeMatcher::MatchScaledValue(Value *ScaleReg, int64_t Scale, static bool MightBeFoldableInst(Instruction *I) { switch (I->getOpcode()) { case Instruction::BitCast: + case Instruction::AddrSpaceCast: // Don't touch identity bitcasts. if (I->getType() == I->getOperand(0)->getType()) return false; @@ -1994,6 +1995,7 @@ 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() || |