[InstCombine] Transform `(binop1 (binop2 (lshift X,Amt),Mask),(lshift Y,Amt))`
If `Mask` and `Amt` are not constants and `binop1` and `binop2` are the same we can transform to: `(binop (lshift (binop X, Y), Amt), Mask)` If `binop` is `add`, `lshift` must be `shl`. If `Mask` and `Amt` are constants `C` and `C1` respectively. We can transform to: `(lshift1 (binop1 (binop2 X, (inv_lshift1 C, C1), Y)), C1)` Saving an instruction IFF: `lshift1` is same opcode as `lshift2` Either `bitwise1` and/or `bitwise2` is `and`. Proofs(1/2): https://alive2.llvm.org/ce/z/BjN-m_ Proofs(2/2): https://alive2.llvm.org/ce/z/bZn5QB This is to help fix the regression caused in D151807 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D152568
Loading
Please sign in to comment