This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] make simplifyUnsignedRangeCheck commutative for ZeroICmp
AbandonedPublic

Authored by khei4 on Mar 15 2023, 11:53 PM.

Details

Summary

on InstSimplify, simplifyUnsignedRangeCheck missed being commutative for inner equality comparison.
related Functional patch: https://reviews.llvm.org/D78430

Depends on https://reviews.llvm.org/D146195

Diff Detail

Event Timeline

khei4 created this revision.Mar 15 2023, 11:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 11:53 PM
khei4 requested review of this revision.Mar 15 2023, 11:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2023, 11:53 PM
nikic requested changes to this revision.Mar 16 2023, 1:31 AM

InstCombine canonicalizes constant icmp operands to the RHS, this is why constants are not usually handled on the LHS. Unless there is some PhaseOrdering reason why it is important to handle this pattern prior to the first InstCombine run, we shouldn't do this.

llvm/lib/Analysis/InstructionSimplify.cpp
1564

You can use m_c_ICmp.

This revision now requires changes to proceed.Mar 16 2023, 1:31 AM
khei4 abandoned this revision.Mar 16 2023, 1:57 AM

InstCombine canonicalizes constant icmp operands to the RHS, this is why constants are not usually handled on the LHS. Unless there is some PhaseOrdering reason why it is important to handle this pattern prior to the first InstCombine run, we shouldn't do this.

Oh, now I could have found that canonicalization. Thank you!