optimizeCompareInstr would stop searching if there are other EFLAG readers between the CmpInstr that we attempt to remove and the earlier instruction that we try to use instead. Example:
= SUB32rr %0, %1, implicit-def $eflags ... we no longer stop when there are $eflag users here CMP32rr %0, %1 ; will be removed ...
I don't see any reason why we cannot allow EFLAG readers between the two flag producers. Maybe it was an accident/artifact that wasn't obvious before the cleanups in D110857