aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-11-07 00:16:28 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-11-07 00:16:28 +0000
commit9d0b704e3ea418441001dac4d1a56c2c224cdbf5 (patch)
tree2780b6fda90bfd498c8a016222aa8713ac6890a1 /test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
parentbd79fc8ef2543c16239f840a03b6c338cf42399d (diff)
Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message: This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments. Update CreateMalloc so that its callers specify the size to allocate: MallocInst-autoupgrade users use non-TargetData-computed allocation sizes. Optimization uses use TargetData to compute the allocation size. Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays. Extend getMallocType() to support malloc calls that have non-bitcast uses. Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly. Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use. Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use. Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll')
-rw-r--r--test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll b/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
index abd31094bf..d3c3ff59fe 100644
--- a/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
+++ b/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -globalopt
+target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
%struct.s_annealing_sched = type { i32, float, float, float, float }
%struct.s_bb = type { i32, i32, i32, i32 }
@@ -96,7 +97,9 @@ bb.i34: ; preds = %bb
unreachable
bb1.i38: ; preds = %bb
- %0 = malloc %struct.s_net, i32 undef ; <%struct.s_net*> [#uses=1]
+ %mallocsize = mul i64 28, undef ; <i64> [#uses=1]
+ %malloccall = tail call i8* @malloc(i64 %mallocsize) ; <i8*> [#uses=1]
+ %0 = bitcast i8* %malloccall to %struct.s_net* ; <%struct.s_net*> [#uses=1]
br i1 undef, label %bb.i1.i39, label %my_malloc.exit2.i
bb.i1.i39: ; preds = %bb1.i38
@@ -115,3 +118,5 @@ my_malloc.exit8.i: ; preds = %my_malloc.exit2.i
bb7: ; preds = %bb6.preheader
unreachable
}
+
+declare noalias i8* @malloc(i64)