Revert r137781; I agree with Duncan's comment that the situation in question is clear...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 17 Aug 2011 19:31:49 +0000 (19:31 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 17 Aug 2011 19:31:49 +0000 (19:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137853 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InstructionSimplify.cpp

index 89e55a46516876bbe4642dfd4e75ab16d09c1b24..cfff9c03c837f325ab839ed3596b512f68f58b33 100644 (file)
@@ -1348,11 +1348,6 @@ static Value *SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD,
     std::swap(Op0, Op1);
   }
 
-  // A ^ A = 0
-  // Do this first so that we catch the undef ^ undef "idiom".
-  if (Op0 == Op1)
-    return Constant::getNullValue(Op0->getType());
-
   // A ^ undef -> undef
   if (match(Op1, m_Undef()))
     return Op1;
@@ -1361,6 +1356,10 @@ static Value *SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD,
   if (match(Op1, m_Zero()))
     return Op0;
 
+  // A ^ A = 0
+  if (Op0 == Op1)
+    return Constant::getNullValue(Op0->getType());
+
   // A ^ ~A  =  ~A ^ A  =  -1
   if (match(Op0, m_Not(m_Specific(Op1))) ||
       match(Op1, m_Not(m_Specific(Op0))))