[LICM] Ensure LICM can hoist invariant.group
authorWilliam S. Moses <gh@wsmoses.com>
Tue, 14 Feb 2023 23:36:07 +0000 (18:36 -0500)
committerWilliam S. Moses <gh@wsmoses.com>
Sun, 26 Feb 2023 17:41:41 +0000 (12:41 -0500)
commit58eac856ccc0d7d0f6760b07c6be1537d970cda3
tree1461b80aa880899f1705664c2225a2bbaafb4dba
parent74ad19c25d7217d8f580a21d12fd4c784a1a0094
[LICM] Ensure LICM can hoist invariant.group

Invariant.group's are not sufficiently handled by LICM. Specifically,
if a given invariant.group loaded pointer is not overwritten between
the start of a loop, and its use in the load, it can be hoisted.
The invariant.group (on an already invariant pointer operand) ensures
the result is the same. If it is not overwritten between the start
of the loop and the load, it is therefore legal to hoist.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D144053
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/invariant.group.ll [new file with mode: 0644]