[LLVMdev] Canonical rules

Dan Gohman gohman at apple.com
Tue Mar 23 08:24:15 PDT 2010



On Mar 23, 2010, at 4:07 AM, Hranáč Jan <xhrana01 at stud.fit.vutbr.cz>  
wrote:

> LLVM version: 2.6
> Query context: Automatic generator of LLVM backends.
>
> Query:
> What are canonical rules for initial DAG (generated by LLVM)?
> Are there any at all?
> Example:
> Commutative operations. Are operations like
> X = 1 + REG
> automatically transformed into
> X = REG + 1
> ?

The order of operands of an Add is not essential.  Robust components  
should be able to behave correctly with either form.

Canonicalization simplifies optimization code, eliminating the need to  
recognize all possible trivial variants of a particular pattern.  But  
if canonicalization is disabled or bypassed (and there are a few  
different ways this can happen), everything should still be  
conservatively correct.

Dan
>






More information about the llvm-dev mailing list