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 | 107db21c2b8e16dc8c18c5c5e13056b6a9deedcf (patch) | |
tree | 9d3aaa72cc38dd1e1508795d191933bb5b1d4255 /lib/CodeGen/CodeGenPrepare.cpp | |
parent | a2f371b8eb440d0fac62b879e82e442938413bbd (diff) | |
download | llvm-107db21c2b8e16dc8c18c5c5e13056b6a9deedcf.tar.gz llvm-107db21c2b8e16dc8c18c5c5e13056b6a9deedcf.tar.bz2 llvm-107db21c2b8e16dc8c18c5c5e13056b6a9deedcf.tar.xz |
Similar to bitcast, treat addrspacecast as a foldable operand.
Added a test sink-addrspacecast.ll to verify this change.
Patch by Jingyue Wu.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenPrepare.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index dc5f67b8c0..6aa60c66b7 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/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() || |