diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-02 02:43:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-02 02:43:51 +0000 |
commit | 39ceb471b7ebaf0ebef09f7916419ae2e0f30acc (patch) | |
tree | 84e7fffc926ecc8b008d545f49f4be696d1039df /lib/Transforms | |
parent | 3a819568ca4ce1fdf04764ff466678e687479921 (diff) | |
download | external_llvm-39ceb471b7ebaf0ebef09f7916419ae2e0f30acc.zip external_llvm-39ceb471b7ebaf0ebef09f7916419ae2e0f30acc.tar.gz external_llvm-39ceb471b7ebaf0ebef09f7916419ae2e0f30acc.tar.bz2 |
don't turn (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : B
for vectors. Codegen is generating awful code or segfaulting
in various cases (e.g. PR6204).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 806e7b5..f79e4fa 100644 --- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -1591,15 +1591,19 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { } } - // (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : B, and commuted variants - if (Instruction *Match = MatchSelectFromAndOr(A, B, C, D)) - return Match; - if (Instruction *Match = MatchSelectFromAndOr(B, A, D, C)) - return Match; - if (Instruction *Match = MatchSelectFromAndOr(C, B, A, D)) - return Match; - if (Instruction *Match = MatchSelectFromAndOr(D, A, B, C)) - return Match; + // (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : B, and commuted variants. + // Don't do this for vector select idioms, the code generator doesn't handle + // them well yet. + if (!isa<VectorType>(I.getType())) { + if (Instruction *Match = MatchSelectFromAndOr(A, B, C, D)) + return Match; + if (Instruction *Match = MatchSelectFromAndOr(B, A, D, C)) + return Match; + if (Instruction *Match = MatchSelectFromAndOr(C, B, A, D)) + return Match; + if (Instruction *Match = MatchSelectFromAndOr(D, A, B, C)) + return Match; + } // ((A&~B)|(~A&B)) -> A^B if ((match(C, m_Not(m_Specific(D))) && |