summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SCCP
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-17 07:59:14 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-17 07:59:14 +0000
commit83b3d8267225d585678d5d3af9bba5735f4b415d (patch)
tree9d6c2ad7bfd568186e83a39e6f03e1c0bf415715 /llvm/test/Transforms/SCCP
parent100602d7561ca5e245db6194bddae86357d203d4 (diff)
downloadbcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.tar.gz
bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.zip
Regression is gone, don't try to find it on clean target.
llvm-svn: 33296
Diffstat (limited to 'llvm/test/Transforms/SCCP')
-rw-r--r--llvm/test/Transforms/SCCP/.cvsignore3
-rw-r--r--llvm/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll23
-rw-r--r--llvm/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll7
-rw-r--r--llvm/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll20
-rw-r--r--llvm/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll39
-rw-r--r--llvm/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll10
-rw-r--r--llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll33
-rw-r--r--llvm/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll15
-rw-r--r--llvm/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll14
-rw-r--r--llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll11
-rw-r--r--llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll128
-rw-r--r--llvm/test/Transforms/SCCP/2006-12-04-PackedType.ll149
-rw-r--r--llvm/test/Transforms/SCCP/2006-12-19-UndefBug.ll7
-rw-r--r--llvm/test/Transforms/SCCP/basictest.ll16
-rw-r--r--llvm/test/Transforms/SCCP/calltest.ll24
-rw-r--r--llvm/test/Transforms/SCCP/dg.exp3
-rw-r--r--llvm/test/Transforms/SCCP/ipsccp-basic.ll13
-rw-r--r--llvm/test/Transforms/SCCP/ipsccp-conditional.ll19
-rw-r--r--llvm/test/Transforms/SCCP/ipsccp-gvar.ll23
-rw-r--r--llvm/test/Transforms/SCCP/loadtest.ll26
-rw-r--r--llvm/test/Transforms/SCCP/logical-nuke.ll8
-rw-r--r--llvm/test/Transforms/SCCP/phitest.ll23
-rw-r--r--llvm/test/Transforms/SCCP/sccptest.ll34
-rw-r--r--llvm/test/Transforms/SCCP/select.ll12
24 files changed, 660 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SCCP/.cvsignore b/llvm/test/Transforms/SCCP/.cvsignore
new file mode 100644
index 00000000000..7f2443f2f31
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/.cvsignore
@@ -0,0 +1,3 @@
+Output
+*.log
+*.sum
diff --git a/llvm/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll b/llvm/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll
new file mode 100644
index 00000000000..2136ca644c8
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll
@@ -0,0 +1,23 @@
+; edgefailure - This function illustrates how SCCP is not doing it's job. This
+; function should be optimized almost completely away: the loop should be
+; analyzed to detect that the body executes exactly once, and thus the branch
+; can be eliminated and code becomes trivially dead. This is distilled from a
+; real benchmark (mst from Olden benchmark, MakeGraph function). When SCCP is
+; fixed, this should be eliminated by a single SCCP application.
+;
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep loop
+
+int* %test() {
+bb1:
+ %A = malloc int
+ br label %bb2
+bb2:
+ %i = phi int [ %i2, %bb2 ], [ 0, %bb1 ] ;; Always 0
+ %i2 = add int %i, 1 ;; Always 1
+ store int %i, int *%A
+ %loop = setle int %i2, 0 ;; Always false
+ br bool %loop, label %bb2, label %bb3
+
+bb3:
+ ret int * %A
+}
diff --git a/llvm/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll b/llvm/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll
new file mode 100644
index 00000000000..24e99b19e39
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep sub
+
+void %test3(int, int) {
+ add int 0, 0
+ sub int 0, 4
+ ret void
+}
diff --git a/llvm/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll b/llvm/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
new file mode 100644
index 00000000000..c851efdb0e1
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
@@ -0,0 +1,20 @@
+; This test shows a case where SCCP is incorrectly eliminating the PHI node
+; because it thinks it has a constant 0 value, when it really doesn't.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep phi
+
+int "test"(int %A, bool %c) {
+bb1:
+ br label %BB2
+BB2:
+ %V = phi int [0, %bb1], [%A, %BB4]
+ br label %BB3
+
+BB3:
+ br bool %c, label %BB4, label %BB5
+BB4:
+ br label %BB2
+
+BB5:
+ ret int %V
+}
diff --git a/llvm/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll b/llvm/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
new file mode 100644
index 00000000000..c31a421d0e5
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
@@ -0,0 +1,39 @@
+; This test shows SCCP "proving" that the loop (from bb6 to 14) loops infinitely
+; this is in fact NOT the case, so the return should still be alive in the code
+; after sccp and CFG simplification have been performed.
+;
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -simplifycfg | llvm-dis | grep ret
+
+
+void "old_main"() {
+bb3: ;[#uses=1]
+ br label %bb6
+
+bb6: ;[#uses=3]
+ %reg403 = phi int [ %reg155, %bb14 ], [ 0, %bb3 ] ; <int> [#uses=2]
+ %reg155 = add int %reg403, 1 ; <int> [#uses=3]
+
+ br label %bb11
+
+bb11:
+ %reg407 = phi int [ %reg408, %bb11 ], [ 0, %bb6 ] ; <int> [#uses=2]
+ %reg408 = add int %reg407, 1 ; <int> [#uses=2]
+ %cond550 = setle int %reg407, 1 ; <bool> [#uses=1]
+ br bool %cond550, label %bb11, label %bb12
+
+bb12: ;[#uses=2]
+ br label %bb13
+
+bb13: ;[#uses=3]
+ %reg409 = phi int [ %reg410, %bb13 ], [ 0, %bb12 ] ; <int> [#uses=1]
+ %reg410 = add int %reg409, 1 ; <int> [#uses=2]
+ %cond552 = setle int %reg410, 2 ; <bool> [#uses=1]
+ br bool %cond552, label %bb13, label %bb14
+
+bb14: ;[#uses=2]
+ %cond553 = setle int %reg155, 31 ; <bool> [#uses=1]
+ br bool %cond553, label %bb6, label %bb15
+
+bb15: ;[#uses=1]
+ ret void
+}
diff --git a/llvm/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll b/llvm/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll
new file mode 100644
index 00000000000..dad9c7e70d6
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep '%X'
+
+%G = uninitialized global [40x int]
+
+implementation
+
+int* %test() {
+ %X = getelementptr [40x int]* %G, uint 0, uint 0
+ ret int* %X
+}
diff --git a/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll b/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll
new file mode 100644
index 00000000000..bf33950e34d
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -simplifycfg | llvm-dis | not grep then:
+
+void %cprop_test11(int* %data.1) {
+entry: ; No predecessors!
+ %tmp.1 = load int* %data.1 ; <int> [#uses=3]
+ %tmp.41 = setgt int %tmp.1, 1 ; <bool> [#uses=1]
+ br bool %tmp.41, label %no_exit, label %loopexit
+
+no_exit: ; preds = %entry, %then, %endif
+ %j.0 = phi int [ %j.0, %endif ], [ %i.0, %then ], [ 1, %entry ] ; <int> [#uses=3]
+ %i.0 = phi int [ %inc, %endif ], [ %inc1, %then ], [ 1, %entry ] ; <int> [#uses=4]
+ %tmp.8.not = cast int %j.0 to bool ; <bool> [#uses=1]
+ br bool %tmp.8.not, label %endif, label %then
+
+then: ; preds = %no_exit
+ %inc1 = add int %i.0, 1 ; <int> [#uses=3]
+ %tmp.42 = setlt int %inc1, %tmp.1 ; <bool> [#uses=1]
+ br bool %tmp.42, label %no_exit, label %loopexit
+
+endif: ; preds = %no_exit
+ %inc = add int %i.0, 1 ; <int> [#uses=3]
+ %tmp.4 = setlt int %inc, %tmp.1 ; <bool> [#uses=1]
+ br bool %tmp.4, label %no_exit, label %loopexit
+
+loopexit: ; preds = %entry, %endif, %then
+ %j.1 = phi int [ 1, %entry ], [ %j.0, %endif ], [ %i.0, %then ] ; <int> [#uses=1]
+ %i.1 = phi int [ 1, %entry ], [ %inc, %endif ], [ %inc1, %then ] ; <int> [#uses=1]
+ %tmp.17 = getelementptr int* %data.1, long 1 ; <int*> [#uses=1]
+ store int %j.1, int* %tmp.17
+ %tmp.23 = getelementptr int* %data.1, long 2 ; <int*> [#uses=1]
+ store int %i.1, int* %tmp.23
+ ret void
+}
diff --git a/llvm/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll b/llvm/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll
new file mode 100644
index 00000000000..36bfba4a404
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll
@@ -0,0 +1,15 @@
+; The PHI cannot be eliminated from this testcase, SCCP is mishandling invoke's!
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep phi
+
+declare void %foo()
+int %test(bool %cond) {
+Entry:
+ br bool %cond, label %Inv, label %Cont
+Inv:
+ invoke void %foo() to label %Ok except label %Cont
+Ok:
+ br label %Cont
+Cont:
+ %X = phi int [0, %Entry], [1,%Ok], [0, %Inv]
+ ret int %X
+}
diff --git a/llvm/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll b/llvm/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll
new file mode 100644
index 00000000000..544edc0b3c5
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -disable-output
+
+implementation
+
+declare int %foo()
+
+void %caller() {
+ br bool true, label %T, label %F
+F:
+ %X = invoke int %foo() to label %T unwind label %T
+
+T:
+ ret void
+}
diff --git a/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll b/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
new file mode 100644
index 00000000000..52cda01e165
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep 'ret i32 1'
+
+; This function definitely returns 1, even if we don't know the direction
+; of the branch.
+
+int %foo() {
+ br bool undef, label %T, label %T
+T:
+ %X = add int 0, 1
+ ret int %X
+}
diff --git a/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll b/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
new file mode 100644
index 00000000000..edfbe016c40
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
@@ -0,0 +1,128 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -disable-output
+
+target endian = big
+target pointersize = 32
+target triple = "powerpc-apple-darwin8.7.0"
+ %struct.pat_list = type { int, %struct.pat_list* }
+%JUMP = external global int ; <int*> [#uses=1]
+%old_D_pat = external global [16 x ubyte] ; <[16 x ubyte]*> [#uses=0]
+
+implementation ; Functions:
+
+void %asearch1(uint %D) {
+entry:
+ %tmp80 = setlt uint 0, %D ; <bool> [#uses=1]
+ br bool %tmp80, label %bb647.preheader, label %cond_true81.preheader
+
+cond_true81.preheader: ; preds = %entry
+ ret void
+
+bb647.preheader: ; preds = %entry
+ %tmp3.i = call int %read( ) ; <int> [#uses=1]
+ %tmp6.i = add int %tmp3.i, 0 ; <int> [#uses=1]
+ %tmp653 = setgt int %tmp6.i, 0 ; <bool> [#uses=1]
+ br bool %tmp653, label %cond_true654, label %UnifiedReturnBlock
+
+cond_true612: ; preds = %cond_true654
+ ret void
+
+cond_next624: ; preds = %cond_true654
+ ret void
+
+cond_true654: ; preds = %bb647.preheader
+ br bool undef, label %cond_true612, label %cond_next624
+
+UnifiedReturnBlock: ; preds = %bb647.preheader
+ ret void
+}
+
+void %bitap(int %D) {
+entry:
+ %tmp29 = seteq int 0, 0 ; <bool> [#uses=1]
+ br bool %tmp29, label %cond_next50, label %cond_next37
+
+cond_next37: ; preds = %entry
+ ret void
+
+cond_next50: ; preds = %entry
+ %tmp52 = setgt int %D, 0 ; <bool> [#uses=1]
+ br bool %tmp52, label %cond_true53, label %cond_next71
+
+cond_true53: ; preds = %cond_next50
+ %tmp54 = load int* %JUMP ; <int> [#uses=1]
+ %tmp55 = seteq int %tmp54, 1 ; <bool> [#uses=1]
+ br bool %tmp55, label %cond_true56, label %cond_next63
+
+cond_true56: ; preds = %cond_true53
+ %tmp57 = cast int %D to uint ; <uint> [#uses=1]
+ call void %asearch1( uint %tmp57 )
+ ret void
+
+cond_next63: ; preds = %cond_true53
+ ret void
+
+cond_next71: ; preds = %cond_next50
+ ret void
+}
+
+declare int %read()
+
+void %initial_value() {
+entry:
+ ret void
+}
+
+void %main() {
+entry:
+ br label %cond_next252
+
+cond_next208: ; preds = %cond_true260
+ %tmp229 = call int %atoi( ) ; <int> [#uses=1]
+ br label %cond_next252
+
+bb217: ; preds = %cond_true260
+ ret void
+
+cond_next252: ; preds = %cond_next208, %entry
+ %D.0.0 = phi int [ 0, %entry ], [ %tmp229, %cond_next208 ] ; <int> [#uses=1]
+ %tmp254 = getelementptr sbyte** null, int 1 ; <sbyte**> [#uses=1]
+ %tmp256 = load sbyte** %tmp254 ; <sbyte*> [#uses=1]
+ %tmp258 = load sbyte* %tmp256 ; <sbyte> [#uses=1]
+ %tmp259 = seteq sbyte %tmp258, 45 ; <bool> [#uses=1]
+ br bool %tmp259, label %cond_true260, label %bb263
+
+cond_true260: ; preds = %cond_next252
+ %tmp205818 = setgt sbyte 0, -1 ; <bool> [#uses=1]
+ br bool %tmp205818, label %cond_next208, label %bb217
+
+bb263: ; preds = %cond_next252
+ %tmp265 = seteq int 0, 0 ; <bool> [#uses=1]
+ br bool %tmp265, label %cond_next276, label %cond_true266
+
+cond_true266: ; preds = %bb263
+ ret void
+
+cond_next276: ; preds = %bb263
+ %tmp278 = seteq int 0, 0 ; <bool> [#uses=1]
+ br bool %tmp278, label %cond_next298, label %cond_true279
+
+cond_true279: ; preds = %cond_next276
+ ret void
+
+cond_next298: ; preds = %cond_next276
+ call void %bitap( int %D.0.0 )
+ ret void
+}
+
+declare int %atoi()
+
+void %subset_pset() {
+entry:
+ ret void
+}
+
+void %strcmp() {
+entry:
+ ret void
+}
+
diff --git a/llvm/test/Transforms/SCCP/2006-12-04-PackedType.ll b/llvm/test/Transforms/SCCP/2006-12-04-PackedType.ll
new file mode 100644
index 00000000000..7942b657f63
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2006-12-04-PackedType.ll
@@ -0,0 +1,149 @@
+; Test PackedType handling by SCCP.
+; SCCP ignores PackedTypes until PR 1034 is fixed
+;
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp
+target datalayout = "E-p:32:32"
+target endian = big
+target pointersize = 32
+target triple = "powerpc-apple-darwin8"
+ %struct.GLDAlphaTest = type { float, ushort, ubyte, ubyte }
+ %struct.GLDArrayRange = type { ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDBlendMode = type { ushort, ushort, ushort, ushort, %struct.GLTColor4, ushort, ushort, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDBufferRec = type opaque
+ %struct.GLDBufferstate = type { %struct.GLTDimensions, %struct.GLTDimensions, %struct.GLTFixedColor4, %struct.GLTFixedColor4, ubyte, ubyte, ubyte, ubyte, [2 x %struct.GLSBuffer], [4 x %struct.GLSBuffer], %struct.GLSBuffer, %struct.GLSBuffer, %struct.GLSBuffer, [4 x %struct.GLSBuffer*], %struct.GLSBuffer*, %struct.GLSBuffer*, %struct.GLSBuffer*, ubyte, ubyte }
+ %struct.GLDClearColor = type { double, %struct.GLTColor4, %struct.GLTColor4, float, int }
+ %struct.GLDClipPlane = type { uint, [6 x %struct.GLTColor4] }
+ %struct.GLDColorBuffer = type { ushort, ushort, [4 x ushort] }
+ %struct.GLDColorMatrix = type { [16 x float]*, %struct.GLDImagingColorScale }
+ %struct.GLDContextRec = type { float, float, float, float, float, float, float, float, %struct.GLTColor4, %struct.GLTColor4, %struct.GLVMFPContext, %struct.GLDTextureMachine, %struct.GLGProcessor, %struct._GLVMConstants*, void (%struct.GLDContextRec*, int, int, %struct.GLVMFragmentAttribRec*, %struct.GLVMFragmentAttribRec*, int)*, %struct._GLVMFunction*, void (%struct.GLDContextRec*, %struct.GLDVertex*)*, void (%struct.GLDContextRec*, %struct.GLDVertex*, %struct.GLDVertex*)*, void (%struct.GLDContextRec*, %struct.GLDVertex*, %struct.GLDVertex*, %struct.GLDVertex*)*, %struct._GLVMFunction*, %struct._GLVMFunction*, %struct._GLVMFunction*, uint, uint, uint, float, float, float, uint, %struct.GLSDrawable, %struct.GLDRect, %struct.GLDFormat, %struct.GLDBufferstate, %struct.GLDSharedRec*, %struct.GLDState*, %struct.GLDPluginState*, %struct.GLTDimensions, %struct.GLTColor4*, %struct.GLTColor4*, %struct.GLVMFragmentAttribRec*, %struct.GLVMFragmentAttribRec*, %struct.GLVMFragmentAttribRec*, %struct.GLDPipelineProgramRec*, %struct.GLDStateProgramRec, %struct.GLVMTextures, { [4 x sbyte*], sbyte*, sbyte* }, [64 x float], %struct.GLDStippleData, ushort, ubyte, ubyte, uint, %struct.GLDFramebufferRec*, ubyte, %struct.GLDQueryRec*, %struct.GLDQueryRec* }
+ %struct.GLDConvolution = type { %struct.GLTColor4, %struct.GLDImagingColorScale, ushort, ushort, float*, int, int }
+ %struct.GLDDepthTest = type { ushort, ushort, ubyte, ubyte, ubyte, ubyte, double, double }
+ %struct.GLDFogMode = type { %struct.GLTColor4, float, float, float, float, float, ushort, ushort, ushort, ubyte, ubyte }
+ %struct.GLDFormat = type { int, int, int, int, int, int, uint, uint, ubyte, ubyte, ubyte, ubyte, int, int, int }
+ %struct.GLDFramebufferAttachment = type { uint, uint, uint, int, uint, uint }
+ %struct.GLDFramebufferData = type { [6 x %struct.GLDFramebufferAttachment], [4 x ushort], ushort, ushort, ushort, ushort, uint }
+ %struct.GLDFramebufferRec = type { %struct.GLDFramebufferData*, %struct.GLDPluginFramebufferData*, %struct.GLDPixelFormat }
+ %struct.GLDHintMode = type { ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort }
+ %struct.GLDHistogram = type { %struct.GLTFixedColor4*, int, ushort, ubyte, ubyte }
+ %struct.GLDImagingColorScale = type { { float, float }, { float, float }, { float, float }, { float, float } }
+ %struct.GLDImagingSubset = type { %struct.GLDConvolution, %struct.GLDConvolution, %struct.GLDConvolution, %struct.GLDColorMatrix, %struct.GLDMinmax, %struct.GLDHistogram, %struct.GLDImagingColorScale, %struct.GLDImagingColorScale, %struct.GLDImagingColorScale, %struct.GLDImagingColorScale, uint }
+ %struct.GLDLight = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTCoord3, float, float, float, float, float, %struct.GLTCoord3, float, float, float, float, float }
+ %struct.GLDLightModel = type { %struct.GLTColor4, [8 x %struct.GLDLight], [2 x %struct.GLDMaterial], uint, ushort, ushort, ushort, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDLightProduct = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4 }
+ %struct.GLDLineMode = type { float, int, ushort, ushort, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDLogicOp = type { ushort, ubyte, ubyte }
+ %struct.GLDMaskMode = type { uint, [3 x uint], ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDMaterial = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, float, float, float, float, [8 x %struct.GLDLightProduct], %struct.GLTColor4, [6 x int], [2 x int] }
+ %struct.GLDMinmax = type { %struct.GLDMinmaxTable*, ushort, ubyte, ubyte }
+ %struct.GLDMinmaxTable = type { %struct.GLTColor4, %struct.GLTColor4 }
+ %struct.GLDMipmaplevel = type { [4 x uint], [4 x float], [4 x uint], [4 x uint], [4 x float], [4 x uint], [3 x uint], uint, float*, float*, float*, uint, uint, sbyte*, short, ushort, ushort, short }
+ %struct.GLDMultisample = type { float, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDPipelineProgramData = type { ushort, ushort, uint, %struct._PPStreamToken*, ulong, %struct.GLDShaderSourceData*, %struct.GLTColor4*, uint }
+ %struct.GLDPipelineProgramRec = type { %struct.GLDPipelineProgramData*, %struct._PPStreamToken*, %struct._PPStreamToken*, %struct._GLVMFunction*, uint, uint, uint }
+ %struct.GLDPipelineProgramState = type { ubyte, ubyte, ubyte, ubyte, %struct.GLTColor4* }
+ %struct.GLDPixelFormat = type { ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDPixelMap = type { int*, float*, float*, float*, float*, float*, float*, float*, float*, int*, int, int, int, int, int, int, int, int, int, int }
+ %struct.GLDPixelMode = type { float, float, %struct.GLDPixelStore, %struct.GLDPixelTransfer, %struct.GLDPixelMap, %struct.GLDImagingSubset, uint, uint }
+ %struct.GLDPixelPack = type { int, int, int, int, int, int, int, int, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDPixelStore = type { %struct.GLDPixelPack, %struct.GLDPixelPack }
+ %struct.GLDPixelTransfer = type { float, float, float, float, float, float, float, float, float, float, int, int, float, float, float, float, float, float, float, float, float, float, float, float }
+ %struct.GLDPluginFramebufferData = type { [6 x %struct.GLDTextureRec*], uint, uint }
+ %struct.GLDPluginProgramData = type { [3 x %struct.GLDPipelineProgramRec*], %struct.GLDBufferRec**, uint }
+ %struct.GLDPluginState = type { [16 x [5 x %struct.GLDTextureRec*]], [3 x %struct.GLDTextureRec*], [16 x %struct.GLDTextureRec*], [3 x %struct.GLDPipelineProgramRec*], %struct.GLDProgramRec*, %struct.GLDVertexArrayRec*, [16 x %struct.GLDBufferRec*], %struct.GLDFramebufferRec*, %struct.GLDFramebufferRec* }
+ %struct.GLDPointMode = type { float, float, float, float, %struct.GLTCoord3, float, ubyte, ubyte, ubyte, ubyte, ushort, ushort, uint, ushort, ushort }
+ %struct.GLDPolygonMode = type { [128 x ubyte], float, float, ushort, ushort, ushort, ushort, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDProgramData = type { uint, [16 x int], int, int, uint, int }
+ %struct.GLDProgramRec = type { %struct.GLDProgramData*, %struct.GLDPluginProgramData*, uint }
+ %struct.GLDQueryRec = type { uint, uint, %struct.GLDQueryRec* }
+ %struct.GLDRect = type { int, int, int, int, int, int }
+ %struct.GLDRegisterCombiners = type { ubyte, ubyte, ubyte, ubyte, int, [2 x %struct.GLTColor4], [8 x %struct.GLDRegisterCombinersPerStageState], %struct.GLDRegisterCombinersFinalStageState }
+ %struct.GLDRegisterCombinersFinalStageState = type { ubyte, ubyte, ubyte, ubyte, [7 x %struct.GLDRegisterCombinersPerVariableState] }
+ %struct.GLDRegisterCombinersPerPortionState = type { [4 x %struct.GLDRegisterCombinersPerVariableState], ubyte, ubyte, ubyte, ubyte, ushort, ushort, ushort, ushort, ushort, ushort }
+ %struct.GLDRegisterCombinersPerStageState = type { [2 x %struct.GLDRegisterCombinersPerPortionState], [2 x %struct.GLTColor4] }
+ %struct.GLDRegisterCombinersPerVariableState = type { ushort, ushort, ushort, ushort }
+ %struct.GLDScissorTest = type { %struct.GLTFixedColor4, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDShaderSourceData = type { uint, uint, sbyte*, int*, uint, uint, sbyte*, int*, sbyte* }
+ %struct.GLDSharedRec = type opaque
+ %struct.GLDState = type { short, short, uint, uint, uint, [256 x %struct.GLTColor4], [128 x %struct.GLTColor4], %struct.GLDViewport, %struct.GLDTransform, %struct.GLDLightModel, uint*, int, int, int, %struct.GLDAlphaTest, %struct.GLDBlendMode, %struct.GLDClearColor, %struct.GLDColorBuffer, %struct.GLDDepthTest, %struct.GLDArrayRange, %struct.GLDFogMode, %struct.GLDHintMode, %struct.GLDLineMode, %struct.GLDLogicOp, %struct.GLDMaskMode, %struct.GLDPixelMode, %struct.GLDPointMode, %struct.GLDPolygonMode, %struct.GLDScissorTest, uint, %struct.GLDStencilTest, [16 x %struct.GLDTextureMode], %struct.GLDArrayRange, [8 x %struct.GLDTextureCoordGen], %struct.GLDClipPlane, %struct.GLDMultisample, %struct.GLDRegisterCombiners, %struct.GLDArrayRange, %struct.GLDArrayRange, [3 x %struct.GLDPipelineProgramState], %struct.GLDTransformFeedback }
+ %struct.GLDStateProgramRec = type { %struct.GLDPipelineProgramData*, %struct.GLDPipelineProgramRec* }
+ %struct.GLDStencilTest = type { [3 x { uint, int, ushort, ushort, ushort, ushort }], uint, [4 x ubyte] }
+ %struct.GLDStippleData = type { uint, ushort, ushort, [32 x [32 x ubyte]] }
+ %struct.GLDTextureCoordGen = type { { ushort, ushort, %struct.GLTColor4, %struct.GLTColor4 }, { ushort, ushort, %struct.GLTColor4, %struct.GLTColor4 }, { ushort, ushort, %struct.GLTColor4, %struct.GLTColor4 }, { ushort, ushort, %struct.GLTColor4, %struct.GLTColor4 }, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDTextureGeomState = type { ushort, ushort, ushort, ushort, ushort, ubyte, ubyte, ushort, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, [6 x ushort], [6 x ushort] }
+ %struct.GLDTextureLevel = type { uint, uint, ushort, ushort, ushort, ubyte, ubyte, ushort, ushort, ushort, ushort, ubyte* }
+ %struct.GLDTextureMachine = type { [8 x %struct.GLDTextureRec*], %struct.GLDTextureRec*, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDTextureMode = type { %struct.GLTColor4, uint, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, ushort, float, float, float, ushort, ushort, ushort, ushort, ushort, ushort, [4 x ushort], ubyte, ubyte, ubyte, ubyte, [3 x float], [4 x float], float, float }
+ %struct.GLDTextureParamState = type { ushort, ushort, ushort, ushort, ushort, ushort, %struct.GLTColor4, float, float, float, float, short, short, ushort, ushort, float, ushort, ubyte, ubyte, int, sbyte* }
+ %struct.GLDTextureRec = type { %struct.GLDTextureState*, int, [2 x float], float, uint, float, float, float, float, float, float, %struct.GLDMipmaplevel*, %struct.GLDMipmaplevel*, int, int, uint, uint, uint, uint, %struct.GLDTextureParamState, uint, [2 x %struct._PPStreamToken] }
+ %struct.GLDTextureState = type { ushort, ushort, ushort, float, uint, ushort, %struct.GLISWRSurface*, ubyte, ubyte, ubyte, ubyte, %struct.GLDTextureParamState, %struct.GLDTextureGeomState, %struct.GLDTextureLevel, [6 x [15 x %struct.GLDTextureLevel]] }
+ %struct.GLDTransform = type { [24 x [16 x float]], [24 x [16 x float]], [16 x float], float, float, float, float, int, float, ushort, ushort, ubyte, ubyte, ubyte, ubyte }
+ %struct.GLDTransformFeedback = type { ubyte, ubyte, ubyte, [16 x uint], [16 x uint] }
+ %struct.GLDVertex = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTCoord3, float, %struct.GLTColor4, float, float, float, ubyte, ubyte, ubyte, ubyte, [4 x float], [2 x %struct.GLDMaterial*], uint, uint, [8 x %struct.GLTColor4] }
+ %struct.GLDVertexArrayRec = type opaque
+ %struct.GLDViewport = type { float, float, float, float, float, float, float, float, double, double, int, int, int, int, float, float, float, float }
+ %struct.GLGColorTable = type { uint, uint, int, sbyte* }
+ %struct.GLGOperation = type { sbyte*, sbyte*, int, uint, uint, int, uint, uint, uint, uint, uint, uint, uint, float, float, %struct.GLGColorTable, %struct.GLGColorTable, %struct.GLGColorTable }
+ %struct.GLGProcessor = type { void (%struct.GLDPixelMode*, %struct.GLGOperation*, %struct._GLGFunctionKey*)*, %struct._GLVMFunction*, %struct._GLGFunctionKey* }
+ %struct.GLISWRSurface = type { int, int, int, int, int, int, int, int, int, int, ubyte*, ubyte*, ubyte*, [4 x ubyte*], uint }
+ %struct.GLIWindow = type { uint, uint, uint }
+ %struct.GLSBuffer = type { sbyte* }
+ %struct.GLSDrawable = type { %struct.GLSWindowRec* }
+ %struct.GLSWindowRec = type { %struct.GLTDimensions, %struct.GLTDimensions, uint, uint, %struct.GLSDrawable, [2 x ubyte*], ubyte*, ubyte*, ubyte*, [4 x ubyte*], uint, uint, uint, uint, [4 x uint], ushort, ushort, ushort, %struct.GLIWindow, uint, uint, sbyte*, ubyte* }
+ %struct.GLTColor4 = type { float, float, float, float }
+ %struct.GLTCoord3 = type { float, float, float }
+ %struct.GLTDimensions = type { int, int }
+ %struct.GLTFixedColor4 = type { int, int, int, int }
+ %struct.GLVMFPContext = type { float, uint, uint, uint }
+ %struct.GLVMFragmentAttribRec = type { <4 x float>, <4 x float>, <4 x float>, <4 x float>, [8 x <4 x float>] }
+ %struct.GLVMTextures = type { [8 x %struct.GLDTextureRec*] }
+ %struct._GLGFunctionKey = type opaque
+ %struct._GLVMConstants = type opaque
+ %struct._GLVMFunction = type opaque
+ %struct._PPStreamToken = type { { ushort, ubyte, ubyte, uint } }
+
+implementation ; Functions:
+
+void %gldLLVMVecPointRender(%struct.GLDContextRec* %ctx) {
+entry:
+ %tmp.uip = getelementptr %struct.GLDContextRec* %ctx, int 0, uint 22 ; <uint*> [#uses=1]
+ %tmp = load uint* %tmp.uip ; <uint> [#uses=3]
+ %tmp91 = lshr uint %tmp, ubyte 5 ; <uint> [#uses=1]
+ %tmp92 = trunc uint %tmp91 to bool ; <bool> [#uses=1]
+ br bool %tmp92, label %cond_true93, label %cond_next116
+
+cond_true93: ; preds = %entry
+ %tmp = getelementptr %struct.GLDContextRec* %ctx, int 0, uint 31, uint 14 ; <int*> [#uses=1]
+ %tmp95 = load int* %tmp ; <int> [#uses=1]
+ %tmp95 = sitofp int %tmp95 to float ; <float> [#uses=1]
+ %tmp108 = mul float undef, %tmp95 ; <float> [#uses=1]
+ br label %cond_next116
+
+cond_next116: ; preds = %cond_true93, %entry
+ %point_size.2 = phi float [ %tmp108, %cond_true93 ], [ undef, %entry ] ; <float> [#uses=2]
+ %tmp457 = setlt float %point_size.2, 1.000000e+00 ; <bool> [#uses=1]
+ %tmp460 = lshr uint %tmp, ubyte 6 ; <uint> [#uses=1]
+ %tmp461 = trunc uint %tmp460 to bool ; <bool> [#uses=1]
+ br bool %tmp457, label %cond_true458, label %cond_next484
+
+cond_true458: ; preds = %cond_next116
+ br bool %tmp461, label %cond_true462, label %cond_next487
+
+cond_true462: ; preds = %cond_true458
+ %tmp26 = bitcast uint %tmp to int ; <int> [#uses=1]
+ %tmp465 = and int %tmp26, 128 ; <int> [#uses=1]
+ %tmp466 = seteq int %tmp465, 0 ; <bool> [#uses=1]
+ br bool %tmp466, label %cond_true467, label %cond_next487
+
+cond_true467: ; preds = %cond_true462
+ ret void
+
+cond_next484: ; preds = %cond_next116
+ %tmp486 = mul float %point_size.2, 5.000000e-01 ; <float> [#uses=1]
+ br label %cond_next487
+
+cond_next487: ; preds = %cond_next484, %cond_true462, %cond_true458
+ %radius.0 = phi float [ %tmp486, %cond_next484 ], [ 5.000000e-01, %cond_true458 ], [ 5.000000e-01, %cond_true462 ] ; <float> [#uses=2]
+ %tmp494 = insertelement <4 x float> zeroinitializer, float %radius.0, uint 2 ; <<4 x float>> [#uses=1]
+ %tmp495 = insertelement <4 x float> %tmp494, float %radius.0, uint 3 ; <<4 x float>> [#uses=0]
+ ret void
+}
diff --git a/llvm/test/Transforms/SCCP/2006-12-19-UndefBug.ll b/llvm/test/Transforms/SCCP/2006-12-19-UndefBug.ll
new file mode 100644
index 00000000000..e991818b6c9
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/2006-12-19-UndefBug.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | \
+; RUN: grep 'ret i1 false'
+
+bool %foo() {
+ %X = and bool false, undef
+ ret bool %X
+}
diff --git a/llvm/test/Transforms/SCCP/basictest.ll b/llvm/test/Transforms/SCCP/basictest.ll
new file mode 100644
index 00000000000..417f847e64a
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/basictest.ll
@@ -0,0 +1,16 @@
+; This is a basic sanity check for constant propogation. The add instruction
+; should be eliminated.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep add
+
+int %test(bool %B) {
+ br bool %B, label %BB1, label %BB2
+BB1:
+ %Val = add int 0, 0
+ br label %BB3
+BB2:
+ br label %BB3
+BB3:
+ %Ret = phi int [%Val, %BB1], [1, %BB2]
+ ret int %Ret
+}
diff --git a/llvm/test/Transforms/SCCP/calltest.ll b/llvm/test/Transforms/SCCP/calltest.ll
new file mode 100644
index 00000000000..2e46b691832
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/calltest.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -adce -simplifycfg | llvm-dis | not grep br
+
+; No matter how hard you try, sqrt(1.0) is always 1.0. This allows the
+; optimizer to delete this loop.
+
+declare double %sqrt(double)
+
+double %test(uint %param) {
+entry:
+ br label %Loop
+
+Loop:
+ %I2 = phi uint [ 0, %entry ], [ %I3, %Loop ]
+ %V = phi double [ 1.0, %entry], [ %V2, %Loop ]
+
+ %V2 = call double %sqrt(double %V)
+
+ %I3 = add uint %I2, 1
+ %tmp.7 = setne uint %I3, %param
+ br bool %tmp.7, label %Loop, label %Exit
+
+Exit:
+ ret double %V
+}
diff --git a/llvm/test/Transforms/SCCP/dg.exp b/llvm/test/Transforms/SCCP/dg.exp
new file mode 100644
index 00000000000..142de8a6c8f
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm-dg.exp
+
+llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version
diff --git a/llvm/test/Transforms/SCCP/ipsccp-basic.ll b/llvm/test/Transforms/SCCP/ipsccp-basic.ll
new file mode 100644
index 00000000000..2c42dface54
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/ipsccp-basic.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | grep -v 'ret i32 17' | grep -v 'ret i32 undef' | not grep ret
+
+implementation
+
+internal int %bar(int %A) {
+ %X = add int 1, 2
+ ret int %A
+}
+
+int %foo() {
+ %X = call int %bar(int 17)
+ ret int %X
+}
diff --git a/llvm/test/Transforms/SCCP/ipsccp-conditional.ll b/llvm/test/Transforms/SCCP/ipsccp-conditional.ll
new file mode 100644
index 00000000000..5f06df3e8e1
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/ipsccp-conditional.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | grep -v 'ret i32 0' | grep -v 'ret i32 undef' | not grep ret
+
+implementation
+
+internal int %bar(int %A) {
+ %C = seteq int %A, 0
+ br bool %C, label %T, label %F
+T:
+ %B = call int %bar(int 0)
+ ret int 0
+F: ; unreachable
+ %C = call int %bar(int 1)
+ ret int %C
+}
+
+int %foo() {
+ %X = call int %bar(int 0)
+ ret int %X
+}
diff --git a/llvm/test/Transforms/SCCP/ipsccp-gvar.ll b/llvm/test/Transforms/SCCP/ipsccp-gvar.ll
new file mode 100644
index 00000000000..d76b4810cb0
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/ipsccp-gvar.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | not grep global
+
+%G = internal global int undef
+
+implementation
+
+void %foo() {
+ %X = load int* %G
+ store int %X, int* %G
+ ret void
+}
+
+int %bar() {
+ %V = load int* %G
+ %C = seteq int %V, 17
+ br bool %C, label %T, label %F
+T:
+ store int 17, int* %G
+ ret int %V
+F:
+ store int 123, int* %G
+ ret int 0
+}
diff --git a/llvm/test/Transforms/SCCP/loadtest.ll b/llvm/test/Transforms/SCCP/loadtest.ll
new file mode 100644
index 00000000000..99da7285cf2
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/loadtest.ll
@@ -0,0 +1,26 @@
+; This test makes sure that these instructions are properly constant propagated.
+;
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep load
+
+%X = constant int 42
+%Y = constant [2 x { int, float }] [ { int, float } { int 12, float 1.0 },
+ { int, float } { int 37, float 1.2312 } ]
+int %test1() {
+ %B = load int* %X
+ ret int %B
+}
+
+float %test2() {
+ %A = getelementptr [2 x { int, float}]* %Y, long 0, long 1, uint 1
+ %B = load float* %A
+ ret float %B
+}
+
+int %test3() {
+ %A = getelementptr [2 x { int, float}]* %Y, long 0, long 0, uint 0
+ %B = load int* %A
+ ret int %B
+}
+
+
diff --git a/llvm/test/Transforms/SCCP/logical-nuke.ll b/llvm/test/Transforms/SCCP/logical-nuke.ll
new file mode 100644
index 00000000000..c0a555a3002
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/logical-nuke.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep 'ret i32 0'
+
+; Test that SCCP has basic knowledge of when and/or nuke overdefined values.
+
+int %test(int %X) {
+ %Y = and int %X, 0
+ ret int %Y
+}
diff --git a/llvm/test/Transforms/SCCP/phitest.ll b/llvm/test/Transforms/SCCP/phitest.ll
new file mode 100644
index 00000000000..cdbdb2ce08a
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/phitest.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -dce -simplifycfg | llvm-dis | not grep br
+
+int %test(int %param) {
+entry:
+ %tmp.1 = setne int %param, 0
+ br bool %tmp.1, label %endif.0, label %else
+
+else:
+ br label %endif.0
+
+endif.0:
+ %a.0 = phi int [ 2, %else ], [ 3, %entry ]
+ %b.0 = phi int [ 3, %else ], [ 2, %entry ]
+ %tmp.5 = add int %a.0, %b.0
+ %tmp.7 = setne int %tmp.5, 5
+ br bool %tmp.7, label %UnifiedReturnBlock, label %endif.1
+
+endif.1:
+ ret int 0
+
+UnifiedReturnBlock:
+ ret int 2
+}
diff --git a/llvm/test/Transforms/SCCP/sccptest.ll b/llvm/test/Transforms/SCCP/sccptest.ll
new file mode 100644
index 00000000000..6fae7ce957d
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/sccptest.ll
@@ -0,0 +1,34 @@
+; This is the test case taken from appel's book that illustrates a hard case
+; that SCCP gets right. BB3 should be completely eliminated.
+;
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -constprop -dce -cfgsimplify | llvm-dis | not grep BB3
+
+int %testfunction(int %i0, int %j0) {
+BB1:
+ br label %BB2
+BB2:
+ %j2 = phi int [%j4, %BB7], [1, %BB1]
+ %k2 = phi int [%k4, %BB7], [0, %BB1]
+ %kcond = setlt int %k2, 100
+ br bool %kcond, label %BB3, label %BB4
+
+BB3:
+ %jcond = setlt int %j2, 20
+ br bool %jcond, label %BB5, label %BB6
+
+BB4:
+ ret int %j2
+
+BB5:
+ %k3 = add int %k2, 1
+ br label %BB7
+
+BB6:
+ %k5 = add int %k2, 1
+ br label %BB7
+
+BB7:
+ %j4 = phi int [1, %BB5], [%k2, %BB6]
+ %k4 = phi int [%k3, %BB5], [%k5, %BB6]
+ br label %BB2
+}
diff --git a/llvm/test/Transforms/SCCP/select.ll b/llvm/test/Transforms/SCCP/select.ll
new file mode 100644
index 00000000000..0209681c787
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/select.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -disable-output &&
+; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep select
+
+int %test1(bool %C) {
+ %X = select bool %C, int 0, int 0
+ ret int %X
+}
+
+int %test2(bool %C) {
+ %X = select bool %C, int 0, int undef
+ ret int %X
+}
OpenPOWER on IntegriCloud