[PATCH] D23469: Make the memory dependence queries in the memcpy optimizer nonlocal

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 15:48:14 PDT 2016


majnemer added a comment.

Thanks for the patch!

Could you please reduce the testcase? It contains quite a few unnecessary instructions.

Something along the lines of the following would be more appropriate:

  define void @wobble(i8* noalias nocapture sret %arg, i8* nocapture readonly dereferenceable(64) %arg1, i1 zeroext %arg3) local_unnamed_addr #0 {
  bb:
    %tmp51 = alloca [64 x i8], align 8
    %tmp51.sub = getelementptr inbounds [64 x i8], [64 x i8]* %tmp51, i64 0, i64 0
    call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp51.sub, i8* nonnull %arg1, i64 64, i32 8, i1 false)
    br i1 %arg3, label %bb11, label %bb12
  
  bb11:                                             ; preds = %bb
    tail call void @ham() #3
    unreachable
  
  bb12:                                             ; preds = %bb
    call void @llvm.memcpy.p0i8.p0i8.i64(i8* %arg, i8* %tmp51.sub, i64 64, i32 8, i1 false)
    ret void
  }
  
  ; Function Attrs: argmemonly nounwind
  declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1) #1
  
  ; Function Attrs: noreturn nounwind
  declare void @ham() local_unnamed_addr #2


Repository:
  rL LLVM

https://reviews.llvm.org/D23469





More information about the llvm-commits mailing list