[llvm-branch-commits] [llvm-branch] r288070 - Merging r283612:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 28 13:35:42 PST 2016


Author: tstellar
Date: Mon Nov 28 15:35:41 2016
New Revision: 288070

URL: http://llvm.org/viewvc/llvm-project?rev=288070&view=rev
Log:
Merging r283612:

------------------------------------------------------------------------
r283612 | davide | 2016-10-07 14:53:09 -0700 (Fri, 07 Oct 2016) | 5 lines

[InstCombine] Don't unpack arrays that are too large (part 2).

This is similar to r283599, but for store instructions.
Thanks to David for pointing out!

------------------------------------------------------------------------

Modified:
    llvm/branches/release_39/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    llvm/branches/release_39/test/Transforms/InstCombine/unpack-fca.ll

Modified: llvm/branches/release_39/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=288070&r1=288069&r2=288070&view=diff
==============================================================================
--- llvm/branches/release_39/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)
+++ llvm/branches/release_39/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Mon Nov 28 15:35:41 2016
@@ -1088,6 +1088,13 @@ static bool unpackStoreToAggregate(InstC
       return true;
     }
 
+    // Bail out if the array is too large. Ideally we would like to optimize
+    // arrays of arbitrary size but this has a terrible impact on compile time.
+    // The threshold here is chosen arbitrarily, maybe needs a little bit of
+    // tuning.
+    if (NumElements > 1024)
+      return false;
+
     const DataLayout &DL = IC.getDataLayout();
     auto EltSize = DL.getTypeAllocSize(AT->getElementType());
     auto Align = SI.getAlignment();

Modified: llvm/branches/release_39/test/Transforms/InstCombine/unpack-fca.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/Transforms/InstCombine/unpack-fca.ll?rev=288070&r1=288069&r2=288070&view=diff
==============================================================================
--- llvm/branches/release_39/test/Transforms/InstCombine/unpack-fca.ll (original)
+++ llvm/branches/release_39/test/Transforms/InstCombine/unpack-fca.ll Mon Nov 28 15:35:41 2016
@@ -49,6 +49,15 @@ define void @storeArrayOfA([1 x %A]* %aa
   ret void
 }
 
+define void @storeLargeArrayOfA([2000 x %A]* %aa.ptr) {
+; CHECK-LABEL: storeLargeArrayOfA
+; CHECK-NEXT: store [2000 x %A]
+; CHECK-NEXT: ret void
+  %i1 = insertvalue [2000 x %A] undef, %A { %A__vtbl* @A__vtblZ }, 1
+  store [2000 x %A] %i1, [2000 x %A]* %aa.ptr, align 8
+  ret void
+}
+
 define void @storeStructOfArrayOfA({ [1 x %A] }* %saa.ptr) {
 ; CHECK-LABEL: storeStructOfArrayOfA
 ; CHECK-NEXT: [[GEP:%[a-z0-9\.]+]] = getelementptr inbounds { [1 x %A] }, { [1 x %A] }* %saa.ptr, i64 0, i32 0, i64 0, i32 0




More information about the llvm-branch-commits mailing list