[PATCH] D126638: [CGP] Also freeze ctlz/cttz operand when despeculating

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 06:08:33 PDT 2022


spatel added a comment.

In D126638#3569452 <https://reviews.llvm.org/D126638#3569452>, @nikic wrote:

> For what input is that? As far as I can tell, AArch64 never uses despeculation, and ARM uses a libcall legalization where it makes no difference. I'm trying this one:

I was experimenting with tests based on the IR in the regression test in this patch, so just changing the frozen value alone after doing the despeculation:

  define i32 @tgt(i32 %A) {
  entry:
    %f = freeze i32 %A
    %i = icmp eq i32 %f, 0
    br i1 %i, label %end, label %false
  false:
    %z = call i32 @llvm.ctlz.i32(i32 %A, i1 true)
    br label %end
  end:
    %ctz = phi i32 [ 32, %entry ], [ %z, %false ]
    ret i32 %ctz
  }
  
  define i32 @tgt2(i32 %A) {
  entry:
    %f = freeze i32 %A
    %i = icmp eq i32 %f, 0
    br i1 %i, label %end, label %false
  false:
    %z = call i32 @llvm.ctlz.i32(i32 %f, i1 true)
    br label %end
  end:
    %ctz = phi i32 [ 32, %entry ], [ %z, %false ]
    ret i32 %ctz
  }

And then sending that through llc with:
$ llc -o - ctlz.ll -mtriple=aarch64
$ llc -o - ctlz.ll -mtriple=armv7

I used 'v7' with arm; I do see the libcalls with base 'arm' codegen.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126638/new/

https://reviews.llvm.org/D126638



More information about the llvm-commits mailing list