[PATCH] D82998: [BasicAA] Enable -basic-aa-recphi by default

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 05:44:01 PDT 2020


bjope added a comment.

Here is a reproducer for the new problem that @uabelho noticed. Might be possible to reduce it further, but I think it at least show the problem:

  ; opt -basic-aa-recphi=0 -gvn -o - -S
  ; opt -basic-aa-recphi=1 -gvn -o - -S
  
  declare i16 @myprintf(i32)
  
  define i16 @main(i16 %argc.5.par, i16** nocapture readnone %argv.6.par) {
    %int_arr.10 = alloca [3 x i16], align 1
    %_tmp1 = getelementptr inbounds [3 x i16], [3 x i16]* %int_arr.10, i16 0, i16 2
    br label %bb1
  
  bb1:                                              ; preds = %bb1, %0
    %i.7.0 = phi i16 [ 2, %0 ], [ %_tmp5, %bb1 ]
    %ls1.9.0 = phi i16* [ %_tmp1, %0 ], [ %_tmp7, %bb1 ]
    store i16 %i.7.0, i16* %ls1.9.0, align 1
    %_tmp5 = add nsw i16 %i.7.0, -1
    %_tmp7 = getelementptr i16, i16* %ls1.9.0, i16 -1
    %_tmp9 = icmp sgt i16 %i.7.0, 0
    br i1 %_tmp9, label %bb1, label %bb3
  
  bb3:                                              ; preds = %bb1
    %_tmp11 = getelementptr inbounds [3 x i16], [3 x i16]* %int_arr.10, i16 0, i16 1
    %_tmp12 = load i16, i16* %_tmp11, align 1
    %_tmp13 = sext i16 %_tmp12 to i32
    %_tmp16 = call i16 @myprintf(i32 %_tmp13)
    %_tmp18.not = icmp eq i16 %_tmp12, 1
    br i1 %_tmp18.not, label %bb5, label %bb4
  
  bb4:                                              ; preds = %bb3
    ret i16 1
  
  bb5:                                              ; preds = %bb3, %bb4
    ret i16 0
  }

See https://godbolt.org/z/j59xxh for the diff.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82998





More information about the llvm-commits mailing list