summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/CodeGenPrepare/ARM
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2018-09-12 10:19:10 +0000
committerDavid Green <david.green@arm.com>2018-09-12 10:19:10 +0000
commite27e87cdcb0b4dd56806434bc31fabe8e24e9972 (patch)
treedb23aeee10eeec3140c7a1b13e1f0450682703df /llvm/test/Transforms/CodeGenPrepare/ARM
parent10fb67728593478671d75403c6bf8683db60c9d3 (diff)
downloadbcm5719-llvm-e27e87cdcb0b4dd56806434bc31fabe8e24e9972.tar.gz
bcm5719-llvm-e27e87cdcb0b4dd56806434bc31fabe8e24e9972.zip
[CGP] Ensure splitgep gives deterministic output
The output of splitLargeGEPOffsets does not appear to be deterministic because of the way that we iterate over a DenseMap. I've changed it to a MapVector for consistent output. The test here isn't particularly great, only showing a consmetic difference in output. The original reproducer is much larger but show a diffierence in instruction ordering, leading to different codegen. Differential Revision: https://reviews.llvm.org/D51851 llvm-svn: 342043
Diffstat (limited to 'llvm/test/Transforms/CodeGenPrepare/ARM')
-rw-r--r--llvm/test/Transforms/CodeGenPrepare/ARM/splitgep.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/ARM/splitgep.ll b/llvm/test/Transforms/CodeGenPrepare/ARM/splitgep.ll
new file mode 100644
index 00000000000..b2edb852385
--- /dev/null
+++ b/llvm/test/Transforms/CodeGenPrepare/ARM/splitgep.ll
@@ -0,0 +1,40 @@
+; RUN: opt -S -codegenprepare %s | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+target triple = "thumbv6m-arm-none-eabi"
+
+; Check that we have deterministic output
+define void @test([65536 x i32]** %sp, [65536 x i32]* %t, i32 %n) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: %0 = bitcast [65536 x i32]* %t to i8*
+; CHECK-NEXT: %splitgep1 = getelementptr i8, i8* %0, i32 80000
+; CHECK-NEXT: %s = load [65536 x i32]*, [65536 x i32]** %sp
+; CHECK-NEXT: %1 = bitcast [65536 x i32]* %s to i8*
+; CHECK-NEXT: %splitgep = getelementptr i8, i8* %1, i32 80000
+entry:
+ %s = load [65536 x i32]*, [65536 x i32]** %sp
+ br label %while_cond
+
+while_cond:
+ %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
+ %gep0 = getelementptr [65536 x i32], [65536 x i32]* %s, i64 0, i32 20000
+ %gep1 = getelementptr [65536 x i32], [65536 x i32]* %s, i64 0, i32 20001
+ %gep2 = getelementptr [65536 x i32], [65536 x i32]* %t, i64 0, i32 20000
+ %gep3 = getelementptr [65536 x i32], [65536 x i32]* %t, i64 0, i32 20001
+ %cmp = icmp slt i32 %phi, %n
+ br i1 %cmp, label %while_body, label %while_end
+
+while_body:
+ %i = add i32 %phi, 1
+ %j = add i32 %phi, 2
+ store i32 %i, i32* %gep0
+ store i32 %phi, i32* %gep1
+ store i32 %i, i32* %gep2
+ store i32 %phi, i32* %gep3
+ br label %while_cond
+
+while_end:
+ ret void
+}
+
OpenPOWER on IntegriCloud