[InstSimplify] Simplify icmp between Shl instructions of the same value
define i1 @compare_vscales() { %vscale = call i64 @llvm.vscale.i64() %vscalex2 = shl nuw nsw i64 %vscale, 1 %vscalex4 = shl nuw nsw i64 %vscale, 2 %cmp = icmp ult i64 %vscalex2, %vscalex4 ret i1 %cmp }
This IR is currently emitted by LLVM. This icmp is redundant as this snippet
can be simplified to true or false as both operands originate from the same
@llvm.vscale.i64() call.
Proof of concept:
https://alive2.llvm.org/ce/z/KCrE8j
https://alive2.llvm.org/ce/z/wH8vBN
This function isn't really needed, see my other comment further down for details.