[PATCH] SimplifyCFG: turn recursive GatherConstantCompares into iterative

Chad Rosier mcrosier at codeaurora.org
Mon Nov 17 12:01:05 PST 2014


> As a side question, the existing code assumes that the "icmp" are always
> taking the constant as the second operand (it never tries to match the
> first operand). Is it something that is canonicalized in the IR and can be
> assumed here?

AFAIK, it's the preferred form in IR and I've seen a lot of code that make
this assumption.  However, you should investigate on a case by case basis.
 I'm not aware of any pass or verifier that strictly enforces this
standard across all optimizations/passes.

As an aside, the reassociate pass now canonicalizes constants of binary
operators to the RHS.  This doesn't include icmp instructions, however. 
Later passes may obliterate this canonicalization.

 HTH, Chad




More information about the llvm-commits mailing list