Hi all, >>> if (a == b) >>> ... >>> >>> # c = PHI <a, b> >>> >>> where we'd lose eliding such a conditional. IMHO that's bad >>> and very undesirable. >> But if we only suppress this optimization for pointers is it that terrible? > > I've at least seen a lot of cases with c = PHI <a, 0> for null pointer > checks. It's just we're going to chase a lot of cases down even > knowing RTL will fuck up later big times.
Even if pointer substitution based on "==" is not possible in general, it can still be possible (depending on other choices in the IR semantics) to do substitution for "== NULL" pointer tests. This is the conclusion we came to when studying similar questions for LLVM IR in <https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf>. Kind regards, Ralf