[llvm-branch-commits] [llvm-branch] r96546 - in /llvm/branches/Apple/Hermes: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp test/Transforms/InstCombine/crash.ll

Dan Gohman gohman at apple.com
Wed Feb 17 16:58:41 PST 2010


Author: djg
Date: Wed Feb 17 18:58:40 2010
New Revision: 96546

URL: http://llvm.org/viewvc/llvm-project?rev=96546&view=rev
Log:
$ svn merge -c 95642 https://djg@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r95642 into '.':
U    test/Transforms/InstCombine/crash.ll
U    lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Modified:
    llvm/branches/Apple/Hermes/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    llvm/branches/Apple/Hermes/test/Transforms/InstCombine/crash.ll

Modified: llvm/branches/Apple/Hermes/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=96546&r1=96545&r2=96546&view=diff

==============================================================================
--- llvm/branches/Apple/Hermes/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/branches/Apple/Hermes/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Wed Feb 17 18:58:40 2010
@@ -1160,19 +1160,24 @@
                                          Value *C, Value *D) {
   // If A is not a select of -1/0, this cannot match.
   Value *Cond = 0;
-  if (!match(A, m_SExt(m_Value(Cond))))
+  if (!match(A, m_SExt(m_Value(Cond))) ||
+      !Cond->getType()->isInteger(1))
     return 0;
 
   // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B.
-  if (match(D, m_Not(m_SExt(m_Specific(Cond)))))
+  if (match(D, m_Not(m_SExt(m_Specific(Cond)))) &&
+      Cond->getType()->isInteger(1))
     return SelectInst::Create(Cond, C, B);
-  if (match(D, m_SExt(m_Not(m_Specific(Cond)))))
+  if (match(D, m_SExt(m_Not(m_Specific(Cond)))) &&
+      Cond->getType()->isInteger(1))
     return SelectInst::Create(Cond, C, B);
   
   // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D.
-  if (match(B, m_Not(m_SExt(m_Specific(Cond)))))
+  if (match(B, m_Not(m_SExt(m_Specific(Cond)))) &&
+      Cond->getType()->isInteger(1))
     return SelectInst::Create(Cond, C, D);
-  if (match(B, m_SExt(m_Not(m_Specific(Cond)))))
+  if (match(B, m_SExt(m_Not(m_Specific(Cond)))) &&
+      Cond->getType()->isInteger(1))
     return SelectInst::Create(Cond, C, D);
   return 0;
 }

Modified: llvm/branches/Apple/Hermes/test/Transforms/InstCombine/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/test/Transforms/InstCombine/crash.ll?rev=96546&r1=96545&r2=96546&view=diff

==============================================================================
--- llvm/branches/Apple/Hermes/test/Transforms/InstCombine/crash.ll (original)
+++ llvm/branches/Apple/Hermes/test/Transforms/InstCombine/crash.ll Wed Feb 17 18:58:40 2010
@@ -226,3 +226,14 @@
   ret void
 }
 
+
+; PR6193
+define i32 @test11(i32 %aMaskWidth, i8 %aStride) nounwind {
+entry:
+  %conv41 = sext i8 %aStride to i32
+  %neg = xor i32 %conv41, -1
+  %and42 = and i32 %aMaskWidth, %neg
+  %and47 = and i32 130, %conv41
+  %or = or i32 %and42, %and47
+  ret i32 %or
+}





More information about the llvm-branch-commits mailing list