HomePhabricator

[InstCombine] Simplify compare of Phi with constant inputs against a constant

Authored by mkazantsev on Jun 5 2020, 2:43 AM.

Description

[InstCombine] Simplify compare of Phi with constant inputs against a constant

We can simplify

icmp <pred> phi(C1, C2, ...), C

with

phi(icmp(C1, C), icmp(C2, C), ...)

provided that all comparison of constants are constants themselves.

Differential Revision: https://reviews.llvm.org/D81151
Reviewed By: lebedev.ri