diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-08-16 22:38:34 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-08-16 22:38:34 +0000 |
commit | 55919a9ed70ca3e826c7ef4216e349958e03b562 (patch) | |
tree | 5ddf4b34f1c7c40ce331089e030d18f1de1b7dc7 /llvm/lib | |
parent | f87d6c00e78690a422362b1118e6460666108b63 (diff) | |
download | bcm5719-llvm-55919a9ed70ca3e826c7ef4216e349958e03b562.tar.gz bcm5719-llvm-55919a9ed70ca3e826c7ef4216e349958e03b562.zip |
Extend the undef ^ undef idiom once more. No testcase: I can't figure out how to actually trigger the codepath in question at the moment, but it might get exposed in the future.
llvm-svn: 137781
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index cfff9c03c83..89e55a46516 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -1348,6 +1348,11 @@ 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; @@ -1356,10 +1361,6 @@ 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)))) |