summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2015-12-11 13:36:59 +0000
committerJames Molloy <james.molloy@arm.com>2015-12-11 13:36:59 +0000
commit1bb6ea5e2d3a7ae89e48af43fb63574ea39c9b6d (patch)
tree18ebb304b5ef7af3687c8a318ea72cf19b815921 /llvm/test
parent027158fad7a335400d4b1bd08225316ecf971e0f (diff)
downloadbcm5719-llvm-1bb6ea5e2d3a7ae89e48af43fb63574ea39c9b6d.tar.gz
bcm5719-llvm-1bb6ea5e2d3a7ae89e48af43fb63574ea39c9b6d.zip
[Mem2Reg] Respect optnone
Mem2Reg shouldn't be optimizing a function that is marked optnone. There is a test checking this that fails when mem2reg is explicitly added to the standard pass pipeline. llvm-svn: 255336
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/Mem2Reg/optnone.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Mem2Reg/optnone.ll b/llvm/test/Transforms/Mem2Reg/optnone.ll
new file mode 100644
index 00000000000..41ee77aff79
--- /dev/null
+++ b/llvm/test/Transforms/Mem2Reg/optnone.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -mem2reg -S | FileCheck %s
+
+; This function is optnone, so the allocas should not be eliminated.
+
+; CHECK-LABEL: @testfunc
+; CHECK: alloca
+; CHECK: alloca
+define double @testfunc(i32 %i, double %j) optnone noinline {
+ %I = alloca i32 ; <i32*> [#uses=4]
+ %J = alloca double ; <double*> [#uses=2]
+ store i32 %i, i32* %I
+ store double %j, double* %J
+ %t1 = load i32, i32* %I ; <i32> [#uses=1]
+ %t2 = add i32 %t1, 1 ; <i32> [#uses=1]
+ store i32 %t2, i32* %I
+ %t3 = load i32, i32* %I ; <i32> [#uses=1]
+ %t4 = sitofp i32 %t3 to double ; <double> [#uses=1]
+ %t5 = load double, double* %J ; <double> [#uses=1]
+ %t6 = fmul double %t4, %t5 ; <double> [#uses=1]
+ ret double %t6
+}
OpenPOWER on IntegriCloud