diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-07-30 21:26:37 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-07-30 21:26:37 +0000 |
commit | 42af3601c29a521cec564c2c55e43f9751494b8e (patch) | |
tree | feffa04ccfa985f458c4cd71aff9389119c8efcb /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 2aa09d4319ff20528806bbb85844559b22347294 (diff) | |
download | llvm-42af3601c29a521cec564c2c55e43f9751494b8e.zip llvm-42af3601c29a521cec564c2c55e43f9751494b8e.tar.gz llvm-42af3601c29a521cec564c2c55e43f9751494b8e.tar.bz2 |
InstCombine: Simplify (A ^ B) or/and (A ^ B ^ C)
While we can already transform A | (A ^ B) into A | B, things get bad
once we have (A ^ B) | (A ^ B ^ Cst) because reassociation will morph
this into (A ^ B) | ((A ^ Cst) ^ B). Our existing patterns fail once
this happens.
To fix this, we add a new pattern which looks through the tree of xor
binary operators to see that, in fact, there exists a redundant xor
operation.
What follows bellow is a correctness proof of the transform using CVC3.
$ cat t.cvc
A, B, C : BITVECTOR(64);
QUERY BVXOR(A, B) | BVXOR(BVXOR(B, C), A) = BVXOR(A, B) | C;
QUERY BVXOR(BVXOR(A, C), B) | BVXOR(A, B) = BVXOR(A, B) | C;
QUERY BVXOR(A, B) & BVXOR(BVXOR(B, C), A) = BVXOR(A, B) & ~C;
QUERY BVXOR(BVXOR(A, C), B) & BVXOR(A, B) = BVXOR(A, B) & ~C;
$ cvc3 < t.cvc
Valid.
Valid.
Valid.
Valid.
llvm-svn: 214342
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions