[LICM] Reassociate & hoist add expressions
This patch allows LICM to reassociate and hoist following expressions: ``` loop: %sum = add nsw %iv, %C1 %cmp = icmp <signed pred> %sum, C2 ``` where `C1` and `C2` are loop invariants. The reassociated version looks like ``` preheader: %inv_sum = C2 - C1 ... loop: %cmp = icmp <signed pred> %iv, %inv_sum ``` In order to prove legality, we need both initial addition and the newly created subtraction to happen without overflow. Differential Revision: https://reviews.llvm.org/D149132 Reviewed By: skatkov
Loading
Please sign in to comment