summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-07-08 21:17:51 +0000
committerSanjay Patel <spatel@rotateright.com>2016-07-08 21:17:51 +0000
commit664514f7fe1451c5a41e871e6174677f941c9548 (patch)
tree5fdfed3f16f12f035bf56ccab8e25adb9961f37b /llvm/lib/Transforms/InstCombine
parent68f499a6fa5e3b52b08f920f61d6f73f9aa57bcf (diff)
downloadbcm5719-llvm-664514f7fe1451c5a41e871e6174677f941c9548.tar.gz
bcm5719-llvm-664514f7fe1451c5a41e871e6174677f941c9548.zip
[InstCombine] don't form select from bitcasted logic ops if bitcasts have >1 use
This isn't a sure thing (are 2 extra bitcasts less expensive than a logic op?), but we'll try to err on the conservative side by going with the case that has less IR instructions. Note: This question came up in http://reviews.llvm.org/D22114 , but this part is independent of that patch proposal, so I'm making this small change ahead of that one. See also: http://reviews.llvm.org/rL274926 llvm-svn: 274932
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 3865572e816..01a5152131b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -1619,8 +1619,8 @@ static Value *matchSelectFromAndOr(Value *A, Value *C, Value *B, Value *D,
// through its bitcast and the corresponding bitcast of the 'not' condition.
Type *OrigType = A->getType();
Value *SrcA, *SrcB;
- if (match(A, m_BitCast(m_Value(SrcA))) &&
- match(B, m_BitCast(m_Value(SrcB)))) {
+ if (match(A, m_OneUse(m_BitCast(m_Value(SrcA)))) &&
+ match(B, m_OneUse(m_BitCast(m_Value(SrcB))))) {
A = SrcA;
B = SrcB;
}
OpenPOWER on IntegriCloud