[InstCombine] 'hoist xor-by-constant from xor-by-value': completely give up on consta...
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 29 Dec 2020 13:27:55 +0000 (16:27 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 29 Dec 2020 13:28:18 +0000 (16:28 +0300)
commit374ef57f1379d3d3bbe5bfb19f1d2ea7e79b6db9
treed283180059e066f01bab0b0ae1af017a802c0383
parent7486de1b2eced2cccc7b0b95598e9ab45039d700
[InstCombine] 'hoist xor-by-constant from xor-by-value': completely give up on constant exprs

As Mikael Holmén is noting in the post-commit review for the first fix
https://reviews.llvm.org/rGd4ccef38d0bb#967466
not hoisting constantexprs is not enough,
because if the xor originally was a constantexpr (i.e. X is a constantexpr).
`SimplifyAssociativeOrCommutative()` in `visitXor()` will immediately
undo this transform, thus again causing an infinite combine loop.

This transform has resulted in a surprising number of constantexpr failures.
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll