May 2015
Intermediate to advanced
296 pages
5h 10m
English
In this recipe, you will learn about reassociating expressions and how it helps in optimization.
The opt tool should be installed for this recipe to work.
$ cat testreassociate.ll define i32 @test(i32 %b, i32 %a) { %tmp.1 = add i32 %a, 1234 %tmp.2 = add i32 %b, %tmp.1 %tmp.4 = xor i32 %a, -1 ; (b+(a+1234))+~a -> b+1233 %tmp.5 = add i32 %tmp.2, %tmp.4 ret i32 %tmp.5 }
$ opt testreassociate.ll –reassociate –die –S define i32 @test(i32 %b, i32 %a) { %tmp.5 = add i32 %b, 1233 ret i32 %tmp.5 }
By reassociation, we mean applying algebraic properties ...
Read now
Unlock full access