[InstCombine] reduce xor-of-or's bitwise logic (PR46955); 2nd try
authorSanjay Patel <spatel@rotateright.com>
Mon, 3 Aug 2020 13:19:11 +0000 (09:19 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 3 Aug 2020 14:21:56 +0000 (10:21 -0400)
commit23693ffc3ba6146a22cd1e9373e25dc1e1a41a17
tree5eb7e257a3b67744aae187f6d5130b9e841b49c4
parent2d8ca4ae2b1a512d31566e042a4bf4fa1043def9
[InstCombine] reduce xor-of-or's bitwise logic (PR46955); 2nd try

The 1st try at this (rG2265d01f2a5b) exposed what looks like
unspecified behavior in C/C++ resulting in test variations.

The arguments to BinaryOperator::CreateAnd() were both IRBuilder
function calls, and the order in which they execute determines
the order of the new instructions in the IR. But the order of
function arg evaluation is not fixed by the rules of C/C++, so
depending on compiler config, the test would fail because the
test expected a single fixed ordering of instructions.

Original commit message:
I tried to use m_Deferred() on this, but didn't find
a clean way to do that.

http://bugs.llvm.org/PR46955

https://alive2.llvm.org/ce/z/2h6QTq
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/xor.ll