[PATCH] D12116: [AArch64] Improve load/store optimizer to handle LDUR + LDR.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 17:05:18 PDT 2015


mzolotukhin added a comment.

Hi Chad, Ahmed,

I ran some testing for this patch and found a bug there. The issue is that when we scale offset, we need to make sure that the original value is divisible by the scale factor. Here is a test to illustrate the issue:

  define <2 x i64> @test4(i64* %p) nounwind {
    %a1 = bitcast i64* %p to <2 x i64>*
    %tmp1 = load <2 x i64>, < 2 x i64>* %a1, align 8           # Load <p[0], p[1]>
  
    %add.ptr2 = getelementptr inbounds i64, i64* %p, i64 3
    %a2 = bitcast i64* %add.ptr2 to <2 x i64>*
    %tmp2 = load <2 x i64>, <2 x i64>* %a2, align 8            # Load <p[3], p[4]>
    %add = add nsw <2 x i64> %tmp1, %tmp2
    ret <2 x i64> %add
  }

The current patch will combine these two loads, which is incorrect.

Michael


Repository:
  rL LLVM

http://reviews.llvm.org/D12116





More information about the llvm-commits mailing list