[PATCH] [SLSR] simplify ternary adds by reassociation

Sanjoy Das sanjoy at playingwithpointers.com
Wed Apr 8 13:23:28 PDT 2015


Should this rule live inside `-reassociate`?  Optimizing

   define void @reassociate(i32 %a, i32 %b, i32 %c) {
    %1 = add i32 %a, %c
    call void @foo(i32 %1)
    %2 = add i32 %a, %b
    %3 = add i32 %2, %c
    call void @foo(i32 %3)
    ret void
  }

to

   define void @reassociate(i32 %a, i32 %b, i32 %c) {
    %1 = add i32 %a, %c
    call void @foo(i32 %1)
    %3 = add i32 %1, %b
    call void @foo(i32 %3)
    ret void
  }

looks like a generally good idea to me.


http://reviews.llvm.org/D8898

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list