<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 21, 2015 at 6:54 AM, James Molloy <span dir="ltr"><<a href="mailto:james.molloy@arm.com" target="_blank">james.molloy@arm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi jingyue, wu, Gerolf,<br>
<br>
A single-offset GEP such as:<br>
<br>
  getelementptr i8*, i8* %base, i32 %offset<br></blockquote><div><br>Just out of pedantry/by way of explanation, that should be: getelementptr i8, i8* %base, ....<br><br>(note the first type parameter is the type pointed to, not the pointer type - this is part of the transition to opaque pointer types - so there will be no "pointer to i8" in the future, just a raw pointer and operations like gep will indicate how to treat the referenced bytes)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
doesn't make sense to split apart. There is no complex calculation to CSE.<br>
<br>
REPOSITORY<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D9149" target="_blank">http://reviews.llvm.org/D9149</a><br>
<br>
Files:<br>
  lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp<br>
  test/CodeGen/AArch64/arm64-addr-mode-folding.ll<br>
  test/CodeGen/AArch64/arm64-cse.ll<br>
  test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll<br>
<br>
Index: lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp<br>
===================================================================<br>
--- lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp<br>
+++ lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp<br>
@@ -829,7 +829,7 @@<br>
<br>
   // The backend can already nicely handle the case where all indices are<br>
   // constant.<br>
-  if (GEP->hasAllConstantIndices())<br>
+  if (GEP->hasAllConstantIndices() || GEP->getNumOperands() == 2)<br>
     return false;<br>
<br>
   bool Changed = canonicalizeArrayIndicesToPointerSize(GEP);<br>
Index: test/CodeGen/AArch64/arm64-addr-mode-folding.ll<br>
===================================================================<br>
--- test/CodeGen/AArch64/arm64-addr-mode-folding.ll<br>
+++ test/CodeGen/AArch64/arm64-addr-mode-folding.ll<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc -O3 -mtriple arm64-apple-ios3 -aarch64-gep-opt=false %s -o - | FileCheck %s<br>
+; RUN: llc -O3 -mtriple arm64-apple-ios3 %s -o - | FileCheck %s<br>
 ; <rdar://problem/13621857><br>
<br>
 @block = common global i8* null, align 8<br>
Index: test/CodeGen/AArch64/arm64-cse.ll<br>
===================================================================<br>
--- test/CodeGen/AArch64/arm64-cse.ll<br>
+++ test/CodeGen/AArch64/arm64-cse.ll<br>
@@ -1,4 +1,4 @@<br>
-; RUN: llc -O3 < %s -aarch64-atomic-cfg-tidy=0 -aarch64-gep-opt=false -verify-machineinstrs | FileCheck %s<br>
+; RUN: llc -O3 < %s -aarch64-atomic-cfg-tidy=0 -verify-machineinstrs | FileCheck %s<br>
 target triple = "arm64-apple-ios"<br>
<br>
 ; rdar://12462006<br>
@@ -12,7 +12,7 @@<br>
 ; CHECK-NOT: sub<br>
 ; CHECK: <a href="http://b.ge" target="_blank">b.ge</a><br>
 ; CHECK: sub<br>
-; CHECK: sub<br>
+; CHECK: {{sub|add}}<br>
 ; CHECK-NOT: sub<br>
 ; CHECK: ret<br>
  %0 = load i32, i32* %offset, align 4<br>
Index: test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll<br>
===================================================================<br>
--- test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll<br>
+++ test/Transforms/SeparateConstOffsetFromGEP/NVPTX/split-gep.ll<br>
@@ -237,7 +237,7 @@<br>
<br>
 ; The code that rebuilds an OR expression used to be buggy, and failed on this<br>
 ; test.<br>
-define float* @shl_add_or(i64 %a, float* %ptr) {<br>
+define float* @shl_add_or(i64 %a, [10 x float]* %ptr) {<br>
 ; CHECK-LABEL: @shl_add_or(<br>
 entry:<br>
   %shl = shl i64 %a, 2<br>
@@ -247,8 +247,8 @@<br>
   ; ((a << 2) + 12) and 1 have no common bits. Therefore,<br>
   ; SeparateConstOffsetFromGEP is able to extract the 12.<br>
   ; TODO(jingyue): We could reassociate the expression to combine 12 and 1.<br>
-  %p = getelementptr float, float* %ptr, i64 %or<br>
-; CHECK: [[PTR:%[a-zA-Z0-9]+]] = getelementptr float, float* %ptr, i64 [[OR]]<br>
+  %p = getelementptr [10 x float], [10 x float]* %ptr, i64 %or, i64 0<br>
+; CHECK: [[PTR:%[a-zA-Z0-9]+]] = getelementptr [10 x float], [10 x float]* %ptr, i64 [[OR]], i64 0<br>
 ; CHECK: getelementptr float, float* [[PTR]], i64 12<br>
   ret float* %p<br>
 ; CHECK-NEXT: ret<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>