summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-02 17:52:33 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-02 17:52:33 +0000
commit009b1c42aa6266385f2c37e227516b24077e6dd7 (patch)
tree64ba909838c23261cace781ece27d106134ea451 /test/Transforms
downloadsrc-test2-009b1c42aa6266385f2c37e227516b24077e6dd7.tar.gz
src-test2-009b1c42aa6266385f2c37e227516b24077e6dd7.zip
Notes
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/ADCE/2002-01-31-UseStuckAround.ll13
-rw-r--r--test/Transforms/ADCE/2002-05-22-PHITest.ll16
-rw-r--r--test/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll32
-rw-r--r--test/Transforms/ADCE/2002-05-28-Crash-distilled.ll17
-rw-r--r--test/Transforms/ADCE/2002-05-28-Crash.ll54
-rw-r--r--test/Transforms/ADCE/2002-07-17-AssertionFailure.ll13
-rw-r--r--test/Transforms/ADCE/2002-07-17-PHIAssertion.ll48
-rw-r--r--test/Transforms/ADCE/2002-07-29-Segfault.ll9
-rw-r--r--test/Transforms/ADCE/2003-01-22-PredecessorProblem.ll25
-rw-r--r--test/Transforms/ADCE/2003-04-25-PHIPostDominateProblem.ll35
-rw-r--r--test/Transforms/ADCE/2003-06-11-InvalidCFG.ll28
-rw-r--r--test/Transforms/ADCE/2003-06-24-BadSuccessor.ll91
-rw-r--r--test/Transforms/ADCE/2003-06-24-BasicFunctionality.ll41
-rw-r--r--test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll19
-rw-r--r--test/Transforms/ADCE/2003-09-15-InfLoopCrash.ll9
-rw-r--r--test/Transforms/ADCE/2003-11-16-MissingPostDominanceInfo.ll18
-rw-r--r--test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll16
-rw-r--r--test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll45
-rw-r--r--test/Transforms/ADCE/basictest.ll19
-rw-r--r--test/Transforms/ADCE/basictest1.ll97
-rw-r--r--test/Transforms/ADCE/basictest2.ll97
-rw-r--r--test/Transforms/ADCE/dce_pure_call.ll8
-rw-r--r--test/Transforms/ADCE/dce_pure_invoke.ll15
-rw-r--r--test/Transforms/ADCE/dg.exp3
-rw-r--r--test/Transforms/ADCE/unreachable-function.ll5
-rw-r--r--test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll15
-rw-r--r--test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll25
-rw-r--r--test/Transforms/ArgumentPromotion/2008-09-07-CGUpdate.ll12
-rw-r--r--test/Transforms/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll25
-rw-r--r--test/Transforms/ArgumentPromotion/aggregate-promote.ll23
-rw-r--r--test/Transforms/ArgumentPromotion/attrs.ll25
-rw-r--r--test/Transforms/ArgumentPromotion/basictest.ll22
-rw-r--r--test/Transforms/ArgumentPromotion/byval-2.ll26
-rw-r--r--test/Transforms/ArgumentPromotion/byval.ll24
-rw-r--r--test/Transforms/ArgumentPromotion/chained.ll16
-rw-r--r--test/Transforms/ArgumentPromotion/control-flow.ll19
-rw-r--r--test/Transforms/ArgumentPromotion/control-flow2.ll21
-rw-r--r--test/Transforms/ArgumentPromotion/dg.exp3
-rw-r--r--test/Transforms/ArgumentPromotion/pr3085.ll1944
-rw-r--r--test/Transforms/BlockPlacement/basictest.ll15
-rw-r--r--test/Transforms/BlockPlacement/dg.exp3
-rw-r--r--test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll18
-rw-r--r--test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll75
-rw-r--r--test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll33
-rw-r--r--test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll28
-rw-r--r--test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll47
-rw-r--r--test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll20
-rw-r--r--test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll23
-rw-r--r--test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll194
-rw-r--r--test/Transforms/CodeExtractor/2004-08-12-BlockExtractPHI.ll26
-rw-r--r--test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll15
-rw-r--r--test/Transforms/CodeExtractor/dg.exp3
-rw-r--r--test/Transforms/CodeGenPrepare/2008-11-24-RAUW-Self.ll511
-rw-r--r--test/Transforms/CodeGenPrepare/dg.exp3
-rw-r--r--test/Transforms/CondProp/2006-08-14-SingleEntryPhiCrash.ll462
-rw-r--r--test/Transforms/CondProp/2006-11-01-PhiNodeCrash.ll1084
-rw-r--r--test/Transforms/CondProp/2007-08-01-InvalidRead.ll814
-rw-r--r--test/Transforms/CondProp/2009-01-25-SingleEntryPHI.ll37
-rw-r--r--test/Transforms/CondProp/basictest-dbg.ll45
-rw-r--r--test/Transforms/CondProp/basictest.ll28
-rw-r--r--test/Transforms/CondProp/dg.exp3
-rw-r--r--test/Transforms/CondProp/phisimplify.ll43
-rw-r--r--test/Transforms/CondProp/phisimplify2.ll46
-rw-r--r--test/Transforms/CondProp/phisimplify3.ll26
-rw-r--r--test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll15
-rw-r--r--test/Transforms/ConstProp/2002-05-03-NotOperator.ll19
-rw-r--r--test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll20
-rw-r--r--test/Transforms/ConstProp/2003-05-12-DivideError.ll15
-rw-r--r--test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll10
-rw-r--r--test/Transforms/ConstProp/2006-11-30-vector-cast.ll10
-rw-r--r--test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll7
-rw-r--r--test/Transforms/ConstProp/2006-12-01-bool-casts.ll15
-rw-r--r--test/Transforms/ConstProp/2007-02-05-BitCast.ll7
-rw-r--r--test/Transforms/ConstProp/2007-02-23-sdiv.ll5
-rw-r--r--test/Transforms/ConstProp/2007-11-23-cttz.ll8
-rw-r--r--test/Transforms/ConstProp/2008-07-07-VectorCompare.ll28
-rw-r--r--test/Transforms/ConstProp/basictest.ll20
-rw-r--r--test/Transforms/ConstProp/bitcast.ll2
-rw-r--r--test/Transforms/ConstProp/bitcast2.ll8
-rw-r--r--test/Transforms/ConstProp/bswap.ll25
-rw-r--r--test/Transforms/ConstProp/calls.ll30
-rw-r--r--test/Transforms/ConstProp/dg.exp3
-rw-r--r--test/Transforms/ConstProp/float-to-ptr-cast.ll12
-rw-r--r--test/Transforms/ConstProp/logicaltest.ll35
-rw-r--r--test/Transforms/ConstProp/nottest.ll19
-rw-r--r--test/Transforms/ConstProp/phi.ll17
-rw-r--r--test/Transforms/ConstProp/remtest.ll24
-rw-r--r--test/Transforms/ConstantMerge/2002-09-23-CPR-Update.ll13
-rw-r--r--test/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll5
-rw-r--r--test/Transforms/ConstantMerge/2006-03-07-DontMergeDiffSections.ll16
-rw-r--r--test/Transforms/ConstantMerge/dg.exp3
-rw-r--r--test/Transforms/DeadArgElim/2006-06-27-struct-ret.ll11
-rw-r--r--test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll11
-rw-r--r--test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll12
-rw-r--r--test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll20
-rw-r--r--test/Transforms/DeadArgElim/2008-01-16-VarargsParamAttrs.ll31
-rw-r--r--test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll23
-rw-r--r--test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll26
-rw-r--r--test/Transforms/DeadArgElim/basictest.ll36
-rw-r--r--test/Transforms/DeadArgElim/canon.ll24
-rw-r--r--test/Transforms/DeadArgElim/dead_vaargs.ll12
-rw-r--r--test/Transforms/DeadArgElim/deadretval.ll18
-rw-r--r--test/Transforms/DeadArgElim/deadretval2.ll59
-rw-r--r--test/Transforms/DeadArgElim/dg.exp3
-rw-r--r--test/Transforms/DeadArgElim/keepalive.ll30
-rw-r--r--test/Transforms/DeadArgElim/multdeadretval.ll68
-rw-r--r--test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll14
-rw-r--r--test/Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll13
-rw-r--r--test/Transforms/DeadStoreElimination/2005-11-30-vaarg.ll9
-rw-r--r--test/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll1113
-rw-r--r--test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll14
-rw-r--r--test/Transforms/DeadStoreElimination/2008-11-28-MemDepUpdate.ll16
-rw-r--r--test/Transforms/DeadStoreElimination/2008-11-29-OffEndOfBlock.ll27
-rw-r--r--test/Transforms/DeadStoreElimination/PartialStore.ll13
-rw-r--r--test/Transforms/DeadStoreElimination/alloca.ll9
-rw-r--r--test/Transforms/DeadStoreElimination/byval.ll10
-rw-r--r--test/Transforms/DeadStoreElimination/context-sensitive.ll14
-rw-r--r--test/Transforms/DeadStoreElimination/dg.exp3
-rw-r--r--test/Transforms/DeadStoreElimination/free.ll15
-rw-r--r--test/Transforms/DeadStoreElimination/memcpy.ll52
-rw-r--r--test/Transforms/DeadStoreElimination/simple.ll9
-rw-r--r--test/Transforms/DeadStoreElimination/volatile-load.ll8
-rw-r--r--test/Transforms/FunctionAttrs/2008-09-03-Mutual.ll11
-rw-r--r--test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll18
-rw-r--r--test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll9
-rw-r--r--test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll9
-rw-r--r--test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll10
-rw-r--r--test/Transforms/FunctionAttrs/2008-12-29-Constant.ll8
-rw-r--r--test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll101
-rw-r--r--test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll14
-rw-r--r--test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll7
-rw-r--r--test/Transforms/FunctionAttrs/dg.exp3
-rw-r--r--test/Transforms/GVN/2007-07-25-DominatedLoop.ll86
-rw-r--r--test/Transforms/GVN/2007-07-25-InfiniteLoop.ll14
-rw-r--r--test/Transforms/GVN/2007-07-25-Loop.ll15
-rw-r--r--test/Transforms/GVN/2007-07-25-NestedLoop.ll38
-rw-r--r--test/Transforms/GVN/2007-07-25-SinglePredecessor.ll29
-rw-r--r--test/Transforms/GVN/2007-07-26-InterlockingLoops.ll30
-rw-r--r--test/Transforms/GVN/2007-07-26-NonRedundant.ll16
-rw-r--r--test/Transforms/GVN/2007-07-26-PhiErasure.ll28
-rw-r--r--test/Transforms/GVN/2007-07-30-PredIDom.ll274
-rw-r--r--test/Transforms/GVN/2007-07-31-NoDomInherit.ll313
-rw-r--r--test/Transforms/GVN/2007-07-31-RedundantPhi.ll22
-rw-r--r--test/Transforms/GVN/2008-02-12-UndefLoad.ll20
-rw-r--r--test/Transforms/GVN/2008-02-13-NewPHI.ll22
-rw-r--r--test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll25
-rw-r--r--test/Transforms/GVN/2008-02-26-MemCpySize.ll46
-rw-r--r--test/Transforms/GVN/2008-07-02-Unreachable.ll35
-rw-r--r--test/Transforms/GVN/2008-12-09-SelfRemove.ll26
-rw-r--r--test/Transforms/GVN/2008-12-12-RLE-Crash.ll35
-rw-r--r--test/Transforms/GVN/2008-12-14-rle-reanalyze.ll18
-rw-r--r--test/Transforms/GVN/2008-12-15-CacheVisited.ll28
-rw-r--r--test/Transforms/GVN/2009-01-21-SortInvalidation.ll55
-rw-r--r--test/Transforms/GVN/2009-01-22-SortInvalidation.ll100
-rw-r--r--test/Transforms/GVN/2009-02-17-LoadPRECrash.ll193
-rw-r--r--test/Transforms/GVN/2009-03-05-dbg.ll66
-rw-r--r--test/Transforms/GVN/2009-03-10-PREOnVoid.ll82
-rw-r--r--test/Transforms/GVN/basic.ll10
-rw-r--r--test/Transforms/GVN/bitcast-of-call.ll12
-rw-r--r--test/Transforms/GVN/calls-nonlocal.ll49
-rw-r--r--test/Transforms/GVN/calls-readonly.ll29
-rw-r--r--test/Transforms/GVN/condprop.ll52
-rw-r--r--test/Transforms/GVN/dg.exp3
-rw-r--r--test/Transforms/GVN/load-constant-mem.ll13
-rw-r--r--test/Transforms/GVN/local-pre.ll18
-rw-r--r--test/Transforms/GVN/lpre-basic.ll18
-rw-r--r--test/Transforms/GVN/lpre-call-wrap-2.ll39
-rw-r--r--test/Transforms/GVN/lpre-call-wrap.ll54
-rw-r--r--test/Transforms/GVN/mixed.ll13
-rw-r--r--test/Transforms/GVN/pre-basic-add.ll27
-rw-r--r--test/Transforms/GVN/pre-single-pred.ll32
-rw-r--r--test/Transforms/GVN/rle-dominated.ll20
-rw-r--r--test/Transforms/GVN/rle-must-alias.ll47
-rw-r--r--test/Transforms/GVN/rle-no-phi-translate.ll24
-rw-r--r--test/Transforms/GVN/rle-nonlocal.ll19
-rw-r--r--test/Transforms/GVN/rle-phi-translate.ll32
-rw-r--r--test/Transforms/GVN/rle-semidominated.ll19
-rw-r--r--test/Transforms/GVNPRE/2007-06-12-NoExit.ll9
-rw-r--r--test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll19
-rw-r--r--test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll70
-rw-r--r--test/Transforms/GVNPRE/2007-06-15-Looping.ll22
-rw-r--r--test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll22
-rw-r--r--test/Transforms/GVNPRE/2007-06-18-EraseNumbering.ll26
-rw-r--r--test/Transforms/GVNPRE/2007-07-03-PhiTranslateGEP.ll14
-rw-r--r--test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll9
-rw-r--r--test/Transforms/GVNPRE/2007-07-04-SelectInst.ll18
-rw-r--r--test/Transforms/GVNPRE/2007-07-05-AvailabilityUpdating.ll54
-rw-r--r--test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll14
-rw-r--r--test/Transforms/GVNPRE/basic.ll38
-rw-r--r--test/Transforms/GVNPRE/cast.ll17
-rw-r--r--test/Transforms/GVNPRE/dg.exp3
-rw-r--r--test/Transforms/GVNPRE/extractelement.ll18
-rw-r--r--test/Transforms/GVNPRE/gep.ll17
-rw-r--r--test/Transforms/GVNPRE/insertelement.ll18
-rw-r--r--test/Transforms/GVNPRE/select.ll17
-rw-r--r--test/Transforms/GVNPRE/shufflevector.ll18
-rw-r--r--test/Transforms/GlobalDCE/2002-07-17-CastRef.ll11
-rw-r--r--test/Transforms/GlobalDCE/2002-07-17-ConstantRef.ll13
-rw-r--r--test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll17
-rw-r--r--test/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll12
-rw-r--r--test/Transforms/GlobalDCE/2002-09-12-Redeletion.ll11
-rw-r--r--test/Transforms/GlobalDCE/2003-07-01-SelfReference.ll11
-rw-r--r--test/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll6
-rw-r--r--test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll8
-rw-r--r--test/Transforms/GlobalDCE/2009-02-17-AliasUsesAliasee.ll4
-rw-r--r--test/Transforms/GlobalDCE/basicvariabletest.ll5
-rw-r--r--test/Transforms/GlobalDCE/dg.exp3
-rw-r--r--test/Transforms/GlobalDCE/externally_available.ll10
-rw-r--r--test/Transforms/GlobalOpt/2004-10-10-CastStoreOnce.ll17
-rw-r--r--test/Transforms/GlobalOpt/2005-06-15-LocalizeConstExprCrash.ll10
-rw-r--r--test/Transforms/GlobalOpt/2005-09-27-Crash.ll27
-rw-r--r--test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll135
-rw-r--r--test/Transforms/GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll33
-rw-r--r--test/Transforms/GlobalOpt/2007-04-05-Crash.ll34
-rw-r--r--test/Transforms/GlobalOpt/2007-05-13-Crash.ll74
-rw-r--r--test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll36
-rw-r--r--test/Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll19
-rw-r--r--test/Transforms/GlobalOpt/2008-01-03-Crash.ll26
-rw-r--r--test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll16
-rw-r--r--test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll9
-rw-r--r--test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll57
-rw-r--r--test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll32
-rw-r--r--test/Transforms/GlobalOpt/2008-07-17-addrspace.ll28
-rw-r--r--test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll24
-rw-r--r--test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll27
-rw-r--r--test/Transforms/GlobalOpt/2009-01-13-phi-user.ll35
-rw-r--r--test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll10
-rw-r--r--test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll12
-rw-r--r--test/Transforms/GlobalOpt/2009-03-03-dbg.ll54
-rw-r--r--test/Transforms/GlobalOpt/2009-03-05-dbg.ll67
-rw-r--r--test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll11
-rw-r--r--test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll17
-rw-r--r--test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll117
-rw-r--r--test/Transforms/GlobalOpt/alias-resolve.ll19
-rw-r--r--test/Transforms/GlobalOpt/basictest.ll9
-rw-r--r--test/Transforms/GlobalOpt/constantexpr-dangle.ll13
-rw-r--r--test/Transforms/GlobalOpt/ctor-list-opt-dbg.ll98
-rw-r--r--test/Transforms/GlobalOpt/ctor-list-opt.ll85
-rw-r--r--test/Transforms/GlobalOpt/deadglobal-2.ll11
-rw-r--r--test/Transforms/GlobalOpt/deadglobal.ll9
-rw-r--r--test/Transforms/GlobalOpt/dg.exp3
-rw-r--r--test/Transforms/GlobalOpt/globalsra-partial.ll23
-rw-r--r--test/Transforms/GlobalOpt/globalsra.ll23
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-1.ll34
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-2.ll36
-rw-r--r--test/Transforms/GlobalOpt/heap-sra-phi.ll41
-rw-r--r--test/Transforms/GlobalOpt/integer-bool.ll23
-rw-r--r--test/Transforms/GlobalOpt/iterate.ll11
-rw-r--r--test/Transforms/GlobalOpt/load-store-global.ll15
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-1.ll18
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-2.ll20
-rw-r--r--test/Transforms/GlobalOpt/malloc-promote-3.ll26
-rw-r--r--test/Transforms/GlobalOpt/memcpy.ll15
-rw-r--r--test/Transforms/GlobalOpt/memset.ll21
-rw-r--r--test/Transforms/GlobalOpt/phi-select.ll31
-rw-r--r--test/Transforms/GlobalOpt/storepointer-compare.ll30
-rw-r--r--test/Transforms/GlobalOpt/storepointer.ll19
-rw-r--r--test/Transforms/GlobalOpt/trivialstore.ll19
-rw-r--r--test/Transforms/GlobalOpt/undef-init.ll17
-rw-r--r--test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll15
-rw-r--r--test/Transforms/IPConstantProp/deadarg.ll6
-rw-r--r--test/Transforms/IPConstantProp/dg.exp3
-rw-r--r--test/Transforms/IPConstantProp/recursion.ll12
-rw-r--r--test/Transforms/IPConstantProp/return-argument.ll49
-rw-r--r--test/Transforms/IPConstantProp/return-constant.ll26
-rw-r--r--test/Transforms/IPConstantProp/return-constants.ll41
-rw-r--r--test/Transforms/IndMemRem/2009-01-24-Noalias.ll11
-rw-r--r--test/Transforms/IndMemRem/dg.exp3
-rw-r--r--test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll17
-rw-r--r--test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll17
-rw-r--r--test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll15
-rw-r--r--test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll18
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll25
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll18
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-15-Crash.ll24
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll15
-rw-r--r--test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll26
-rw-r--r--test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll283
-rw-r--r--test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll27
-rw-r--r--test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll23
-rw-r--r--test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll61
-rw-r--r--test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll20
-rw-r--r--test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll37
-rw-r--r--test/Transforms/IndVarSimplify/2005-11-18-Crash.ll17
-rw-r--r--test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll22
-rw-r--r--test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll22
-rw-r--r--test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll44
-rw-r--r--test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll33
-rw-r--r--test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll38
-rw-r--r--test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll19
-rw-r--r--test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll117
-rw-r--r--test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll20
-rw-r--r--test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll17
-rw-r--r--test/Transforms/IndVarSimplify/2008-09-02-IVType.ll58
-rw-r--r--test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll32
-rw-r--r--test/Transforms/IndVarSimplify/2008-11-03-Floating.ll65
-rw-r--r--test/Transforms/IndVarSimplify/2008-11-17-Floating.ll35
-rw-r--r--test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll11
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll114
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll160
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll35
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-27-Floating.ll18
-rw-r--r--test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll41
-rw-r--r--test/Transforms/IndVarSimplify/ada-loops.ll90
-rw-r--r--test/Transforms/IndVarSimplify/addrec-gep.ll78
-rw-r--r--test/Transforms/IndVarSimplify/avoid-i0.ll126
-rw-r--r--test/Transforms/IndVarSimplify/casted-argument.ll50
-rw-r--r--test/Transforms/IndVarSimplify/complex-scev.ll29
-rw-r--r--test/Transforms/IndVarSimplify/dg.exp3
-rw-r--r--test/Transforms/IndVarSimplify/divide-pointer.ll95
-rw-r--r--test/Transforms/IndVarSimplify/exit_value_tests.ll114
-rw-r--r--test/Transforms/IndVarSimplify/gep-with-mul-base.ll58
-rw-r--r--test/Transforms/IndVarSimplify/interesting-invoke-use.ll57
-rw-r--r--test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll25
-rw-r--r--test/Transforms/IndVarSimplify/iv-zext.ll33
-rw-r--r--test/Transforms/IndVarSimplify/lftr-other-uses.ll36
-rw-r--r--test/Transforms/IndVarSimplify/lftr_simple.ll22
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_1.ll21
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_2.ll28
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_3.ll19
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_4.ll20
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_5.ll32
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_6.ll29
-rw-r--r--test/Transforms/IndVarSimplify/pointer-indvars.ll15
-rw-r--r--test/Transforms/IndVarSimplify/preserve-gep-remainder.ll19
-rw-r--r--test/Transforms/IndVarSimplify/preserve-gep.ll39
-rw-r--r--test/Transforms/IndVarSimplify/preserve-signed-wrap.ll38
-rw-r--r--test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll99
-rw-r--r--test/Transforms/IndVarSimplify/signed-trip-count.ll30
-rw-r--r--test/Transforms/IndVarSimplify/subtract.ll15
-rw-r--r--test/Transforms/IndVarSimplify/tripcount_compute.ll100
-rw-r--r--test/Transforms/IndVarSimplify/tripcount_infinite.ll38
-rw-r--r--test/Transforms/IndVarSimplify/variable-stride-ivs.ll43
-rw-r--r--test/Transforms/Inline/2003-09-14-InlineValue.ll21
-rw-r--r--test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll16
-rw-r--r--test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll25
-rw-r--r--test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll23
-rw-r--r--test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll19
-rw-r--r--test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll20
-rw-r--r--test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll20
-rw-r--r--test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll11
-rw-r--r--test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll11
-rw-r--r--test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll25
-rw-r--r--test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll840
-rw-r--r--test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll245
-rw-r--r--test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll338
-rw-r--r--test/Transforms/Inline/2007-04-15-InlineEH.ll49
-rw-r--r--test/Transforms/Inline/2007-06-06-NoInline.ll46
-rw-r--r--test/Transforms/Inline/2007-06-25-WeakInline.ll14
-rw-r--r--test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll19
-rw-r--r--test/Transforms/Inline/2008-03-04-StructRet.ll28
-rw-r--r--test/Transforms/Inline/2008-03-07-Inline-2.ll53
-rw-r--r--test/Transforms/Inline/2008-03-07-Inline.ll57
-rw-r--r--test/Transforms/Inline/2008-09-02-AlwaysInline.ll10
-rw-r--r--test/Transforms/Inline/2008-09-02-NoInline.ll10
-rw-r--r--test/Transforms/Inline/2008-10-30-AlwaysInline.ll14
-rw-r--r--test/Transforms/Inline/2008-11-04-AlwaysInline.ll7
-rw-r--r--test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll36
-rw-r--r--test/Transforms/Inline/2009-01-12-RecursiveInline.ll92
-rw-r--r--test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll293
-rw-r--r--test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll20
-rw-r--r--test/Transforms/Inline/alloca_test.ll21
-rw-r--r--test/Transforms/Inline/always_inline_dyn_alloca.ll15
-rw-r--r--test/Transforms/Inline/basictest.ll12
-rw-r--r--test/Transforms/Inline/byval.ll28
-rw-r--r--test/Transforms/Inline/byval2.ll28
-rw-r--r--test/Transforms/Inline/casts.ll19
-rw-r--r--test/Transforms/Inline/cfg_preserve_test.ll16
-rw-r--r--test/Transforms/Inline/dg.exp3
-rw-r--r--test/Transforms/Inline/dynamic_alloca_test.ll35
-rw-r--r--test/Transforms/Inline/externally_available.ll16
-rw-r--r--test/Transforms/Inline/inline-invoke-tail.ll35
-rw-r--r--test/Transforms/Inline/inline-tail.ll15
-rw-r--r--test/Transforms/Inline/inline_cleanup.ll63
-rw-r--r--test/Transforms/Inline/inline_constprop.ll14
-rw-r--r--test/Transforms/Inline/inline_dce.ll25
-rw-r--r--test/Transforms/Inline/inline_prune.ll45
-rw-r--r--test/Transforms/Inline/invoke_test-1.ll24
-rw-r--r--test/Transforms/Inline/invoke_test-2.ll30
-rw-r--r--test/Transforms/Inline/invoke_test-3.ll32
-rw-r--r--test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll9
-rw-r--r--test/Transforms/InstCombine/2002-05-14-SubFailure.ll10
-rw-r--r--test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll508
-rw-r--r--test/Transforms/InstCombine/2002-08-02-CastTest.ll11
-rw-r--r--test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll12
-rw-r--r--test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll11
-rw-r--r--test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll8
-rw-r--r--test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll10
-rw-r--r--test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll16
-rw-r--r--test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll13
-rw-r--r--test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll44
-rw-r--r--test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll21
-rw-r--r--test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll7
-rw-r--r--test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll12
-rw-r--r--test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll15
-rw-r--r--test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll13
-rw-r--r--test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll8
-rw-r--r--test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll28
-rw-r--r--test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll15
-rw-r--r--test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll13
-rw-r--r--test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll10
-rw-r--r--test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll10
-rw-r--r--test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll9
-rw-r--r--test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll9
-rw-r--r--test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll8
-rw-r--r--test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll18
-rw-r--r--test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll25
-rw-r--r--test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll9
-rw-r--r--test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll10
-rw-r--r--test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll132
-rw-r--r--test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll14
-rw-r--r--test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll7
-rw-r--r--test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll9
-rw-r--r--test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll8
-rw-r--r--test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll10
-rw-r--r--test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll9
-rw-r--r--test/Transforms/InstCombine/2005-06-16-RangeCrash.ll9
-rw-r--r--test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll14
-rw-r--r--test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll14
-rw-r--r--test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll21
-rw-r--r--test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll10
-rw-r--r--test/Transforms/InstCombine/2006-02-28-Crash.ll8
-rw-r--r--test/Transforms/InstCombine/2006-03-30-ExtractElement.ll8
-rw-r--r--test/Transforms/InstCombine/2006-04-01-InfLoop.ll444
-rw-r--r--test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll11
-rw-r--r--test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll51
-rw-r--r--test/Transforms/InstCombine/2006-05-06-Infloop.ll519
-rw-r--r--test/Transforms/InstCombine/2006-06-28-infloop.ll20
-rw-r--r--test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll46
-rw-r--r--test/Transforms/InstCombine/2006-09-15-CastToBool.ll14
-rw-r--r--test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll10
-rw-r--r--test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll12
-rw-r--r--test/Transforms/InstCombine/2006-10-20-mask.ll11
-rw-r--r--test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll9
-rw-r--r--test/Transforms/InstCombine/2006-11-03-Memmove64.ll16
-rw-r--r--test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll9
-rw-r--r--test/Transforms/InstCombine/2006-11-27-XorBug.ll12
-rw-r--r--test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll9
-rw-r--r--test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll12
-rw-r--r--test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll18
-rw-r--r--test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll51
-rw-r--r--test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll41
-rw-r--r--test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll162
-rw-r--r--test/Transforms/InstCombine/2006-12-15-Range-Test.ll31
-rw-r--r--test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll30
-rw-r--r--test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll10
-rw-r--r--test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll6
-rw-r--r--test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll7
-rw-r--r--test/Transforms/InstCombine/2007-01-27-AndICmp.ll8
-rw-r--r--test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll45
-rw-r--r--test/Transforms/InstCombine/2007-02-07-PointerCast.ll22
-rw-r--r--test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll31
-rw-r--r--test/Transforms/InstCombine/2007-03-13-CompareMerge.ll9
-rw-r--r--test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll10
-rw-r--r--test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll7
-rw-r--r--test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll29
-rw-r--r--test/Transforms/InstCombine/2007-03-25-DoubleShift.ll9
-rw-r--r--test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll36
-rw-r--r--test/Transforms/InstCombine/2007-03-27-PR1280.ll15
-rw-r--r--test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll302
-rw-r--r--test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll19
-rw-r--r--test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll7
-rw-r--r--test/Transforms/InstCombine/2007-05-04-Crash.ll30
-rw-r--r--test/Transforms/InstCombine/2007-05-10-icmp-or.ll8
-rw-r--r--test/Transforms/InstCombine/2007-05-14-Crash.ll18
-rw-r--r--test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll10
-rw-r--r--test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll22
-rw-r--r--test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll9
-rw-r--r--test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll10
-rw-r--r--test/Transforms/InstCombine/2007-09-05-EqualGEP.ll10
-rw-r--r--test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll13
-rw-r--r--test/Transforms/InstCombine/2007-09-11-Trampoline.ll24
-rw-r--r--test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll14
-rw-r--r--test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll20
-rw-r--r--test/Transforms/InstCombine/2007-10-12-Crash.ll38
-rw-r--r--test/Transforms/InstCombine/2007-10-28-EmptyField.ll24
-rw-r--r--test/Transforms/InstCombine/2007-10-28-stacksave.ll47
-rw-r--r--test/Transforms/InstCombine/2007-10-31-RangeCrash.ll35
-rw-r--r--test/Transforms/InstCombine/2007-10-31-StringCrash.ll21
-rw-r--r--test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll22
-rw-r--r--test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll10
-rw-r--r--test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll16
-rw-r--r--test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll12
-rw-r--r--test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll9
-rw-r--r--test/Transforms/InstCombine/2007-12-12-GEPScale.ll10
-rw-r--r--test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll7
-rw-r--r--test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll29
-rw-r--r--test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll89
-rw-r--r--test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll23
-rw-r--r--test/Transforms/InstCombine/2008-01-06-CastCrash.ll10
-rw-r--r--test/Transforms/InstCombine/2008-01-06-VoidCast.ll10
-rw-r--r--test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll9
-rw-r--r--test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll15
-rw-r--r--test/Transforms/InstCombine/2008-01-14-DoubleNest.ll24
-rw-r--r--test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll24
-rw-r--r--test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll17
-rw-r--r--test/Transforms/InstCombine/2008-01-21-MulTrunc.ll11
-rw-r--r--test/Transforms/InstCombine/2008-01-27-FloatSelect.ll7
-rw-r--r--test/Transforms/InstCombine/2008-01-29-AddICmp.ll20
-rw-r--r--test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll33
-rw-r--r--test/Transforms/InstCombine/2008-02-13-MulURem.ll8
-rw-r--r--test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll14
-rw-r--r--test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll9
-rw-r--r--test/Transforms/InstCombine/2008-02-23-MulSub.ll9
-rw-r--r--test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll16
-rw-r--r--test/Transforms/InstCombine/2008-03-13-IntToPtr.ll9
-rw-r--r--test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll15
-rw-r--r--test/Transforms/InstCombine/2008-04-28-VolatileStore.ll8
-rw-r--r--test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll25
-rw-r--r--test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll21
-rw-r--r--test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll25
-rw-r--r--test/Transforms/InstCombine/2008-05-08-StrLenSink.ll28
-rw-r--r--test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll33
-rw-r--r--test/Transforms/InstCombine/2008-05-17-InfLoop.ll23
-rw-r--r--test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll13
-rw-r--r--test/Transforms/InstCombine/2008-05-22-IDivVector.ll6
-rw-r--r--test/Transforms/InstCombine/2008-05-22-NegValVector.ll8
-rw-r--r--test/Transforms/InstCombine/2008-05-23-CompareFold.ll11
-rw-r--r--test/Transforms/InstCombine/2008-05-31-AddBool.ll7
-rw-r--r--test/Transforms/InstCombine/2008-05-31-Bools.ll24
-rw-r--r--test/Transforms/InstCombine/2008-06-05-ashr-crash.ll7
-rw-r--r--test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll47
-rw-r--r--test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll20
-rw-r--r--test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll19
-rw-r--r--test/Transforms/InstCombine/2008-06-19-UncondLoad.ll16
-rw-r--r--test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll11
-rw-r--r--test/Transforms/InstCombine/2008-06-24-StackRestore.ll39
-rw-r--r--test/Transforms/InstCombine/2008-07-08-AndICmp.ll10
-rw-r--r--test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll10
-rw-r--r--test/Transforms/InstCombine/2008-07-08-SubAnd.ll9
-rw-r--r--test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll26
-rw-r--r--test/Transforms/InstCombine/2008-07-09-SubAndError.ll9
-rw-r--r--test/Transforms/InstCombine/2008-07-10-CastSextBool.ll17
-rw-r--r--test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll19
-rw-r--r--test/Transforms/InstCombine/2008-07-11-RemAnd.ll9
-rw-r--r--test/Transforms/InstCombine/2008-07-13-DivZero.ll16
-rw-r--r--test/Transforms/InstCombine/2008-07-16-fsub.ll8
-rw-r--r--test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll13
-rw-r--r--test/Transforms/InstCombine/2008-08-05-And.ll23
-rw-r--r--test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll41
-rw-r--r--test/Transforms/InstCombine/2008-09-02-VectorCrash.ll27
-rw-r--r--test/Transforms/InstCombine/2008-09-29-FoldingOr.ll10
-rw-r--r--test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll8
-rw-r--r--test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll8
-rw-r--r--test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll8
-rw-r--r--test/Transforms/InstCombine/2008-11-08-FCmp.ll46
-rw-r--r--test/Transforms/InstCombine/2008-11-20-DivMulRem.ll34
-rw-r--r--test/Transforms/InstCombine/2008-11-27-IDivVector.ll11
-rw-r--r--test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll11
-rw-r--r--test/Transforms/InstCombine/2008-11-27-UDivNegative.ll6
-rw-r--r--test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll7
-rw-r--r--test/Transforms/InstCombine/2009-01-05-i128-crash.ll27
-rw-r--r--test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll28
-rw-r--r--test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll11
-rw-r--r--test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll316
-rw-r--r--test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll75
-rw-r--r--test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll18
-rw-r--r--test/Transforms/InstCombine/2009-01-31-InfIterate.ll22
-rw-r--r--test/Transforms/InstCombine/2009-01-31-Pressure.ll22
-rw-r--r--test/Transforms/InstCombine/2009-02-04-FPBitcast.ll12
-rw-r--r--test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll278
-rw-r--r--test/Transforms/InstCombine/2009-02-21-LoadCST.ll12
-rw-r--r--test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll38
-rw-r--r--test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll14
-rw-r--r--test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll11
-rw-r--r--test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll9
-rw-r--r--test/Transforms/InstCombine/2009-03-24-InfLoop.ll9
-rw-r--r--test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll24
-rw-r--r--test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll13
-rw-r--r--test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll9
-rw-r--r--test/Transforms/InstCombine/CPP_min_max.ll34
-rw-r--r--test/Transforms/InstCombine/GEPIdxCanon.ll10
-rw-r--r--test/Transforms/InstCombine/IntPtrCast.ll9
-rw-r--r--test/Transforms/InstCombine/JavaCompare.ll14
-rw-r--r--test/Transforms/InstCombine/README.txt4
-rw-r--r--test/Transforms/InstCombine/add-shrink.ll14
-rw-r--r--test/Transforms/InstCombine/add-sitofp.ll9
-rw-r--r--test/Transforms/InstCombine/add.ll277
-rw-r--r--test/Transforms/InstCombine/add2.ll46
-rw-r--r--test/Transforms/InstCombine/addnegneg.ll12
-rw-r--r--test/Transforms/InstCombine/adjust-for-sminmax.ll85
-rw-r--r--test/Transforms/InstCombine/align-2d-gep.ll43
-rw-r--r--test/Transforms/InstCombine/align-addr.ll30
-rw-r--r--test/Transforms/InstCombine/align-inc.ll11
-rw-r--r--test/Transforms/InstCombine/alloca.ll31
-rw-r--r--test/Transforms/InstCombine/and-compare.ll11
-rw-r--r--test/Transforms/InstCombine/and-fcmp.ll34
-rw-r--r--test/Transforms/InstCombine/and-not-or.ll34
-rw-r--r--test/Transforms/InstCombine/and-or-and.ll61
-rw-r--r--test/Transforms/InstCombine/and-or-not.ll46
-rw-r--r--test/Transforms/InstCombine/and-or.ll39
-rw-r--r--test/Transforms/InstCombine/and-xor-merge.ll19
-rw-r--r--test/Transforms/InstCombine/and.ll255
-rw-r--r--test/Transforms/InstCombine/and2.ll12
-rw-r--r--test/Transforms/InstCombine/apint-add1.ll34
-rw-r--r--test/Transforms/InstCombine/apint-add2.ll46
-rw-r--r--test/Transforms/InstCombine/apint-and-compare.ll16
-rw-r--r--test/Transforms/InstCombine/apint-and-or-and.ll50
-rw-r--r--test/Transforms/InstCombine/apint-and-xor-merge.ll22
-rw-r--r--test/Transforms/InstCombine/apint-and1.ll57
-rw-r--r--test/Transforms/InstCombine/apint-and2.ll82
-rw-r--r--test/Transforms/InstCombine/apint-call-cast-target.ll17
-rw-r--r--test/Transforms/InstCombine/apint-cast-and-cast.ll15
-rw-r--r--test/Transforms/InstCombine/apint-cast-cast-to-and.ll8
-rw-r--r--test/Transforms/InstCombine/apint-cast.ll20
-rw-r--r--test/Transforms/InstCombine/apint-div1.ll22
-rw-r--r--test/Transforms/InstCombine/apint-div2.ll22
-rw-r--r--test/Transforms/InstCombine/apint-elim-logicalops.ll39
-rw-r--r--test/Transforms/InstCombine/apint-mul1.ll11
-rw-r--r--test/Transforms/InstCombine/apint-mul2.ll12
-rw-r--r--test/Transforms/InstCombine/apint-not.ll42
-rw-r--r--test/Transforms/InstCombine/apint-or1.ll36
-rw-r--r--test/Transforms/InstCombine/apint-or2.ll35
-rw-r--r--test/Transforms/InstCombine/apint-rem1.ll22
-rw-r--r--test/Transforms/InstCombine/apint-rem2.ll22
-rw-r--r--test/Transforms/InstCombine/apint-select.ll44
-rw-r--r--test/Transforms/InstCombine/apint-shift-simplify.ll23
-rw-r--r--test/Transforms/InstCombine/apint-shift.ll191
-rw-r--r--test/Transforms/InstCombine/apint-shl-trunc.ll14
-rw-r--r--test/Transforms/InstCombine/apint-sub.ll141
-rw-r--r--test/Transforms/InstCombine/apint-xor1.ll50
-rw-r--r--test/Transforms/InstCombine/apint-xor2.ll51
-rw-r--r--test/Transforms/InstCombine/apint-zext1.ll9
-rw-r--r--test/Transforms/InstCombine/apint-zext2.ll9
-rw-r--r--test/Transforms/InstCombine/ashr-nop.ll8
-rw-r--r--test/Transforms/InstCombine/binop-cast.ll7
-rw-r--r--test/Transforms/InstCombine/bit-tracking.ll26
-rw-r--r--test/Transforms/InstCombine/bitcast-gep.ll30
-rw-r--r--test/Transforms/InstCombine/bitcast-vector-fold.ll33
-rw-r--r--test/Transforms/InstCombine/bitcount.ll19
-rw-r--r--test/Transforms/InstCombine/bittest.ll30
-rw-r--r--test/Transforms/InstCombine/bswap-fold.ll52
-rw-r--r--test/Transforms/InstCombine/bswap.ll72
-rw-r--r--test/Transforms/InstCombine/call-cast-target.ll14
-rw-r--r--test/Transforms/InstCombine/call-intrinsics.ll19
-rw-r--r--test/Transforms/InstCombine/call.ll78
-rw-r--r--test/Transforms/InstCombine/call2.ll27
-rw-r--r--test/Transforms/InstCombine/canonicalize_branch.ll36
-rw-r--r--test/Transforms/InstCombine/cast-and-cast.ll17
-rw-r--r--test/Transforms/InstCombine/cast-cast-to-and.ll9
-rw-r--r--test/Transforms/InstCombine/cast-load-gep.ll20
-rw-r--r--test/Transforms/InstCombine/cast-malloc.ll15
-rw-r--r--test/Transforms/InstCombine/cast-mul-select.ll29
-rw-r--r--test/Transforms/InstCombine/cast-propagate.ll11
-rw-r--r--test/Transforms/InstCombine/cast-set.ll51
-rw-r--r--test/Transforms/InstCombine/cast-sext-zext.ll12
-rw-r--r--test/Transforms/InstCombine/cast-store-gep.ll17
-rw-r--r--test/Transforms/InstCombine/cast.ll263
-rw-r--r--test/Transforms/InstCombine/cast2.ll29
-rw-r--r--test/Transforms/InstCombine/cast_ld_addr_space.ll19
-rw-r--r--test/Transforms/InstCombine/cast_ptr.ll19
-rw-r--r--test/Transforms/InstCombine/constant-fold-ptr-casts.ll18
-rw-r--r--test/Transforms/InstCombine/dce-iterate.ll24
-rw-r--r--test/Transforms/InstCombine/deadcode.ll24
-rw-r--r--test/Transforms/InstCombine/dg.exp3
-rw-r--r--test/Transforms/InstCombine/div-cmp-overflow.ll8
-rw-r--r--test/Transforms/InstCombine/div.ll84
-rw-r--r--test/Transforms/InstCombine/enforce-known-alignment.ll18
-rw-r--r--test/Transforms/InstCombine/extractvalue.ll38
-rw-r--r--test/Transforms/InstCombine/fold-vector-zero.ll35
-rw-r--r--test/Transforms/InstCombine/fp-ret-bitcast.ll27
-rw-r--r--test/Transforms/InstCombine/fpcast.ll15
-rw-r--r--test/Transforms/InstCombine/fpextend.ll36
-rw-r--r--test/Transforms/InstCombine/getelementptr-setcc.ll31
-rw-r--r--test/Transforms/InstCombine/getelementptr-seteq.ll13
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll81
-rw-r--r--test/Transforms/InstCombine/getelementptr_cast.ll11
-rw-r--r--test/Transforms/InstCombine/getelementptr_const.ll15
-rw-r--r--test/Transforms/InstCombine/getelementptr_index.ll9
-rw-r--r--test/Transforms/InstCombine/getelementptr_promote.ll58
-rw-r--r--test/Transforms/InstCombine/hoist_instr.ll17
-rw-r--r--test/Transforms/InstCombine/icmp.ll30
-rw-r--r--test/Transforms/InstCombine/known_align.ll27
-rw-r--r--test/Transforms/InstCombine/load.ll78
-rw-r--r--test/Transforms/InstCombine/load2.ll11
-rw-r--r--test/Transforms/InstCombine/load3.ll14
-rw-r--r--test/Transforms/InstCombine/loadstore-alignment.ll66
-rw-r--r--test/Transforms/InstCombine/logical-select.ll54
-rw-r--r--test/Transforms/InstCombine/lshr-phi.ll35
-rw-r--r--test/Transforms/InstCombine/malloc-free-delete.ll11
-rw-r--r--test/Transforms/InstCombine/malloc.ll7
-rw-r--r--test/Transforms/InstCombine/malloc2.ll19
-rw-r--r--test/Transforms/InstCombine/malloc3.ll26
-rw-r--r--test/Transforms/InstCombine/memcpy-to-load.ll14
-rw-r--r--test/Transforms/InstCombine/memmove.ll42
-rw-r--r--test/Transforms/InstCombine/memset.ll15
-rw-r--r--test/Transforms/InstCombine/mul-masked-bits.ll10
-rw-r--r--test/Transforms/InstCombine/mul.ll93
-rw-r--r--test/Transforms/InstCombine/multi-use-or.ll24
-rw-r--r--test/Transforms/InstCombine/narrow.ll18
-rw-r--r--test/Transforms/InstCombine/not-fcmp.ll10
-rw-r--r--test/Transforms/InstCombine/not.ll54
-rw-r--r--test/Transforms/InstCombine/nothrow.ll8
-rw-r--r--test/Transforms/InstCombine/odr-linkage.ll19
-rw-r--r--test/Transforms/InstCombine/or-fcmp.ll34
-rw-r--r--test/Transforms/InstCombine/or-to-xor.ll42
-rw-r--r--test/Transforms/InstCombine/or.ll171
-rw-r--r--test/Transforms/InstCombine/or2.ll12
-rw-r--r--test/Transforms/InstCombine/phi-merge.ll31
-rw-r--r--test/Transforms/InstCombine/phi.ll115
-rw-r--r--test/Transforms/InstCombine/pr2645-0.ll33
-rw-r--r--test/Transforms/InstCombine/pr2645-1.ll39
-rw-r--r--test/Transforms/InstCombine/pr2996.ll12
-rw-r--r--test/Transforms/InstCombine/preserve-sminmax.ll22
-rw-r--r--test/Transforms/InstCombine/ptr-int-cast.ll16
-rw-r--r--test/Transforms/InstCombine/rem.ll83
-rw-r--r--test/Transforms/InstCombine/sdiv-1.ll22
-rw-r--r--test/Transforms/InstCombine/sdiv-2.ll28
-rw-r--r--test/Transforms/InstCombine/select-2.ll18
-rw-r--r--test/Transforms/InstCombine/select.ll204
-rw-r--r--test/Transforms/InstCombine/set.ll171
-rw-r--r--test/Transforms/InstCombine/setcc-cast-cast.ll46
-rw-r--r--test/Transforms/InstCombine/setcc-strength-reduce.ll37
-rw-r--r--test/Transforms/InstCombine/sext-misc.ll75
-rw-r--r--test/Transforms/InstCombine/shift-simplify.ll42
-rw-r--r--test/Transforms/InstCombine/shift-sra.ll19
-rw-r--r--test/Transforms/InstCombine/shift-trunc-shift.ll10
-rw-r--r--test/Transforms/InstCombine/shift.ll216
-rw-r--r--test/Transforms/InstCombine/shl-icmp.ll29
-rw-r--r--test/Transforms/InstCombine/shl-trunc.ll9
-rw-r--r--test/Transforms/InstCombine/shufflemask-undef.ll109
-rw-r--r--test/Transforms/InstCombine/shufflevec-constant.ll14
-rw-r--r--test/Transforms/InstCombine/signed-comparison.ll28
-rw-r--r--test/Transforms/InstCombine/signext.ll45
-rw-r--r--test/Transforms/InstCombine/sink_instruction.ll19
-rw-r--r--test/Transforms/InstCombine/sitofp.ll55
-rw-r--r--test/Transforms/InstCombine/srem-simplify-bug.ll9
-rw-r--r--test/Transforms/InstCombine/srem.ll8
-rw-r--r--test/Transforms/InstCombine/srem1.ll18
-rw-r--r--test/Transforms/InstCombine/stack-overalign.ll29
-rw-r--r--test/Transforms/InstCombine/stacksaverestore.ll56
-rw-r--r--test/Transforms/InstCombine/store-merge.ll37
-rw-r--r--test/Transforms/InstCombine/store.ll17
-rw-r--r--test/Transforms/InstCombine/sub.ll148
-rw-r--r--test/Transforms/InstCombine/udiv-simplify-bug-0.ll14
-rw-r--r--test/Transforms/InstCombine/udiv-simplify-bug-1.ll20
-rw-r--r--test/Transforms/InstCombine/udiv_select_to_select_shift.ll17
-rw-r--r--test/Transforms/InstCombine/urem-simplify-bug.ll32
-rw-r--r--test/Transforms/InstCombine/urem.ll8
-rw-r--r--test/Transforms/InstCombine/vec_demanded_elts-2.ll19
-rw-r--r--test/Transforms/InstCombine/vec_demanded_elts.ll47
-rw-r--r--test/Transforms/InstCombine/vec_extract_elt.ll9
-rw-r--r--test/Transforms/InstCombine/vec_insert_to_shuffle.ll19
-rw-r--r--test/Transforms/InstCombine/vec_insertelt.ll7
-rw-r--r--test/Transforms/InstCombine/vec_narrow.ll12
-rw-r--r--test/Transforms/InstCombine/vec_shuffle.ll47
-rw-r--r--test/Transforms/InstCombine/vec_shuffle2.ll19
-rw-r--r--test/Transforms/InstCombine/vector-srem.ll9
-rw-r--r--test/Transforms/InstCombine/volatile_store.ll14
-rw-r--r--test/Transforms/InstCombine/xor-demorgans.ll12
-rw-r--r--test/Transforms/InstCombine/xor-undef.ll6
-rw-r--r--test/Transforms/InstCombine/xor.ll193
-rw-r--r--test/Transforms/InstCombine/xor2.ll17
-rw-r--r--test/Transforms/InstCombine/zero-point-zero-add.ll15
-rw-r--r--test/Transforms/InstCombine/zeroext-and-reduce.ll10
-rw-r--r--test/Transforms/InstCombine/zext-fold.ll12
-rw-r--r--test/Transforms/InstCombine/zext-or-icmp.ll35
-rw-r--r--test/Transforms/InstCombine/zext.ll33
-rw-r--r--test/Transforms/Internalize/2008-05-09-AllButMain.ll27
-rw-r--r--test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile2
-rw-r--r--test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll10
-rw-r--r--test/Transforms/Internalize/dg.exp3
-rw-r--r--test/Transforms/JumpThreading/2008-04-24-InfLoop.ll142
-rw-r--r--test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll25
-rw-r--r--test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll13
-rw-r--r--test/Transforms/JumpThreading/2008-11-28-InfLoop.ll17
-rw-r--r--test/Transforms/JumpThreading/2009-01-08-DeadLoopRepl.ll49
-rw-r--r--test/Transforms/JumpThreading/2009-01-19-InfSwitchLoop.ll21
-rw-r--r--test/Transforms/JumpThreading/and-and-cond.ll33
-rw-r--r--test/Transforms/JumpThreading/and-cond.ll32
-rw-r--r--test/Transforms/JumpThreading/basic.ll53
-rw-r--r--test/Transforms/JumpThreading/compare.ll30
-rw-r--r--test/Transforms/JumpThreading/dg.exp3
-rw-r--r--test/Transforms/JumpThreading/no-irreducible-loops.ll38
-rw-r--r--test/Transforms/JumpThreading/thread-loads.ll34
-rw-r--r--test/Transforms/JumpThreading/undef.ll12
-rw-r--r--test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll23
-rw-r--r--test/Transforms/LCSSA/2006-06-12-MultipleExitsSameBlock.ll27
-rw-r--r--test/Transforms/LCSSA/2006-07-09-NoDominator.ll24
-rw-r--r--test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll145
-rw-r--r--test/Transforms/LCSSA/2006-10-31-UnreachableBlock.ll184
-rw-r--r--test/Transforms/LCSSA/2007-07-12-LICM-2.ll17
-rw-r--r--test/Transforms/LCSSA/2007-07-12-LICM-3.ll24
-rw-r--r--test/Transforms/LCSSA/2007-07-12-LICM.ll14
-rw-r--r--test/Transforms/LCSSA/basictest.ll24
-rw-r--r--test/Transforms/LCSSA/dg.exp3
-rw-r--r--test/Transforms/LICM/2003-02-26-LoopExitNotDominated.ll18
-rw-r--r--test/Transforms/LICM/2003-02-27-NestedLoopExitBlocks.ll17
-rw-r--r--test/Transforms/LICM/2003-02-27-PreheaderExitNodeUpdate.ll16
-rw-r--r--test/Transforms/LICM/2003-02-27-PreheaderProblem.ll24
-rw-r--r--test/Transforms/LICM/2003-02-27-StoreSinkPHIs.ll15
-rw-r--r--test/Transforms/LICM/2003-02-28-PromoteDifferentType.ll15
-rw-r--r--test/Transforms/LICM/2003-05-02-LoadHoist.ll23
-rw-r--r--test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll26
-rw-r--r--test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll21
-rw-r--r--test/Transforms/LICM/2003-12-11-SinkingToPHI.ll16
-rw-r--r--test/Transforms/LICM/2003-12-13-VolatilePromote.ll16
-rw-r--r--test/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.ll19
-rw-r--r--test/Transforms/LICM/2004-11-17-UndefIndexCrash.ll20
-rw-r--r--test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll9
-rw-r--r--test/Transforms/LICM/2006-09-12-DeadUserOfSunkInstr.ll148
-rw-r--r--test/Transforms/LICM/2007-05-22-VolatileSink.ll56
-rw-r--r--test/Transforms/LICM/2007-07-30-AliasSet.ll39
-rw-r--r--test/Transforms/LICM/2007-09-17-PromoteValue.ll61
-rw-r--r--test/Transforms/LICM/2007-09-24-PromoteNullValue.ll46
-rw-r--r--test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll21
-rw-r--r--test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll30
-rw-r--r--test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll23
-rw-r--r--test/Transforms/LICM/2009-03-25-AliasSetTracker.ll39
-rw-r--r--test/Transforms/LICM/Preserve-LCSSA.ll25
-rw-r--r--test/Transforms/LICM/basictest.ll15
-rw-r--r--test/Transforms/LICM/call_sink_const_function.ll17
-rw-r--r--test/Transforms/LICM/call_sink_pure_function.ll16
-rw-r--r--test/Transforms/LICM/dg.exp3
-rw-r--r--test/Transforms/LICM/no-preheader-test.ll20
-rw-r--r--test/Transforms/LICM/scalar_promote.ll35
-rw-r--r--test/Transforms/LICM/sink_critical_edge.ll16
-rw-r--r--test/Transforms/LICM/sink_inst.ll20
-rw-r--r--test/Transforms/LICM/sink_load.ll21
-rw-r--r--test/Transforms/LICM/sink_multiple.ll21
-rw-r--r--test/Transforms/LICM/sink_multiple_exits.ll24
-rw-r--r--test/Transforms/LICM/sink_only_some_exits.ll23
-rw-r--r--test/Transforms/LICM/sink_phi_node_use.ll21
-rw-r--r--test/Transforms/LICM/sink_trapping_inst.ll18
-rw-r--r--test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll13
-rw-r--r--test/Transforms/LoopDeletion/2008-05-06-Phi.ll109
-rw-r--r--test/Transforms/LoopDeletion/dcetest.ll36
-rw-r--r--test/Transforms/LoopDeletion/dg.exp3
-rw-r--r--test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll63
-rw-r--r--test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll57
-rw-r--r--test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll60
-rw-r--r--test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll46
-rw-r--r--test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll48
-rw-r--r--test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll67
-rw-r--r--test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll72
-rw-r--r--test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll74
-rw-r--r--test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll464
-rw-r--r--test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll69
-rw-r--r--test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll40
-rw-r--r--test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll32
-rw-r--r--test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll25
-rw-r--r--test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll78
-rw-r--r--test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll38
-rw-r--r--test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll31
-rw-r--r--test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll66
-rw-r--r--test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll69
-rw-r--r--test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll64
-rw-r--r--test/Transforms/LoopIndexSplit/2009-03-30-undef.ll24
-rw-r--r--test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll52
-rw-r--r--test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll44
-rw-r--r--test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll58
-rw-r--r--test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll50
-rw-r--r--test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll67
-rw-r--r--test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll69
-rw-r--r--test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll34
-rw-r--r--test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll52
-rw-r--r--test/Transforms/LoopIndexSplit/SplitValue-2007-08-24-dbg.ll71
-rw-r--r--test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll52
-rw-r--r--test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll52
-rw-r--r--test/Transforms/LoopIndexSplit/dg.exp3
-rw-r--r--test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll21
-rw-r--r--test/Transforms/LoopRotate/LRCrash-1.ll18
-rw-r--r--test/Transforms/LoopRotate/LRCrash-2.ll24
-rw-r--r--test/Transforms/LoopRotate/LRCrash-3.ll29
-rw-r--r--test/Transforms/LoopRotate/LRCrash-4.ll18
-rw-r--r--test/Transforms/LoopRotate/LRCrash-5.ll26
-rw-r--r--test/Transforms/LoopRotate/PhiRename-1.ll95
-rw-r--r--test/Transforms/LoopRotate/PhiSelfRefernce-1.ll39
-rw-r--r--test/Transforms/LoopRotate/dg.exp3
-rw-r--r--test/Transforms/LoopRotate/pr2639.ll38
-rw-r--r--test/Transforms/LoopSimplify/2003-04-25-AssertFail.ll20
-rw-r--r--test/Transforms/LoopSimplify/2003-05-12-PreheaderExitOfChild.ll42
-rw-r--r--test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll52
-rw-r--r--test/Transforms/LoopSimplify/2003-12-10-ExitBlocksProblem.ll36
-rw-r--r--test/Transforms/LoopSimplify/2004-02-05-DominatorInfoCorruption.ll14
-rw-r--r--test/Transforms/LoopSimplify/2004-03-15-IncorrectDomUpdate.ll11
-rw-r--r--test/Transforms/LoopSimplify/2004-04-01-IncorrectDomUpdate.ll20
-rw-r--r--test/Transforms/LoopSimplify/2004-04-12-LoopSimplify-SwitchBackedges.ll18
-rw-r--r--test/Transforms/LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll18
-rw-r--r--test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll892
-rw-r--r--test/Transforms/LoopSimplify/basictest.ll16
-rw-r--r--test/Transforms/LoopSimplify/dg.exp3
-rw-r--r--test/Transforms/LoopSimplify/hardertest.ll15
-rw-r--r--test/Transforms/LoopSimplify/phi-node-simplify.ll55
-rw-r--r--test/Transforms/LoopSimplify/single-backedge.ll20
-rw-r--r--test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll57
-rw-r--r--test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll17
-rw-r--r--test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll32
-rw-r--r--test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll71
-rw-r--r--test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll24
-rw-r--r--test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll31
-rw-r--r--test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll99
-rw-r--r--test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll48
-rw-r--r--test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll39
-rw-r--r--test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll33
-rw-r--r--test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll44
-rw-r--r--test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll24
-rw-r--r--test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll26
-rw-r--r--test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll58
-rw-r--r--test/Transforms/LoopStrengthReduce/dead-phi.ll21
-rw-r--r--test/Transforms/LoopStrengthReduce/dg.exp3
-rw-r--r--test/Transforms/LoopStrengthReduce/different-type-ivs.ll25
-rw-r--r--test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll23
-rw-r--r--test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll36
-rw-r--r--test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll22
-rw-r--r--test/Transforms/LoopStrengthReduce/dont_reverse.ll21
-rw-r--r--test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll20
-rw-r--r--test/Transforms/LoopStrengthReduce/invariant_value_first.ll23
-rw-r--r--test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll20
-rw-r--r--test/Transforms/LoopStrengthReduce/nested-reduce.ll49
-rw-r--r--test/Transforms/LoopStrengthReduce/ops_after_indvar.ll24
-rw-r--r--test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll28
-rw-r--r--test/Transforms/LoopStrengthReduce/pr2537.ll21
-rw-r--r--test/Transforms/LoopStrengthReduce/pr2570.ll287
-rw-r--r--test/Transforms/LoopStrengthReduce/pr3086.ll29
-rw-r--r--test/Transforms/LoopStrengthReduce/pr3399.ll32
-rw-r--r--test/Transforms/LoopStrengthReduce/pr3571.ll27
-rw-r--r--test/Transforms/LoopStrengthReduce/related_indvars.ll27
-rw-r--r--test/Transforms/LoopStrengthReduce/remove_indvar.ll19
-rw-r--r--test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll27
-rw-r--r--test/Transforms/LoopStrengthReduce/share_ivs.ll24
-rw-r--r--test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll29
-rw-r--r--test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll41
-rw-r--r--test/Transforms/LoopStrengthReduce/variable_stride.ll18
-rw-r--r--test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll14
-rw-r--r--test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll22
-rw-r--r--test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll16
-rw-r--r--test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll17
-rw-r--r--test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll36
-rw-r--r--test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll18
-rw-r--r--test/Transforms/LoopUnroll/2007-11-05-Crash.ll295
-rw-r--r--test/Transforms/LoopUnroll/dg.exp3
-rw-r--r--test/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll1697
-rw-r--r--test/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll32
-rw-r--r--test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll35
-rw-r--r--test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll25
-rw-r--r--test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll28
-rw-r--r--test/Transforms/LoopUnswitch/2007-05-09-tl.ll95
-rw-r--r--test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll45
-rw-r--r--test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll27
-rw-r--r--test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll66
-rw-r--r--test/Transforms/LoopUnswitch/2007-08-01-Dom.ll30
-rw-r--r--test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll55
-rw-r--r--test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll29
-rw-r--r--test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll26
-rw-r--r--test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll22
-rw-r--r--test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll36
-rw-r--r--test/Transforms/LoopUnswitch/basictest.ll31
-rw-r--r--test/Transforms/LoopUnswitch/dg.exp3
-rw-r--r--test/Transforms/LowerInvoke/2003-12-10-Crash.ll22
-rw-r--r--test/Transforms/LowerInvoke/2004-02-29-PHICrash.ll15
-rw-r--r--test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll17
-rw-r--r--test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll15
-rw-r--r--test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll14
-rw-r--r--test/Transforms/LowerInvoke/basictest.ll30
-rw-r--r--test/Transforms/LowerInvoke/dg.exp3
-rw-r--r--test/Transforms/LowerSetJmp/2003-11-05-DominanceProperties.ll16
-rw-r--r--test/Transforms/LowerSetJmp/dg.exp3
-rw-r--r--test/Transforms/LowerSetJmp/simpletest.ll32
-rw-r--r--test/Transforms/LowerSwitch/2003-05-01-PHIProblem.ll15
-rw-r--r--test/Transforms/LowerSwitch/2003-08-23-EmptySwitch.ll9
-rw-r--r--test/Transforms/LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll19
-rw-r--r--test/Transforms/LowerSwitch/dg.exp3
-rw-r--r--test/Transforms/LowerSwitch/feature.ll51
-rw-r--r--test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll11
-rw-r--r--test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll12
-rw-r--r--test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll10
-rw-r--r--test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll16
-rw-r--r--test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll16
-rw-r--r--test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll16
-rw-r--r--test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll22
-rw-r--r--test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll47
-rw-r--r--test/Transforms/Mem2Reg/2005-11-28-Crash.ll62
-rw-r--r--test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll47
-rw-r--r--test/Transforms/Mem2Reg/PromoteMemToRegister.ll18
-rw-r--r--test/Transforms/Mem2Reg/UndefValuesMerge.ll13
-rw-r--r--test/Transforms/Mem2Reg/dg.exp3
-rw-r--r--test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll34
-rw-r--r--test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll19
-rw-r--r--test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll17
-rw-r--r--test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll107
-rw-r--r--test/Transforms/MemCpyOpt/dg.exp3
-rw-r--r--test/Transforms/MemCpyOpt/form-memset.ll55
-rw-r--r--test/Transforms/MemCpyOpt/form-memset2.ll99
-rw-r--r--test/Transforms/MemCpyOpt/memcpy.ll22
-rw-r--r--test/Transforms/MemCpyOpt/sret.ll28
-rw-r--r--test/Transforms/MergeFunc/dg.exp3
-rw-r--r--test/Transforms/MergeFunc/fold-weak.ll11
-rw-r--r--test/Transforms/MergeFunc/phi-speculation1.ll29
-rw-r--r--test/Transforms/MergeFunc/phi-speculation2.ll29
-rw-r--r--test/Transforms/PredicateSimplifier/2006-08-02-Switch.ll19
-rw-r--r--test/Transforms/PredicateSimplifier/2006-08-07-LeaderOffByOne.ll23
-rw-r--r--test/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll24
-rw-r--r--test/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll46
-rw-r--r--test/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll48
-rw-r--r--test/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll26
-rw-r--r--test/Transforms/PredicateSimplifier/2006-11-04-ImpossibleGT.ll16
-rw-r--r--test/Transforms/PredicateSimplifier/2006-11-04-ReplacingZeros.ll25
-rw-r--r--test/Transforms/PredicateSimplifier/2006-11-05-CycleGTLT.ll13
-rw-r--r--test/Transforms/PredicateSimplifier/2006-11-11-Squeeze.ll25
-rw-r--r--test/Transforms/PredicateSimplifier/2006-11-12-MergeNodes.ll41
-rw-r--r--test/Transforms/PredicateSimplifier/2007-01-04-SelectSwitch.ll17
-rw-r--r--test/Transforms/PredicateSimplifier/2007-03-17-OpsToDefVRP.ll19
-rw-r--r--test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll102
-rw-r--r--test/Transforms/PredicateSimplifier/dg.exp3
-rw-r--r--test/Transforms/PredicateSimplifier/predsimplify.ll279
-rw-r--r--test/Transforms/PredicateSimplifier/predsimplify.reg1.ll20
-rw-r--r--test/Transforms/PredicateSimplifier/predsimplify.reg2.ll37
-rw-r--r--test/Transforms/PredicateSimplifier/predsimplify.reg3.ll22
-rw-r--r--test/Transforms/PredicateSimplifier/predsimplify.reg4.ll28
-rw-r--r--test/Transforms/PruneEH/2003-09-14-ExternalCall.ll11
-rw-r--r--test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll15
-rw-r--r--test/Transforms/PruneEH/2008-06-02-Weak.ll12
-rw-r--r--test/Transforms/PruneEH/2008-09-05-CGUpdate.ll1445
-rw-r--r--test/Transforms/PruneEH/dg.exp3
-rw-r--r--test/Transforms/PruneEH/recursivetest.ll20
-rw-r--r--test/Transforms/PruneEH/simplenoreturntest.ll13
-rw-r--r--test/Transforms/PruneEH/simpletest.ll19
-rw-r--r--test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll10
-rw-r--r--test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll17
-rw-r--r--test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll11
-rw-r--r--test/Transforms/RaiseAllocations/dg.exp3
-rw-r--r--test/Transforms/Reassociate/2002-05-15-AgressiveSubMove.ll9
-rw-r--r--test/Transforms/Reassociate/2002-05-15-MissedTree.ll9
-rw-r--r--test/Transforms/Reassociate/2002-05-15-SubReassociate.ll12
-rw-r--r--test/Transforms/Reassociate/2002-05-15-SubReassociate2.ll13
-rw-r--r--test/Transforms/Reassociate/2002-07-09-DominanceProblem.ll10
-rw-r--r--test/Transforms/Reassociate/2003-08-12-InfiniteLoop.ll9
-rw-r--r--test/Transforms/Reassociate/2005-08-24-Crash.ll13
-rw-r--r--test/Transforms/Reassociate/2005-09-01-ArrayOutOfBounds.ll23
-rw-r--r--test/Transforms/Reassociate/2006-04-27-ReassociateVector.ll8
-rw-r--r--test/Transforms/Reassociate/basictest.ll10
-rw-r--r--test/Transforms/Reassociate/basictest2.ll11
-rw-r--r--test/Transforms/Reassociate/basictest3.ll54
-rw-r--r--test/Transforms/Reassociate/basictest4.ll23
-rw-r--r--test/Transforms/Reassociate/dg.exp3
-rw-r--r--test/Transforms/Reassociate/inverses.ll28
-rw-r--r--test/Transforms/Reassociate/looptest.ll50
-rw-r--r--test/Transforms/Reassociate/mul-factor3.ll16
-rw-r--r--test/Transforms/Reassociate/mul-neg-add.ll10
-rw-r--r--test/Transforms/Reassociate/mulfactor.ll14
-rw-r--r--test/Transforms/Reassociate/mulfactor2.ll16
-rw-r--r--test/Transforms/Reassociate/negation.ll21
-rw-r--r--test/Transforms/Reassociate/otherops.ll28
-rw-r--r--test/Transforms/Reassociate/shift-factor.ll13
-rw-r--r--test/Transforms/Reassociate/shifttest.ll12
-rw-r--r--test/Transforms/Reassociate/subtest.ll11
-rw-r--r--test/Transforms/Reassociate/subtest2.ll13
-rw-r--r--test/Transforms/SCCP/2002-05-02-EdgeFailure.ll26
-rw-r--r--test/Transforms/SCCP/2002-05-02-MissSecondInst.ll8
-rw-r--r--test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll19
-rw-r--r--test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll33
-rw-r--r--test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll9
-rw-r--r--test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll30
-rw-r--r--test/Transforms/SCCP/2003-08-26-InvokeHandling.ll18
-rw-r--r--test/Transforms/SCCP/2004-11-16-DeadInvoke.ll13
-rw-r--r--test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll12
-rw-r--r--test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll103
-rw-r--r--test/Transforms/SCCP/2006-12-04-PackedType.ll140
-rw-r--r--test/Transforms/SCCP/2006-12-19-UndefBug.ll8
-rw-r--r--test/Transforms/SCCP/2007-05-16-InvokeCrash.ll41
-rw-r--r--test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll36
-rw-r--r--test/Transforms/SCCP/2008-03-10-sret.ll19
-rw-r--r--test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll11
-rw-r--r--test/Transforms/SCCP/2008-05-23-UndefCallFold.ll14
-rw-r--r--test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll28
-rw-r--r--test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll10
-rw-r--r--test/Transforms/SCCP/apint-array.ll23
-rw-r--r--test/Transforms/SCCP/apint-basictest.ll16
-rw-r--r--test/Transforms/SCCP/apint-basictest2.ll17
-rw-r--r--test/Transforms/SCCP/apint-basictest3.ll23
-rw-r--r--test/Transforms/SCCP/apint-basictest4.ll25
-rw-r--r--test/Transforms/SCCP/apint-bigarray.ll23
-rw-r--r--test/Transforms/SCCP/apint-bigint.ll9
-rw-r--r--test/Transforms/SCCP/apint-bigint2.ll18
-rw-r--r--test/Transforms/SCCP/apint-ipsccp1.ll24
-rw-r--r--test/Transforms/SCCP/apint-ipsccp2.ll19
-rw-r--r--test/Transforms/SCCP/apint-ipsccp3.ll23
-rw-r--r--test/Transforms/SCCP/apint-ipsccp4.ll49
-rw-r--r--test/Transforms/SCCP/apint-load.ll36
-rw-r--r--test/Transforms/SCCP/apint-phi.ll19
-rw-r--r--test/Transforms/SCCP/apint-select.ll21
-rw-r--r--test/Transforms/SCCP/basictest.ll17
-rw-r--r--test/Transforms/SCCP/calltest.ll22
-rw-r--r--test/Transforms/SCCP/dg.exp3
-rw-r--r--test/Transforms/SCCP/empty-struct.ll20
-rw-r--r--test/Transforms/SCCP/ipsccp-basic.ll13
-rw-r--r--test/Transforms/SCCP/ipsccp-conditional.ll19
-rw-r--r--test/Transforms/SCCP/ipsccp-gvar.ll22
-rw-r--r--test/Transforms/SCCP/loadtest.ll26
-rw-r--r--test/Transforms/SCCP/logical-nuke.ll9
-rw-r--r--test/Transforms/SCCP/phitest.ll21
-rw-r--r--test/Transforms/SCCP/sccptest.ll31
-rw-r--r--test/Transforms/SCCP/select.ll12
-rw-r--r--test/Transforms/SRETPromotion/2008-03-11-attributes.ll7
-rw-r--r--test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll24
-rw-r--r--test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll20
-rw-r--r--test/Transforms/SRETPromotion/basictest.ll33
-rw-r--r--test/Transforms/SRETPromotion/dg.exp3
-rw-r--r--test/Transforms/ScalarRepl/2003-05-29-ArrayFail.ll12
-rw-r--r--test/Transforms/ScalarRepl/2003-05-30-InvalidIndices.ll8
-rw-r--r--test/Transforms/ScalarRepl/2003-05-30-MultiLevel.ll10
-rw-r--r--test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll13
-rw-r--r--test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll16
-rw-r--r--test/Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll28
-rw-r--r--test/Transforms/ScalarRepl/2006-01-24-IllegalUnionPromoteCrash.ll12
-rw-r--r--test/Transforms/ScalarRepl/2006-04-20-PromoteCrash.ll18
-rw-r--r--test/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll57
-rw-r--r--test/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll19
-rw-r--r--test/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll20
-rw-r--r--test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll44
-rw-r--r--test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll27
-rw-r--r--test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll23
-rw-r--r--test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll30
-rw-r--r--test/Transforms/ScalarRepl/2008-01-29-PromoteBug.ll21
-rw-r--r--test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll16
-rw-r--r--test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll32
-rw-r--r--test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll17
-rw-r--r--test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll22
-rw-r--r--test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll24
-rw-r--r--test/Transforms/ScalarRepl/2009-01-09-scalarrepl-empty.ll15
-rw-r--r--test/Transforms/ScalarRepl/2009-02-02-ScalarPromoteOutOfRange.ll16
-rw-r--r--test/Transforms/ScalarRepl/2009-02-05-LoadFCA.ll20
-rw-r--r--test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll19
-rw-r--r--test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll184
-rw-r--r--test/Transforms/ScalarRepl/2009-03-17-CleanUp.ll3961
-rw-r--r--test/Transforms/ScalarRepl/2009-04-21-ZeroLengthMemSet.ll16
-rw-r--r--test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll12
-rw-r--r--test/Transforms/ScalarRepl/2009-06-01-BitcastIntPadding.ll17
-rw-r--r--test/Transforms/ScalarRepl/AggregatePromote.ll51
-rw-r--r--test/Transforms/ScalarRepl/DifferingTypes.ll15
-rw-r--r--test/Transforms/ScalarRepl/arraytest.ll10
-rw-r--r--test/Transforms/ScalarRepl/badarray.ll20
-rw-r--r--test/Transforms/ScalarRepl/basictest.ll10
-rw-r--r--test/Transforms/ScalarRepl/bitfield-sroa.ll16
-rw-r--r--test/Transforms/ScalarRepl/copy-aggregate.ll57
-rw-r--r--test/Transforms/ScalarRepl/debuginfo.ll105
-rw-r--r--test/Transforms/ScalarRepl/dg.exp3
-rw-r--r--test/Transforms/ScalarRepl/load-store-aggregate.ll30
-rw-r--r--test/Transforms/ScalarRepl/memcpy-from-global.ll33
-rw-r--r--test/Transforms/ScalarRepl/memset-aggregate-byte-leader.ll23
-rw-r--r--test/Transforms/ScalarRepl/memset-aggregate.ll66
-rw-r--r--test/Transforms/ScalarRepl/not-a-vector.ll19
-rw-r--r--test/Transforms/ScalarRepl/phinodepromote.ll34
-rw-r--r--test/Transforms/ScalarRepl/select_promote.ll18
-rw-r--r--test/Transforms/ScalarRepl/sroa-fca.ll21
-rw-r--r--test/Transforms/ScalarRepl/sroa_two.ll13
-rw-r--r--test/Transforms/ScalarRepl/union-fp-int.ll13
-rw-r--r--test/Transforms/ScalarRepl/union-packed.ll13
-rw-r--r--test/Transforms/ScalarRepl/union-pointer.ll41
-rw-r--r--test/Transforms/ScalarRepl/vector_memcpy.ll29
-rw-r--r--test/Transforms/ScalarRepl/vector_promote.ll64
-rw-r--r--test/Transforms/ScalarRepl/volatile.ll12
-rw-r--r--test/Transforms/SimplifyCFG/2002-05-05-EmptyBlockMerge.ll22
-rw-r--r--test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll19
-rw-r--r--test/Transforms/SimplifyCFG/2002-06-24-PHINode.ll14
-rw-r--r--test/Transforms/SimplifyCFG/2002-09-24-PHIAssertion.ll13
-rw-r--r--test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll17
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll13
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-05-MishandleInvoke.ll12
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll22
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll26
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch-dbg.ll58
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll80
-rw-r--r--test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll40
-rw-r--r--test/Transforms/SimplifyCFG/2005-06-16-PHICrash.ll95
-rw-r--r--test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll71
-rw-r--r--test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll75
-rw-r--r--test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll15
-rw-r--r--test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll124
-rw-r--r--test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll27
-rw-r--r--test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll413
-rw-r--r--test/Transforms/SimplifyCFG/2006-08-03-Crash.ll98
-rw-r--r--test/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll28
-rw-r--r--test/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll555
-rw-r--r--test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll131
-rw-r--r--test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll14
-rw-r--r--test/Transforms/SimplifyCFG/2007-12-21-Crash.ll37
-rw-r--r--test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll26
-rw-r--r--test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll43
-rw-r--r--test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll30
-rw-r--r--test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll131
-rw-r--r--test/Transforms/SimplifyCFG/2008-07-13-InfLoopMiscompile.ll36
-rw-r--r--test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll60
-rw-r--r--test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll18
-rw-r--r--test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll36
-rw-r--r--test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll13
-rw-r--r--test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll46
-rw-r--r--test/Transforms/SimplifyCFG/2009-01-18-PHIPropCrash.ll31
-rw-r--r--test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll31
-rw-r--r--test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll108
-rw-r--r--test/Transforms/SimplifyCFG/2009-05-12-externweak.ll47
-rw-r--r--test/Transforms/SimplifyCFG/BrUnwind.ll15
-rw-r--r--test/Transforms/SimplifyCFG/DeadSetCC.ll28
-rw-r--r--test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll18
-rw-r--r--test/Transforms/SimplifyCFG/HoistCode.ll11
-rw-r--r--test/Transforms/SimplifyCFG/InvokeEliminate.ll18
-rw-r--r--test/Transforms/SimplifyCFG/PhiBlockMerge.ll22
-rw-r--r--test/Transforms/SimplifyCFG/PhiBlockMerge2.ll27
-rw-r--r--test/Transforms/SimplifyCFG/PhiEliminate.ll41
-rw-r--r--test/Transforms/SimplifyCFG/PhiEliminate2.ll14
-rw-r--r--test/Transforms/SimplifyCFG/PhiNoEliminate.ll27
-rw-r--r--test/Transforms/SimplifyCFG/SpeculativeExec.ll21
-rw-r--r--test/Transforms/SimplifyCFG/UncondBranchToReturn.ll33
-rw-r--r--test/Transforms/SimplifyCFG/UnreachableEliminate.ll33
-rw-r--r--test/Transforms/SimplifyCFG/basictest.ll25
-rw-r--r--test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll70
-rw-r--r--test/Transforms/SimplifyCFG/branch-cond-merge.ll19
-rw-r--r--test/Transforms/SimplifyCFG/branch-cond-prop.ll17
-rw-r--r--test/Transforms/SimplifyCFG/branch-fold-test.ll17
-rw-r--r--test/Transforms/SimplifyCFG/branch-fold.ll13
-rw-r--r--test/Transforms/SimplifyCFG/branch-phi-thread.ll66
-rw-r--r--test/Transforms/SimplifyCFG/branch_fold_dbg.ll122
-rw-r--r--test/Transforms/SimplifyCFG/dbginfo.ll73
-rw-r--r--test/Transforms/SimplifyCFG/dg.exp3
-rw-r--r--test/Transforms/SimplifyCFG/hoist-common-code.dbg.ll33
-rw-r--r--test/Transforms/SimplifyCFG/hoist-common-code.ll18
-rw-r--r--test/Transforms/SimplifyCFG/iterative-simplify.ll100
-rw-r--r--test/Transforms/SimplifyCFG/noreturn-call.ll11
-rw-r--r--test/Transforms/SimplifyCFG/return-merge.ll19
-rw-r--r--test/Transforms/SimplifyCFG/switch-simplify-crash.ll108
-rw-r--r--test/Transforms/SimplifyCFG/switch_create.ll47
-rw-r--r--test/Transforms/SimplifyCFG/switch_formation.dbg.ll49
-rw-r--r--test/Transforms/SimplifyCFG/switch_formation.ll31
-rw-r--r--test/Transforms/SimplifyCFG/switch_switch_fold.ll47
-rw-r--r--test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll116
-rw-r--r--test/Transforms/SimplifyCFG/switch_thread.ll79
-rw-r--r--test/Transforms/SimplifyCFG/trapping-load-unreachable.ll19
-rw-r--r--test/Transforms/SimplifyCFG/two-entry-phi-return.dbg.ll28
-rw-r--r--test/Transforms/SimplifyCFG/two-entry-phi-return.ll15
-rw-r--r--test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll11
-rw-r--r--test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll29
-rw-r--r--test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll14
-rw-r--r--test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll10
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-01-04-Annotate.ll12
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll13
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-02-12-StrTo.ll14
-rw-r--r--test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll14
-rw-r--r--test/Transforms/SimplifyLibCalls/ExitInMain.ll15
-rw-r--r--test/Transforms/SimplifyLibCalls/FFS.ll36
-rw-r--r--test/Transforms/SimplifyLibCalls/FPrintF.ll25
-rw-r--r--test/Transforms/SimplifyLibCalls/IsDigit.ll21
-rw-r--r--test/Transforms/SimplifyLibCalls/MemCpy.ll20
-rw-r--r--test/Transforms/SimplifyLibCalls/Printf.ll21
-rw-r--r--test/Transforms/SimplifyLibCalls/Puts.ll26
-rw-r--r--test/Transforms/SimplifyLibCalls/SPrintF.ll36
-rw-r--r--test/Transforms/SimplifyLibCalls/StrCat.ll29
-rw-r--r--test/Transforms/SimplifyLibCalls/StrChr.ll22
-rw-r--r--test/Transforms/SimplifyLibCalls/StrCmp.ll28
-rw-r--r--test/Transforms/SimplifyLibCalls/StrCpy.ll26
-rw-r--r--test/Transforms/SimplifyLibCalls/StrLen.ll56
-rw-r--r--test/Transforms/SimplifyLibCalls/StrNCat.ll27
-rw-r--r--test/Transforms/SimplifyLibCalls/StrNCmp.ll28
-rw-r--r--test/Transforms/SimplifyLibCalls/StrNCpy.ll25
-rw-r--r--test/Transforms/SimplifyLibCalls/ToAscii.ll21
-rw-r--r--test/Transforms/SimplifyLibCalls/abs.ll11
-rw-r--r--test/Transforms/SimplifyLibCalls/dg.exp3
-rw-r--r--test/Transforms/SimplifyLibCalls/exp2.ll38
-rw-r--r--test/Transforms/SimplifyLibCalls/floor.ll39
-rw-r--r--test/Transforms/SimplifyLibCalls/half-powr.ll41
-rw-r--r--test/Transforms/SimplifyLibCalls/memcmp.ll22
-rw-r--r--test/Transforms/SimplifyLibCalls/memmove.ll12
-rw-r--r--test/Transforms/SimplifyLibCalls/memset.ll12
-rw-r--r--test/Transforms/SimplifyLibCalls/pow2.ll37
-rw-r--r--test/Transforms/StripSymbols/2007-01-15-llvm.used.ll15
-rw-r--r--test/Transforms/StripSymbols/dg.exp3
-rw-r--r--test/Transforms/TailCallElim/accum_recursion.ll15
-rw-r--r--test/Transforms/TailCallElim/accum_recursion_constant_arg.ll20
-rw-r--r--test/Transforms/TailCallElim/ackermann.ll26
-rw-r--r--test/Transforms/TailCallElim/dg.exp3
-rw-r--r--test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll13
-rw-r--r--test/Transforms/TailCallElim/inf-recursion.ll10
-rw-r--r--test/Transforms/TailCallElim/intervening-inst.ll17
-rw-r--r--test/Transforms/TailCallElim/move_alloca_for_tail_call.ll13
-rw-r--r--test/Transforms/TailCallElim/return_constant.ll17
-rw-r--r--test/Transforms/TailCallElim/trivial_codegen_tailcall.ll11
-rw-r--r--test/Transforms/TailDup/2003-06-24-Simpleloop.ll15
-rw-r--r--test/Transforms/TailDup/2003-07-22-InfiniteLoop.ll11
-rw-r--r--test/Transforms/TailDup/2003-08-23-InvalidatedPointers.ll29
-rw-r--r--test/Transforms/TailDup/2003-08-31-UnreachableBlocks.ll17
-rw-r--r--test/Transforms/TailDup/2004-04-01-DemoteRegToStack.ll20
-rw-r--r--test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll26
-rw-r--r--test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll27
-rw-r--r--test/Transforms/TailDup/MergeTest.ll27
-rw-r--r--test/Transforms/TailDup/PHIUpdateTest.ll16
-rw-r--r--test/Transforms/TailDup/basictest.ll20
-rw-r--r--test/Transforms/TailDup/basictest2.ll15
-rw-r--r--test/Transforms/TailDup/dg.exp3
-rw-r--r--test/Transforms/TailDup/if-tail-dup.ll49
1289 files changed, 58145 insertions, 0 deletions
diff --git a/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll b/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll
new file mode 100644
index 000000000000..893d82b9f5e0
--- /dev/null
+++ b/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -o - | opt -adce
+
+define i32 @"main"(i32 %argc)
+begin
+ br label %2
+
+ %retval = phi i32 [ %argc, %2 ] ; <i32> [#uses=2]
+ %two = add i32 %retval, %retval ; <i32> [#uses=1]
+ ret i32 %two
+
+ br label %1
+end
+
diff --git a/test/Transforms/ADCE/2002-05-22-PHITest.ll b/test/Transforms/ADCE/2002-05-22-PHITest.ll
new file mode 100644
index 000000000000..04f0051af8dc
--- /dev/null
+++ b/test/Transforms/ADCE/2002-05-22-PHITest.ll
@@ -0,0 +1,16 @@
+; It is illegal to remove BB1 because it will mess up the PHI node!
+;
+; RUN: llvm-as < %s | opt -adce | llvm-dis | grep BB1
+
+define i32 @test(i1 %C, i32 %A, i32 %B) {
+; <label>:0
+ br i1 %C, label %BB1, label %BB2
+
+BB1: ; preds = %0
+ br label %BB2
+
+BB2: ; preds = %BB1, %0
+ %R = phi i32 [ %A, %0 ], [ %B, %BB1 ] ; <i32> [#uses=1]
+ ret i32 %R
+}
+
diff --git a/test/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll b/test/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll
new file mode 100644
index 000000000000..911f8e678b35
--- /dev/null
+++ b/test/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll
@@ -0,0 +1,32 @@
+; This testcase contains a entire loop that should be removed. The only thing
+; left is the store instruction in BB0. The problem this testcase was running
+; into was that when the reg109 PHI was getting zero predecessors, it was
+; removed even though there were uses still around. Now the uses are filled
+; in with a dummy value before the PHI is deleted.
+;
+; RUN: llvm-as < %s | opt -adce
+
+ %node_t = type { double*, %node_t*, %node_t**, double**, double*, i32, i32 }
+
+define void @localize_local(%node_t* %nodelist) {
+bb0:
+ %nodelist.upgrd.1 = alloca %node_t* ; <%node_t**> [#uses=2]
+ store %node_t* %nodelist, %node_t** %nodelist.upgrd.1
+ br label %bb1
+
+bb1: ; preds = %bb0
+ %reg107 = load %node_t** %nodelist.upgrd.1 ; <%node_t*> [#uses=2]
+ %cond211 = icmp eq %node_t* %reg107, null ; <i1> [#uses=1]
+ br i1 %cond211, label %bb3, label %bb2
+
+bb2: ; preds = %bb2, %bb1
+ %reg109 = phi %node_t* [ %reg110, %bb2 ], [ %reg107, %bb1 ] ; <%node_t*> [#uses=1]
+ %reg212 = getelementptr %node_t* %reg109, i64 0, i32 1 ; <%node_t**> [#uses=1]
+ %reg110 = load %node_t** %reg212 ; <%node_t*> [#uses=2]
+ %cond213 = icmp ne %node_t* %reg110, null ; <i1> [#uses=1]
+ br i1 %cond213, label %bb2, label %bb3
+
+bb3: ; preds = %bb2, %bb1
+ ret void
+}
+
diff --git a/test/Transforms/ADCE/2002-05-28-Crash-distilled.ll b/test/Transforms/ADCE/2002-05-28-Crash-distilled.ll
new file mode 100644
index 000000000000..5d25ff13525e
--- /dev/null
+++ b/test/Transforms/ADCE/2002-05-28-Crash-distilled.ll
@@ -0,0 +1,17 @@
+; This testcase is a distilled form of: 2002-05-28-Crash.ll
+
+; RUN: llvm-as < %s | opt -adce
+
+define float @test(i32 %i) {
+ %F = sitofp i32 %i to float ; <float> [#uses=1]
+ %I = bitcast i32 %i to i32 ; <i32> [#uses=1]
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %B = icmp ne i32 %I, 0 ; <i1> [#uses=1]
+ br i1 %B, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret float %F
+}
+
diff --git a/test/Transforms/ADCE/2002-05-28-Crash.ll b/test/Transforms/ADCE/2002-05-28-Crash.ll
new file mode 100644
index 000000000000..27c7205203c0
--- /dev/null
+++ b/test/Transforms/ADCE/2002-05-28-Crash.ll
@@ -0,0 +1,54 @@
+; This testcase is distilled from the GNU rx package. The loop should be
+; removed but causes a problem when ADCE does. The source function is:
+; int rx_bitset_empty (int size, rx_Bitset set) {
+; int x;
+; RX_subset s;
+; s = set[0];
+; set[0] = 1;
+; for (x = rx_bitset_numb_subsets(size) - 1; !set[x]; --x)
+; ;
+; set[0] = s;
+; return !s;
+;}
+;
+; RUN: llvm-as < %s | opt -adce
+
+define i32 @rx_bitset_empty(i32 %size, i32* %set) {
+bb1:
+ %reg110 = load i32* %set ; <i32> [#uses=2]
+ store i32 1, i32* %set
+ %cast112 = sext i32 %size to i64 ; <i64> [#uses=1]
+ %reg113 = add i64 %cast112, 31 ; <i64> [#uses=1]
+ %reg114 = lshr i64 %reg113, 5 ; <i64> [#uses=2]
+ %cast109 = trunc i64 %reg114 to i32 ; <i32> [#uses=1]
+ %reg129 = add i32 %cast109, -1 ; <i32> [#uses=1]
+ %reg114-idxcast = trunc i64 %reg114 to i32 ; <i32> [#uses=1]
+ %reg114-idxcast-offset = add i32 %reg114-idxcast, 1073741823 ; <i32> [#uses=1]
+ %reg114-idxcast-offset.upgrd.1 = zext i32 %reg114-idxcast-offset to i64 ; <i64> [#uses=1]
+ %reg124 = getelementptr i32* %set, i64 %reg114-idxcast-offset.upgrd.1 ; <i32*> [#uses=1]
+ %reg125 = load i32* %reg124 ; <i32> [#uses=1]
+ %cond232 = icmp ne i32 %reg125, 0 ; <i1> [#uses=1]
+ br i1 %cond232, label %bb3, label %bb2
+
+bb2: ; preds = %bb2, %bb1
+ %cann-indvar = phi i32 [ 0, %bb1 ], [ %add1-indvar, %bb2 ] ; <i32> [#uses=2]
+ %reg130-scale = mul i32 %cann-indvar, -1 ; <i32> [#uses=1]
+ %reg130 = add i32 %reg130-scale, %reg129 ; <i32> [#uses=1]
+ %add1-indvar = add i32 %cann-indvar, 1 ; <i32> [#uses=1]
+ %reg130-idxcast = bitcast i32 %reg130 to i32 ; <i32> [#uses=1]
+ %reg130-idxcast-offset = add i32 %reg130-idxcast, 1073741823 ; <i32> [#uses=1]
+ %reg130-idxcast-offset.upgrd.2 = zext i32 %reg130-idxcast-offset to i64 ; <i64> [#uses=1]
+ %reg118 = getelementptr i32* %set, i64 %reg130-idxcast-offset.upgrd.2 ; <i32*> [#uses=1]
+ %reg119 = load i32* %reg118 ; <i32> [#uses=1]
+ %cond233 = icmp eq i32 %reg119, 0 ; <i1> [#uses=1]
+ br i1 %cond233, label %bb2, label %bb3
+
+bb3: ; preds = %bb2, %bb1
+ store i32 %reg110, i32* %set
+ %cast126 = zext i32 %reg110 to i64 ; <i64> [#uses=1]
+ %reg127 = add i64 %cast126, -1 ; <i64> [#uses=1]
+ %reg128 = lshr i64 %reg127, 63 ; <i64> [#uses=1]
+ %cast120 = trunc i64 %reg128 to i32 ; <i32> [#uses=1]
+ ret i32 %cast120
+}
+
diff --git a/test/Transforms/ADCE/2002-07-17-AssertionFailure.ll b/test/Transforms/ADCE/2002-07-17-AssertionFailure.ll
new file mode 100644
index 000000000000..fb4fe4a8d279
--- /dev/null
+++ b/test/Transforms/ADCE/2002-07-17-AssertionFailure.ll
@@ -0,0 +1,13 @@
+; This testcase fails because ADCE does not correctly delete the chain of
+; three instructions that are dead here. Ironically there were a dead basic
+; block in this function, it would work fine, but that would be the part we
+; have to fix now, wouldn't it....
+;
+; RUN: llvm-as < %s | opt -adce
+
+define void @foo(i8* %reg5481) {
+ %cast611 = bitcast i8* %reg5481 to i8** ; <i8**> [#uses=1]
+ %reg162 = load i8** %cast611 ; <i8*> [#uses=1]
+ ptrtoint i8* %reg162 to i32 ; <i32>:1 [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/ADCE/2002-07-17-PHIAssertion.ll b/test/Transforms/ADCE/2002-07-17-PHIAssertion.ll
new file mode 100644
index 000000000000..42a7e4dcde4a
--- /dev/null
+++ b/test/Transforms/ADCE/2002-07-17-PHIAssertion.ll
@@ -0,0 +1,48 @@
+; This testcase was extracted from the gzip SPEC benchmark
+;
+; RUN: llvm-as < %s | opt -adce
+
+@bk = external global i32 ; <i32*> [#uses=2]
+@hufts = external global i32 ; <i32*> [#uses=1]
+
+define i32 @inflate() {
+bb0:
+ br label %bb2
+
+bb2: ; preds = %bb6, %bb0
+ %reg128 = phi i32 [ %reg130, %bb6 ], [ 0, %bb0 ] ; <i32> [#uses=2]
+ br i1 true, label %bb4, label %bb3
+
+bb3: ; preds = %bb2
+ br label %UnifiedExitNode
+
+bb4: ; preds = %bb2
+ %reg117 = load i32* @hufts ; <i32> [#uses=2]
+ %cond241 = icmp ule i32 %reg117, %reg128 ; <i1> [#uses=1]
+ br i1 %cond241, label %bb6, label %bb5
+
+bb5: ; preds = %bb4
+ br label %bb6
+
+bb6: ; preds = %bb5, %bb4
+ %reg130 = phi i32 [ %reg117, %bb5 ], [ %reg128, %bb4 ] ; <i32> [#uses=1]
+ br i1 false, label %bb2, label %bb7
+
+bb7: ; preds = %bb6
+ %reg126 = load i32* @bk ; <i32> [#uses=1]
+ %cond247 = icmp ule i32 %reg126, 7 ; <i1> [#uses=1]
+ br i1 %cond247, label %bb9, label %bb8
+
+bb8: ; preds = %bb8, %bb7
+ %reg119 = load i32* @bk ; <i32> [#uses=1]
+ %cond256 = icmp ugt i32 %reg119, 7 ; <i1> [#uses=1]
+ br i1 %cond256, label %bb8, label %bb9
+
+bb9: ; preds = %bb8, %bb7
+ br label %UnifiedExitNode
+
+UnifiedExitNode: ; preds = %bb9, %bb3
+ %UnifiedRetVal = phi i32 [ 7, %bb3 ], [ 0, %bb9 ] ; <i32> [#uses=1]
+ ret i32 %UnifiedRetVal
+}
+
diff --git a/test/Transforms/ADCE/2002-07-29-Segfault.ll b/test/Transforms/ADCE/2002-07-29-Segfault.ll
new file mode 100644
index 000000000000..1c65b3b54434
--- /dev/null
+++ b/test/Transforms/ADCE/2002-07-29-Segfault.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -adce
+
+define void @test() {
+ br label %BB3
+
+BB3: ; preds = %BB3, %0
+ br label %BB3
+}
+
diff --git a/test/Transforms/ADCE/2003-01-22-PredecessorProblem.ll b/test/Transforms/ADCE/2003-01-22-PredecessorProblem.ll
new file mode 100644
index 000000000000..4ec900560705
--- /dev/null
+++ b/test/Transforms/ADCE/2003-01-22-PredecessorProblem.ll
@@ -0,0 +1,25 @@
+; Testcase reduced from 197.parser by bugpoint
+; RUN: llvm-as < %s | opt -adce
+
+define void @conjunction_prune() {
+; <label>:0
+ br label %bb19
+
+bb19: ; preds = %bb23, %bb22, %0
+ %reg205 = phi i8* [ null, %bb22 ], [ null, %bb23 ], [ null, %0 ] ; <i8*> [#uses=1]
+ br i1 false, label %bb21, label %bb22
+
+bb21: ; preds = %bb19
+ %cast455 = bitcast i8* %reg205 to i8** ; <i8**> [#uses=0]
+ br label %bb22
+
+bb22: ; preds = %bb21, %bb19
+ br i1 false, label %bb19, label %bb23
+
+bb23: ; preds = %bb22
+ br i1 false, label %bb19, label %bb28
+
+bb28: ; preds = %bb23
+ ret void
+}
+
diff --git a/test/Transforms/ADCE/2003-04-25-PHIPostDominateProblem.ll b/test/Transforms/ADCE/2003-04-25-PHIPostDominateProblem.ll
new file mode 100644
index 000000000000..603b14b537d5
--- /dev/null
+++ b/test/Transforms/ADCE/2003-04-25-PHIPostDominateProblem.ll
@@ -0,0 +1,35 @@
+; THis testcase caused an assertion failure because a PHI node did not have
+; entries for it's postdominator. But I think this can only happen when the
+; PHI node is dead, so we just avoid patching up dead PHI nodes.
+
+; RUN: llvm-as < %s | opt -adce
+
+target datalayout = "e-p:32:32"
+
+define void @dead_test8() {
+entry:
+ br label %loopentry
+
+loopentry: ; preds = %endif, %entry
+ %k.1 = phi i32 [ %k.0, %endif ], [ 0, %entry ] ; <i32> [#uses=1]
+ br i1 false, label %no_exit, label %return
+
+no_exit: ; preds = %loopentry
+ br i1 false, label %then, label %else
+
+then: ; preds = %no_exit
+ br label %endif
+
+else: ; preds = %no_exit
+ %dec = add i32 %k.1, -1 ; <i32> [#uses=1]
+ br label %endif
+
+endif: ; preds = %else, %then
+ %k.0 = phi i32 [ %dec, %else ], [ 0, %then ] ; <i32> [#uses=1]
+ store i32 2, i32* null
+ br label %loopentry
+
+return: ; preds = %loopentry
+ ret void
+}
+
diff --git a/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll b/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll
new file mode 100644
index 000000000000..a9657a7a37d1
--- /dev/null
+++ b/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+
+@G = external global i32* ; <i32**> [#uses=1]
+
+declare void @Fn(i32*)
+
+define i32 @main(i32 %argc.1, i8** %argv.1) {
+entry:
+ br label %endif.42
+
+endif.42: ; preds = %shortcirc_done.12, %then.66, %endif.42, %entry
+ br i1 false, label %endif.65, label %endif.42
+
+then.66: ; preds = %shortcirc_done.12
+ call void @Fn( i32* %tmp.2846 )
+ br label %endif.42
+
+endif.65: ; preds = %endif.42
+ %tmp.2846 = load i32** @G ; <i32*> [#uses=1]
+ br i1 false, label %shortcirc_next.12, label %shortcirc_done.12
+
+shortcirc_next.12: ; preds = %endif.65
+ br label %shortcirc_done.12
+
+shortcirc_done.12: ; preds = %shortcirc_next.12, %endif.65
+ br i1 false, label %then.66, label %endif.42
+}
+
diff --git a/test/Transforms/ADCE/2003-06-24-BadSuccessor.ll b/test/Transforms/ADCE/2003-06-24-BadSuccessor.ll
new file mode 100644
index 000000000000..e5dd0cc6d9a7
--- /dev/null
+++ b/test/Transforms/ADCE/2003-06-24-BadSuccessor.ll
@@ -0,0 +1,91 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+target datalayout = "e-p:32:32"
+ %struct..CppObjTypeDesc = type { i32, i16, i16 }
+ %struct..TypeToken = type { i32, i16, i16 }
+
+define i32 @C_ReFaxToDb() {
+entry:
+ br i1 false, label %endif.0, label %then.0
+
+then.0: ; preds = %entry
+ ret i32 0
+
+endif.0: ; preds = %entry
+ br i1 false, label %then.11, label %then.4
+
+then.4: ; preds = %endif.0
+ ret i32 0
+
+then.11: ; preds = %endif.0
+ br i1 false, label %loopentry.0, label %else.2
+
+loopentry.0: ; preds = %loopentry.1, %endif.14, %then.11
+ br i1 false, label %endif.14, label %loopexit.0
+
+endif.14: ; preds = %loopentry.0
+ br i1 false, label %loopentry.1, label %loopentry.0
+
+loopentry.1: ; preds = %then.53, %endif.14
+ %SubArrays.10 = phi i32* [ %SubArrays.8, %then.53 ], [ null, %endif.14 ] ; <i32*> [#uses=3]
+ br i1 false, label %no_exit.1, label %loopentry.0
+
+no_exit.1: ; preds = %loopentry.1
+ switch i32 0, label %label.17 [
+ i32 2, label %label.11
+ i32 19, label %label.10
+ ]
+
+label.10: ; preds = %no_exit.1
+ br i1 false, label %then.43, label %endif.43
+
+then.43: ; preds = %label.10
+ br i1 false, label %then.44, label %endif.44
+
+then.44: ; preds = %then.43
+ br i1 false, label %shortcirc_next.4, label %endif.45
+
+shortcirc_next.4: ; preds = %then.44
+ br i1 false, label %no_exit.2, label %loopexit.2
+
+no_exit.2: ; preds = %shortcirc_next.4
+ %tmp.897 = getelementptr i32* %SubArrays.10, i64 0 ; <i32*> [#uses=1]
+ %tmp.899 = load i32* %tmp.897 ; <i32> [#uses=1]
+ store i32 %tmp.899, i32* null
+ ret i32 0
+
+loopexit.2: ; preds = %shortcirc_next.4
+ ret i32 0
+
+endif.45: ; preds = %then.44
+ ret i32 0
+
+endif.44: ; preds = %then.43
+ ret i32 0
+
+endif.43: ; preds = %label.10
+ ret i32 0
+
+label.11: ; preds = %no_exit.1
+ ret i32 0
+
+label.17: ; preds = %no_exit.1
+ br i1 false, label %then.53, label %shortcirc_next.7
+
+shortcirc_next.7: ; preds = %label.17
+ br i1 false, label %then.53, label %shortcirc_next.8
+
+shortcirc_next.8: ; preds = %shortcirc_next.7
+ ret i32 0
+
+then.53: ; preds = %shortcirc_next.7, %label.17
+ %SubArrays.8 = phi i32* [ %SubArrays.10, %shortcirc_next.7 ], [ %SubArrays.10, %label.17 ] ; <i32*> [#uses=1]
+ %tmp.1023 = load i32* null ; <i32> [#uses=1]
+ switch i32 %tmp.1023, label %loopentry.1 [
+ ]
+
+loopexit.0: ; preds = %loopentry.0
+ ret i32 0
+
+else.2: ; preds = %then.11
+ ret i32 0
+}
diff --git a/test/Transforms/ADCE/2003-06-24-BasicFunctionality.ll b/test/Transforms/ADCE/2003-06-24-BasicFunctionality.ll
new file mode 100644
index 000000000000..9c6764d56235
--- /dev/null
+++ b/test/Transforms/ADCE/2003-06-24-BasicFunctionality.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis | not grep then:
+
+define void @dead_test8(i32* %data.1, i32 %idx.1) {
+entry:
+ %tmp.1 = load i32* %data.1 ; <i32> [#uses=2]
+ %tmp.41 = icmp sgt i32 %tmp.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp.41, label %no_exit.preheader, label %return
+
+no_exit.preheader: ; preds = %entry
+ %tmp.11 = getelementptr i32* %data.1, i64 1 ; <i32*> [#uses=1]
+ %tmp.22-idxcast = sext i32 %idx.1 to i64 ; <i64> [#uses=1]
+ %tmp.28 = getelementptr i32* %data.1, i64 %tmp.22-idxcast ; <i32*> [#uses=1]
+ br label %no_exit
+
+no_exit: ; preds = %endif, %no_exit.preheader
+ %k.1 = phi i32 [ %k.0, %endif ], [ 0, %no_exit.preheader ] ; <i32> [#uses=3]
+ %i.0 = phi i32 [ %inc.1, %endif ], [ 0, %no_exit.preheader ] ; <i32> [#uses=1]
+ %tmp.12 = load i32* %tmp.11 ; <i32> [#uses=1]
+ %tmp.14 = sub i32 0, %tmp.12 ; <i32> [#uses=1]
+ %tmp.161 = icmp ne i32 %k.1, %tmp.14 ; <i1> [#uses=1]
+ br i1 %tmp.161, label %then, label %else
+
+then: ; preds = %no_exit
+ %inc.0 = add i32 %k.1, 1 ; <i32> [#uses=1]
+ br label %endif
+
+else: ; preds = %no_exit
+ %dec = add i32 %k.1, -1 ; <i32> [#uses=1]
+ br label %endif
+
+endif: ; preds = %else, %then
+ %k.0 = phi i32 [ %dec, %else ], [ %inc.0, %then ] ; <i32> [#uses=1]
+ store i32 2, i32* %tmp.28
+ %inc.1 = add i32 %i.0, 1 ; <i32> [#uses=2]
+ %tmp.4 = icmp slt i32 %inc.1, %tmp.1 ; <i1> [#uses=1]
+ br i1 %tmp.4, label %no_exit, label %return
+
+return: ; preds = %endif, %entry
+ ret void
+}
+
diff --git a/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll b/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll
new file mode 100644
index 000000000000..e6345c13eba3
--- /dev/null
+++ b/test/Transforms/ADCE/2003-09-10-UnwindInstFail.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+
+define void @test() {
+ br i1 false, label %then, label %endif
+
+then: ; preds = %0
+ invoke void null( i8* null )
+ to label %invoke_cont unwind label %invoke_catch
+
+invoke_catch: ; preds = %then
+ unwind
+
+invoke_cont: ; preds = %then
+ ret void
+
+endif: ; preds = %0
+ ret void
+}
+
diff --git a/test/Transforms/ADCE/2003-09-15-InfLoopCrash.ll b/test/Transforms/ADCE/2003-09-15-InfLoopCrash.ll
new file mode 100644
index 000000000000..37e077f21cb9
--- /dev/null
+++ b/test/Transforms/ADCE/2003-09-15-InfLoopCrash.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+
+define i32 @main() {
+ br label %loop
+
+loop: ; preds = %loop, %0
+ br label %loop
+}
+
diff --git a/test/Transforms/ADCE/2003-11-16-MissingPostDominanceInfo.ll b/test/Transforms/ADCE/2003-11-16-MissingPostDominanceInfo.ll
new file mode 100644
index 000000000000..6e9b17ed3131
--- /dev/null
+++ b/test/Transforms/ADCE/2003-11-16-MissingPostDominanceInfo.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis | grep call
+declare void @exit(i32)
+
+define i32 @main(i32 %argc) {
+ %C = icmp eq i32 %argc, 1 ; <i1> [#uses=2]
+ br i1 %C, label %Cond, label %Done
+
+Cond: ; preds = %0
+ br i1 %C, label %Loop, label %Done
+
+Loop: ; preds = %Loop, %Cond
+ call void @exit( i32 0 )
+ br label %Loop
+
+Done: ; preds = %Cond, %0
+ ret i32 1
+}
+
diff --git a/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll b/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll
new file mode 100644
index 000000000000..87a1550e9d45
--- /dev/null
+++ b/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+
+define void @test() {
+entry:
+ br label %UnifiedReturnBlock
+
+UnifiedReturnBlock: ; preds = %invoke_catch.0, %entry
+ ret void
+
+invoke_catch.0: ; No predecessors!
+ br i1 false, label %UnifiedUnwindBlock, label %UnifiedReturnBlock
+
+UnifiedUnwindBlock: ; preds = %invoke_catch.0
+ unwind
+}
+
diff --git a/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll b/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll
new file mode 100644
index 000000000000..8ddbbbe2c50d
--- /dev/null
+++ b/test/Transforms/ADCE/2005-02-17-PHI-Invoke-Crash.ll
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+
+declare void @strlen()
+
+declare void @_ZN10QByteArray6resizeEi()
+
+declare void @q_atomic_decrement()
+
+define void @_ZNK10QByteArray13leftJustifiedEicb() {
+entry:
+ invoke void @strlen( )
+ to label %tmp.3.i.noexc unwind label %invoke_catch.0
+
+tmp.3.i.noexc: ; preds = %entry
+ br i1 false, label %then.0, label %else.0
+
+invoke_catch.0: ; preds = %entry
+ invoke void @q_atomic_decrement( )
+ to label %tmp.1.i.i183.noexc unwind label %terminate
+
+tmp.1.i.i183.noexc: ; preds = %invoke_catch.0
+ unwind
+
+then.0: ; preds = %tmp.3.i.noexc
+ invoke void @_ZN10QByteArray6resizeEi( )
+ to label %invoke_cont.1 unwind label %invoke_catch.1
+
+invoke_catch.1: ; preds = %then.0
+ invoke void @q_atomic_decrement( )
+ to label %tmp.1.i.i162.noexc unwind label %terminate
+
+tmp.1.i.i162.noexc: ; preds = %invoke_catch.1
+ ret void
+
+invoke_cont.1: ; preds = %then.0
+ ret void
+
+else.0: ; preds = %tmp.3.i.noexc
+ ret void
+
+terminate: ; preds = %invoke_catch.1, %invoke_catch.0
+ %dbg.0.1 = phi { }* [ null, %invoke_catch.1 ], [ null, %invoke_catch.0 ] ; <{ }*> [#uses=0]
+ unreachable
+}
+
diff --git a/test/Transforms/ADCE/basictest.ll b/test/Transforms/ADCE/basictest.ll
new file mode 100644
index 000000000000..22ff0f753bec
--- /dev/null
+++ b/test/Transforms/ADCE/basictest.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis
+
+define i32 @Test(i32 %A, i32 %B) {
+BB1:
+ br label %BB4
+
+BB2: ; No predecessors!
+ br label %BB3
+
+BB3: ; preds = %BB4, %BB2
+ %ret = phi i32 [ %X, %BB4 ], [ %B, %BB2 ] ; <i32> [#uses=1]
+ ret i32 %ret
+
+BB4: ; preds = %BB1
+ %X = phi i32 [ %A, %BB1 ] ; <i32> [#uses=1]
+ br label %BB3
+}
+
+
diff --git a/test/Transforms/ADCE/basictest1.ll b/test/Transforms/ADCE/basictest1.ll
new file mode 100644
index 000000000000..29f40deb9c7f
--- /dev/null
+++ b/test/Transforms/ADCE/basictest1.ll
@@ -0,0 +1,97 @@
+; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis
+%FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 }
+ %spec_fd_t = type { i32, i32, i32, i8* }
+@__iob = external global [20 x %FILE] ; <[20 x %FILE]*> [#uses=1]
+@dbglvl = global i32 4 ; <i32*> [#uses=3]
+@spec_fd = external global [3 x %spec_fd_t] ; <[3 x %spec_fd_t]*> [#uses=4]
+@.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <[34 x i8]*> [#uses=1]
+@.LC10 = internal global [4 x i8] c"EOF\00" ; <[4 x i8]*> [#uses=1]
+@.LC11 = internal global [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+@.LC12 = internal global [17 x i8] c"spec_getc: %d = \00" ; <[17 x i8]*> [#uses=1]
+
+declare i32 @fprintf(%FILE*, i8*, ...)
+
+declare void @exit(i32)
+
+declare i32 @remove(i8*)
+
+declare i32 @fputc(i32, %FILE*)
+
+declare i32 @fwrite(i8*, i32, i32, %FILE*)
+
+declare void @perror(i8*)
+
+define i32 @spec_getc(i32 %fd) {
+ %reg109 = load i32* @dbglvl ; <i32> [#uses=1]
+ %cond266 = icmp sle i32 %reg109, 4 ; <i1> [#uses=1]
+ br i1 %cond266, label %bb3, label %bb2
+
+bb2: ; preds = %0
+ %cast273 = getelementptr [17 x i8]* @.LC12, i64 0, i64 0 ; <i8*> [#uses=0]
+ br label %bb3
+
+bb3: ; preds = %bb2, %0
+ %cond267 = icmp sle i32 %fd, 3 ; <i1> [#uses=1]
+ br i1 %cond267, label %bb5, label %bb4
+
+bb4: ; preds = %bb3
+ %reg111 = getelementptr [20 x %FILE]* @__iob, i64 0, i64 1, i32 3 ; <i8*> [#uses=1]
+ %cast274 = getelementptr [34 x i8]* @.LC9, i64 0, i64 0 ; <i8*> [#uses=0]
+ %cast282 = bitcast i8* %reg111 to %FILE* ; <%FILE*> [#uses=0]
+ call void @exit( i32 1 )
+ br label %UnifiedExitNode
+
+bb5: ; preds = %bb3
+ %reg107-idxcast1 = sext i32 %fd to i64 ; <i64> [#uses=2]
+ %reg107-idxcast2 = sext i32 %fd to i64 ; <i64> [#uses=1]
+ %reg1311 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
+ %idx1 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
+ %reg1321 = load i32* %idx1 ; <i32> [#uses=3]
+ %idx2 = getelementptr %spec_fd_t* %reg1311, i64 0, i32 1 ; <i32*> [#uses=1]
+ %reg1331 = load i32* %idx2 ; <i32> [#uses=1]
+ %cond270 = icmp slt i32 %reg1321, %reg1331 ; <i1> [#uses=1]
+ br i1 %cond270, label %bb9, label %bb6
+
+bb6: ; preds = %bb5
+ %reg134 = load i32* @dbglvl ; <i32> [#uses=1]
+ %cond271 = icmp sle i32 %reg134, 4 ; <i1> [#uses=1]
+ br i1 %cond271, label %bb8, label %bb7
+
+bb7: ; preds = %bb6
+ %cast277 = getelementptr [4 x i8]* @.LC10, i64 0, i64 0 ; <i8*> [#uses=0]
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6
+ br label %UnifiedExitNode
+
+bb9: ; preds = %bb5
+ %reg107-idxcast3 = sext i32 %fd to i64 ; <i64> [#uses=1]
+ %idx3 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <i8**> [#uses=1]
+ %reg1601 = load i8** %idx3 ; <i8*> [#uses=1]
+ %reg132-idxcast1 = sext i32 %reg1321 to i64 ; <i64> [#uses=1]
+ %idx4 = getelementptr i8* %reg1601, i64 %reg132-idxcast1 ; <i8*> [#uses=1]
+ %reg1621 = load i8* %idx4 ; <i8> [#uses=2]
+ %cast108 = zext i8 %reg1621 to i64 ; <i64> [#uses=0]
+ %reg157 = add i32 %reg1321, 1 ; <i32> [#uses=1]
+ %idx5 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
+ store i32 %reg157, i32* %idx5
+ %reg163 = load i32* @dbglvl ; <i32> [#uses=1]
+ %cond272 = icmp sle i32 %reg163, 4 ; <i1> [#uses=1]
+ br i1 %cond272, label %bb11, label %bb10
+
+bb10: ; preds = %bb9
+ %cast279 = getelementptr [4 x i8]* @.LC11, i64 0, i64 0 ; <i8*> [#uses=0]
+ br label %bb11
+
+bb11: ; preds = %bb10, %bb9
+ %cast291 = zext i8 %reg1621 to i32 ; <i32> [#uses=1]
+ br label %UnifiedExitNode
+
+UnifiedExitNode: ; preds = %bb11, %bb8, %bb4
+ %UnifiedRetVal = phi i32 [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ] ; <i32> [#uses=1]
+ ret i32 %UnifiedRetVal
+}
+
+declare i32 @puts(i8*)
+
+declare i32 @printf(i8*, ...)
diff --git a/test/Transforms/ADCE/basictest2.ll b/test/Transforms/ADCE/basictest2.ll
new file mode 100644
index 000000000000..120e23352dd0
--- /dev/null
+++ b/test/Transforms/ADCE/basictest2.ll
@@ -0,0 +1,97 @@
+; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis
+ %FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 }
+ %spec_fd_t = type { i32, i32, i32, i8* }
+@__iob = external global [20 x %FILE] ; <[20 x %FILE]*> [#uses=1]
+@dbglvl = global i32 4 ; <i32*> [#uses=3]
+@spec_fd = external global [3 x %spec_fd_t] ; <[3 x %spec_fd_t]*> [#uses=4]
+@.LC9 = internal global [34 x i8] c"spec_read: fd=%d, > MAX_SPEC_FD!\0A\00" ; <[34 x i8]*> [#uses=1]
+@.LC10 = internal global [4 x i8] c"EOF\00" ; <[4 x i8]*> [#uses=1]
+@.LC11 = internal global [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+@.LC12 = internal global [17 x i8] c"spec_getc: %d = \00" ; <[17 x i8]*> [#uses=1]
+
+declare i32 @fprintf(%FILE*, i8*, ...)
+
+declare void @exit(i32)
+
+declare i32 @remove(i8*)
+
+declare i32 @fputc(i32, %FILE*)
+
+declare i32 @fwrite(i8*, i32, i32, %FILE*)
+
+declare void @perror(i8*)
+
+define i32 @spec_getc(i32 %fd) {
+ %reg109 = load i32* @dbglvl ; <i32> [#uses=1]
+ %cond266 = icmp sle i32 %reg109, 4 ; <i1> [#uses=1]
+ br i1 %cond266, label %bb3, label %bb2
+
+bb2: ; preds = %0
+ %cast273 = getelementptr [17 x i8]* @.LC12, i64 0, i64 0 ; <i8*> [#uses=0]
+ br label %bb3
+
+bb3: ; preds = %bb2, %0
+ %cond267 = icmp sle i32 %fd, 3 ; <i1> [#uses=0]
+ br label %bb5
+
+bb4: ; No predecessors!
+ %reg111 = getelementptr [20 x %FILE]* @__iob, i64 0, i64 1, i32 3 ; <i8*> [#uses=1]
+ %cast274 = getelementptr [34 x i8]* @.LC9, i64 0, i64 0 ; <i8*> [#uses=0]
+ %cast282 = bitcast i8* %reg111 to %FILE* ; <%FILE*> [#uses=0]
+ call void @exit( i32 1 )
+ br label %UnifiedExitNode
+
+bb5: ; preds = %bb3
+ %reg107-idxcast1 = sext i32 %fd to i64 ; <i64> [#uses=2]
+ %reg107-idxcast2 = sext i32 %fd to i64 ; <i64> [#uses=1]
+ %reg1311 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast2 ; <%spec_fd_t*> [#uses=1]
+ %idx1 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
+ %reg1321 = load i32* %idx1 ; <i32> [#uses=3]
+ %idx2 = getelementptr %spec_fd_t* %reg1311, i64 0, i32 1 ; <i32*> [#uses=1]
+ %reg1331 = load i32* %idx2 ; <i32> [#uses=1]
+ %cond270 = icmp slt i32 %reg1321, %reg1331 ; <i1> [#uses=1]
+ br i1 %cond270, label %bb9, label %bb6
+
+bb6: ; preds = %bb5
+ %reg134 = load i32* @dbglvl ; <i32> [#uses=1]
+ %cond271 = icmp sle i32 %reg134, 4 ; <i1> [#uses=1]
+ br i1 %cond271, label %bb8, label %bb7
+
+bb7: ; preds = %bb6
+ %cast277 = getelementptr [4 x i8]* @.LC10, i64 0, i64 0 ; <i8*> [#uses=0]
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6
+ br label %UnifiedExitNode
+
+bb9: ; preds = %bb5
+ %reg107-idxcast3 = sext i32 %fd to i64 ; <i64> [#uses=1]
+ %idx3 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast3, i32 3 ; <i8**> [#uses=1]
+ %reg1601 = load i8** %idx3 ; <i8*> [#uses=1]
+ %reg132-idxcast1 = sext i32 %reg1321 to i64 ; <i64> [#uses=1]
+ %idx4 = getelementptr i8* %reg1601, i64 %reg132-idxcast1 ; <i8*> [#uses=1]
+ %reg1621 = load i8* %idx4 ; <i8> [#uses=2]
+ %cast108 = zext i8 %reg1621 to i64 ; <i64> [#uses=0]
+ %reg157 = add i32 %reg1321, 1 ; <i32> [#uses=1]
+ %idx5 = getelementptr [3 x %spec_fd_t]* @spec_fd, i64 0, i64 %reg107-idxcast1, i32 2 ; <i32*> [#uses=1]
+ store i32 %reg157, i32* %idx5
+ %reg163 = load i32* @dbglvl ; <i32> [#uses=1]
+ %cond272 = icmp sle i32 %reg163, 4 ; <i1> [#uses=1]
+ br i1 %cond272, label %bb11, label %bb10
+
+bb10: ; preds = %bb9
+ %cast279 = getelementptr [4 x i8]* @.LC11, i64 0, i64 0 ; <i8*> [#uses=0]
+ br label %bb11
+
+bb11: ; preds = %bb10, %bb9
+ %cast291 = zext i8 %reg1621 to i32 ; <i32> [#uses=1]
+ br label %UnifiedExitNode
+
+UnifiedExitNode: ; preds = %bb11, %bb8, %bb4
+ %UnifiedRetVal = phi i32 [ 42, %bb4 ], [ -1, %bb8 ], [ %cast291, %bb11 ] ; <i32> [#uses=1]
+ ret i32 %UnifiedRetVal
+}
+
+declare i32 @puts(i8*)
+
+declare i32 @printf(i8*, ...)
diff --git a/test/Transforms/ADCE/dce_pure_call.ll b/test/Transforms/ADCE/dce_pure_call.ll
new file mode 100644
index 000000000000..3935bf72b9c1
--- /dev/null
+++ b/test/Transforms/ADCE/dce_pure_call.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep call
+
+declare i32 @strlen(i8*) readonly nounwind
+
+define void @test() {
+ call i32 @strlen( i8* null ) ; <i32>:1 [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/ADCE/dce_pure_invoke.ll b/test/Transforms/ADCE/dce_pure_invoke.ll
new file mode 100644
index 000000000000..bd28df2b5e75
--- /dev/null
+++ b/test/Transforms/ADCE/dce_pure_invoke.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -adce | llvm-dis | grep null
+
+declare i32 @strlen(i8*) readnone
+
+define i32 @test() {
+ ; invoke of pure function should not be deleted!
+ invoke i32 @strlen( i8* null ) readnone
+ to label %Cont unwind label %Other ; <i32>:1 [#uses=0]
+
+Cont: ; preds = %0
+ ret i32 0
+
+Other: ; preds = %0
+ ret i32 1
+}
diff --git a/test/Transforms/ADCE/dg.exp b/test/Transforms/ADCE/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/ADCE/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/ADCE/unreachable-function.ll b/test/Transforms/ADCE/unreachable-function.ll
new file mode 100644
index 000000000000..86c55f591688
--- /dev/null
+++ b/test/Transforms/ADCE/unreachable-function.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | opt -adce -disable-output
+
+define void @test() {
+ unreachable
+}
diff --git a/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll b/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
new file mode 100644
index 000000000000..67c061fc1ca6
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep nounwind | count 2
+
+define internal i32 @deref(i32* %x) nounwind {
+entry:
+ %tmp2 = load i32* %x, align 4 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define i32 @f(i32 %x) {
+entry:
+ %x_addr = alloca i32 ; <i32*> [#uses=2]
+ store i32 %x, i32* %x_addr, align 4
+ %tmp1 = call i32 @deref( i32* %x_addr ) nounwind ; <i32> [#uses=1]
+ ret i32 %tmp1
+}
diff --git a/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll b/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll
new file mode 100644
index 000000000000..11bcb285d5e0
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis > %t
+; RUN: cat %t | grep {define.*@callee(.*i32\\*}
+; PR2498
+
+; This test tries to convince argpromotion about promoting the load from %A + 2,
+; because there is a load of %A in the entry block
+define internal i32 @callee(i1 %C, i32* %A) {
+entry:
+ ; Unconditonally load the element at %A
+ %A.0 = load i32* %A
+ br i1 %C, label %T, label %F
+T:
+ ret i32 %A.0
+F:
+ ; Load the element at offset two from %A. This should not be promoted!
+ %A.2 = getelementptr i32* %A, i32 2
+ %R = load i32* %A.2
+ ret i32 %R
+}
+
+define i32 @foo() {
+ %X = call i32 @callee(i1 false, i32* null) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/ArgumentPromotion/2008-09-07-CGUpdate.ll b/test/Transforms/ArgumentPromotion/2008-09-07-CGUpdate.ll
new file mode 100644
index 000000000000..047ff0a48c6d
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/2008-09-07-CGUpdate.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -inline -argpromotion -disable-output
+
+define internal fastcc i32 @hash(i32* %ts, i32 %mod) nounwind {
+entry:
+ unreachable
+}
+
+define void @encode(i32* %m, i32* %ts, i32* %new) nounwind {
+entry:
+ %0 = call fastcc i32 @hash( i32* %ts, i32 0 ) nounwind ; <i32> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll b/test/Transforms/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll
new file mode 100644
index 000000000000..d4061655008c
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -argpromotion -disable-output
+
+define internal fastcc i32 @term_SharingList(i32* %Term, i32* %List) nounwind {
+entry:
+ br i1 false, label %bb, label %bb5
+
+bb: ; preds = %entry
+ %0 = call fastcc i32 @term_SharingList( i32* null, i32* %List ) nounwind ; <i32> [#uses=0]
+ unreachable
+
+bb5: ; preds = %entry
+ ret i32 0
+}
+
+define i32 @term_Sharing(i32* %Term) nounwind {
+entry:
+ br i1 false, label %bb.i, label %bb14
+
+bb.i: ; preds = %entry
+ %0 = call fastcc i32 @term_SharingList( i32* null, i32* null ) nounwind ; <i32> [#uses=0]
+ ret i32 1
+
+bb14: ; preds = %entry
+ ret i32 0
+}
diff --git a/test/Transforms/ArgumentPromotion/aggregate-promote.ll b/test/Transforms/ArgumentPromotion/aggregate-promote.ll
new file mode 100644
index 000000000000..62b1a07c434e
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/aggregate-promote.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -argpromotion -instcombine | llvm-dis | not grep load
+
+%QuadTy = type { i32, i32, i32, i32 }
+@G = constant %QuadTy {
+ i32 0,
+ i32 0,
+ i32 17,
+ i32 25 } ; <%QuadTy*> [#uses=1]
+
+define internal i32 @test(%QuadTy* %P) {
+ %A = getelementptr %QuadTy* %P, i64 0, i32 3 ; <i32*> [#uses=1]
+ %B = getelementptr %QuadTy* %P, i64 0, i32 2 ; <i32*> [#uses=1]
+ %a = load i32* %A ; <i32> [#uses=1]
+ %b = load i32* %B ; <i32> [#uses=1]
+ %V = add i32 %a, %b ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @caller() {
+ %V = call i32 @test( %QuadTy* @G ) ; <i32> [#uses=1]
+ ret i32 %V
+}
+
diff --git a/test/Transforms/ArgumentPromotion/attrs.ll b/test/Transforms/ArgumentPromotion/attrs.ll
new file mode 100644
index 000000000000..0fb38be1f0b2
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/attrs.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep zeroext
+
+ %struct.ss = type { i32, i64 }
+
+define internal void @f(%struct.ss* byval %b, i32* byval %X, i32 %i) nounwind {
+entry:
+ %tmp = getelementptr %struct.ss* %b, i32 0, i32 0
+ %tmp1 = load i32* %tmp, align 4
+ %tmp2 = add i32 %tmp1, 1
+ store i32 %tmp2, i32* %tmp, align 4
+
+ store i32 0, i32* %X
+ ret void
+}
+
+define i32 @test(i32* %X) {
+entry:
+ %S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
+ %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp1, align 8
+ %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ store i64 2, i64* %tmp4, align 4
+ call void @f( %struct.ss* byval %S, i32* byval %X, i32 zeroext 0)
+ ret i32 0
+}
diff --git a/test/Transforms/ArgumentPromotion/basictest.ll b/test/Transforms/ArgumentPromotion/basictest.ll
new file mode 100644
index 000000000000..99697f4c40d7
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/basictest.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -argpromotion -mem2reg | llvm-dis | not grep alloca
+define internal i32 @test(i32* %X, i32* %Y) {
+ %A = load i32* %X ; <i32> [#uses=1]
+ %B = load i32* %Y ; <i32> [#uses=1]
+ %C = add i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define internal i32 @caller(i32* %B) {
+ %A = alloca i32 ; <i32*> [#uses=2]
+ store i32 1, i32* %A
+ %C = call i32 @test( i32* %A, i32* %B ) ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @callercaller() {
+ %B = alloca i32 ; <i32*> [#uses=2]
+ store i32 2, i32* %B
+ %X = call i32 @caller( i32* %B ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/ArgumentPromotion/byval-2.ll b/test/Transforms/ArgumentPromotion/byval-2.ll
new file mode 100644
index 000000000000..d6253574ca00
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/byval-2.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep -F {i32* byval} | count 2
+; Argpromote + scalarrepl should change this to passing the two integers by value.
+
+ %struct.ss = type { i32, i64 }
+
+define internal void @f(%struct.ss* byval %b, i32* byval %X) nounwind {
+entry:
+ %tmp = getelementptr %struct.ss* %b, i32 0, i32 0
+ %tmp1 = load i32* %tmp, align 4
+ %tmp2 = add i32 %tmp1, 1
+ store i32 %tmp2, i32* %tmp, align 4
+
+ store i32 0, i32* %X
+ ret void
+}
+
+define i32 @test(i32* %X) {
+entry:
+ %S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
+ %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp1, align 8
+ %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ store i64 2, i64* %tmp4, align 4
+ call void @f( %struct.ss* byval %S, i32* byval %X)
+ ret i32 0
+}
diff --git a/test/Transforms/ArgumentPromotion/byval.ll b/test/Transforms/ArgumentPromotion/byval.ll
new file mode 100644
index 000000000000..3a3458f3d941
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/byval.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -argpromotion -scalarrepl | llvm-dis | not grep load
+; Argpromote + scalarrepl should change this to passing the two integers by value.
+
+ %struct.ss = type { i32, i64 }
+
+define internal void @f(%struct.ss* byval %b) nounwind {
+entry:
+ %tmp = getelementptr %struct.ss* %b, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp1 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmp1, 1 ; <i32> [#uses=1]
+ store i32 %tmp2, i32* %tmp, align 4
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ %S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
+ %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp1, align 8
+ %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ store i64 2, i64* %tmp4, align 4
+ call void @f( %struct.ss* byval %S ) nounwind
+ ret i32 0
+}
diff --git a/test/Transforms/ArgumentPromotion/chained.ll b/test/Transforms/ArgumentPromotion/chained.ll
new file mode 100644
index 000000000000..de5f6e527063
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/chained.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -argpromotion -instcombine | llvm-dis | not grep load
+
+@G1 = constant i32 0 ; <i32*> [#uses=1]
+@G2 = constant i32* @G1 ; <i32**> [#uses=1]
+
+define internal i32 @test(i32** %X) {
+ %Y = load i32** %X ; <i32*> [#uses=1]
+ %X.upgrd.1 = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %X.upgrd.1
+}
+
+define i32 @caller(i32** %P) {
+ %X = call i32 @test( i32** @G2 ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/ArgumentPromotion/control-flow.ll b/test/Transforms/ArgumentPromotion/control-flow.ll
new file mode 100644
index 000000000000..76e8fd95030e
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/control-flow.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | \
+; RUN: not grep {load i32\* null}
+
+define internal i32 @callee(i1 %C, i32* %P) {
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ ret i32 17
+
+F: ; preds = %0
+ %X = load i32* %P ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+define i32 @foo() {
+ %X = call i32 @callee( i1 true, i32* null ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/ArgumentPromotion/control-flow2.ll b/test/Transforms/ArgumentPromotion/control-flow2.ll
new file mode 100644
index 000000000000..58750138567f
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/control-flow2.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | \
+; RUN: grep {load i32\\* %A}
+
+define internal i32 @callee(i1 %C, i32* %P) {
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ ret i32 17
+
+F: ; preds = %0
+ %X = load i32* %P ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+define i32 @foo() {
+ %A = alloca i32 ; <i32*> [#uses=2]
+ store i32 17, i32* %A
+ %X = call i32 @callee( i1 false, i32* %A ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/ArgumentPromotion/dg.exp b/test/Transforms/ArgumentPromotion/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/ArgumentPromotion/pr3085.ll b/test/Transforms/ArgumentPromotion/pr3085.ll
new file mode 100644
index 000000000000..e350370ca7af
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/pr3085.ll
@@ -0,0 +1,1944 @@
+; RUN: llvm-as < %s | opt -disable-output -loop-extract-single -loop-rotate -loop-reduce -argpromotion
+; PR 3085
+
+ %struct.Lit = type { i8 }
+
+define fastcc %struct.Lit* @import_lit(i32 %lit) nounwind {
+entry:
+ br i1 false, label %bb, label %bb1
+
+bb: ; preds = %entry
+ unreachable
+
+bb1: ; preds = %entry
+ br label %bb3
+
+bb2: ; preds = %bb3
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb1
+ br i1 false, label %bb2, label %bb6
+
+bb6: ; preds = %bb3
+ br i1 false, label %bb.i.i, label %bb1.i.i
+
+bb.i.i: ; preds = %bb6
+ br label %int2lit.exit
+
+bb1.i.i: ; preds = %bb6
+ br label %int2lit.exit
+
+int2lit.exit: ; preds = %bb1.i.i, %bb.i.i
+ ret %struct.Lit* null
+}
+
+define fastcc i32 @picosat_main(i32 %argc, i8** %argv) nounwind {
+entry:
+ br i1 false, label %bb.i, label %picosat_time_stamp.exit
+
+bb.i: ; preds = %entry
+ br label %picosat_time_stamp.exit
+
+picosat_time_stamp.exit: ; preds = %bb.i, %entry
+ br label %bb108
+
+bb: ; preds = %bb108
+ br i1 false, label %bb1, label %bb2
+
+bb1: ; preds = %bb
+ br label %bb106
+
+bb2: ; preds = %bb
+ br i1 false, label %bb3, label %bb4
+
+bb3: ; preds = %bb2
+ br label %bb106
+
+bb4: ; preds = %bb2
+ br i1 false, label %bb5, label %bb6
+
+bb5: ; preds = %bb4
+ br label %bb106
+
+bb6: ; preds = %bb4
+ br i1 false, label %bb7, label %bb8
+
+bb7: ; preds = %bb6
+ br label %bb106
+
+bb8: ; preds = %bb6
+ br i1 false, label %bb106, label %bb10
+
+bb10: ; preds = %bb8
+ br i1 false, label %bb106, label %bb12
+
+bb12: ; preds = %bb10
+ br i1 false, label %bb106, label %bb14
+
+bb14: ; preds = %bb12
+ br i1 false, label %bb15, label %bb19
+
+bb15: ; preds = %bb14
+ br i1 false, label %bb16, label %bb17
+
+bb16: ; preds = %bb15
+ br label %bb106
+
+bb17: ; preds = %bb15
+ br label %bb106
+
+bb19: ; preds = %bb14
+ br i1 false, label %bb20, label %bb28
+
+bb20: ; preds = %bb19
+ br i1 false, label %bb21, label %bb22
+
+bb21: ; preds = %bb20
+ br label %bb106
+
+bb22: ; preds = %bb20
+ br i1 false, label %bb106, label %bb24
+
+bb24: ; preds = %bb22
+ br i1 false, label %bb106, label %bb26
+
+bb26: ; preds = %bb24
+ br label %bb106
+
+bb28: ; preds = %bb19
+ br i1 false, label %bb29, label %bb35
+
+bb29: ; preds = %bb28
+ br i1 false, label %bb30, label %bb31
+
+bb30: ; preds = %bb29
+ br label %bb106
+
+bb31: ; preds = %bb29
+ br i1 false, label %bb32, label %bb33
+
+bb32: ; preds = %bb31
+ br label %bb106
+
+bb33: ; preds = %bb31
+ br label %bb106
+
+bb35: ; preds = %bb28
+ br i1 false, label %bb36, label %bb40
+
+bb36: ; preds = %bb35
+ br i1 false, label %bb37, label %bb38
+
+bb37: ; preds = %bb36
+ br label %bb106
+
+bb38: ; preds = %bb36
+ br label %bb106
+
+bb40: ; preds = %bb35
+ br i1 false, label %bb41, label %bb49
+
+bb41: ; preds = %bb40
+ br i1 false, label %bb43, label %bb42
+
+bb42: ; preds = %bb41
+ br label %bb106
+
+bb43: ; preds = %bb41
+ br i1 false, label %bb44, label %bb45
+
+bb44: ; preds = %bb43
+ br label %bb106
+
+bb45: ; preds = %bb43
+ br i1 false, label %bb46, label %bb47
+
+bb46: ; preds = %bb45
+ br label %bb106
+
+bb47: ; preds = %bb45
+ br label %bb106
+
+bb49: ; preds = %bb40
+ br i1 false, label %bb50, label %bb56
+
+bb50: ; preds = %bb49
+ br i1 false, label %bb52, label %bb51
+
+bb51: ; preds = %bb50
+ br label %bb106
+
+bb52: ; preds = %bb50
+ br i1 false, label %bb53, label %bb54
+
+bb53: ; preds = %bb52
+ br label %bb106
+
+bb54: ; preds = %bb52
+ br label %bb106
+
+bb56: ; preds = %bb49
+ br i1 false, label %bb57, label %bb63
+
+bb57: ; preds = %bb56
+ br i1 false, label %bb59, label %bb58
+
+bb58: ; preds = %bb57
+ br label %bb106
+
+bb59: ; preds = %bb57
+ br i1 false, label %bb60, label %bb61
+
+bb60: ; preds = %bb59
+ br label %bb106
+
+bb61: ; preds = %bb59
+ br label %bb106
+
+bb63: ; preds = %bb56
+ br i1 false, label %bb64, label %bb70
+
+bb64: ; preds = %bb63
+ br i1 false, label %bb66, label %bb65
+
+bb65: ; preds = %bb64
+ br label %bb106
+
+bb66: ; preds = %bb64
+ br i1 false, label %bb67, label %bb68
+
+bb67: ; preds = %bb66
+ br label %bb106
+
+bb68: ; preds = %bb66
+ br label %bb106
+
+bb70: ; preds = %bb63
+ br i1 false, label %bb71, label %bb79
+
+bb71: ; preds = %bb70
+ br i1 false, label %bb73, label %bb72
+
+bb72: ; preds = %bb71
+ br label %bb106
+
+bb73: ; preds = %bb71
+ br i1 false, label %bb74, label %bb75
+
+bb74: ; preds = %bb73
+ br label %bb106
+
+bb75: ; preds = %bb73
+ br i1 false, label %bb76, label %bb77
+
+bb76: ; preds = %bb75
+ br label %bb106
+
+bb77: ; preds = %bb75
+ br label %bb106
+
+bb79: ; preds = %bb70
+ br i1 false, label %bb80, label %bb86
+
+bb80: ; preds = %bb79
+ br i1 false, label %bb82, label %bb81
+
+bb81: ; preds = %bb80
+ br label %bb106
+
+bb82: ; preds = %bb80
+ br i1 false, label %bb83, label %bb84
+
+bb83: ; preds = %bb82
+ br label %bb106
+
+bb84: ; preds = %bb82
+ br label %bb106
+
+bb86: ; preds = %bb79
+ br i1 false, label %bb87, label %bb93
+
+bb87: ; preds = %bb86
+ br i1 false, label %bb89, label %bb88
+
+bb88: ; preds = %bb87
+ br label %bb106
+
+bb89: ; preds = %bb87
+ br i1 false, label %bb90, label %bb91
+
+bb90: ; preds = %bb89
+ br label %bb106
+
+bb91: ; preds = %bb89
+ br label %bb106
+
+bb93: ; preds = %bb86
+ br i1 false, label %bb94, label %bb95
+
+bb94: ; preds = %bb93
+ br label %bb106
+
+bb95: ; preds = %bb93
+ br i1 false, label %bb98, label %bb97
+
+bb97: ; preds = %bb95
+ br label %bb106
+
+bb98: ; preds = %bb95
+ br i1 false, label %bb103, label %bb1.i24
+
+bb1.i24: ; preds = %bb98
+ br i1 false, label %bb99, label %bb103
+
+bb99: ; preds = %bb1.i24
+ br i1 false, label %bb101, label %bb100
+
+bb100: ; preds = %bb99
+ br label %bb102
+
+bb101: ; preds = %bb99
+ br label %bb102
+
+bb102: ; preds = %bb101, %bb100
+ br label %bb106
+
+bb103: ; preds = %bb1.i24, %bb98
+ br i1 false, label %bb104, label %bb105
+
+bb104: ; preds = %bb103
+ br label %bb106
+
+bb105: ; preds = %bb103
+ br label %bb106
+
+bb106: ; preds = %bb105, %bb104, %bb102, %bb97, %bb94, %bb91, %bb90, %bb88, %bb84, %bb83, %bb81, %bb77, %bb76, %bb74, %bb72, %bb68, %bb67, %bb65, %bb61, %bb60, %bb58, %bb54, %bb53, %bb51, %bb47, %bb46, %bb44, %bb42, %bb38, %bb37, %bb33, %bb32, %bb30, %bb26, %bb24, %bb22, %bb21, %bb17, %bb16, %bb12, %bb10, %bb8, %bb7, %bb5, %bb3, %bb1
+ br i1 false, label %bb108, label %bb110
+
+bb108: ; preds = %bb106, %picosat_time_stamp.exit
+ br i1 false, label %bb, label %bb110
+
+bb110: ; preds = %bb108, %bb106
+ br i1 false, label %bb112, label %bb171
+
+bb112: ; preds = %bb110
+ br i1 false, label %bb114, label %bb113
+
+bb113: ; preds = %bb112
+ br label %bb114
+
+bb114: ; preds = %bb113, %bb112
+ br i1 false, label %bb.i.i35, label %bb1.i.i36
+
+bb.i.i35: ; preds = %bb114
+ unreachable
+
+bb1.i.i36: ; preds = %bb114
+ br i1 false, label %bb5.i.i.i41, label %bb6.i.i.i42
+
+bb5.i.i.i41: ; preds = %bb1.i.i36
+ unreachable
+
+bb6.i.i.i42: ; preds = %bb1.i.i36
+ br i1 false, label %bb7.i.i.i43, label %bb8.i.i.i44
+
+bb7.i.i.i43: ; preds = %bb6.i.i.i42
+ br label %bb8.i.i.i44
+
+bb8.i.i.i44: ; preds = %bb7.i.i.i43, %bb6.i.i.i42
+ br i1 false, label %picosat_init.exit, label %bb14.i.i
+
+bb14.i.i: ; preds = %bb8.i.i.i44
+ br label %picosat_init.exit
+
+picosat_init.exit: ; preds = %bb14.i.i, %bb8.i.i.i44
+ br i1 false, label %bb116, label %bb115
+
+bb115: ; preds = %picosat_init.exit
+ br label %bb116
+
+bb116: ; preds = %bb115, %picosat_init.exit
+ br i1 false, label %bb119, label %bb118
+
+bb118: ; preds = %bb116
+ br label %bb119
+
+bb119: ; preds = %bb118, %bb116
+ br i1 false, label %bb121, label %bb120
+
+bb120: ; preds = %bb119
+ br label %bb121
+
+bb121: ; preds = %bb120, %bb119
+ br i1 false, label %bb126, label %bb122
+
+bb122: ; preds = %bb121
+ br label %bb126
+
+bb126: ; preds = %bb122, %bb121
+ br i1 false, label %bb128, label %bb127
+
+bb127: ; preds = %bb126
+ br label %bb128
+
+bb128: ; preds = %bb127, %bb126
+ br label %SKIP_COMMENTS.i
+
+SKIP_COMMENTS.i.loopexit: ; preds = %bb.i149, %bb.i149
+ br label %SKIP_COMMENTS.i.backedge
+
+SKIP_COMMENTS.i: ; preds = %SKIP_COMMENTS.i.backedge, %bb128
+ br i1 false, label %bb.i149.preheader, label %bb3.i152
+
+bb.i149.preheader: ; preds = %SKIP_COMMENTS.i
+ br label %bb.i149
+
+bb.i149: ; preds = %bb.i149, %bb.i149.preheader
+ switch i32 0, label %bb.i149 [
+ i32 -1, label %SKIP_COMMENTS.i.loopexit
+ i32 10, label %SKIP_COMMENTS.i.loopexit
+ ]
+
+bb3.i152: ; preds = %SKIP_COMMENTS.i
+ br i1 false, label %bb4.i153, label %SKIP_COMMENTS.i.backedge
+
+SKIP_COMMENTS.i.backedge: ; preds = %bb3.i152, %SKIP_COMMENTS.i.loopexit
+ br label %SKIP_COMMENTS.i
+
+bb4.i153: ; preds = %bb3.i152
+ br i1 false, label %bb5.i154, label %bb129
+
+bb5.i154: ; preds = %bb4.i153
+ br i1 false, label %bb129, label %bb6.i155.preheader
+
+bb6.i155.preheader: ; preds = %bb5.i154
+ br label %bb6.i155
+
+bb6.i155: ; preds = %bb6.i155, %bb6.i155.preheader
+ br i1 false, label %bb7.i156, label %bb6.i155
+
+bb7.i156: ; preds = %bb6.i155
+ br i1 false, label %bb8.i157, label %bb129
+
+bb8.i157: ; preds = %bb7.i156
+ br i1 false, label %bb9.i158, label %bb129
+
+bb9.i158: ; preds = %bb8.i157
+ br i1 false, label %bb10.i159, label %bb129
+
+bb10.i159: ; preds = %bb9.i158
+ br i1 false, label %bb129, label %bb11.i160.preheader
+
+bb11.i160.preheader: ; preds = %bb10.i159
+ br label %bb11.i160
+
+bb11.i160: ; preds = %bb11.i160, %bb11.i160.preheader
+ br i1 false, label %bb12.i161, label %bb11.i160
+
+bb12.i161: ; preds = %bb11.i160
+ br i1 false, label %bb129, label %bb15.i165.preheader
+
+bb15.i165.preheader: ; preds = %bb12.i161
+ br label %bb15.i165
+
+bb14.i163: ; preds = %bb15.i165
+ br label %bb15.i165
+
+bb15.i165: ; preds = %bb14.i163, %bb15.i165.preheader
+ br i1 false, label %bb16.i166, label %bb14.i163
+
+bb16.i166: ; preds = %bb15.i165
+ br i1 false, label %bb129, label %bb17.i167.preheader
+
+bb17.i167.preheader: ; preds = %bb16.i166
+ br label %bb17.i167
+
+bb17.i167: ; preds = %bb17.i167, %bb17.i167.preheader
+ br i1 false, label %bb18.i168, label %bb17.i167
+
+bb18.i168: ; preds = %bb17.i167
+ br i1 false, label %bb129, label %bb21.i172.preheader
+
+bb21.i172.preheader: ; preds = %bb18.i168
+ br label %bb21.i172
+
+bb20.i170: ; preds = %bb21.i172
+ br label %bb21.i172
+
+bb21.i172: ; preds = %bb20.i170, %bb21.i172.preheader
+ br i1 false, label %bb22.i173, label %bb20.i170
+
+bb22.i173: ; preds = %bb21.i172
+ br i1 false, label %bb24.i175, label %bb129
+
+bb24.i175: ; preds = %bb22.i173
+ br i1 false, label %bb26.i180, label %bb25.i176
+
+bb25.i176: ; preds = %bb24.i175
+ br label %bb26.i180
+
+bb26.i180: ; preds = %bb25.i176, %bb24.i175
+ br i1 false, label %bb.i.i181, label %bb3.i.i184.preheader
+
+bb.i.i181: ; preds = %bb26.i180
+ br label %bb3.i.i184.preheader
+
+bb3.i.i184.preheader: ; preds = %bb.i.i181, %bb26.i180
+ br label %bb3.i.i184
+
+bb2.i.i183: ; preds = %bb3.i.i184
+ br label %bb3.i.i184
+
+bb3.i.i184: ; preds = %bb2.i.i183, %bb3.i.i184.preheader
+ br i1 false, label %bb2.i.i183, label %bb4.i.i185
+
+bb4.i.i185: ; preds = %bb3.i.i184
+ br i1 false, label %bb.i.i.i186, label %picosat_adjust.exit.i
+
+bb.i.i.i186: ; preds = %bb4.i.i185
+ br label %picosat_adjust.exit.i
+
+picosat_adjust.exit.i: ; preds = %bb.i.i.i186, %bb4.i.i185
+ br i1 false, label %bb28.i188, label %bb27.i187
+
+bb27.i187: ; preds = %picosat_adjust.exit.i
+ br label %bb28.i188
+
+bb28.i188: ; preds = %bb27.i187, %picosat_adjust.exit.i
+ br label %READ_LITERAL.i.outer
+
+READ_LITERAL.i.outer: ; preds = %READ_LITERAL.i.outer.backedge, %bb28.i188
+ br label %READ_LITERAL.i
+
+READ_LITERAL.i.loopexit: ; preds = %bb29.i189, %bb29.i189
+ br label %READ_LITERAL.i.backedge
+
+READ_LITERAL.i: ; preds = %READ_LITERAL.i.backedge, %READ_LITERAL.i.outer
+ switch i32 0, label %bb39.i199 [
+ i32 99, label %bb29.i189.preheader
+ i32 -1, label %bb33.i193
+ ]
+
+bb29.i189.preheader: ; preds = %READ_LITERAL.i
+ br label %bb29.i189
+
+bb29.i189: ; preds = %bb29.i189, %bb29.i189.preheader
+ switch i32 0, label %bb29.i189 [
+ i32 -1, label %READ_LITERAL.i.loopexit
+ i32 10, label %READ_LITERAL.i.loopexit
+ ]
+
+bb33.i193: ; preds = %READ_LITERAL.i
+ br i1 false, label %bb35.i195, label %parse.exit
+
+bb35.i195: ; preds = %bb33.i193
+ br i1 false, label %bb38.i198, label %parse.exit
+
+bb38.i198: ; preds = %bb35.i195
+ br label %parse.exit
+
+bb39.i199: ; preds = %READ_LITERAL.i
+ br i1 false, label %bb40.i200, label %READ_LITERAL.i.backedge
+
+READ_LITERAL.i.backedge: ; preds = %bb39.i199, %READ_LITERAL.i.loopexit
+ br label %READ_LITERAL.i
+
+bb40.i200: ; preds = %bb39.i199
+ br i1 false, label %bb41.i201, label %bb42.i202
+
+bb41.i201: ; preds = %bb40.i200
+ br label %bb42.i202
+
+bb42.i202: ; preds = %bb41.i201, %bb40.i200
+ br i1 false, label %parse.exit.loopexit, label %bb46.i.preheader
+
+bb46.i.preheader: ; preds = %bb42.i202
+ br label %bb46.i
+
+bb45.i: ; preds = %bb46.i
+ br label %bb46.i
+
+bb46.i: ; preds = %bb45.i, %bb46.i.preheader
+ br i1 false, label %bb47.i, label %bb45.i
+
+bb47.i: ; preds = %bb46.i
+ br i1 false, label %parse.exit.loopexit, label %bb50.i
+
+bb50.i: ; preds = %bb47.i
+ br i1 false, label %bb55.i, label %bb51.i
+
+bb51.i: ; preds = %bb50.i
+ br i1 false, label %parse.exit.loopexit, label %bb54.i
+
+bb54.i: ; preds = %bb51.i
+ br label %bb56.i
+
+bb55.i: ; preds = %bb50.i
+ br label %bb56.i
+
+bb56.i: ; preds = %bb55.i, %bb54.i
+ br i1 false, label %bb3.i11.i, label %bb.i8.i
+
+bb.i8.i: ; preds = %bb56.i
+ br i1 false, label %bb1.i9.i, label %bb3.i11.i
+
+bb1.i9.i: ; preds = %bb.i8.i
+ br i1 false, label %bb3.i11.i, label %bb2.i10.i
+
+bb2.i10.i: ; preds = %bb1.i9.i
+ unreachable
+
+bb3.i11.i: ; preds = %bb1.i9.i, %bb.i8.i, %bb56.i
+ br i1 false, label %bb7.i.i208, label %bb6.i.i207
+
+bb6.i.i207: ; preds = %bb3.i11.i
+ br label %READ_LITERAL.i.outer.backedge
+
+bb7.i.i208: ; preds = %bb3.i11.i
+ br i1 false, label %bb53.i.i.i.i.preheader, label %bb.i.i.i.i210.preheader
+
+bb.i.i.i.i210.preheader: ; preds = %bb7.i.i208
+ br label %bb.i.i.i.i210
+
+bb.i.i.i.i210: ; preds = %bb.i.i.i.i210.backedge, %bb.i.i.i.i210.preheader
+ br i1 false, label %bb17.i.i.i.i, label %bb18.i.i.i.i
+
+bb17.i.i.i.i: ; preds = %bb.i.i.i.i210
+ br label %bb18.i.i.i.i
+
+bb18.i.i.i.i: ; preds = %bb17.i.i.i.i, %bb.i.i.i.i210
+ br i1 false, label %bb19.i.i.i.i, label %bb20.i.i.i.i
+
+bb19.i.i.i.i: ; preds = %bb18.i.i.i.i
+ br label %bb20.i.i.i.i
+
+bb20.i.i.i.i: ; preds = %bb19.i.i.i.i, %bb18.i.i.i.i
+ br i1 false, label %bb21.i.i.i.i, label %bb22.i.i.i.i
+
+bb21.i.i.i.i: ; preds = %bb20.i.i.i.i
+ br label %bb22.i.i.i.i
+
+bb22.i.i.i.i: ; preds = %bb21.i.i.i.i, %bb20.i.i.i.i
+ br label %bb23.i.i.i.i.outer
+
+bb23.i.i.i.i.outer: ; preds = %bb28.i.i.i.i, %bb22.i.i.i.i
+ br label %bb23.i.i.i.i
+
+bb23.i.i.i.i: ; preds = %bb23.i.i.i.i, %bb23.i.i.i.i.outer
+ br i1 false, label %bb23.i.i.i.i, label %bb26.i.i.i.i.preheader
+
+bb26.i.i.i.i.preheader: ; preds = %bb23.i.i.i.i
+ br label %bb26.i.i.i.i
+
+bb26.i.i.i.i: ; preds = %bb26.i.i.i.i, %bb26.i.i.i.i.preheader
+ br i1 false, label %bb27.i.i.i.i, label %bb26.i.i.i.i
+
+bb27.i.i.i.i: ; preds = %bb26.i.i.i.i
+ br i1 false, label %bb28.i.i.i.i, label %bb29.i.i.i.i
+
+bb28.i.i.i.i: ; preds = %bb27.i.i.i.i
+ br label %bb23.i.i.i.i.outer
+
+bb29.i.i.i.i: ; preds = %bb27.i.i.i.i
+ br i1 false, label %bb33.i.i.i.i, label %bb44.i.i.i.i
+
+bb33.i.i.i.i: ; preds = %bb29.i.i.i.i
+ br i1 false, label %bb34.i.i.i.i, label %bb38.i.i.i.i
+
+bb34.i.i.i.i: ; preds = %bb33.i.i.i.i
+ br i1 false, label %bb37.i.i.i.i, label %bb35.i.i.i.i
+
+bb35.i.i.i.i: ; preds = %bb34.i.i.i.i
+ br label %bb37.i.i.i.i
+
+bb37.i.i.i.i: ; preds = %bb35.i.i.i.i, %bb34.i.i.i.i
+ br label %bb38.i.i.i.i
+
+bb38.i.i.i.i: ; preds = %bb37.i.i.i.i, %bb33.i.i.i.i
+ br i1 false, label %bb39.i.i.i.i, label %bb43.i.i.i.i
+
+bb39.i.i.i.i: ; preds = %bb38.i.i.i.i
+ br i1 false, label %bb42.i.i.i.i, label %bb40.i.i.i.i
+
+bb40.i.i.i.i: ; preds = %bb39.i.i.i.i
+ br label %bb42.i.i.i.i
+
+bb42.i.i.i.i: ; preds = %bb40.i.i.i.i, %bb39.i.i.i.i
+ br label %bb43.i.i.i.i
+
+bb43.i.i.i.i: ; preds = %bb42.i.i.i.i, %bb38.i.i.i.i
+ br label %bb.i.i.i.i210.backedge
+
+bb.i.i.i.i210.backedge: ; preds = %bb47.i.i.i.i, %bb44.i.i.i.i, %bb43.i.i.i.i
+ br label %bb.i.i.i.i210
+
+bb44.i.i.i.i: ; preds = %bb29.i.i.i.i
+ br i1 false, label %bb.i.i.i.i210.backedge, label %bb46.i.i.i.i
+
+bb46.i.i.i.i: ; preds = %bb44.i.i.i.i
+ br i1 false, label %bb47.i.i.i.i, label %bb53.i.i.i.i.preheader.loopexit
+
+bb53.i.i.i.i.preheader.loopexit: ; preds = %bb46.i.i.i.i
+ br label %bb53.i.i.i.i.preheader
+
+bb53.i.i.i.i.preheader: ; preds = %bb53.i.i.i.i.preheader.loopexit, %bb7.i.i208
+ br label %bb53.i.i.i.i
+
+bb47.i.i.i.i: ; preds = %bb46.i.i.i.i
+ br label %bb.i.i.i.i210.backedge
+
+bb50.i.i.i.i: ; preds = %bb53.i.i.i.i
+ br i1 false, label %bb51.i.i.i.i, label %bb52.i.i.i.i
+
+bb51.i.i.i.i: ; preds = %bb50.i.i.i.i
+ br label %bb52.i.i.i.i
+
+bb52.i.i.i.i: ; preds = %bb51.i.i.i.i, %bb50.i.i.i.i
+ br label %bb53.i.i.i.i
+
+bb53.i.i.i.i: ; preds = %bb52.i.i.i.i, %bb53.i.i.i.i.preheader
+ br i1 false, label %bb50.i.i.i.i, label %bb59.i.i.i.i.preheader
+
+bb59.i.i.i.i.preheader: ; preds = %bb53.i.i.i.i
+ br label %bb59.i.i.i.i
+
+bb55.i.i.i.i: ; preds = %bb59.i.i.i.i
+ br label %bb57.i.i.i.i
+
+bb56.i.i.i.i: ; preds = %bb57.i.i.i.i
+ br label %bb57.i.i.i.i
+
+bb57.i.i.i.i: ; preds = %bb56.i.i.i.i, %bb55.i.i.i.i
+ br i1 false, label %bb56.i.i.i.i, label %bb58.i.i.i.i
+
+bb58.i.i.i.i: ; preds = %bb57.i.i.i.i
+ br label %bb59.i.i.i.i
+
+bb59.i.i.i.i: ; preds = %bb58.i.i.i.i, %bb59.i.i.i.i.preheader
+ br i1 false, label %bb60.i.i.i.i, label %bb55.i.i.i.i
+
+bb60.i.i.i.i: ; preds = %bb59.i.i.i.i
+ br label %bb69.i.i.i.i
+
+bb61.i.i.i.i: ; preds = %bb69.i.i.i.i
+ br i1 false, label %bb68.i.i.i.i, label %bb62.i.i.i.i
+
+bb62.i.i.i.i: ; preds = %bb61.i.i.i.i
+ br i1 false, label %bb63.i.i.i.i, label %bb65.i.i.i.i
+
+bb63.i.i.i.i: ; preds = %bb62.i.i.i.i
+ br i1 false, label %bb.i.i12.i, label %bb65.i.i.i.i
+
+bb65.i.i.i.i: ; preds = %bb63.i.i.i.i, %bb62.i.i.i.i
+ br i1 false, label %bb.i.i12.i, label %bb67.i.i.i.i
+
+bb67.i.i.i.i: ; preds = %bb65.i.i.i.i
+ br label %bb68.i.i.i.i
+
+bb68.i.i.i.i: ; preds = %bb67.i.i.i.i, %bb61.i.i.i.i
+ br label %bb69.i.i.i.i
+
+bb69.i.i.i.i: ; preds = %bb68.i.i.i.i, %bb60.i.i.i.i
+ br i1 false, label %bb61.i.i.i.i, label %bb70.i.i.i.i
+
+bb70.i.i.i.i: ; preds = %bb69.i.i.i.i
+ br label %READ_LITERAL.i.outer.backedge
+
+bb.i.i12.i: ; preds = %bb65.i.i.i.i, %bb63.i.i.i.i
+ br i1 false, label %bb1.i.i.i213, label %bb5.i.i.i218
+
+bb1.i.i.i213: ; preds = %bb.i.i12.i
+ br i1 false, label %bb4.i.i.i217, label %bb2.i.i.i214
+
+bb2.i.i.i214: ; preds = %bb1.i.i.i213
+ br label %bb4.i.i.i217
+
+bb4.i.i.i217: ; preds = %bb2.i.i.i214, %bb1.i.i.i213
+ br label %bb5.i.i.i218
+
+bb5.i.i.i218: ; preds = %bb4.i.i.i217, %bb.i.i12.i
+ br label %READ_LITERAL.i.outer.backedge
+
+READ_LITERAL.i.outer.backedge: ; preds = %bb5.i.i.i218, %bb70.i.i.i.i, %bb6.i.i207
+ br label %READ_LITERAL.i.outer
+
+parse.exit.loopexit: ; preds = %bb51.i, %bb47.i, %bb42.i202
+ br label %parse.exit
+
+parse.exit: ; preds = %parse.exit.loopexit, %bb38.i198, %bb35.i195, %bb33.i193
+ br i1 false, label %bb130, label %bb129
+
+bb129: ; preds = %parse.exit, %bb22.i173, %bb18.i168, %bb16.i166, %bb12.i161, %bb10.i159, %bb9.i158, %bb8.i157, %bb7.i156, %bb5.i154, %bb4.i153
+ br label %bb170
+
+bb130: ; preds = %parse.exit
+ br i1 false, label %bb143, label %bb142.preheader
+
+bb142.preheader: ; preds = %bb130
+ br label %bb142
+
+bb132: ; preds = %bb142
+ br i1 false, label %bb137, label %bb133
+
+bb133: ; preds = %bb132
+ br i1 false, label %bb137, label %bb134
+
+bb134: ; preds = %bb133
+ br i1 false, label %bb137, label %bb135
+
+bb135: ; preds = %bb134
+ br i1 false, label %bb137, label %bb136
+
+bb136: ; preds = %bb135
+ br i1 false, label %bb137, label %bb138
+
+bb137: ; preds = %bb136, %bb135, %bb134, %bb133, %bb132
+ br label %bb141
+
+bb138: ; preds = %bb136
+ br i1 false, label %bb139, label %bb141
+
+bb139: ; preds = %bb138
+ br i1 false, label %bb2.i126, label %picosat_assume.exit
+
+bb2.i126: ; preds = %bb139
+ br i1 false, label %bb5.i130, label %bb3.i127
+
+bb3.i127: ; preds = %bb2.i126
+ br label %bb5.i130
+
+bb5.i130: ; preds = %bb3.i127, %bb2.i126
+ br label %picosat_assume.exit
+
+picosat_assume.exit: ; preds = %bb5.i130, %bb139
+ br i1 false, label %bb141, label %bb140
+
+bb140: ; preds = %picosat_assume.exit
+ br label %bb141
+
+bb141: ; preds = %bb140, %picosat_assume.exit, %bb138, %bb137
+ br label %bb142
+
+bb142: ; preds = %bb141, %bb142.preheader
+ br i1 false, label %bb132, label %bb143.loopexit
+
+bb143.loopexit: ; preds = %bb142
+ br label %bb143
+
+bb143: ; preds = %bb143.loopexit, %bb130
+ br i1 false, label %bb145, label %bb144
+
+bb144: ; preds = %bb143
+ br label %bb11.i
+
+bb5.i114: ; preds = %bb11.i
+ br label %bb11.i
+
+bb11.i: ; preds = %bb5.i114, %bb144
+ br i1 false, label %bb12.i, label %bb5.i114
+
+bb12.i: ; preds = %bb11.i
+ br i1 false, label %bb.i.i.i118, label %bb1.i.i.i119
+
+bb.i.i.i118: ; preds = %bb12.i
+ br label %int2lit.exit.i
+
+bb1.i.i.i119: ; preds = %bb12.i
+ br label %int2lit.exit.i
+
+int2lit.exit.i: ; preds = %bb1.i.i.i119, %bb.i.i.i118
+ br label %bb19.i
+
+bb13.i: ; preds = %bb19.i
+ br label %bb17.i
+
+bb14.i: ; preds = %bb17.i
+ br label %bb17.i
+
+bb17.i: ; preds = %bb14.i, %bb13.i
+ br i1 false, label %bb14.i, label %bb18.i
+
+bb18.i: ; preds = %bb17.i
+ br label %bb19.i
+
+bb19.i: ; preds = %bb18.i, %int2lit.exit.i
+ br i1 false, label %bb20.i, label %bb13.i
+
+bb20.i: ; preds = %bb19.i
+ br label %bb33.i
+
+bb24.i: ; preds = %bb33.i
+ br i1 false, label %bb29.i, label %bb25.i
+
+bb25.i: ; preds = %bb24.i
+ br label %bb27.i
+
+bb26.i: ; preds = %bb27.i
+ br label %bb27.i
+
+bb27.i: ; preds = %bb26.i, %bb25.i
+ br i1 false, label %bb26.i, label %bb28.i
+
+bb28.i: ; preds = %bb27.i
+ br label %bb29.i
+
+bb29.i: ; preds = %bb28.i, %bb24.i
+ br label %bb33.i
+
+bb33.i: ; preds = %bb29.i, %bb20.i
+ br i1 false, label %bb34.i, label %bb24.i
+
+bb34.i: ; preds = %bb33.i
+ br i1 false, label %bb.i.i58.i, label %bb1.i.i59.i
+
+bb.i.i58.i: ; preds = %bb34.i
+ br label %int2lit.exit63.i
+
+bb1.i.i59.i: ; preds = %bb34.i
+ br label %int2lit.exit63.i
+
+int2lit.exit63.i: ; preds = %bb1.i.i59.i, %bb.i.i58.i
+ br label %bb41.i
+
+bb35.i: ; preds = %bb41.i
+ br label %bb39.i
+
+bb36.i: ; preds = %bb39.i
+ br i1 false, label %bb38.i, label %bb37.i
+
+bb37.i: ; preds = %bb36.i
+ br label %bb38.i
+
+bb38.i: ; preds = %bb37.i, %bb36.i
+ br label %bb39.i
+
+bb39.i: ; preds = %bb38.i, %bb35.i
+ br i1 false, label %bb36.i, label %bb40.i
+
+bb40.i: ; preds = %bb39.i
+ br label %bb41.i
+
+bb41.i: ; preds = %bb40.i, %int2lit.exit63.i
+ br i1 false, label %bb42.i, label %bb35.i
+
+bb42.i: ; preds = %bb41.i
+ br label %bb44.i
+
+bb43.i: ; preds = %bb44.i
+ br label %bb44.i
+
+bb44.i: ; preds = %bb43.i, %bb42.i
+ br i1 false, label %bb43.i, label %picosat_print.exit
+
+picosat_print.exit: ; preds = %bb44.i
+ br label %bb167
+
+bb145: ; preds = %bb143
+ br i1 false, label %bb147, label %bb146
+
+bb146: ; preds = %bb145
+ br label %bb147
+
+bb147: ; preds = %bb146, %bb145
+ br i1 false, label %bb149, label %bb148
+
+bb148: ; preds = %bb147
+ br label %bb149
+
+bb149: ; preds = %bb148, %bb147
+ br i1 false, label %bb.i54, label %bb1.i55
+
+bb.i54: ; preds = %bb149
+ unreachable
+
+bb1.i55: ; preds = %bb149
+ br i1 false, label %bb.i.i56, label %bb1.i.i57
+
+bb.i.i56: ; preds = %bb1.i55
+ br label %bb1.i.i57
+
+bb1.i.i57: ; preds = %bb.i.i56, %bb1.i55
+ br i1 false, label %bb3.i.i59, label %bb2.i.i58
+
+bb2.i.i58: ; preds = %bb1.i.i57
+ br label %bb3.i.i59
+
+bb3.i.i59: ; preds = %bb2.i.i58, %bb1.i.i57
+ br i1 false, label %bb5.i.i61, label %sat.exit.i
+
+bb5.i.i61: ; preds = %bb3.i.i59
+ br i1 false, label %bb6.i.i65, label %bb1.i.i.i63
+
+bb1.i.i.i63: ; preds = %bb5.i.i61
+ br i1 false, label %sat.exit.i, label %bb6.i.i65
+
+bb6.i.i65: ; preds = %bb1.i.i.i63, %bb5.i.i61
+ br i1 false, label %bb8.i.i67, label %bb7.i.i66
+
+bb7.i.i66: ; preds = %bb6.i.i65
+ br label %bb8.i.i67
+
+bb8.i.i67: ; preds = %bb7.i.i66, %bb6.i.i65
+ br i1 false, label %bb10.i.i69, label %sat.exit.i
+
+bb10.i.i69: ; preds = %bb8.i.i67
+ br i1 false, label %bb11.i.i70, label %bb1.i61.i.i
+
+bb1.i61.i.i: ; preds = %bb10.i.i69
+ br i1 false, label %sat.exit.i, label %bb11.i.i70
+
+bb11.i.i70: ; preds = %bb1.i61.i.i, %bb10.i.i69
+ br label %bb13.i.i71.outer
+
+bb13.i.i71.outer: ; preds = %bb42.i.i, %bb11.i.i70
+ br label %bb13.i.i71
+
+bb13.i.i71: ; preds = %bb13.i.i71.backedge, %bb13.i.i71.outer
+ br i1 false, label %bb14.i.i72, label %bb15.i.i73
+
+bb14.i.i72: ; preds = %bb13.i.i71
+ br label %bb15.i.i73
+
+bb15.i.i73: ; preds = %bb14.i.i72, %bb13.i.i71
+ br i1 false, label %bb19.i.i, label %bb16.i.i
+
+bb16.i.i: ; preds = %bb15.i.i73
+ br i1 false, label %bb.i.i79.i.i, label %incincs.exit.i.i
+
+bb.i.i79.i.i: ; preds = %bb16.i.i
+ br label %bb4.i.i.i85.i.i
+
+bb.i.i.i80.i.i: ; preds = %bb4.i.i.i85.i.i
+ br i1 false, label %bb3.i.i.i83.i.i, label %bb1.i.i.i81.i.i
+
+bb1.i.i.i81.i.i: ; preds = %bb.i.i.i80.i.i
+ br i1 false, label %bb2.i.i.i82.i.i, label %bb3.i.i.i83.i.i
+
+bb2.i.i.i82.i.i: ; preds = %bb1.i.i.i81.i.i
+ br label %bb3.i.i.i83.i.i
+
+bb3.i.i.i83.i.i: ; preds = %bb2.i.i.i82.i.i, %bb1.i.i.i81.i.i, %bb.i.i.i80.i.i
+ br label %bb4.i.i.i85.i.i
+
+bb4.i.i.i85.i.i: ; preds = %bb3.i.i.i83.i.i, %bb.i.i79.i.i
+ br i1 false, label %crescore.exit.i.i.i.i, label %bb.i.i.i80.i.i
+
+crescore.exit.i.i.i.i: ; preds = %bb4.i.i.i85.i.i
+ br label %incincs.exit.i.i
+
+incincs.exit.i.i: ; preds = %crescore.exit.i.i.i.i, %bb16.i.i
+ br i1 false, label %bb13.i.i71.backedge, label %sat.exit.i.loopexit.loopexit
+
+bb13.i.i71.backedge: ; preds = %bb1.i55.i.i, %bb28.i.i, %incincs.exit.i.i
+ br label %bb13.i.i71
+
+bb19.i.i: ; preds = %bb15.i.i73
+ br i1 false, label %bb20.i.i, label %bb1.i68.i.i
+
+bb1.i68.i.i: ; preds = %bb19.i.i
+ br i1 false, label %sat.exit.i.loopexit.loopexit, label %bb20.i.i
+
+bb20.i.i: ; preds = %bb1.i68.i.i, %bb19.i.i
+ br i1 false, label %bb24.i.i, label %bb21.i.i
+
+bb21.i.i: ; preds = %bb20.i.i
+ br i1 false, label %bb22.i.i, label %bb24.i.i
+
+bb22.i.i: ; preds = %bb21.i.i
+ br i1 false, label %bb23.i.i, label %bb24.i.i
+
+bb23.i.i: ; preds = %bb22.i.i
+ br label %bb24.i.i
+
+bb24.i.i: ; preds = %bb23.i.i, %bb22.i.i, %bb21.i.i, %bb20.i.i
+ br i1 false, label %bb26.i.i, label %sat.exit.i.loopexit.loopexit
+
+bb26.i.i: ; preds = %bb24.i.i
+ br i1 false, label %bb27.i.i, label %bb33.i.i.loopexit
+
+bb27.i.i: ; preds = %bb26.i.i
+ br i1 false, label %bb33.i.i.loopexit, label %bb28.i.i
+
+bb28.i.i: ; preds = %bb27.i.i
+ br i1 false, label %bb1.i55.i.i, label %bb13.i.i71.backedge
+
+bb1.i55.i.i: ; preds = %bb28.i.i
+ br i1 false, label %bb29.i.i, label %bb13.i.i71.backedge
+
+bb29.i.i: ; preds = %bb1.i55.i.i
+ br i1 false, label %bb31.i.i, label %sat.exit.i.loopexit.loopexit2
+
+bb31.i.i: ; preds = %bb29.i.i
+ br i1 false, label %bb33.i.i, label %bb1.i48.i.i
+
+bb1.i48.i.i: ; preds = %bb31.i.i
+ br i1 false, label %sat.exit.i.loopexit.loopexit2, label %bb33.i.i
+
+bb33.i.i.loopexit: ; preds = %bb27.i.i, %bb26.i.i
+ br label %bb33.i.i
+
+bb33.i.i: ; preds = %bb33.i.i.loopexit, %bb1.i48.i.i, %bb31.i.i
+ br i1 false, label %bb34.i.i, label %bb35.i.i
+
+bb34.i.i: ; preds = %bb33.i.i
+ br i1 false, label %bb35.i.i, label %bb2.i44.i.i76
+
+bb2.i44.i.i76: ; preds = %bb34.i.i
+ br label %bb35.i.i
+
+bb35.i.i: ; preds = %bb2.i44.i.i76, %bb34.i.i, %bb33.i.i
+ br i1 false, label %bb1.i37.i.i, label %bb.i35.i.i
+
+bb.i35.i.i: ; preds = %bb35.i.i
+ br label %bb36.i.i
+
+bb1.i37.i.i: ; preds = %bb35.i.i
+ br i1 false, label %bb37.i.i, label %bb36.i.i
+
+bb36.i.i: ; preds = %bb1.i37.i.i, %bb.i35.i.i
+ br label %bb25.i23.i.i
+
+bb.i18.i.i: ; preds = %bb25.i23.i.i
+ br i1 false, label %bb24.i22.i.i, label %bb22.i19.i.i
+
+bb22.i19.i.i: ; preds = %bb.i18.i.i
+ br label %bb24.i22.i.i
+
+bb24.i22.i.i: ; preds = %bb22.i19.i.i, %bb.i18.i.i
+ br label %bb25.i23.i.i
+
+bb25.i23.i.i: ; preds = %bb24.i22.i.i, %bb36.i.i
+ br i1 false, label %bb.i18.i.i, label %bb26.i24.i.i
+
+bb26.i24.i.i: ; preds = %bb25.i23.i.i
+ br i1 false, label %bb27.i25.i.i, label %bb32.i.i.i
+
+bb27.i25.i.i: ; preds = %bb26.i24.i.i
+ br label %bb32.i.i.i
+
+bb32.i.i.i: ; preds = %bb27.i25.i.i, %bb26.i24.i.i
+ br label %bb64.i.i.i
+
+bb33.i.i.i: ; preds = %bb64.i.i.i
+ br i1 false, label %bb60.i.i.i, label %bb34.i.i.i
+
+bb34.i.i.i: ; preds = %bb33.i.i.i
+ br i1 false, label %bb38.i.i.i, label %bb60.i.i.i
+
+bb38.i.i.i: ; preds = %bb34.i.i.i
+ br i1 false, label %bb39.i.i.i, label %bb48.i.i.i
+
+bb39.i.i.i: ; preds = %bb38.i.i.i
+ br i1 false, label %bb48.i.i.i, label %bb40.i.i.i
+
+bb40.i.i.i: ; preds = %bb39.i.i.i
+ br i1 false, label %bb60.i.i.i, label %bb45.i.i.i
+
+bb45.i.i.i: ; preds = %bb40.i.i.i
+ br label %bb60.i.i.i
+
+bb48.i.i.i: ; preds = %bb39.i.i.i, %bb38.i.i.i
+ br i1 false, label %bb53.i.i.i, label %bb60.i.i.i
+
+bb53.i.i.i: ; preds = %bb48.i.i.i
+ br i1 false, label %bb60.i.i.i, label %bb58.i.i.i
+
+bb58.i.i.i: ; preds = %bb53.i.i.i
+ br i1 false, label %bb59.i.i.i, label %bb60.i.i.i
+
+bb59.i.i.i: ; preds = %bb58.i.i.i
+ br label %bb60.i.i.i
+
+bb60.i.i.i: ; preds = %bb59.i.i.i, %bb58.i.i.i, %bb53.i.i.i, %bb48.i.i.i, %bb45.i.i.i, %bb40.i.i.i, %bb34.i.i.i, %bb33.i.i.i
+ %lcollect.i.i.i.1 = phi i32 [ %lcollect.i.i.i.2, %bb34.i.i.i ], [ %lcollect.i.i.i.2, %bb48.i.i.i ], [ %lcollect.i.i.i.2, %bb58.i.i.i ], [ %lcollect.i.i.i.2, %bb59.i.i.i ], [ %lcollect.i.i.i.2, %bb53.i.i.i ], [ %lcollect.i.i.i.2, %bb33.i.i.i ], [ %lcollect.i.i.i.2, %bb40.i.i.i ], [ 0, %bb45.i.i.i ] ; <i32> [#uses=1]
+ br label %bb64.i.i.i
+
+bb64.i.i.i: ; preds = %bb60.i.i.i, %bb32.i.i.i
+ %lcollect.i.i.i.2 = phi i32 [ 0, %bb32.i.i.i ], [ %lcollect.i.i.i.1, %bb60.i.i.i ] ; <i32> [#uses=8]
+ br i1 false, label %bb65.i.i.i, label %bb33.i.i.i
+
+bb65.i.i.i: ; preds = %bb64.i.i.i
+ br i1 false, label %bb103.i.i.i.preheader, label %bb66.i.i.i.preheader
+
+bb66.i.i.i.preheader: ; preds = %bb65.i.i.i
+ br label %bb66.i.i.i
+
+bb66.i.i.i: ; preds = %bb66.i.i.i.backedge, %bb66.i.i.i.preheader
+ br i1 false, label %bb67.i.i.i, label %bb68.i.i.i
+
+bb67.i.i.i: ; preds = %bb66.i.i.i
+ br label %bb68.i.i.i
+
+bb68.i.i.i: ; preds = %bb67.i.i.i, %bb66.i.i.i
+ br i1 false, label %bb69.i.i.i, label %bb70.i.i.i
+
+bb69.i.i.i: ; preds = %bb68.i.i.i
+ br label %bb70.i.i.i
+
+bb70.i.i.i: ; preds = %bb69.i.i.i, %bb68.i.i.i
+ br i1 false, label %bb71.i.i.i, label %bb72.i.i.i
+
+bb71.i.i.i: ; preds = %bb70.i.i.i
+ br label %bb72.i.i.i
+
+bb72.i.i.i: ; preds = %bb71.i.i.i, %bb70.i.i.i
+ br label %bb73.i.i.i.outer
+
+bb73.i.i.i.outer: ; preds = %bb78.i.i.i, %bb72.i.i.i
+ br label %bb73.i.i.i
+
+bb73.i.i.i: ; preds = %bb73.i.i.i, %bb73.i.i.i.outer
+ br i1 false, label %bb73.i.i.i, label %bb76.i.i.i.preheader
+
+bb76.i.i.i.preheader: ; preds = %bb73.i.i.i
+ br label %bb76.i.i.i
+
+bb76.i.i.i: ; preds = %bb76.i.i.i, %bb76.i.i.i.preheader
+ br i1 false, label %bb77.i.i.i, label %bb76.i.i.i
+
+bb77.i.i.i: ; preds = %bb76.i.i.i
+ br i1 false, label %bb78.i.i.i, label %bb79.i.i.i
+
+bb78.i.i.i: ; preds = %bb77.i.i.i
+ br label %bb73.i.i.i.outer
+
+bb79.i.i.i: ; preds = %bb77.i.i.i
+ br i1 false, label %bb83.i.i.i, label %bb94.i.i.i
+
+bb83.i.i.i: ; preds = %bb79.i.i.i
+ br i1 false, label %bb84.i.i.i, label %bb88.i.i.i
+
+bb84.i.i.i: ; preds = %bb83.i.i.i
+ br i1 false, label %bb87.i.i.i, label %bb85.i.i.i
+
+bb85.i.i.i: ; preds = %bb84.i.i.i
+ br label %bb87.i.i.i
+
+bb87.i.i.i: ; preds = %bb85.i.i.i, %bb84.i.i.i
+ br label %bb88.i.i.i
+
+bb88.i.i.i: ; preds = %bb87.i.i.i, %bb83.i.i.i
+ br i1 false, label %bb89.i.i.i, label %bb93.i.i.i
+
+bb89.i.i.i: ; preds = %bb88.i.i.i
+ br i1 false, label %bb92.i.i.i, label %bb90.i.i.i
+
+bb90.i.i.i: ; preds = %bb89.i.i.i
+ br label %bb92.i.i.i
+
+bb92.i.i.i: ; preds = %bb90.i.i.i, %bb89.i.i.i
+ br label %bb93.i.i.i
+
+bb93.i.i.i: ; preds = %bb92.i.i.i, %bb88.i.i.i
+ br label %bb66.i.i.i.backedge
+
+bb66.i.i.i.backedge: ; preds = %bb97.i.i.i, %bb94.i.i.i, %bb93.i.i.i
+ br label %bb66.i.i.i
+
+bb94.i.i.i: ; preds = %bb79.i.i.i
+ br i1 false, label %bb66.i.i.i.backedge, label %bb96.i.i.i
+
+bb96.i.i.i: ; preds = %bb94.i.i.i
+ br i1 false, label %bb97.i.i.i, label %bb103.i.i.i.preheader.loopexit
+
+bb103.i.i.i.preheader.loopexit: ; preds = %bb96.i.i.i
+ br label %bb103.i.i.i.preheader
+
+bb103.i.i.i.preheader: ; preds = %bb103.i.i.i.preheader.loopexit, %bb65.i.i.i
+ br label %bb103.i.i.i
+
+bb97.i.i.i: ; preds = %bb96.i.i.i
+ br label %bb66.i.i.i.backedge
+
+bb100.i.i.i: ; preds = %bb103.i.i.i
+ br i1 false, label %bb101.i.i.i, label %bb102.i.i.i
+
+bb101.i.i.i: ; preds = %bb100.i.i.i
+ br label %bb102.i.i.i
+
+bb102.i.i.i: ; preds = %bb101.i.i.i, %bb100.i.i.i
+ br label %bb103.i.i.i
+
+bb103.i.i.i: ; preds = %bb102.i.i.i, %bb103.i.i.i.preheader
+ br i1 false, label %bb100.i.i.i, label %bb109.i.i.i.preheader
+
+bb109.i.i.i.preheader: ; preds = %bb103.i.i.i
+ br label %bb109.i.i.i
+
+bb105.i.i.i: ; preds = %bb109.i.i.i
+ br label %bb107.i.i.i
+
+bb106.i.i.i: ; preds = %bb107.i.i.i
+ br label %bb107.i.i.i
+
+bb107.i.i.i: ; preds = %bb106.i.i.i, %bb105.i.i.i
+ br i1 false, label %bb106.i.i.i, label %bb108.i.i.i
+
+bb108.i.i.i: ; preds = %bb107.i.i.i
+ br label %bb109.i.i.i
+
+bb109.i.i.i: ; preds = %bb108.i.i.i, %bb109.i.i.i.preheader
+ br i1 false, label %bb110.i.i.i, label %bb105.i.i.i
+
+bb110.i.i.i: ; preds = %bb109.i.i.i
+ %0 = sub i32 0, %lcollect.i.i.i.2 ; <i32> [#uses=1]
+ %1 = add i32 %0, 1 ; <i32> [#uses=1]
+ br label %bb113.i.i.i
+
+bb111.i.i.i: ; preds = %bb113.i.i.i
+ br i1 false, label %bb114.i.i.i, label %bb113.i.i.i
+
+bb113.i.i.i: ; preds = %bb111.i.i.i, %bb110.i.i.i
+ br i1 false, label %bb111.i.i.i, label %bb114.i.i.i
+
+bb114.i.i.i: ; preds = %bb113.i.i.i, %bb111.i.i.i
+ %2 = lshr i32 %1, 1 ; <i32> [#uses=2]
+ br i1 false, label %bb116.i.i.i, label %bb124.i.i.i
+
+bb116.i.i.i: ; preds = %bb114.i.i.i
+ br i1 false, label %bb117.i.i.i.preheader, label %bb122.i.i.i.preheader
+
+bb122.i.i.i.preheader: ; preds = %bb116.i.i.i
+ br label %bb122.i.i.i
+
+bb117.i.i.i.preheader: ; preds = %bb116.i.i.i
+ br label %bb117.i.i.i
+
+bb117.i.i.i: ; preds = %bb118.i.i.i, %bb117.i.i.i.preheader
+ %target.i.i.i.1 = phi i32 [ %3, %bb118.i.i.i ], [ %2, %bb117.i.i.i.preheader ] ; <i32> [#uses=1]
+ %3 = add i32 %target.i.i.i.1, 1 ; <i32> [#uses=2]
+ br i1 false, label %bb118.i.i.i, label %bb124.i.i.i.loopexit
+
+bb118.i.i.i: ; preds = %bb117.i.i.i
+ br i1 false, label %bb117.i.i.i, label %bb124.i.i.i.loopexit
+
+bb122.i.i.i: ; preds = %bb123.i.i.i, %bb122.i.i.i.preheader
+ %target.i.i.i.2 = phi i32 [ %4, %bb123.i.i.i ], [ %2, %bb122.i.i.i.preheader ] ; <i32> [#uses=2]
+ br i1 false, label %bb124.i.i.i.loopexit1, label %bb123.i.i.i
+
+bb123.i.i.i: ; preds = %bb122.i.i.i
+ %4 = add i32 %target.i.i.i.2, -1 ; <i32> [#uses=1]
+ br i1 false, label %bb122.i.i.i, label %bb124.i.i.i.loopexit1
+
+bb124.i.i.i.loopexit: ; preds = %bb118.i.i.i, %bb117.i.i.i
+ br label %bb124.i.i.i
+
+bb124.i.i.i.loopexit1: ; preds = %bb123.i.i.i, %bb122.i.i.i
+ br label %bb124.i.i.i
+
+bb124.i.i.i: ; preds = %bb124.i.i.i.loopexit1, %bb124.i.i.i.loopexit, %bb114.i.i.i
+ %target.i.i.i.0 = phi i32 [ 0, %bb114.i.i.i ], [ %3, %bb124.i.i.i.loopexit ], [ %target.i.i.i.2, %bb124.i.i.i.loopexit1 ] ; <i32> [#uses=0]
+ br label %bb132.i.i.i.outer
+
+bb125.i.i.i: ; preds = %bb132.i.i.i
+ br i1 false, label %bb132.i.i.i, label %bb130.i.i.i
+
+bb130.i.i.i: ; preds = %bb125.i.i.i
+ br label %bb132.i.i.i.outer
+
+bb132.i.i.i.outer: ; preds = %bb130.i.i.i, %bb124.i.i.i
+ br label %bb132.i.i.i
+
+bb132.i.i.i: ; preds = %bb132.i.i.i.outer, %bb125.i.i.i
+ br i1 false, label %bb125.i.i.i, label %bb133.i.i.i
+
+bb133.i.i.i: ; preds = %bb132.i.i.i
+ br i1 false, label %bb136.i.i.i, label %bb134.i.i.i
+
+bb134.i.i.i: ; preds = %bb133.i.i.i
+ br i1 false, label %bb136.i.i.i, label %bb135.i.i.i
+
+bb135.i.i.i: ; preds = %bb134.i.i.i
+ br label %bb136.i.i.i
+
+bb136.i.i.i: ; preds = %bb135.i.i.i, %bb134.i.i.i, %bb133.i.i.i
+ br i1 false, label %bb137.i.i.i, label %bb37.i.i
+
+bb137.i.i.i: ; preds = %bb136.i.i.i
+ br label %bb37.i.i
+
+bb37.i.i: ; preds = %bb137.i.i.i, %bb136.i.i.i, %bb1.i37.i.i
+ br i1 false, label %bb40.i.i, label %bb38.i.i
+
+bb38.i.i: ; preds = %bb37.i.i
+ br i1 false, label %bb39.i.i, label %bb40.i.i
+
+bb39.i.i: ; preds = %bb38.i.i
+ br i1 false, label %bb17.i.i.i, label %bb3.i12.i.i
+
+bb3.i12.i.i: ; preds = %bb39.i.i
+ br label %bb5.i14.i.i
+
+bb5.i14.i.i: ; preds = %bb8.i.i.i79, %bb3.i12.i.i
+ br i1 false, label %bb6.i15.i.i, label %bb9.i.i.i80
+
+bb6.i15.i.i: ; preds = %bb5.i14.i.i
+ br i1 false, label %bb7.i.i.i78, label %bb9.i.i.i80
+
+bb7.i.i.i78: ; preds = %bb6.i15.i.i
+ br i1 false, label %bb9.i.i.i80, label %bb8.i.i.i79
+
+bb8.i.i.i79: ; preds = %bb7.i.i.i78
+ br i1 false, label %bb9.i.i.i80, label %bb5.i14.i.i
+
+bb9.i.i.i80: ; preds = %bb8.i.i.i79, %bb7.i.i.i78, %bb6.i15.i.i, %bb5.i14.i.i
+ br i1 false, label %bb16.i.i.i, label %bb10.i.i.i81
+
+bb10.i.i.i81: ; preds = %bb9.i.i.i80
+ br i1 false, label %bb11.i.i.i, label %bb15.i.i.i
+
+bb11.i.i.i: ; preds = %bb10.i.i.i81
+ br i1 false, label %bb16.i.i.i, label %bb15.i.i.i
+
+bb15.i.i.i: ; preds = %bb11.i.i.i, %bb10.i.i.i81
+ br label %bb16.i.i.i
+
+bb16.i.i.i: ; preds = %bb15.i.i.i, %bb11.i.i.i, %bb9.i.i.i80
+ br label %bb17.i.i.i
+
+bb17.i.i.i: ; preds = %bb16.i.i.i, %bb39.i.i
+ br i1 false, label %bb18.i.i.i, label %bb25.i.i.i
+
+bb18.i.i.i: ; preds = %bb17.i.i.i
+ br i1 false, label %bb24.i.i.i, label %bb23.i.i.i
+
+bb23.i.i.i: ; preds = %bb18.i.i.i
+ br label %bb24.i.i.i
+
+bb24.i.i.i: ; preds = %bb23.i.i.i, %bb18.i.i.i
+ br label %bb29.i.i.i
+
+bb25.i.i.i: ; preds = %bb17.i.i.i
+ br i1 false, label %bb29.i.i.i, label %bb27.i.i.i
+
+bb27.i.i.i: ; preds = %bb25.i.i.i
+ br i1 false, label %bb29.i.i.i, label %bb28.i.i.i
+
+bb28.i.i.i: ; preds = %bb27.i.i.i
+ br i1 false, label %bb29.i.i.i, label %bb.i4.i.i.i
+
+bb.i4.i.i.i: ; preds = %bb28.i.i.i
+ br i1 false, label %bb4.i.i16.i.i, label %bb29.i.i.i
+
+bb4.i.i16.i.i: ; preds = %bb.i4.i.i.i
+ br label %bb29.i.i.i
+
+bb29.i.i.i: ; preds = %bb4.i.i16.i.i, %bb.i4.i.i.i, %bb28.i.i.i, %bb27.i.i.i, %bb25.i.i.i, %bb24.i.i.i
+ br label %bb40.i.i
+
+bb40.i.i: ; preds = %bb29.i.i.i, %bb38.i.i, %bb37.i.i
+ br i1 false, label %bb9.i.i.i.i.preheader, label %bb2.i.i.i87
+
+bb9.i.i.i.i.preheader: ; preds = %bb40.i.i
+ br label %bb9.i.i.i.i
+
+bb.i.i.i.i84: ; preds = %bb9.i.i.i.i
+ switch i8 0, label %bb8.i.i.i.i [
+ i8 -1, label %bb1.i.i.i.i85
+ i8 1, label %bb9.i.i.i.i
+ ]
+
+bb1.i.i.i.i85: ; preds = %bb.i.i.i.i84
+ br i1 false, label %bb5.i.i.i.i, label %bb2.i.i.i87
+
+bb5.i.i.i.i: ; preds = %bb1.i.i.i.i85
+ br label %bb2.i.i.i87
+
+bb8.i.i.i.i: ; preds = %bb.i.i.i.i84
+ br i1 false, label %bb2.i.i.i87, label %bb6.i.i.i95
+
+bb9.i.i.i.i: ; preds = %bb.i.i.i.i84, %bb9.i.i.i.i.preheader
+ br i1 false, label %bb.i.i.i.i84, label %bb10.i.i.i.i
+
+bb10.i.i.i.i: ; preds = %bb9.i.i.i.i
+ br label %bb2.i.i.i87
+
+bb2.i.i.i87: ; preds = %bb10.i.i.i.i, %bb8.i.i.i.i, %bb5.i.i.i.i, %bb1.i.i.i.i85, %bb40.i.i
+ br i1 false, label %bb3.i.i.i88, label %decide.exit.i.i
+
+bb3.i.i.i88: ; preds = %bb2.i.i.i87
+ br i1 false, label %bb4.i.i.i90, label %bb1.i23.i.i.i
+
+bb1.i23.i.i.i: ; preds = %bb3.i.i.i88
+ br i1 false, label %decide.exit.i.i, label %bb4.i.i.i90
+
+bb4.i.i.i90: ; preds = %bb1.i23.i.i.i, %bb3.i.i.i88
+ br i1 false, label %bb1.i9.i.i.i, label %bb5.i.i.i94
+
+bb1.i9.i.i.i: ; preds = %bb4.i.i.i90
+ br i1 false, label %bb.i.i27.i.i.i.i, label %bb1.i.i28.i.i.i.i
+
+bb.i.i27.i.i.i.i: ; preds = %bb1.i9.i.i.i
+ br label %int2lit.exit32.i.i.i.i
+
+bb1.i.i28.i.i.i.i: ; preds = %bb1.i9.i.i.i
+ br label %int2lit.exit32.i.i.i.i
+
+int2lit.exit32.i.i.i.i: ; preds = %bb1.i.i28.i.i.i.i, %bb.i.i27.i.i.i.i
+ br i1 false, label %bb8.i19.i.i.i, label %bb2.i.i.i.i91
+
+bb2.i.i.i.i91: ; preds = %int2lit.exit32.i.i.i.i
+ br label %bb4.i.i.i.i
+
+bb3.i.i.i.i92: ; preds = %gcd.exit.i.i.i.i
+ br label %bb4.i.i.i.i
+
+bb4.i.i.i.i: ; preds = %bb3.i.i.i.i92, %bb2.i.i.i.i91
+ br label %bb3.i.i13.i.i.i
+
+bb2.i.i12.i.i.i: ; preds = %bb3.i.i13.i.i.i
+ br label %bb3.i.i13.i.i.i
+
+bb3.i.i13.i.i.i: ; preds = %bb2.i.i12.i.i.i, %bb4.i.i.i.i
+ br i1 false, label %gcd.exit.i.i.i.i, label %bb2.i.i12.i.i.i
+
+gcd.exit.i.i.i.i: ; preds = %bb3.i.i13.i.i.i
+ br i1 false, label %bb5.i14.i.i.i.preheader, label %bb3.i.i.i.i92
+
+bb5.i14.i.i.i.preheader: ; preds = %gcd.exit.i.i.i.i
+ br label %bb5.i14.i.i.i
+
+bb5.i14.i.i.i: ; preds = %int2lit.exit.i.i.i.i, %bb5.i14.i.i.i.preheader
+ br i1 false, label %bb.i.i.i17.i.i.i, label %bb1.i.i.i18.i.i.i
+
+bb.i.i.i17.i.i.i: ; preds = %bb5.i14.i.i.i
+ br label %int2lit.exit.i.i.i.i
+
+bb1.i.i.i18.i.i.i: ; preds = %bb5.i14.i.i.i
+ br label %int2lit.exit.i.i.i.i
+
+int2lit.exit.i.i.i.i: ; preds = %bb1.i.i.i18.i.i.i, %bb.i.i.i17.i.i.i
+ br i1 false, label %bb8.i19.i.i.i.loopexit, label %bb5.i14.i.i.i
+
+bb8.i19.i.i.i.loopexit: ; preds = %int2lit.exit.i.i.i.i
+ br label %bb8.i19.i.i.i
+
+bb8.i19.i.i.i: ; preds = %bb8.i19.i.i.i.loopexit, %int2lit.exit32.i.i.i.i
+ br i1 false, label %bb5.i.i.i94, label %bb6.i.i.i95
+
+bb5.i.i.i94: ; preds = %bb8.i19.i.i.i, %bb4.i.i.i90
+ br label %bb.i2.i.i.i
+
+bb.i2.i.i.i: ; preds = %hpop.exit.i.i.i.i, %bb5.i.i.i94
+ br i1 false, label %hpop.exit.i.i.i.i, label %bb1.i.i.i.i.i
+
+bb1.i.i.i.i.i: ; preds = %bb.i2.i.i.i
+ br label %bb2.i.i.i.i.i
+
+bb2.i.i.i.i.i: ; preds = %bb11.i.i.i.i.i, %bb1.i.i.i.i.i
+ br i1 false, label %bb3.i.i.i.i.i, label %bb12.i.i.i.i.i
+
+bb3.i.i.i.i.i: ; preds = %bb2.i.i.i.i.i
+ br i1 false, label %bb4.i.i.i.i.i, label %bb1.i.i.i.i.i.i
+
+bb1.i.i.i.i.i.i: ; preds = %bb3.i.i.i.i.i
+ br i1 false, label %bb8.i.i.i.i.i, label %bb3.i.i.i.i.i.i
+
+bb3.i.i.i.i.i.i: ; preds = %bb1.i.i.i.i.i.i
+ br i1 false, label %bb4.i.i.i.i.i, label %bb8.i.i.i.i.i
+
+bb4.i.i.i.i.i: ; preds = %bb3.i.i.i.i.i.i, %bb3.i.i.i.i.i
+ br i1 false, label %bb5.i.i.i.i.i, label %bb11.i.i.i.i.i
+
+bb5.i.i.i.i.i: ; preds = %bb4.i.i.i.i.i
+ br i1 false, label %bb6.i.i.i.i.i, label %bb1.i21.i.i.i.i.i
+
+bb1.i21.i.i.i.i.i: ; preds = %bb5.i.i.i.i.i
+ br i1 false, label %bb11.i.i.i.i.i, label %bb3.i24.i.i.i.i.i
+
+bb3.i24.i.i.i.i.i: ; preds = %bb1.i21.i.i.i.i.i
+ br i1 false, label %bb6.i.i.i.i.i, label %bb11.i.i.i.i.i
+
+bb6.i.i.i.i.i: ; preds = %bb3.i24.i.i.i.i.i, %bb5.i.i.i.i.i
+ br label %bb11.i.i.i.i.i
+
+bb8.i.i.i.i.i: ; preds = %bb3.i.i.i.i.i.i, %bb1.i.i.i.i.i.i
+ br i1 false, label %bb9.i.i.i.i.i, label %bb12.i.i.i.i.i
+
+bb9.i.i.i.i.i: ; preds = %bb8.i.i.i.i.i
+ br i1 false, label %bb11.i.i.i.i.i, label %bb1.i8.i.i.i.i.i
+
+bb1.i8.i.i.i.i.i: ; preds = %bb9.i.i.i.i.i
+ br i1 false, label %bb12.i.i.i.i.i, label %bb3.i11.i.i.i.i.i
+
+bb3.i11.i.i.i.i.i: ; preds = %bb1.i8.i.i.i.i.i
+ br i1 false, label %bb11.i.i.i.i.i, label %bb12.i.i.i.i.i
+
+bb11.i.i.i.i.i: ; preds = %bb3.i11.i.i.i.i.i, %bb9.i.i.i.i.i, %bb6.i.i.i.i.i, %bb3.i24.i.i.i.i.i, %bb1.i21.i.i.i.i.i, %bb4.i.i.i.i.i
+ br label %bb2.i.i.i.i.i
+
+bb12.i.i.i.i.i: ; preds = %bb3.i11.i.i.i.i.i, %bb1.i8.i.i.i.i.i, %bb8.i.i.i.i.i, %bb2.i.i.i.i.i
+ br label %hpop.exit.i.i.i.i
+
+hpop.exit.i.i.i.i: ; preds = %bb12.i.i.i.i.i, %bb.i2.i.i.i
+ br i1 false, label %sdecide.exit.i.i.i, label %bb.i2.i.i.i
+
+sdecide.exit.i.i.i: ; preds = %hpop.exit.i.i.i.i
+ br label %bb6.i.i.i95
+
+bb6.i.i.i95: ; preds = %sdecide.exit.i.i.i, %bb8.i19.i.i.i, %bb8.i.i.i.i
+ br label %decide.exit.i.i
+
+decide.exit.i.i: ; preds = %bb6.i.i.i95, %bb1.i23.i.i.i, %bb2.i.i.i87
+ br i1 false, label %bb42.i.i, label %sat.exit.i.loopexit.loopexit2
+
+bb42.i.i: ; preds = %decide.exit.i.i
+ br label %bb13.i.i71.outer
+
+sat.exit.i.loopexit.loopexit: ; preds = %bb24.i.i, %bb1.i68.i.i, %incincs.exit.i.i
+ br label %sat.exit.i.loopexit
+
+sat.exit.i.loopexit.loopexit2: ; preds = %decide.exit.i.i, %bb1.i48.i.i, %bb29.i.i
+ br label %sat.exit.i.loopexit
+
+sat.exit.i.loopexit: ; preds = %sat.exit.i.loopexit.loopexit2, %sat.exit.i.loopexit.loopexit
+ br label %sat.exit.i
+
+sat.exit.i: ; preds = %sat.exit.i.loopexit, %bb1.i61.i.i, %bb8.i.i67, %bb1.i.i.i63, %bb3.i.i59
+ br i1 false, label %bb7.i, label %bb2.i96
+
+bb2.i96: ; preds = %sat.exit.i
+ switch i32 0, label %bb5.i99 [
+ i32 10, label %bb4.i98
+ i32 20, label %bb6.i100
+ ]
+
+bb4.i98: ; preds = %bb2.i96
+ br label %bb6.i100
+
+bb5.i99: ; preds = %bb2.i96
+ br label %bb6.i100
+
+bb6.i100: ; preds = %bb5.i99, %bb4.i98, %bb2.i96
+ br label %bb7.i
+
+bb7.i: ; preds = %bb6.i100, %sat.exit.i
+ br i1 false, label %bb.i1.i, label %picosat_sat.exit
+
+bb.i1.i: ; preds = %bb7.i
+ br label %picosat_sat.exit
+
+picosat_sat.exit: ; preds = %bb.i1.i, %bb7.i
+ switch i32 0, label %bb166 [
+ i32 20, label %bb150
+ i32 10, label %bb163
+ ]
+
+bb150: ; preds = %picosat_sat.exit
+ br i1 false, label %bb152, label %bb151
+
+bb151: ; preds = %bb150
+ br label %bb152
+
+bb152: ; preds = %bb151, %bb150
+ br i1 false, label %bb154, label %bb153
+
+bb153: ; preds = %bb152
+ br label %bb154
+
+bb154: ; preds = %bb153, %bb152
+ br i1 false, label %bb157, label %bb156
+
+bb156: ; preds = %bb154
+ br label %bb157
+
+bb157: ; preds = %bb156, %bb154
+ br i1 false, label %bb159, label %bb158
+
+bb158: ; preds = %bb157
+ br label %bb159
+
+bb159: ; preds = %bb158, %bb157
+ br i1 false, label %bb167, label %bb160
+
+bb160: ; preds = %bb159
+ br label %bb167
+
+bb163: ; preds = %picosat_sat.exit
+ br i1 false, label %bb167, label %bb164
+
+bb164: ; preds = %bb163
+ br label %bb4.i
+
+bb.i11: ; preds = %bb4.i
+ br i1 false, label %bb.i.i12, label %bb1.i.i14
+
+bb.i.i12: ; preds = %bb.i11
+ unreachable
+
+bb1.i.i14: ; preds = %bb.i11
+ br i1 false, label %bb3.i.i16, label %bb2.i.i15
+
+bb2.i.i15: ; preds = %bb1.i.i14
+ unreachable
+
+bb3.i.i16: ; preds = %bb1.i.i14
+ br i1 false, label %bb3.i, label %bb7.i.i
+
+bb7.i.i: ; preds = %bb3.i.i16
+ br i1 false, label %bb.i.i.i.i17, label %bb1.i.i.i.i18
+
+bb.i.i.i.i17: ; preds = %bb7.i.i
+ br label %int2lit.exit.i.i
+
+bb1.i.i.i.i18: ; preds = %bb7.i.i
+ br label %int2lit.exit.i.i
+
+int2lit.exit.i.i: ; preds = %bb1.i.i.i.i18, %bb.i.i.i.i17
+ br i1 false, label %bb3.i, label %bb9.i.i
+
+bb9.i.i: ; preds = %int2lit.exit.i.i
+ br label %bb3.i
+
+bb3.i: ; preds = %bb9.i.i, %int2lit.exit.i.i, %bb3.i.i16
+ br label %bb4.i
+
+bb4.i: ; preds = %bb3.i, %bb164
+ br i1 false, label %bb5.i, label %bb.i11
+
+bb5.i: ; preds = %bb4.i
+ br i1 false, label %bb6.i, label %bb167
+
+bb6.i: ; preds = %bb5.i
+ br label %bb167
+
+bb166: ; preds = %picosat_sat.exit
+ br label %bb167
+
+bb167: ; preds = %bb166, %bb6.i, %bb5.i, %bb163, %bb160, %bb159, %picosat_print.exit
+ br i1 false, label %bb168, label %bb170
+
+bb168: ; preds = %bb167
+ br i1 false, label %bb170, label %bb169
+
+bb169: ; preds = %bb168
+ br i1 false, label %bb.i7, label %picosat_time_stamp.exit9
+
+bb.i7: ; preds = %bb169
+ br label %picosat_time_stamp.exit9
+
+picosat_time_stamp.exit9: ; preds = %bb.i7, %bb169
+ br label %bb170
+
+bb170: ; preds = %picosat_time_stamp.exit9, %bb168, %bb167, %bb129
+ br i1 false, label %bb.i.i3, label %picosat_leave.exit
+
+bb.i.i3: ; preds = %bb170
+ br label %picosat_leave.exit
+
+picosat_leave.exit: ; preds = %bb.i.i3, %bb170
+ br i1 false, label %bb1.i.i, label %bb.i.i
+
+bb.i.i: ; preds = %picosat_leave.exit
+ unreachable
+
+bb1.i.i: ; preds = %picosat_leave.exit
+ br label %bb9.i.i.i
+
+bb3.i.i.i: ; preds = %bb9.i.i.i
+ br i1 false, label %bb5.i.i.i, label %bb4.i.i.i
+
+bb4.i.i.i: ; preds = %bb3.i.i.i
+ br label %bb5.i.i.i
+
+bb5.i.i.i: ; preds = %bb4.i.i.i, %bb3.i.i.i
+ br label %bb9.i.i.i
+
+bb9.i.i.i: ; preds = %bb5.i.i.i, %bb1.i.i
+ br i1 false, label %bb10.i.i.i, label %bb3.i.i.i
+
+bb10.i.i.i: ; preds = %bb9.i.i.i
+ br i1 false, label %delete.exit.i.i.i, label %bb1.i.i.i.i
+
+bb1.i.i.i.i: ; preds = %bb10.i.i.i
+ br label %delete.exit.i.i.i
+
+delete.exit.i.i.i: ; preds = %bb1.i.i.i.i, %bb10.i.i.i
+ br i1 false, label %delete_clauses.exit.i.i, label %bb1.i7.i.i.i
+
+bb1.i7.i.i.i: ; preds = %delete.exit.i.i.i
+ br label %delete_clauses.exit.i.i
+
+delete_clauses.exit.i.i: ; preds = %bb1.i7.i.i.i, %delete.exit.i.i.i
+ br label %bb3.i.i
+
+bb2.i.i: ; preds = %bb3.i.i
+ br i1 false, label %lrelease.exit.i.i, label %bb1.i.i23.i.i
+
+bb1.i.i23.i.i: ; preds = %bb2.i.i
+ br label %lrelease.exit.i.i
+
+lrelease.exit.i.i: ; preds = %bb1.i.i23.i.i, %bb2.i.i
+ br label %bb3.i.i
+
+bb3.i.i: ; preds = %lrelease.exit.i.i, %delete_clauses.exit.i.i
+ br i1 false, label %bb4.i.i, label %bb2.i.i
+
+bb4.i.i: ; preds = %bb3.i.i
+ br i1 false, label %delete.exit214.i.i, label %bb1.i208.i.i
+
+bb1.i208.i.i: ; preds = %bb4.i.i
+ br label %delete.exit214.i.i
+
+delete.exit214.i.i: ; preds = %bb1.i208.i.i, %bb4.i.i
+ br i1 false, label %delete.exit203.i.i, label %bb1.i197.i.i
+
+bb1.i197.i.i: ; preds = %delete.exit214.i.i
+ br label %delete.exit203.i.i
+
+delete.exit203.i.i: ; preds = %bb1.i197.i.i, %delete.exit214.i.i
+ br i1 false, label %delete.exit192.i.i, label %bb1.i186.i.i
+
+bb1.i186.i.i: ; preds = %delete.exit203.i.i
+ br label %delete.exit192.i.i
+
+delete.exit192.i.i: ; preds = %bb1.i186.i.i, %delete.exit203.i.i
+ br i1 false, label %delete.exit181.i.i, label %bb1.i175.i.i
+
+bb1.i175.i.i: ; preds = %delete.exit192.i.i
+ br label %delete.exit181.i.i
+
+delete.exit181.i.i: ; preds = %bb1.i175.i.i, %delete.exit192.i.i
+ br i1 false, label %delete.exit170.i.i, label %bb1.i164.i.i
+
+bb1.i164.i.i: ; preds = %delete.exit181.i.i
+ br label %delete.exit170.i.i
+
+delete.exit170.i.i: ; preds = %bb1.i164.i.i, %delete.exit181.i.i
+ br i1 false, label %delete.exit159.i.i, label %bb1.i153.i.i
+
+bb1.i153.i.i: ; preds = %delete.exit170.i.i
+ br label %delete.exit159.i.i
+
+delete.exit159.i.i: ; preds = %bb1.i153.i.i, %delete.exit170.i.i
+ br i1 false, label %delete.exit148.i.i, label %bb1.i142.i.i
+
+bb1.i142.i.i: ; preds = %delete.exit159.i.i
+ br label %delete.exit148.i.i
+
+delete.exit148.i.i: ; preds = %bb1.i142.i.i, %delete.exit159.i.i
+ br i1 false, label %delete.exit137.i.i, label %bb1.i131.i.i
+
+bb1.i131.i.i: ; preds = %delete.exit148.i.i
+ br label %delete.exit137.i.i
+
+delete.exit137.i.i: ; preds = %bb1.i131.i.i, %delete.exit148.i.i
+ br i1 false, label %delete.exit126.i.i, label %bb1.i120.i.i
+
+bb1.i120.i.i: ; preds = %delete.exit137.i.i
+ br label %delete.exit126.i.i
+
+delete.exit126.i.i: ; preds = %bb1.i120.i.i, %delete.exit137.i.i
+ br i1 false, label %delete.exit115.i.i, label %bb1.i109.i.i
+
+bb1.i109.i.i: ; preds = %delete.exit126.i.i
+ br label %delete.exit115.i.i
+
+delete.exit115.i.i: ; preds = %bb1.i109.i.i, %delete.exit126.i.i
+ br i1 false, label %delete.exit104.i.i, label %bb1.i98.i.i
+
+bb1.i98.i.i: ; preds = %delete.exit115.i.i
+ br label %delete.exit104.i.i
+
+delete.exit104.i.i: ; preds = %bb1.i98.i.i, %delete.exit115.i.i
+ br i1 false, label %delete.exit93.i.i, label %bb1.i87.i.i
+
+bb1.i87.i.i: ; preds = %delete.exit104.i.i
+ br label %delete.exit93.i.i
+
+delete.exit93.i.i: ; preds = %bb1.i87.i.i, %delete.exit104.i.i
+ br i1 false, label %delete.exit82.i.i, label %bb1.i76.i.i
+
+bb1.i76.i.i: ; preds = %delete.exit93.i.i
+ br label %delete.exit82.i.i
+
+delete.exit82.i.i: ; preds = %bb1.i76.i.i, %delete.exit93.i.i
+ br i1 false, label %delete.exit71.i.i, label %bb1.i65.i.i
+
+bb1.i65.i.i: ; preds = %delete.exit82.i.i
+ br label %delete.exit71.i.i
+
+delete.exit71.i.i: ; preds = %bb1.i65.i.i, %delete.exit82.i.i
+ br i1 false, label %delete.exit60.i.i, label %bb1.i54.i.i
+
+bb1.i54.i.i: ; preds = %delete.exit71.i.i
+ br label %delete.exit60.i.i
+
+delete.exit60.i.i: ; preds = %bb1.i54.i.i, %delete.exit71.i.i
+ br i1 false, label %delete.exit38.i.i, label %bb1.i32.i.i
+
+bb1.i32.i.i: ; preds = %delete.exit60.i.i
+ br label %delete.exit38.i.i
+
+delete.exit38.i.i: ; preds = %bb1.i32.i.i, %delete.exit60.i.i
+ br i1 false, label %delete.exit18.i.i, label %bb1.i12.i.i
+
+bb1.i12.i.i: ; preds = %delete.exit38.i.i
+ br label %delete.exit18.i.i
+
+delete.exit18.i.i: ; preds = %bb1.i12.i.i, %delete.exit38.i.i
+ br i1 false, label %picosat_reset.exit, label %bb1.i2.i.i
+
+bb1.i2.i.i: ; preds = %delete.exit18.i.i
+ br label %picosat_reset.exit
+
+picosat_reset.exit: ; preds = %bb1.i2.i.i, %delete.exit18.i.i
+ br label %bb171
+
+bb171: ; preds = %picosat_reset.exit, %bb110
+ br i1 false, label %bb173, label %bb172
+
+bb172: ; preds = %bb171
+ br label %bb173
+
+bb173: ; preds = %bb172, %bb171
+ br i1 false, label %bb175, label %bb174
+
+bb174: ; preds = %bb173
+ br label %bb175
+
+bb175: ; preds = %bb174, %bb173
+ br i1 false, label %bb177, label %bb176
+
+bb176: ; preds = %bb175
+ br label %bb177
+
+bb177: ; preds = %bb176, %bb175
+ br i1 false, label %bb179, label %bb178
+
+bb178: ; preds = %bb177
+ ret i32 0
+
+bb179: ; preds = %bb177
+ ret i32 0
+}
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+ br label %bb2
+
+bb: ; preds = %bb2
+ br i1 false, label %bb3, label %bb2
+
+bb2: ; preds = %bb, %entry
+ br i1 false, label %bb5.loopexit, label %bb
+
+bb3: ; preds = %bb
+ br i1 false, label %bb5, label %bb4
+
+bb4: ; preds = %bb3
+ br label %bb5
+
+bb5.loopexit: ; preds = %bb2
+ br label %bb5
+
+bb5: ; preds = %bb5.loopexit, %bb4, %bb3
+ %0 = call fastcc i32 @picosat_main(i32 %argc, i8** %argv) nounwind ; <i32> [#uses=2]
+ br i1 false, label %bb7, label %bb6
+
+bb6: ; preds = %bb5
+ ret i32 %0
+
+bb7: ; preds = %bb5
+ ret i32 %0
+}
diff --git a/test/Transforms/BlockPlacement/basictest.ll b/test/Transforms/BlockPlacement/basictest.ll
new file mode 100644
index 000000000000..4eec23e49cf1
--- /dev/null
+++ b/test/Transforms/BlockPlacement/basictest.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -block-placement -disable-output -print-function 2> /dev/null
+
+define i32 @test() {
+ br i1 true, label %X, label %Y
+
+A: ; preds = %Y, %X
+ ret i32 0
+
+X: ; preds = %0
+ br label %A
+
+Y: ; preds = %0
+ br label %A
+}
+
diff --git a/test/Transforms/BlockPlacement/dg.exp b/test/Transforms/BlockPlacement/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/BlockPlacement/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll b/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll
new file mode 100644
index 000000000000..8afdcae50ae9
--- /dev/null
+++ b/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -std-compile-opts -o - | llc -o - | grep bork_directive | wc -l | grep 2
+
+;; We don't want branch folding to fold asm directives.
+
+define void @bork(i32 %param) {
+entry:
+ %tmp = icmp eq i32 %param, 0
+ br i1 %tmp, label %cond_true, label %cond_false
+
+cond_true:
+ call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
+ ret void
+
+cond_false:
+ call void asm sideeffect ".foo_directive ${0:c}:${1:c}", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
+ call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
+ ret void
+}
diff --git a/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll b/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
new file mode 100644
index 000000000000..aba35642e4dc
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
@@ -0,0 +1,75 @@
+; RUN: llvm-as < %s | opt -loop-extract -disable-output
+
+define void @solve() {
+entry:
+ br label %loopentry.0
+
+loopentry.0: ; preds = %endif.0, %entry
+ br i1 false, label %no_exit.0, label %loopexit.0
+
+no_exit.0: ; preds = %loopentry.0
+ br i1 false, label %then.0, label %endif.0
+
+then.0: ; preds = %no_exit.0
+ br i1 false, label %shortcirc_done, label %shortcirc_next
+
+shortcirc_next: ; preds = %then.0
+ br label %shortcirc_done
+
+shortcirc_done: ; preds = %shortcirc_next, %then.0
+ br i1 false, label %then.1, label %endif.1
+
+then.1: ; preds = %shortcirc_done
+ br i1 false, label %cond_true, label %cond_false
+
+cond_true: ; preds = %then.1
+ br label %cond_continue
+
+cond_false: ; preds = %then.1
+ br label %cond_continue
+
+cond_continue: ; preds = %cond_false, %cond_true
+ br label %return
+
+after_ret.0: ; No predecessors!
+ br label %endif.1
+
+endif.1: ; preds = %after_ret.0, %shortcirc_done
+ br label %endif.0
+
+endif.0: ; preds = %endif.1, %no_exit.0
+ br label %loopentry.0
+
+loopexit.0: ; preds = %loopentry.0
+ br i1 false, label %then.2, label %endif.2
+
+then.2: ; preds = %loopexit.0
+ br i1 false, label %then.3, label %endif.3
+
+then.3: ; preds = %then.2
+ br label %return
+
+after_ret.1: ; No predecessors!
+ br label %endif.3
+
+endif.3: ; preds = %after_ret.1, %then.2
+ br label %endif.2
+
+endif.2: ; preds = %endif.3, %loopexit.0
+ br label %loopentry.1
+
+loopentry.1: ; preds = %no_exit.1, %endif.2
+ br i1 false, label %no_exit.1, label %loopexit.1
+
+no_exit.1: ; preds = %loopentry.1
+ br label %loopentry.1
+
+loopexit.1: ; preds = %loopentry.1
+ br label %return
+
+after_ret.2: ; No predecessors!
+ br label %return
+
+return: ; preds = %after_ret.2, %loopexit.1, %then.3, %cond_continue
+ ret void
+}
diff --git a/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll b/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
new file mode 100644
index 000000000000..a41430d45d3c
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -loop-extract -disable-output
+; This testcase is failing the loop extractor because not all exit blocks
+; are dominated by all of the live-outs.
+
+define i32 @ab(i32 %alpha, i32 %beta) {
+entry:
+ br label %loopentry.1.preheader
+
+loopentry.1.preheader: ; preds = %entry
+ br label %loopentry.1
+
+loopentry.1: ; preds = %no_exit.1, %loopentry.1.preheader
+ br i1 false, label %no_exit.1, label %loopexit.0.loopexit1
+
+no_exit.1: ; preds = %loopentry.1
+ %tmp.53 = load i32* null ; <i32> [#uses=1]
+ br i1 false, label %shortcirc_next.2, label %loopentry.1
+
+shortcirc_next.2: ; preds = %no_exit.1
+ %tmp.563 = call i32 @wins( i32 0, i32 %tmp.53, i32 3 ) ; <i32> [#uses=0]
+ ret i32 0
+
+loopexit.0.loopexit1: ; preds = %loopentry.1
+ br label %loopexit.0
+
+loopexit.0: ; preds = %loopexit.0.loopexit1
+ ret i32 0
+}
+
+declare i32 @wins(i32, i32, i32)
+
+declare i16 @ab_code()
+
diff --git a/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll b/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
new file mode 100644
index 000000000000..ded821b702f5
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -loop-extract-single -disable-output
+
+define void @ab() {
+entry:
+ br label %codeReplTail
+
+then.1: ; preds = %codeReplTail
+ br label %loopentry.1
+
+loopentry.1: ; preds = %no_exit.1, %then.1
+ br i1 false, label %no_exit.1, label %loopexit.0.loopexit1
+
+no_exit.1: ; preds = %loopentry.1
+ br label %loopentry.1
+
+loopexit.0.loopexit: ; preds = %codeReplTail
+ ret void
+
+loopexit.0.loopexit1: ; preds = %loopentry.1
+ ret void
+
+codeReplTail: ; preds = %codeReplTail, %entry
+ switch i16 0, label %codeReplTail [
+ i16 0, label %loopexit.0.loopexit
+ i16 1, label %then.1
+ ]
+}
+
diff --git a/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll b/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
new file mode 100644
index 000000000000..e2030e2db987
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -loop-extract -disable-output
+
+define void @sendMTFValues() {
+entry:
+ br i1 false, label %then.1, label %endif.1
+
+then.1: ; preds = %entry
+ br i1 false, label %loopentry.6.preheader, label %else.0
+
+endif.1: ; preds = %entry
+ ret void
+
+else.0: ; preds = %then.1
+ ret void
+
+loopentry.6.preheader: ; preds = %then.1
+ br i1 false, label %endif.7.preheader, label %loopexit.9
+
+endif.7.preheader: ; preds = %loopentry.6.preheader
+ %tmp.183 = add i32 0, -1 ; <i32> [#uses=1]
+ br label %endif.7
+
+endif.7: ; preds = %loopexit.15, %endif.7.preheader
+ br i1 false, label %loopentry.10, label %loopentry.12
+
+loopentry.10: ; preds = %endif.7
+ br label %loopentry.12
+
+loopentry.12: ; preds = %loopentry.10, %endif.7
+ %ge.2.1 = phi i32 [ 0, %loopentry.10 ], [ %tmp.183, %endif.7 ] ; <i32> [#uses=0]
+ br i1 false, label %loopexit.14, label %no_exit.11
+
+no_exit.11: ; preds = %loopentry.12
+ ret void
+
+loopexit.14: ; preds = %loopentry.12
+ br i1 false, label %loopexit.15, label %no_exit.14
+
+no_exit.14: ; preds = %loopexit.14
+ ret void
+
+loopexit.15: ; preds = %loopexit.14
+ br i1 false, label %endif.7, label %loopexit.9
+
+loopexit.9: ; preds = %loopexit.15, %loopentry.6.preheader
+ ret void
+}
diff --git a/test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll b/test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll
new file mode 100644
index 000000000000..9f4b273a61ea
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -loop-extract -disable-output
+
+%struct.node_t = type { double*, %struct.node_t*, %struct.node_t**, double**, double*, i32, i32 }
+%struct.table_t = type { [1 x %struct.node_t**], [1 x %struct.node_t**] }
+
+define void @make_tables() {
+entry:
+ %tmp.0.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=1]
+ br i1 false, label %no_exit.i, label %loopexit.i
+
+no_exit.i: ; preds = %no_exit.i, %entry
+ %prev_node.0.i.1 = phi %struct.node_t* [ %tmp.16.i, %no_exit.i ], [ %tmp.0.i, %entry ] ; <%struct.node_t*> [#uses=0]
+ %tmp.16.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=2]
+ br i1 false, label %no_exit.i, label %loopexit.i
+
+loopexit.i: ; preds = %no_exit.i, %entry
+ %cur_node.0.i.0 = phi %struct.node_t* [ null, %entry ], [ %tmp.16.i, %no_exit.i ] ; <%struct.node_t*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll b/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
new file mode 100644
index 000000000000..b1b0324bca50
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -loop-extract -disable-output
+
+define void @maketree() {
+entry:
+ br i1 false, label %no_exit.1, label %loopexit.0
+
+no_exit.1: ; preds = %endif, %expandbox.entry, %entry
+ br i1 false, label %endif, label %expandbox.entry
+
+expandbox.entry: ; preds = %no_exit.1
+ br i1 false, label %loopexit.1, label %no_exit.1
+
+endif: ; preds = %no_exit.1
+ br i1 false, label %loopexit.1, label %no_exit.1
+
+loopexit.1: ; preds = %endif, %expandbox.entry
+ %ic.i.0.0.4 = phi i32 [ 0, %expandbox.entry ], [ 0, %endif ] ; <i32> [#uses=0]
+ ret void
+
+loopexit.0: ; preds = %entry
+ ret void
+}
+
diff --git a/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll b/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll
new file mode 100644
index 000000000000..48e5a768e0e5
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll
@@ -0,0 +1,194 @@
+; RUN: llvm-as < %s | opt -loop-extract -disable-output
+
+declare i32 @_IO_getc()
+
+declare void @__errno_location()
+
+define void @yylex() {
+entry:
+ switch i32 0, label %label.126 [
+ i32 0, label %return
+ i32 61, label %combine
+ i32 33, label %combine
+ i32 94, label %combine
+ i32 37, label %combine
+ i32 47, label %combine
+ i32 42, label %combine
+ i32 62, label %combine
+ i32 60, label %combine
+ i32 58, label %combine
+ i32 124, label %combine
+ i32 38, label %combine
+ i32 45, label %combine
+ i32 43, label %combine
+ i32 34, label %string_constant
+ i32 39, label %char_constant
+ i32 46, label %loopexit.2
+ i32 57, label %loopexit.2
+ i32 56, label %loopexit.2
+ i32 55, label %loopexit.2
+ i32 54, label %loopexit.2
+ i32 53, label %loopexit.2
+ i32 52, label %loopexit.2
+ i32 51, label %loopexit.2
+ i32 50, label %loopexit.2
+ i32 49, label %loopexit.2
+ i32 48, label %loopexit.2
+ i32 95, label %letter
+ i32 122, label %letter
+ i32 121, label %letter
+ i32 120, label %letter
+ i32 119, label %letter
+ i32 118, label %letter
+ i32 117, label %letter
+ i32 116, label %letter
+ i32 115, label %letter
+ i32 114, label %letter
+ i32 113, label %letter
+ i32 112, label %letter
+ i32 111, label %letter
+ i32 110, label %letter
+ i32 109, label %letter
+ i32 108, label %letter
+ i32 107, label %letter
+ i32 106, label %letter
+ i32 105, label %letter
+ i32 104, label %letter
+ i32 103, label %letter
+ i32 102, label %letter
+ i32 101, label %letter
+ i32 100, label %letter
+ i32 99, label %letter
+ i32 98, label %letter
+ i32 97, label %letter
+ i32 90, label %letter
+ i32 89, label %letter
+ i32 88, label %letter
+ i32 87, label %letter
+ i32 86, label %letter
+ i32 85, label %letter
+ i32 84, label %letter
+ i32 83, label %letter
+ i32 82, label %letter
+ i32 81, label %letter
+ i32 80, label %letter
+ i32 79, label %letter
+ i32 78, label %letter
+ i32 77, label %letter
+ i32 75, label %letter
+ i32 74, label %letter
+ i32 73, label %letter
+ i32 72, label %letter
+ i32 71, label %letter
+ i32 70, label %letter
+ i32 69, label %letter
+ i32 68, label %letter
+ i32 67, label %letter
+ i32 66, label %letter
+ i32 65, label %letter
+ i32 64, label %label.13
+ i32 76, label %label.12
+ i32 36, label %label.11
+ i32 -1, label %label.10
+ ]
+
+label.10: ; preds = %entry
+ ret void
+
+label.11: ; preds = %entry
+ ret void
+
+label.12: ; preds = %entry
+ ret void
+
+label.13: ; preds = %entry
+ ret void
+
+letter: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
+ ret void
+
+loopexit.2: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
+ switch i32 0, label %shortcirc_next.14 [
+ i32 48, label %then.20
+ i32 46, label %endif.38
+ ]
+
+then.20: ; preds = %loopexit.2
+ switch i32 0, label %else.4 [
+ i32 120, label %then.21
+ i32 88, label %then.21
+ ]
+
+then.21: ; preds = %then.20, %then.20
+ ret void
+
+else.4: ; preds = %then.20
+ ret void
+
+shortcirc_next.14: ; preds = %loopexit.2
+ ret void
+
+endif.38: ; preds = %loopexit.2
+ br i1 false, label %then.40, label %then.39
+
+then.39: ; preds = %endif.38
+ ret void
+
+then.40: ; preds = %endif.38
+ invoke void @__errno_location( )
+ to label %switchexit.2 unwind label %LongJmpBlkPre
+
+loopentry.6: ; preds = %endif.52
+ switch i32 0, label %switchexit.2 [
+ i32 73, label %label.82
+ i32 105, label %label.82
+ i32 76, label %label.80
+ i32 108, label %label.80
+ i32 70, label %label.78
+ i32 102, label %label.78
+ ]
+
+label.78: ; preds = %loopentry.6, %loopentry.6
+ ret void
+
+label.80: ; preds = %loopentry.6, %loopentry.6
+ ret void
+
+label.82: ; preds = %loopentry.6, %loopentry.6
+ %c.0.15.5 = phi i32 [ %tmp.79417, %loopentry.6 ], [ %tmp.79417, %loopentry.6 ] ; <i32> [#uses=0]
+ ret void
+
+switchexit.2: ; preds = %loopentry.6, %then.40
+ br i1 false, label %endif.51, label %loopexit.6
+
+endif.51: ; preds = %switchexit.2
+ br i1 false, label %endif.52, label %then.52
+
+then.52: ; preds = %endif.51
+ ret void
+
+endif.52: ; preds = %endif.51
+ %tmp.79417 = invoke i32 @_IO_getc( )
+ to label %loopentry.6 unwind label %LongJmpBlkPre ; <i32> [#uses=2]
+
+loopexit.6: ; preds = %switchexit.2
+ ret void
+
+char_constant: ; preds = %entry
+ ret void
+
+string_constant: ; preds = %entry
+ ret void
+
+combine: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
+ ret void
+
+label.126: ; preds = %entry
+ ret void
+
+return: ; preds = %entry
+ ret void
+
+LongJmpBlkPre: ; preds = %endif.52, %then.40
+ ret void
+}
diff --git a/test/Transforms/CodeExtractor/2004-08-12-BlockExtractPHI.ll b/test/Transforms/CodeExtractor/2004-08-12-BlockExtractPHI.ll
new file mode 100644
index 000000000000..0ab5498b0491
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-08-12-BlockExtractPHI.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -extract-blocks -disable-output
+
+define void @test1() {
+no_exit.0.i:
+ br i1 false, label %yylex.entry, label %yylex.entry
+
+yylex.entry: ; preds = %no_exit.0.i, %no_exit.0.i
+ %tmp.1027 = phi i32 [ 0, %no_exit.0.i ], [ 0, %no_exit.0.i ] ; <i32> [#uses=0]
+ ret void
+}
+
+define void @test2() {
+no_exit.0.i:
+ switch i32 0, label %yylex.entry [
+ i32 0, label %yylex.entry
+ i32 1, label %foo
+ ]
+
+yylex.entry: ; preds = %no_exit.0.i, %no_exit.0.i
+ %tmp.1027 = phi i32 [ 0, %no_exit.0.i ], [ 0, %no_exit.0.i ] ; <i32> [#uses=0]
+ ret void
+
+foo: ; preds = %no_exit.0.i
+ ret void
+}
+
diff --git a/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll b/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll
new file mode 100644
index 000000000000..8cd609482668
--- /dev/null
+++ b/test/Transforms/CodeExtractor/2004-11-12-InvokeExtract.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -extract-blocks -disable-output
+define i32 @foo() {
+ br label %EB
+
+EB: ; preds = %0
+ %V = invoke i32 @foo( )
+ to label %Cont unwind label %Unw ; <i32> [#uses=1]
+
+Cont: ; preds = %EB
+ ret i32 %V
+
+Unw: ; preds = %EB
+ unwind
+}
+
diff --git a/test/Transforms/CodeExtractor/dg.exp b/test/Transforms/CodeExtractor/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/CodeExtractor/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/CodeGenPrepare/2008-11-24-RAUW-Self.ll b/test/Transforms/CodeGenPrepare/2008-11-24-RAUW-Self.ll
new file mode 100644
index 000000000000..12d6c0c1f8f9
--- /dev/null
+++ b/test/Transforms/CodeGenPrepare/2008-11-24-RAUW-Self.ll
@@ -0,0 +1,511 @@
+; RUN: llvm-as < %s | opt -codegenprepare | llvm-dis
+; PR3113
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define fastcc i32 @ascii2flt(i8* %str) nounwind {
+entry:
+ br label %bb2.i
+
+bb2.i: ; preds = %bb4.i.bb2.i_crit_edge, %entry
+ br i1 false, label %bb4.i, label %base2flt.exit
+
+bb4.i: ; preds = %bb2.i
+ br i1 false, label %bb11.i, label %bb4.i.bb2.i_crit_edge
+
+bb4.i.bb2.i_crit_edge: ; preds = %bb4.i
+ br label %bb2.i
+
+bb11.i: ; preds = %bb4.i
+ br label %bb11.i.base2flt.exit204_crit_edge
+
+bb11.i.base2flt.exit204_crit_edge: ; preds = %bb11.i
+ br label %base2flt.exit204
+
+bb11.i.bb7.i197_crit_edge: ; No predecessors!
+ br label %bb7.i197
+
+base2flt.exit: ; preds = %bb2.i
+ br label %base2flt.exit.base2flt.exit204_crit_edge
+
+base2flt.exit.base2flt.exit204_crit_edge: ; preds = %base2flt.exit
+ br label %base2flt.exit204
+
+base2flt.exit.bb7.i197_crit_edge: ; No predecessors!
+ br label %bb7.i197
+
+bb10.i196: ; preds = %bb7.i197
+ br label %bb10.i196.base2flt.exit204_crit_edge
+
+bb10.i196.base2flt.exit204_crit_edge: ; preds = %bb7.i197, %bb10.i196
+ br label %base2flt.exit204
+
+bb10.i196.bb7.i197_crit_edge: ; No predecessors!
+ br label %bb7.i197
+
+bb7.i197: ; preds = %bb10.i196.bb7.i197_crit_edge, %base2flt.exit.bb7.i197_crit_edge, %bb11.i.bb7.i197_crit_edge
+ %.reg2mem.0 = phi i32 [ 0, %base2flt.exit.bb7.i197_crit_edge ], [ %.reg2mem.0, %bb10.i196.bb7.i197_crit_edge ], [ 0, %bb11.i.bb7.i197_crit_edge ] ; <i32> [#uses=1]
+ br i1 undef, label %bb10.i196.base2flt.exit204_crit_edge, label %bb10.i196
+
+base2flt.exit204: ; preds = %bb10.i196.base2flt.exit204_crit_edge, %base2flt.exit.base2flt.exit204_crit_edge, %bb11.i.base2flt.exit204_crit_edge
+ br i1 false, label %base2flt.exit204.bb8_crit_edge, label %bb
+
+base2flt.exit204.bb8_crit_edge: ; preds = %base2flt.exit204
+ br label %bb8
+
+bb: ; preds = %base2flt.exit204
+ br i1 false, label %bb.bb18_crit_edge, label %bb1.i
+
+bb.bb18_crit_edge: ; preds = %bb9, %bb
+ br label %bb18
+
+bb1.i: ; preds = %bb
+ br i1 false, label %bb1.i.bb7_crit_edge, label %bb1.i158
+
+bb1.i.bb7_crit_edge.loopexit: ; preds = %bb2.i164
+ br label %bb1.i.bb7_crit_edge
+
+bb1.i.bb7_crit_edge: ; preds = %bb1.i.bb7_crit_edge.loopexit, %bb1.i
+ br label %bb7.preheader
+
+bb1.i158: ; preds = %bb1.i
+ br i1 false, label %bb1.i158.bb10.i179_crit_edge, label %bb1.i158.bb2.i164_crit_edge
+
+bb1.i158.bb2.i164_crit_edge: ; preds = %bb1.i158
+ br label %bb2.i164
+
+bb1.i158.bb10.i179_crit_edge: ; preds = %bb1.i158
+ br label %bb10.i179
+
+bb2.i164: ; preds = %bb4.i166.bb2.i164_crit_edge, %bb1.i158.bb2.i164_crit_edge
+ br i1 false, label %bb4.i166, label %bb1.i.bb7_crit_edge.loopexit
+
+bb4.i166: ; preds = %bb2.i164
+ br i1 false, label %bb4.i166.bb11.i172_crit_edge, label %bb4.i166.bb2.i164_crit_edge
+
+bb4.i166.bb2.i164_crit_edge: ; preds = %bb4.i166
+ br label %bb2.i164
+
+bb4.i166.bb11.i172_crit_edge: ; preds = %bb4.i166
+ br label %bb11.i172
+
+bb11.i172: ; preds = %bb10.i179.bb11.i172_crit_edge, %bb4.i166.bb11.i172_crit_edge
+ br label %bb7.preheader
+
+bb10.i179: ; preds = %bb9.i182, %bb1.i158.bb10.i179_crit_edge
+ br i1 false, label %bb7.i180, label %bb10.i179.bb11.i172_crit_edge
+
+bb10.i179.bb11.i172_crit_edge: ; preds = %bb10.i179
+ br label %bb11.i172
+
+bb7.i180: ; preds = %bb10.i179
+ br i1 false, label %bb7.i180.bb7_crit_edge, label %bb9.i182
+
+bb7.i180.bb7_crit_edge: ; preds = %bb7.i180
+ br label %bb7.preheader
+
+bb7.preheader: ; preds = %bb7.i180.bb7_crit_edge, %bb11.i172, %bb1.i.bb7_crit_edge
+ br label %bb7
+
+bb9.i182: ; preds = %bb7.i180
+ br label %bb10.i179
+
+bb7: ; preds = %addflt.exit114, %bb7.preheader
+ switch i8 0, label %bb4 [
+ i8 0, label %bb7.bb8_crit_edge
+ i8 46, label %bb7.bb8_crit_edge
+ ]
+
+bb7.bb8_crit_edge: ; preds = %bb7, %bb7
+ br label %bb8
+
+bb4: ; preds = %bb7
+ br i1 false, label %bb18.loopexit1, label %bb1.i5
+
+bb1.i5: ; preds = %bb4
+ br i1 false, label %bb1.i5.mulflt.exit157_crit_edge, label %bb3.i147
+
+bb1.i5.mulflt.exit157_crit_edge: ; preds = %bb5.i148, %bb1.i5
+ br label %mulflt.exit157
+
+bb3.i147: ; preds = %bb1.i5
+ br i1 false, label %bb3.i147.mulflt.exit157_crit_edge, label %bb5.i148
+
+bb3.i147.mulflt.exit157_crit_edge: ; preds = %bb8.i150, %bb3.i147
+ br label %mulflt.exit157
+
+bb5.i148: ; preds = %bb3.i147
+ br i1 false, label %bb1.i5.mulflt.exit157_crit_edge, label %bb7.i149
+
+bb7.i149: ; preds = %bb5.i148
+ br i1 false, label %bb8.i150, label %bb7.i149.bb12.i154_crit_edge
+
+bb7.i149.bb12.i154_crit_edge: ; preds = %bb7.i149
+ br label %bb12.i154
+
+bb8.i150: ; preds = %bb7.i149
+ br i1 false, label %bb3.i147.mulflt.exit157_crit_edge, label %bb10.i151
+
+bb10.i151: ; preds = %bb8.i150
+ br label %bb12.i154
+
+bb12.i154: ; preds = %bb10.i151, %bb7.i149.bb12.i154_crit_edge
+ br label %mulflt.exit157
+
+mulflt.exit157: ; preds = %bb12.i154, %bb3.i147.mulflt.exit157_crit_edge, %bb1.i5.mulflt.exit157_crit_edge
+ br i1 false, label %mulflt.exit157.base2flt.exit144_crit_edge, label %bb1.i115
+
+mulflt.exit157.base2flt.exit144_crit_edge.loopexit: ; preds = %bb2.i121
+ br label %mulflt.exit157.base2flt.exit144_crit_edge
+
+mulflt.exit157.base2flt.exit144_crit_edge: ; preds = %mulflt.exit157.base2flt.exit144_crit_edge.loopexit, %mulflt.exit157
+ br label %base2flt.exit144
+
+bb1.i115: ; preds = %mulflt.exit157
+ br i1 false, label %bb1.i115.bb10.i136_crit_edge, label %bb1.i115.bb2.i121_crit_edge
+
+bb1.i115.bb2.i121_crit_edge: ; preds = %bb1.i115
+ br label %bb2.i121
+
+bb1.i115.bb10.i136_crit_edge: ; preds = %bb1.i115
+ br label %bb10.i136
+
+bb2.i121: ; preds = %bb4.i123.bb2.i121_crit_edge, %bb1.i115.bb2.i121_crit_edge
+ br i1 false, label %bb4.i123, label %mulflt.exit157.base2flt.exit144_crit_edge.loopexit
+
+bb4.i123: ; preds = %bb2.i121
+ br i1 false, label %bb4.i123.bb11.i129_crit_edge, label %bb4.i123.bb2.i121_crit_edge
+
+bb4.i123.bb2.i121_crit_edge: ; preds = %bb4.i123
+ br label %bb2.i121
+
+bb4.i123.bb11.i129_crit_edge: ; preds = %bb4.i123
+ br label %bb11.i129
+
+bb11.i129: ; preds = %bb10.i136.bb11.i129_crit_edge, %bb4.i123.bb11.i129_crit_edge
+ br label %base2flt.exit144
+
+bb10.i136: ; preds = %bb9.i139, %bb1.i115.bb10.i136_crit_edge
+ br i1 false, label %bb7.i137, label %bb10.i136.bb11.i129_crit_edge
+
+bb10.i136.bb11.i129_crit_edge: ; preds = %bb10.i136
+ br label %bb11.i129
+
+bb7.i137: ; preds = %bb10.i136
+ br i1 false, label %bb7.i137.base2flt.exit144_crit_edge, label %bb9.i139
+
+bb7.i137.base2flt.exit144_crit_edge: ; preds = %bb7.i137
+ br label %base2flt.exit144
+
+bb9.i139: ; preds = %bb7.i137
+ br label %bb10.i136
+
+base2flt.exit144: ; preds = %bb7.i137.base2flt.exit144_crit_edge, %bb11.i129, %mulflt.exit157.base2flt.exit144_crit_edge
+ br i1 false, label %base2flt.exit144.addflt.exit114_crit_edge, label %bb3.i105
+
+base2flt.exit144.addflt.exit114_crit_edge: ; preds = %bb3.i105, %base2flt.exit144
+ br label %addflt.exit114
+
+bb3.i105: ; preds = %base2flt.exit144
+ br i1 false, label %base2flt.exit144.addflt.exit114_crit_edge, label %bb5.i106
+
+bb5.i106: ; preds = %bb3.i105
+ br i1 false, label %bb5.i106.bb9.i111_crit_edge, label %bb6.i107
+
+bb5.i106.bb9.i111_crit_edge: ; preds = %bb5.i106
+ br label %bb9.i111
+
+bb6.i107: ; preds = %bb5.i106
+ br i1 false, label %bb6.i107.addflt.exit114_crit_edge, label %bb8.i108
+
+bb6.i107.addflt.exit114_crit_edge: ; preds = %bb6.i107
+ br label %addflt.exit114
+
+bb8.i108: ; preds = %bb6.i107
+ br label %bb9.i111
+
+bb9.i111: ; preds = %bb8.i108, %bb5.i106.bb9.i111_crit_edge
+ br label %addflt.exit114
+
+addflt.exit114: ; preds = %bb9.i111, %bb6.i107.addflt.exit114_crit_edge, %base2flt.exit144.addflt.exit114_crit_edge
+ br label %bb7
+
+bb18.loopexit1: ; preds = %bb4
+ ret i32 -1
+
+bb18: ; preds = %bb8.bb18_crit_edge, %bb.bb18_crit_edge
+ ret i32 0
+
+bb8: ; preds = %bb7.bb8_crit_edge, %base2flt.exit204.bb8_crit_edge
+ br i1 false, label %bb9, label %bb8.bb18_crit_edge
+
+bb8.bb18_crit_edge: ; preds = %bb8
+ br label %bb18
+
+bb9: ; preds = %bb8
+ br i1 false, label %bb.bb18_crit_edge, label %bb1.i13
+
+bb1.i13: ; preds = %bb9
+ br i1 false, label %bb1.i13.base2flt.exit102_crit_edge, label %bb1.i73
+
+bb1.i13.base2flt.exit102_crit_edge.loopexit: ; preds = %bb2.i79
+ br label %bb1.i13.base2flt.exit102_crit_edge
+
+bb1.i13.base2flt.exit102_crit_edge: ; preds = %bb1.i13.base2flt.exit102_crit_edge.loopexit, %bb1.i13
+ br label %base2flt.exit102
+
+bb1.i73: ; preds = %bb1.i13
+ br i1 false, label %bb1.i73.bb10.i94_crit_edge, label %bb1.i73.bb2.i79_crit_edge
+
+bb1.i73.bb2.i79_crit_edge: ; preds = %bb1.i73
+ br label %bb2.i79
+
+bb1.i73.bb10.i94_crit_edge: ; preds = %bb1.i73
+ br label %bb10.i94
+
+bb2.i79: ; preds = %bb4.i81.bb2.i79_crit_edge, %bb1.i73.bb2.i79_crit_edge
+ br i1 false, label %bb4.i81, label %bb1.i13.base2flt.exit102_crit_edge.loopexit
+
+bb4.i81: ; preds = %bb2.i79
+ br i1 false, label %bb4.i81.bb11.i87_crit_edge, label %bb4.i81.bb2.i79_crit_edge
+
+bb4.i81.bb2.i79_crit_edge: ; preds = %bb4.i81
+ br label %bb2.i79
+
+bb4.i81.bb11.i87_crit_edge: ; preds = %bb4.i81
+ br label %bb11.i87
+
+bb11.i87: ; preds = %bb10.i94.bb11.i87_crit_edge, %bb4.i81.bb11.i87_crit_edge
+ br label %base2flt.exit102
+
+bb10.i94: ; preds = %bb9.i97, %bb1.i73.bb10.i94_crit_edge
+ br i1 false, label %bb7.i95, label %bb10.i94.bb11.i87_crit_edge
+
+bb10.i94.bb11.i87_crit_edge: ; preds = %bb10.i94
+ br label %bb11.i87
+
+bb7.i95: ; preds = %bb10.i94
+ br i1 false, label %bb7.i95.base2flt.exit102_crit_edge, label %bb9.i97
+
+bb7.i95.base2flt.exit102_crit_edge: ; preds = %bb7.i95
+ br label %base2flt.exit102
+
+bb9.i97: ; preds = %bb7.i95
+ br label %bb10.i94
+
+base2flt.exit102: ; preds = %bb7.i95.base2flt.exit102_crit_edge, %bb11.i87, %bb1.i13.base2flt.exit102_crit_edge
+ br i1 false, label %base2flt.exit102.mulflt.exit72_crit_edge, label %bb3.i62
+
+base2flt.exit102.mulflt.exit72_crit_edge: ; preds = %bb5.i63, %base2flt.exit102
+ br label %mulflt.exit72
+
+bb3.i62: ; preds = %base2flt.exit102
+ br i1 false, label %bb3.i62.mulflt.exit72_crit_edge, label %bb5.i63
+
+bb3.i62.mulflt.exit72_crit_edge: ; preds = %bb8.i65, %bb3.i62
+ br label %mulflt.exit72
+
+bb5.i63: ; preds = %bb3.i62
+ br i1 false, label %base2flt.exit102.mulflt.exit72_crit_edge, label %bb7.i64
+
+bb7.i64: ; preds = %bb5.i63
+ br i1 false, label %bb8.i65, label %bb7.i64.bb12.i69_crit_edge
+
+bb7.i64.bb12.i69_crit_edge: ; preds = %bb7.i64
+ br label %bb12.i69
+
+bb8.i65: ; preds = %bb7.i64
+ br i1 false, label %bb3.i62.mulflt.exit72_crit_edge, label %bb10.i66
+
+bb10.i66: ; preds = %bb8.i65
+ br label %bb12.i69
+
+bb12.i69: ; preds = %bb10.i66, %bb7.i64.bb12.i69_crit_edge
+ br label %mulflt.exit72
+
+mulflt.exit72: ; preds = %bb12.i69, %bb3.i62.mulflt.exit72_crit_edge, %base2flt.exit102.mulflt.exit72_crit_edge
+ br i1 false, label %mulflt.exit72.bb10.i58_crit_edge, label %bb3.i50
+
+mulflt.exit72.bb10.i58_crit_edge: ; preds = %bb3.i50, %mulflt.exit72
+ br label %bb10.i58
+
+bb3.i50: ; preds = %mulflt.exit72
+ br i1 false, label %mulflt.exit72.bb10.i58_crit_edge, label %bb5.i51
+
+bb5.i51: ; preds = %bb3.i50
+ br i1 false, label %bb5.i51.bb9.i56_crit_edge, label %bb6.i52
+
+bb5.i51.bb9.i56_crit_edge: ; preds = %bb5.i51
+ br label %bb9.i56
+
+bb6.i52: ; preds = %bb5.i51
+ br i1 false, label %bb6.i52.bb10.i58_crit_edge, label %bb8.i53
+
+bb6.i52.bb10.i58_crit_edge: ; preds = %bb6.i52
+ br label %bb10.i58
+
+bb8.i53: ; preds = %bb6.i52
+ br label %bb9.i56
+
+bb9.i56: ; preds = %bb8.i53, %bb5.i51.bb9.i56_crit_edge
+ br label %bb15.preheader
+
+bb10.i58: ; preds = %bb6.i52.bb10.i58_crit_edge, %mulflt.exit72.bb10.i58_crit_edge
+ br label %bb15.preheader
+
+bb15.preheader: ; preds = %bb10.i58, %bb9.i56
+ br label %bb15
+
+bb15: ; preds = %addflt.exit, %bb15.preheader
+ br i1 false, label %bb15.bb18.loopexit_crit_edge, label %bb12
+
+bb15.bb18.loopexit_crit_edge: ; preds = %bb15
+ br label %bb18.loopexit
+
+bb12: ; preds = %bb15
+ br i1 false, label %bb12.bb18.loopexit_crit_edge, label %bb1.i21
+
+bb12.bb18.loopexit_crit_edge: ; preds = %bb12
+ br label %bb18.loopexit
+
+bb1.i21: ; preds = %bb12
+ br i1 false, label %bb1.i21.mulflt.exit47_crit_edge, label %bb3.i37
+
+bb1.i21.mulflt.exit47_crit_edge: ; preds = %bb5.i38, %bb1.i21
+ br label %mulflt.exit47
+
+bb3.i37: ; preds = %bb1.i21
+ br i1 false, label %bb3.i37.mulflt.exit47_crit_edge, label %bb5.i38
+
+bb3.i37.mulflt.exit47_crit_edge: ; preds = %bb8.i40, %bb3.i37
+ br label %mulflt.exit47
+
+bb5.i38: ; preds = %bb3.i37
+ br i1 false, label %bb1.i21.mulflt.exit47_crit_edge, label %bb7.i39
+
+bb7.i39: ; preds = %bb5.i38
+ br i1 false, label %bb8.i40, label %bb7.i39.bb12.i44_crit_edge
+
+bb7.i39.bb12.i44_crit_edge: ; preds = %bb7.i39
+ br label %bb12.i44
+
+bb8.i40: ; preds = %bb7.i39
+ br i1 false, label %bb3.i37.mulflt.exit47_crit_edge, label %bb10.i41
+
+bb10.i41: ; preds = %bb8.i40
+ br label %bb12.i44
+
+bb12.i44: ; preds = %bb10.i41, %bb7.i39.bb12.i44_crit_edge
+ br label %mulflt.exit47
+
+mulflt.exit47: ; preds = %bb12.i44, %bb3.i37.mulflt.exit47_crit_edge, %bb1.i21.mulflt.exit47_crit_edge
+ br i1 false, label %mulflt.exit47.base2flt.exit34_crit_edge, label %bb1.i15
+
+mulflt.exit47.base2flt.exit34_crit_edge.loopexit: ; preds = %bb2.i20
+ br label %mulflt.exit47.base2flt.exit34_crit_edge
+
+mulflt.exit47.base2flt.exit34_crit_edge: ; preds = %mulflt.exit47.base2flt.exit34_crit_edge.loopexit, %mulflt.exit47
+ br label %base2flt.exit34
+
+bb1.i15: ; preds = %mulflt.exit47
+ br i1 false, label %bb1.i15.bb10.i31_crit_edge, label %bb1.i15.bb2.i20_crit_edge
+
+bb1.i15.bb2.i20_crit_edge: ; preds = %bb1.i15
+ br label %bb2.i20
+
+bb1.i15.bb10.i31_crit_edge: ; preds = %bb1.i15
+ br label %bb10.i31
+
+bb2.i20: ; preds = %bb4.i22.bb2.i20_crit_edge, %bb1.i15.bb2.i20_crit_edge
+ br i1 false, label %bb4.i22, label %mulflt.exit47.base2flt.exit34_crit_edge.loopexit
+
+bb4.i22: ; preds = %bb2.i20
+ br i1 false, label %bb4.i22.bb11.i28_crit_edge, label %bb4.i22.bb2.i20_crit_edge
+
+bb4.i22.bb2.i20_crit_edge: ; preds = %bb4.i22
+ br label %bb2.i20
+
+bb4.i22.bb11.i28_crit_edge: ; preds = %bb4.i22
+ br label %bb11.i28
+
+bb11.i28: ; preds = %bb10.i31.bb11.i28_crit_edge, %bb4.i22.bb11.i28_crit_edge
+ br label %base2flt.exit34
+
+bb10.i31: ; preds = %bb9.i33, %bb1.i15.bb10.i31_crit_edge
+ br i1 false, label %bb7.i32, label %bb10.i31.bb11.i28_crit_edge
+
+bb10.i31.bb11.i28_crit_edge: ; preds = %bb10.i31
+ br label %bb11.i28
+
+bb7.i32: ; preds = %bb10.i31
+ br i1 false, label %bb7.i32.base2flt.exit34_crit_edge, label %bb9.i33
+
+bb7.i32.base2flt.exit34_crit_edge: ; preds = %bb7.i32
+ br label %base2flt.exit34
+
+bb9.i33: ; preds = %bb7.i32
+ br label %bb10.i31
+
+base2flt.exit34: ; preds = %bb7.i32.base2flt.exit34_crit_edge, %bb11.i28, %mulflt.exit47.base2flt.exit34_crit_edge
+ br i1 false, label %base2flt.exit34.mulflt.exit_crit_edge, label %bb3.i9
+
+base2flt.exit34.mulflt.exit_crit_edge: ; preds = %bb5.i10, %base2flt.exit34
+ br label %mulflt.exit
+
+bb3.i9: ; preds = %base2flt.exit34
+ br i1 false, label %bb3.i9.mulflt.exit_crit_edge, label %bb5.i10
+
+bb3.i9.mulflt.exit_crit_edge: ; preds = %bb8.i11, %bb3.i9
+ br label %mulflt.exit
+
+bb5.i10: ; preds = %bb3.i9
+ br i1 false, label %base2flt.exit34.mulflt.exit_crit_edge, label %bb7.i
+
+bb7.i: ; preds = %bb5.i10
+ br i1 false, label %bb8.i11, label %bb7.i.bb12.i_crit_edge
+
+bb7.i.bb12.i_crit_edge: ; preds = %bb7.i
+ br label %bb12.i
+
+bb8.i11: ; preds = %bb7.i
+ br i1 false, label %bb3.i9.mulflt.exit_crit_edge, label %bb10.i12
+
+bb10.i12: ; preds = %bb8.i11
+ br label %bb12.i
+
+bb12.i: ; preds = %bb10.i12, %bb7.i.bb12.i_crit_edge
+ br label %mulflt.exit
+
+mulflt.exit: ; preds = %bb12.i, %bb3.i9.mulflt.exit_crit_edge, %base2flt.exit34.mulflt.exit_crit_edge
+ br i1 false, label %mulflt.exit.addflt.exit_crit_edge, label %bb3.i
+
+mulflt.exit.addflt.exit_crit_edge: ; preds = %bb3.i, %mulflt.exit
+ br label %addflt.exit
+
+bb3.i: ; preds = %mulflt.exit
+ br i1 false, label %mulflt.exit.addflt.exit_crit_edge, label %bb5.i
+
+bb5.i: ; preds = %bb3.i
+ br i1 false, label %bb5.i.bb9.i_crit_edge, label %bb6.i
+
+bb5.i.bb9.i_crit_edge: ; preds = %bb5.i
+ br label %bb9.i
+
+bb6.i: ; preds = %bb5.i
+ br i1 false, label %bb6.i.addflt.exit_crit_edge, label %bb8.i
+
+bb6.i.addflt.exit_crit_edge: ; preds = %bb6.i
+ br label %addflt.exit
+
+bb8.i: ; preds = %bb6.i
+ br label %bb9.i
+
+bb9.i: ; preds = %bb8.i, %bb5.i.bb9.i_crit_edge
+ br label %addflt.exit
+
+addflt.exit: ; preds = %bb9.i, %bb6.i.addflt.exit_crit_edge, %mulflt.exit.addflt.exit_crit_edge
+ br label %bb15
+
+bb18.loopexit: ; preds = %bb12.bb18.loopexit_crit_edge, %bb15.bb18.loopexit_crit_edge
+ ret i32 0
+}
diff --git a/test/Transforms/CodeGenPrepare/dg.exp b/test/Transforms/CodeGenPrepare/dg.exp
new file mode 100644
index 000000000000..de42dad163fd
--- /dev/null
+++ b/test/Transforms/CodeGenPrepare/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]]
diff --git a/test/Transforms/CondProp/2006-08-14-SingleEntryPhiCrash.ll b/test/Transforms/CondProp/2006-08-14-SingleEntryPhiCrash.ll
new file mode 100644
index 000000000000..fa083799b9f2
--- /dev/null
+++ b/test/Transforms/CondProp/2006-08-14-SingleEntryPhiCrash.ll
@@ -0,0 +1,462 @@
+; RUN: llvm-as < %s | opt -condprop -disable-output
+; PR877
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin9.0.0d1"
+ %"struct.kc::impl_Ccode_option" = type { %"struct.kc::impl_abstract_phylum" }
+ %"struct.kc::impl_ID" = type { %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_casestring__Str"*, i32, %"struct.kc::impl_casestring__Str"* }
+ %"struct.kc::impl_abstract_phylum" = type { i32 (...)** }
+ %"struct.kc::impl_casestring__Str" = type { %"struct.kc::impl_abstract_phylum", i8* }
+ %"struct.kc::impl_elem_patternrepresentation" = type { %"struct.kc::impl_abstract_phylum", i32, %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_ID"* }
+ %"struct.kc::impl_outmostpatterns" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_elem_patternrepresentation"*, %"struct.kc::impl_outmostpatterns"* }
+ %"struct.kc::impl_patternrepresentations" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_outmostpatterns"*, %"struct.kc::impl_patternrepresentations"* }
+
+define void @_ZN2kc16compare_patternsEPNS_26impl_patternrepresentationES1_PNS_27impl_patternrepresentationsE() {
+entry:
+ br label %bb1269.outer.outer.outer.outer
+
+cond_true: ; preds = %cond_true1298
+ br label %bb1269.outer69
+
+cond_false: ; preds = %cond_true1298
+ br i1 false, label %cond_next, label %bb51
+
+cond_next: ; preds = %cond_false
+ br i1 false, label %bb52, label %bb51
+
+bb51: ; preds = %cond_next, %cond_false
+ br label %bb52
+
+bb52: ; preds = %bb51, %cond_next
+ br i1 false, label %cond_false82, label %cond_true55
+
+cond_true55: ; preds = %bb52
+ br i1 false, label %UnifiedReturnBlock, label %cond_true57
+
+cond_true57: ; preds = %cond_true55
+ br label %UnifiedReturnBlock
+
+cond_false82: ; preds = %bb52
+ br i1 false, label %cond_next97, label %bb113
+
+cond_next97: ; preds = %cond_false82
+ br i1 false, label %bb114, label %bb113
+
+bb113: ; preds = %cond_next97, %cond_false82
+ br label %bb114
+
+bb114: ; preds = %bb113, %cond_next97
+ br i1 false, label %cond_false151, label %cond_true117
+
+cond_true117: ; preds = %bb114
+ br i1 false, label %UnifiedReturnBlock, label %cond_true120
+
+cond_true120: ; preds = %cond_true117
+ br label %UnifiedReturnBlock
+
+cond_false151: ; preds = %bb114
+ br i1 false, label %cond_next166, label %bb182
+
+cond_next166: ; preds = %cond_false151
+ br i1 false, label %bb183, label %bb182
+
+bb182: ; preds = %cond_next166, %cond_false151
+ br label %bb183
+
+bb183: ; preds = %bb182, %cond_next166
+ br i1 false, label %cond_false256, label %cond_true186
+
+cond_true186: ; preds = %bb183
+ br i1 false, label %cond_true207, label %cond_false214
+
+cond_true207: ; preds = %cond_true186
+ br label %bb1269.outer38.backedge
+
+bb1269.outer38.backedge: ; preds = %cond_true545, %cond_true432, %cond_true320, %cond_true207
+ br label %bb1269.outer38
+
+cond_false214: ; preds = %cond_true186
+ br i1 false, label %cond_true228, label %cond_false235
+
+cond_true228: ; preds = %cond_false214
+ br label %bb1269.outer21.backedge
+
+bb1269.outer21.backedge: ; preds = %cond_true566, %cond_true453, %cond_true341, %cond_true228
+ br label %bb1269.outer21
+
+cond_false235: ; preds = %cond_false214
+ br i1 false, label %UnifiedReturnBlock, label %cond_false250
+
+cond_false250: ; preds = %cond_false235
+ br label %UnifiedUnreachableBlock
+
+cond_false256: ; preds = %bb183
+ br i1 false, label %cond_next271, label %bb287
+
+cond_next271: ; preds = %cond_false256
+ br i1 false, label %bb288, label %bb287
+
+bb287: ; preds = %cond_next271, %cond_false256
+ br label %bb288
+
+bb288: ; preds = %bb287, %cond_next271
+ br i1 false, label %cond_false369, label %cond_true291
+
+cond_true291: ; preds = %bb288
+ br i1 false, label %cond_true320, label %cond_false327
+
+cond_true320: ; preds = %cond_true291
+ br label %bb1269.outer38.backedge
+
+cond_false327: ; preds = %cond_true291
+ br i1 false, label %cond_true341, label %cond_false348
+
+cond_true341: ; preds = %cond_false327
+ br label %bb1269.outer21.backedge
+
+cond_false348: ; preds = %cond_false327
+ br i1 false, label %UnifiedReturnBlock, label %cond_false363
+
+cond_false363: ; preds = %cond_false348
+ br label %UnifiedUnreachableBlock
+
+cond_false369: ; preds = %bb288
+ br i1 false, label %cond_next384, label %bb400
+
+cond_next384: ; preds = %cond_false369
+ br i1 false, label %bb401, label %bb400
+
+bb400: ; preds = %cond_next384, %cond_false369
+ br label %bb401
+
+bb401: ; preds = %bb400, %cond_next384
+ br i1 false, label %cond_false481, label %cond_true404
+
+cond_true404: ; preds = %bb401
+ br i1 false, label %cond_true432, label %cond_false439
+
+cond_true432: ; preds = %cond_true404
+ br label %bb1269.outer38.backedge
+
+cond_false439: ; preds = %cond_true404
+ br i1 false, label %cond_true453, label %cond_false460
+
+cond_true453: ; preds = %cond_false439
+ br label %bb1269.outer21.backedge
+
+cond_false460: ; preds = %cond_false439
+ br i1 false, label %UnifiedReturnBlock, label %cond_false475
+
+cond_false475: ; preds = %cond_false460
+ br label %UnifiedUnreachableBlock
+
+cond_false481: ; preds = %bb401
+ br i1 false, label %cond_next496, label %bb512
+
+cond_next496: ; preds = %cond_false481
+ br i1 false, label %bb513, label %bb512
+
+bb512: ; preds = %cond_next496, %cond_false481
+ br label %bb513
+
+bb513: ; preds = %bb512, %cond_next496
+ br i1 false, label %cond_false594, label %cond_true516
+
+cond_true516: ; preds = %bb513
+ br i1 false, label %cond_true545, label %cond_false552
+
+cond_true545: ; preds = %cond_true516
+ br label %bb1269.outer38.backedge
+
+cond_false552: ; preds = %cond_true516
+ br i1 false, label %cond_true566, label %cond_false573
+
+cond_true566: ; preds = %cond_false552
+ br label %bb1269.outer21.backedge
+
+cond_false573: ; preds = %cond_false552
+ br i1 false, label %UnifiedReturnBlock, label %cond_false588
+
+cond_false588: ; preds = %cond_false573
+ br label %UnifiedUnreachableBlock
+
+cond_false594: ; preds = %bb513
+ br i1 false, label %cond_next609, label %bb625
+
+cond_next609: ; preds = %cond_false594
+ br i1 false, label %bb626, label %bb625
+
+bb625: ; preds = %cond_next609, %cond_false594
+ br label %bb626
+
+bb626: ; preds = %bb625, %cond_next609
+ br i1 false, label %cond_false707, label %cond_true629
+
+cond_true629: ; preds = %bb626
+ br i1 false, label %cond_true658, label %cond_false665
+
+cond_true658: ; preds = %cond_true629
+ br label %bb1269.outer2.backedge
+
+bb1269.outer2.backedge: ; preds = %cond_true679, %cond_true658
+ br label %bb1269.outer2
+
+cond_false665: ; preds = %cond_true629
+ br i1 false, label %cond_true679, label %cond_false686
+
+cond_true679: ; preds = %cond_false665
+ br label %bb1269.outer2.backedge
+
+cond_false686: ; preds = %cond_false665
+ br i1 false, label %UnifiedReturnBlock, label %cond_false701
+
+cond_false701: ; preds = %cond_false686
+ br label %UnifiedUnreachableBlock
+
+cond_false707: ; preds = %bb626
+ br i1 false, label %cond_next722, label %bb738
+
+cond_next722: ; preds = %cond_false707
+ br i1 false, label %bb739, label %bb738
+
+bb738: ; preds = %cond_next722, %cond_false707
+ br label %bb739
+
+bb739: ; preds = %bb738, %cond_next722
+ br i1 false, label %cond_false820, label %cond_true742
+
+cond_true742: ; preds = %bb739
+ br i1 false, label %cond_true771, label %cond_false778
+
+cond_true771: ; preds = %cond_true742
+ br label %bb1269.outer.backedge
+
+bb1269.outer.backedge: ; preds = %cond_true792, %cond_true771
+ br label %bb1269.outer
+
+cond_false778: ; preds = %cond_true742
+ br i1 false, label %cond_true792, label %cond_false799
+
+cond_true792: ; preds = %cond_false778
+ br label %bb1269.outer.backedge
+
+cond_false799: ; preds = %cond_false778
+ br i1 false, label %UnifiedReturnBlock, label %cond_false814
+
+cond_false814: ; preds = %cond_false799
+ br label %UnifiedUnreachableBlock
+
+cond_false820: ; preds = %bb739
+ br i1 false, label %cond_next835, label %bb851
+
+cond_next835: ; preds = %cond_false820
+ br i1 false, label %bb852, label %bb851
+
+bb851: ; preds = %cond_next835, %cond_false820
+ br label %bb852
+
+bb852: ; preds = %bb851, %cond_next835
+ br i1 false, label %cond_false933, label %cond_true855
+
+cond_true855: ; preds = %bb852
+ br i1 false, label %cond_true884, label %cond_false891
+
+cond_true884: ; preds = %cond_true855
+ br label %bb1269.outer.outer.backedge
+
+bb1269.outer.outer.backedge: ; preds = %cond_true905, %cond_true884
+ br label %bb1269.outer.outer
+
+cond_false891: ; preds = %cond_true855
+ br i1 false, label %cond_true905, label %cond_false912
+
+cond_true905: ; preds = %cond_false891
+ br label %bb1269.outer.outer.backedge
+
+cond_false912: ; preds = %cond_false891
+ br i1 false, label %UnifiedReturnBlock, label %cond_false927
+
+cond_false927: ; preds = %cond_false912
+ br label %UnifiedUnreachableBlock
+
+cond_false933: ; preds = %bb852
+ br i1 false, label %cond_next948, label %bb964
+
+cond_next948: ; preds = %cond_false933
+ br i1 false, label %bb965, label %bb964
+
+bb964: ; preds = %cond_next948, %cond_false933
+ br label %bb965
+
+bb965: ; preds = %bb964, %cond_next948
+ br i1 false, label %cond_false1046, label %cond_true968
+
+cond_true968: ; preds = %bb965
+ br i1 false, label %cond_true997, label %cond_false1004
+
+cond_true997: ; preds = %cond_true968
+ br label %bb1269.outer.outer.outer.backedge
+
+bb1269.outer.outer.outer.backedge: ; preds = %cond_true1018, %cond_true997
+ br label %bb1269.outer.outer.outer
+
+cond_false1004: ; preds = %cond_true968
+ br i1 false, label %cond_true1018, label %cond_false1025
+
+cond_true1018: ; preds = %cond_false1004
+ br label %bb1269.outer.outer.outer.backedge
+
+cond_false1025: ; preds = %cond_false1004
+ br i1 false, label %UnifiedReturnBlock, label %cond_false1040
+
+cond_false1040: ; preds = %cond_false1025
+ br label %UnifiedUnreachableBlock
+
+cond_false1046: ; preds = %bb965
+ br i1 false, label %cond_next1061, label %bb1077
+
+cond_next1061: ; preds = %cond_false1046
+ br i1 false, label %bb1078, label %bb1077
+
+bb1077: ; preds = %cond_next1061, %cond_false1046
+ br label %bb1078
+
+bb1078: ; preds = %bb1077, %cond_next1061
+ %tmp1080 = phi i1 [ true, %bb1077 ], [ false, %cond_next1061 ] ; <i1> [#uses=1]
+ br i1 %tmp1080, label %cond_false1159, label %cond_true1081
+
+cond_true1081: ; preds = %bb1078
+ br i1 false, label %cond_true1110, label %cond_false1117
+
+cond_true1110: ; preds = %cond_true1081
+ br label %bb1269.outer.outer.outer.outer.backedge
+
+bb1269.outer.outer.outer.outer.backedge: ; preds = %cond_true1131, %cond_true1110
+ br label %bb1269.outer.outer.outer.outer
+
+cond_false1117: ; preds = %cond_true1081
+ br i1 false, label %cond_true1131, label %cond_false1138
+
+cond_true1131: ; preds = %cond_false1117
+ br label %bb1269.outer.outer.outer.outer.backedge
+
+cond_false1138: ; preds = %cond_false1117
+ br i1 false, label %UnifiedReturnBlock, label %cond_false1153
+
+cond_false1153: ; preds = %cond_false1138
+ br label %UnifiedUnreachableBlock
+
+cond_false1159: ; preds = %bb1078
+ %tmp.i119.lcssa35.lcssa.lcssa.lcssa.lcssa.lcssa = phi %"struct.kc::impl_elem_patternrepresentation"* [ null, %bb1078 ] ; <%"struct.kc::impl_elem_patternrepresentation"*> [#uses=0]
+ br i1 false, label %UnifiedReturnBlock, label %cond_false1174
+
+cond_false1174: ; preds = %cond_false1159
+ br i1 false, label %UnifiedReturnBlock, label %cond_false1189
+
+cond_false1189: ; preds = %cond_false1174
+ br i1 false, label %UnifiedReturnBlock, label %cond_false1204
+
+cond_false1204: ; preds = %cond_false1189
+ br i1 false, label %UnifiedReturnBlock, label %cond_false1219
+
+cond_false1219: ; preds = %cond_false1204
+ br i1 false, label %UnifiedReturnBlock, label %cond_true1222
+
+cond_true1222: ; preds = %cond_false1219
+ br label %UnifiedReturnBlock
+
+bb1269.outer.outer.outer.outer: ; preds = %bb1269.outer.outer.outer.outer.backedge, %entry
+ br label %bb1269.outer.outer.outer
+
+bb1269.outer.outer.outer: ; preds = %bb1269.outer.outer.outer.outer, %bb1269.outer.outer.outer.backedge
+ br label %bb1269.outer.outer
+
+bb1269.outer.outer: ; preds = %bb1269.outer.outer.outer, %bb1269.outer.outer.backedge
+ br label %bb1269.outer
+
+bb1269.outer: ; preds = %bb1269.outer.outer, %bb1269.outer.backedge
+ br label %bb1269.outer2
+
+bb1269.outer2: ; preds = %bb1269.outer, %bb1269.outer2.backedge
+ br label %bb1269.outer21
+
+bb1269.outer21: ; preds = %bb1269.outer2, %bb1269.outer21.backedge
+ br label %bb1269.outer38
+
+bb1269.outer38: ; preds = %bb1269.outer21, %bb1269.outer38.backedge
+ br label %bb1269.outer54
+
+bb1269.outer54: ; preds = %bb1269.outer38
+ br label %bb1269.outer69
+
+bb1269.outer69: ; preds = %bb1269.outer54, %cond_true
+ br label %bb1269
+
+bb1269: ; preds = %bb1269.outer69
+ br i1 false, label %cond_next1281, label %bb1294
+
+cond_next1281: ; preds = %bb1269
+ br i1 false, label %cond_true1298, label %bb1294
+
+bb1294: ; preds = %cond_next1281, %bb1269
+ br i1 false, label %cond_true1331, label %cond_next1313
+
+cond_true1298: ; preds = %cond_next1281
+ br i1 false, label %cond_false, label %cond_true
+
+cond_next1313: ; preds = %bb1294
+ br i1 false, label %cond_true1331, label %cond_next1355
+
+cond_true1331: ; preds = %cond_next1313, %bb1294
+ br i1 false, label %cond_false1346, label %cond_true1342
+
+cond_true1342: ; preds = %cond_true1331
+ br label %cond_next1350
+
+cond_false1346: ; preds = %cond_true1331
+ br label %cond_next1350
+
+cond_next1350: ; preds = %cond_false1346, %cond_true1342
+ br label %bb.i
+
+bb.i: ; preds = %bb.i, %cond_next1350
+ br i1 false, label %_ZN2kc18impl_abstract_list8freelistEv.exit, label %bb.i
+
+_ZN2kc18impl_abstract_list8freelistEv.exit: ; preds = %bb.i
+ br label %cond_next1355
+
+cond_next1355: ; preds = %_ZN2kc18impl_abstract_list8freelistEv.exit, %cond_next1313
+ br i1 false, label %cond_next1363, label %bb1388
+
+cond_next1363: ; preds = %cond_next1355
+ br i1 false, label %UnifiedReturnBlock, label %cond_true1366
+
+cond_true1366: ; preds = %cond_next1363
+ br label %UnifiedReturnBlock
+
+bb1388: ; preds = %cond_next1355
+ br i1 false, label %UnifiedReturnBlock, label %bb1414.preheader
+
+bb1414.preheader: ; preds = %bb1388
+ br label %bb1414
+
+bb1414: ; preds = %cond_true1426, %bb1414.preheader
+ br i1 false, label %cond_true1426, label %bb1429
+
+cond_true1426: ; preds = %bb1414
+ br label %bb1414
+
+bb1429: ; preds = %bb1414
+ br i1 false, label %cond_true1431, label %UnifiedReturnBlock
+
+cond_true1431: ; preds = %bb1429
+ br i1 false, label %UnifiedReturnBlock, label %cond_true1434
+
+cond_true1434: ; preds = %cond_true1431
+ br label %UnifiedReturnBlock
+
+UnifiedUnreachableBlock: ; preds = %cond_false1153, %cond_false1040, %cond_false927, %cond_false814, %cond_false701, %cond_false588, %cond_false475, %cond_false363, %cond_false250
+ unreachable
+
+UnifiedReturnBlock: ; preds = %cond_true1434, %cond_true1431, %bb1429, %bb1388, %cond_true1366, %cond_next1363, %cond_true1222, %cond_false1219, %cond_false1204, %cond_false1189, %cond_false1174, %cond_false1159, %cond_false1138, %cond_false1025, %cond_false912, %cond_false799, %cond_false686, %cond_false573, %cond_false460, %cond_false348, %cond_false235, %cond_true120, %cond_true117, %cond_true57, %cond_true55
+ ret void
+}
diff --git a/test/Transforms/CondProp/2006-11-01-PhiNodeCrash.ll b/test/Transforms/CondProp/2006-11-01-PhiNodeCrash.ll
new file mode 100644
index 000000000000..573ee6cadd39
--- /dev/null
+++ b/test/Transforms/CondProp/2006-11-01-PhiNodeCrash.ll
@@ -0,0 +1,1084 @@
+; RUN: llvm-as < %s | opt -condprop -disable-output
+; PR979
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+deplibs = [ "c", "crtend" ]
+ %struct.IO_APIC_reg_00 = type { i32 }
+ %struct.Qdisc = type { i32 (%struct.sk_buff*, %struct.Qdisc*)*, %struct.sk_buff* (%struct.Qdisc*)*, i32, %struct.Qdisc_ops*, %struct.Qdisc*, i32, %struct.IO_APIC_reg_00, %struct.sk_buff_head, %struct.net_device*, %struct.tc_stats, i32 (%struct.sk_buff*, %struct.Qdisc*)*, %struct.Qdisc*, [1 x i8] }
+ %struct.Qdisc_class_ops = type { i32 (%struct.Qdisc*, i32, %struct.Qdisc*, %struct.Qdisc**)*, %struct.Qdisc* (%struct.Qdisc*, i32)*, i32 (%struct.Qdisc*, i32)*, void (%struct.Qdisc*, i32)*, i32 (%struct.Qdisc*, i32, i32, %struct._agp_version**, i32*)*, i32 (%struct.Qdisc*, i32)*, void (%struct.Qdisc*, %struct.qdisc_walker*)*, %struct.tcf_proto** (%struct.Qdisc*, i32)*, i32 (%struct.Qdisc*, i32, i32)*, void (%struct.Qdisc*, i32)*, i32 (%struct.Qdisc*, i32, %struct.sk_buff*, %struct.tcmsg*)* }
+ %struct.Qdisc_ops = type { %struct.Qdisc_ops*, %struct.Qdisc_class_ops*, [16 x i8], i32, i32 (%struct.sk_buff*, %struct.Qdisc*)*, %struct.sk_buff* (%struct.Qdisc*)*, i32 (%struct.sk_buff*, %struct.Qdisc*)*, i32 (%struct.Qdisc*)*, i32 (%struct.Qdisc*, %struct._agp_version*)*, void (%struct.Qdisc*)*, void (%struct.Qdisc*)*, i32 (%struct.Qdisc*, %struct._agp_version*)*, i32 (%struct.Qdisc*, %struct.sk_buff*)* }
+ %struct.ViceFid = type { i32, i32, i32 }
+ %struct.__wait_queue = type { i32, %struct.task_struct*, %struct.list_head }
+ %struct.__wait_queue_head = type { %struct.IO_APIC_reg_00, %struct.list_head }
+ %struct._agp_version = type { i16, i16 }
+ %struct._drm_i810_overlay_t = type { i32, i32 }
+ %struct.address_space = type { %struct.list_head, %struct.list_head, %struct.list_head, i32, %struct.address_space_operations*, %struct.inode*, %struct.vm_area_struct*, %struct.vm_area_struct*, %struct.IO_APIC_reg_00, i32 }
+ %struct.address_space_operations = type { i32 (%struct.page*)*, i32 (%struct.file*, %struct.page*)*, i32 (%struct.page*)*, i32 (%struct.file*, %struct.page*, i32, i32)*, i32 (%struct.file*, %struct.page*, i32, i32)*, i32 (%struct.address_space*, i32)*, i32 (%struct.page*, i32)*, i32 (%struct.page*, i32)*, i32 (i32, %struct.inode*, %struct.kiobuf*, i32, i32)*, i32 (i32, %struct.file*, %struct.kiobuf*, i32, i32)*, void (%struct.page*)* }
+ %struct.audio_buf_info = type { i32, i32, i32, i32 }
+ %struct.autofs_packet_hdr = type { i32, i32 }
+ %struct.block_device = type { %struct.list_head, %struct.IO_APIC_reg_00, %struct.inode*, i16, i32, %struct.block_device_operations*, %struct.semaphore, %struct.list_head }
+ %struct.block_device_operations = type { i32 (%struct.inode*, %struct.file*)*, i32 (%struct.inode*, %struct.file*)*, i32 (%struct.inode*, %struct.file*, i32, i32)*, i32 (i16)*, i32 (i16)*, %struct.module* }
+ %struct.bluez_skb_cb = type { i32 }
+ %struct.buffer_head = type { %struct.buffer_head*, i32, i16, i16, i16, %struct.IO_APIC_reg_00, i16, i32, i32, %struct.buffer_head*, %struct.buffer_head*, %struct.buffer_head*, %struct.buffer_head*, %struct.buffer_head**, i8*, %struct.page*, void (%struct.buffer_head*, i32)*, i8*, i32, %struct.__wait_queue_head, %struct.list_head }
+ %struct.char_device = type { %struct.list_head, %struct.IO_APIC_reg_00, i16, %struct.IO_APIC_reg_00, %struct.semaphore }
+ %struct.completion = type { i32, %struct.__wait_queue_head }
+ %struct.cramfs_info = type { i32, i32, i32, i32 }
+ %struct.dentry = type { %struct.IO_APIC_reg_00, i32, %struct.inode*, %struct.dentry*, %struct.list_head, %struct.list_head, %struct.list_head, %struct.list_head, %struct.list_head, i32, %struct.qstr, i32, %struct.dentry_operations*, %struct.super_block*, i32, i8*, [16 x i8] }
+ %struct.dentry_operations = type { i32 (%struct.dentry*, i32)*, i32 (%struct.dentry*, %struct.qstr*)*, i32 (%struct.dentry*, %struct.qstr*, %struct.qstr*)*, i32 (%struct.dentry*)*, void (%struct.dentry*)*, void (%struct.dentry*, %struct.inode*)* }
+ %struct.dev_mc_list = type { %struct.dev_mc_list*, [8 x i8], i8, i32, i32 }
+ %struct.dnotify_struct = type { %struct.dnotify_struct*, i32, i32, %struct.file*, %struct.files_struct* }
+ %struct.dquot = type { %struct.list_head, %struct.list_head, %struct.list_head, %struct.__wait_queue_head, %struct.__wait_queue_head, i32, i32, %struct.super_block*, i32, i16, i64, i16, i16, i32, %struct.mem_dqblk }
+ %struct.dquot_operations = type { void (%struct.inode*, i32)*, void (%struct.inode*)*, i32 (%struct.inode*, i64, i32)*, i32 (%struct.inode*, i32)*, void (%struct.inode*, i64)*, void (%struct.inode*, i32)*, i32 (%struct.inode*, %struct.iattr*)*, i32 (%struct.dquot*)* }
+ %struct.drm_clip_rect = type { i16, i16, i16, i16 }
+ %struct.drm_ctx_priv_map = type { i32, i8* }
+ %struct.drm_mga_indices = type { i32, i32, i32, i32 }
+ %struct.dst_entry = type { %struct.dst_entry*, %struct.IO_APIC_reg_00, i32, %struct.net_device*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.neighbour*, %struct.hh_cache*, i32 (%struct.sk_buff*)*, i32 (%struct.sk_buff*)*, %struct.dst_ops*, [0 x i8] }
+ %struct.dst_ops = type { i16, i16, i32, i32 ()*, %struct.dst_entry* (%struct.dst_entry*, i32)*, %struct.dst_entry* (%struct.dst_entry*, %struct.sk_buff*)*, void (%struct.dst_entry*)*, %struct.dst_entry* (%struct.dst_entry*)*, void (%struct.sk_buff*)*, i32, %struct.IO_APIC_reg_00, %struct.kmem_cache_s* }
+ %struct.e820entry = type { i64, i64, i32 }
+ %struct.exec_domain = type { i8*, void (i32, %struct.pt_regs*)*, i8, i8, i32*, i32*, %struct.map_segment*, %struct.map_segment*, %struct.map_segment*, %struct.map_segment*, %struct.module*, %struct.exec_domain* }
+ %struct.ext2_inode_info = type { [15 x i32], i32, i32, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.ext3_inode_info = type { [15 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.list_head, i64, %struct.rw_semaphore }
+ %struct.fasync_struct = type { i32, i32, %struct.fasync_struct*, %struct.file* }
+ %struct.file = type { %struct.list_head, %struct.dentry*, %struct.vfsmount*, %struct.file_operations*, %struct.IO_APIC_reg_00, i32, i16, i64, i32, i32, i32, i32, i32, %struct.audio_buf_info, i32, i32, i32, i32, i8*, %struct.kiobuf*, i32 }
+ %struct.file_lock = type { %struct.file_lock*, %struct.list_head, %struct.list_head, %struct.files_struct*, i32, %struct.__wait_queue_head, %struct.file*, i8, i8, i64, i64, void (%struct.file_lock*)*, void (%struct.file_lock*)*, void (%struct.file_lock*)*, %struct.fasync_struct*, i32, { %struct.nfs_lock_info } }
+ %struct.file_operations = type { %struct.module*, i64 (%struct.file*, i64, i32)*, i32 (%struct.file*, i8*, i32, i64*)*, i32 (%struct.file*, i8*, i32, i64*)*, i32 (%struct.file*, i8*, i32 (i8*, i8*, i32, i64, i32, i32)*)*, i32 (%struct.file*, %struct.poll_table_struct*)*, i32 (%struct.inode*, %struct.file*, i32, i32)*, i32 (%struct.file*, %struct.vm_area_struct*)*, i32 (%struct.inode*, %struct.file*)*, i32 (%struct.file*)*, i32 (%struct.inode*, %struct.file*)*, i32 (%struct.file*, %struct.dentry*, i32)*, i32 (i32, %struct.file*, i32)*, i32 (%struct.file*, i32, %struct.file_lock*)*, i32 (%struct.file*, %struct.iovec*, i32, i64*)*, i32 (%struct.file*, %struct.iovec*, i32, i64*)*, i32 (%struct.file*, %struct.page*, i32, i32, i64*, i32)*, i32 (%struct.file*, i32, i32, i32, i32)* }
+ %struct.file_system_type = type { i8*, i32, %struct.super_block* (%struct.super_block*, i8*, i32)*, %struct.module*, %struct.file_system_type*, %struct.list_head }
+ %struct.files_struct = type { %struct.IO_APIC_reg_00, %typedef.rwlock_t, i32, i32, i32, %struct.file**, %typedef.__kernel_fd_set*, %typedef.__kernel_fd_set*, %typedef.__kernel_fd_set, %typedef.__kernel_fd_set, [32 x %struct.file*] }
+ %struct.fs_disk_quota = type { i8, i8, i16, i32, i64, i64, i64, i64, i64, i64, i32, i32, i16, i16, i32, i64, i64, i64, i32, i16, i16, [8 x i8] }
+ %struct.fs_quota_stat = type { i8, i16, i8, %struct.e820entry, %struct.e820entry, i32, i32, i32, i32, i16, i16 }
+ %struct.fs_struct = type { %struct.IO_APIC_reg_00, %typedef.rwlock_t, i32, %struct.dentry*, %struct.dentry*, %struct.dentry*, %struct.vfsmount*, %struct.vfsmount*, %struct.vfsmount* }
+ %struct.hh_cache = type { %struct.hh_cache*, %struct.IO_APIC_reg_00, i16, i32, i32 (%struct.sk_buff*)*, %typedef.rwlock_t, [32 x i32] }
+ %struct.i387_fxsave_struct = type { i16, i16, i16, i16, i32, i32, i32, i32, i32, i32, [32 x i32], [32 x i32], [56 x i32] }
+ %struct.iattr = type { i32, i16, i32, i32, i64, i32, i32, i32, i32 }
+ %struct.if_dqblk = type { i64, i64, i64, i64, i64, i64, i64, i64, i32 }
+ %struct.if_dqinfo = type { i64, i64, i32, i32 }
+ %struct.ifmap = type { i32, i32, i16, i8, i8, i8 }
+ %struct.ifreq = type { { [16 x i8] }, %typedef.dvd_authinfo }
+ %struct.inode = type { %struct.list_head, %struct.list_head, %struct.list_head, %struct.list_head, %struct.list_head, i32, %struct.IO_APIC_reg_00, i16, i16, i16, i32, i32, i16, i64, i32, i32, i32, i32, i32, i32, i32, i16, %struct.semaphore, %struct.rw_semaphore, %struct.semaphore, %struct.inode_operations*, %struct.file_operations*, %struct.super_block*, %struct.__wait_queue_head, %struct.file_lock*, %struct.address_space*, %struct.address_space, [2 x %struct.dquot*], %struct.list_head, %struct.pipe_inode_info*, %struct.block_device*, %struct.char_device*, i32, %struct.dnotify_struct*, i32, i32, i8, %struct.IO_APIC_reg_00, i32, i32, { %struct.ext2_inode_info, %struct.ext3_inode_info, %struct.msdos_inode_info, %struct.iso_inode_info, %struct.nfs_inode_info, %struct._drm_i810_overlay_t, %struct.shmem_inode_info, %struct.proc_inode_info, %struct.socket, %struct.usbdev_inode_info, i8* } }
+ %struct.inode_operations = type { i32 (%struct.inode*, %struct.dentry*, i32)*, %struct.dentry* (%struct.inode*, %struct.dentry*)*, i32 (%struct.dentry*, %struct.inode*, %struct.dentry*)*, i32 (%struct.inode*, %struct.dentry*)*, i32 (%struct.inode*, %struct.dentry*, i8*)*, i32 (%struct.inode*, %struct.dentry*, i32)*, i32 (%struct.inode*, %struct.dentry*)*, i32 (%struct.inode*, %struct.dentry*, i32, i32)*, i32 (%struct.inode*, %struct.dentry*, %struct.inode*, %struct.dentry*)*, i32 (%struct.dentry*, i8*, i32)*, i32 (%struct.dentry*, %struct.nameidata*)*, void (%struct.inode*)*, i32 (%struct.inode*, i32)*, i32 (%struct.dentry*)*, i32 (%struct.dentry*, %struct.iattr*)*, i32 (%struct.dentry*, %struct.iattr*)*, i32 (%struct.dentry*, i8*, i8*, i32, i32)*, i32 (%struct.dentry*, i8*, i8*, i32)*, i32 (%struct.dentry*, i8*, i32)*, i32 (%struct.dentry*, i8*)* }
+ %struct.iovec = type { i8*, i32 }
+ %struct.ip_options = type { i32, i8, i8, i8, i8, i8, i8, i8, i8, [0 x i8] }
+ %struct.isapnp_dma = type { i8, i8, %struct.isapnp_resources*, %struct.isapnp_dma* }
+ %struct.isapnp_irq = type { i16, i8, i8, %struct.isapnp_resources*, %struct.isapnp_irq* }
+ %struct.isapnp_mem = type { i32, i32, i32, i32, i8, i8, %struct.isapnp_resources*, %struct.isapnp_mem* }
+ %struct.isapnp_mem32 = type { [17 x i8], %struct.isapnp_resources*, %struct.isapnp_mem32* }
+ %struct.isapnp_port = type { i16, i16, i8, i8, i8, i8, %struct.isapnp_resources*, %struct.isapnp_port* }
+ %struct.isapnp_resources = type { i16, i16, %struct.isapnp_port*, %struct.isapnp_irq*, %struct.isapnp_dma*, %struct.isapnp_mem*, %struct.isapnp_mem32*, %struct.pci_dev*, %struct.isapnp_resources*, %struct.isapnp_resources* }
+ %struct.iso_inode_info = type { i32, i8, [3 x i8], i32, i32 }
+ %struct.iw_handler_def = type opaque
+ %struct.iw_statistics = type opaque
+ %struct.k_sigaction = type { %struct.sigaction }
+ %struct.kern_ipc_perm = type { i32, i32, i32, i32, i32, i16, i32 }
+ %struct.kiobuf = type { i32, i32, i32, i32, i32, %struct.page**, %struct.buffer_head**, i32*, %struct.IO_APIC_reg_00, i32, void (%struct.kiobuf*)*, %struct.__wait_queue_head }
+ %struct.kmem_cache_s = type { %struct.list_head, %struct.list_head, %struct.list_head, i32, i32, i32, %struct.IO_APIC_reg_00, i32, i32, i32, i32, i32, i32, %struct.kmem_cache_s*, i32, i32, void (i8*, %struct.kmem_cache_s*, i32)*, void (i8*, %struct.kmem_cache_s*, i32)*, i32, [20 x i8], %struct.list_head, [32 x %struct._drm_i810_overlay_t*], i32 }
+ %struct.linux_binfmt = type { %struct.linux_binfmt*, %struct.module*, i32 (%struct.linux_binprm*, %struct.pt_regs*)*, i32 (%struct.file*)*, i32 (i32, %struct.pt_regs*, %struct.file*)*, i32, i32 (%struct.linux_binprm*, i8*)* }
+ %struct.linux_binprm = type { [128 x i8], [32 x %struct.page*], i32, i32, %struct.file*, i32, i32, i32, i32, i32, i32, i32, i8*, i32, i32 }
+ %struct.list_head = type { %struct.list_head*, %struct.list_head* }
+ %struct.llva_sigcontext = type { %typedef.llva_icontext_t, %typedef.llva_fp_state_t, i32, i32, i32, i32, [1 x i32], i8* }
+ %struct.map_segment = type opaque
+ %struct.mem_dqblk = type { i32, i32, i64, i32, i32, i32, i32, i32 }
+ %struct.mem_dqinfo = type { %struct.quota_format_type*, i32, i32, i32, { %struct.ViceFid } }
+ %struct.mm_struct = type { %struct.vm_area_struct*, %struct.rb_root_s, %struct.vm_area_struct*, %struct.IO_APIC_reg_00*, %struct.IO_APIC_reg_00, %struct.IO_APIC_reg_00, i32, %struct.rw_semaphore, %struct.IO_APIC_reg_00, %struct.list_head, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.iovec }
+ %struct.module = type { i32, %struct.module*, i8*, i32, %struct.IO_APIC_reg_00, i32, i32, i32, %struct.drm_ctx_priv_map*, %struct.module_ref*, %struct.module_ref*, i32 ()*, void ()*, %struct._drm_i810_overlay_t*, %struct._drm_i810_overlay_t*, %struct.module_persist*, %struct.module_persist*, i32 ()*, i32, i8*, i8*, i8*, i8*, i8* }
+ %struct.module_persist = type opaque
+ %struct.module_ref = type { %struct.module*, %struct.module*, %struct.module_ref* }
+ %struct.msdos_inode_info = type { i32, i32, i32, i32, i32, i32, %struct.inode*, %struct.list_head }
+ %struct.msghdr = type { i8*, i32, %struct.iovec*, i32, i8*, i32, i32 }
+ %struct.msq_setbuf = type { i32, i32, i32, i16 }
+ %struct.nameidata = type { %struct.dentry*, %struct.vfsmount*, %struct.qstr, i32, i32 }
+ %struct.namespace = type { %struct.IO_APIC_reg_00, %struct.vfsmount*, %struct.list_head, %struct.rw_semaphore }
+ %struct.neigh_ops = type { i32, void (%struct.neighbour*)*, void (%struct.neighbour*, %struct.sk_buff*)*, void (%struct.neighbour*, %struct.sk_buff*)*, i32 (%struct.sk_buff*)*, i32 (%struct.sk_buff*)*, i32 (%struct.sk_buff*)*, i32 (%struct.sk_buff*)* }
+ %struct.neigh_parms = type { %struct.neigh_parms*, i32 (%struct.neighbour*)*, %struct.neigh_table*, i32, i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.neigh_table = type { %struct.neigh_table*, i32, i32, i32, i32 (i8*, %struct.net_device*)*, i32 (%struct.neighbour*)*, i32 (%struct.pneigh_entry*)*, void (%struct.pneigh_entry*)*, void (%struct.sk_buff*)*, i8*, %struct.neigh_parms, i32, i32, i32, i32, i32, %struct.timer_list, %struct.timer_list, %struct.sk_buff_head, i32, %typedef.rwlock_t, i32, %struct.neigh_parms*, %struct.kmem_cache_s*, %struct.tasklet_struct, %struct.audio_buf_info, [32 x %struct.neighbour*], [16 x %struct.pneigh_entry*] }
+ %struct.neighbour = type { %struct.neighbour*, %struct.neigh_table*, %struct.neigh_parms*, %struct.net_device*, i32, i32, i32, i8, i8, i8, i8, %struct.IO_APIC_reg_00, %typedef.rwlock_t, [8 x i8], %struct.hh_cache*, %struct.IO_APIC_reg_00, i32 (%struct.sk_buff*)*, %struct.sk_buff_head, %struct.timer_list, %struct.neigh_ops*, [0 x i8] }
+ %struct.net_bridge_port = type opaque
+ %struct.net_device = type { [16 x i8], i32, i32, i32, i32, i32, i32, i8, i8, i32, %struct.net_device*, i32 (%struct.net_device*)*, %struct.net_device*, i32, i32, %struct.net_device_stats* (%struct.net_device*)*, %struct.iw_statistics* (%struct.net_device*)*, %struct.iw_handler_def*, i32, i32, i16, i16, i16, i16, i32, i16, i16, i8*, %struct.net_device*, [8 x i8], [8 x i8], i8, %struct.dev_mc_list*, i32, i32, i32, i32, %struct.timer_list, i8*, i8*, i8*, i8*, i8*, %struct.list_head, i32, i32, %struct.Qdisc*, %struct.Qdisc*, %struct.Qdisc*, %struct.Qdisc*, i32, %struct.IO_APIC_reg_00, i32, %struct.IO_APIC_reg_00, %struct.IO_APIC_reg_00, i32, i32, void (%struct.net_device*)*, void (%struct.net_device*)*, i32 (%struct.net_device*)*, i32 (%struct.net_device*)*, i32 (%struct.sk_buff*, %struct.net_device*)*, i32 (%struct.net_device*, i32*)*, i32 (%struct.sk_buff*, %struct.net_device*, i16, i8*, i8*, i32)*, i32 (%struct.sk_buff*)*, void (%struct.net_device*)*, i32 (%struct.net_device*, i8*)*, i32 (%struct.net_device*, %struct.ifreq*, i32)*, i32 (%struct.net_device*, %struct.ifmap*)*, i32 (%struct.neighbour*, %struct.hh_cache*)*, void (%struct.hh_cache*, %struct.net_device*, i8*)*, i32 (%struct.net_device*, i32)*, void (%struct.net_device*)*, void (%struct.net_device*, %struct.vlan_group*)*, void (%struct.net_device*, i16)*, void (%struct.net_device*, i16)*, i32 (%struct.sk_buff*, i8*)*, i32 (%struct.net_device*, %struct.neigh_parms*)*, i32 (%struct.net_device*, %struct.dst_entry*)*, %struct.module*, %struct.net_bridge_port* }
+ %struct.net_device_stats = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.nf_conntrack = type { %struct.IO_APIC_reg_00, void (%struct.nf_conntrack*)* }
+ %struct.nf_ct_info = type { %struct.nf_conntrack* }
+ %struct.nfs_fh = type { i16, [64 x i8] }
+ %struct.nfs_inode_info = type { i64, %struct.nfs_fh, i16, i32, i64, i64, i64, i32, i32, i32, [2 x i32], %struct.list_head, %struct.list_head, %struct.list_head, %struct.list_head, i32, i32, i32, i32, %struct.rpc_cred* }
+ %struct.nfs_lock_info = type { i32, i32, %struct.nlm_host* }
+ %struct.nlm_host = type opaque
+ %struct.open_request = type { %struct.open_request*, i32, i32, i16, i16, i8, i8, i16, i32, i32, i32, i32, %struct.or_calltable*, %struct.sock*, { %struct.tcp_v4_open_req } }
+ %struct.or_calltable = type { i32, i32 (%struct.sock*, %struct.open_request*, %struct.dst_entry*)*, void (%struct.sk_buff*, %struct.open_request*)*, void (%struct.open_request*)*, void (%struct.sk_buff*)* }
+ %struct.page = type { %struct.list_head, %struct.address_space*, i32, %struct.page*, %struct.IO_APIC_reg_00, i32, %struct.list_head, %struct.page**, %struct.buffer_head* }
+ %struct.pci_bus = type { %struct.list_head, %struct.pci_bus*, %struct.list_head, %struct.list_head, %struct.pci_dev*, [4 x %struct.resource*], %struct.pci_ops*, i8*, %struct.proc_dir_entry*, i8, i8, i8, i8, [48 x i8], i16, i16, i32, i8, i8, i8, i8 }
+ %struct.pci_dev = type { %struct.list_head, %struct.list_head, %struct.pci_bus*, %struct.pci_bus*, i8*, %struct.proc_dir_entry*, i32, i16, i16, i16, i16, i32, i8, i8, %struct.pci_driver*, i8*, i64, i32, [4 x i16], [4 x i16], i32, [12 x %struct.resource], [2 x %struct.resource], [2 x %struct.resource], [90 x i8], [8 x i8], i32, i32, i16, i16, i32 (%struct.pci_dev*)*, i32 (%struct.pci_dev*)*, i32 (%struct.pci_dev*)* }
+ %struct.pci_device_id = type { i32, i32, i32, i32, i32, i32, i32 }
+ %struct.pci_driver = type { %struct.list_head, i8*, %struct.pci_device_id*, i32 (%struct.pci_dev*, %struct.pci_device_id*)*, void (%struct.pci_dev*)*, i32 (%struct.pci_dev*, i32)*, i32 (%struct.pci_dev*, i32)*, i32 (%struct.pci_dev*)*, i32 (%struct.pci_dev*, i32, i32)* }
+ %struct.pci_ops = type { i32 (%struct.pci_dev*, i32, i8*)*, i32 (%struct.pci_dev*, i32, i16*)*, i32 (%struct.pci_dev*, i32, i32*)*, i32 (%struct.pci_dev*, i32, i8)*, i32 (%struct.pci_dev*, i32, i16)*, i32 (%struct.pci_dev*, i32, i32)* }
+ %struct.pipe_inode_info = type { %struct.__wait_queue_head, i8*, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.pneigh_entry = type { %struct.pneigh_entry*, %struct.net_device*, [0 x i8] }
+ %struct.poll_table_entry = type { %struct.file*, %struct.__wait_queue, %struct.__wait_queue_head* }
+ %struct.poll_table_page = type { %struct.poll_table_page*, %struct.poll_table_entry*, [0 x %struct.poll_table_entry] }
+ %struct.poll_table_struct = type { i32, %struct.poll_table_page* }
+ %struct.proc_dir_entry = type { i16, i16, i8*, i16, i16, i32, i32, i32, %struct.inode_operations*, %struct.file_operations*, i32 (i8*, i8**, i32, i32)*, %struct.module*, %struct.proc_dir_entry*, %struct.proc_dir_entry*, %struct.proc_dir_entry*, i8*, i32 (i8*, i8**, i32, i32, i32*, i8*)*, i32 (%struct.file*, i8*, i32, i8*)*, %struct.IO_APIC_reg_00, i32, i16 }
+ %struct.proc_inode_info = type { %struct.task_struct*, i32, { i32 (%struct.task_struct*, i8*)* }, %struct.file* }
+ %struct.proto = type { void (%struct.sock*, i32)*, i32 (%struct.sock*, %struct.sockaddr*, i32)*, i32 (%struct.sock*, i32)*, %struct.sock* (%struct.sock*, i32, i32*)*, i32 (%struct.sock*, i32, i32)*, i32 (%struct.sock*)*, i32 (%struct.sock*)*, void (%struct.sock*, i32)*, i32 (%struct.sock*, i32, i32, i8*, i32)*, i32 (%struct.sock*, i32, i32, i8*, i32*)*, i32 (%struct.sock*, %struct.msghdr*, i32)*, i32 (%struct.sock*, %struct.msghdr*, i32, i32, i32, i32*)*, i32 (%struct.sock*, %struct.sockaddr*, i32)*, i32 (%struct.sock*, %struct.sk_buff*)*, void (%struct.sock*)*, void (%struct.sock*)*, i32 (%struct.sock*, i16)*, [32 x i8], [32 x { i32, [28 x i8] }] }
+ %struct.proto_ops = type { i32, i32 (%struct.socket*)*, i32 (%struct.socket*, %struct.sockaddr*, i32)*, i32 (%struct.socket*, %struct.sockaddr*, i32, i32)*, i32 (%struct.socket*, %struct.socket*)*, i32 (%struct.socket*, %struct.socket*, i32)*, i32 (%struct.socket*, %struct.sockaddr*, i32*, i32)*, i32 (%struct.file*, %struct.socket*, %struct.poll_table_struct*)*, i32 (%struct.socket*, i32, i32)*, i32 (%struct.socket*, i32)*, i32 (%struct.socket*, i32)*, i32 (%struct.socket*, i32, i32, i8*, i32)*, i32 (%struct.socket*, i32, i32, i8*, i32*)*, i32 (%struct.socket*, %struct.msghdr*, i32, %struct.scm_cookie*)*, i32 (%struct.socket*, %struct.msghdr*, i32, i32, %struct.scm_cookie*)*, i32 (%struct.file*, %struct.socket*, %struct.vm_area_struct*)*, i32 (%struct.socket*, %struct.page*, i32, i32, i32)* }
+ %struct.pt_regs = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.qdisc_walker = type { i32, i32, i32, i32 (%struct.Qdisc*, i32, %struct.qdisc_walker*)* }
+ %struct.qstr = type { i8*, i32, i32 }
+ %struct.quota_format_ops = type { i32 (%struct.super_block*, i32)*, i32 (%struct.super_block*, i32)*, i32 (%struct.super_block*, i32)*, i32 (%struct.super_block*, i32)*, i32 (%struct.dquot*)*, i32 (%struct.dquot*)* }
+ %struct.quota_format_type = type { i32, %struct.quota_format_ops*, %struct.module*, %struct.quota_format_type* }
+ %struct.quota_info = type { i32, %struct.semaphore, %struct.semaphore, [2 x %struct.file*], [2 x %struct.mem_dqinfo], [2 x %struct.quota_format_ops*] }
+ %struct.quotactl_ops = type { i32 (%struct.super_block*, i32, i32, i8*)*, i32 (%struct.super_block*, i32)*, i32 (%struct.super_block*, i32)*, i32 (%struct.super_block*, i32, %struct.if_dqinfo*)*, i32 (%struct.super_block*, i32, %struct.if_dqinfo*)*, i32 (%struct.super_block*, i32, i32, %struct.if_dqblk*)*, i32 (%struct.super_block*, i32, i32, %struct.if_dqblk*)*, i32 (%struct.super_block*, %struct.fs_quota_stat*)*, i32 (%struct.super_block*, i32, i32)*, i32 (%struct.super_block*, i32, i32, %struct.fs_disk_quota*)*, i32 (%struct.super_block*, i32, i32, %struct.fs_disk_quota*)* }
+ %struct.rb_node_s = type { %struct.rb_node_s*, i32, %struct.rb_node_s*, %struct.rb_node_s* }
+ %struct.rb_root_s = type { %struct.rb_node_s* }
+ %struct.resource = type { i8*, i32, i32, i32, %struct.resource*, %struct.resource*, %struct.resource* }
+ %struct.revectored_struct = type { [8 x i32] }
+ %struct.rpc_auth = type { [8 x %struct.rpc_cred*], i32, i32, i32, i32, i32, %struct.rpc_authops* }
+ %struct.rpc_authops = type { i32, i8*, %struct.rpc_auth* (%struct.rpc_clnt*)*, void (%struct.rpc_auth*)*, %struct.rpc_cred* (i32)* }
+ %struct.rpc_clnt = type { %struct.IO_APIC_reg_00, %struct.rpc_xprt*, %struct.rpc_procinfo*, i32, i8*, i8*, %struct.rpc_auth*, %struct.rpc_stat*, i32, i32, i32, %struct.rpc_rtt, %struct.msq_setbuf, %struct.rpc_wait_queue, i32, [32 x i8] }
+ %struct.rpc_cred = type { %struct.rpc_cred*, %struct.rpc_auth*, %struct.rpc_credops*, i32, %struct.IO_APIC_reg_00, i16, i32, i32 }
+ %struct.rpc_credops = type { void (%struct.rpc_cred*)*, i32 (%struct.rpc_cred*, i32)*, i32* (%struct.rpc_task*, i32*, i32)*, i32 (%struct.rpc_task*)*, i32* (%struct.rpc_task*, i32*)* }
+ %struct.rpc_message = type { i32, i8*, i8*, %struct.rpc_cred* }
+ %struct.rpc_procinfo = type { i8*, i32 (i8*, i32*, i8*)*, i32 (i8*, i32*, i8*)*, i32, i32, i32 }
+ %struct.rpc_program = type { i8*, i32, i32, %struct.rpc_version**, %struct.rpc_stat* }
+ %struct.rpc_rqst = type { %struct.rpc_xprt*, %struct.rpc_timeout, %struct.xdr_buf, %struct.xdr_buf, %struct.rpc_task*, i32, %struct.rpc_rqst*, i32, i32, %struct.list_head, %struct.xdr_buf, [2 x i32], i32, i32, i32, i32 }
+ %struct.rpc_rtt = type { i32, [5 x i32], [5 x i32], %struct.IO_APIC_reg_00 }
+ %struct.rpc_stat = type { %struct.rpc_program*, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.rpc_task = type { %struct.list_head, i32, %struct.list_head, %struct.rpc_clnt*, %struct.rpc_rqst*, i32, %struct.rpc_wait_queue*, %struct.rpc_message, i32*, i8, i8, i8, void (%struct.rpc_task*)*, void (%struct.rpc_task*)*, void (%struct.rpc_task*)*, void (%struct.rpc_task*)*, void (%struct.rpc_task*)*, i8*, %struct.timer_list, %struct.__wait_queue_head, i32, i16, i8, i32, i16 }
+ %struct.rpc_timeout = type { i32, i32, i32, i32, i16, i8 }
+ %struct.rpc_version = type { i32, i32, %struct.rpc_procinfo* }
+ %struct.rpc_wait_queue = type { %struct.list_head, i8* }
+ %struct.rpc_xprt = type { %struct.socket*, %struct.sock*, %struct.rpc_timeout, %struct.sockaddr_in, i32, i32, i32, i32, i32, %struct.rpc_wait_queue, %struct.rpc_wait_queue, %struct.rpc_wait_queue, %struct.rpc_wait_queue, %struct.rpc_rqst*, [16 x %struct.rpc_rqst], i32, i8, i32, i32, i32, i32, i32, i32, %struct.IO_APIC_reg_00, %struct.IO_APIC_reg_00, %struct.rpc_task*, %struct.list_head, void (%struct.sock*, i32)*, void (%struct.sock*)*, void (%struct.sock*)*, %struct.__wait_queue_head }
+ %struct.rw_semaphore = type { i32, %struct.IO_APIC_reg_00, %struct.list_head }
+ %struct.scm_cookie = type { %struct.ViceFid, %struct.scm_fp_list*, i32 }
+ %struct.scm_fp_list = type { i32, [255 x %struct.file*] }
+ %struct.sem_array = type { %struct.kern_ipc_perm, i32, i32, %struct._drm_i810_overlay_t*, %struct.sem_queue*, %struct.sem_queue**, %struct.sem_undo*, i32 }
+ %struct.sem_queue = type { %struct.sem_queue*, %struct.sem_queue**, %struct.task_struct*, %struct.sem_undo*, i32, i32, %struct.sem_array*, i32, %struct.sembuf*, i32, i32 }
+ %struct.sem_undo = type { %struct.sem_undo*, %struct.sem_undo*, i32, i16* }
+ %struct.semaphore = type { %struct.IO_APIC_reg_00, i32, %struct.__wait_queue_head }
+ %struct.sembuf = type { i16, i16, i16 }
+ %struct.seq_file = type { i8*, i32, i32, i32, i64, %struct.semaphore, %struct.seq_operations*, i8* }
+ %struct.seq_operations = type { i8* (%struct.seq_file*, i64*)*, void (%struct.seq_file*, i8*)*, i8* (%struct.seq_file*, i8*, i64*)*, i32 (%struct.seq_file*, i8*)* }
+ %struct.shmem_inode_info = type { %struct.IO_APIC_reg_00, i32, [16 x %struct.IO_APIC_reg_00], i8**, i32, i32, %struct.list_head, %struct.inode* }
+ %struct.sigaction = type { void (i32)*, i32, void ()*, %typedef.__kernel_fsid_t }
+ %struct.siginfo = type { i32, i32, i32, { [29 x i32] } }
+ %struct.signal_struct = type { %struct.IO_APIC_reg_00, [64 x %struct.k_sigaction], %struct.IO_APIC_reg_00 }
+ %struct.sigpending = type { %struct.sigqueue*, %struct.sigqueue**, %typedef.__kernel_fsid_t }
+ %struct.sigqueue = type { %struct.sigqueue*, %struct.siginfo }
+ %struct.sk_buff = type { %struct.sk_buff*, %struct.sk_buff*, %struct.sk_buff_head*, %struct.sock*, %struct._drm_i810_overlay_t, %struct.net_device*, %struct.net_device*, { i8* }, { i8* }, { i8* }, %struct.dst_entry*, [48 x i8], i32, i32, i32, i8, i8, i8, i8, i32, %struct.IO_APIC_reg_00, i16, i16, i32, i8*, i8*, i8*, i8*, void (%struct.sk_buff*)*, i32, i32, %struct.nf_ct_info*, i32 }
+ %struct.sk_buff_head = type { %struct.sk_buff*, %struct.sk_buff*, i32, %struct.IO_APIC_reg_00 }
+ %struct.sock = type { i32, i32, i16, i16, i32, %struct.sock*, %struct.sock**, %struct.sock*, %struct.sock**, i8, i8, i16, i16, i8, i8, %struct.IO_APIC_reg_00, %struct.semaphore, i32, %struct.__wait_queue_head*, %struct.dst_entry*, %typedef.rwlock_t, %struct.IO_APIC_reg_00, %struct.sk_buff_head, %struct.IO_APIC_reg_00, %struct.sk_buff_head, %struct.IO_APIC_reg_00, i32, i32, i32, i32, i32, %struct.sock*, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, %struct.sock*, { %struct.sk_buff*, %struct.sk_buff* }, %typedef.rwlock_t, %struct.sk_buff_head, %struct.proto*, { %struct.tcp_opt }, i32, i32, i16, i16, i32, i16, i8, i8, %struct.ViceFid, i32, i32, i32, { %struct.unix_opt }, %struct.timer_list, %struct._drm_i810_overlay_t, %struct.socket*, i8*, void (%struct.sock*)*, void (%struct.sock*, i32)*, void (%struct.sock*)*, void (%struct.sock*)*, i32 (%struct.sock*, %struct.sk_buff*)*, void (%struct.sock*)* }
+ %struct.sockaddr = type { i16, [14 x i8] }
+ %struct.sockaddr_in = type { i16, i16, %struct.IO_APIC_reg_00, [8 x i8] }
+ %struct.sockaddr_un = type { i16, [108 x i8] }
+ %struct.socket = type { i32, i32, %struct.proto_ops*, %struct.inode*, %struct.fasync_struct*, %struct.file*, %struct.sock*, %struct.__wait_queue_head, i16, i8 }
+ %struct.statfs = type { i32, i32, i32, i32, i32, i32, i32, %typedef.__kernel_fsid_t, i32, [6 x i32] }
+ %struct.super_block = type { %struct.list_head, i16, i32, i8, i8, i64, %struct.file_system_type*, %struct.super_operations*, %struct.dquot_operations*, %struct.quotactl_ops*, i32, i32, %struct.dentry*, %struct.rw_semaphore, %struct.semaphore, i32, %struct.IO_APIC_reg_00, %struct.list_head, %struct.list_head, %struct.list_head, %struct.block_device*, %struct.list_head, %struct.quota_info, { [115 x i32] }, %struct.semaphore, %struct.semaphore }
+ %struct.super_operations = type { %struct.inode* (%struct.super_block*)*, void (%struct.inode*)*, void (%struct.inode*)*, void (%struct.inode*, i8*)*, void (%struct.inode*)*, void (%struct.inode*, i32)*, void (%struct.inode*)*, void (%struct.inode*)*, void (%struct.super_block*)*, void (%struct.super_block*)*, i32 (%struct.super_block*)*, void (%struct.super_block*)*, void (%struct.super_block*)*, i32 (%struct.super_block*, %struct.statfs*)*, i32 (%struct.super_block*, i32*, i8*)*, void (%struct.inode*)*, void (%struct.super_block*)*, %struct.dentry* (%struct.super_block*, i32*, i32, i32, i32)*, i32 (%struct.dentry*, i32*, i32*, i32)*, i32 (%struct.seq_file*, %struct.vfsmount*)* }
+ %struct.task_struct = type { i32, i32, i32, %struct.IO_APIC_reg_00, %struct.exec_domain*, i32, i32, i32, i32, i32, i32, %struct.mm_struct*, i32, i32, i32, %struct.list_head, i32, %struct.task_struct*, %struct.task_struct*, %struct.mm_struct*, %struct.list_head, i32, i32, %struct.linux_binfmt*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.task_struct*, %struct.task_struct*, %struct.task_struct*, %struct.task_struct*, %struct.task_struct*, %struct.list_head, %struct.task_struct*, %struct.task_struct**, %struct.__wait_queue_head, %struct.completion*, i32, i32, i32, i32, i32, i32, i32, %struct.timer_list, %struct.audio_buf_info, i32, [32 x i32], [32 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [32 x i32], i32, i32, i32, i32, %struct.user_struct*, [11 x %struct._drm_i810_overlay_t], i16, [16 x i8], i32, i32, %struct.tty_struct*, i32, %struct.sem_undo*, %struct.sem_queue*, %struct.thread_struct, %struct.fs_struct*, %struct.files_struct*, %struct.namespace*, %struct.IO_APIC_reg_00, %struct.signal_struct*, %typedef.__kernel_fsid_t, %struct.sigpending, i32, i32, i32 (i8*)*, i8*, %typedef.__kernel_fsid_t*, i32, i32, %struct.IO_APIC_reg_00, i8*, %struct.llva_sigcontext*, i32, %struct.task_struct*, i32, %typedef.llva_icontext_t, %typedef.llva_fp_state_t, i32*, i32, i8* }
+ %struct.tasklet_struct = type { %struct.tasklet_struct*, i32, %struct.IO_APIC_reg_00, void (i32)*, i32 }
+ %struct.tc_stats = type { i64, i32, i32, i32, i32, i32, i32, i32, %struct.IO_APIC_reg_00* }
+ %struct.tcf_proto = type { %struct.tcf_proto*, i8*, i32 (%struct.sk_buff*, %struct.tcf_proto*, %struct._drm_i810_overlay_t*)*, i32, i32, i32, %struct.Qdisc*, i8*, %struct.tcf_proto_ops* }
+ %struct.tcf_proto_ops = type { %struct.tcf_proto_ops*, [16 x i8], i32 (%struct.sk_buff*, %struct.tcf_proto*, %struct._drm_i810_overlay_t*)*, i32 (%struct.tcf_proto*)*, void (%struct.tcf_proto*)*, i32 (%struct.tcf_proto*, i32)*, void (%struct.tcf_proto*, i32)*, i32 (%struct.tcf_proto*, i32, i32, %struct._agp_version**, i32*)*, i32 (%struct.tcf_proto*, i32)*, void (%struct.tcf_proto*, %struct.tcf_walker*)*, i32 (%struct.tcf_proto*, i32, %struct.sk_buff*, %struct.tcmsg*)* }
+ %struct.tcf_walker = type { i32, i32, i32, i32 (%struct.tcf_proto*, i32, %struct.tcf_walker*)* }
+ %struct.tcmsg = type { i8, i8, i16, i32, i32, i32, i32 }
+ %struct.tcp_func = type { i32 (%struct.sk_buff*)*, void (%struct.sock*, %struct.tcphdr*, i32, %struct.sk_buff*)*, i32 (%struct.sock*)*, i32 (%struct.sock*, %struct.sk_buff*)*, %struct.sock* (%struct.sock*, %struct.sk_buff*, %struct.open_request*, %struct.dst_entry*)*, i32 (%struct.sock*)*, i16, i32 (%struct.sock*, i32, i32, i8*, i32)*, i32 (%struct.sock*, i32, i32, i8*, i32*)*, void (%struct.sock*, %struct.sockaddr*)*, i32 }
+ %struct.tcp_listen_opt = type { i8, i32, i32, i32, i32, [512 x %struct.open_request*] }
+ %struct.tcp_opt = type { i32, i32, i32, i32, i32, i32, i32, i32, { i8, i8, i8, i8, i32, i32, i32, i16, i16 }, { %struct.sk_buff_head, %struct.task_struct*, %struct.iovec*, i32, i32 }, i32, i32, i32, i32, i16, i16, i16, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i32, i32, i32, %struct.timer_list, %struct.timer_list, %struct.sk_buff_head, %struct.tcp_func*, %struct.sk_buff*, %struct.page*, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i16, i8, i8, [1 x %struct._drm_i810_overlay_t], [4 x %struct._drm_i810_overlay_t], i32, i32, i8, i8, i16, i8, i8, i16, i32, i32, i32, i32, i32, i32, i32, i32, i16, i8, i8, i32, %typedef.rwlock_t, %struct.tcp_listen_opt*, %struct.open_request*, %struct.open_request*, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.tcp_v4_open_req = type { i32, i32, %struct.ip_options* }
+ %struct.tcphdr = type { i16, i16, i32, i32, i16, i16, i16, i16 }
+ %struct.termios = type { i32, i32, i32, i32, i8, [19 x i8] }
+ %struct.thread_struct = type { i32, i32, i32, i32, i32, [8 x i32], i32, i32, i32, %union.i387_union, %struct.vm86_struct*, i32, i32, i32, i32, i32, [33 x i32] }
+ %struct.timer_list = type { %struct.list_head, i32, i32, void (i32)* }
+ %struct.tq_struct = type { %struct.list_head, i32, void (i8*)*, i8* }
+ %struct.tty_driver = type { i32, i8*, i8*, i32, i16, i16, i16, i16, i16, %struct.termios, i32, i32*, %struct.proc_dir_entry*, %struct.tty_driver*, %struct.tty_struct**, %struct.termios**, %struct.termios**, i8*, i32 (%struct.tty_struct*, %struct.file*)*, void (%struct.tty_struct*, %struct.file*)*, i32 (%struct.tty_struct*, i32, i8*, i32)*, void (%struct.tty_struct*, i8)*, void (%struct.tty_struct*)*, i32 (%struct.tty_struct*)*, i32 (%struct.tty_struct*)*, i32 (%struct.tty_struct*, %struct.file*, i32, i32)*, void (%struct.tty_struct*, %struct.termios*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*, i32)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*, i32)*, void (%struct.tty_struct*, i8)*, i32 (i8*, i8**, i32, i32, i32*, i8*)*, i32 (%struct.file*, i8*, i32, i8*)*, %struct.tty_driver*, %struct.tty_driver* }
+ %struct.tty_flip_buffer = type { %struct.tq_struct, %struct.semaphore, i8*, i8*, i32, i32, [1024 x i8], [1024 x i8], [4 x i8] }
+ %struct.tty_ldisc = type { i32, i8*, i32, i32, i32 (%struct.tty_struct*)*, void (%struct.tty_struct*)*, void (%struct.tty_struct*)*, i32 (%struct.tty_struct*)*, i32 (%struct.tty_struct*, %struct.file*, i8*, i32)*, i32 (%struct.tty_struct*, %struct.file*, i8*, i32)*, i32 (%struct.tty_struct*, %struct.file*, i32, i32)*, void (%struct.tty_struct*, %struct.termios*)*, i32 (%struct.tty_struct*, %struct.file*, %struct.poll_table_struct*)*, void (%struct.tty_struct*, i8*, i8*, i32)*, i32 (%struct.tty_struct*)*, void (%struct.tty_struct*)* }
+ %struct.tty_struct = type { i32, %struct.tty_driver, %struct.tty_ldisc, %struct.termios*, %struct.termios*, i32, i32, i16, i32, i32, %struct.drm_clip_rect, i8, i8, %struct.tty_struct*, %struct.fasync_struct*, %struct.tty_flip_buffer, i32, i32, %struct.__wait_queue_head, %struct.__wait_queue_head, %struct.tq_struct, i8*, i8*, %struct.list_head, i32, i8, i16, i32, i32, [8 x i32], i8*, i32, i32, i32, [128 x i32], i32, i32, i32, %struct.semaphore, %struct.semaphore, %struct.IO_APIC_reg_00, %struct.tq_struct }
+ %struct.unix_address = type { %struct.IO_APIC_reg_00, i32, i32, [0 x %struct.sockaddr_un] }
+ %struct.unix_opt = type { %struct.unix_address*, %struct.dentry*, %struct.vfsmount*, %struct.semaphore, %struct.sock*, %struct.sock**, %struct.sock*, %struct.IO_APIC_reg_00, %typedef.rwlock_t, %struct.__wait_queue_head }
+ %struct.usb_bus = type opaque
+ %struct.usbdev_inode_info = type { %struct.list_head, %struct.list_head, { %struct.usb_bus* } }
+ %struct.user_struct = type { %struct.IO_APIC_reg_00, %struct.IO_APIC_reg_00, %struct.IO_APIC_reg_00, %struct.user_struct*, %struct.user_struct**, i32 }
+ %struct.vfsmount = type { %struct.list_head, %struct.vfsmount*, %struct.dentry*, %struct.dentry*, %struct.super_block*, %struct.list_head, %struct.list_head, %struct.IO_APIC_reg_00, i32, i8*, %struct.list_head }
+ %struct.vlan_group = type opaque
+ %struct.vm86_regs = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i32, i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 }
+ %struct.vm86_struct = type { %struct.vm86_regs, i32, i32, i32, %struct.revectored_struct, %struct.revectored_struct }
+ %struct.vm_area_struct = type { %struct.mm_struct*, i32, i32, %struct.vm_area_struct*, %struct.IO_APIC_reg_00, i32, %struct.rb_node_s, %struct.vm_area_struct*, %struct.vm_area_struct**, %struct.vm_operations_struct*, i32, %struct.file*, i32, i8* }
+ %struct.vm_operations_struct = type { void (%struct.vm_area_struct*)*, void (%struct.vm_area_struct*)*, %struct.page* (%struct.vm_area_struct*, i32, i32)* }
+ %struct.xdr_buf = type { [1 x %struct.iovec], [1 x %struct.iovec], %struct.page**, i32, i32, i32 }
+ %typedef.__kernel_fd_set = type { [32 x i32] }
+ %typedef.__kernel_fsid_t = type { [2 x i32] }
+ %typedef.dvd_authinfo = type { [2 x i64] }
+ %typedef.llva_fp_state_t = type { [7 x i32], [20 x i32] }
+ %typedef.llva_icontext_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, i32 }
+ %typedef.rwlock_t = type { %struct.IO_APIC_reg_00, %struct.IO_APIC_reg_00, i32 }
+ %typedef.sigset_t = type { [2 x i32] }
+ %typedef.socket_lock_t = type { %struct.IO_APIC_reg_00, i32, %struct.__wait_queue_head }
+ %union.i387_union = type { %struct.i387_fxsave_struct }
+
+define void @rs_init() {
+entry:
+ br i1 false, label %loopentry.0.no_exit.0_crit_edge, label %loopentry.0.loopexit.0_crit_edge
+
+loopentry.0: ; No predecessors!
+ unreachable
+
+loopentry.0.loopexit.0_crit_edge: ; preds = %entry
+ br label %loopexit.0
+
+loopentry.0.no_exit.0_crit_edge: ; preds = %entry
+ br label %no_exit.0
+
+no_exit.0: ; preds = %no_exit.0.no_exit.0_crit_edge, %loopentry.0.no_exit.0_crit_edge
+ br i1 false, label %no_exit.0.no_exit.0_crit_edge, label %no_exit.0.loopexit.0_crit_edge
+
+no_exit.0.loopexit.0_crit_edge: ; preds = %no_exit.0
+ br label %loopexit.0
+
+no_exit.0.no_exit.0_crit_edge: ; preds = %no_exit.0
+ br label %no_exit.0
+
+loopexit.0: ; preds = %no_exit.0.loopexit.0_crit_edge, %loopentry.0.loopexit.0_crit_edge
+ br i1 false, label %then.0, label %loopexit.0.endif.0_crit_edge
+
+loopexit.0.endif.0_crit_edge: ; preds = %loopexit.0
+ br label %endif.0
+
+then.0: ; preds = %loopexit.0
+ br i1 false, label %loopentry.1.no_exit.1_crit_edge, label %loopentry.1.loopexit.1_crit_edge
+
+loopentry.1: ; No predecessors!
+ unreachable
+
+loopentry.1.loopexit.1_crit_edge: ; preds = %then.0
+ br label %loopexit.1
+
+loopentry.1.no_exit.1_crit_edge: ; preds = %then.0
+ br label %no_exit.1
+
+no_exit.1: ; preds = %no_exit.1.backedge, %loopentry.1.no_exit.1_crit_edge
+ br i1 false, label %shortcirc_next.0, label %no_exit.1.shortcirc_done.0_crit_edge
+
+no_exit.1.shortcirc_done.0_crit_edge: ; preds = %no_exit.1
+ br label %shortcirc_done.0
+
+shortcirc_next.0: ; preds = %no_exit.1
+ br label %shortcirc_done.0
+
+shortcirc_done.0: ; preds = %shortcirc_next.0, %no_exit.1.shortcirc_done.0_crit_edge
+ br i1 false, label %then.1, label %endif.1
+
+then.1: ; preds = %shortcirc_done.0
+ br i1 false, label %then.1.no_exit.1_crit_edge, label %then.1.loopexit.1_crit_edge
+
+then.1.loopexit.1_crit_edge: ; preds = %then.1
+ br label %loopexit.1
+
+then.1.no_exit.1_crit_edge: ; preds = %then.1
+ br label %no_exit.1.backedge
+
+no_exit.1.backedge: ; preds = %endif.1.no_exit.1_crit_edge, %then.1.no_exit.1_crit_edge
+ br label %no_exit.1
+
+endif.1: ; preds = %shortcirc_done.0
+ br i1 false, label %endif.1.no_exit.1_crit_edge, label %endif.1.loopexit.1_crit_edge
+
+endif.1.loopexit.1_crit_edge: ; preds = %endif.1
+ br label %loopexit.1
+
+endif.1.no_exit.1_crit_edge: ; preds = %endif.1
+ br label %no_exit.1.backedge
+
+loopexit.1: ; preds = %endif.1.loopexit.1_crit_edge, %then.1.loopexit.1_crit_edge, %loopentry.1.loopexit.1_crit_edge
+ br label %endif.0
+
+endif.0: ; preds = %loopexit.1, %loopexit.0.endif.0_crit_edge
+ br i1 false, label %then.2, label %endif.0.endif.2_crit_edge
+
+endif.0.endif.2_crit_edge: ; preds = %endif.0
+ br label %endif.2
+
+then.2: ; preds = %endif.0
+ unreachable
+
+dead_block.0: ; No predecessors!
+ br label %endif.2
+
+endif.2: ; preds = %dead_block.0, %endif.0.endif.2_crit_edge
+ br i1 false, label %then.3, label %endif.2.endif.3_crit_edge
+
+endif.2.endif.3_crit_edge: ; preds = %endif.2
+ br label %endif.3
+
+then.3: ; preds = %endif.2
+ unreachable
+
+dead_block.1: ; No predecessors!
+ br label %endif.3
+
+endif.3: ; preds = %dead_block.1, %endif.2.endif.3_crit_edge
+ br label %loopentry.2
+
+loopentry.2: ; preds = %endif.6, %endif.3
+ br i1 false, label %loopentry.2.no_exit.2_crit_edge, label %loopentry.2.loopexit.2_crit_edge
+
+loopentry.2.loopexit.2_crit_edge: ; preds = %loopentry.2
+ br label %loopexit.2
+
+loopentry.2.no_exit.2_crit_edge: ; preds = %loopentry.2
+ br label %no_exit.2
+
+no_exit.2: ; preds = %then.5.no_exit.2_crit_edge, %loopentry.2.no_exit.2_crit_edge
+ br i1 false, label %then.4, label %no_exit.2.endif.4_crit_edge
+
+no_exit.2.endif.4_crit_edge: ; preds = %no_exit.2
+ br label %endif.4
+
+then.4: ; preds = %no_exit.2
+ br label %endif.4
+
+endif.4: ; preds = %then.4, %no_exit.2.endif.4_crit_edge
+ br i1 false, label %shortcirc_next.1, label %endif.4.shortcirc_done.1_crit_edge
+
+endif.4.shortcirc_done.1_crit_edge: ; preds = %endif.4
+ br label %shortcirc_done.1
+
+shortcirc_next.1: ; preds = %endif.4
+ br i1 false, label %then.i21, label %endif.i
+
+then.i21: ; preds = %shortcirc_next.1
+ br label %then.5
+
+then.i21.endif.5_crit_edge: ; No predecessors!
+ unreachable
+
+then.i21.then.5_crit_edge: ; No predecessors!
+ unreachable
+
+endif.i: ; preds = %shortcirc_next.1
+ br label %shortcirc_done.1
+
+__check_region.exit: ; No predecessors!
+ unreachable
+
+shortcirc_done.1: ; preds = %endif.i, %endif.4.shortcirc_done.1_crit_edge
+ br i1 false, label %shortcirc_done.1.then.5_crit_edge, label %shortcirc_done.1.endif.5_crit_edge
+
+shortcirc_done.1.endif.5_crit_edge: ; preds = %shortcirc_done.1
+ br label %endif.5
+
+shortcirc_done.1.then.5_crit_edge: ; preds = %shortcirc_done.1
+ br label %then.5
+
+then.5: ; preds = %shortcirc_done.1.then.5_crit_edge, %then.i21
+ br i1 false, label %then.5.no_exit.2_crit_edge, label %then.5.loopexit.2_crit_edge
+
+then.5.loopexit.2_crit_edge: ; preds = %then.5
+ br label %loopexit.2
+
+then.5.no_exit.2_crit_edge: ; preds = %then.5
+ br label %no_exit.2
+
+dead_block_after_continue.0: ; No predecessors!
+ unreachable
+
+endif.5: ; preds = %shortcirc_done.1.endif.5_crit_edge
+ br i1 false, label %then.6, label %endif.5.endif.6_crit_edge
+
+endif.5.endif.6_crit_edge: ; preds = %endif.5
+ br label %endif.6
+
+then.6: ; preds = %endif.5
+ br label %endif.6
+
+endif.6: ; preds = %then.6, %endif.5.endif.6_crit_edge
+ br label %loopentry.2
+
+loopcont.2: ; No predecessors!
+ unreachable
+
+loopexit.2: ; preds = %then.5.loopexit.2_crit_edge, %loopentry.2.loopexit.2_crit_edge
+ br label %loopentry.3
+
+loopentry.3: ; preds = %endif.9, %loopexit.2
+ br i1 false, label %loopentry.3.no_exit.3_crit_edge, label %loopentry.3.loopexit.3_crit_edge
+
+loopentry.3.loopexit.3_crit_edge: ; preds = %loopentry.3
+ br label %loopexit.3
+
+loopentry.3.no_exit.3_crit_edge: ; preds = %loopentry.3
+ br label %no_exit.3
+
+no_exit.3: ; preds = %then.7.no_exit.3_crit_edge, %loopentry.3.no_exit.3_crit_edge
+ br i1 false, label %then.7, label %no_exit.3.endif.7_crit_edge
+
+no_exit.3.endif.7_crit_edge: ; preds = %no_exit.3
+ br label %endif.7
+
+then.7: ; preds = %no_exit.3
+ br i1 false, label %then.7.no_exit.3_crit_edge, label %then.7.loopexit.3_crit_edge
+
+then.7.loopexit.3_crit_edge: ; preds = %then.7
+ br label %loopexit.3
+
+then.7.no_exit.3_crit_edge: ; preds = %then.7
+ br label %no_exit.3
+
+dead_block_after_continue.1: ; No predecessors!
+ unreachable
+
+endif.7: ; preds = %no_exit.3.endif.7_crit_edge
+ br i1 false, label %shortcirc_next.2, label %endif.7.shortcirc_done.2_crit_edge
+
+endif.7.shortcirc_done.2_crit_edge: ; preds = %endif.7
+ br label %shortcirc_done.2
+
+shortcirc_next.2: ; preds = %endif.7
+ br label %shortcirc_done.2
+
+shortcirc_done.2: ; preds = %shortcirc_next.2, %endif.7.shortcirc_done.2_crit_edge
+ br i1 false, label %shortcirc_next.3, label %shortcirc_done.2.shortcirc_done.3_crit_edge
+
+shortcirc_done.2.shortcirc_done.3_crit_edge: ; preds = %shortcirc_done.2
+ br label %shortcirc_done.3
+
+shortcirc_next.3: ; preds = %shortcirc_done.2
+ br i1 false, label %shortcirc_next.3.shortcirc_done.4_crit_edge, label %shortcirc_next.4
+
+shortcirc_next.3.shortcirc_done.4_crit_edge: ; preds = %shortcirc_next.3
+ br label %shortcirc_done.4
+
+shortcirc_next.4: ; preds = %shortcirc_next.3
+ br label %shortcirc_done.4
+
+shortcirc_done.4: ; preds = %shortcirc_next.4, %shortcirc_next.3.shortcirc_done.4_crit_edge
+ br label %shortcirc_done.3
+
+shortcirc_done.3: ; preds = %shortcirc_done.4, %shortcirc_done.2.shortcirc_done.3_crit_edge
+ br i1 false, label %then.8, label %shortcirc_done.3.endif.8_crit_edge
+
+shortcirc_done.3.endif.8_crit_edge: ; preds = %shortcirc_done.3
+ br label %endif.8
+
+then.8: ; preds = %shortcirc_done.3
+ br label %endif.8
+
+endif.8: ; preds = %then.8, %shortcirc_done.3.endif.8_crit_edge
+ br i1 false, label %then.9, label %else
+
+then.9: ; preds = %endif.8
+ br i1 false, label %cond_true.0, label %cond_false.0
+
+cond_true.0: ; preds = %then.9
+ br label %cond_continue.0
+
+cond_false.0: ; preds = %then.9
+ br label %cond_continue.0
+
+cond_continue.0: ; preds = %cond_false.0, %cond_true.0
+ br label %endif.9
+
+else: ; preds = %endif.8
+ br i1 false, label %cond_true.1, label %cond_false.1
+
+cond_true.1: ; preds = %else
+ br label %cond_continue.1
+
+cond_false.1: ; preds = %else
+ br label %cond_continue.1
+
+cond_continue.1: ; preds = %cond_false.1, %cond_true.1
+ br label %endif.9
+
+endif.9: ; preds = %cond_continue.1, %cond_continue.0
+ br label %loopentry.3
+
+loopcont.3: ; No predecessors!
+ unreachable
+
+loopexit.3: ; preds = %then.7.loopexit.3_crit_edge, %loopentry.3.loopexit.3_crit_edge
+ br i1 false, label %loopentry.i.i.i2.no_exit.i.i.i4_crit_edge, label %loopentry.i.i.i2.pci_register_driver.exit.i.i_crit_edge
+
+loopentry.i.i.i2: ; No predecessors!
+ unreachable
+
+loopentry.i.i.i2.pci_register_driver.exit.i.i_crit_edge: ; preds = %loopexit.3
+ br label %pci_register_driver.exit.i.i
+
+loopentry.i.i.i2.no_exit.i.i.i4_crit_edge: ; preds = %loopexit.3
+ br label %no_exit.i.i.i4
+
+no_exit.i.i.i4: ; preds = %endif.i.i.i10.no_exit.i.i.i4_crit_edge, %loopentry.i.i.i2.no_exit.i.i.i4_crit_edge
+ br i1 false, label %then.i.i.i6, label %no_exit.i.i.i4.endif.i.i.i10_crit_edge
+
+no_exit.i.i.i4.endif.i.i.i10_crit_edge: ; preds = %no_exit.i.i.i4
+ br label %endif.i.i.i10
+
+then.i.i.i6: ; preds = %no_exit.i.i.i4
+ br i1 false, label %then.0.i.i.i.i, label %else.i.i.i.i
+
+then.0.i.i.i.i: ; preds = %then.i.i.i6
+ br i1 false, label %then.1.i.i.i.i, label %endif.1.i.i.i.i
+
+then.1.i.i.i.i: ; preds = %then.0.i.i.i.i
+ br label %endif.i.i.i10
+
+endif.1.i.i.i.i: ; preds = %then.0.i.i.i.i
+ br i1 false, label %endif.1.i.i.i.i.then.i.i.i.i.i.i_crit_edge, label %endif.1.i.i.i.i.endif.i.i.i.i.i.i_crit_edge
+
+endif.1.i.i.i.i.endif.i.i.i.i.i.i_crit_edge: ; preds = %endif.1.i.i.i.i
+ br label %endif.i.i.i.i.i.i
+
+endif.1.i.i.i.i.then.i.i.i.i.i.i_crit_edge: ; preds = %endif.1.i.i.i.i
+ br label %then.i.i.i.i.i.i
+
+else.i.i.i.i: ; preds = %then.i.i.i6
+ br i1 false, label %endif.0.i.i.i.i.then.i.i.i.i.i.i_crit_edge, label %endif.0.i.i.i.i.endif.i.i.i.i.i.i_crit_edge
+
+endif.0.i.i.i.i: ; No predecessors!
+ unreachable
+
+endif.0.i.i.i.i.endif.i.i.i.i.i.i_crit_edge: ; preds = %else.i.i.i.i
+ br label %endif.i.i.i.i.i.i
+
+endif.0.i.i.i.i.then.i.i.i.i.i.i_crit_edge: ; preds = %else.i.i.i.i
+ br label %then.i.i.i.i.i.i
+
+then.i.i.i.i.i.i: ; preds = %endif.0.i.i.i.i.then.i.i.i.i.i.i_crit_edge, %endif.1.i.i.i.i.then.i.i.i.i.i.i_crit_edge
+ br i1 false, label %then.i.i.i.i.i.i.then.2.i.i.i.i_crit_edge, label %then.i.i.i.i.i.i.endif.2.i.i.i.i_crit_edge
+
+then.i.i.i.i.i.i.endif.2.i.i.i.i_crit_edge: ; preds = %then.i.i.i.i.i.i
+ br label %endif.2.i.i.i.i
+
+then.i.i.i.i.i.i.then.2.i.i.i.i_crit_edge: ; preds = %then.i.i.i.i.i.i
+ br label %then.2.i.i.i.i
+
+endif.i.i.i.i.i.i: ; preds = %endif.0.i.i.i.i.endif.i.i.i.i.i.i_crit_edge, %endif.1.i.i.i.i.endif.i.i.i.i.i.i_crit_edge
+ br i1 false, label %dev_probe_lock.exit.i.i.i.i.then.2.i.i.i.i_crit_edge, label %dev_probe_lock.exit.i.i.i.i.endif.2.i.i.i.i_crit_edge
+
+dev_probe_lock.exit.i.i.i.i: ; No predecessors!
+ unreachable
+
+dev_probe_lock.exit.i.i.i.i.endif.2.i.i.i.i_crit_edge: ; preds = %endif.i.i.i.i.i.i
+ br label %endif.2.i.i.i.i
+
+dev_probe_lock.exit.i.i.i.i.then.2.i.i.i.i_crit_edge: ; preds = %endif.i.i.i.i.i.i
+ br label %then.2.i.i.i.i
+
+then.2.i.i.i.i: ; preds = %dev_probe_lock.exit.i.i.i.i.then.2.i.i.i.i_crit_edge, %then.i.i.i.i.i.i.then.2.i.i.i.i_crit_edge
+ br label %endif.2.i.i.i.i
+
+endif.2.i.i.i.i: ; preds = %then.2.i.i.i.i, %dev_probe_lock.exit.i.i.i.i.endif.2.i.i.i.i_crit_edge, %then.i.i.i.i.i.i.endif.2.i.i.i.i_crit_edge
+ br i1 false, label %then.i.i2.i.i.i.i, label %endif.i.i3.i.i.i.i
+
+then.i.i2.i.i.i.i: ; preds = %endif.2.i.i.i.i
+ br label %endif.i.i.i10
+
+endif.i.i3.i.i.i.i: ; preds = %endif.2.i.i.i.i
+ br label %endif.i.i.i10
+
+dev_probe_unlock.exit.i.i.i.i: ; No predecessors!
+ unreachable
+
+pci_announce_device.exit.i.i.i: ; No predecessors!
+ unreachable
+
+endif.i.i.i10: ; preds = %endif.i.i3.i.i.i.i, %then.i.i2.i.i.i.i, %then.1.i.i.i.i, %no_exit.i.i.i4.endif.i.i.i10_crit_edge
+ br i1 false, label %endif.i.i.i10.no_exit.i.i.i4_crit_edge, label %endif.i.i.i10.pci_register_driver.exit.i.i_crit_edge
+
+endif.i.i.i10.pci_register_driver.exit.i.i_crit_edge: ; preds = %endif.i.i.i10
+ br label %pci_register_driver.exit.i.i
+
+endif.i.i.i10.no_exit.i.i.i4_crit_edge: ; preds = %endif.i.i.i10
+ br label %no_exit.i.i.i4
+
+pci_register_driver.exit.i.i: ; preds = %endif.i.i.i10.pci_register_driver.exit.i.i_crit_edge, %loopentry.i.i.i2.pci_register_driver.exit.i.i_crit_edge
+ br i1 false, label %then.0.i.i12, label %endif.0.i.i13
+
+then.0.i.i12: ; preds = %pci_register_driver.exit.i.i
+ br label %probe_serial_pci.exit
+
+then.0.i.i12.probe_serial_pci.exit_crit_edge: ; No predecessors!
+ unreachable
+
+then.0.i.i12.then.i_crit_edge: ; No predecessors!
+ br label %then.i
+
+endif.0.i.i13: ; preds = %pci_register_driver.exit.i.i
+ br i1 false, label %then.1.i.i14, label %endif.0.i.i13.endif.1.i.i15_crit_edge
+
+endif.0.i.i13.endif.1.i.i15_crit_edge: ; preds = %endif.0.i.i13
+ br label %endif.1.i.i15
+
+then.1.i.i14: ; preds = %endif.0.i.i13
+ br label %endif.1.i.i15
+
+endif.1.i.i15: ; preds = %then.1.i.i14, %endif.0.i.i13.endif.1.i.i15_crit_edge
+ br i1 false, label %loopentry.i8.i.i.no_exit.i9.i.i_crit_edge, label %loopentry.i8.i.i.pci_unregister_driver.exit.i.i_crit_edge
+
+loopentry.i8.i.i: ; No predecessors!
+ unreachable
+
+loopentry.i8.i.i.pci_unregister_driver.exit.i.i_crit_edge: ; preds = %endif.1.i.i15
+ br label %pci_unregister_driver.exit.i.i
+
+loopentry.i8.i.i.no_exit.i9.i.i_crit_edge: ; preds = %endif.1.i.i15
+ br label %no_exit.i9.i.i
+
+no_exit.i9.i.i: ; preds = %endif.0.i.i.i.no_exit.i9.i.i_crit_edge, %loopentry.i8.i.i.no_exit.i9.i.i_crit_edge
+ br i1 false, label %then.0.i.i.i, label %no_exit.i9.i.i.endif.0.i.i.i_crit_edge
+
+no_exit.i9.i.i.endif.0.i.i.i_crit_edge: ; preds = %no_exit.i9.i.i
+ br label %endif.0.i.i.i
+
+then.0.i.i.i: ; preds = %no_exit.i9.i.i
+ br i1 false, label %then.1.i.i.i, label %then.0.i.i.i.endif.1.i.i.i_crit_edge
+
+then.0.i.i.i.endif.1.i.i.i_crit_edge: ; preds = %then.0.i.i.i
+ br label %endif.1.i.i.i
+
+then.1.i.i.i: ; preds = %then.0.i.i.i
+ br label %endif.1.i.i.i
+
+endif.1.i.i.i: ; preds = %then.1.i.i.i, %then.0.i.i.i.endif.1.i.i.i_crit_edge
+ br label %endif.0.i.i.i
+
+endif.0.i.i.i: ; preds = %endif.1.i.i.i, %no_exit.i9.i.i.endif.0.i.i.i_crit_edge
+ br i1 false, label %endif.0.i.i.i.no_exit.i9.i.i_crit_edge, label %endif.0.i.i.i.pci_unregister_driver.exit.i.i_crit_edge
+
+endif.0.i.i.i.pci_unregister_driver.exit.i.i_crit_edge: ; preds = %endif.0.i.i.i
+ br label %pci_unregister_driver.exit.i.i
+
+endif.0.i.i.i.no_exit.i9.i.i_crit_edge: ; preds = %endif.0.i.i.i
+ br label %no_exit.i9.i.i
+
+pci_unregister_driver.exit.i.i: ; preds = %endif.0.i.i.i.pci_unregister_driver.exit.i.i_crit_edge, %loopentry.i8.i.i.pci_unregister_driver.exit.i.i_crit_edge
+ br i1 false, label %pci_module_init.exit.i.then.i_crit_edge, label %pci_module_init.exit.i.probe_serial_pci.exit_crit_edge
+
+pci_module_init.exit.i: ; No predecessors!
+ unreachable
+
+pci_module_init.exit.i.probe_serial_pci.exit_crit_edge: ; preds = %pci_unregister_driver.exit.i.i
+ br label %probe_serial_pci.exit
+
+pci_module_init.exit.i.then.i_crit_edge: ; preds = %pci_unregister_driver.exit.i.i
+ br label %then.i
+
+then.i: ; preds = %pci_module_init.exit.i.then.i_crit_edge, %then.0.i.i12.then.i_crit_edge
+ br label %probe_serial_pci.exit
+
+probe_serial_pci.exit: ; preds = %then.i, %pci_module_init.exit.i.probe_serial_pci.exit_crit_edge, %then.0.i.i12
+ br i1 false, label %then.0.i, label %endif.0.i
+
+then.0.i: ; preds = %probe_serial_pci.exit
+ ret void
+
+endif.0.i: ; preds = %probe_serial_pci.exit
+ br i1 false, label %loopentry.0.i.no_exit.0.i_crit_edge, label %loopentry.0.i.loopexit.0.i_crit_edge
+
+loopentry.0.i: ; No predecessors!
+ unreachable
+
+loopentry.0.i.loopexit.0.i_crit_edge: ; preds = %endif.0.i
+ br label %loopexit.0.i
+
+loopentry.0.i.no_exit.0.i_crit_edge: ; preds = %endif.0.i
+ br label %no_exit.0.i
+
+no_exit.0.i: ; preds = %loopcont.0.i.no_exit.0.i_crit_edge, %loopentry.0.i.no_exit.0.i_crit_edge
+ br i1 false, label %then.1.i, label %endif.1.i
+
+then.1.i: ; preds = %no_exit.0.i
+ br label %loopcont.0.i
+
+endif.1.i: ; preds = %no_exit.0.i
+ br i1 false, label %loopentry.1.i.no_exit.1.i_crit_edge, label %loopentry.1.i.loopexit.1.i_crit_edge
+
+loopentry.1.i: ; No predecessors!
+ unreachable
+
+loopentry.1.i.loopexit.1.i_crit_edge: ; preds = %endif.1.i
+ br label %loopexit.1.i
+
+loopentry.1.i.no_exit.1.i_crit_edge: ; preds = %endif.1.i
+ br label %no_exit.1.i
+
+no_exit.1.i: ; preds = %endif.2.i.no_exit.1.i_crit_edge, %loopentry.1.i.no_exit.1.i_crit_edge
+ br i1 false, label %shortcirc_next.0.i, label %no_exit.1.i.shortcirc_done.0.i_crit_edge
+
+no_exit.1.i.shortcirc_done.0.i_crit_edge: ; preds = %no_exit.1.i
+ br label %shortcirc_done.0.i
+
+shortcirc_next.0.i: ; preds = %no_exit.1.i
+ br label %shortcirc_done.0.i
+
+shortcirc_done.0.i: ; preds = %shortcirc_next.0.i, %no_exit.1.i.shortcirc_done.0.i_crit_edge
+ br i1 false, label %then.2.i, label %endif.2.i
+
+then.2.i: ; preds = %shortcirc_done.0.i
+ br i1 false, label %then.2.i.then.3.i_crit_edge, label %then.2.i.else.i_crit_edge
+
+then.2.i.else.i_crit_edge: ; preds = %then.2.i
+ br label %else.i
+
+then.2.i.then.3.i_crit_edge: ; preds = %then.2.i
+ br label %then.3.i
+
+endif.2.i: ; preds = %shortcirc_done.0.i
+ br i1 false, label %endif.2.i.no_exit.1.i_crit_edge, label %endif.2.i.loopexit.1.i_crit_edge
+
+endif.2.i.loopexit.1.i_crit_edge: ; preds = %endif.2.i
+ br label %loopexit.1.i
+
+endif.2.i.no_exit.1.i_crit_edge: ; preds = %endif.2.i
+ br label %no_exit.1.i
+
+loopexit.1.i: ; preds = %endif.2.i.loopexit.1.i_crit_edge, %loopentry.1.i.loopexit.1.i_crit_edge
+ br i1 false, label %loopexit.1.i.then.3.i_crit_edge, label %loopexit.1.i.else.i_crit_edge
+
+loopexit.1.i.else.i_crit_edge: ; preds = %loopexit.1.i
+ br label %else.i
+
+loopexit.1.i.then.3.i_crit_edge: ; preds = %loopexit.1.i
+ br label %then.3.i
+
+then.3.i: ; preds = %loopexit.1.i.then.3.i_crit_edge, %then.2.i.then.3.i_crit_edge
+ br i1 false, label %shortcirc_next.1.i, label %then.3.i.shortcirc_done.1.i_crit_edge
+
+then.3.i.shortcirc_done.1.i_crit_edge: ; preds = %then.3.i
+ br label %shortcirc_done.1.i
+
+shortcirc_next.1.i: ; preds = %then.3.i
+ br label %shortcirc_done.1.i
+
+shortcirc_done.1.i: ; preds = %shortcirc_next.1.i, %then.3.i.shortcirc_done.1.i_crit_edge
+ br i1 false, label %then.4.i, label %endif.4.i
+
+then.4.i: ; preds = %shortcirc_done.1.i
+ br label %endif.3.i
+
+endif.4.i: ; preds = %shortcirc_done.1.i
+ br label %endif.3.i
+
+else.i: ; preds = %loopexit.1.i.else.i_crit_edge, %then.2.i.else.i_crit_edge
+ br i1 false, label %shortcirc_next.0.i.i, label %else.i.shortcirc_done.0.i.i_crit_edge
+
+else.i.shortcirc_done.0.i.i_crit_edge: ; preds = %else.i
+ br label %shortcirc_done.0.i.i
+
+shortcirc_next.0.i.i: ; preds = %else.i
+ br label %shortcirc_done.0.i.i
+
+shortcirc_done.0.i.i: ; preds = %shortcirc_next.0.i.i, %else.i.shortcirc_done.0.i.i_crit_edge
+ br i1 false, label %shortcirc_next.1.i.i, label %shortcirc_done.0.i.i.shortcirc_done.1.i.i_crit_edge
+
+shortcirc_done.0.i.i.shortcirc_done.1.i.i_crit_edge: ; preds = %shortcirc_done.0.i.i
+ br label %shortcirc_done.1.i.i
+
+shortcirc_next.1.i.i: ; preds = %shortcirc_done.0.i.i
+ br i1 false, label %loopentry.i.i2.i.no_exit.i.i3.i_crit_edge, label %loopentry.i.i2.i.loopexit.i.i.i_crit_edge
+
+loopentry.i.i2.i: ; No predecessors!
+ unreachable
+
+loopentry.i.i2.i.loopexit.i.i.i_crit_edge: ; preds = %shortcirc_next.1.i.i
+ br label %loopexit.i.i.i
+
+loopentry.i.i2.i.no_exit.i.i3.i_crit_edge: ; preds = %shortcirc_next.1.i.i
+ br label %no_exit.i.i3.i
+
+no_exit.i.i3.i: ; preds = %endif.i.i.i.no_exit.i.i3.i_crit_edge, %loopentry.i.i2.i.no_exit.i.i3.i_crit_edge
+ br i1 false, label %shortcirc_next.0.i.i.i, label %no_exit.i.i3.i.shortcirc_done.0.i.i.i_crit_edge
+
+no_exit.i.i3.i.shortcirc_done.0.i.i.i_crit_edge: ; preds = %no_exit.i.i3.i
+ br label %shortcirc_done.0.i.i.i
+
+shortcirc_next.0.i.i.i: ; preds = %no_exit.i.i3.i
+ br label %shortcirc_done.0.i.i.i
+
+shortcirc_done.0.i.i.i: ; preds = %shortcirc_next.0.i.i.i, %no_exit.i.i3.i.shortcirc_done.0.i.i.i_crit_edge
+ br i1 false, label %shortcirc_next.1.i.i.i, label %shortcirc_done.0.i.i.i.shortcirc_done.1.i.i.i_crit_edge
+
+shortcirc_done.0.i.i.i.shortcirc_done.1.i.i.i_crit_edge: ; preds = %shortcirc_done.0.i.i.i
+ br label %shortcirc_done.1.i.i.i
+
+shortcirc_next.1.i.i.i: ; preds = %shortcirc_done.0.i.i.i
+ br label %shortcirc_done.1.i.i.i
+
+shortcirc_done.1.i.i.i: ; preds = %shortcirc_next.1.i.i.i, %shortcirc_done.0.i.i.i.shortcirc_done.1.i.i.i_crit_edge
+ br i1 false, label %then.i.i.i, label %endif.i.i.i
+
+then.i.i.i: ; preds = %shortcirc_done.1.i.i.i
+ br label %then.0.i.i
+
+then.i.i.i.endif.0.i.i_crit_edge: ; No predecessors!
+ unreachable
+
+then.i.i.i.then.0.i.i_crit_edge: ; No predecessors!
+ unreachable
+
+endif.i.i.i: ; preds = %shortcirc_done.1.i.i.i
+ br i1 false, label %endif.i.i.i.no_exit.i.i3.i_crit_edge, label %endif.i.i.i.loopexit.i.i.i_crit_edge
+
+endif.i.i.i.loopexit.i.i.i_crit_edge: ; preds = %endif.i.i.i
+ br label %loopexit.i.i.i
+
+endif.i.i.i.no_exit.i.i3.i_crit_edge: ; preds = %endif.i.i.i
+ br label %no_exit.i.i3.i
+
+loopexit.i.i.i: ; preds = %endif.i.i.i.loopexit.i.i.i_crit_edge, %loopentry.i.i2.i.loopexit.i.i.i_crit_edge
+ br label %shortcirc_done.1.i.i
+
+check_compatible_id.exit.i.i: ; No predecessors!
+ unreachable
+
+shortcirc_done.1.i.i: ; preds = %loopexit.i.i.i, %shortcirc_done.0.i.i.shortcirc_done.1.i.i_crit_edge
+ br i1 false, label %shortcirc_done.1.i.i.then.0.i.i_crit_edge, label %shortcirc_done.1.i.i.endif.0.i.i_crit_edge
+
+shortcirc_done.1.i.i.endif.0.i.i_crit_edge: ; preds = %shortcirc_done.1.i.i
+ br label %endif.0.i.i
+
+shortcirc_done.1.i.i.then.0.i.i_crit_edge: ; preds = %shortcirc_done.1.i.i
+ br label %then.0.i.i
+
+then.0.i.i: ; preds = %shortcirc_done.1.i.i.then.0.i.i_crit_edge, %then.i.i.i
+ br label %then.5.i
+
+then.0.i.i.endif.5.i_crit_edge: ; No predecessors!
+ unreachable
+
+then.0.i.i.then.5.i_crit_edge: ; No predecessors!
+ unreachable
+
+endif.0.i.i: ; preds = %shortcirc_done.1.i.i.endif.0.i.i_crit_edge
+ br i1 false, label %endif.0.i.i.shortcirc_done.2.i.i_crit_edge, label %shortcirc_next.2.i.i
+
+endif.0.i.i.shortcirc_done.2.i.i_crit_edge: ; preds = %endif.0.i.i
+ br label %shortcirc_done.2.i.i
+
+shortcirc_next.2.i.i: ; preds = %endif.0.i.i
+ br label %shortcirc_done.2.i.i
+
+shortcirc_done.2.i.i: ; preds = %shortcirc_next.2.i.i, %endif.0.i.i.shortcirc_done.2.i.i_crit_edge
+ br i1 false, label %then.1.i.i, label %endif.1.i.i
+
+then.1.i.i: ; preds = %shortcirc_done.2.i.i
+ br label %then.5.i
+
+then.1.i.i.endif.5.i_crit_edge: ; No predecessors!
+ unreachable
+
+then.1.i.i.then.5.i_crit_edge: ; No predecessors!
+ unreachable
+
+endif.1.i.i: ; preds = %shortcirc_done.2.i.i
+ br i1 false, label %loopentry.0.i7.i.no_exit.0.i8.i_crit_edge, label %loopentry.0.i7.i.loopexit.0.i11.i_crit_edge
+
+loopentry.0.i7.i: ; No predecessors!
+ unreachable
+
+loopentry.0.i7.i.loopexit.0.i11.i_crit_edge: ; preds = %endif.1.i.i
+ br label %loopexit.0.i11.i
+
+loopentry.0.i7.i.no_exit.0.i8.i_crit_edge: ; preds = %endif.1.i.i
+ br label %no_exit.0.i8.i
+
+no_exit.0.i8.i: ; preds = %loopexit.1.i.i.no_exit.0.i8.i_crit_edge, %loopentry.0.i7.i.no_exit.0.i8.i_crit_edge
+ br i1 false, label %loopentry.1.i9.i.no_exit.1.i10.i_crit_edge, label %loopentry.1.i9.i.loopexit.1.i.i_crit_edge
+
+loopentry.1.i9.i: ; No predecessors!
+ unreachable
+
+loopentry.1.i9.i.loopexit.1.i.i_crit_edge: ; preds = %no_exit.0.i8.i
+ br label %loopexit.1.i.i
+
+loopentry.1.i9.i.no_exit.1.i10.i_crit_edge: ; preds = %no_exit.0.i8.i
+ br label %no_exit.1.i10.i
+
+no_exit.1.i10.i: ; preds = %endif.2.i.i.no_exit.1.i10.i_crit_edge, %loopentry.1.i9.i.no_exit.1.i10.i_crit_edge
+ br i1 false, label %shortcirc_next.3.i.i, label %no_exit.1.i10.i.shortcirc_done.3.i.i_crit_edge
+
+no_exit.1.i10.i.shortcirc_done.3.i.i_crit_edge: ; preds = %no_exit.1.i10.i
+ br label %shortcirc_done.3.i.i
+
+shortcirc_next.3.i.i: ; preds = %no_exit.1.i10.i
+ br i1 false, label %shortcirc_next.3.i.i.shortcirc_done.4.i.i_crit_edge, label %shortcirc_next.4.i.i
+
+shortcirc_next.3.i.i.shortcirc_done.4.i.i_crit_edge: ; preds = %shortcirc_next.3.i.i
+ br label %shortcirc_done.4.i.i
+
+shortcirc_next.4.i.i: ; preds = %shortcirc_next.3.i.i
+ br label %shortcirc_done.4.i.i
+
+shortcirc_done.4.i.i: ; preds = %shortcirc_next.4.i.i, %shortcirc_next.3.i.i.shortcirc_done.4.i.i_crit_edge
+ br i1 false, label %shortcirc_done.4.i.i.shortcirc_done.5.i.i_crit_edge, label %shortcirc_next.5.i.i
+
+shortcirc_done.4.i.i.shortcirc_done.5.i.i_crit_edge: ; preds = %shortcirc_done.4.i.i
+ br label %shortcirc_done.5.i.i
+
+shortcirc_next.5.i.i: ; preds = %shortcirc_done.4.i.i
+ %tmp.68.i.i = icmp eq i16 0, 1000 ; <i1> [#uses=1]
+ br label %shortcirc_done.5.i.i
+
+shortcirc_done.5.i.i: ; preds = %shortcirc_next.5.i.i, %shortcirc_done.4.i.i.shortcirc_done.5.i.i_crit_edge
+ %shortcirc_val.4.i.i = phi i1 [ true, %shortcirc_done.4.i.i.shortcirc_done.5.i.i_crit_edge ], [ %tmp.68.i.i, %shortcirc_next.5.i.i ] ; <i1> [#uses=1]
+ br label %shortcirc_done.3.i.i
+
+shortcirc_done.3.i.i: ; preds = %shortcirc_done.5.i.i, %no_exit.1.i10.i.shortcirc_done.3.i.i_crit_edge
+ %shortcirc_val.5.i.i = phi i1 [ false, %no_exit.1.i10.i.shortcirc_done.3.i.i_crit_edge ], [ %shortcirc_val.4.i.i, %shortcirc_done.5.i.i ] ; <i1> [#uses=1]
+ br i1 %shortcirc_val.5.i.i, label %then.2.i.i, label %endif.2.i.i
+
+then.2.i.i: ; preds = %shortcirc_done.3.i.i
+ %port.2.i.i.8.lcssa20 = phi %struct.isapnp_port* [ null, %shortcirc_done.3.i.i ] ; <%struct.isapnp_port*> [#uses=0]
+ br label %endif.5.i
+
+then.2.i.i.endif.5.i_crit_edge: ; No predecessors!
+ unreachable
+
+then.2.i.i.then.5.i_crit_edge: ; No predecessors!
+ unreachable
+
+endif.2.i.i: ; preds = %shortcirc_done.3.i.i
+ br i1 false, label %endif.2.i.i.no_exit.1.i10.i_crit_edge, label %endif.2.i.i.loopexit.1.i.i_crit_edge
+
+endif.2.i.i.loopexit.1.i.i_crit_edge: ; preds = %endif.2.i.i
+ br label %loopexit.1.i.i
+
+endif.2.i.i.no_exit.1.i10.i_crit_edge: ; preds = %endif.2.i.i
+ br label %no_exit.1.i10.i
+
+loopexit.1.i.i: ; preds = %endif.2.i.i.loopexit.1.i.i_crit_edge, %loopentry.1.i9.i.loopexit.1.i.i_crit_edge
+ br i1 false, label %loopexit.1.i.i.no_exit.0.i8.i_crit_edge, label %loopexit.1.i.i.loopexit.0.i11.i_crit_edge
+
+loopexit.1.i.i.loopexit.0.i11.i_crit_edge: ; preds = %loopexit.1.i.i
+ br label %loopexit.0.i11.i
+
+loopexit.1.i.i.no_exit.0.i8.i_crit_edge: ; preds = %loopexit.1.i.i
+ br label %no_exit.0.i8.i
+
+loopexit.0.i11.i: ; preds = %loopexit.1.i.i.loopexit.0.i11.i_crit_edge, %loopentry.0.i7.i.loopexit.0.i11.i_crit_edge
+ br i1 false, label %serial_pnp_guess_board.exit.i.then.5.i_crit_edge, label %serial_pnp_guess_board.exit.i.endif.5.i_crit_edge
+
+serial_pnp_guess_board.exit.i: ; No predecessors!
+ unreachable
+
+serial_pnp_guess_board.exit.i.endif.5.i_crit_edge: ; preds = %loopexit.0.i11.i
+ br label %endif.5.i
+
+serial_pnp_guess_board.exit.i.then.5.i_crit_edge: ; preds = %loopexit.0.i11.i
+ br label %then.5.i
+
+then.5.i: ; preds = %serial_pnp_guess_board.exit.i.then.5.i_crit_edge, %then.1.i.i, %then.0.i.i
+ br label %loopcont.0.i
+
+endif.5.i: ; preds = %serial_pnp_guess_board.exit.i.endif.5.i_crit_edge, %then.2.i.i
+ br label %endif.3.i
+
+endif.3.i: ; preds = %endif.5.i, %endif.4.i, %then.4.i
+ br i1 false, label %then.6.i, label %endif.3.i.endif.6.i_crit_edge
+
+endif.3.i.endif.6.i_crit_edge: ; preds = %endif.3.i
+ br label %endif.6.i
+
+then.6.i: ; preds = %endif.3.i
+ br label %loopentry.0.i.i
+
+loopentry.0.i.i: ; preds = %endif.i.i, %then.6.i
+ br i1 false, label %loopentry.0.i.i.no_exit.0.i.i_crit_edge, label %loopentry.0.i.i.loopexit.0.i.i_crit_edge
+
+loopentry.0.i.i.loopexit.0.i.i_crit_edge: ; preds = %loopentry.0.i.i
+ br label %loopexit.0.i.i
+
+loopentry.0.i.i.no_exit.0.i.i_crit_edge: ; preds = %loopentry.0.i.i
+ br label %no_exit.0.i.i
+
+no_exit.0.i.i: ; preds = %clear_bit195.exit.i.i.no_exit.0.i.i_crit_edge, %loopentry.0.i.i.no_exit.0.i.i_crit_edge
+ br i1 false, label %then.i.i, label %endif.i.i
+
+then.i.i: ; preds = %no_exit.0.i.i
+ br label %loopentry.i.i.i
+
+loopentry.i.i.i: ; preds = %no_exit.i.i.i, %then.i.i
+ br i1 false, label %no_exit.i.i.i, label %clear_bit195.exit.i.i
+
+no_exit.i.i.i: ; preds = %loopentry.i.i.i
+ br label %loopentry.i.i.i
+
+clear_bit195.exit.i.i: ; preds = %loopentry.i.i.i
+ br i1 false, label %clear_bit195.exit.i.i.no_exit.0.i.i_crit_edge, label %clear_bit195.exit.i.i.loopexit.0.i.i_crit_edge
+
+clear_bit195.exit.i.i.loopexit.0.i.i_crit_edge: ; preds = %clear_bit195.exit.i.i
+ br label %loopexit.0.i.i
+
+clear_bit195.exit.i.i.no_exit.0.i.i_crit_edge: ; preds = %clear_bit195.exit.i.i
+ br label %no_exit.0.i.i
+
+endif.i.i: ; preds = %no_exit.0.i.i
+ br label %loopentry.0.i.i
+
+loopexit.0.i.i: ; preds = %clear_bit195.exit.i.i.loopexit.0.i.i_crit_edge, %loopentry.0.i.i.loopexit.0.i.i_crit_edge
+ br i1 false, label %loopentry.1.i.i.no_exit.1.i.i_crit_edge, label %loopentry.1.i.i.avoid_irq_share.exit.i_crit_edge
+
+loopentry.1.i.i: ; No predecessors!
+ unreachable
+
+loopentry.1.i.i.avoid_irq_share.exit.i_crit_edge: ; preds = %loopexit.0.i.i
+ br label %avoid_irq_share.exit.i
+
+loopentry.1.i.i.no_exit.1.i.i_crit_edge: ; preds = %loopexit.0.i.i
+ br label %no_exit.1.i.i
+
+no_exit.1.i.i: ; preds = %loopexit.2.i.i.no_exit.1.i.i_crit_edge, %loopentry.1.i.i.no_exit.1.i.i_crit_edge
+ br i1 false, label %loopentry.2.i.i.no_exit.2.i.i_crit_edge, label %loopentry.2.i.i.loopexit.2.i.i_crit_edge
+
+loopentry.2.i.i: ; No predecessors!
+ unreachable
+
+loopentry.2.i.i.loopexit.2.i.i_crit_edge: ; preds = %no_exit.1.i.i
+ br label %loopexit.2.i.i
+
+loopentry.2.i.i.no_exit.2.i.i_crit_edge: ; preds = %no_exit.1.i.i
+ br label %no_exit.2.i.i
+
+no_exit.2.i.i: ; preds = %no_exit.2.i.i.no_exit.2.i.i_crit_edge, %loopentry.2.i.i.no_exit.2.i.i_crit_edge
+ br i1 false, label %no_exit.2.i.i.no_exit.2.i.i_crit_edge, label %no_exit.2.i.i.loopexit.2.i.i_crit_edge
+
+no_exit.2.i.i.loopexit.2.i.i_crit_edge: ; preds = %no_exit.2.i.i
+ br label %loopexit.2.i.i
+
+no_exit.2.i.i.no_exit.2.i.i_crit_edge: ; preds = %no_exit.2.i.i
+ br label %no_exit.2.i.i
+
+loopexit.2.i.i: ; preds = %no_exit.2.i.i.loopexit.2.i.i_crit_edge, %loopentry.2.i.i.loopexit.2.i.i_crit_edge
+ br i1 false, label %loopexit.2.i.i.no_exit.1.i.i_crit_edge, label %loopexit.2.i.i.avoid_irq_share.exit.i_crit_edge
+
+loopexit.2.i.i.avoid_irq_share.exit.i_crit_edge: ; preds = %loopexit.2.i.i
+ br label %avoid_irq_share.exit.i
+
+loopexit.2.i.i.no_exit.1.i.i_crit_edge: ; preds = %loopexit.2.i.i
+ br label %no_exit.1.i.i
+
+avoid_irq_share.exit.i: ; preds = %loopexit.2.i.i.avoid_irq_share.exit.i_crit_edge, %loopentry.1.i.i.avoid_irq_share.exit.i_crit_edge
+ br label %endif.6.i
+
+endif.6.i: ; preds = %avoid_irq_share.exit.i, %endif.3.i.endif.6.i_crit_edge
+ br label %loopcont.0.i
+
+loopcont.0.i: ; preds = %endif.6.i, %then.5.i, %then.1.i
+ br i1 false, label %loopcont.0.i.no_exit.0.i_crit_edge, label %loopcont.0.i.loopexit.0.i_crit_edge
+
+loopcont.0.i.loopexit.0.i_crit_edge: ; preds = %loopcont.0.i
+ br label %loopexit.0.i
+
+loopcont.0.i.no_exit.0.i_crit_edge: ; preds = %loopcont.0.i
+ br label %no_exit.0.i
+
+loopexit.0.i: ; preds = %loopcont.0.i.loopexit.0.i_crit_edge, %loopentry.0.i.loopexit.0.i_crit_edge
+ ret void
+
+probe_serial_pnp.exit: ; No predecessors!
+ unreachable
+
+after_ret: ; No predecessors!
+ ret void
+
+return: ; No predecessors!
+ unreachable
+}
diff --git a/test/Transforms/CondProp/2007-08-01-InvalidRead.ll b/test/Transforms/CondProp/2007-08-01-InvalidRead.ll
new file mode 100644
index 000000000000..1e1f8cbc63ff
--- /dev/null
+++ b/test/Transforms/CondProp/2007-08-01-InvalidRead.ll
@@ -0,0 +1,814 @@
+; RUN: llvm-as < %s | opt -inline -tailduplicate -condprop -simplifycfg -disable-output
+; PR1575
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+ %struct.DCTtab = type { i8, i8, i8 }
+ %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+ %struct.VLCtab = type { i8, i8 }
+ %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
+ %struct.layer_data = type { i32, [2048 x i8], i8*, [16 x i8], i32, i8*, i32, i32, [64 x i32], [64 x i32], [64 x i32], [64 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [12 x [64 x i16]] }
+@ld = external global %struct.layer_data* ; <%struct.layer_data**> [#uses=1]
+@System_Stream_Flag = external global i32 ; <i32*> [#uses=0]
+@Fault_Flag = external global i32 ; <i32*> [#uses=2]
+@picture_coding_type = external global i32 ; <i32*> [#uses=1]
+@DCTtabnext = external global [12 x %struct.DCTtab] ; <[12 x %struct.DCTtab]*> [#uses=0]
+@DCTtab0 = external global [60 x %struct.DCTtab] ; <[60 x %struct.DCTtab]*> [#uses=0]
+@DCTtab1 = external global [8 x %struct.DCTtab] ; <[8 x %struct.DCTtab]*> [#uses=0]
+@DCTtab2 = external global [16 x %struct.DCTtab] ; <[16 x %struct.DCTtab]*> [#uses=0]
+@DCTtab3 = external global [16 x %struct.DCTtab] ; <[16 x %struct.DCTtab]*> [#uses=0]
+@DCTtab4 = external global [16 x %struct.DCTtab] ; <[16 x %struct.DCTtab]*> [#uses=0]
+@DCTtab5 = external global [16 x %struct.DCTtab] ; <[16 x %struct.DCTtab]*> [#uses=0]
+@DCTtab6 = external global [16 x %struct.DCTtab] ; <[16 x %struct.DCTtab]*> [#uses=0]
+@Quiet_Flag = external global i32 ; <i32*> [#uses=0]
+@.str = external constant [51 x i8] ; <[51 x i8]*> [#uses=0]
+@stderr = external global %struct.FILE* ; <%struct.FILE**> [#uses=0]
+@.str1 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+@scan = external global [2 x [64 x i8]] ; <[2 x [64 x i8]]*> [#uses=0]
+@DCTtabfirst = external global [12 x %struct.DCTtab] ; <[12 x %struct.DCTtab]*> [#uses=0]
+@.str2 = external constant [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str3 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+@base = external global %struct.layer_data ; <%struct.layer_data*> [#uses=1]
+@enhan = external global %struct.layer_data ; <%struct.layer_data*> [#uses=0]
+@chroma_format = external global i32 ; <i32*> [#uses=2]
+@intra_dc_precision = external global i32 ; <i32*> [#uses=0]
+@intra_vlc_format = external global i32 ; <i32*> [#uses=0]
+@DCTtab0a = external global [252 x %struct.DCTtab] ; <[252 x %struct.DCTtab]*> [#uses=0]
+@DCTtab1a = external global [8 x %struct.DCTtab] ; <[8 x %struct.DCTtab]*> [#uses=0]
+@.str4 = external constant [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str5 = external constant [45 x i8] ; <[45 x i8]*> [#uses=0]
+@.str6 = external constant [44 x i8] ; <[44 x i8]*> [#uses=0]
+@.str7 = external constant [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str8 = external constant [44 x i8] ; <[44 x i8]*> [#uses=0]
+@Temporal_Reference_Base = external global i32 ; <i32*> [#uses=0]
+@True_Framenum_max = external global i32 ; <i32*> [#uses=0]
+@Temporal_Reference_GOP_Reset.b = external global i1 ; <i1*> [#uses=0]
+@frame_rate_Table = external constant [16 x double] ; <[16 x double]*> [#uses=0]
+@.str9 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+@horizontal_size = external global i32 ; <i32*> [#uses=0]
+@vertical_size = external global i32 ; <i32*> [#uses=0]
+@aspect_ratio_information = external global i32 ; <i32*> [#uses=0]
+@frame_rate_code = external global i32 ; <i32*> [#uses=0]
+@bit_rate_value = external global i32 ; <i32*> [#uses=0]
+@.str110 = external constant [18 x i8] ; <[18 x i8]*> [#uses=0]
+@vbv_buffer_size = external global i32 ; <i32*> [#uses=0]
+@constrained_parameters_flag = external global i32 ; <i32*> [#uses=0]
+@default_intra_quantizer_matrix = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@drop_flag = external global i32 ; <i32*> [#uses=0]
+@hour = external global i32 ; <i32*> [#uses=0]
+@minute = external global i32 ; <i32*> [#uses=0]
+@.str211 = external constant [27 x i8] ; <[27 x i8]*> [#uses=0]
+@sec = external global i32 ; <i32*> [#uses=0]
+@frame = external global i32 ; <i32*> [#uses=0]
+@closed_gop = external global i32 ; <i32*> [#uses=0]
+@broken_link = external global i32 ; <i32*> [#uses=0]
+@temporal_reference = external global i32 ; <i32*> [#uses=0]
+@vbv_delay = external global i32 ; <i32*> [#uses=0]
+@full_pel_forward_vector = external global i32 ; <i32*> [#uses=0]
+@forward_f_code = external global i32 ; <i32*> [#uses=0]
+@full_pel_backward_vector = external global i32 ; <i32*> [#uses=0]
+@backward_f_code = external global i32 ; <i32*> [#uses=1]
+@Non_Linear_quantizer_scale = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str312 = external constant [37 x i8] ; <[37 x i8]*> [#uses=0]
+@layer_id = external global i32 ; <i32*> [#uses=0]
+@profile_and_level_indication = external global i32 ; <i32*> [#uses=0]
+@progressive_sequence = external global i32 ; <i32*> [#uses=0]
+@.str413 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0]
+@low_delay = external global i32 ; <i32*> [#uses=0]
+@frame_rate_extension_n = external global i32 ; <i32*> [#uses=0]
+@frame_rate_extension_d = external global i32 ; <i32*> [#uses=0]
+@frame_rate = external global double ; <double*> [#uses=0]
+@profile = external global i32 ; <i32*> [#uses=0]
+@level = external global i32 ; <i32*> [#uses=0]
+@bit_rate = external global double ; <double*> [#uses=0]
+@video_format = external global i32 ; <i32*> [#uses=0]
+@color_description = external global i32 ; <i32*> [#uses=0]
+@color_primaries = external global i32 ; <i32*> [#uses=0]
+@transfer_characteristics = external global i32 ; <i32*> [#uses=0]
+@matrix_coefficients = external global i32 ; <i32*> [#uses=0]
+@display_horizontal_size = external global i32 ; <i32*> [#uses=0]
+@.str514 = external constant [27 x i8] ; <[27 x i8]*> [#uses=0]
+@display_vertical_size = external global i32 ; <i32*> [#uses=0]
+@lower_layer_prediction_horizontal_size = external global i32 ; <i32*> [#uses=0]
+@.str615 = external constant [30 x i8] ; <[30 x i8]*> [#uses=0]
+@lower_layer_prediction_vertical_size = external global i32 ; <i32*> [#uses=0]
+@horizontal_subsampling_factor_m = external global i32 ; <i32*> [#uses=0]
+@horizontal_subsampling_factor_n = external global i32 ; <i32*> [#uses=0]
+@vertical_subsampling_factor_m = external global i32 ; <i32*> [#uses=0]
+@vertical_subsampling_factor_n = external global i32 ; <i32*> [#uses=0]
+@.str716 = external constant [38 x i8] ; <[38 x i8]*> [#uses=0]
+@repeat_first_field = external global i32 ; <i32*> [#uses=0]
+@top_field_first = external global i32 ; <i32*> [#uses=0]
+@picture_structure = external global i32 ; <i32*> [#uses=0]
+@frame_center_horizontal_offset = external global [3 x i32] ; <[3 x i32]*> [#uses=0]
+@.str817 = external constant [44 x i8] ; <[44 x i8]*> [#uses=0]
+@frame_center_vertical_offset = external global [3 x i32] ; <[3 x i32]*> [#uses=0]
+@.str918 = external constant [45 x i8] ; <[45 x i8]*> [#uses=0]
+@f_code = external global [2 x [2 x i32]] ; <[2 x [2 x i32]]*> [#uses=0]
+@frame_pred_frame_dct = external global i32 ; <i32*> [#uses=0]
+@concealment_motion_vectors = external global i32 ; <i32*> [#uses=1]
+@chroma_420_type = external global i32 ; <i32*> [#uses=0]
+@progressive_frame = external global i32 ; <i32*> [#uses=0]
+@composite_display_flag = external global i32 ; <i32*> [#uses=0]
+@v_axis = external global i32 ; <i32*> [#uses=0]
+@field_sequence = external global i32 ; <i32*> [#uses=0]
+@sub_carrier = external global i32 ; <i32*> [#uses=0]
+@burst_amplitude = external global i32 ; <i32*> [#uses=0]
+@sub_carrier_phase = external global i32 ; <i32*> [#uses=0]
+@lower_layer_temporal_reference = external global i32 ; <i32*> [#uses=0]
+@.str10 = external constant [55 x i8] ; <[55 x i8]*> [#uses=0]
+@lower_layer_horizontal_offset = external global i32 ; <i32*> [#uses=0]
+@.str11 = external constant [56 x i8] ; <[56 x i8]*> [#uses=0]
+@lower_layer_vertical_offset = external global i32 ; <i32*> [#uses=0]
+@spatial_temporal_weight_code_table_index = external global i32 ; <i32*> [#uses=0]
+@lower_layer_progressive_frame = external global i32 ; <i32*> [#uses=0]
+@lower_layer_deinterlaced_field_select = external global i32 ; <i32*> [#uses=0]
+@.str12 = external constant [36 x i8] ; <[36 x i8]*> [#uses=0]
+@copyright_flag = external global i32 ; <i32*> [#uses=0]
+@copyright_identifier = external global i32 ; <i32*> [#uses=0]
+@original_or_copy = external global i32 ; <i32*> [#uses=0]
+@.str13 = external constant [40 x i8] ; <[40 x i8]*> [#uses=0]
+@copyright_number_1 = external global i32 ; <i32*> [#uses=0]
+@.str14 = external constant [41 x i8] ; <[41 x i8]*> [#uses=0]
+@copyright_number_2 = external global i32 ; <i32*> [#uses=0]
+@.str15 = external constant [40 x i8] ; <[40 x i8]*> [#uses=0]
+@copyright_number_3 = external global i32 ; <i32*> [#uses=0]
+@Verbose_Flag = external global i32 ; <i32*> [#uses=0]
+@.str16 = external constant [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str17 = external constant [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str18 = external constant [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str19 = external constant [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str20 = external constant [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str21 = external constant [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str22 = external constant [25 x i8] ; <[25 x i8]*> [#uses=0]
+@temporal_reference_old.2592 = external global i32 ; <i32*> [#uses=0]
+@temporal_reference_wrap.2591.b = external global i1 ; <i1*> [#uses=0]
+@True_Framenum = external global i32 ; <i32*> [#uses=0]
+@Second_Field = external global i32 ; <i32*> [#uses=0]
+@.str23 = external constant [29 x i8] ; <[29 x i8]*> [#uses=0]
+@Ersatz_Flag = external global i32 ; <i32*> [#uses=0]
+@mb_width = external global i32 ; <i32*> [#uses=0]
+@mb_height = external global i32 ; <i32*> [#uses=0]
+@Two_Streams = external global i32 ; <i32*> [#uses=0]
+@.str124 = external constant [32 x i8] ; <[32 x i8]*> [#uses=0]
+@stwc_table.2193 = external constant [3 x [4 x i8]] ; <[3 x [4 x i8]]*> [#uses=0]
+@stwclass_table.2194 = external constant [9 x i8] ; <[9 x i8]*> [#uses=0]
+@current_frame = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@Coded_Picture_Width = external global i32 ; <i32*> [#uses=0]
+@Chroma_Width = external global i32 ; <i32*> [#uses=0]
+@Clip = external global i8* ; <i8**> [#uses=0]
+@.str225 = external constant [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str326 = external constant [27 x i8] ; <[27 x i8]*> [#uses=0]
+@block_count = external global i32 ; <i32*> [#uses=1]
+@auxframe = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@forward_reference_frame = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@backward_reference_frame = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@.str427 = external constant [34 x i8] ; <[34 x i8]*> [#uses=0]
+@Newref_progressive_frame.2631 = external global i32 ; <i32*> [#uses=0]
+@Oldref_progressive_frame.2630 = external global i32 ; <i32*> [#uses=0]
+@Reference_IDCT_Flag = external global i32 ; <i32*> [#uses=0]
+@.str528 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str629 = external constant [29 x i8] ; <[29 x i8]*> [#uses=0]
+@.str730 = external constant [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str831 = external constant [32 x i8] ; <[32 x i8]*> [#uses=0]
+@PMBtab0 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@PMBtab1 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@BMBtab0 = external constant [16 x %struct.VLCtab] ; <[16 x %struct.VLCtab]*> [#uses=0]
+@BMBtab1 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@spIMBtab = external constant [16 x %struct.VLCtab] ; <[16 x %struct.VLCtab]*> [#uses=0]
+@spPMBtab0 = external constant [16 x %struct.VLCtab] ; <[16 x %struct.VLCtab]*> [#uses=0]
+@spPMBtab1 = external constant [16 x %struct.VLCtab] ; <[16 x %struct.VLCtab]*> [#uses=0]
+@spBMBtab0 = external constant [14 x %struct.VLCtab] ; <[14 x %struct.VLCtab]*> [#uses=0]
+@spBMBtab1 = external constant [12 x %struct.VLCtab] ; <[12 x %struct.VLCtab]*> [#uses=0]
+@spBMBtab2 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@SNRMBtab = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@MVtab0 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@MVtab1 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@MVtab2 = external constant [12 x %struct.VLCtab] ; <[12 x %struct.VLCtab]*> [#uses=0]
+@CBPtab0 = external constant [32 x %struct.VLCtab] ; <[32 x %struct.VLCtab]*> [#uses=0]
+@CBPtab1 = external constant [64 x %struct.VLCtab] ; <[64 x %struct.VLCtab]*> [#uses=0]
+@CBPtab2 = external constant [8 x %struct.VLCtab] ; <[8 x %struct.VLCtab]*> [#uses=0]
+@MBAtab1 = external constant [16 x %struct.VLCtab] ; <[16 x %struct.VLCtab]*> [#uses=0]
+@MBAtab2 = external constant [104 x %struct.VLCtab] ; <[104 x %struct.VLCtab]*> [#uses=0]
+@DClumtab0 = external constant [32 x %struct.VLCtab] ; <[32 x %struct.VLCtab]*> [#uses=0]
+@DClumtab1 = external constant [16 x %struct.VLCtab] ; <[16 x %struct.VLCtab]*> [#uses=0]
+@DCchromtab0 = external constant [32 x %struct.VLCtab] ; <[32 x %struct.VLCtab]*> [#uses=0]
+@DCchromtab1 = external constant [32 x %struct.VLCtab] ; <[32 x %struct.VLCtab]*> [#uses=0]
+@.str32 = external constant [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str133 = external constant [29 x i8] ; <[29 x i8]*> [#uses=0]
+@global_pic = external global i32 ; <i32*> [#uses=0]
+@global_MBA = external global i32 ; <i32*> [#uses=0]
+@.str1648 = external constant [45 x i8] ; <[45 x i8]*> [#uses=0]
+@.str1749 = external constant [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str1850 = external constant [42 x i8] ; <[42 x i8]*> [#uses=0]
+@iclp = external global i16* ; <i16**> [#uses=0]
+@iclip = external global [1024 x i16] ; <[1024 x i16]*> [#uses=0]
+@c = external global [8 x [8 x double]] ; <[8 x [8 x double]]*> [#uses=0]
+@Version = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@Author = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@Inverse_Table_6_9 = external global [8 x [4 x i32]] ; <[8 x [4 x i32]]*> [#uses=0]
+@Main_Bitstream_Filename = external global i8* ; <i8**> [#uses=0]
+@.str51 = external constant [36 x i8] ; <[36 x i8]*> [#uses=0]
+@Error_Text = external global [256 x i8] ; <[256 x i8]*> [#uses=0]
+@.str152 = external constant [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str253 = external constant [33 x i8] ; <[33 x i8]*> [#uses=0]
+@Enhancement_Layer_Bitstream_Filename = external global i8* ; <i8**> [#uses=0]
+@.str354 = external constant [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str455 = external constant [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str556 = external constant [30 x i8] ; <[30 x i8]*> [#uses=0]
+@Coded_Picture_Height = external global i32 ; <i32*> [#uses=0]
+@Chroma_Height = external global i32 ; <i32*> [#uses=0]
+@Table_6_20.3737 = external constant [3 x i32] ; <[3 x i32]*> [#uses=0]
+@.str657 = external constant [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str758 = external constant [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str859 = external constant [26 x i8] ; <[26 x i8]*> [#uses=0]
+@substitute_frame = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@.str960 = external constant [34 x i8] ; <[34 x i8]*> [#uses=0]
+@llframe0 = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@.str1061 = external constant [24 x i8] ; <[24 x i8]*> [#uses=0]
+@llframe1 = external global [3 x i8*] ; <[3 x i8*]*> [#uses=0]
+@.str1162 = external constant [24 x i8] ; <[24 x i8]*> [#uses=0]
+@lltmp = external global i16* ; <i16**> [#uses=0]
+@.str1263 = external constant [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str1364 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str1465 = external constant [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str1566 = external constant [1195 x i8] ; <[1195 x i8]*> [#uses=0]
+@Output_Type = external global i32 ; <i32*> [#uses=0]
+@Main_Bitstream_Flag = external global i32 ; <i32*> [#uses=0]
+@.str1667 = external constant [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str1768 = external constant [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str1869 = external constant [39 x i8] ; <[39 x i8]*> [#uses=0]
+@Frame_Store_Flag = external global i32 ; <i32*> [#uses=0]
+@Big_Picture_Flag = external global i32 ; <i32*> [#uses=0]
+@.str1970 = external constant [49 x i8] ; <[49 x i8]*> [#uses=0]
+@Spatial_Flag = external global i32 ; <i32*> [#uses=0]
+@.str2071 = external constant [39 x i8] ; <[39 x i8]*> [#uses=0]
+@Lower_Layer_Picture_Filename = external global i8* ; <i8**> [#uses=0]
+@Output_Picture_Filename = external global i8* ; <i8**> [#uses=0]
+@.str2172 = external constant [1 x i8] ; <[1 x i8]*> [#uses=0]
+@.str2273 = external constant [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str2374 = external constant [49 x i8] ; <[49 x i8]*> [#uses=0]
+@User_Data_Flag = external global i32 ; <i32*> [#uses=0]
+@.str24 = external constant [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str25 = external constant [39 x i8] ; <[39 x i8]*> [#uses=0]
+@Substitute_Picture_Filename = external global i8* ; <i8**> [#uses=0]
+@.str26 = external constant [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str27 = external constant [55 x i8] ; <[55 x i8]*> [#uses=0]
+@Display_Progressive_Flag = external global i32 ; <i32*> [#uses=0]
+@.str28 = external constant [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str29 = external constant [2 x i8] ; <[2 x i8]*> [#uses=0]
+@hiQdither = external global i32 ; <i32*> [#uses=0]
+@Trace_Flag = external global i32 ; <i32*> [#uses=0]
+@Verify_Flag = external global i32 ; <i32*> [#uses=0]
+@Stats_Flag = external global i32 ; <i32*> [#uses=0]
+@Decode_Layer = external global i32 ; <i32*> [#uses=0]
+@.str75 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0]
+@C.53.2124 = external constant [3 x [3 x i8]] ; <[3 x [3 x i8]]*> [#uses=0]
+@.str76 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@C.60.2169 = external constant [3 x [3 x i8]] ; <[3 x [3 x i8]]*> [#uses=0]
+@.str77 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str178 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str279 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str380 = external constant [11 x i8] ; <[11 x i8]*> [#uses=0]
+@outfile = external global i32 ; <i32*> [#uses=0]
+@.str481 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0]
+@optr = external global i8* ; <i8**> [#uses=0]
+@obfr = external global [4096 x i8] ; <[4096 x i8]*> [#uses=0]
+@.str582 = external constant [35 x i8] ; <[35 x i8]*> [#uses=0]
+@u422.3075 = external global i8* ; <i8**> [#uses=0]
+@v422.3076 = external global i8* ; <i8**> [#uses=0]
+@.str683 = external constant [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str784 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@u444.3185 = external global i8* ; <i8**> [#uses=0]
+@v444.3186 = external global i8* ; <i8**> [#uses=0]
+@u422.3183 = external global i8* ; <i8**> [#uses=0]
+@v422.3184 = external global i8* ; <i8**> [#uses=0]
+@.str885 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str986 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@tga24.3181 = external constant [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str1087 = external constant [14 x i8] ; <[14 x i8]*> [#uses=0]
+@bgate.2952.b = external global i1 ; <i1*> [#uses=0]
+@previous_temporal_reference.2947 = external global i32 ; <i32*> [#uses=0]
+@previous_picture_coding_type.2951 = external global i32 ; <i32*> [#uses=0]
+@previous_anchor_temporal_reference.2949 = external global i32 ; <i32*> [#uses=0]
+@.str88 = external constant [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str189 = external constant [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str290 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str391 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str492 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str593 = external constant [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str694 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str795 = external constant [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str896 = external constant [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str97 = external constant [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str198 = external constant [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str299 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+
+declare void @Initialize_Buffer()
+
+declare void @Fill_Buffer()
+
+declare i32 @read(...)
+
+declare i32 @Get_Byte()
+
+declare i32 @Get_Word()
+
+declare i32 @Show_Bits(i32)
+
+declare i32 @Get_Bits1()
+
+declare void @Flush_Buffer(i32)
+
+declare void @Next_Packet()
+
+declare i32 @Get_Bits(i32)
+
+declare void @Decode_MPEG1_Intra_Block(i32, i32*)
+
+declare i32 @Get_Luma_DC_dct_diff()
+
+declare i32 @Get_Chroma_DC_dct_diff()
+
+declare i32 @puts(i8*)
+
+declare i32 @fwrite(i8*, i32, i32, i8*)
+
+declare void @Decode_MPEG1_Non_Intra_Block(i32)
+
+declare void @Decode_MPEG2_Intra_Block(i32, i32*)
+
+declare void @Decode_MPEG2_Non_Intra_Block(i32)
+
+declare i32 @Get_Hdr()
+
+declare i32 @Get_Bits32()
+
+declare i32 @fprintf(%struct.FILE*, i8*, ...)
+
+declare void @next_start_code()
+
+declare fastcc void @sequence_header()
+
+define internal fastcc void @group_of_pictures_header() {
+entry:
+ ret void
+}
+
+define internal fastcc void @picture_header() {
+entry:
+ unreachable
+}
+
+declare i32 @slice_header()
+
+declare fastcc void @extension_and_user_data()
+
+declare void @Flush_Buffer32()
+
+declare fastcc void @sequence_extension()
+
+declare fastcc void @sequence_display_extension()
+
+declare fastcc void @quant_matrix_extension()
+
+declare fastcc void @sequence_scalable_extension()
+
+declare void @Error(i8*)
+
+declare fastcc void @picture_display_extension()
+
+declare fastcc void @picture_coding_extension()
+
+declare fastcc void @picture_spatial_scalable_extension()
+
+declare fastcc void @picture_temporal_scalable_extension()
+
+declare fastcc void @extra_bit_information()
+
+declare void @marker_bit(i8*)
+
+declare fastcc void @user_data()
+
+declare fastcc void @copyright_extension()
+
+declare i32 @printf(i8*, ...)
+
+declare fastcc void @Update_Temporal_Reference_Tacking_Data()
+
+define void @Decode_Picture(i32 %bitstream_framenum, i32 %sequence_framenum) {
+entry:
+ %tmp16 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp16, label %bb43, label %bb22
+
+bb22: ; preds = %entry
+ ret void
+
+bb43: ; preds = %entry
+ call fastcc void @picture_data( )
+ ret void
+}
+
+declare void @Substitute_Frame_Buffer(i32, i32)
+
+define void @Spatial_Prediction() {
+entry:
+ ret void
+}
+
+define internal fastcc void @picture_data() {
+entry:
+ %tmp4 = icmp eq i32 0, 3 ; <i1> [#uses=1]
+ br i1 %tmp4, label %bb8, label %bb
+
+bb: ; preds = %entry
+ ret void
+
+bb8: ; preds = %entry
+ %tmp11 = call fastcc i32 @slice( i32 0 ) ; <i32> [#uses=0]
+ ret void
+}
+
+define internal fastcc i32 @slice(i32 %MBAmax) {
+entry:
+ %tmp6 = icmp eq i32 0, 1 ; <i1> [#uses=1]
+ br i1 %tmp6, label %bb9, label %bb231
+
+bb9: ; preds = %entry
+ %tmp11 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp11, label %bb27, label %bb17
+
+bb17: ; preds = %bb9
+ ret i32 0
+
+bb27: ; preds = %bb9
+ %tmp31 = icmp slt i32 0, %MBAmax ; <i1> [#uses=1]
+ br i1 %tmp31, label %bb110, label %bb231
+
+resync: ; preds = %bb139
+ ret i32 0
+
+bb110: ; preds = %bb27
+ %tmp113 = icmp slt i32 0, %MBAmax ; <i1> [#uses=1]
+ br i1 %tmp113, label %bb131, label %bb119
+
+bb119: ; preds = %bb110
+ ret i32 0
+
+bb131: ; preds = %bb110
+ %tmp133 = icmp eq i32 0, 1 ; <i1> [#uses=1]
+ br i1 %tmp133, label %bb139, label %bb166
+
+bb139: ; preds = %bb131
+ %tmp144 = call fastcc i32 @decode_macroblock( i32* null, i32* null, i32* null, i32* null, i32* null, [2 x [2 x i32]]* null, i32* null, [2 x i32]* null, i32* null ) ; <i32> [#uses=1]
+ switch i32 %tmp144, label %bb166 [
+ i32 -1, label %bb231
+ i32 0, label %resync
+ ]
+
+bb166: ; preds = %bb139, %bb131
+ ret i32 0
+
+bb231: ; preds = %bb139, %bb27, %entry
+ ret i32 0
+}
+
+declare i32 @Get_macroblock_address_increment()
+
+declare fastcc void @macroblock_modes(i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32*)
+
+declare i32 @Get_macroblock_type()
+
+declare fastcc void @Add_Block(i32, i32, i32, i32, i32)
+
+declare fastcc void @Decode_SNR_Macroblock(i32*, i32*, i32, i32, i32*)
+
+declare i32 @Get_coded_block_pattern()
+
+declare fastcc void @Clear_Block(i32)
+
+declare fastcc void @Sum_Block(i32)
+
+declare fastcc void @Saturate(i16*)
+
+declare fastcc void @Update_Picture_Buffers()
+
+declare void @Output_Last_Frame_of_Sequence(i32)
+
+declare void @Write_Frame(i8**, i32)
+
+declare fastcc void @frame_reorder(i32, i32)
+
+declare fastcc void @motion_compensation(i32, i32, i32, [2 x [2 x i32]]*, [2 x i32]*, i32*, i32, i32)
+
+declare void @form_predictions(i32, i32, i32, i32, [2 x [2 x i32]]*, [2 x i32]*, i32*, i32)
+
+declare void @Reference_IDCT(i16*)
+
+declare void @Fast_IDCT(i16*)
+
+declare fastcc void @skipped_macroblock(i32*, [2 x [2 x i32]]*, i32*, [2 x i32]*, i32*, i32*)
+
+declare fastcc i32 @start_of_slice(i32*, i32*, i32*, [2 x [2 x i32]]*)
+
+define internal fastcc i32 @decode_macroblock(i32* %macroblock_type, i32* %stwtype, i32* %stwclass, i32* %motion_type, i32* %dct_type, [2 x [2 x i32]]* %PMV, i32* %dc_dct_pred, [2 x i32]* %motion_vertical_field_select, i32* %dmvector) {
+entry:
+ %tmp3 = icmp eq i32 0, 1 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb, label %bb15
+
+bb: ; preds = %entry
+ %tmp7 = icmp slt i32 0, 3 ; <i1> [#uses=1]
+ br i1 %tmp7, label %bb13, label %bb14
+
+bb13: ; preds = %bb
+ br label %bb15
+
+bb14: ; preds = %bb
+ ret i32 0
+
+bb15: ; preds = %bb13, %entry
+ %tmp21 = load i32* @Fault_Flag, align 4 ; <i32> [#uses=1]
+ %tmp22 = icmp eq i32 %tmp21, 0 ; <i1> [#uses=1]
+ br i1 %tmp22, label %bb29, label %bb630
+
+bb29: ; preds = %bb15
+ %tmp33 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp33, label %bb91, label %bb39
+
+bb39: ; preds = %bb29
+ ret i32 0
+
+bb91: ; preds = %bb29
+ %tmp94 = and i32 0, 8 ; <i32> [#uses=0]
+ %tmp121 = load %struct.layer_data** @ld, align 4 ; <%struct.layer_data*> [#uses=0]
+ %tmp123 = load i32* null ; <i32> [#uses=1]
+ %tmp124 = icmp eq i32 %tmp123, 0 ; <i1> [#uses=1]
+ br i1 %tmp124, label %bb146, label %bb130
+
+bb130: ; preds = %bb91
+ call void @motion_vectors( [2 x [2 x i32]]* %PMV, i32* %dmvector, [2 x i32]* %motion_vertical_field_select, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 )
+ br label %bb157
+
+bb146: ; preds = %bb91
+ br label %bb157
+
+bb157: ; preds = %bb146, %bb130
+ %tmp159 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp159, label %bb166, label %bb630
+
+bb166: ; preds = %bb157
+ %tmp180 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp180, label %bb201, label %bb186
+
+bb186: ; preds = %bb166
+ br label %bb212
+
+bb201: ; preds = %bb166
+ %tmp205 = load i32* @backward_f_code, align 4 ; <i32> [#uses=0]
+ br label %bb212
+
+bb212: ; preds = %bb201, %bb186
+ %tmp214 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp214, label %bb221, label %bb630
+
+bb221: ; preds = %bb212
+ %tmp22422511 = and i32 0, 1 ; <i32> [#uses=1]
+ %toBool226 = icmp eq i32 %tmp22422511, 0 ; <i1> [#uses=1]
+ br i1 %toBool226, label %bb239, label %bb230
+
+bb230: ; preds = %bb221
+ ret i32 0
+
+bb239: ; preds = %bb221
+ %tmp241 = load i32* getelementptr (%struct.layer_data* @base, i32 0, i32 17), align 4 ; <i32> [#uses=0]
+ %tmp262 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp262, label %bb296, label %bb268
+
+bb268: ; preds = %bb239
+ %tmp270 = load i32* @chroma_format, align 4 ; <i32> [#uses=1]
+ %tmp271 = icmp eq i32 %tmp270, 2 ; <i1> [#uses=1]
+ br i1 %tmp271, label %bb277, label %bb282
+
+bb277: ; preds = %bb268
+ br label %bb312
+
+bb282: ; preds = %bb268
+ %tmp283 = load i32* @chroma_format, align 4 ; <i32> [#uses=0]
+ br label %bb312
+
+bb296: ; preds = %bb239
+ %tmp298 = load i32* %macroblock_type ; <i32> [#uses=1]
+ %tmp2993009 = and i32 %tmp298, 1 ; <i32> [#uses=1]
+ %toBool301 = icmp eq i32 %tmp2993009, 0 ; <i1> [#uses=1]
+ br i1 %toBool301, label %bb312, label %bb305
+
+bb305: ; preds = %bb296
+ %tmp306 = load i32* @block_count, align 4 ; <i32> [#uses=0]
+ %tmp308 = add i32 0, -1 ; <i32> [#uses=0]
+ br label %bb312
+
+bb312: ; preds = %bb305, %bb296, %bb282, %bb277
+ %tmp313 = load i32* @Fault_Flag, align 4 ; <i32> [#uses=1]
+ %tmp314 = icmp eq i32 %tmp313, 0 ; <i1> [#uses=1]
+ br i1 %tmp314, label %bb398, label %bb630
+
+bb346: ; preds = %cond_true404
+ %toBool351 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ %tmp359 = icmp ne i32 0, 0 ; <i1> [#uses=2]
+ br i1 %toBool351, label %bb372, label %bb355
+
+bb355: ; preds = %bb346
+ br i1 %tmp359, label %bb365, label %bb368
+
+bb365: ; preds = %bb355
+ br label %bb386
+
+bb368: ; preds = %bb355
+ call void @Decode_MPEG1_Intra_Block( i32 0, i32* %dc_dct_pred )
+ br label %bb386
+
+bb372: ; preds = %bb346
+ br i1 %tmp359, label %bb382, label %bb384
+
+bb382: ; preds = %bb372
+ br label %bb386
+
+bb384: ; preds = %bb372
+ call void @Decode_MPEG1_Non_Intra_Block( i32 0 )
+ br label %bb386
+
+bb386: ; preds = %bb384, %bb382, %bb368, %bb365
+ %tmp388 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp388, label %bb395, label %bb630
+
+bb395: ; preds = %cond_true404, %bb386
+ %tmp397 = add i32 0, 1 ; <i32> [#uses=0]
+ ret i32 0
+
+bb398: ; preds = %bb312
+ %tmp401 = icmp slt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp401, label %cond_true404, label %bb407
+
+cond_true404: ; preds = %bb398
+ %tmp340341514 = and i32 0, 0 ; <i32> [#uses=1]
+ %toBool342 = icmp eq i32 %tmp340341514, 0 ; <i1> [#uses=1]
+ br i1 %toBool342, label %bb395, label %bb346
+
+bb407: ; preds = %bb398
+ %tmp408 = load i32* @picture_coding_type, align 4 ; <i32> [#uses=0]
+ %tmp419 = load i32* %macroblock_type ; <i32> [#uses=1]
+ %tmp420 = and i32 %tmp419, 1 ; <i32> [#uses=1]
+ %tmp421 = icmp eq i32 %tmp420, 0 ; <i1> [#uses=0]
+ %tmp442 = load i32* %macroblock_type ; <i32> [#uses=1]
+ %tmp4434447 = and i32 %tmp442, 1 ; <i32> [#uses=0]
+ %tmp450 = load i32* @concealment_motion_vectors, align 4 ; <i32> [#uses=0]
+ %tmp572 = icmp eq i32 0, 4 ; <i1> [#uses=1]
+ br i1 %tmp572, label %bb578, label %bb630
+
+bb578: ; preds = %bb407
+ %tmp613 = getelementptr [2 x [2 x i32]]* %PMV, i32 1, i32 1, i32 1 ; <i32*> [#uses=0]
+ %tmp618 = getelementptr [2 x [2 x i32]]* %PMV, i32 1, i32 1, i32 0 ; <i32*> [#uses=0]
+ %tmp623 = getelementptr [2 x [2 x i32]]* %PMV, i32 0, i32 1, i32 1 ; <i32*> [#uses=0]
+ %tmp628 = getelementptr [2 x [2 x i32]]* %PMV, i32 0, i32 1, i32 0 ; <i32*> [#uses=0]
+ ret i32 1
+
+bb630: ; preds = %bb407, %bb386, %bb312, %bb212, %bb157, %bb15
+ %tmp.0 = phi i32 [ 0, %bb15 ], [ 0, %bb157 ], [ 0, %bb212 ], [ 0, %bb312 ], [ 0, %bb386 ], [ 1, %bb407 ] ; <i32> [#uses=1]
+ ret i32 %tmp.0
+}
+
+declare void @motion_vectors([2 x [2 x i32]]*, i32*, [2 x i32]*, i32, i32, i32, i32, i32, i32, i32)
+
+declare void @motion_vector(i32*, i32*, i32, i32, i32, i32, i32)
+
+declare fastcc i32 @Get_I_macroblock_type()
+
+declare fastcc i32 @Get_P_macroblock_type()
+
+declare fastcc i32 @Get_B_macroblock_type()
+
+declare fastcc void @Get_D_macroblock_type()
+
+declare fastcc i32 @Get_I_Spatial_macroblock_type()
+
+declare fastcc i32 @Get_P_Spatial_macroblock_type()
+
+declare fastcc i32 @Get_B_Spatial_macroblock_type()
+
+declare fastcc i32 @Get_SNR_macroblock_type()
+
+declare i32 @Get_motion_code()
+
+declare i32 @Get_dmvector()
+
+declare fastcc void @idctrow(i16*)
+
+declare fastcc void @idctcol(i16*)
+
+declare void @Initialize_Fast_IDCT()
+
+declare void @Initialize_Reference_IDCT()
+
+declare double @cos(double)
+
+declare double @floor(double)
+
+declare fastcc void @decode_motion_vector(i32*, i32, i32, i32, i32)
+
+declare void @Dual_Prime_Arithmetic([2 x i32]*, i32*, i32, i32)
+
+declare i32 @main(i32, i8**)
+
+declare i32 @open(i8*, i32, ...)
+
+declare void @exit(i32)
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+declare i32 @lseek(i32, i32, i32)
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+declare i32 @close(i32)
+
+declare fastcc void @Initialize_Decoder()
+
+declare fastcc void @Initialize_Sequence()
+
+declare void @Print_Bits(i32, i32, i32)
+
+declare fastcc void @Process_Options(i32, i8**)
+
+declare i32 @toupper(i32)
+
+declare i32 @atoi(i8*)
+
+declare fastcc i32 @Headers()
+
+declare fastcc void @Decode_Bitstream()
+
+declare fastcc void @Deinitialize_Sequence()
+
+declare fastcc i32 @video_sequence(i32*)
+
+declare void @Clear_Options()
+
+declare fastcc void @form_prediction(i8**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)
+
+declare fastcc void @form_component_prediction(i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32)
+
+declare fastcc void @Read_Lower_Layer_Component_Framewise(i32, i32, i32)
+
+declare i8* @strcat(i8*, i8*)
+
+declare %struct.FILE* @fopen(i8*, i8*)
+
+declare i32 @_IO_getc(%struct.FILE*)
+
+declare i32 @fclose(%struct.FILE*)
+
+declare fastcc void @Read_Lower_Layer_Component_Fieldwise(i32, i32, i32)
+
+declare fastcc void @Make_Spatial_Prediction_Frame(i32, i32, i8*, i8*, i16*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)
+
+declare fastcc void @Deinterlace(i8*, i8*, i32, i32, i32, i32)
+
+declare fastcc void @Subsample_Vertical(i8*, i16*, i32, i32, i32, i32, i32, i32, i32)
+
+declare fastcc void @Subsample_Horizontal(i16*, i8*, i32, i32, i32, i32, i32, i32, i32)
+
+declare fastcc void @store_one(i8*, i8**, i32, i32, i32)
+
+declare fastcc void @store_yuv(i8*, i8**, i32, i32, i32)
+
+declare fastcc void @store_yuv1(i8*, i8*, i32, i32, i32, i32)
+
+declare i32 @write(...)
+
+declare fastcc void @store_sif(i8*, i8**, i32, i32, i32)
+
+declare fastcc void @store_ppm_tga(i8*, i8**, i32, i32, i32, i32)
+
+declare fastcc void @putbyte(i32)
+
+declare fastcc void @putword(i32)
+
+declare fastcc void @conv422to444(i8*, i8*)
+
+declare fastcc void @conv420to422(i8*, i8*)
+
+declare fastcc void @Read_Frame(i8*, i8**, i32)
+
+declare fastcc i32 @Read_Components(i8*, i32)
+
+declare fastcc void @Read_Component(i8*, i8*, i32, i32)
+
+declare fastcc i32 @Extract_Components(i8*, i32)
+
+declare i32 @fseek(%struct.FILE*, i32, i32)
+
+declare i32 @fread(i8*, i32, i32, %struct.FILE*)
+
+declare fastcc void @Copy_Frame(i8*, i8*, i32, i32, i32, i32)
+
+declare i32 @Get_Long()
diff --git a/test/Transforms/CondProp/2009-01-25-SingleEntryPHI.ll b/test/Transforms/CondProp/2009-01-25-SingleEntryPHI.ll
new file mode 100644
index 000000000000..d14ce38f3df2
--- /dev/null
+++ b/test/Transforms/CondProp/2009-01-25-SingleEntryPHI.ll
@@ -0,0 +1,37 @@
+; RUN: llvm-as < %s | opt -condprop | llvm-dis
+; PR3405
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+ br label %bb2
+
+bb2: ; preds = %bb.bb2_crit_edge, %entry
+ br i1 false, label %bb5.thread2, label %bb
+
+bb: ; preds = %bb2
+ br i1 false, label %bb3, label %bb.bb2_crit_edge
+
+bb.bb2_crit_edge: ; preds = %bb
+ br label %bb2
+
+bb3: ; preds = %bb
+ %.lcssa4 = phi i1 [ false, %bb ] ; <i1> [#uses=1]
+ br i1 %.lcssa4, label %bb5.thread, label %bb6
+
+bb5.thread: ; preds = %bb3
+ br label %bb7
+
+bb7: ; preds = %bb5.thread2, %bb5.thread
+ br label %UnifiedReturnBlock
+
+bb6: ; preds = %bb3
+ br label %UnifiedReturnBlock
+
+bb5.thread2: ; preds = %bb2
+ br label %bb7
+
+UnifiedReturnBlock: ; preds = %bb6, %bb7
+ ret i32 0
+}
diff --git a/test/Transforms/CondProp/basictest-dbg.ll b/test/Transforms/CondProp/basictest-dbg.ll
new file mode 100644
index 000000000000..d8a680b89841
--- /dev/null
+++ b/test/Transforms/CondProp/basictest-dbg.ll
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -condprop | llvm-dis | \
+; RUN: not grep {br label}
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+
+define i32 @test(i1 %C) {
+ br i1 %C, label %T1, label %F1
+
+T1: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %Cont
+
+F1: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %Cont
+
+Cont: ; preds = %F1, %T1
+ %C2 = phi i1 [ false, %F1 ], [ true, %T1 ] ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %C2, label %T2, label %F2
+
+T2: ; preds = %Cont
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @bar( )
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret i32 17
+
+F2: ; preds = %Cont
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret i32 1
+}
+
+declare void @bar()
+
diff --git a/test/Transforms/CondProp/basictest.ll b/test/Transforms/CondProp/basictest.ll
new file mode 100644
index 000000000000..317247caf585
--- /dev/null
+++ b/test/Transforms/CondProp/basictest.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -condprop | llvm-dis | \
+; RUN: not grep {br label}
+; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep T2
+
+
+define i32 @test(i1 %C) {
+ br i1 %C, label %T1, label %F1
+
+T1: ; preds = %0
+ br label %Cont
+
+F1: ; preds = %0
+ br label %Cont
+
+Cont: ; preds = %F1, %T1
+ %C2 = phi i1 [ false, %F1 ], [ true, %T1 ] ; <i1> [#uses=1]
+ br i1 %C2, label %T2, label %F2
+
+T2: ; preds = %Cont
+ call void @bar( )
+ ret i32 17
+
+F2: ; preds = %Cont
+ ret i32 1
+}
+
+declare void @bar()
+
diff --git a/test/Transforms/CondProp/dg.exp b/test/Transforms/CondProp/dg.exp
new file mode 100644
index 000000000000..39954d8a498d
--- /dev/null
+++ b/test/Transforms/CondProp/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll}]]
diff --git a/test/Transforms/CondProp/phisimplify.ll b/test/Transforms/CondProp/phisimplify.ll
new file mode 100644
index 000000000000..5b5a3042eb62
--- /dev/null
+++ b/test/Transforms/CondProp/phisimplify.ll
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep phi
+
+define i32 @test(i32 %C, i1 %Val) {
+ switch i32 %C, label %T1 [
+ i32 4, label %T2
+ i32 17, label %T3
+ ]
+
+T1: ; preds = %0
+ call void @a( )
+ br label %Cont
+
+T2: ; preds = %0
+ call void @b( )
+ br label %Cont
+
+T3: ; preds = %0
+ call void @c( )
+ br label %Cont
+
+Cont: ; preds = %T3, %T2, %T1
+ ;; PHI becomes dead after threading T2
+ %C2 = phi i1 [ %Val, %T1 ], [ true, %T2 ], [ %Val, %T3 ] ; <i1> [#uses=1]
+ br i1 %C2, label %L2, label %F2
+
+L2: ; preds = %Cont
+ call void @d( )
+ ret i32 17
+
+F2: ; preds = %Cont
+ call void @e( )
+ ret i32 1
+}
+
+declare void @a()
+
+declare void @b()
+
+declare void @c()
+
+declare void @d()
+
+declare void @e()
diff --git a/test/Transforms/CondProp/phisimplify2.ll b/test/Transforms/CondProp/phisimplify2.ll
new file mode 100644
index 000000000000..03d12e3e4c97
--- /dev/null
+++ b/test/Transforms/CondProp/phisimplify2.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep phi
+
+declare i1 @foo()
+
+define i32 @test(i32 %C) {
+ %Val = call i1 @foo( ) ; <i1> [#uses=2]
+ switch i32 %C, label %T1 [
+ i32 4, label %T2
+ i32 17, label %T3
+ ]
+
+T1: ; preds = %0
+ call void @a( )
+ br label %Cont
+
+T2: ; preds = %0
+ call void @b( )
+ br label %Cont
+
+T3: ; preds = %0
+ call void @c( )
+ br label %Cont
+
+Cont: ; preds = %T3, %T2, %T1
+ ;; PHI becomes dead after threading T2
+ %C2 = phi i1 [ %Val, %T1 ], [ true, %T2 ], [ %Val, %T3 ] ; <i1> [#uses=1]
+ br i1 %C2, label %L2, label %F2
+
+L2: ; preds = %Cont
+ call void @d( )
+ ret i32 17
+
+F2: ; preds = %Cont
+ call void @e( )
+ ret i32 1
+}
+
+declare void @a()
+
+declare void @b()
+
+declare void @c()
+
+declare void @d()
+
+declare void @e()
diff --git a/test/Transforms/CondProp/phisimplify3.ll b/test/Transforms/CondProp/phisimplify3.ll
new file mode 100644
index 000000000000..16785971e3cc
--- /dev/null
+++ b/test/Transforms/CondProp/phisimplify3.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep phi
+
+define i32 @foo(i1, i32, i32) {
+prologue:
+ br i1 %0, label %eq, label %ne
+
+eq: ; preds = %prologue
+ store i32 0, i32* inttoptr (i32 10000 to i32*)
+ %3 = icmp eq i32 %1, %2 ; <i1> [#uses=1]
+ br label %join
+
+ne: ; preds = %prologue
+ %4 = icmp ne i32 %1, %2 ; <i1> [#uses=1]
+ br label %join
+
+join: ; preds = %ne, %eq
+ %5 = phi i1 [ %3, %eq ], [ %4, %ne ] ; <i1> [#uses=1]
+ br i1 %5, label %yes, label %no
+
+yes: ; preds = %join
+ store i32 0, i32* inttoptr (i32 20000 to i32*)
+ ret i32 5
+
+no: ; preds = %join
+ ret i32 20
+}
diff --git a/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll b/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll
new file mode 100644
index 000000000000..1a0845c52ac0
--- /dev/null
+++ b/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll
@@ -0,0 +1,15 @@
+; Make sure that the constant propogator doesn't divide by zero!
+;
+; RUN: llvm-as < %s | opt -constprop
+;
+
+define i32 @test() {
+ %R = sdiv i32 12, 0 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test2() {
+ %R = srem i32 12, 0 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
diff --git a/test/Transforms/ConstProp/2002-05-03-NotOperator.ll b/test/Transforms/ConstProp/2002-05-03-NotOperator.ll
new file mode 100644
index 000000000000..7a281aa04b67
--- /dev/null
+++ b/test/Transforms/ConstProp/2002-05-03-NotOperator.ll
@@ -0,0 +1,19 @@
+; This bug has to do with the fact that constant propogation was implemented in
+; terms of _logical_ not (! in C) instead of _bitwise_ not (~ in C). This was
+; due to a spec change.
+
+; Fix #2: The unary not instruction now no longer exists. Change to xor.
+
+; RUN: llvm-as < $test | opt -constprop | llvm-dis | \
+; RUN: not grep {i32 0}
+
+define i32 @test1() {
+ %R = xor i32 123, -1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test2() {
+ %R = xor i32 -123, -1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
diff --git a/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll b/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll
new file mode 100644
index 000000000000..781d796506c8
--- /dev/null
+++ b/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll
@@ -0,0 +1,20 @@
+; SetCC on boolean values was not implemented!
+
+; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | \
+; RUN: not grep set
+
+define i1 @test1() {
+ %A = icmp ule i1 true, false ; <i1> [#uses=1]
+ %B = icmp uge i1 true, false ; <i1> [#uses=1]
+ %C = icmp ult i1 false, true ; <i1> [#uses=1]
+ %D = icmp ugt i1 true, false ; <i1> [#uses=1]
+ %E = icmp eq i1 false, false ; <i1> [#uses=1]
+ %F = icmp ne i1 false, true ; <i1> [#uses=1]
+ %G = and i1 %A, %B ; <i1> [#uses=1]
+ %H = and i1 %C, %D ; <i1> [#uses=1]
+ %I = and i1 %E, %F ; <i1> [#uses=1]
+ %J = and i1 %G, %H ; <i1> [#uses=1]
+ %K = and i1 %I, %J ; <i1> [#uses=1]
+ ret i1 %K
+}
+
diff --git a/test/Transforms/ConstProp/2003-05-12-DivideError.ll b/test/Transforms/ConstProp/2003-05-12-DivideError.ll
new file mode 100644
index 000000000000..a3f239f95bd4
--- /dev/null
+++ b/test/Transforms/ConstProp/2003-05-12-DivideError.ll
@@ -0,0 +1,15 @@
+; Make sure that the constant propagator doesn't cause a sigfpe
+;
+; RUN: llvm-as < %s | opt -constprop
+;
+
+define i32 @test() {
+ %R = sdiv i32 -2147483648, -1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test2() {
+ %R = srem i32 -2147483648, -1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
diff --git a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll
new file mode 100644
index 000000000000..9ffbcd1b0ce1
--- /dev/null
+++ b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
+; RUN: not grep {ret i1 false}
+
+@b = external global [2 x { }] ; <[2 x { }]*> [#uses=2]
+
+define i1 @f() {
+ %tmp.2 = icmp eq { }* getelementptr ([2 x { }]* @b, i32 0, i32 0), getelementptr ([2 x { }]* @b, i32 0, i32 1) ; <i1> [#uses=1]
+ ret i1 %tmp.2
+}
+
diff --git a/test/Transforms/ConstProp/2006-11-30-vector-cast.ll b/test/Transforms/ConstProp/2006-11-30-vector-cast.ll
new file mode 100644
index 000000000000..812cbcfa6277
--- /dev/null
+++ b/test/Transforms/ConstProp/2006-11-30-vector-cast.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
+; RUN: grep {i32 -1}
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
+; RUN: not grep zeroinitializer
+
+define <4 x i32> @test() {
+ %tmp40 = bitcast <2 x i64> bitcast (<4 x i32> < i32 0, i32 0, i32 -1, i32 0 > to <2 x i64>) to <4 x i32>; <<4 x i32>> [#uses=1]
+ ret <4 x i32> %tmp40
+}
+
diff --git a/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll b/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll
new file mode 100644
index 000000000000..889ef56bf9c6
--- /dev/null
+++ b/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i1 false}
+define i1 @test() {
+ %X = trunc i32 320 to i1 ; <i1> [#uses=1]
+ ret i1 %X
+}
+
diff --git a/test/Transforms/ConstProp/2006-12-01-bool-casts.ll b/test/Transforms/ConstProp/2006-12-01-bool-casts.ll
new file mode 100644
index 000000000000..dd1e46d8c6fc
--- /dev/null
+++ b/test/Transforms/ConstProp/2006-12-01-bool-casts.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
+; RUN: grep {ret i32 -1}
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
+; RUN: grep {ret i32 1}
+
+define i32 @test1() {
+ %A = sext i1 true to i32 ; <i32> [#uses=1]
+ ret i32 %A
+}
+
+define i32 @test2() {
+ %A = zext i1 true to i32 ; <i32> [#uses=1]
+ ret i32 %A
+}
+
diff --git a/test/Transforms/ConstProp/2007-02-05-BitCast.ll b/test/Transforms/ConstProp/2007-02-05-BitCast.ll
new file mode 100644
index 000000000000..a1d7c3e0377c
--- /dev/null
+++ b/test/Transforms/ConstProp/2007-02-05-BitCast.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | grep 1065353216
+
+define i32 @test() {
+ %A = bitcast float 1.000000e+00 to i32 ; <i32> [#uses=1]
+ ret i32 %A
+}
+
diff --git a/test/Transforms/ConstProp/2007-02-23-sdiv.ll b/test/Transforms/ConstProp/2007-02-23-sdiv.ll
new file mode 100644
index 000000000000..721199fc7f14
--- /dev/null
+++ b/test/Transforms/ConstProp/2007-02-23-sdiv.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | llvm-dis | grep {global i32 0}
+; PR1215
+
+@G = global i32 sdiv (i32 0, i32 -1)
+
diff --git a/test/Transforms/ConstProp/2007-11-23-cttz.ll b/test/Transforms/ConstProp/2007-11-23-cttz.ll
new file mode 100644
index 000000000000..995ce2febf87
--- /dev/null
+++ b/test/Transforms/ConstProp/2007-11-23-cttz.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | grep {ret i13 13}
+; PR1816
+declare i13 @llvm.cttz.i13(i13)
+
+define i13 @test() {
+ %X = call i13 @llvm.cttz.i13(i13 0)
+ ret i13 %X
+}
diff --git a/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll b/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll
new file mode 100644
index 000000000000..4c7146320485
--- /dev/null
+++ b/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -constprop -disable-output
+; PR2529
+define <4 x i32> @test1(i32 %argc, i8** %argv) {
+entry:
+ %foo = vicmp slt <4 x i32> undef, <i32 14, i32 undef, i32 undef, i32 undef>
+ ret <4 x i32> %foo
+}
+
+define <4 x i32> @test2(i32 %argc, i8** %argv) {
+entry:
+ %foo = vicmp slt <4 x i32> <i32 undef, i32 undef, i32 undef, i32
+undef>, <i32 undef, i32 undef, i32 undef, i32 undef>
+ ret <4 x i32> %foo
+}
+
+
+define <4 x i32> @test3() {
+ %foo = vfcmp ueq <4 x float> <float 0.0, float 0.0, float 0.0, float
+undef>, <float 1.0, float 1.0, float 1.0, float undef>
+ ret <4 x i32> %foo
+}
+
+define <4 x i32> @test4() {
+ %foo = vfcmp ueq <4 x float> <float 0.0, float 0.0, float 0.0, float 0.0>, <float 1.0, float 1.0, float 1.0, float 0.0>
+
+ ret <4 x i32> %foo
+}
+
diff --git a/test/Transforms/ConstProp/basictest.ll b/test/Transforms/ConstProp/basictest.ll
new file mode 100644
index 000000000000..56892d93186f
--- /dev/null
+++ b/test/Transforms/ConstProp/basictest.ll
@@ -0,0 +1,20 @@
+; This is a basic sanity check for constant propogation. The add instruction
+; should be eliminated.
+
+; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep add
+
+define i32 @test(i1 %B) {
+ br i1 %B, label %BB1, label %BB2
+
+BB1: ; preds = %0
+ %Val = add i32 0, 0 ; <i32> [#uses=1]
+ br label %BB3
+
+BB2: ; preds = %0
+ br label %BB3
+
+BB3: ; preds = %BB2, %BB1
+ %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ; <i32> [#uses=1]
+ ret i32 %Ret
+}
+
diff --git a/test/Transforms/ConstProp/bitcast.ll b/test/Transforms/ConstProp/bitcast.ll
new file mode 100644
index 000000000000..bf943c971f3a
--- /dev/null
+++ b/test/Transforms/ConstProp/bitcast.ll
@@ -0,0 +1,2 @@
+; RUN: llvm-as < %s | llvm-dis | grep 0x36A0000000000000
+@A = global float 0x36A0000000000000 ; <float*> [#uses=0]
diff --git a/test/Transforms/ConstProp/bitcast2.ll b/test/Transforms/ConstProp/bitcast2.ll
new file mode 100644
index 000000000000..66def7f49da2
--- /dev/null
+++ b/test/Transforms/ConstProp/bitcast2.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+; PR2165
+
+define <1 x i64> @test() {
+ %A = bitcast i64 63 to <1 x i64>
+ ret <1 x i64> %A
+}
+
diff --git a/test/Transforms/ConstProp/bswap.ll b/test/Transforms/ConstProp/bswap.ll
new file mode 100644
index 000000000000..49758271046e
--- /dev/null
+++ b/test/Transforms/ConstProp/bswap.ll
@@ -0,0 +1,25 @@
+; bswap should be constant folded when it is passed a constant argument
+
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep call
+
+declare i16 @llvm.bswap.i16(i16)
+
+declare i32 @llvm.bswap.i32(i32)
+
+declare i64 @llvm.bswap.i64(i64)
+
+define i16 @W() {
+ %Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1]
+ ret i16 %Z
+}
+
+define i32 @X() {
+ %Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i64 @Y() {
+ %Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1]
+ ret i64 %Z
+}
+
diff --git a/test/Transforms/ConstProp/calls.ll b/test/Transforms/ConstProp/calls.ll
new file mode 100644
index 000000000000..126db4ca2313
--- /dev/null
+++ b/test/Transforms/ConstProp/calls.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep call
+
+declare double @cos(double)
+
+declare double @sin(double)
+
+declare double @tan(double)
+
+declare double @sqrt(double)
+
+declare i1 @llvm.isunordered.f64(double, double)
+
+define double @T() {
+ %A = call double @cos( double 0.000000e+00 ) ; <double> [#uses=1]
+ %B = call double @sin( double 0.000000e+00 ) ; <double> [#uses=1]
+ %a = add double %A, %B ; <double> [#uses=1]
+ %C = call double @tan( double 0.000000e+00 ) ; <double> [#uses=1]
+ %b = add double %a, %C ; <double> [#uses=1]
+ %D = call double @sqrt( double 4.000000e+00 ) ; <double> [#uses=1]
+ %c = add double %b, %D ; <double> [#uses=1]
+ ret double %c
+}
+
+define i1 @TNAN() {
+ %A = fcmp uno double 0x7FF8000000000000, 1.000000e+00 ; <i1> [#uses=1]
+ %B = fcmp uno double 1.230000e+02, 1.000000e+00 ; <i1> [#uses=1]
+ %C = or i1 %A, %B ; <i1> [#uses=1]
+ ret i1 %C
+}
+
diff --git a/test/Transforms/ConstProp/dg.exp b/test/Transforms/ConstProp/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/ConstProp/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/ConstProp/float-to-ptr-cast.ll b/test/Transforms/ConstProp/float-to-ptr-cast.ll
new file mode 100644
index 000000000000..cbf84f54f0a2
--- /dev/null
+++ b/test/Transforms/ConstProp/float-to-ptr-cast.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -constprop | llvm-dis | \
+; RUN: grep -F {ret i32* null} | count 2
+
+define i32* @test1() {
+ %X = inttoptr i64 0 to i32* ; <i32*> [#uses=1]
+ ret i32* %X
+}
+
+define i32* @test2() {
+ ret i32* null
+}
+
diff --git a/test/Transforms/ConstProp/logicaltest.ll b/test/Transforms/ConstProp/logicaltest.ll
new file mode 100644
index 000000000000..81bdb950e9fc
--- /dev/null
+++ b/test/Transforms/ConstProp/logicaltest.ll
@@ -0,0 +1,35 @@
+; Ensure constant propogation of logical instructions is working correctly.
+
+; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | \
+; RUN: not egrep {and|or|xor}
+
+define i32 @test1() {
+ %R = and i32 4, 1234 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i1 @test1.upgrd.1() {
+ %R = and i1 true, false ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i32 @test2() {
+ %R = or i32 4, 1234 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i1 @test2.upgrd.2() {
+ %R = or i1 true, false ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i32 @test3() {
+ %R = xor i32 4, 1234 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i1 @test3.upgrd.3() {
+ %R = xor i1 true, false ; <i1> [#uses=1]
+ ret i1 %R
+}
+
diff --git a/test/Transforms/ConstProp/nottest.ll b/test/Transforms/ConstProp/nottest.ll
new file mode 100644
index 000000000000..41ea1b387304
--- /dev/null
+++ b/test/Transforms/ConstProp/nottest.ll
@@ -0,0 +1,19 @@
+; Ensure constant propogation of 'not' instructions is working correctly.
+
+; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep xor
+
+define i32 @test1() {
+ %R = xor i32 4, -1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test2() {
+ %R = xor i32 -23, -1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i1 @test3() {
+ %R = xor i1 true, true ; <i1> [#uses=1]
+ ret i1 %R
+}
+
diff --git a/test/Transforms/ConstProp/phi.ll b/test/Transforms/ConstProp/phi.ll
new file mode 100644
index 000000000000..858c0becb148
--- /dev/null
+++ b/test/Transforms/ConstProp/phi.ll
@@ -0,0 +1,17 @@
+; This is a basic sanity check for constant propogation. The add instruction
+; should be eliminated.
+
+; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep phi
+
+define i32 @test(i1 %B) {
+BB0:
+ br i1 %B, label %BB1, label %BB3
+
+BB1: ; preds = %BB0
+ br label %BB3
+
+BB3: ; preds = %BB1, %BB0
+ %Ret = phi i32 [ 1, %BB0 ], [ 1, %BB1 ] ; <i32> [#uses=1]
+ ret i32 %Ret
+}
+
diff --git a/test/Transforms/ConstProp/remtest.ll b/test/Transforms/ConstProp/remtest.ll
new file mode 100644
index 000000000000..11861a4e8093
--- /dev/null
+++ b/test/Transforms/ConstProp/remtest.ll
@@ -0,0 +1,24 @@
+; Ensure constant propagation of remainder instructions is working correctly.
+
+; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep rem
+
+define i32 @test1() {
+ %R = srem i32 4, 3 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test2() {
+ %R = srem i32 123, -23 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define float @test3() {
+ %R = frem float 0x4028E66660000000, 0x405ECDA1C0000000 ; <float> [#uses=1]
+ ret float %R
+}
+
+define double @test4() {
+ %R = frem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C ; <double> [#uses=1]
+ ret double %R
+}
+
diff --git a/test/Transforms/ConstantMerge/2002-09-23-CPR-Update.ll b/test/Transforms/ConstantMerge/2002-09-23-CPR-Update.ll
new file mode 100644
index 000000000000..658944de23f8
--- /dev/null
+++ b/test/Transforms/ConstantMerge/2002-09-23-CPR-Update.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -constmerge > /dev/null
+
+@foo.upgrd.1 = internal constant { i32 } { i32 7 } ; <{ i32 }*> [#uses=1]
+@bar = internal constant { i32 } { i32 7 } ; <{ i32 }*> [#uses=1]
+
+declare i32 @test(i32*)
+
+define void @foo() {
+ call i32 @test( i32* getelementptr ({ i32 }* @foo.upgrd.1, i64 0, i32 0) ) ; <i32>:1 [#uses=0]
+ call i32 @test( i32* getelementptr ({ i32 }* @bar, i64 0, i32 0) ) ; <i32>:2 [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll b/test/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll
new file mode 100644
index 000000000000..9a9c3ddf0ab1
--- /dev/null
+++ b/test/Transforms/ConstantMerge/2003-10-28-MergeExternalConstants.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | opt -constmerge | llvm-dis | %prcontext foo 2 | grep bar
+
+@foo = constant i32 6 ; <i32*> [#uses=0]
+@bar = constant i32 6 ; <i32*> [#uses=0]
+
diff --git a/test/Transforms/ConstantMerge/2006-03-07-DontMergeDiffSections.ll b/test/Transforms/ConstantMerge/2006-03-07-DontMergeDiffSections.ll
new file mode 100644
index 000000000000..a621b594ca05
--- /dev/null
+++ b/test/Transforms/ConstantMerge/2006-03-07-DontMergeDiffSections.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -constmerge | llvm-dis | grep foo
+; RUN: llvm-as < %s | opt -constmerge | llvm-dis | grep bar
+
+; Don't merge constants in different sections.
+
+@G1 = internal constant i32 1, section "foo" ; <i32*> [#uses=1]
+@G2 = internal constant i32 1, section "bar" ; <i32*> [#uses=1]
+@G3 = internal constant i32 1, section "bar" ; <i32*> [#uses=1]
+
+define void @test(i32** %P1, i32** %P2, i32** %P3) {
+ store i32* @G1, i32** %P1
+ store i32* @G2, i32** %P2
+ store i32* @G3, i32** %P3
+ ret void
+}
+
diff --git a/test/Transforms/ConstantMerge/dg.exp b/test/Transforms/ConstantMerge/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/ConstantMerge/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/DeadArgElim/2006-06-27-struct-ret.ll b/test/Transforms/DeadArgElim/2006-06-27-struct-ret.ll
new file mode 100644
index 000000000000..0d86800c780a
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2006-06-27-struct-ret.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -deadargelim -disable-output
+
+define internal void @build_delaunay({ i32 }* sret %agg.result) {
+ ret void
+}
+
+define void @test() {
+ call void @build_delaunay( { i32 }* sret null )
+ ret void
+}
+
diff --git a/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll b/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll
new file mode 100644
index 000000000000..2b3a2ea247a2
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2007-02-07-FuncRename.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | grep {@test(}
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep dead
+
+define internal i32 @test(i32 %X, i32 %dead) {
+ ret i32 %X
+}
+
+define i32 @caller() {
+ %A = call i32 @test(i32 123, i32 456)
+ ret i32 %A
+}
diff --git a/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll b/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll
new file mode 100644
index 000000000000..2a09b76c35b4
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep {ret i32 0}
+; PR1735
+
+define internal i32 @test(i32 %A, ...) {
+ ret i32 %A
+}
+
+define i32 @foo() {
+ %A = call i32(i32, ...)* @test(i32 1)
+ ret i32 %A
+}
+
diff --git a/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll b/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll
new file mode 100644
index 000000000000..47a85ea78c3e
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
+; RUN: cat %t | grep nounwind | count 2
+; RUN: cat %t | grep signext | count 2
+; RUN: cat %t | not grep inreg
+; RUN: cat %t | not grep zeroext
+; RUN: cat %t | not grep byval
+
+ %struct = type { }
+
+@g = global i8 0
+
+define internal i8 @foo(i8* inreg %p, i8 signext %y, ... ) zeroext nounwind {
+ store i8 %y, i8* @g
+ ret i8 0
+}
+
+define i32 @bar() {
+ %A = call i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) zeroext nounwind
+ ret i32 0
+}
diff --git a/test/Transforms/DeadArgElim/2008-01-16-VarargsParamAttrs.ll b/test/Transforms/DeadArgElim/2008-01-16-VarargsParamAttrs.ll
new file mode 100644
index 000000000000..96cddf1fd3a1
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2008-01-16-VarargsParamAttrs.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | grep byval
+
+ %struct.point = type { double, double }
+@pts = global [4 x %struct.point] [ %struct.point { double 1.000000e+00, double 2.000000e+00 }, %struct.point { double 3.000000e+00, double 4.000000e+00 }, %struct.point { double 5.000000e+00, double 6.000000e+00 }, %struct.point { double 7.000000e+00, double 8.000000e+00 } ], align 32 ; <[4 x %struct.point]*> [#uses=1]
+
+define internal i32 @va1(i32 %nargs, ...) {
+entry:
+ %pi = alloca %struct.point ; <%struct.point*> [#uses=0]
+ %args = alloca i8* ; <i8**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %args1 = bitcast i8** %args to i8* ; <i8*> [#uses=1]
+ call void @llvm.va_start( i8* %args1 )
+ %args41 = bitcast i8** %args to i8* ; <i8*> [#uses=1]
+ call void @llvm.va_end( i8* %args41 )
+ ret i32 undef
+}
+
+declare void @llvm.va_start(i8*) nounwind
+
+declare void @llvm.va_end(i8*) nounwind
+
+define i32 @main() {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp = getelementptr [4 x %struct.point]* @pts, i32 0, i32 0 ; <%struct.point*> [#uses=1]
+ %tmp1 = call i32 (i32, ...)* @va1( i32 1, %struct.point* byval %tmp ) nounwind ; <i32> [#uses=0]
+ call void @exit( i32 0 ) noreturn nounwind
+ unreachable
+}
+
+declare void @exit(i32) noreturn nounwind
diff --git a/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll b/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll
new file mode 100644
index 000000000000..2c9416049a78
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t
+; RUN: cat %t | grep 123
+
+; This test tries to catch wrongful removal of return values for a specific case
+; that was break llvm-gcc builds.
+
+; This function has a live return value, it is used by @alive.
+define internal i32 @test5() {
+ ret i32 123
+}
+
+; This function doesn't use the return value @test5 and tries to lure DAE into
+; marking @test5's return value dead because only this call is unused.
+define i32 @dead() {
+ %DEAD = call i32 @test5()
+ ret i32 0
+}
+
+; This function ensures the retval of @test5 is live.
+define i32 @alive() {
+ %LIVE = call i32 @test5()
+ ret i32 %LIVE
+}
diff --git a/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll b/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll
new file mode 100644
index 000000000000..f5f2ce18b6c5
--- /dev/null
+++ b/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis
+; PR3807
+
+define internal { i32, i32 } @foo() {
+ ret {i32,i32} {i32 42, i32 4}
+}
+
+define i32 @bar() {
+ %x = invoke {i32,i32} @foo() to label %T unwind label %T2
+T:
+ %y = extractvalue {i32,i32} %x, 1
+ ret i32 %y
+T2:
+ unreachable
+}
+
+define i32 @bar2() {
+entry:
+ %x = invoke {i32,i32} @foo() to label %T unwind label %T2
+T:
+ %PN = phi i32 [0, %entry]
+ %y = extractvalue {i32,i32} %x, 1
+ ret i32 %y
+T2:
+ unreachable
+} \ No newline at end of file
diff --git a/test/Transforms/DeadArgElim/basictest.ll b/test/Transforms/DeadArgElim/basictest.ll
new file mode 100644
index 000000000000..5f68f9859652
--- /dev/null
+++ b/test/Transforms/DeadArgElim/basictest.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep DEADARG
+
+; test - an obviously dead argument
+define internal i32 @test(i32 %v, i32 %DEADARG1, i32* %p) {
+ store i32 %v, i32* %p
+ ret i32 %v
+}
+
+; hardertest - an argument which is only used by a call of a function with a
+; dead argument.
+define internal i32 @hardertest(i32 %DEADARG2) {
+ %p = alloca i32 ; <i32*> [#uses=1]
+ %V = call i32 @test( i32 5, i32 %DEADARG2, i32* %p ) ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+; evenhardertest - recursive dead argument...
+define internal void @evenhardertest(i32 %DEADARG3) {
+ call void @evenhardertest( i32 %DEADARG3 )
+ ret void
+}
+
+define internal void @needarg(i32 %TEST) {
+ call i32 @needarg2( i32 %TEST ) ; <i32>:1 [#uses=0]
+ ret void
+}
+
+define internal i32 @needarg2(i32 %TEST) {
+ ret i32 %TEST
+}
+
+define internal void @needarg3(i32 %TEST3) {
+ call void @needarg( i32 %TEST3 )
+ ret void
+}
+
diff --git a/test/Transforms/DeadArgElim/canon.ll b/test/Transforms/DeadArgElim/canon.ll
new file mode 100644
index 000000000000..b8adb713a7af
--- /dev/null
+++ b/test/Transforms/DeadArgElim/canon.ll
@@ -0,0 +1,24 @@
+; This test shows a few canonicalizations made by deadargelim
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
+; This test should remove {} and replace it with void
+; RUN: cat %t | grep {define internal void @test}
+; This test shouls replace the {i32} return value with just i32
+; RUN: cat %t | grep {define internal i32 @test2}
+
+define internal {} @test() {
+ ret {} undef
+}
+
+define internal {i32} @test2() {
+ ret {i32} undef;
+}
+
+define void @caller() {
+ call {} @test()
+ %X = call {i32} @test2();
+ %Y = extractvalue {i32} %X, 0
+ call void @user(i32 %Y, {i32} %X)
+ ret void
+}
+
+declare void @user(i32, {i32})
diff --git a/test/Transforms/DeadArgElim/dead_vaargs.ll b/test/Transforms/DeadArgElim/dead_vaargs.ll
new file mode 100644
index 000000000000..a4444bc102af
--- /dev/null
+++ b/test/Transforms/DeadArgElim/dead_vaargs.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep 47
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep 1.0
+
+define i32 @bar(i32 %A) {
+ %tmp4 = tail call i32 (i32, ...)* @foo( i32 %A, i32 %A, i32 %A, i32 %A, i64 47, double 1.000000e+00 ) ; <i32> [#uses=1]
+ ret i32 %tmp4
+}
+
+define internal i32 @foo(i32 %X, ...) {
+ ret i32 %X
+}
+
diff --git a/test/Transforms/DeadArgElim/deadretval.ll b/test/Transforms/DeadArgElim/deadretval.ll
new file mode 100644
index 000000000000..5395290978b1
--- /dev/null
+++ b/test/Transforms/DeadArgElim/deadretval.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep DEAD
+
+; Dead arg only used by dead retval
+define internal i32 @test(i32 %DEADARG) {
+ ret i32 %DEADARG
+}
+
+define i32 @test2(i32 %A) {
+ %DEAD = call i32 @test( i32 %A ) ; <i32> [#uses=0]
+ ret i32 123
+}
+
+define i32 @test3() {
+ %X = call i32 @test2( i32 3232 ) ; <i32> [#uses=1]
+ %Y = add i32 %X, -123 ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/DeadArgElim/deadretval2.ll b/test/Transforms/DeadArgElim/deadretval2.ll
new file mode 100644
index 000000000000..316d7555e927
--- /dev/null
+++ b/test/Transforms/DeadArgElim/deadretval2.ll
@@ -0,0 +1,59 @@
+; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis > %t
+; RUN: cat %t | not grep DEAD
+; RUN: cat %t | grep LIVE | count 4
+
+@P = external global i32 ; <i32*> [#uses=1]
+
+; Dead arg only used by dead retval
+define internal i32 @test(i32 %DEADARG) {
+ ret i32 %DEADARG
+}
+
+define internal i32 @test2(i32 %DEADARG) {
+ %DEADRETVAL = call i32 @test( i32 %DEADARG ) ; <i32> [#uses=1]
+ ret i32 %DEADRETVAL
+}
+
+define void @test3(i32 %X) {
+ %DEADRETVAL = call i32 @test2( i32 %X ) ; <i32> [#uses=0]
+ ret void
+}
+
+define internal i32 @foo() {
+ %DEAD = load i32* @P ; <i32> [#uses=1]
+ ret i32 %DEAD
+}
+
+define internal i32 @id(i32 %X) {
+ ret i32 %X
+}
+
+define void @test4() {
+ %DEAD = call i32 @foo( ) ; <i32> [#uses=1]
+ %DEAD2 = call i32 @id( i32 %DEAD ) ; <i32> [#uses=0]
+ ret void
+}
+
+; These test if returning another functions return value properly marks that
+; other function's return value as live. We do this twice, with the functions in
+; different orders (ie, first the caller, than the callee and first the callee
+; and then the caller) since DAE processes functions one by one and handles
+; these cases slightly different.
+
+define internal i32 @test5() {
+ ret i32 123
+}
+
+define i32 @test6() {
+ %LIVE = call i32 @test5()
+ ret i32 %LIVE
+}
+
+define i32 @test7() {
+ %LIVE = call i32 @test8()
+ ret i32 %LIVE
+}
+
+define internal i32 @test8() {
+ ret i32 124
+}
diff --git a/test/Transforms/DeadArgElim/dg.exp b/test/Transforms/DeadArgElim/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/DeadArgElim/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/DeadArgElim/keepalive.ll b/test/Transforms/DeadArgElim/keepalive.ll
new file mode 100644
index 000000000000..899ebd93a469
--- /dev/null
+++ b/test/Transforms/DeadArgElim/keepalive.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
+; RUN: grep {define internal zeroext i32 @test1() nounwind} %t
+; RUN: grep {define internal %Ty @test2} %t
+
+%Ty = type <{ i32, i32 }>
+
+; Check if the pass doesn't modify anything that doesn't need changing. We feed
+; an unused argument to each function to lure it into changing _something_ about
+; the function and then changing too much.
+
+; This checks if the return value attributes are not removed
+define internal zeroext i32 @test1(i32 %DEADARG1) nounwind {
+ ret i32 1
+}
+
+; This checks if the struct doesn't get non-packed
+define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
+ ret <{ i32, i32 }> <{ i32 1, i32 2 }>
+}
+
+; We use this external function to make sure the return values don't become dead
+declare void @user(i32, <{ i32, i32 }>)
+
+define void @caller() {
+ %B = call i32 @test1(i32 1)
+ %C = call <{ i32, i32 }> @test2(i32 2)
+ call void @user(i32 %B, <{ i32, i32 }> %C)
+ ret void
+}
+
diff --git a/test/Transforms/DeadArgElim/multdeadretval.ll b/test/Transforms/DeadArgElim/multdeadretval.ll
new file mode 100644
index 000000000000..6e0474a6f8d2
--- /dev/null
+++ b/test/Transforms/DeadArgElim/multdeadretval.ll
@@ -0,0 +1,68 @@
+; This test sees if return values (and arguments) are properly removed when they
+; are unused. All unused values are typed i16, so we can easily check. We also
+; run instcombine to fold insert/extractvalue chains and we run dce to clean up
+; any remaining dead stuff.
+; RUN: llvm-as < %s | opt -deadargelim -instcombine -dce | llvm-dis | not grep i16
+
+define internal {i16, i32} @test(i16 %DEADARG) {
+ %A = insertvalue {i16,i32} undef, i16 1, 0
+ %B = insertvalue {i16,i32} %A, i32 1001, 1
+ ret {i16,i32} %B
+}
+
+define internal {i32, i16} @test2() {
+ %DEAD = call i16 @test4()
+ %A = insertvalue {i32,i16} undef, i32 1, 0
+ %B = insertvalue {i32,i16} %A, i16 %DEAD, 1
+ ret {i32,i16} %B
+}
+
+; Dead argument, used to check if the second result of test2 is dead even when
+; it's used as a dead argument
+define internal i32 @test3(i16 %A) {
+ %ret = call {i16, i32} @test( i16 %A ) ; <i32> [#uses=0]
+ %DEAD = extractvalue {i16, i32} %ret, 0
+ %LIVE = extractvalue {i16, i32} %ret, 1
+ ret i32 %LIVE
+}
+
+define internal i16 @test4() {
+ ret i16 0
+}
+
+; Multiple return values, multiple live return values
+define internal {i32, i32, i16} @test5() {
+ %A = insertvalue {i32,i32,i16} undef, i32 1, 0
+ %B = insertvalue {i32,i32,i16} %A, i32 2, 1
+ %C = insertvalue {i32,i32,i16} %B, i16 3, 2
+ ret {i32, i32, i16} %C
+}
+
+; Nested return values
+define internal {{i32}, {i16, i16}} @test6() {
+ %A = insertvalue {{i32}, {i16, i16}} undef, i32 1, 0, 0
+ %B = insertvalue {{i32}, {i16, i16}} %A, i16 2, 1, 0
+ %C = insertvalue {{i32}, {i16, i16}} %B, i16 3, 1, 1
+ ret {{i32}, {i16, i16}} %C
+}
+
+define i32 @main() {
+ %ret = call {i32, i16} @test2() ; <i32> [#uses=1]
+ %LIVE = extractvalue {i32, i16} %ret, 0
+ %DEAD = extractvalue {i32, i16} %ret, 1
+ %Y = add i32 %LIVE, -123 ; <i32> [#uses=1]
+ %LIVE2 = call i32 @test3(i16 %DEAD) ; <i32> [#uses=1]
+ %Z = add i32 %LIVE2, %Y ; <i32> [#uses=1]
+ %ret1 = call { i32, i32, i16 } @test5 ()
+ %LIVE3 = extractvalue { i32, i32, i16} %ret1, 0
+ %LIVE4 = extractvalue { i32, i32, i16} %ret1, 1
+ %DEAD2 = extractvalue { i32, i32, i16} %ret1, 2
+ %V = add i32 %LIVE3, %LIVE4
+ %W = add i32 %Z, %V
+ %ret2 = call { { i32 }, { i16, i16 } } @test6 ()
+ %LIVE5 = extractvalue { { i32 }, { i16, i16 } } %ret2, 0, 0
+ %DEAD3 = extractvalue { { i32 }, { i16, i16 } } %ret2, 1, 0
+ %DEAD4 = extractvalue { { i32 }, { i16, i16 } } %ret2, 1, 1
+ %Q = add i32 %W, %LIVE5
+ ret i32 %Q
+}
diff --git a/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll b/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll
new file mode 100644
index 000000000000..54fa078a5916
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -dse -scalarrepl -instcombine | \
+; RUN: llvm-dis | not grep {ret i32 undef}
+
+define i32 @test(double %__x) {
+ %__u = alloca { [3 x i32] } ; <{ [3 x i32] }*> [#uses=2]
+ %tmp.1 = bitcast { [3 x i32] }* %__u to double* ; <double*> [#uses=1]
+ store double %__x, double* %tmp.1
+ %tmp.4 = getelementptr { [3 x i32] }* %__u, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.5 = load i32* %tmp.4 ; <i32> [#uses=1]
+ %tmp.6 = icmp slt i32 %tmp.5, 0 ; <i1> [#uses=1]
+ %tmp.7 = zext i1 %tmp.6 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp.7
+}
+
diff --git a/test/Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll b/test/Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll
new file mode 100644
index 000000000000..3c40347f3094
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | \
+; RUN: grep {store i32 1234567}
+
+; Do not delete stores that are only partially killed.
+
+define i32 @test() {
+ %V = alloca i32 ; <i32*> [#uses=3]
+ store i32 1234567, i32* %V
+ %V2 = bitcast i32* %V to i8* ; <i8*> [#uses=1]
+ store i8 0, i8* %V2
+ %X = load i32* %V ; <i32> [#uses=1]
+ ret i32 %X
+}
diff --git a/test/Transforms/DeadStoreElimination/2005-11-30-vaarg.ll b/test/Transforms/DeadStoreElimination/2005-11-30-vaarg.ll
new file mode 100644
index 000000000000..58d678708794
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2005-11-30-vaarg.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | grep store
+
+define double @foo(i8* %X) {
+ %X_addr = alloca i8* ; <i8**> [#uses=2]
+ store i8* %X, i8** %X_addr
+ %tmp.0 = va_arg i8** %X_addr, double ; <double> [#uses=1]
+ ret double %tmp.0
+}
+
diff --git a/test/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll b/test/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll
new file mode 100644
index 000000000000..50dcf3278b89
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll
@@ -0,0 +1,1113 @@
+; RUN: llvm-as < %s | opt -globalsmodref-aa -dse -disable-output
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8"
+ %struct.ECacheType = type { i32, i32, i32 }
+ %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.QTType = type { i8, i8, i16, i32, i32, i32 }
+ %struct.TType = type { i8, i8, i8, i8, i16, i32, i32, i32 }
+ %struct._RuneEntry = type { i32, i32, i32, i32* }
+ %struct._RuneLocale = type { [8 x i8], [32 x i8], i32 (i8*, i32, i8**)*, i32 (i32, i8*, i32, i8**)*, i32, [256 x i32], [256 x i32], [256 x i32], %struct._RuneRange, %struct._RuneRange, %struct._RuneRange, i8*, i32 }
+ %struct._RuneRange = type { i32, %struct._RuneEntry* }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+ %struct.move_s = type { i32, i32, i32, i32, i32, i32 }
+ %struct.move_x = type { i32, i32, i32, i32 }
+ %struct.node_t = type { i8, i8, i8, i8, i32, i32, %struct.node_t**, %struct.node_t*, %struct.move_s }
+ %struct.see_data = type { i32, i32 }
+@rook_o.2925 = internal global [4 x i32] [ i32 12, i32 -12, i32 1, i32 -1 ] ; <[4 x i32]*> [#uses=0]
+@bishop_o.2926 = internal global [4 x i32] [ i32 11, i32 -11, i32 13, i32 -13 ] ; <[4 x i32]*> [#uses=0]
+@knight_o.2927 = internal global [8 x i32] [ i32 10, i32 -10, i32 14, i32 -14, i32 23, i32 -23, i32 25, i32 -25 ] ; <[8 x i32]*> [#uses=0]
+@board = internal global [144 x i32] zeroinitializer ; <[144 x i32]*> [#uses=0]
+@holding = internal global [2 x [16 x i32]] zeroinitializer ; <[2 x [16 x i32]]*> [#uses=0]
+@hold_hash = internal global i32 0 ; <i32*> [#uses=0]
+@white_hand_eval = internal global i32 0 ; <i32*> [#uses=0]
+@black_hand_eval = internal global i32 0 ; <i32*> [#uses=0]
+@num_holding = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=0]
+@zobrist = internal global [14 x [144 x i32]] zeroinitializer ; <[14 x [144 x i32]]*> [#uses=0]
+@Variant = internal global i32 0 ; <i32*> [#uses=7]
+@userealholdings.b = internal global i1 false ; <i1*> [#uses=1]
+@realholdings = internal global [255 x i8] zeroinitializer ; <[255 x i8]*> [#uses=0]
+@comp_color = internal global i32 0 ; <i32*> [#uses=0]
+@C.97.3177 = internal global [13 x i32] [ i32 0, i32 2, i32 1, i32 4, i32 3, i32 0, i32 0, i32 8, i32 7, i32 10, i32 9, i32 12, i32 11 ] ; <[13 x i32]*> [#uses=0]
+@str = internal global [30 x i8] c"%s:%u: failed assertion `%s'\0A\00" ; <[30 x i8]*> [#uses=0]
+@str.upgrd.1 = internal global [81 x i8] c"/Volumes/Stuff/src/speccpu2006-091-llvm/benchspec//CPU2006/458.sjeng/src/crazy.c\00" ; <[81 x i8]*> [#uses=0]
+@str.upgrd.2 = internal global [32 x i8] c"piece > frame && piece < npiece\00" ; <[32 x i8]*> [#uses=0]
+@C.101.3190 = internal global [13 x i32] [ i32 0, i32 2, i32 1, i32 2, i32 1, i32 0, i32 0, i32 2, i32 1, i32 2, i32 1, i32 2, i32 1 ] ; <[13 x i32]*> [#uses=0]
+@hand_value = internal global [13 x i32] [ i32 0, i32 100, i32 -100, i32 210, i32 -210, i32 0, i32 0, i32 250, i32 -250, i32 450, i32 -450, i32 230, i32 -230 ] ; <[13 x i32]*> [#uses=0]
+@material = internal global [14 x i32] zeroinitializer ; <[14 x i32]*> [#uses=0]
+@Material = internal global i32 0 ; <i32*> [#uses=0]
+@str.upgrd.3 = internal global [23 x i8] c"holding[who][what] > 0\00" ; <[23 x i8]*> [#uses=0]
+@str.upgrd.4 = internal global [24 x i8] c"holding[who][what] < 20\00" ; <[24 x i8]*> [#uses=0]
+@fifty = internal global i32 0 ; <i32*> [#uses=0]
+@move_number = internal global i32 0 ; <i32*> [#uses=1]
+@ply = internal global i32 0 ; <i32*> [#uses=2]
+@hash_history = internal global [600 x i32] zeroinitializer ; <[600 x i32]*> [#uses=1]
+@hash = internal global i32 0 ; <i32*> [#uses=1]
+@ECacheSize.b = internal global i1 false ; <i1*> [#uses=1]
+@ECache = internal global %struct.ECacheType* null ; <%struct.ECacheType**> [#uses=1]
+@ECacheProbes = internal global i32 0 ; <i32*> [#uses=1]
+@ECacheHits = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.5 = internal global [34 x i8] c"Out of memory allocating ECache.\0A\00" ; <[34 x i8]*> [#uses=0]
+@rankoffsets.2930 = internal global [8 x i32] [ i32 110, i32 98, i32 86, i32 74, i32 62, i32 50, i32 38, i32 26 ] ; <[8 x i32]*> [#uses=0]
+@white_castled = internal global i32 0 ; <i32*> [#uses=0]
+@black_castled = internal global i32 0 ; <i32*> [#uses=0]
+@book_ply = internal global i32 0 ; <i32*> [#uses=0]
+@bking_loc = internal global i32 0 ; <i32*> [#uses=1]
+@wking_loc = internal global i32 0 ; <i32*> [#uses=1]
+@white_to_move = internal global i32 0 ; <i32*> [#uses=3]
+@moved = internal global [144 x i32] zeroinitializer ; <[144 x i32]*> [#uses=0]
+@ep_square = internal global i32 0 ; <i32*> [#uses=0]
+@_DefaultRuneLocale = external global %struct._RuneLocale ; <%struct._RuneLocale*> [#uses=0]
+@str.upgrd.6 = internal global [3 x i8] c"bm\00" ; <[3 x i8]*> [#uses=0]
+@str1 = internal global [3 x i8] c"am\00" ; <[3 x i8]*> [#uses=0]
+@str1.upgrd.7 = internal global [34 x i8] c"No best-move or avoid-move found!\00" ; <[34 x i8]*> [#uses=0]
+@str.upgrd.8 = internal global [25 x i8] c"\0AName of EPD testsuite: \00" ; <[25 x i8]*> [#uses=0]
+@__sF = external global [0 x %struct.FILE] ; <[0 x %struct.FILE]*> [#uses=0]
+@str.upgrd.9 = internal global [21 x i8] c"\0ATime per move (s): \00" ; <[21 x i8]*> [#uses=0]
+@str.upgrd.10 = internal global [2 x i8] c"\0A\00" ; <[2 x i8]*> [#uses=0]
+@str2 = internal global [2 x i8] c"r\00" ; <[2 x i8]*> [#uses=0]
+@root_to_move = internal global i32 0 ; <i32*> [#uses=1]
+@forcedwin.b = internal global i1 false ; <i1*> [#uses=2]
+@fixed_time = internal global i32 0 ; <i32*> [#uses=1]
+@nodes = internal global i32 0 ; <i32*> [#uses=1]
+@qnodes = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.11 = internal global [29 x i8] c"\0ANodes: %i (%0.2f%% qnodes)\0A\00" ; <[29 x i8]*> [#uses=0]
+@str.upgrd.12 = internal global [54 x i8] c"ECacheProbes : %u ECacheHits : %u HitRate : %f%%\0A\00" ; <[54 x i8]*> [#uses=0]
+@TTStores = internal global i32 0 ; <i32*> [#uses=1]
+@TTProbes = internal global i32 0 ; <i32*> [#uses=1]
+@TTHits = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.13 = internal global [60 x i8] c"TTStores : %u TTProbes : %u TTHits : %u HitRate : %f%%\0A\00" ; <[60 x i8]*> [#uses=0]
+@NTries = internal global i32 0 ; <i32*> [#uses=1]
+@NCuts = internal global i32 0 ; <i32*> [#uses=1]
+@TExt = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.14 = internal global [51 x i8] c"NTries : %u NCuts : %u CutRate : %f%% TExt: %u\0A\00" ; <[51 x i8]*> [#uses=0]
+@ext_check = internal global i32 0 ; <i32*> [#uses=1]
+@razor_drop = internal global i32 0 ; <i32*> [#uses=1]
+@razor_material = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.15 = internal global [61 x i8] c"Check extensions: %u Razor drops : %u Razor Material : %u\0A\00" ; <[61 x i8]*> [#uses=0]
+@FHF = internal global i32 0 ; <i32*> [#uses=1]
+@FH = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.16 = internal global [22 x i8] c"Move ordering : %f%%\0A\00" ; <[22 x i8]*> [#uses=0]
+@maxposdiff = internal global i32 0 ; <i32*> [#uses=1]
+@str.upgrd.17 = internal global [47 x i8] c"Material score: %d Eval : %d MaxPosDiff: %d\0A\00" ; <[47 x i8]*> [#uses=0]
+@str.upgrd.18 = internal global [17 x i8] c"Solution found.\0A\00" ; <[17 x i8]*> [#uses=0]
+@str3 = internal global [21 x i8] c"Solution not found.\0A\00" ; <[21 x i8]*> [#uses=0]
+@str.upgrd.19 = internal global [15 x i8] c"Solved: %d/%d\0A\00" ; <[15 x i8]*> [#uses=0]
+@str.upgrd.20 = internal global [9 x i8] c"EPD: %s\0A\00" ; <[9 x i8]*> [#uses=0]
+@str4 = internal global [21 x i8] c"Searching to %d ply\0A\00" ; <[21 x i8]*> [#uses=0]
+@maxdepth = internal global i32 0 ; <i32*> [#uses=0]
+@std_material = internal global [14 x i32] [ i32 0, i32 100, i32 -100, i32 310, i32 -310, i32 4000, i32 -4000, i32 500, i32 -500, i32 900, i32 -900, i32 325, i32 -325, i32 0 ] ; <[14 x i32]*> [#uses=0]
+@zh_material = internal global [14 x i32] [ i32 0, i32 100, i32 -100, i32 210, i32 -210, i32 4000, i32 -4000, i32 250, i32 -250, i32 450, i32 -450, i32 230, i32 -230, i32 0 ] ; <[14 x i32]*> [#uses=0]
+@suicide_material = internal global [14 x i32] [ i32 0, i32 15, i32 -15, i32 150, i32 -150, i32 500, i32 -500, i32 150, i32 -150, i32 50, i32 -50, i32 0, i32 0, i32 0 ] ; <[14 x i32]*> [#uses=0]
+@losers_material = internal global [14 x i32] [ i32 0, i32 80, i32 -80, i32 320, i32 -320, i32 1000, i32 -1000, i32 350, i32 -350, i32 400, i32 -400, i32 270, i32 -270, i32 0 ] ; <[14 x i32]*> [#uses=0]
+@Xfile = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@Xrank = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 0, i32 0, i32 0, i32 0, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 0, i32 0, i32 0, i32 0, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 6, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 0, i32 0, i32 0, i32 0, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@Xdiagl = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 9, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 0, i32 0, i32 0, i32 10, i32 9, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 0, i32 0, i32 0, i32 0, i32 11, i32 10, i32 9, i32 1, i32 2, i32 3, i32 4, i32 5, i32 0, i32 0, i32 0, i32 0, i32 12, i32 11, i32 10, i32 9, i32 1, i32 2, i32 3, i32 4, i32 0, i32 0, i32 0, i32 0, i32 13, i32 12, i32 11, i32 10, i32 9, i32 1, i32 2, i32 3, i32 0, i32 0, i32 0, i32 0, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 1, i32 2, i32 0, i32 0, i32 0, i32 0, i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@Xdiagr = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 1, i32 0, i32 0, i32 0, i32 0, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 1, i32 2, i32 0, i32 0, i32 0, i32 0, i32 13, i32 12, i32 11, i32 10, i32 9, i32 1, i32 2, i32 3, i32 0, i32 0, i32 0, i32 0, i32 12, i32 11, i32 10, i32 9, i32 1, i32 2, i32 3, i32 4, i32 0, i32 0, i32 0, i32 0, i32 11, i32 10, i32 9, i32 1, i32 2, i32 3, i32 4, i32 5, i32 0, i32 0, i32 0, i32 0, i32 10, i32 9, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 0, i32 0, i32 0, i32 0, i32 9, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@sqcolor = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@pcsqbishop = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 -5, i32 -10, i32 -5, i32 -5, i32 -10, i32 -5, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 10, i32 5, i32 10, i32 10, i32 5, i32 10, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 5, i32 6, i32 15, i32 15, i32 6, i32 5, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 3, i32 15, i32 10, i32 10, i32 15, i32 3, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 3, i32 15, i32 10, i32 10, i32 15, i32 3, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 5, i32 6, i32 15, i32 15, i32 6, i32 5, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 10, i32 5, i32 10, i32 10, i32 5, i32 10, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 -5, i32 -10, i32 -5, i32 -5, i32 -10, i32 -5, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@black_knight = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 15, i32 25, i32 25, i32 25, i32 25, i32 15, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 15, i32 25, i32 35, i32 35, i32 35, i32 15, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 10, i32 25, i32 20, i32 25, i32 25, i32 10, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 20, i32 20, i32 20, i32 20, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 15, i32 15, i32 15, i32 15, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 3, i32 3, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -35, i32 -10, i32 -10, i32 -10, i32 -10, i32 -35, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@white_knight = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -35, i32 -10, i32 -10, i32 -10, i32 -10, i32 -35, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 3, i32 3, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 15, i32 15, i32 15, i32 15, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 20, i32 20, i32 20, i32 20, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 10, i32 25, i32 20, i32 25, i32 25, i32 10, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 15, i32 25, i32 35, i32 35, i32 35, i32 15, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 15, i32 25, i32 25, i32 25, i32 25, i32 15, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@white_pawn = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 25, i32 25, i32 35, i32 5, i32 5, i32 50, i32 45, i32 30, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 14, i32 14, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 20, i32 20, i32 10, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 12, i32 18, i32 18, i32 27, i32 27, i32 18, i32 18, i32 18, i32 0, i32 0, i32 0, i32 0, i32 25, i32 30, i32 30, i32 35, i32 35, i32 35, i32 30, i32 25, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@black_pawn = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 30, i32 30, i32 30, i32 35, i32 35, i32 35, i32 30, i32 25, i32 0, i32 0, i32 0, i32 0, i32 12, i32 18, i32 18, i32 27, i32 27, i32 18, i32 18, i32 18, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 20, i32 20, i32 10, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 14, i32 14, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 7, i32 7, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 25, i32 25, i32 35, i32 5, i32 5, i32 50, i32 45, i32 30, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@white_king = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -100, i32 7, i32 4, i32 0, i32 10, i32 4, i32 7, i32 -100, i32 0, i32 0, i32 0, i32 0, i32 -250, i32 -200, i32 -150, i32 -100, i32 -100, i32 -150, i32 -200, i32 -250, i32 0, i32 0, i32 0, i32 0, i32 -350, i32 -300, i32 -300, i32 -250, i32 -250, i32 -300, i32 -300, i32 -350, i32 0, i32 0, i32 0, i32 0, i32 -400, i32 -400, i32 -400, i32 -350, i32 -350, i32 -400, i32 -400, i32 -400, i32 0, i32 0, i32 0, i32 0, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 0, i32 0, i32 0, i32 0, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 0, i32 0, i32 0, i32 0, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 0, i32 0, i32 0, i32 0, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@black_king = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 0, i32 0, i32 0, i32 0, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 0, i32 0, i32 0, i32 0, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 -500, i32 0, i32 0, i32 0, i32 0, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 -450, i32 0, i32 0, i32 0, i32 0, i32 -400, i32 -400, i32 -400, i32 -350, i32 -350, i32 -400, i32 -400, i32 -400, i32 0, i32 0, i32 0, i32 0, i32 -350, i32 -300, i32 -300, i32 -250, i32 -250, i32 -300, i32 -300, i32 -350, i32 0, i32 0, i32 0, i32 0, i32 -250, i32 -200, i32 -150, i32 -100, i32 -100, i32 -150, i32 -200, i32 -250, i32 0, i32 0, i32 0, i32 0, i32 -100, i32 7, i32 4, i32 0, i32 10, i32 4, i32 7, i32 -100, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@black_queen = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5, i32 5, i32 5, i32 10, i32 10, i32 5, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3, i32 3, i32 3, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 0, i32 0, i32 0, i32 0, i32 -60, i32 -40, i32 -40, i32 -60, i32 -60, i32 -40, i32 -40, i32 -60, i32 0, i32 0, i32 0, i32 0, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 -15, i32 -15, i32 -10, i32 -10, i32 -15, i32 -15, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 7, i32 10, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@white_queen = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 7, i32 10, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 -15, i32 -15, i32 -10, i32 -10, i32 -15, i32 -15, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 -40, i32 0, i32 0, i32 0, i32 0, i32 -60, i32 -40, i32 -40, i32 -60, i32 -60, i32 -40, i32 -40, i32 -60, i32 0, i32 0, i32 0, i32 0, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 -30, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 3, i32 3, i32 3, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5, i32 5, i32 5, i32 10, i32 10, i32 5, i32 5, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@black_rook = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 15, i32 20, i32 25, i32 25, i32 20, i32 15, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 15, i32 20, i32 20, i32 15, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -20, i32 -20, i32 -30, i32 -30, i32 -20, i32 -20, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 -15, i32 -15, i32 -10, i32 -10, i32 -15, i32 -15, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 7, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@white_rook = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 7, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 -15, i32 -15, i32 -10, i32 -10, i32 -15, i32 -15, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -20, i32 -20, i32 -30, i32 -30, i32 -20, i32 -20, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 15, i32 20, i32 20, i32 15, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 15, i32 20, i32 25, i32 25, i32 20, i32 15, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@upscale = internal global [64 x i32] [ i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 62, i32 63, i32 64, i32 65, i32 66, i32 67, i32 68, i32 69, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 86, i32 87, i32 88, i32 89, i32 90, i32 91, i32 92, i32 93, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117 ] ; <[64 x i32]*> [#uses=0]
+@pre_p_tropism = internal global [9 x i32] [ i32 9999, i32 40, i32 20, i32 10, i32 3, i32 1, i32 1, i32 0, i32 9999 ] ; <[9 x i32]*> [#uses=0]
+@pre_r_tropism = internal global [9 x i32] [ i32 9999, i32 50, i32 40, i32 15, i32 5, i32 1, i32 1, i32 0, i32 9999 ] ; <[9 x i32]*> [#uses=0]
+@pre_n_tropism = internal global [9 x i32] [ i32 9999, i32 50, i32 70, i32 35, i32 10, i32 2, i32 1, i32 0, i32 9999 ] ; <[9 x i32]*> [#uses=0]
+@pre_q_tropism = internal global [9 x i32] [ i32 9999, i32 100, i32 60, i32 20, i32 5, i32 2, i32 0, i32 0, i32 9999 ] ; <[9 x i32]*> [#uses=0]
+@pre_b_tropism = internal global [9 x i32] [ i32 9999, i32 50, i32 25, i32 15, i32 5, i32 2, i32 2, i32 2, i32 9999 ] ; <[9 x i32]*> [#uses=0]
+@rookdistance = internal global [144 x [144 x i32]] zeroinitializer ; <[144 x [144 x i32]]*> [#uses=0]
+@distance = internal global [144 x [144 x i32]] zeroinitializer ; <[144 x [144 x i32]]*> [#uses=0]
+@p_tropism = internal global [144 x [144 x i8]] zeroinitializer ; <[144 x [144 x i8]]*> [#uses=0]
+@b_tropism = internal global [144 x [144 x i8]] zeroinitializer ; <[144 x [144 x i8]]*> [#uses=0]
+@n_tropism = internal global [144 x [144 x i8]] zeroinitializer ; <[144 x [144 x i8]]*> [#uses=0]
+@r_tropism = internal global [144 x [144 x i8]] zeroinitializer ; <[144 x [144 x i8]]*> [#uses=0]
+@q_tropism = internal global [144 x [144 x i8]] zeroinitializer ; <[144 x [144 x i8]]*> [#uses=0]
+@cfg_devscale.b = internal global i1 false ; <i1*> [#uses=0]
+@pieces = internal global [62 x i32] zeroinitializer ; <[62 x i32]*> [#uses=0]
+@piece_count = internal global i32 0 ; <i32*> [#uses=1]
+@cfg_smarteval.b = internal global i1 false ; <i1*> [#uses=0]
+@lcentral = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -15, i32 -15, i32 -15, i32 -15, i32 -15, i32 -15, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 0, i32 3, i32 5, i32 5, i32 3, i32 0, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 0, i32 15, i32 15, i32 15, i32 15, i32 0, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 0, i32 15, i32 30, i32 30, i32 15, i32 0, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 0, i32 15, i32 30, i32 30, i32 15, i32 0, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 0, i32 15, i32 15, i32 15, i32 15, i32 0, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -15, i32 0, i32 3, i32 5, i32 5, i32 3, i32 0, i32 -15, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -15, i32 -15, i32 -15, i32 -15, i32 -15, i32 -15, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@str3.upgrd.21 = internal global [81 x i8] c"/Volumes/Stuff/src/speccpu2006-091-llvm/benchspec//CPU2006/458.sjeng/src/leval.c\00" ; <[81 x i8]*> [#uses=0]
+@str5 = internal global [21 x i8] c"(i > 0) && (i < 145)\00" ; <[21 x i8]*> [#uses=0]
+@kingcap.b = internal global i1 false ; <i1*> [#uses=0]
+@numb_moves = internal global i32 0 ; <i32*> [#uses=2]
+@genfor = internal global %struct.move_s* null ; <%struct.move_s**> [#uses=0]
+@captures = internal global i32 0 ; <i32*> [#uses=1]
+@fcaptures.b = internal global i1 false ; <i1*> [#uses=0]
+@gfrom = internal global i32 0 ; <i32*> [#uses=0]
+@Giveaway.b = internal global i1 false ; <i1*> [#uses=0]
+@path_x = internal global [300 x %struct.move_x] zeroinitializer ; <[300 x %struct.move_x]*> [#uses=0]
+@str7 = internal global [81 x i8] c"/Volumes/Stuff/src/speccpu2006-091-llvm/benchspec//CPU2006/458.sjeng/src/moves.c\00" ; <[81 x i8]*> [#uses=0]
+@str8 = internal global [15 x i8] c"find_slot < 63\00" ; <[15 x i8]*> [#uses=0]
+@is_promoted = internal global [62 x i32] zeroinitializer ; <[62 x i32]*> [#uses=0]
+@squares = internal global [144 x i32] zeroinitializer ; <[144 x i32]*> [#uses=0]
+@str.upgrd.22 = internal global [38 x i8] c"promoted > frame && promoted < npiece\00" ; <[38 x i8]*> [#uses=0]
+@str1.upgrd.23 = internal global [38 x i8] c"promoted < npiece && promoted > frame\00" ; <[38 x i8]*> [#uses=0]
+@evalRoutines = internal global [7 x i32 (i32, i32)*] [ i32 (i32, i32)* @ErrorIt, i32 (i32, i32)* @Pawn, i32 (i32, i32)* @Knight, i32 (i32, i32)* @King, i32 (i32, i32)* @Rook, i32 (i32, i32)* @Queen, i32 (i32, i32)* @Bishop ] ; <[7 x i32 (i32, i32)*]*> [#uses=0]
+@sbishop = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 8, i32 5, i32 5, i32 5, i32 5, i32 8, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 3, i32 3, i32 5, i32 5, i32 3, i32 3, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 2, i32 5, i32 4, i32 4, i32 5, i32 2, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 2, i32 5, i32 4, i32 4, i32 5, i32 2, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 3, i32 3, i32 5, i32 5, i32 3, i32 3, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 8, i32 5, i32 5, i32 5, i32 5, i32 8, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 -2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@sknight = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 3, i32 3, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 5, i32 5, i32 5, i32 5, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 5, i32 10, i32 10, i32 5, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 5, i32 10, i32 10, i32 5, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 5, i32 5, i32 5, i32 5, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 3, i32 3, i32 0, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@swhite_pawn = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 10, i32 10, i32 3, i32 2, i32 1, i32 0, i32 0, i32 0, i32 0, i32 2, i32 4, i32 6, i32 12, i32 12, i32 6, i32 4, i32 2, i32 0, i32 0, i32 0, i32 0, i32 3, i32 6, i32 9, i32 14, i32 14, i32 9, i32 6, i32 3, i32 0, i32 0, i32 0, i32 0, i32 10, i32 12, i32 14, i32 16, i32 16, i32 14, i32 12, i32 10, i32 0, i32 0, i32 0, i32 0, i32 20, i32 22, i32 24, i32 26, i32 26, i32 24, i32 22, i32 20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@sblack_pawn = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 20, i32 22, i32 24, i32 26, i32 26, i32 24, i32 22, i32 20, i32 0, i32 0, i32 0, i32 0, i32 10, i32 12, i32 14, i32 16, i32 16, i32 14, i32 12, i32 10, i32 0, i32 0, i32 0, i32 0, i32 3, i32 6, i32 9, i32 14, i32 14, i32 9, i32 6, i32 3, i32 0, i32 0, i32 0, i32 0, i32 2, i32 4, i32 6, i32 12, i32 12, i32 6, i32 4, i32 2, i32 0, i32 0, i32 0, i32 0, i32 1, i32 2, i32 3, i32 10, i32 10, i32 3, i32 2, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@swhite_king = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 14, i32 0, i32 0, i32 0, i32 9, i32 14, i32 2, i32 0, i32 0, i32 0, i32 0, i32 -3, i32 -5, i32 -6, i32 -6, i32 -6, i32 -6, i32 -5, i32 -3, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 -5, i32 -8, i32 -8, i32 -8, i32 -8, i32 -5, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -8, i32 -8, i32 -13, i32 -13, i32 -13, i32 -13, i32 -8, i32 -8, i32 0, i32 0, i32 0, i32 0, i32 -13, i32 -13, i32 -21, i32 -21, i32 -21, i32 -21, i32 -13, i32 -13, i32 0, i32 0, i32 0, i32 0, i32 -21, i32 -21, i32 -34, i32 -34, i32 -34, i32 -34, i32 -21, i32 -21, i32 0, i32 0, i32 0, i32 0, i32 -34, i32 -34, i32 -55, i32 -55, i32 -55, i32 -55, i32 -34, i32 -34, i32 0, i32 0, i32 0, i32 0, i32 -55, i32 -55, i32 -89, i32 -89, i32 -89, i32 -89, i32 -55, i32 -55, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@sblack_king = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -55, i32 -55, i32 -89, i32 -89, i32 -89, i32 -89, i32 -55, i32 -55, i32 0, i32 0, i32 0, i32 0, i32 -34, i32 -34, i32 -55, i32 -55, i32 -55, i32 -55, i32 -34, i32 -34, i32 0, i32 0, i32 0, i32 0, i32 -21, i32 -21, i32 -34, i32 -34, i32 -34, i32 -34, i32 -21, i32 -21, i32 0, i32 0, i32 0, i32 0, i32 -13, i32 -13, i32 -21, i32 -21, i32 -21, i32 -21, i32 -13, i32 -13, i32 0, i32 0, i32 0, i32 0, i32 -8, i32 -8, i32 -13, i32 -13, i32 -13, i32 -13, i32 -8, i32 -8, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 -5, i32 -8, i32 -8, i32 -8, i32 -8, i32 -5, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -3, i32 -5, i32 -6, i32 -6, i32 -6, i32 -6, i32 -5, i32 -3, i32 0, i32 0, i32 0, i32 0, i32 2, i32 14, i32 0, i32 0, i32 0, i32 9, i32 14, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@send_king = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 -3, i32 -1, i32 0, i32 0, i32 -1, i32 -3, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 -3, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 -3, i32 0, i32 0, i32 0, i32 0, i32 -1, i32 10, i32 25, i32 25, i32 25, i32 25, i32 10, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 25, i32 50, i32 50, i32 25, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10, i32 25, i32 50, i32 50, i32 25, i32 10, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -1, i32 10, i32 25, i32 25, i32 25, i32 25, i32 10, i32 -1, i32 0, i32 0, i32 0, i32 0, i32 -3, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 -3, i32 0, i32 0, i32 0, i32 0, i32 -5, i32 -3, i32 -1, i32 0, i32 0, i32 -1, i32 -3, i32 -5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@srev_rank = internal global [9 x i32] [ i32 0, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1 ] ; <[9 x i32]*> [#uses=0]
+@std_p_tropism = internal global [8 x i32] [ i32 9999, i32 15, i32 10, i32 7, i32 2, i32 0, i32 0, i32 0 ] ; <[8 x i32]*> [#uses=0]
+@std_own_p_tropism = internal global [8 x i32] [ i32 9999, i32 30, i32 10, i32 2, i32 0, i32 0, i32 0, i32 0 ] ; <[8 x i32]*> [#uses=0]
+@std_r_tropism = internal global [16 x i32] [ i32 9999, i32 0, i32 15, i32 5, i32 2, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[16 x i32]*> [#uses=0]
+@std_n_tropism = internal global [8 x i32] [ i32 9999, i32 14, i32 9, i32 6, i32 1, i32 0, i32 0, i32 0 ] ; <[8 x i32]*> [#uses=0]
+@std_q_tropism = internal global [8 x i32] [ i32 9999, i32 200, i32 50, i32 15, i32 3, i32 2, i32 1, i32 0 ] ; <[8 x i32]*> [#uses=0]
+@std_b_tropism = internal global [8 x i32] [ i32 9999, i32 12, i32 7, i32 5, i32 0, i32 0, i32 0, i32 0 ] ; <[8 x i32]*> [#uses=0]
+@phase = internal global i32 0 ; <i32*> [#uses=1]
+@dir.3001 = internal global [4 x i32] [ i32 -13, i32 -11, i32 11, i32 13 ] ; <[4 x i32]*> [#uses=0]
+@dir.3021 = internal global [4 x i32] [ i32 -1, i32 1, i32 12, i32 -12 ] ; <[4 x i32]*> [#uses=0]
+@king_locs = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=0]
+@square_d1.3081 = internal global [2 x i32] [ i32 29, i32 113 ] ; <[2 x i32]*> [#uses=0]
+@wmat = internal global i32 0 ; <i32*> [#uses=0]
+@bmat = internal global i32 0 ; <i32*> [#uses=0]
+@str.upgrd.24 = internal global [35 x i8] c"Illegal piece detected sq=%i c=%i\0A\00" ; <[35 x i8]*> [#uses=0]
+@str10 = internal global [81 x i8] c"/Volumes/Stuff/src/speccpu2006-091-llvm/benchspec//CPU2006/458.sjeng/src/neval.c\00" ; <[81 x i8]*> [#uses=0]
+@std_hand_value = internal global [13 x i32] [ i32 0, i32 100, i32 -100, i32 210, i32 -210, i32 0, i32 0, i32 250, i32 -250, i32 450, i32 -450, i32 230, i32 -230 ] ; <[13 x i32]*> [#uses=0]
+@xb_mode = internal global i32 0 ; <i32*> [#uses=0]
+@str.upgrd.25 = internal global [69 x i8] c"tellics ptell Hello! I am Sjeng and hope you enjoy playing with me.\0A\00" ; <[69 x i8]*> [#uses=0]
+@str.upgrd.26 = internal global [76 x i8] c"tellics ptell For help on some commands that I understand, ptell me 'help'\0A\00" ; <[76 x i8]*> [#uses=0]
+@str12 = internal global [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=0]
+@my_partner = internal global [256 x i8] zeroinitializer ; <[256 x i8]*> [#uses=0]
+@str13 = internal global [25 x i8] c"tellics set f5 bughouse\0A\00" ; <[25 x i8]*> [#uses=0]
+@str.upgrd.27 = internal global [16 x i8] c"tellics unseek\0A\00" ; <[16 x i8]*> [#uses=0]
+@str.upgrd.28 = internal global [20 x i8] c"tellics set f5 1=1\0A\00" ; <[20 x i8]*> [#uses=0]
+@str.upgrd.29 = internal global [80 x i8] c"is...uh...what did you say?\0A\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" ; <[80 x i8]*> [#uses=0]
+@str.upgrd.30 = internal global [5 x i8] c"help\00" ; <[5 x i8]*> [#uses=0]
+@str.upgrd.31 = internal global [147 x i8] c"tellics ptell Commands that I understand are : sit, go, fast, slow, abort, flag, +/++/+++/-/--/---{p,n,b,r,q,d,h,trades}, x, dead, formula, help.\0A\00" ; <[147 x i8]*> [#uses=0]
+@str.upgrd.32 = internal global [6 x i8] c"sorry\00" ; <[6 x i8]*> [#uses=0]
+@str.upgrd.33 = internal global [59 x i8] c"tellics ptell Sorry, but I'm not playing a bughouse game.\0A\00" ; <[59 x i8]*> [#uses=0]
+@str.upgrd.34 = internal global [4 x i8] c"sit\00" ; <[4 x i8]*> [#uses=0]
+@str.upgrd.35 = internal global [56 x i8] c"tellics ptell Ok, I sit next move. Tell me when to go.\0A\00" ; <[56 x i8]*> [#uses=0]
+@must_sit.b = internal global i1 false ; <i1*> [#uses=0]
+@str114 = internal global [3 x i8] c"go\00" ; <[3 x i8]*> [#uses=0]
+@str2.upgrd.36 = internal global [5 x i8] c"move\00" ; <[5 x i8]*> [#uses=0]
+@str.upgrd.37 = internal global [31 x i8] c"tellics ptell Ok, I'm moving.\0A\00" ; <[31 x i8]*> [#uses=0]
+@str3.upgrd.38 = internal global [5 x i8] c"fast\00" ; <[5 x i8]*> [#uses=0]
+@str4.upgrd.39 = internal global [5 x i8] c"time\00" ; <[5 x i8]*> [#uses=0]
+@str15 = internal global [35 x i8] c"tellics ptell Ok, I'm going FAST!\0A\00" ; <[35 x i8]*> [#uses=0]
+@go_fast.b = internal global i1 false ; <i1*> [#uses=0]
+@str5.upgrd.40 = internal global [5 x i8] c"slow\00" ; <[5 x i8]*> [#uses=0]
+@str16 = internal global [36 x i8] c"tellics ptell Ok, moving normally.\0A\00" ; <[36 x i8]*> [#uses=0]
+@str6 = internal global [6 x i8] c"abort\00" ; <[6 x i8]*> [#uses=0]
+@str7.upgrd.41 = internal global [35 x i8] c"tellics ptell Requesting abort...\0A\00" ; <[35 x i8]*> [#uses=0]
+@str17 = internal global [15 x i8] c"tellics abort\0A\00" ; <[15 x i8]*> [#uses=0]
+@str8.upgrd.42 = internal global [5 x i8] c"flag\00" ; <[5 x i8]*> [#uses=0]
+@str.upgrd.43 = internal global [27 x i8] c"tellics ptell Flagging...\0A\00" ; <[27 x i8]*> [#uses=0]
+@str.upgrd.44 = internal global [14 x i8] c"tellics flag\0A\00" ; <[14 x i8]*> [#uses=0]
+@str18 = internal global [2 x i8] c"+\00" ; <[2 x i8]*> [#uses=0]
+@str9 = internal global [6 x i8] c"trade\00" ; <[6 x i8]*> [#uses=0]
+@str10.upgrd.45 = internal global [35 x i8] c"tellics ptell Ok, trading is GOOD\0A\00" ; <[35 x i8]*> [#uses=0]
+@str11 = internal global [4 x i8] c"+++\00" ; <[4 x i8]*> [#uses=0]
+@str12.upgrd.46 = internal global [6 x i8] c"mates\00" ; <[6 x i8]*> [#uses=0]
+@str13.upgrd.47 = internal global [3 x i8] c"++\00" ; <[3 x i8]*> [#uses=0]
+@str.upgrd.48 = internal global [49 x i8] c"is VERY good (ptell me 'x' to play normal again)\00" ; <[49 x i8]*> [#uses=0]
+@str.upgrd.49 = internal global [44 x i8] c"is good (ptell me 'x' to play normal again)\00" ; <[44 x i8]*> [#uses=0]
+@str19 = internal global [29 x i8] c"tellics ptell Ok, Knight %s\0A\00" ; <[29 x i8]*> [#uses=0]
+@str14 = internal global [29 x i8] c"tellics ptell Ok, Bishop %s\0A\00" ; <[29 x i8]*> [#uses=0]
+@str15.upgrd.50 = internal global [27 x i8] c"tellics ptell Ok, Rook %s\0A\00" ; <[27 x i8]*> [#uses=0]
+@str.upgrd.51 = internal global [28 x i8] c"tellics ptell Ok, Queen %s\0A\00" ; <[28 x i8]*> [#uses=0]
+@str16.upgrd.52 = internal global [27 x i8] c"tellics ptell Ok, Pawn %s\0A\00" ; <[27 x i8]*> [#uses=0]
+@str17.upgrd.53 = internal global [31 x i8] c"tellics ptell Ok, Diagonal %s\0A\00" ; <[31 x i8]*> [#uses=0]
+@str18.upgrd.54 = internal global [28 x i8] c"tellics ptell Ok, Heavy %s\0A\00" ; <[28 x i8]*> [#uses=0]
+@str20 = internal global [34 x i8] c"tellics ptell Ok, trading is BAD\0A\00" ; <[34 x i8]*> [#uses=0]
+@str20.upgrd.55 = internal global [4 x i8] c"---\00" ; <[4 x i8]*> [#uses=0]
+@str.upgrd.56 = internal global [53 x i8] c"mates you (ptell me 'x' when it no longer mates you)\00" ; <[53 x i8]*> [#uses=0]
+@str21 = internal global [3 x i8] c"--\00" ; <[3 x i8]*> [#uses=0]
+@str.upgrd.57 = internal global [52 x i8] c"is VERY bad (ptell me 'x' when it is no longer bad)\00" ; <[52 x i8]*> [#uses=0]
+@str21.upgrd.58 = internal global [47 x i8] c"is bad (ptell me 'x' when it is no longer bad)\00" ; <[47 x i8]*> [#uses=0]
+@str23 = internal global [16 x i8] c"mate me anymore\00" ; <[16 x i8]*> [#uses=0]
+@str24 = internal global [6 x i8] c"never\00" ; <[6 x i8]*> [#uses=0]
+@str25 = internal global [5 x i8] c"mind\00" ; <[5 x i8]*> [#uses=0]
+@str22 = internal global [9 x i8] c"ptell me\00" ; <[9 x i8]*> [#uses=0]
+@str.upgrd.59 = internal global [55 x i8] c"tellics ptell Ok, reverting to STANDARD piece values!\0A\00" ; <[55 x i8]*> [#uses=0]
+@partnerdead.b = internal global i1 false ; <i1*> [#uses=0]
+@piecedead.b = internal global i1 false ; <i1*> [#uses=0]
+@str.upgrd.60 = internal global [26 x i8] c"i'll have to sit...(dead)\00" ; <[26 x i8]*> [#uses=0]
+@str27 = internal global [5 x i8] c"dead\00" ; <[5 x i8]*> [#uses=0]
+@str28 = internal global [27 x i8] c"i'll have to sit...(piece)\00" ; <[27 x i8]*> [#uses=0]
+@str29 = internal global [3 x i8] c"ok\00" ; <[3 x i8]*> [#uses=0]
+@str30 = internal global [3 x i8] c"hi\00" ; <[3 x i8]*> [#uses=0]
+@str31 = internal global [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=0]
+@str32 = internal global [26 x i8] c"tellics ptell Greetings.\0A\00" ; <[26 x i8]*> [#uses=0]
+@str.upgrd.61 = internal global [8 x i8] c"formula\00" ; <[8 x i8]*> [#uses=0]
+@str.upgrd.62 = internal global [87 x i8] c"tellics ptell Setting formula, if you are still interrupted, complain to my operator.\0A\00" ; <[87 x i8]*> [#uses=0]
+@str33 = internal global [59 x i8] c"tellics ptell Sorry, but I don't understand that command.\0A\00" ; <[59 x i8]*> [#uses=0]
+@pawnmated.3298 = internal global i32 0 ; <i32*> [#uses=0]
+@knightmated.3299 = internal global i32 0 ; <i32*> [#uses=0]
+@bishopmated.3300 = internal global i32 0 ; <i32*> [#uses=0]
+@rookmated.3301 = internal global i32 0 ; <i32*> [#uses=0]
+@queenmated.3302 = internal global i32 0 ; <i32*> [#uses=0]
+@str.upgrd.63 = internal global [41 x i8] c"tellics ptell p doesn't mate me anymore\0A\00" ; <[41 x i8]*> [#uses=0]
+@str34 = internal global [41 x i8] c"tellics ptell n doesn't mate me anymore\0A\00" ; <[41 x i8]*> [#uses=0]
+@str35 = internal global [41 x i8] c"tellics ptell b doesn't mate me anymore\0A\00" ; <[41 x i8]*> [#uses=0]
+@str36 = internal global [41 x i8] c"tellics ptell r doesn't mate me anymore\0A\00" ; <[41 x i8]*> [#uses=0]
+@str37 = internal global [41 x i8] c"tellics ptell q doesn't mate me anymore\0A\00" ; <[41 x i8]*> [#uses=0]
+@str38 = internal global [20 x i8] c"tellics ptell ---p\0A\00" ; <[20 x i8]*> [#uses=0]
+@str39 = internal global [20 x i8] c"tellics ptell ---n\0A\00" ; <[20 x i8]*> [#uses=0]
+@str40 = internal global [20 x i8] c"tellics ptell ---b\0A\00" ; <[20 x i8]*> [#uses=0]
+@str41 = internal global [20 x i8] c"tellics ptell ---r\0A\00" ; <[20 x i8]*> [#uses=0]
+@str42 = internal global [20 x i8] c"tellics ptell ---q\0A\00" ; <[20 x i8]*> [#uses=0]
+@str23.upgrd.64 = internal global [17 x i8] c"tellics ptell x\0A\00" ; <[17 x i8]*> [#uses=0]
+@str.upgrd.65 = internal global [18 x i8] c"tellics ptell go\0A\00" ; <[18 x i8]*> [#uses=0]
+@bufftop = internal global i32 0 ; <i32*> [#uses=2]
+@membuff = internal global i8* null ; <i8**> [#uses=3]
+@maxply = internal global i32 0 ; <i32*> [#uses=1]
+@forwards = internal global i32 0 ; <i32*> [#uses=1]
+@nodecount = internal global i32 0 ; <i32*> [#uses=1]
+@frees = internal global i32 0 ; <i32*> [#uses=0]
+@PBSize.b = internal global i1 false ; <i1*> [#uses=1]
+@alllosers.b = internal global i1 false ; <i1*> [#uses=1]
+@rootlosers = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=1]
+@pn_move = internal global %struct.move_s zeroinitializer ; <%struct.move_s*> [#uses=7]
+@iters = internal global i32 0 ; <i32*> [#uses=1]
+@kibitzed.b = internal global i1 false ; <i1*> [#uses=0]
+@str24.upgrd.66 = internal global [28 x i8] c"tellics kibitz Forced win!\0A\00" ; <[28 x i8]*> [#uses=0]
+@str25.upgrd.67 = internal global [34 x i8] c"tellics kibitz Forced win! (alt)\0A\00" ; <[34 x i8]*> [#uses=0]
+@pn_time = internal global i32 0 ; <i32*> [#uses=1]
+@post = internal global i32 0 ; <i32*> [#uses=0]
+@str.upgrd.68 = internal global [94 x i8] c"tellics whisper proof %d, disproof %d, %d losers, highest depth %d, primary %d, secondary %d\0A\00" ; <[94 x i8]*> [#uses=0]
+@str26 = internal global [30 x i8] c"tellics whisper Forced reply\0A\00" ; <[30 x i8]*> [#uses=0]
+@str27.upgrd.69 = internal global [60 x i8] c"P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d MaxDepth: %d\0A\00" ; <[60 x i8]*> [#uses=0]
+@str.upgrd.70 = internal global [90 x i8] c"tellics whisper proof %d, disproof %d, %d nodes, %d forwards, %d iters, highest depth %d\0A\00" ; <[90 x i8]*> [#uses=0]
+@str.upgrd.71 = internal global [11 x i8] c"Time : %f\0A\00" ; <[11 x i8]*> [#uses=0]
+@str28.upgrd.72 = internal global [23 x i8] c"This position is WON.\0A\00" ; <[23 x i8]*> [#uses=0]
+@str29.upgrd.73 = internal global [5 x i8] c"PV: \00" ; <[5 x i8]*> [#uses=0]
+@str30.upgrd.74 = internal global [4 x i8] c"%s \00" ; <[4 x i8]*> [#uses=0]
+@str31.upgrd.75 = internal global [2 x i8] c" \00" ; <[2 x i8]*> [#uses=0]
+@str32.upgrd.76 = internal global [41 x i8] c"\0Atellics kibitz Forced win in %d moves.\0A\00" ; <[41 x i8]*> [#uses=0]
+@str33.upgrd.77 = internal global [20 x i8] c"\0A1-0 {White mates}\0A\00" ; <[20 x i8]*> [#uses=0]
+@result = internal global i32 0 ; <i32*> [#uses=4]
+@str1.upgrd.78 = internal global [20 x i8] c"\0A0-1 {Black mates}\0A\00" ; <[20 x i8]*> [#uses=0]
+@str35.upgrd.79 = internal global [24 x i8] c"This position is LOST.\0A\00" ; <[24 x i8]*> [#uses=0]
+@str36.upgrd.80 = internal global [27 x i8] c"This position is UNKNOWN.\0A\00" ; <[27 x i8]*> [#uses=0]
+@str37.upgrd.81 = internal global [47 x i8] c"P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d\0A\00" ; <[47 x i8]*> [#uses=0]
+@s_threat.b = internal global i1 false ; <i1*> [#uses=0]
+@TTSize.b = internal global i1 false ; <i1*> [#uses=3]
+@cfg_razordrop.b = internal global i1 false ; <i1*> [#uses=0]
+@cfg_futprune.b = internal global i1 false ; <i1*> [#uses=0]
+@cfg_onerep.b = internal global i1 false ; <i1*> [#uses=0]
+@setcode = internal global [30 x i8] zeroinitializer ; <[30 x i8]*> [#uses=0]
+@str38.upgrd.82 = internal global [3 x i8] c"%u\00" ; <[3 x i8]*> [#uses=0]
+@searching_pv.b = internal global i1 false ; <i1*> [#uses=0]
+@pv = internal global [300 x [300 x %struct.move_s]] zeroinitializer ; <[300 x [300 x %struct.move_s]]*> [#uses=0]
+@i_depth = internal global i32 0 ; <i32*> [#uses=0]
+@history_h = internal global [144 x [144 x i32]] zeroinitializer ; <[144 x [144 x i32]]*> [#uses=0]
+@killer1 = internal global [300 x %struct.move_s] zeroinitializer ; <[300 x %struct.move_s]*> [#uses=0]
+@killer2 = internal global [300 x %struct.move_s] zeroinitializer ; <[300 x %struct.move_s]*> [#uses=0]
+@killer3 = internal global [300 x %struct.move_s] zeroinitializer ; <[300 x %struct.move_s]*> [#uses=0]
+@rootnodecount = internal global [512 x i32] zeroinitializer ; <[512 x i32]*> [#uses=0]
+@raw_nodes = internal global i32 0 ; <i32*> [#uses=0]
+@pv_length = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@time_exit.b = internal global i1 false ; <i1*> [#uses=0]
+@time_for_move = internal global i32 0 ; <i32*> [#uses=3]
+@failed = internal global i32 0 ; <i32*> [#uses=0]
+@extendedtime.b = internal global i1 false ; <i1*> [#uses=1]
+@time_left = internal global i32 0 ; <i32*> [#uses=0]
+@str39.upgrd.83 = internal global [38 x i8] c"Extended from %d to %d, time left %d\0A\00" ; <[38 x i8]*> [#uses=0]
+@checks = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@singular = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@recaps = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@ext_onerep = internal global i32 0 ; <i32*> [#uses=1]
+@FULL = internal global i32 0 ; <i32*> [#uses=1]
+@PVS = internal global i32 0 ; <i32*> [#uses=1]
+@PVSF = internal global i32 0 ; <i32*> [#uses=1]
+@killer_scores = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@killer_scores2 = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@killer_scores3 = internal global [300 x i32] zeroinitializer ; <[300 x i32]*> [#uses=0]
+@time_failure.b = internal global i1 false ; <i1*> [#uses=0]
+@cur_score = internal global i32 0 ; <i32*> [#uses=0]
+@legals = internal global i32 0 ; <i32*> [#uses=3]
+@movetotal = internal global i32 0 ; <i32*> [#uses=0]
+@searching_move = internal global [20 x i8] zeroinitializer ; <[20 x i8]*> [#uses=0]
+@is_pondering.b = internal global i1 false ; <i1*> [#uses=6]
+@true_i_depth = internal global i8 0 ; <i8*> [#uses=1]
+@is_analyzing.b = internal global i1 false ; <i1*> [#uses=0]
+@inc = internal global i32 0 ; <i32*> [#uses=1]
+@time_cushion = internal global i32 0 ; <i32*> [#uses=2]
+@str40.upgrd.84 = internal global [16 x i8] c"Opening phase.\0A\00" ; <[16 x i8]*> [#uses=1]
+@str.upgrd.85 = internal global [19 x i8] c"Middlegame phase.\0A\00" ; <[19 x i8]*> [#uses=1]
+@str1.upgrd.86 = internal global [16 x i8] c"Endgame phase.\0A\00" ; <[16 x i8]*> [#uses=1]
+@str43 = internal global [20 x i8] c"Time for move : %d\0A\00" ; <[20 x i8]*> [#uses=1]
+@postpv = internal global [256 x i8] zeroinitializer ; <[256 x i8]*> [#uses=0]
+@str44 = internal global [49 x i8] c"tellics whisper %d restart(s), ended up with %s\0A\00" ; <[49 x i8]*> [#uses=0]
+@moves_to_tc = internal global i32 0 ; <i32*> [#uses=0]
+@str45 = internal global [27 x i8] c"tellics kibitz Mate in %d\0A\00" ; <[27 x i8]*> [#uses=0]
+@str46 = internal global [52 x i8] c"tellics ptell Mate in %d, give him no more pieces.\0A\00" ; <[52 x i8]*> [#uses=0]
+@tradefreely.b = internal global i1 false ; <i1*> [#uses=0]
+@str.upgrd.87 = internal global [37 x i8] c"tellics ptell You can trade freely.\0A\00" ; <[37 x i8]*> [#uses=0]
+@str47 = internal global [25 x i8] c"tellics ptell ---trades\0A\00" ; <[25 x i8]*> [#uses=0]
+@str2.upgrd.88 = internal global [49 x i8] c"tellics kibitz Both players dead...resigning...\0A\00" ; <[49 x i8]*> [#uses=0]
+@str3.upgrd.89 = internal global [16 x i8] c"tellics resign\0A\00" ; <[16 x i8]*> [#uses=0]
+@str48 = internal global [81 x i8] c"tellics ptell I am forcedly mated (dead). Tell me 'go' to start moving into it.\0A\00" ; <[81 x i8]*> [#uses=0]
+@str.upgrd.90 = internal global [62 x i8] c"tellics ptell I'll have to sit...(lose piece that mates you)\0A\00" ; <[62 x i8]*> [#uses=0]
+@see_num_attackers = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=0]
+@see_attackers = internal global [2 x [16 x %struct.see_data]] zeroinitializer ; <[2 x [16 x %struct.see_data]]*> [#uses=0]
+@scentral = internal global [144 x i32] [ i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 3, i32 5, i32 5, i32 3, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 2, i32 15, i32 15, i32 15, i32 15, i32 2, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 7, i32 15, i32 25, i32 25, i32 15, i32 7, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 7, i32 15, i32 25, i32 25, i32 15, i32 7, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 2, i32 15, i32 15, i32 15, i32 15, i32 2, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -10, i32 0, i32 3, i32 5, i32 5, i32 3, i32 0, i32 -10, i32 0, i32 0, i32 0, i32 0, i32 -20, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -10, i32 -20, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 ] ; <[144 x i32]*> [#uses=0]
+@str51 = internal global [81 x i8] c"/Volumes/Stuff/src/speccpu2006-091-llvm/benchspec//CPU2006/458.sjeng/src/seval.c\00" ; <[81 x i8]*> [#uses=0]
+@divider = internal global [50 x i8] c"-------------------------------------------------\00" ; <[50 x i8]*> [#uses=0]
+@min_per_game = internal global i32 0 ; <i32*> [#uses=0]
+@opp_rating = internal global i32 0 ; <i32*> [#uses=0]
+@my_rating = internal global i32 0 ; <i32*> [#uses=0]
+@str53 = internal global [15 x i8] c"SPEC Workload\0A\00" ; <[15 x i8]*> [#uses=0]
+@opening_history = internal global [256 x i8] zeroinitializer ; <[256 x i8]*> [#uses=0]
+@str60 = internal global [81 x i8] c"Material score: %d Eval : %d MaxPosDiff: %d White hand: %d Black hand : %d\0A\00" ; <[81 x i8]*> [#uses=0]
+@str61 = internal global [26 x i8] c"Hash : %X HoldHash : %X\0A\00" ; <[26 x i8]*> [#uses=0]
+@str62 = internal global [9 x i8] c"move %s\0A\00" ; <[9 x i8]*> [#uses=0]
+@str63 = internal global [5 x i8] c"\0A%s\0A\00" ; <[5 x i8]*> [#uses=0]
+@str64 = internal global [19 x i8] c"0-1 {Black Mates}\0A\00" ; <[19 x i8]*> [#uses=0]
+@str1.upgrd.91 = internal global [19 x i8] c"1-0 {White Mates}\0A\00" ; <[19 x i8]*> [#uses=0]
+@str65 = internal global [27 x i8] c"1/2-1/2 {Fifty move rule}\0A\00" ; <[27 x i8]*> [#uses=0]
+@str2.upgrd.92 = internal global [29 x i8] c"1/2-1/2 {3 fold repetition}\0A\00" ; <[29 x i8]*> [#uses=0]
+@str66 = internal global [16 x i8] c"1/2-1/2 {Draw}\0A\00" ; <[16 x i8]*> [#uses=0]
+@str68 = internal global [8 x i8] c"Sjeng: \00" ; <[8 x i8]*> [#uses=0]
+@str69 = internal global [18 x i8] c"Illegal move: %s\0A\00" ; <[18 x i8]*> [#uses=0]
+@str3.upgrd.93 = internal global [9 x i8] c"setboard\00" ; <[9 x i8]*> [#uses=0]
+@str470 = internal global [5 x i8] c"quit\00" ; <[5 x i8]*> [#uses=0]
+@str571 = internal global [5 x i8] c"exit\00" ; <[5 x i8]*> [#uses=0]
+@str6.upgrd.94 = internal global [8 x i8] c"diagram\00" ; <[8 x i8]*> [#uses=0]
+@str7.upgrd.95 = internal global [2 x i8] c"d\00" ; <[2 x i8]*> [#uses=0]
+@str72 = internal global [6 x i8] c"perft\00" ; <[6 x i8]*> [#uses=0]
+@str73 = internal global [3 x i8] c"%d\00" ; <[3 x i8]*> [#uses=0]
+@str74 = internal global [28 x i8] c"Raw nodes for depth %d: %i\0A\00" ; <[28 x i8]*> [#uses=0]
+@str.upgrd.96 = internal global [13 x i8] c"Time : %.2f\0A\00" ; <[13 x i8]*> [#uses=0]
+@str75 = internal global [4 x i8] c"new\00" ; <[4 x i8]*> [#uses=0]
+@str.upgrd.97 = internal global [40 x i8] c"tellics set 1 Sjeng SPEC 1.0 (SPEC/%s)\0A\00" ; <[40 x i8]*> [#uses=0]
+@str.upgrd.98 = internal global [7 x i8] c"xboard\00" ; <[7 x i8]*> [#uses=0]
+@str8.upgrd.99 = internal global [6 x i8] c"nodes\00" ; <[6 x i8]*> [#uses=0]
+@str77 = internal global [38 x i8] c"Number of nodes: %i (%0.2f%% qnodes)\0A\00" ; <[38 x i8]*> [#uses=0]
+@str9.upgrd.100 = internal global [5 x i8] c"post\00" ; <[5 x i8]*> [#uses=0]
+@str10.upgrd.101 = internal global [7 x i8] c"nopost\00" ; <[7 x i8]*> [#uses=0]
+@str11.upgrd.102 = internal global [7 x i8] c"random\00" ; <[7 x i8]*> [#uses=0]
+@str12.upgrd.103 = internal global [5 x i8] c"hard\00" ; <[5 x i8]*> [#uses=0]
+@str13.upgrd.104 = internal global [5 x i8] c"easy\00" ; <[5 x i8]*> [#uses=0]
+@str14.upgrd.105 = internal global [2 x i8] c"?\00" ; <[2 x i8]*> [#uses=0]
+@str15.upgrd.106 = internal global [6 x i8] c"white\00" ; <[6 x i8]*> [#uses=0]
+@str16.upgrd.107 = internal global [6 x i8] c"black\00" ; <[6 x i8]*> [#uses=0]
+@str17.upgrd.108 = internal global [6 x i8] c"force\00" ; <[6 x i8]*> [#uses=0]
+@str18.upgrd.109 = internal global [5 x i8] c"eval\00" ; <[5 x i8]*> [#uses=0]
+@str.upgrd.110 = internal global [10 x i8] c"Eval: %d\0A\00" ; <[10 x i8]*> [#uses=0]
+@str2178 = internal global [3 x i8] c"%i\00" ; <[3 x i8]*> [#uses=0]
+@str22.upgrd.111 = internal global [5 x i8] c"otim\00" ; <[5 x i8]*> [#uses=0]
+@opp_time = internal global i32 0 ; <i32*> [#uses=0]
+@str23.upgrd.112 = internal global [6 x i8] c"level\00" ; <[6 x i8]*> [#uses=0]
+@str.upgrd.113 = internal global [12 x i8] c"%i %i:%i %i\00" ; <[12 x i8]*> [#uses=0]
+@sec_per_game = internal global i32 0 ; <i32*> [#uses=0]
+@str24.upgrd.114 = internal global [9 x i8] c"%i %i %i\00" ; <[9 x i8]*> [#uses=0]
+@str25.upgrd.115 = internal global [7 x i8] c"rating\00" ; <[7 x i8]*> [#uses=0]
+@str26.upgrd.116 = internal global [6 x i8] c"%i %i\00" ; <[6 x i8]*> [#uses=0]
+@str27.upgrd.117 = internal global [8 x i8] c"holding\00" ; <[8 x i8]*> [#uses=0]
+@str28.upgrd.118 = internal global [8 x i8] c"variant\00" ; <[8 x i8]*> [#uses=0]
+@str29.upgrd.119 = internal global [7 x i8] c"normal\00" ; <[7 x i8]*> [#uses=0]
+@str79 = internal global [11 x i8] c"crazyhouse\00" ; <[11 x i8]*> [#uses=0]
+@str30.upgrd.120 = internal global [9 x i8] c"bughouse\00" ; <[9 x i8]*> [#uses=0]
+@str31.upgrd.121 = internal global [8 x i8] c"suicide\00" ; <[8 x i8]*> [#uses=0]
+@str32.upgrd.122 = internal global [9 x i8] c"giveaway\00" ; <[9 x i8]*> [#uses=0]
+@str33.upgrd.123 = internal global [7 x i8] c"losers\00" ; <[7 x i8]*> [#uses=0]
+@str34.upgrd.124 = internal global [8 x i8] c"analyze\00" ; <[8 x i8]*> [#uses=0]
+@str35.upgrd.125 = internal global [5 x i8] c"undo\00" ; <[5 x i8]*> [#uses=0]
+@str36.upgrd.126 = internal global [18 x i8] c"Move number : %d\0A\00" ; <[18 x i8]*> [#uses=0]
+@str37.upgrd.127 = internal global [7 x i8] c"remove\00" ; <[7 x i8]*> [#uses=0]
+@str38.upgrd.128 = internal global [5 x i8] c"edit\00" ; <[5 x i8]*> [#uses=0]
+@str41.upgrd.129 = internal global [2 x i8] c"#\00" ; <[2 x i8]*> [#uses=0]
+@str42.upgrd.130 = internal global [8 x i8] c"partner\00" ; <[8 x i8]*> [#uses=0]
+@str43.upgrd.131 = internal global [9 x i8] c"$partner\00" ; <[9 x i8]*> [#uses=0]
+@str44.upgrd.132 = internal global [6 x i8] c"ptell\00" ; <[6 x i8]*> [#uses=0]
+@str45.upgrd.133 = internal global [5 x i8] c"test\00" ; <[5 x i8]*> [#uses=0]
+@str46.upgrd.134 = internal global [3 x i8] c"st\00" ; <[3 x i8]*> [#uses=0]
+@str47.upgrd.135 = internal global [7 x i8] c"result\00" ; <[7 x i8]*> [#uses=0]
+@str48.upgrd.136 = internal global [6 x i8] c"prove\00" ; <[6 x i8]*> [#uses=0]
+@str49 = internal global [26 x i8] c"\0AMax time to search (s): \00" ; <[26 x i8]*> [#uses=0]
+@str50 = internal global [5 x i8] c"ping\00" ; <[5 x i8]*> [#uses=0]
+@str51.upgrd.137 = internal global [9 x i8] c"pong %d\0A\00" ; <[9 x i8]*> [#uses=0]
+@str52 = internal global [6 x i8] c"fritz\00" ; <[6 x i8]*> [#uses=0]
+@str53.upgrd.138 = internal global [6 x i8] c"reset\00" ; <[6 x i8]*> [#uses=0]
+@str54 = internal global [3 x i8] c"sd\00" ; <[3 x i8]*> [#uses=0]
+@str55 = internal global [26 x i8] c"New max depth set to: %d\0A\00" ; <[26 x i8]*> [#uses=0]
+@str56 = internal global [5 x i8] c"auto\00" ; <[5 x i8]*> [#uses=0]
+@str57 = internal global [9 x i8] c"protover\00" ; <[9 x i8]*> [#uses=0]
+@str.upgrd.139 = internal global [63 x i8] c"feature ping=0 setboard=1 playother=0 san=0 usermove=0 time=1\0A\00" ; <[63 x i8]*> [#uses=0]
+@str80 = internal global [53 x i8] c"feature draw=0 sigint=0 sigterm=0 reuse=1 analyze=0\0A\00" ; <[53 x i8]*> [#uses=0]
+@str.upgrd.140 = internal global [33 x i8] c"feature myname=\22Sjeng SPEC 1.0\22\0A\00" ; <[33 x i8]*> [#uses=0]
+@str.upgrd.141 = internal global [71 x i8] c"feature variants=\22normal,bughouse,crazyhouse,suicide,giveaway,losers\22\0A\00" ; <[71 x i8]*> [#uses=0]
+@str.upgrd.142 = internal global [46 x i8] c"feature colors=1 ics=0 name=0 pause=0 done=1\0A\00" ; <[46 x i8]*> [#uses=0]
+@str58 = internal global [9 x i8] c"accepted\00" ; <[9 x i8]*> [#uses=0]
+@str59 = internal global [9 x i8] c"rejected\00" ; <[9 x i8]*> [#uses=0]
+@str.upgrd.143 = internal global [65 x i8] c"Interface does not support a required feature...expect trouble.\0A\00" ; <[65 x i8]*> [#uses=0]
+@str61.upgrd.144 = internal global [6 x i8] c"\0A%s\0A\0A\00" ; <[6 x i8]*> [#uses=0]
+@str81 = internal global [41 x i8] c"diagram/d: toggle diagram display\0A\00" ; <[41 x i8]*> [#uses=0]
+@str82 = internal global [34 x i8] c"exit/quit: terminate Sjeng\0A\00" ; <[34 x i8]*> [#uses=0]
+@str62.upgrd.145 = internal global [51 x i8] c"go: make Sjeng play the side to move\0A\00" ; <[51 x i8]*> [#uses=0]
+@str83 = internal global [35 x i8] c"new: start a new game\0A\00" ; <[35 x i8]*> [#uses=0]
+@str84 = internal global [55 x i8] c"level <x>: the xboard style command to set time\0A\00" ; <[55 x i8]*> [#uses=0]
+@str85 = internal global [49 x i8] c" <x> should be in the form: <a> <b> <c> where:\0A\00" ; <[49 x i8]*> [#uses=0]
+@str63.upgrd.146 = internal global [49 x i8] c" a -> moves to TC (0 if using an ICS style TC)\0A\00" ; <[49 x i8]*> [#uses=0]
+@str86 = internal global [25 x i8] c" b -> minutes per game\0A\00" ; <[25 x i8]*> [#uses=0]
+@str64.upgrd.147 = internal global [29 x i8] c" c -> increment in seconds\0A\00" ; <[29 x i8]*> [#uses=0]
+@str65.upgrd.148 = internal global [55 x i8] c"nodes: outputs the number of nodes searched\0A\00" ; <[55 x i8]*> [#uses=0]
+@str87 = internal global [47 x i8] c"perft <x>: compute raw nodes to depth x\0A\00" ; <[47 x i8]*> [#uses=0]
+@str.upgrd.149 = internal global [42 x i8] c"post: toggles thinking output\0A\00" ; <[42 x i8]*> [#uses=0]
+@str.upgrd.150 = internal global [45 x i8] c"xboard: put Sjeng into xboard mode\0A\00" ; <[45 x i8]*> [#uses=0]
+@str.upgrd.151 = internal global [39 x i8] c"test: run an EPD testsuite\0A\00" ; <[39 x i8]*> [#uses=0]
+@str88 = internal global [52 x i8] c"speed: test movegen and evaluation speed\0A\00" ; <[52 x i8]*> [#uses=0]
+@str89 = internal global [59 x i8] c"proof: try to prove or disprove the current pos\0A\00" ; <[59 x i8]*> [#uses=0]
+@str90 = internal global [44 x i8] c"sd <x>: limit thinking to depth x\0A\00" ; <[44 x i8]*> [#uses=0]
+@str66.upgrd.152 = internal global [51 x i8] c"st <x>: limit thinking to x centiseconds\0A\00" ; <[51 x i8]*> [#uses=0]
+@str67 = internal global [54 x i8] c"setboard <FEN>: set board to a specified FEN string\0A\00" ; <[54 x i8]*> [#uses=0]
+@str68.upgrd.153 = internal global [38 x i8] c"undo: back up a half move\0A\00" ; <[38 x i8]*> [#uses=0]
+@str69.upgrd.154 = internal global [38 x i8] c"remove: back up a full move\0A\00" ; <[38 x i8]*> [#uses=0]
+@str70 = internal global [42 x i8] c"force: disable computer moving\0A\00" ; <[42 x i8]*> [#uses=0]
+@str71 = internal global [44 x i8] c"auto: computer plays both sides\0A\00" ; <[44 x i8]*> [#uses=0]
+@DP_TTable = internal global %struct.TType* null ; <%struct.TType**> [#uses=1]
+@AS_TTable = internal global %struct.TType* null ; <%struct.TType**> [#uses=1]
+@QS_TTable = internal global %struct.QTType* null ; <%struct.QTType**> [#uses=1]
+@str93 = internal global [38 x i8] c"Out of memory allocating hashtables.\0A\00" ; <[38 x i8]*> [#uses=0]
+@type_to_char.3058 = internal global [14 x i32] [ i32 70, i32 80, i32 80, i32 78, i32 78, i32 75, i32 75, i32 82, i32 82, i32 81, i32 81, i32 66, i32 66, i32 69 ] ; <[14 x i32]*> [#uses=0]
+@str94 = internal global [8 x i8] c"%c@%c%d\00" ; <[8 x i8]*> [#uses=0]
+@str95 = internal global [5 x i8] c"%c%d\00" ; <[5 x i8]*> [#uses=0]
+@str1.upgrd.155 = internal global [8 x i8] c"%c%d=%c\00" ; <[8 x i8]*> [#uses=0]
+@str2.upgrd.156 = internal global [8 x i8] c"%cx%c%d\00" ; <[8 x i8]*> [#uses=0]
+@str96 = internal global [11 x i8] c"%cx%c%d=%c\00" ; <[11 x i8]*> [#uses=0]
+@str97 = internal global [4 x i8] c"O-O\00" ; <[4 x i8]*> [#uses=0]
+@str98 = internal global [6 x i8] c"O-O-O\00" ; <[6 x i8]*> [#uses=0]
+@str99 = internal global [9 x i8] c"%c%c%c%d\00" ; <[9 x i8]*> [#uses=0]
+@str3100 = internal global [9 x i8] c"%c%d%c%d\00" ; <[9 x i8]*> [#uses=0]
+@str101 = internal global [10 x i8] c"%c%cx%c%d\00" ; <[10 x i8]*> [#uses=0]
+@str4.upgrd.157 = internal global [10 x i8] c"%c%dx%c%d\00" ; <[10 x i8]*> [#uses=0]
+@str102 = internal global [7 x i8] c"%c%c%d\00" ; <[7 x i8]*> [#uses=0]
+@str5103 = internal global [5 x i8] c"illg\00" ; <[5 x i8]*> [#uses=0]
+@type_to_char.3190 = internal global [14 x i32] [ i32 70, i32 80, i32 112, i32 78, i32 110, i32 75, i32 107, i32 82, i32 114, i32 81, i32 113, i32 66, i32 98, i32 69 ] ; <[14 x i32]*> [#uses=0]
+@str7.upgrd.158 = internal global [10 x i8] c"%c%d%c%dn\00" ; <[10 x i8]*> [#uses=0]
+@str8.upgrd.159 = internal global [10 x i8] c"%c%d%c%dr\00" ; <[10 x i8]*> [#uses=0]
+@str9.upgrd.160 = internal global [10 x i8] c"%c%d%c%db\00" ; <[10 x i8]*> [#uses=0]
+@str10.upgrd.161 = internal global [10 x i8] c"%c%d%c%dk\00" ; <[10 x i8]*> [#uses=0]
+@str11.upgrd.162 = internal global [10 x i8] c"%c%d%c%dq\00" ; <[10 x i8]*> [#uses=0]
+@C.88.3251 = internal global [14 x i8*] [ i8* getelementptr ([3 x i8]* @str105, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str12106, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str13107, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str141, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str152, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str163, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str174, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str185, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str19108, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str206, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str21109, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str227, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str238, i32 0, i32 0), i8* getelementptr ([3 x i8]* @str249, i32 0, i32 0) ] ; <[14 x i8*]*> [#uses=0]
+@str105 = internal global [3 x i8] c"!!\00" ; <[3 x i8]*> [#uses=1]
+@str12106 = internal global [3 x i8] c" P\00" ; <[3 x i8]*> [#uses=1]
+@str13107 = internal global [3 x i8] c"*P\00" ; <[3 x i8]*> [#uses=1]
+@str141 = internal global [3 x i8] c" N\00" ; <[3 x i8]*> [#uses=1]
+@str152 = internal global [3 x i8] c"*N\00" ; <[3 x i8]*> [#uses=1]
+@str163 = internal global [3 x i8] c" K\00" ; <[3 x i8]*> [#uses=1]
+@str174 = internal global [3 x i8] c"*K\00" ; <[3 x i8]*> [#uses=1]
+@str185 = internal global [3 x i8] c" R\00" ; <[3 x i8]*> [#uses=1]
+@str19108 = internal global [3 x i8] c"*R\00" ; <[3 x i8]*> [#uses=1]
+@str206 = internal global [3 x i8] c" Q\00" ; <[3 x i8]*> [#uses=1]
+@str21109 = internal global [3 x i8] c"*Q\00" ; <[3 x i8]*> [#uses=1]
+@str227 = internal global [3 x i8] c" B\00" ; <[3 x i8]*> [#uses=1]
+@str238 = internal global [3 x i8] c"*B\00" ; <[3 x i8]*> [#uses=1]
+@str249 = internal global [3 x i8] c" \00" ; <[3 x i8]*> [#uses=1]
+@str110 = internal global [42 x i8] c"+----+----+----+----+----+----+----+----+\00" ; <[42 x i8]*> [#uses=0]
+@str25.upgrd.163 = internal global [6 x i8] c" %s\0A\00" ; <[6 x i8]*> [#uses=0]
+@str26.upgrd.164 = internal global [5 x i8] c"%d |\00" ; <[5 x i8]*> [#uses=0]
+@str27.upgrd.165 = internal global [6 x i8] c" %s |\00" ; <[6 x i8]*> [#uses=0]
+@str28.upgrd.166 = internal global [7 x i8] c"\0A %s\0A\00" ; <[7 x i8]*> [#uses=0]
+@str111 = internal global [45 x i8] c"\0A a b c d e f g h\0A\0A\00" ; <[45 x i8]*> [#uses=0]
+@str29.upgrd.167 = internal global [45 x i8] c"\0A h g f e d c b a\0A\0A\00" ; <[45 x i8]*> [#uses=0]
+@str33.upgrd.168 = internal global [2 x i8] c"<\00" ; <[2 x i8]*> [#uses=0]
+@str34.upgrd.169 = internal global [3 x i8] c"> \00" ; <[3 x i8]*> [#uses=0]
+@str114.upgrd.170 = internal global [18 x i8] c"%2i %7i %5i %8i \00" ; <[18 x i8]*> [#uses=0]
+@str115 = internal global [20 x i8] c"%2i %c%1i.%02i %9i \00" ; <[20 x i8]*> [#uses=0]
+@str39.upgrd.171 = internal global [5 x i8] c"%s !\00" ; <[5 x i8]*> [#uses=0]
+@str40.upgrd.172 = internal global [6 x i8] c"%s !!\00" ; <[6 x i8]*> [#uses=0]
+@str41.upgrd.173 = internal global [6 x i8] c"%s ??\00" ; <[6 x i8]*> [#uses=0]
+@str124 = internal global [71 x i8] c"\0ASjeng version SPEC 1.0, Copyright (C) 2000-2005 Gian-Carlo Pascutto\0A\0A\00" ; <[71 x i8]*> [#uses=0]
+@state = internal global [625 x i32] zeroinitializer ; <[625 x i32]*> [#uses=0]
+
+declare fastcc i32 @calc_attackers(i32, i32)
+
+declare fastcc i32 @is_attacked(i32, i32)
+
+declare fastcc void @ProcessHoldings(i8*)
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32)
+
+declare i8* @strncpy(i8*, i8*, i32)
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+declare void @__eprintf(i8*, i8*, i32, i8*)
+
+declare fastcc void @addHolding(i32, i32)
+
+declare fastcc void @removeHolding(i32, i32)
+
+declare fastcc void @DropremoveHolding(i32, i32)
+
+declare i32 @printf(i8*, ...)
+
+declare fastcc i32 @is_draw()
+
+declare void @exit(i32)
+
+declare fastcc void @setup_epd_line(i8*)
+
+declare i32 @atoi(i8*)
+
+declare fastcc void @reset_piece_square()
+
+declare fastcc void @initialize_hash()
+
+declare i32 @__maskrune(i32, i32)
+
+declare fastcc void @comp_to_san(i64, i64, i64, i8*)
+
+declare i8* @strstr(i8*, i8*)
+
+declare i32 @atol(i8*)
+
+declare %struct.FILE* @fopen(i8*, i8*)
+
+declare fastcc void @display_board(i32)
+
+define internal void @think(%struct.move_s* sret %agg.result) {
+entry:
+ %output.i = alloca [8 x i8], align 8 ; <[8 x i8]*> [#uses=0]
+ %comp_move = alloca %struct.move_s, align 16 ; <%struct.move_s*> [#uses=7]
+ %temp_move = alloca %struct.move_s, align 16 ; <%struct.move_s*> [#uses=6]
+ %moves = alloca [512 x %struct.move_s], align 16 ; <[512 x %struct.move_s]*> [#uses=7]
+ %output = alloca [8 x i8], align 8 ; <[8 x i8]*> [#uses=1]
+ store i1 false, i1* @userealholdings.b
+ %tmp = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0 ; <%struct.move_s*> [#uses=3]
+ %tmp362 = getelementptr %struct.move_s* %comp_move, i32 0, i32 0 ; <i32*> [#uses=0]
+ %tmp365 = getelementptr %struct.move_s* %comp_move, i32 0, i32 1 ; <i32*> [#uses=0]
+ %tmp368 = getelementptr %struct.move_s* %comp_move, i32 0, i32 2 ; <i32*> [#uses=0]
+ %tmp371 = getelementptr %struct.move_s* %comp_move, i32 0, i32 3 ; <i32*> [#uses=0]
+ %tmp374 = getelementptr %struct.move_s* %comp_move, i32 0, i32 4 ; <i32*> [#uses=0]
+ %tmp377 = getelementptr %struct.move_s* %comp_move, i32 0, i32 5 ; <i32*> [#uses=0]
+ %tmp.upgrd.174 = bitcast %struct.move_s* %comp_move to { i64, i64, i64 }* ; <{ i64, i64, i64 }*> [#uses=3]
+ %tmp.upgrd.175 = getelementptr { i64, i64, i64 }* %tmp.upgrd.174, i32 0, i32 0 ; <i64*> [#uses=0]
+ %tmp829 = getelementptr { i64, i64, i64 }* %tmp.upgrd.174, i32 0, i32 1 ; <i64*> [#uses=0]
+ %tmp832 = getelementptr { i64, i64, i64 }* %tmp.upgrd.174, i32 0, i32 2 ; <i64*> [#uses=0]
+ %output.upgrd.176 = getelementptr [8 x i8]* %output, i32 0, i32 0 ; <i8*> [#uses=0]
+ %tmp573 = getelementptr %struct.move_s* %temp_move, i32 0, i32 0 ; <i32*> [#uses=0]
+ %tmp576 = getelementptr %struct.move_s* %temp_move, i32 0, i32 1 ; <i32*> [#uses=0]
+ %tmp579 = getelementptr %struct.move_s* %temp_move, i32 0, i32 2 ; <i32*> [#uses=0]
+ %tmp582 = getelementptr %struct.move_s* %temp_move, i32 0, i32 3 ; <i32*> [#uses=0]
+ %tmp585 = getelementptr %struct.move_s* %temp_move, i32 0, i32 4 ; <i32*> [#uses=0]
+ %tmp588 = getelementptr %struct.move_s* %temp_move, i32 0, i32 5 ; <i32*> [#uses=0]
+ %pn_restart.0.ph = bitcast i32 0 to i32 ; <i32> [#uses=2]
+ %tmp21362 = icmp eq i32 0, 0 ; <i1> [#uses=2]
+ %tmp216 = sitofp i32 %pn_restart.0.ph to float ; <float> [#uses=1]
+ %tmp216.upgrd.177 = fpext float %tmp216 to double ; <double> [#uses=1]
+ %tmp217 = add double %tmp216.upgrd.177, 1.000000e+00 ; <double> [#uses=1]
+ %tmp835 = icmp sgt i32 %pn_restart.0.ph, 9 ; <i1> [#uses=0]
+ store i32 0, i32* @nodes
+ store i32 0, i32* @qnodes
+ store i32 1, i32* @ply
+ store i32 0, i32* @ECacheProbes
+ store i32 0, i32* @ECacheHits
+ store i32 0, i32* @TTProbes
+ store i32 0, i32* @TTHits
+ store i32 0, i32* @TTStores
+ store i32 0, i32* @NCuts
+ store i32 0, i32* @NTries
+ store i32 0, i32* @TExt
+ store i32 0, i32* @FH
+ store i32 0, i32* @FHF
+ store i32 0, i32* @PVS
+ store i32 0, i32* @FULL
+ store i32 0, i32* @PVSF
+ store i32 0, i32* @ext_check
+ store i32 0, i32* @ext_onerep
+ store i32 0, i32* @razor_drop
+ store i32 0, i32* @razor_material
+ store i1 false, i1* @extendedtime.b
+ store i1 false, i1* @forcedwin.b
+ store i32 200, i32* @maxposdiff
+ store i8 0, i8* @true_i_depth
+ store i32 0, i32* @legals
+ %tmp48 = load i32* @Variant ; <i32> [#uses=1]
+ %tmp49 = icmp eq i32 %tmp48, 4 ; <i1> [#uses=1]
+ %storemerge = zext i1 %tmp49 to i32 ; <i32> [#uses=1]
+ store i32 %storemerge, i32* @captures
+ call fastcc void @gen( %struct.move_s* %tmp )
+ %tmp53 = load i32* @numb_moves ; <i32> [#uses=1]
+ %tmp.i = load i32* @Variant ; <i32> [#uses=1]
+ %tmp.i.upgrd.178 = icmp eq i32 %tmp.i, 3 ; <i1> [#uses=1]
+ br i1 %tmp.i.upgrd.178, label %in_check.exit, label %cond_next.i
+
+cond_next.i: ; preds = %entry
+ %tmp2.i5 = load i32* @white_to_move ; <i32> [#uses=1]
+ %tmp3.i = icmp eq i32 %tmp2.i5, 1 ; <i1> [#uses=0]
+ ret void
+
+in_check.exit: ; preds = %entry
+ %tmp7637 = icmp sgt i32 %tmp53, 0 ; <i1> [#uses=1]
+ br i1 %tmp7637, label %cond_true77, label %bb80
+
+cond_true77: ; preds = %in_check.exit
+ %l.1.0 = bitcast i32 0 to i32 ; <i32> [#uses=2]
+ call fastcc void @make( %struct.move_s* %tmp, i32 %l.1.0 )
+ %tmp61 = call fastcc i32 @check_legal( %struct.move_s* %tmp, i32 %l.1.0, i32 0 ) ; <i32> [#uses=1]
+ %tmp62 = icmp eq i32 %tmp61, 0 ; <i1> [#uses=0]
+ ret void
+
+bb80: ; preds = %in_check.exit
+ %tmp81 = load i32* @Variant ; <i32> [#uses=1]
+ %tmp82 = icmp eq i32 %tmp81, 4 ; <i1> [#uses=1]
+ br i1 %tmp82, label %cond_true83, label %cond_next118
+
+cond_true83: ; preds = %bb80
+ %tmp84 = load i32* @legals ; <i32> [#uses=1]
+ %tmp85 = icmp eq i32 %tmp84, 0 ; <i1> [#uses=0]
+ ret void
+
+cond_next118: ; preds = %bb80
+ %tmp119 = load i32* @Variant ; <i32> [#uses=1]
+ %tmp120 = icmp eq i32 %tmp119, 1 ; <i1> [#uses=1]
+ br i1 %tmp120, label %cond_next176, label %cond_true121
+
+cond_true121: ; preds = %cond_next118
+ %tmp122.b = load i1* @is_pondering.b ; <i1> [#uses=1]
+ br i1 %tmp122.b, label %cond_next176, label %cond_true124
+
+cond_true124: ; preds = %cond_true121
+ %tmp125 = load i32* @legals ; <i32> [#uses=1]
+ %tmp126 = icmp eq i32 %tmp125, 1 ; <i1> [#uses=1]
+ br i1 %tmp126, label %cond_true127, label %cond_next176
+
+cond_true127: ; preds = %cond_true124
+ %tmp128 = load i32* @inc ; <i32> [#uses=1]
+ %tmp129 = mul i32 %tmp128, 100 ; <i32> [#uses=1]
+ %tmp130 = load i32* @time_cushion ; <i32> [#uses=1]
+ %tmp131 = add i32 %tmp129, %tmp130 ; <i32> [#uses=1]
+ store i32 %tmp131, i32* @time_cushion
+ %tmp134 = getelementptr %struct.move_s* %agg.result, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp135 = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp136 = load i32* %tmp135 ; <i32> [#uses=1]
+ store i32 %tmp136, i32* %tmp134
+ %tmp137 = getelementptr %struct.move_s* %agg.result, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp138 = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp139 = load i32* %tmp138 ; <i32> [#uses=1]
+ store i32 %tmp139, i32* %tmp137
+ %tmp140 = getelementptr %struct.move_s* %agg.result, i32 0, i32 2 ; <i32*> [#uses=1]
+ %tmp141 = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0, i32 2 ; <i32*> [#uses=1]
+ %tmp142 = load i32* %tmp141 ; <i32> [#uses=1]
+ store i32 %tmp142, i32* %tmp140
+ %tmp143 = getelementptr %struct.move_s* %agg.result, i32 0, i32 3 ; <i32*> [#uses=1]
+ %tmp144 = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0, i32 3 ; <i32*> [#uses=1]
+ %tmp145 = load i32* %tmp144 ; <i32> [#uses=1]
+ store i32 %tmp145, i32* %tmp143
+ %tmp146 = getelementptr %struct.move_s* %agg.result, i32 0, i32 4 ; <i32*> [#uses=1]
+ %tmp147 = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0, i32 4 ; <i32*> [#uses=1]
+ %tmp148 = load i32* %tmp147 ; <i32> [#uses=1]
+ store i32 %tmp148, i32* %tmp146
+ %tmp149 = getelementptr %struct.move_s* %agg.result, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp150 = getelementptr [512 x %struct.move_s]* %moves, i32 0, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp151 = load i32* %tmp150 ; <i32> [#uses=1]
+ store i32 %tmp151, i32* %tmp149
+ ret void
+
+cond_next176: ; preds = %cond_true124, %cond_true121, %cond_next118
+ call fastcc void @check_phase( )
+ %tmp177 = load i32* @phase ; <i32> [#uses=1]
+ switch i32 %tmp177, label %bb187 [
+ i32 0, label %bb178
+ i32 1, label %bb180
+ i32 2, label %bb183
+ ]
+
+bb178: ; preds = %cond_next176
+ %tmp179 = call i32 (i8*, ...)* @printf( i8* getelementptr ([16 x i8]* @str40.upgrd.84, i32 0, i64 0) ) ; <i32> [#uses=0]
+ %tmp18854.b = load i1* @is_pondering.b ; <i1> [#uses=1]
+ br i1 %tmp18854.b, label %cond_false210, label %cond_true190
+
+bb180: ; preds = %cond_next176
+ %tmp182 = call i32 (i8*, ...)* @printf( i8* getelementptr ([19 x i8]* @str.upgrd.85, i32 0, i64 0) ) ; <i32> [#uses=0]
+ %tmp18856.b = load i1* @is_pondering.b ; <i1> [#uses=0]
+ ret void
+
+bb183: ; preds = %cond_next176
+ %tmp185 = call i32 (i8*, ...)* @printf( i8* getelementptr ([16 x i8]* @str1.upgrd.86, i32 0, i64 0) ) ; <i32> [#uses=0]
+ %tmp18858.b = load i1* @is_pondering.b ; <i1> [#uses=0]
+ ret void
+
+bb187: ; preds = %cond_next176
+ %tmp188.b = load i1* @is_pondering.b ; <i1> [#uses=0]
+ ret void
+
+cond_true190: ; preds = %bb178
+ %tmp191 = load i32* @fixed_time ; <i32> [#uses=1]
+ %tmp192 = icmp eq i32 %tmp191, 0 ; <i1> [#uses=0]
+ ret void
+
+cond_false210: ; preds = %bb178
+ store i32 999999, i32* @time_for_move
+ br i1 %tmp21362, label %cond_true226.critedge, label %bb287.critedge
+
+cond_true226.critedge: ; preds = %cond_false210
+ %tmp223.c = call i32 (i8*, ...)* @printf( i8* getelementptr ([20 x i8]* @str43, i32 0, i64 0), i32 999999 ) ; <i32> [#uses=0]
+ %tmp.i.upgrd.179 = load %struct.TType** @DP_TTable ; <%struct.TType*> [#uses=1]
+ %tmp.i7.b = load i1* @TTSize.b ; <i1> [#uses=1]
+ %tmp1.i = select i1 %tmp.i7.b, i32 60000000, i32 0 ; <i32> [#uses=1]
+ %tmp.i.sb = getelementptr %struct.TType* %tmp.i.upgrd.179, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %tmp.i.sb, i8 0, i32 %tmp1.i, i32 4 )
+ %tmp2.i = load %struct.TType** @AS_TTable ; <%struct.TType*> [#uses=1]
+ %tmp3.i8.b = load i1* @TTSize.b ; <i1> [#uses=1]
+ %tmp4.i = select i1 %tmp3.i8.b, i32 60000000, i32 0 ; <i32> [#uses=1]
+ %tmp2.i.upgrd.180 = getelementptr %struct.TType* %tmp2.i, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %tmp2.i.upgrd.180, i8 0, i32 %tmp4.i, i32 4 )
+ %tmp.i.QTT = load %struct.QTType** @QS_TTable ; <%struct.QTType*> [#uses=1]
+ %tmp5.i9.b = load i1* @TTSize.b ; <i1> [#uses=1]
+ %tmp6.i10 = select i1 %tmp5.i9.b, i32 48000000, i32 0 ; <i32> [#uses=1]
+ %tmp7.i = getelementptr %struct.QTType* %tmp.i.QTT, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %tmp7.i, i8 0, i32 %tmp6.i10, i32 4 )
+ %tmp.i.ECache = load %struct.ECacheType** @ECache ; <%struct.ECacheType*> [#uses=1]
+ %tmp.i14.b = load i1* @ECacheSize.b ; <i1> [#uses=1]
+ %tmp1.i16 = select i1 %tmp.i14.b, i32 12000000, i32 0 ; <i32> [#uses=1]
+ %tmp.i17 = bitcast %struct.ECacheType* %tmp.i.ECache to i8* ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %tmp.i17, i8 0, i32 %tmp1.i16, i32 4 )
+ call void @llvm.memset.i32( i8* bitcast ([300 x i32]* @rootlosers to i8*), i8 0, i32 1200, i32 4 )
+ %tmp234.b = load i1* @is_pondering.b ; <i1> [#uses=1]
+ br i1 %tmp234.b, label %bb263, label %cond_next238
+
+cond_next238: ; preds = %cond_true226.critedge
+ %tmp239 = load i32* @Variant ; <i32> [#uses=2]
+ switch i32 %tmp239, label %bb263 [
+ i32 3, label %bb249
+ i32 4, label %bb249
+ ]
+
+bb249: ; preds = %cond_next238, %cond_next238
+ %tmp250 = load i32* @piece_count ; <i32> [#uses=1]
+ %tmp251 = icmp sgt i32 %tmp250, 3 ; <i1> [#uses=1]
+ %tmp240.not = icmp ne i32 %tmp239, 3 ; <i1> [#uses=1]
+ %brmerge = or i1 %tmp251, %tmp240.not ; <i1> [#uses=1]
+ br i1 %brmerge, label %bb260, label %bb263
+
+bb260: ; preds = %bb249
+ %tmp261 = load i32* @time_for_move ; <i32> [#uses=1]
+ %tmp261.upgrd.181 = sitofp i32 %tmp261 to float ; <float> [#uses=1]
+ %tmp261.upgrd.182 = fpext float %tmp261.upgrd.181 to double ; <double> [#uses=1]
+ %tmp262 = fdiv double %tmp261.upgrd.182, 3.000000e+00 ; <double> [#uses=1]
+ %tmp262.upgrd.183 = fptosi double %tmp262 to i32 ; <i32> [#uses=1]
+ store i32 %tmp262.upgrd.183, i32* @pn_time
+ %tmp1.b.i = load i1* @PBSize.b ; <i1> [#uses=1]
+ %tmp1.i1 = select i1 %tmp1.b.i, i32 200000, i32 0 ; <i32> [#uses=1]
+ %tmp.i2 = call i8* @calloc( i32 %tmp1.i1, i32 44 ) ; <i8*> [#uses=1]
+ %tmp.i.ub = bitcast i8* %tmp.i2 to i8* ; <i8*> [#uses=1]
+ store i8* %tmp.i.ub, i8** @membuff
+ %tmp2.i3 = call i8* @calloc( i32 1, i32 44 ) ; <i8*> [#uses=3]
+ %tmp2.i.upgrd.184 = bitcast i8* %tmp2.i3 to %struct.node_t* ; <%struct.node_t*> [#uses=6]
+ %tmp.i.move_s = getelementptr [512 x %struct.move_s]* null, i32 0, i32 0 ; <%struct.move_s*> [#uses=3]
+ call fastcc void @gen( %struct.move_s* %tmp.i.move_s )
+ %tmp3.i4 = load i32* @numb_moves ; <i32> [#uses=4]
+ %tmp3.i5 = bitcast i32 %tmp3.i4 to i32 ; <i32> [#uses=0]
+ store i1 false, i1* @alllosers.b
+ call void @llvm.memset.i32( i8* bitcast ([300 x i32]* @rootlosers to i8*), i8 0, i32 1200, i32 4 )
+ %nodesspent.i = bitcast [512 x i32]* null to i8* ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %nodesspent.i, i8 0, i32 2048, i32 16 )
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 0)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 1)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 2)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 3)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 4)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 5)
+ %tmp.i.i = load i32* @Variant ; <i32> [#uses=1]
+ %tmp.i.i.upgrd.185 = icmp eq i32 %tmp.i.i, 3 ; <i1> [#uses=1]
+ br i1 %tmp.i.i.upgrd.185, label %in_check.exit.i, label %cond_next.i.i
+
+cond_next.i.i: ; preds = %bb260
+ %tmp2.i.i = load i32* @white_to_move ; <i32> [#uses=1]
+ %tmp3.i.i = icmp eq i32 %tmp2.i.i, 1 ; <i1> [#uses=1]
+ br i1 %tmp3.i.i, label %cond_true4.i.i, label %cond_false12.i.i
+
+cond_true4.i.i: ; preds = %cond_next.i.i
+ %tmp5.i.i = load i32* @wking_loc ; <i32> [#uses=1]
+ %tmp6.i.i = call fastcc i32 @is_attacked( i32 %tmp5.i.i, i32 0 ) ; <i32> [#uses=1]
+ %not.tmp7.i.i = icmp ne i32 %tmp6.i.i, 0 ; <i1> [#uses=1]
+ %tmp217.i = zext i1 %not.tmp7.i.i to i32 ; <i32> [#uses=1]
+ %tmp4219.i = icmp sgt i32 %tmp3.i4, 0 ; <i1> [#uses=1]
+ br i1 %tmp4219.i, label %cond_true43.i, label %bb46.i
+
+cond_false12.i.i: ; preds = %cond_next.i.i
+ %tmp13.i.i = load i32* @bking_loc ; <i32> [#uses=1]
+ %tmp14.i.i = call fastcc i32 @is_attacked( i32 %tmp13.i.i, i32 1 ) ; <i32> [#uses=1]
+ %not.tmp15.i.i = icmp ne i32 %tmp14.i.i, 0 ; <i1> [#uses=1]
+ %tmp2120.i = zext i1 %not.tmp15.i.i to i32 ; <i32> [#uses=1]
+ %tmp4222.i = icmp sgt i32 %tmp3.i4, 0 ; <i1> [#uses=1]
+ br i1 %tmp4222.i, label %cond_true43.i, label %bb46.i
+
+in_check.exit.i: ; preds = %bb260
+ %tmp4224.i = icmp sgt i32 %tmp3.i4, 0 ; <i1> [#uses=0]
+ ret void
+
+cond_true43.i: ; preds = %cond_false12.i.i, %cond_true4.i.i
+ %tmp21.0.ph.i = phi i32 [ %tmp217.i, %cond_true4.i.i ], [ %tmp2120.i, %cond_false12.i.i ] ; <i32> [#uses=1]
+ %i.0.0.i = bitcast i32 0 to i32 ; <i32> [#uses=2]
+ call fastcc void @make( %struct.move_s* %tmp.i.move_s, i32 %i.0.0.i )
+ %tmp27.i = call fastcc i32 @check_legal( %struct.move_s* %tmp.i.move_s, i32 %i.0.0.i, i32 %tmp21.0.ph.i ) ; <i32> [#uses=1]
+ %tmp.i6 = icmp eq i32 %tmp27.i, 0 ; <i1> [#uses=0]
+ ret void
+
+bb46.i: ; preds = %cond_false12.i.i, %cond_true4.i.i
+ %tmp48.i = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp48.i, label %cond_true49.i, label %cond_next53.i
+
+cond_true49.i: ; preds = %bb46.i
+ store i32 0, i32* @bufftop
+ %tmp50.i = load i8** @membuff ; <i8*> [#uses=1]
+ free i8* %tmp50.i
+ free i8* %tmp2.i3
+ ret void
+
+cond_next53.i: ; preds = %bb46.i
+ store i32 1, i32* @nodecount
+ store i32 0, i32* @iters
+ store i32 0, i32* @maxply
+ store i32 0, i32* @forwards
+ %tmp54.i = load i32* @move_number ; <i32> [#uses=1]
+ %tmp55.i = load i32* @ply ; <i32> [#uses=1]
+ %tmp56.i = add i32 %tmp54.i, -1 ; <i32> [#uses=1]
+ %tmp57.i = add i32 %tmp56.i, %tmp55.i ; <i32> [#uses=1]
+ %tmp58.i = load i32* @hash ; <i32> [#uses=1]
+ %tmp.i.upgrd.186 = getelementptr [600 x i32]* @hash_history, i32 0, i32 %tmp57.i ; <i32*> [#uses=1]
+ store i32 %tmp58.i, i32* %tmp.i.upgrd.186
+ %tmp59.i = load i32* @white_to_move ; <i32> [#uses=1]
+ %tmp60.i = icmp eq i32 %tmp59.i, 0 ; <i1> [#uses=1]
+ %tmp60.i.upgrd.187 = zext i1 %tmp60.i to i32 ; <i32> [#uses=1]
+ store i32 %tmp60.i.upgrd.187, i32* @root_to_move
+ %tmp.i4.i = load i32* @Variant ; <i32> [#uses=2]
+ %tmp.i5.i = icmp eq i32 %tmp.i4.i, 3 ; <i1> [#uses=1]
+ br i1 %tmp.i5.i, label %cond_true.i.i, label %cond_false.i.i
+
+cond_true.i.i: ; preds = %cond_next53.i
+ call fastcc void @suicide_pn_eval( %struct.node_t* %tmp2.i.upgrd.184 )
+ %tmp6328.i = getelementptr %struct.node_t* %tmp2.i.upgrd.184, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp29.i = load i8* %tmp6328.i ; <i8> [#uses=1]
+ %tmp6430.i = icmp eq i8 %tmp29.i, 1 ; <i1> [#uses=0]
+ ret void
+
+cond_false.i.i: ; preds = %cond_next53.i
+ %tmp2.i.i.upgrd.188 = icmp eq i32 %tmp.i4.i, 4 ; <i1> [#uses=1]
+ %tmp63.i = getelementptr %struct.node_t* %tmp2.i.upgrd.184, i32 0, i32 0 ; <i8*> [#uses=2]
+ br i1 %tmp2.i.i.upgrd.188, label %cond_true3.i.i, label %cond_false5.i.i
+
+cond_true3.i.i: ; preds = %cond_false.i.i
+ call fastcc void @losers_pn_eval( %struct.node_t* %tmp2.i.upgrd.184 )
+ %tmp31.i = load i8* %tmp63.i ; <i8> [#uses=1]
+ %tmp6432.i = icmp eq i8 %tmp31.i, 1 ; <i1> [#uses=1]
+ br i1 %tmp6432.i, label %bb75.i, label %cond_next67.i
+
+cond_false5.i.i: ; preds = %cond_false.i.i
+ call fastcc void @std_pn_eval( %struct.node_t* %tmp2.i.upgrd.184 )
+ %tmp.i.upgrd.189 = load i8* %tmp63.i ; <i8> [#uses=1]
+ %tmp64.i = icmp eq i8 %tmp.i.upgrd.189, 1 ; <i1> [#uses=0]
+ ret void
+
+cond_next67.i: ; preds = %cond_true3.i.i
+ %tmp69.i = getelementptr %struct.node_t* %tmp2.i.upgrd.184, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp70.i = load i8* %tmp69.i ; <i8> [#uses=1]
+ %tmp71.i = icmp eq i8 %tmp70.i, 0 ; <i1> [#uses=0]
+ ret void
+
+bb75.i: ; preds = %cond_true3.i.i
+ store i32 0, i32* @bufftop
+ %tmp76.i = load i8** @membuff ; <i8*> [#uses=1]
+ free i8* %tmp76.i
+ free i8* %tmp2.i3
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 0)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 1)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 2)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 3)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 4)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 5)
+ %tmp28869 = load i32* @result ; <i32> [#uses=1]
+ %tmp28970 = icmp eq i32 %tmp28869, 0 ; <i1> [#uses=1]
+ br i1 %tmp28970, label %cond_next337, label %cond_true290
+
+bb263: ; preds = %bb249, %cond_next238, %cond_true226.critedge
+ br i1 %tmp21362, label %cond_true266, label %bb287
+
+cond_true266: ; preds = %bb263
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 0)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 1)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 2)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 3)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 4)
+ store i32 0, i32* getelementptr (%struct.move_s* @pn_move, i64 0, i32 5)
+ %tmp28871 = load i32* @result ; <i32> [#uses=1]
+ %tmp28972 = icmp eq i32 %tmp28871, 0 ; <i1> [#uses=0]
+ ret void
+
+bb287.critedge: ; preds = %cond_false210
+ %tmp218.c = fdiv double 1.999998e+06, %tmp217 ; <double> [#uses=1]
+ %tmp218.c.upgrd.190 = fptosi double %tmp218.c to i32 ; <i32> [#uses=2]
+ store i32 %tmp218.c.upgrd.190, i32* @time_for_move
+ %tmp22367.c = call i32 (i8*, ...)* @printf( i8* getelementptr ([20 x i8]* @str43, i32 0, i64 0), i32 %tmp218.c.upgrd.190 ) ; <i32> [#uses=0]
+ ret void
+
+bb287: ; preds = %bb263
+ %tmp288 = load i32* @result ; <i32> [#uses=1]
+ %tmp289 = icmp eq i32 %tmp288, 0 ; <i1> [#uses=0]
+ ret void
+
+cond_true290: ; preds = %bb75.i
+ %tmp292 = load i32* getelementptr (%struct.move_s* @pn_move, i32 0, i32 1) ; <i32> [#uses=1]
+ %tmp295 = icmp eq i32 %tmp292, 0 ; <i1> [#uses=0]
+ ret void
+
+cond_next337: ; preds = %bb75.i
+ %tmp338.b = load i1* @forcedwin.b ; <i1> [#uses=1]
+ br i1 %tmp338.b, label %bb348, label %cond_next342
+
+cond_next342: ; preds = %cond_next337
+ %tmp343 = load i32* @result ; <i32> [#uses=1]
+ %tmp344 = icmp eq i32 %tmp343, 0 ; <i1> [#uses=0]
+ ret void
+
+bb348: ; preds = %cond_next337
+ %tmp350 = load i32* getelementptr (%struct.move_s* @pn_move, i32 0, i32 1) ; <i32> [#uses=1]
+ %tmp353 = icmp eq i32 %tmp350, 0 ; <i1> [#uses=0]
+ ret void
+}
+
+declare fastcc i32 @eval(i32, i32)
+
+declare i8* @fgets(i8*, i32, %struct.FILE*)
+
+declare i32 @fclose(%struct.FILE*)
+
+declare fastcc i32 @losers_eval()
+
+declare fastcc i32 @l_bishop_mobility(i32)
+
+declare fastcc i32 @l_rook_mobility(i32)
+
+declare fastcc i32 @check_legal(%struct.move_s*, i32, i32)
+
+declare fastcc void @gen(%struct.move_s*)
+
+declare fastcc void @push_pawn(i32, i32)
+
+declare fastcc void @push_knighT(i32)
+
+declare fastcc void @push_slidE(i32)
+
+declare fastcc void @push_king(i32)
+
+declare fastcc i32 @f_in_check(%struct.move_s*, i32)
+
+declare fastcc void @make(%struct.move_s*, i32)
+
+declare fastcc void @add_capture(i32, i32, i32)
+
+declare fastcc void @unmake(%struct.move_s*, i32)
+
+declare i32 @ErrorIt(i32, i32)
+
+declare i32 @Pawn(i32, i32)
+
+declare i32 @Knight(i32, i32)
+
+declare i32 @King(i32, i32)
+
+declare i32 @Rook(i32, i32)
+
+declare i32 @Queen(i32, i32)
+
+declare i32 @Bishop(i32, i32)
+
+declare fastcc void @check_phase()
+
+declare fastcc i32 @bishop_mobility(i32)
+
+declare fastcc i32 @rook_mobility(i32)
+
+declare i32 @sscanf(i8*, i8*, ...)
+
+declare i32 @strncmp(i8*, i8*, i32)
+
+declare i8* @strchr(i8*, i32)
+
+declare fastcc void @CheckBadFlow(i32)
+
+declare fastcc void @suicide_pn_eval(%struct.node_t*)
+
+declare fastcc void @losers_pn_eval(%struct.node_t*)
+
+declare fastcc void @std_pn_eval(%struct.node_t*)
+
+declare fastcc %struct.node_t* @select_most_proving(%struct.node_t*)
+
+declare fastcc void @set_proof_and_disproof_numbers(%struct.node_t*)
+
+declare fastcc void @StoreTT(i32, i32, i32, i32, i32, i32)
+
+declare fastcc void @develop_node(%struct.node_t*)
+
+declare fastcc void @update_ancestors(%struct.node_t*)
+
+declare i8* @calloc(i32, i32)
+
+declare fastcc void @comp_to_coord(i64, i64, i64, i8*)
+
+declare i8* @strcat(i8*, i8*)
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+declare fastcc void @order_moves(%struct.move_s*, i32*, i32*, i32, i32)
+
+declare fastcc i32 @see(i32, i32, i32)
+
+declare fastcc void @perft(i32)
+
+declare fastcc i32 @qsearch(i32, i32, i32)
+
+declare fastcc i32 @allocate_time()
+
+declare fastcc void @QStoreTT(i32, i32, i32, i32)
+
+declare fastcc i32 @search(i32, i32, i32, i32)
+
+declare fastcc i32 @ProbeTT(i32*, i32, i32*, i32*, i32*, i32)
+
+declare void @search_root(%struct.move_s* sret , i32, i32, i32)
+
+declare fastcc void @post_fh_thinking(i32, %struct.move_s*)
+
+declare fastcc void @post_thinking(i32)
+
+declare i32 @fprintf(%struct.FILE*, i8*, ...)
+
+declare fastcc i32 @s_bishop_mobility(i32)
+
+declare fastcc i32 @s_rook_mobility(i32)
+
+declare fastcc i32 @suicide_mid_eval()
+
+declare i32 @main(i32, i8**)
+
+declare fastcc void @init_game()
+
+declare void @setbuf(%struct.FILE*, i8*)
+
+declare i8* @strcpy(i8*, i8*)
+
+declare i32 @__tolower(i32)
+
+declare i32 @strcmp(i8*, i8*)
+
+declare void (i32)* @signal(i32, void (i32)*)
+
+declare fastcc void @hash_extract_pv(i32, i8*)
+
+declare double @difftime(i32, i32)
+
+declare i32 @getc(%struct.FILE*)
+
+declare i32 @strlen(i8*)
+
+declare i32 @fwrite(i8*, i32, i32, %struct.FILE*)
diff --git a/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll b/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll
new file mode 100644
index 000000000000..0ba8479a2c55
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep tmp5
+; PR2599
+
+define void @foo({ i32, i32 }* %x) nounwind {
+entry:
+ %tmp4 = getelementptr { i32, i32 }* %x, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp5 = load i32* %tmp4, align 4 ; <i32> [#uses=1]
+ %tmp7 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=2]
+ %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1]
+ %tmp17 = sub i32 0, %tmp8 ; <i32> [#uses=1]
+ store i32 %tmp5, i32* %tmp4, align 4
+ store i32 %tmp17, i32* %tmp7, align 4
+ ret void
+}
diff --git a/test/Transforms/DeadStoreElimination/2008-11-28-MemDepUpdate.ll b/test/Transforms/DeadStoreElimination/2008-11-28-MemDepUpdate.ll
new file mode 100644
index 000000000000..0f3350d80c72
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2008-11-28-MemDepUpdate.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis
+; PR3141
+ %struct.ada__tags__dispatch_table = type { [1 x i32] }
+ %struct.f393a00_1__object = type { %struct.ada__tags__dispatch_table*, i8 }
+ %struct.f393a00_2__windmill = type { %struct.f393a00_1__object, i16 }
+
+define void @f393a00_2__swap(%struct.f393a00_2__windmill* %a, %struct.f393a00_2__windmill* %b) {
+entry:
+ %t = alloca %struct.f393a00_2__windmill ; <%struct.f393a00_2__windmill*> [#uses=1]
+ %0 = getelementptr %struct.f393a00_2__windmill* %t, i32 0, i32 0, i32 0 ; <%struct.ada__tags__dispatch_table**> [#uses=1]
+ %1 = load %struct.ada__tags__dispatch_table** null, align 4 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
+ %2 = load %struct.ada__tags__dispatch_table** %0, align 8 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
+ store %struct.ada__tags__dispatch_table* %2, %struct.ada__tags__dispatch_table** null, align 4
+ store %struct.ada__tags__dispatch_table* %1, %struct.ada__tags__dispatch_table** null, align 4
+ ret void
+}
diff --git a/test/Transforms/DeadStoreElimination/2008-11-29-OffEndOfBlock.ll b/test/Transforms/DeadStoreElimination/2008-11-29-OffEndOfBlock.ll
new file mode 100644
index 000000000000..11e2ffd3d08f
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2008-11-29-OffEndOfBlock.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct.cab_archive = type { i32, i16, i16, i16, i16, i8, %struct.cab_folder*, %struct.cab_file* }
+ %struct.cab_file = type { i32, i16, i64, i8*, i32, i32, i32, %struct.cab_folder*, %struct.cab_file*, %struct.cab_archive*, %struct.cab_state* }
+ %struct.cab_folder = type { i16, i16, %struct.cab_archive*, i64, %struct.cab_folder* }
+ %struct.cab_state = type { i8*, i8*, [38912 x i8], i16, i16, i8*, i16 }
+ %struct.lzx_stream = type { i32, i32, i8, i64, i64, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i32, i8*, i8*, i8*, i8*, i8*, i32, i32, i32, [84 x i8], [720 x i8], [314 x i8], [72 x i8], [104 x i16], [5408 x i16], [4596 x i16], [144 x i16], [51 x i32], [51 x i8], [32768 x i8], %struct.cab_file*, i32 (%struct.cab_file*, i8*, i32)* }
+
+declare fastcc i32 @lzx_read_lens(%struct.lzx_stream*, i8*, i32, i32) nounwind
+
+define i32 @lzx_decompress(%struct.lzx_stream* %lzx, i64 %out_bytes) nounwind {
+bb13: ; preds = %entry
+ %0 = getelementptr %struct.lzx_stream* %lzx, i32 0, i32 25 ; <i8**> [#uses=2]
+ %1 = getelementptr %struct.lzx_stream* %lzx, i32 0, i32 26 ; <i8**> [#uses=2]
+ %2 = getelementptr %struct.lzx_stream* %lzx, i32 0, i32 29 ; <i32*> [#uses=0]
+ br label %bb14
+
+bb14: ; preds = %bb13
+ %3 = load i8** %0, align 4 ; <i8*> [#uses=1]
+ %4 = load i8** %1, align 4 ; <i8*> [#uses=1]
+ store i8* %3, i8** %0, align 4
+ store i8* %4, i8** %1, align 4
+ %5 = call fastcc i32 @lzx_read_lens(%struct.lzx_stream* %lzx, i8* null, i32 256, i32 0) nounwind ; <i32> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/DeadStoreElimination/PartialStore.ll b/test/Transforms/DeadStoreElimination/PartialStore.ll
new file mode 100644
index 000000000000..ce1965724f10
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/PartialStore.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | \
+; RUN: not grep {store i8}
+; Ensure that the dead store is deleted in this case. It is wholely
+; overwritten by the second store.
+define i32 @test() {
+ %V = alloca i32 ; <i32*> [#uses=3]
+ %V2 = bitcast i32* %V to i8* ; <i8*> [#uses=1]
+ store i8 0, i8* %V2
+ store i32 1234567, i32* %V
+ %X = load i32* %V ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/DeadStoreElimination/alloca.ll b/test/Transforms/DeadStoreElimination/alloca.ll
new file mode 100644
index 000000000000..7a2c94ffca62
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/alloca.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
+
+define void @test(i32* %Q) {
+ %P = alloca i32 ; <i32*> [#uses=1]
+ %DEAD = load i32* %Q ; <i32> [#uses=1]
+ store i32 %DEAD, i32* %P
+ ret void
+}
+
diff --git a/test/Transforms/DeadStoreElimination/byval.ll b/test/Transforms/DeadStoreElimination/byval.ll
new file mode 100644
index 000000000000..08f69a40c579
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/byval.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep store
+
+%struct.x = type { i32, i32, i32, i32 }
+
+define i32 @foo(%struct.x* byval %a) nounwind {
+entry:
+ %tmp2 = getelementptr %struct.x* %a, i32 0, i32 0
+ store i32 1, i32* %tmp2, align 4
+ ret i32 1
+}
diff --git a/test/Transforms/DeadStoreElimination/context-sensitive.ll b/test/Transforms/DeadStoreElimination/context-sensitive.ll
new file mode 100644
index 000000000000..266fdbc647ed
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/context-sensitive.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
+
+declare void @ext()
+
+define i32* @caller() {
+ %P = malloc i32 ; <i32*> [#uses=4]
+ %DEAD = load i32* %P ; <i32> [#uses=1]
+ %DEAD2 = add i32 %DEAD, 1 ; <i32> [#uses=1]
+ store i32 %DEAD2, i32* %P
+ call void @ext( )
+ store i32 0, i32* %P
+ ret i32* %P
+}
+
diff --git a/test/Transforms/DeadStoreElimination/dg.exp b/test/Transforms/DeadStoreElimination/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/DeadStoreElimination/free.ll b/test/Transforms/DeadStoreElimination/free.ll
new file mode 100644
index 000000000000..246de9386cc3
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/free.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
+
+define void @test(i32* %Q, i32* %P) {
+ %DEAD = load i32* %Q ; <i32> [#uses=1]
+ store i32 %DEAD, i32* %P
+ free i32* %P
+ ret void
+}
+
+define void @test2({i32, i32}* %P) {
+ %Q = getelementptr {i32, i32} *%P, i32 0, i32 1
+ store i32 4, i32* %Q
+ free {i32,i32}* %P
+ ret void
+}
diff --git a/test/Transforms/DeadStoreElimination/memcpy.ll b/test/Transforms/DeadStoreElimination/memcpy.ll
new file mode 100644
index 000000000000..e96b2e8fb1ed
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/memcpy.ll
@@ -0,0 +1,52 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep alloca
+; ModuleID = 'placeholder.adb'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.placeholder__T5b = type { i32, [1 x i32] }
+ %struct.placeholder__an_interval___PAD = type { %struct.placeholder__interval, [4 x i32] }
+ %struct.placeholder__interval = type { i32, i32 }
+ %struct.placeholder__s__s__the_interval___PAD = type { %struct.placeholder__interval }
+
+define void @_ada_placeholder() nounwind {
+entry:
+ %an_interval = alloca %struct.placeholder__an_interval___PAD ; <%struct.placeholder__an_interval___PAD*> [#uses=3]
+ %tmp34 = bitcast %struct.placeholder__an_interval___PAD* %an_interval to %struct.placeholder__T5b* ; <%struct.placeholder__T5b*> [#uses=1]
+ %tmp5 = getelementptr %struct.placeholder__an_interval___PAD* %an_interval, i32 0, i32 0, i32 0 ; <i32*> [#uses=2]
+ store i32 1, i32* %tmp5, align 8
+ %tmp10 = getelementptr %struct.placeholder__T5b* %tmp34, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp10, align 4
+ %tmp82 = load i32* %tmp5, align 8 ; <i32> [#uses=5]
+ %tmp83 = icmp slt i32 %tmp82, 6 ; <i1> [#uses=1]
+ %min84 = select i1 %tmp83, i32 %tmp82, i32 5 ; <i32> [#uses=3]
+ %tmp85 = icmp sgt i32 %min84, -1 ; <i1> [#uses=2]
+ %min84.cast193 = zext i32 %min84 to i64 ; <i64> [#uses=1]
+ %min84.cast193.op = shl i64 %min84.cast193, 33 ; <i64> [#uses=1]
+ %tmp104 = icmp sgt i32 %tmp82, -1 ; <i1> [#uses=2]
+ %tmp103.cast192 = zext i32 %tmp82 to i64 ; <i64> [#uses=1]
+ %tmp103.cast192.op = shl i64 %tmp103.cast192, 33 ; <i64> [#uses=1]
+ %min84.cast193.op.op = ashr i64 %min84.cast193.op, 28 ; <i64> [#uses=1]
+ %sextr121 = select i1 %tmp85, i64 %min84.cast193.op.op, i64 0 ; <i64> [#uses=2]
+ %tmp103.cast192.op.op = ashr i64 %tmp103.cast192.op, 28 ; <i64> [#uses=1]
+ %sextr123 = select i1 %tmp104, i64 %tmp103.cast192.op.op, i64 0 ; <i64> [#uses=2]
+ %tmp124 = icmp sle i64 %sextr121, %sextr123 ; <i1> [#uses=1]
+ %min125 = select i1 %tmp124, i64 %sextr121, i64 %sextr123 ; <i64> [#uses=1]
+ %sextr131194 = and i64 %min125, 34359738336 ; <i64> [#uses=1]
+ %tmp134 = add i64 %sextr131194, 63 ; <i64> [#uses=1]
+ lshr i64 %tmp134, 3 ; <i64>:0 [#uses=1]
+ %tmp150188.shrunk = trunc i64 %0 to i32 ; <i32> [#uses=1]
+ %tmp159 = and i32 %tmp150188.shrunk, -4 ; <i32> [#uses=1]
+ %tmp161 = alloca i8, i32 %tmp159 ; <i8*> [#uses=1]
+ %min167.op = shl i32 %min84, 2 ; <i32> [#uses=1]
+ %tmp170 = select i1 %tmp85, i32 %min167.op, i32 0 ; <i32> [#uses=2]
+ %tmp173.op = shl i32 %tmp82, 2 ; <i32> [#uses=1]
+ %tmp176 = select i1 %tmp104, i32 %tmp173.op, i32 0 ; <i32> [#uses=2]
+ %tmp177 = icmp sle i32 %tmp170, %tmp176 ; <i1> [#uses=1]
+ %min178 = select i1 %tmp177, i32 %tmp170, i32 %tmp176 ; <i32> [#uses=1]
+ %tmp179 = add i32 %min178, 7 ; <i32> [#uses=1]
+ %tmp180 = and i32 %tmp179, -4 ; <i32> [#uses=1]
+ %tmp183185 = bitcast %struct.placeholder__an_interval___PAD* %an_interval to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp161, i8* %tmp183185, i32 %tmp180, i32 4 )
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll
new file mode 100644
index 000000000000..594671d0f0f1
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/simple.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
+
+define void @test(i32* %Q, i32* %P) {
+ %DEAD = load i32* %Q ; <i32> [#uses=1]
+ store i32 %DEAD, i32* %P
+ store i32 0, i32* %P
+ ret void
+}
+
diff --git a/test/Transforms/DeadStoreElimination/volatile-load.ll b/test/Transforms/DeadStoreElimination/volatile-load.ll
new file mode 100644
index 000000000000..c458284dca76
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/volatile-load.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {volatile load}
+
+@g_1 = global i32 0
+
+define void @foo() nounwind {
+ %t = volatile load i32* @g_1
+ ret void
+}
diff --git a/test/Transforms/FunctionAttrs/2008-09-03-Mutual.ll b/test/Transforms/FunctionAttrs/2008-09-03-Mutual.ll
new file mode 100644
index 000000000000..5261ac465889
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-09-03-Mutual.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep readnone
+
+define i32 @a() {
+ %tmp = call i32 @b( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+define i32 @b() {
+ %tmp = call i32 @a( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
diff --git a/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll b/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
new file mode 100644
index 000000000000..a17d381eec80
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep readnone | count 4
+@x = global i32 0
+
+declare i32 @e() readnone
+
+define i32 @f() {
+ %tmp = call i32 @e( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+define i32 @g() readonly {
+ ret i32 0
+}
+
+define i32 @h() readnone {
+ %tmp = load i32* @x ; <i32> [#uses=1]
+ ret i32 %tmp
+}
diff --git a/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll b/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
new file mode 100644
index 000000000000..cebfdacb4c0c
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep readonly | count 2
+
+define i32 @f() {
+entry:
+ %tmp = call i32 @e( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+declare i32 @e() readonly
diff --git a/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll b/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
new file mode 100644
index 000000000000..b6077fd8ee39
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep read
+; PR2792
+
+@g = global i32 0 ; <i32*> [#uses=1]
+
+define i32 @f() {
+ %t = volatile load i32* @g ; <i32> [#uses=1]
+ ret i32 %t
+}
diff --git a/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll b/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll
new file mode 100644
index 000000000000..50ca64120004
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep readnone | count 2
+
+declare i32 @g(i32*) readnone
+
+define i32 @f() {
+ %x = alloca i32 ; <i32*> [#uses=2]
+ store i32 0, i32* %x
+ %y = call i32 @g(i32* %x) ; <i32> [#uses=1]
+ ret i32 %y
+}
diff --git a/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll b/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
new file mode 100644
index 000000000000..d9c01171ac40
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep readnone
+
+@s = external constant i8 ; <i8*> [#uses=1]
+
+define i8 @f() {
+ %tmp = load i8* @s ; <i8> [#uses=1]
+ ret i8 %tmp
+}
diff --git a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
new file mode 100644
index 000000000000..39a64e6d36cc
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
@@ -0,0 +1,101 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep {nocapture *%%q}
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep {nocapture *%%p} | count 6
+@g = global i32* null ; <i32**> [#uses=1]
+
+define i32* @c1(i32* %q) {
+ ret i32* %q
+}
+
+define void @c2(i32* %q) {
+ store i32* %q, i32** @g
+ ret void
+}
+
+define void @c3(i32* %q) {
+ call void @c2(i32* %q)
+ ret void
+}
+
+define i1 @c4(i32* %q, i32 %bitno) {
+ %tmp = ptrtoint i32* %q to i32
+ %tmp2 = lshr i32 %tmp, %bitno
+ %bit = trunc i32 %tmp2 to i1
+ br i1 %bit, label %l1, label %l0
+l0:
+ ret i1 0 ; escaping value not caught by def-use chaining.
+l1:
+ ret i1 1 ; escaping value not caught by def-use chaining.
+}
+
+@lookup_table = global [2 x i1] [ i1 0, i1 1 ]
+
+define i1 @c5(i32* %q, i32 %bitno) {
+ %tmp = ptrtoint i32* %q to i32
+ %tmp2 = lshr i32 %tmp, %bitno
+ %bit = and i32 %tmp2, 1
+ ; subtle escape mechanism follows
+ %lookup = getelementptr [2 x i1]* @lookup_table, i32 0, i32 %bit
+ %val = load i1* %lookup
+ ret i1 %val
+}
+
+declare void @throw_if_bit_set(i8*, i8) readonly
+define i1 @c6(i8* %q, i8 %bit) {
+ invoke void @throw_if_bit_set(i8* %q, i8 %bit)
+ to label %ret0 unwind label %ret1
+ret0:
+ ret i1 0
+ret1:
+ ret i1 1
+}
+
+define i1* @lookup_bit(i32* %q, i32 %bitno) readnone nounwind {
+ %tmp = ptrtoint i32* %q to i32
+ %tmp2 = lshr i32 %tmp, %bitno
+ %bit = and i32 %tmp2, 1
+ %lookup = getelementptr [2 x i1]* @lookup_table, i32 0, i32 %bit
+ ret i1* %lookup
+}
+
+define i1 @c7(i32* %q, i32 %bitno) {
+ %ptr = call i1* @lookup_bit(i32* %q, i32 %bitno)
+ %val = load i1* %ptr
+ ret i1 %val
+}
+
+
+define i32 @nc1(i32* %q, i32* %p, i1 %b) {
+e:
+ br label %l
+l:
+ %x = phi i32* [ %p, %e ]
+ %y = phi i32* [ %q, %e ]
+ %tmp = bitcast i32* %x to i32* ; <i32*> [#uses=2]
+ %tmp2 = select i1 %b, i32* %tmp, i32* %y
+ %val = load i32* %tmp2 ; <i32> [#uses=1]
+ store i32 0, i32* %tmp
+ store i32* %y, i32** @g
+ ret i32 %val
+}
+
+define void @nc2(i32* %p, i32* %q) {
+ %1 = call i32 @nc1(i32* %q, i32* %p, i1 0) ; <i32> [#uses=0]
+ ret void
+}
+
+define void @nc3(void ()* %p) {
+ call void %p()
+ ret void
+}
+
+declare void @external(i8*) readonly nounwind
+define void @nc4(i8* %p) {
+ call void @external(i8* %p)
+ ret void
+}
+
+define void @nc5(void (i8*)* %f, i8* %p) {
+ call void %f(i8* %p) readonly nounwind
+ call void %f(i8* nocapture %p)
+ ret void
+}
diff --git a/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
new file mode 100644
index 000000000000..68a232f5ff3b
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep {nocapture *%%q}
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep {nocapture *%%p}
+
+define i32* @a(i32** %p) {
+ %tmp = load i32** %p
+ ret i32* %tmp
+}
+
+define i32* @b(i32 *%q) {
+ %mem = alloca i32*
+ store i32* %q, i32** %mem
+ %tmp = call i32* @a(i32** %mem)
+ ret i32* %tmp
+}
diff --git a/test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll b/test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll
new file mode 100644
index 000000000000..4022033c3b0e
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep read
+; PR3754
+
+define i8* @m(i32 %size) {
+ %tmp = malloc i8, i32 %size ; <i8*> [#uses=1]
+ ret i8* %tmp
+}
diff --git a/test/Transforms/FunctionAttrs/dg.exp b/test/Transforms/FunctionAttrs/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/FunctionAttrs/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/GVN/2007-07-25-DominatedLoop.ll b/test/Transforms/GVN/2007-07-25-DominatedLoop.ll
new file mode 100644
index 000000000000..7c10f970e084
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-25-DominatedLoop.ll
@@ -0,0 +1,86 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+ %struct.PerlInterpreter = type { i8 }
+@PL_sv_count = external global i32 ; <i32*> [#uses=2]
+
+define void @perl_destruct(%struct.PerlInterpreter* %sv_interp) {
+entry:
+ br i1 false, label %cond_next25, label %cond_true16
+
+cond_true16: ; preds = %entry
+ ret void
+
+cond_next25: ; preds = %entry
+ br i1 false, label %cond_next33, label %cond_true32
+
+cond_true32: ; preds = %cond_next25
+ ret void
+
+cond_next33: ; preds = %cond_next25
+ br i1 false, label %cond_next61, label %cond_true.i46
+
+cond_true.i46: ; preds = %cond_next33
+ ret void
+
+cond_next61: ; preds = %cond_next33
+ br i1 false, label %cond_next69, label %cond_true66
+
+cond_true66: ; preds = %cond_next61
+ ret void
+
+cond_next69: ; preds = %cond_next61
+ br i1 false, label %Perl_safefree.exit52, label %cond_true.i50
+
+cond_true.i50: ; preds = %cond_next69
+ ret void
+
+Perl_safefree.exit52: ; preds = %cond_next69
+ br i1 false, label %cond_next80, label %cond_true77
+
+cond_true77: ; preds = %Perl_safefree.exit52
+ ret void
+
+cond_next80: ; preds = %Perl_safefree.exit52
+ br i1 false, label %Perl_safefree.exit56, label %cond_true.i54
+
+cond_true.i54: ; preds = %cond_next80
+ ret void
+
+Perl_safefree.exit56: ; preds = %cond_next80
+ br i1 false, label %Perl_safefree.exit60, label %cond_true.i58
+
+cond_true.i58: ; preds = %Perl_safefree.exit56
+ ret void
+
+Perl_safefree.exit60: ; preds = %Perl_safefree.exit56
+ br i1 false, label %Perl_safefree.exit64, label %cond_true.i62
+
+cond_true.i62: ; preds = %Perl_safefree.exit60
+ ret void
+
+Perl_safefree.exit64: ; preds = %Perl_safefree.exit60
+ br i1 false, label %Perl_safefree.exit68, label %cond_true.i66
+
+cond_true.i66: ; preds = %Perl_safefree.exit64
+ ret void
+
+Perl_safefree.exit68: ; preds = %Perl_safefree.exit64
+ br i1 false, label %cond_next150, label %cond_true23.i
+
+cond_true23.i: ; preds = %Perl_safefree.exit68
+ ret void
+
+cond_next150: ; preds = %Perl_safefree.exit68
+ %tmp16092 = load i32* @PL_sv_count, align 4 ; <i32> [#uses=0]
+ br label %cond_next165
+
+bb157: ; preds = %cond_next165
+ %tmp158 = load i32* @PL_sv_count, align 4 ; <i32> [#uses=0]
+ br label %cond_next165
+
+cond_next165: ; preds = %bb157, %cond_next150
+ br i1 false, label %bb171, label %bb157
+
+bb171: ; preds = %cond_next165
+ ret void
+}
diff --git a/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll b/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll
new file mode 100644
index 000000000000..442ba083749f
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-25-InfiniteLoop.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {tmp10 =}
+
+ %struct.INT2 = type { i32, i32 }
+@blkshifts = external global %struct.INT2* ; <%struct.INT2**> [#uses=2]
+
+define i32 @xcompact() {
+entry:
+ store %struct.INT2* null, %struct.INT2** @blkshifts, align 4
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %tmp10 = load %struct.INT2** @blkshifts, align 4 ; <%struct.INT2*> [#uses=0]
+ br label %bb
+}
diff --git a/test/Transforms/GVN/2007-07-25-Loop.ll b/test/Transforms/GVN/2007-07-25-Loop.ll
new file mode 100644
index 000000000000..2efacb55a204
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-25-Loop.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+ %struct.s_segment_inf = type { float, i32, i16, i16, float, float, i32, float, float }
+
+define void @print_arch(i8* %arch_file, i32 %route_type, i64 %det_routing_arch.0.0, i64 %det_routing_arch.0.1, i64 %det_routing_arch.0.2, i64 %det_routing_arch.0.3, i64 %det_routing_arch.0.4, %struct.s_segment_inf* %segment_inf, i64 %timing_inf.0.0, i64 %timing_inf.0.1, i64 %timing_inf.0.2, i64 %timing_inf.0.3, i64 %timing_inf.0.4, i32 %timing_inf.1) {
+entry:
+ br i1 false, label %bb278, label %bb344
+
+bb278: ; preds = %bb278, %entry
+ br i1 false, label %bb278, label %bb344
+
+bb344: ; preds = %bb278, %entry
+ %tmp38758 = load i16* null, align 2 ; <i16> [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/GVN/2007-07-25-NestedLoop.ll b/test/Transforms/GVN/2007-07-25-NestedLoop.ll
new file mode 100644
index 000000000000..cebaaa39be08
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-25-NestedLoop.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+ %struct.TypHeader = type { i32, %struct.TypHeader**, [3 x i8], i8 }
+
+define %struct.TypHeader* @LtRec(%struct.TypHeader* %hdL, %struct.TypHeader* %hdR) {
+entry:
+ br i1 false, label %bb556.preheader, label %bb534.preheader
+
+bb534.preheader: ; preds = %entry
+ ret %struct.TypHeader* null
+
+bb556.preheader: ; preds = %entry
+ %tmp56119 = getelementptr %struct.TypHeader* %hdR, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp56220 = load i32* %tmp56119 ; <i32> [#uses=0]
+ br i1 false, label %bb.nph23, label %bb675.preheader
+
+bb.nph23: ; preds = %bb556.preheader
+ ret %struct.TypHeader* null
+
+bb656: ; preds = %bb675.outer, %bb656
+ %tmp678 = load i32* %tmp677 ; <i32> [#uses=0]
+ br i1 false, label %bb684, label %bb656
+
+bb684: ; preds = %bb675.outer, %bb656
+ br i1 false, label %bb924.preheader, label %bb675.outer
+
+bb675.outer: ; preds = %bb675.preheader, %bb684
+ %tmp67812 = load i32* %tmp67711 ; <i32> [#uses=0]
+ br i1 false, label %bb684, label %bb656
+
+bb675.preheader: ; preds = %bb556.preheader
+ %tmp67711 = getelementptr %struct.TypHeader* %hdR, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp677 = getelementptr %struct.TypHeader* %hdR, i32 0, i32 0 ; <i32*> [#uses=1]
+ br label %bb675.outer
+
+bb924.preheader: ; preds = %bb684
+ ret %struct.TypHeader* null
+}
diff --git a/test/Transforms/GVN/2007-07-25-SinglePredecessor.ll b/test/Transforms/GVN/2007-07-25-SinglePredecessor.ll
new file mode 100644
index 000000000000..10482d8be150
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-25-SinglePredecessor.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+ %struct.ggBRDF = type { i32 (...)** }
+ %struct.ggBox3 = type { %struct.ggPoint3, %struct.ggPoint3 }
+ %struct.ggMaterialRecord = type { %struct.ggPoint2, %struct.ggBox3, %struct.ggBox3, %struct.ggSpectrum, %struct.ggSpectrum, %struct.ggSpectrum, %struct.ggBRDF*, i32, i32, i32, i32 }
+ %struct.ggONB3 = type { %struct.ggPoint3, %struct.ggPoint3, %struct.ggPoint3 }
+ %struct.ggPoint2 = type { [2 x double] }
+ %struct.ggPoint3 = type { [3 x double] }
+ %struct.ggSpectrum = type { [8 x float] }
+ %struct.mrViewingHitRecord = type { double, %struct.ggPoint3, %struct.ggONB3, %struct.ggPoint2, double, %struct.ggSpectrum, %struct.ggSpectrum, i32, i32, i32, i32 }
+ %struct.mrXEllipticalCylinder = type { %struct.ggBRDF, float, float, float, float, float, float }
+
+define i32 @_ZNK21mrZEllipticalCylinder10viewingHitERK6ggRay3dddR18mrViewingHitRecordR16ggMaterialRecord(%struct.mrXEllipticalCylinder* %this, %struct.ggBox3* %ray, double %unnamed_arg, double %tmin, double %tmax, %struct.mrViewingHitRecord* %VHR, %struct.ggMaterialRecord* %unnamed_arg2) {
+entry:
+ %tmp80.i = getelementptr %struct.mrViewingHitRecord* %VHR, i32 0, i32 1, i32 0, i32 0 ; <double*> [#uses=1]
+ store double 0.000000e+00, double* %tmp80.i
+ br i1 false, label %return, label %cond_next.i
+
+cond_next.i: ; preds = %entry
+ br i1 false, label %return, label %cond_true
+
+cond_true: ; preds = %cond_next.i
+ %tmp3.i8 = getelementptr %struct.mrViewingHitRecord* %VHR, i32 0, i32 1, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp46 = load double* %tmp3.i8 ; <double> [#uses=0]
+ ret i32 1
+
+return: ; preds = %cond_next.i, %entry
+ ret i32 0
+}
diff --git a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
new file mode 100644
index 000000000000..076ba4c4f114
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp17625.* = phi i32. }
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp17631.* = phi i32. }
+
+@last = external global [65 x i32*] ; <[65 x i32*]*> [#uses=1]
+
+define i32 @NextRootMove(i32 %wtm) {
+cond_next95: ; preds = %cond_true85, %cond_true79, %cond_true73, %bb68
+ %tmp17618 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 ; <i32*> [#uses=0]
+ br label %cond_true116
+
+cond_true116: ; preds = %cond_true111
+ br i1 false, label %cond_true128, label %cond_true145
+
+cond_true128: ; preds = %cond_true121
+ %tmp17625 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 ; <i32*> [#uses=0]
+ br i1 false, label %bb98.backedge, label %return.loopexit
+
+bb98.backedge: ; preds = %bb171, %cond_true145, %cond_true128
+ br label %cond_true116
+
+cond_true145: ; preds = %cond_false
+ %tmp17631 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 ; <i32*> [#uses=0]
+ br i1 false, label %bb98.backedge, label %return.loopexit
+
+return.loopexit: ; preds = %bb171, %cond_true145, %cond_true128
+ br label %return
+
+return: ; preds = %return.loopexit, %cond_next95, %cond_true85
+ ret i32 0
+}
diff --git a/test/Transforms/GVN/2007-07-26-NonRedundant.ll b/test/Transforms/GVN/2007-07-26-NonRedundant.ll
new file mode 100644
index 000000000000..204803ad3728
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-26-NonRedundant.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+@bsLive = external global i32 ; <i32*> [#uses=2]
+
+define i32 @bsR(i32 %n) {
+entry:
+ br i1 false, label %cond_next, label %bb19
+
+cond_next: ; preds = %entry
+ store i32 0, i32* @bsLive, align 4
+ br label %bb19
+
+bb19: ; preds = %cond_next, %entry
+ %tmp29 = load i32* @bsLive, align 4 ; <i32> [#uses=0]
+ ret i32 0
+}
diff --git a/test/Transforms/GVN/2007-07-26-PhiErasure.ll b/test/Transforms/GVN/2007-07-26-PhiErasure.ll
new file mode 100644
index 000000000000..4925df786d73
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-26-PhiErasure.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp298316 = phi i32 }
+
+ %struct..0anon = type { i32 }
+ %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+ %struct.rtx_def = type { i16, i8, i8, [1 x %struct..0anon] }
+@n_spills = external global i32 ; <i32*> [#uses=2]
+
+define i32 @reload(%struct.rtx_def* %first, i32 %global, %struct.FILE* %dumpfile) {
+cond_next2835.1: ; preds = %cond_next2861
+ %tmp2922 = load i32* @n_spills, align 4 ; <i32> [#uses=0]
+ br label %bb2928
+
+bb2928: ; preds = %cond_next2835.1, %cond_next2943
+ br i1 false, label %cond_next2943, label %cond_true2935
+
+cond_true2935: ; preds = %bb2928
+ br label %cond_next2943
+
+cond_next2943: ; preds = %cond_true2935, %bb2928
+ br i1 false, label %bb2982.preheader, label %bb2928
+
+bb2982.preheader: ; preds = %cond_next2943
+ %tmp298316 = load i32* @n_spills, align 4 ; <i32> [#uses=0]
+ ret i32 0
+
+}
diff --git a/test/Transforms/GVN/2007-07-30-PredIDom.ll b/test/Transforms/GVN/2007-07-30-PredIDom.ll
new file mode 100644
index 000000000000..1d1aec1146aa
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-30-PredIDom.ll
@@ -0,0 +1,274 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+ %"struct.Block::$_16" = type { i32 }
+ %struct.Exp = type { %struct.Exp_*, i32, i32, i32, %struct.Exp*, %struct.Exp*, %"struct.Exp::$_10", %"struct.Block::$_16", %"struct.Exp::$_12" }
+ %"struct.Exp::$_10" = type { %struct.Exp* }
+ %"struct.Exp::$_12" = type { %struct.Exp** }
+ %struct.Exp_ = type { i32, i32, i32, i32, %struct.Id* }
+ %struct.Id = type { i8*, i32, i32, i32, %"struct.Id::$_13" }
+ %"struct.Id::$_13" = type { double }
+
+define i8* @_ZN3Exp8toStringEj(%struct.Exp* %this, i32 %nextpc) {
+entry:
+ switch i32 0, label %bb970 [
+ i32 1, label %bb
+ i32 2, label %bb39
+ i32 3, label %bb195
+ i32 4, label %bb270
+ i32 5, label %bb418
+ i32 6, label %bb633
+ i32 7, label %bb810
+ i32 8, label %bb882
+ i32 9, label %bb925
+ ]
+
+bb: ; preds = %entry
+ store i8* null, i8** null
+ br label %return
+
+bb39: ; preds = %entry
+ br i1 false, label %cond_true, label %cond_false132
+
+cond_true: ; preds = %bb39
+ br i1 false, label %cond_true73, label %cond_false
+
+cond_true73: ; preds = %cond_true
+ br i1 false, label %cond_true108, label %cond_next
+
+cond_true108: ; preds = %cond_true73
+ br label %cond_next
+
+cond_next: ; preds = %cond_true108, %cond_true73
+ br label %cond_next131
+
+cond_false: ; preds = %cond_true
+ br label %cond_next131
+
+cond_next131: ; preds = %cond_false, %cond_next
+ br label %cond_next141
+
+cond_false132: ; preds = %bb39
+ br label %cond_next141
+
+cond_next141: ; preds = %cond_false132, %cond_next131
+ br i1 false, label %cond_true169, label %cond_false175
+
+cond_true169: ; preds = %cond_next141
+ br label %cond_next181
+
+cond_false175: ; preds = %cond_next141
+ br label %cond_next181
+
+cond_next181: ; preds = %cond_false175, %cond_true169
+ br i1 false, label %cond_true189, label %cond_next191
+
+cond_true189: ; preds = %cond_next181
+ br label %cond_next191
+
+cond_next191: ; preds = %cond_true189, %cond_next181
+ store i8* null, i8** null
+ br label %return
+
+bb195: ; preds = %entry
+ br i1 false, label %cond_true248, label %cond_false250
+
+cond_true248: ; preds = %bb195
+ br label %cond_next252
+
+cond_false250: ; preds = %bb195
+ br label %cond_next252
+
+cond_next252: ; preds = %cond_false250, %cond_true248
+ br i1 false, label %cond_true265, label %cond_next267
+
+cond_true265: ; preds = %cond_next252
+ br label %cond_next267
+
+cond_next267: ; preds = %cond_true265, %cond_next252
+ store i8* null, i8** null
+ br label %return
+
+bb270: ; preds = %entry
+ br i1 false, label %cond_true338, label %cond_false340
+
+cond_true338: ; preds = %bb270
+ br label %cond_next342
+
+cond_false340: ; preds = %bb270
+ br label %cond_next342
+
+cond_next342: ; preds = %cond_false340, %cond_true338
+ br i1 false, label %cond_true362, label %cond_false364
+
+cond_true362: ; preds = %cond_next342
+ br label %cond_next366
+
+cond_false364: ; preds = %cond_next342
+ br label %cond_next366
+
+cond_next366: ; preds = %cond_false364, %cond_true362
+ br i1 false, label %cond_true393, label %cond_next395
+
+cond_true393: ; preds = %cond_next366
+ br label %cond_next395
+
+cond_next395: ; preds = %cond_true393, %cond_next366
+ br i1 false, label %cond_true406, label %cond_next408
+
+cond_true406: ; preds = %cond_next395
+ br label %cond_next408
+
+cond_next408: ; preds = %cond_true406, %cond_next395
+ br i1 false, label %cond_true413, label %cond_next415
+
+cond_true413: ; preds = %cond_next408
+ br label %cond_next415
+
+cond_next415: ; preds = %cond_true413, %cond_next408
+ store i8* null, i8** null
+ br label %return
+
+bb418: ; preds = %entry
+ br i1 false, label %cond_true512, label %cond_false514
+
+cond_true512: ; preds = %bb418
+ br label %cond_next516
+
+cond_false514: ; preds = %bb418
+ br label %cond_next516
+
+cond_next516: ; preds = %cond_false514, %cond_true512
+ br i1 false, label %cond_true536, label %cond_false538
+
+cond_true536: ; preds = %cond_next516
+ br label %cond_next540
+
+cond_false538: ; preds = %cond_next516
+ br label %cond_next540
+
+cond_next540: ; preds = %cond_false538, %cond_true536
+ br i1 false, label %cond_true560, label %cond_false562
+
+cond_true560: ; preds = %cond_next540
+ br label %cond_next564
+
+cond_false562: ; preds = %cond_next540
+ br label %cond_next564
+
+cond_next564: ; preds = %cond_false562, %cond_true560
+ br i1 false, label %cond_true597, label %cond_next599
+
+cond_true597: ; preds = %cond_next564
+ br label %cond_next599
+
+cond_next599: ; preds = %cond_true597, %cond_next564
+ br i1 false, label %cond_true614, label %cond_next616
+
+cond_true614: ; preds = %cond_next599
+ br label %cond_next616
+
+cond_next616: ; preds = %cond_true614, %cond_next599
+ br i1 false, label %cond_true621, label %cond_next623
+
+cond_true621: ; preds = %cond_next616
+ br label %cond_next623
+
+cond_next623: ; preds = %cond_true621, %cond_next616
+ br i1 false, label %cond_true628, label %cond_next630
+
+cond_true628: ; preds = %cond_next623
+ br label %cond_next630
+
+cond_next630: ; preds = %cond_true628, %cond_next623
+ store i8* null, i8** null
+ br label %return
+
+bb633: ; preds = %entry
+ br i1 false, label %cond_true667, label %cond_next669
+
+cond_true667: ; preds = %bb633
+ br label %cond_next669
+
+cond_next669: ; preds = %cond_true667, %bb633
+ br i1 false, label %cond_true678, label %cond_next791
+
+cond_true678: ; preds = %cond_next669
+ br label %bb735
+
+bb679: ; preds = %bb735
+ br i1 false, label %cond_true729, label %cond_next731
+
+cond_true729: ; preds = %bb679
+ br label %cond_next731
+
+cond_next731: ; preds = %cond_true729, %bb679
+ br label %bb735
+
+bb735: ; preds = %cond_next731, %cond_true678
+ br i1 false, label %bb679, label %bb743
+
+bb743: ; preds = %bb735
+ br i1 false, label %cond_true788, label %cond_next790
+
+cond_true788: ; preds = %bb743
+ br label %cond_next790
+
+cond_next790: ; preds = %cond_true788, %bb743
+ br label %cond_next791
+
+cond_next791: ; preds = %cond_next790, %cond_next669
+ br i1 false, label %cond_true805, label %cond_next807
+
+cond_true805: ; preds = %cond_next791
+ br label %cond_next807
+
+cond_next807: ; preds = %cond_true805, %cond_next791
+ store i8* null, i8** null
+ br label %return
+
+bb810: ; preds = %entry
+ br i1 false, label %cond_true870, label %cond_next872
+
+cond_true870: ; preds = %bb810
+ br label %cond_next872
+
+cond_next872: ; preds = %cond_true870, %bb810
+ br i1 false, label %cond_true877, label %cond_next879
+
+cond_true877: ; preds = %cond_next872
+ br label %cond_next879
+
+cond_next879: ; preds = %cond_true877, %cond_next872
+ store i8* null, i8** null
+ br label %return
+
+bb882: ; preds = %entry
+ br i1 false, label %cond_true920, label %cond_next922
+
+cond_true920: ; preds = %bb882
+ br label %cond_next922
+
+cond_next922: ; preds = %cond_true920, %bb882
+ store i8* null, i8** null
+ br label %return
+
+bb925: ; preds = %entry
+ br i1 false, label %cond_true965, label %cond_next967
+
+cond_true965: ; preds = %bb925
+ br label %cond_next967
+
+cond_next967: ; preds = %cond_true965, %bb925
+ store i8* null, i8** null
+ br label %return
+
+bb970: ; preds = %entry
+ unreachable
+ ; No predecessors!
+ store i8* null, i8** null
+ br label %return
+
+return: ; preds = %0, %cond_next967, %cond_next922, %cond_next879, %cond_next807, %cond_next630, %cond_next415, %cond_next267, %cond_next191, %bb
+ %retval980 = load i8** null ; <i8*> [#uses=1]
+ ret i8* %retval980
+}
diff --git a/test/Transforms/GVN/2007-07-31-NoDomInherit.ll b/test/Transforms/GVN/2007-07-31-NoDomInherit.ll
new file mode 100644
index 000000000000..6cb7785fcd57
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-31-NoDomInherit.ll
@@ -0,0 +1,313 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {tmp47 = phi i32 }
+
+ %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* }
+@debug = external constant i32 ; <i32*> [#uses=0]
+@counters = external constant i32 ; <i32*> [#uses=1]
+@trialx = external global [17 x i32] ; <[17 x i32]*> [#uses=1]
+@dummy1 = external global [7 x i32] ; <[7 x i32]*> [#uses=0]
+@dummy2 = external global [4 x i32] ; <[4 x i32]*> [#uses=0]
+@unacceptable = external global i32 ; <i32*> [#uses=0]
+@isa = external global [13 x %struct.anon] ; <[13 x %struct.anon]*> [#uses=3]
+@.str = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str1 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str2 = external constant [1 x i8] ; <[1 x i8]*> [#uses=0]
+@.str3 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str4 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str5 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str6 = external constant [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str7 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str8 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str9 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str10 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str11 = external constant [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str12 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str13 = external constant [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str14 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str15 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str16 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str17 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str18 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str19 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str20 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str21 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str22 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str23 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str24 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str25 = external constant [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str26 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str27 = external constant [6 x i8] ; <[6 x i8]*> [#uses=0]
+@r = external global [17 x i32] ; <[17 x i32]*> [#uses=0]
+@.str28 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str29 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@pgm = external global [5 x { i32, [3 x i32] }] ; <[5 x { i32, [3 x i32] }]*> [#uses=4]
+@.str30 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str31 = external constant [13 x i8] ; <[13 x i8]*> [#uses=0]
+@.str32 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str33 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str34 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0]
+@numi = external global i32 ; <i32*> [#uses=7]
+@.str35 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0]
+@counter = external global [5 x i32] ; <[5 x i32]*> [#uses=2]
+@itrialx.2510 = external global i32 ; <i32*> [#uses=0]
+@.str36 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str37 = external constant [42 x i8] ; <[42 x i8]*> [#uses=0]
+@corr_result = external global i32 ; <i32*> [#uses=0]
+@.str38 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str39 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str40 = external constant [47 x i8] ; <[47 x i8]*> [#uses=0]
+@correct_result = external global [17 x i32] ; <[17 x i32]*> [#uses=1]
+@.str41 = external constant [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str42 = external constant [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str43 = external constant [44 x i8] ; <[44 x i8]*> [#uses=1]
+@.str44 = external constant [21 x i8] ; <[21 x i8]*> [#uses=1]
+@.str45 = external constant [12 x i8] ; <[12 x i8]*> [#uses=1]
+@.str46 = external constant [5 x i8] ; <[5 x i8]*> [#uses=1]
+@.str47 = external constant [12 x i8] ; <[12 x i8]*> [#uses=1]
+
+declare i32 @neg(i32, i32, i32)
+
+declare i32 @Not(i32, i32, i32)
+
+declare i32 @pop(i32, i32, i32)
+
+declare i32 @nlz(i32, i32, i32)
+
+declare i32 @rev(i32, i32, i32)
+
+declare i32 @add(i32, i32, i32)
+
+declare i32 @sub(i32, i32, i32)
+
+declare i32 @mul(i32, i32, i32)
+
+declare i32 @divide(i32, i32, i32)
+
+declare i32 @divu(i32, i32, i32)
+
+declare i32 @And(i32, i32, i32)
+
+declare i32 @Or(i32, i32, i32)
+
+declare i32 @Xor(i32, i32, i32)
+
+declare i32 @rotl(i32, i32, i32)
+
+declare i32 @shl(i32, i32, i32)
+
+declare i32 @shr(i32, i32, i32)
+
+declare i32 @shrs(i32, i32, i32)
+
+declare i32 @cmpeq(i32, i32, i32)
+
+declare i32 @cmplt(i32, i32, i32)
+
+declare i32 @cmpltu(i32, i32, i32)
+
+declare i32 @seleq(i32, i32, i32)
+
+declare i32 @sellt(i32, i32, i32)
+
+declare i32 @selle(i32, i32, i32)
+
+declare void @print_expr(i32)
+
+declare i32 @printf(i8*, ...)
+
+declare i32 @putchar(i32)
+
+declare void @print_pgm()
+
+declare void @simulate_one_instruction(i32)
+
+declare i32 @check(i32)
+
+declare i32 @puts(i8*)
+
+declare void @fix_operands(i32)
+
+declare void @abort()
+
+declare i32 @increment()
+
+declare i32 @search()
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %argc_addr = alloca i32 ; <i32*> [#uses=1]
+ %argv_addr = alloca i8** ; <i8***> [#uses=1]
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=2]
+ %i = alloca i32, align 4 ; <i32*> [#uses=21]
+ %num_sol = alloca i32, align 4 ; <i32*> [#uses=4]
+ %total = alloca i32, align 4 ; <i32*> [#uses=4]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %argc, i32* %argc_addr
+ store i8** %argv, i8*** %argv_addr
+ store i32 0, i32* %num_sol
+ store i32 1, i32* @numi
+ br label %bb91
+
+bb: ; preds = %cond_next97
+ %tmp1 = load i32* @numi ; <i32> [#uses=1]
+ %tmp2 = getelementptr [44 x i8]* @.str43, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp3 = call i32 (i8*, ...)* @printf( i8* %tmp2, i32 %tmp1 ) ; <i32> [#uses=0]
+ store i32 0, i32* %i
+ br label %bb13
+
+bb4: ; preds = %bb13
+ %tmp5 = load i32* %i ; <i32> [#uses=1]
+ %tmp6 = load i32* %i ; <i32> [#uses=1]
+ %tmp7 = getelementptr [17 x i32]* @trialx, i32 0, i32 %tmp6 ; <i32*> [#uses=1]
+ %tmp8 = load i32* %tmp7 ; <i32> [#uses=1]
+ %tmp9 = call i32 @userfun( i32 %tmp8 ) ; <i32> [#uses=1]
+ %tmp10 = getelementptr [17 x i32]* @correct_result, i32 0, i32 %tmp5 ; <i32*> [#uses=1]
+ store i32 %tmp9, i32* %tmp10
+ %tmp11 = load i32* %i ; <i32> [#uses=1]
+ %tmp12 = add i32 %tmp11, 1 ; <i32> [#uses=1]
+ store i32 %tmp12, i32* %i
+ br label %bb13
+
+bb13: ; preds = %bb4, %bb
+ %tmp14 = load i32* %i ; <i32> [#uses=1]
+ %tmp15 = icmp sle i32 %tmp14, 16 ; <i1> [#uses=1]
+ %tmp1516 = zext i1 %tmp15 to i32 ; <i32> [#uses=1]
+ %toBool = icmp ne i32 %tmp1516, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb4, label %bb17
+
+bb17: ; preds = %bb13
+ store i32 0, i32* %i
+ br label %bb49
+
+bb18: ; preds = %bb49
+ %tmp19 = load i32* %i ; <i32> [#uses=1]
+ %tmp20 = getelementptr [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp19 ; <{ i32, [3 x i32] }*> [#uses=1]
+ %tmp21 = getelementptr { i32, [3 x i32] }* %tmp20, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp21
+ %tmp22 = load i32* %i ; <i32> [#uses=1]
+ %tmp23 = getelementptr [13 x %struct.anon]* @isa, i32 0, i32 0 ; <%struct.anon*> [#uses=1]
+ %tmp24 = getelementptr %struct.anon* %tmp23, i32 0, i32 3 ; <[3 x i32]*> [#uses=1]
+ %tmp25 = getelementptr [3 x i32]* %tmp24, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp26 = load i32* %tmp25 ; <i32> [#uses=1]
+ %tmp27 = getelementptr [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp22 ; <{ i32, [3 x i32] }*> [#uses=1]
+ %tmp28 = getelementptr { i32, [3 x i32] }* %tmp27, i32 0, i32 1 ; <[3 x i32]*> [#uses=1]
+ %tmp29 = getelementptr [3 x i32]* %tmp28, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %tmp26, i32* %tmp29
+ %tmp30 = load i32* %i ; <i32> [#uses=1]
+ %tmp31 = getelementptr [13 x %struct.anon]* @isa, i32 0, i32 0 ; <%struct.anon*> [#uses=1]
+ %tmp32 = getelementptr %struct.anon* %tmp31, i32 0, i32 3 ; <[3 x i32]*> [#uses=1]
+ %tmp33 = getelementptr [3 x i32]* %tmp32, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp34 = load i32* %tmp33 ; <i32> [#uses=1]
+ %tmp35 = getelementptr [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp30 ; <{ i32, [3 x i32] }*> [#uses=1]
+ %tmp36 = getelementptr { i32, [3 x i32] }* %tmp35, i32 0, i32 1 ; <[3 x i32]*> [#uses=1]
+ %tmp37 = getelementptr [3 x i32]* %tmp36, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %tmp34, i32* %tmp37
+ %tmp38 = load i32* %i ; <i32> [#uses=1]
+ %tmp39 = getelementptr [13 x %struct.anon]* @isa, i32 0, i32 0 ; <%struct.anon*> [#uses=1]
+ %tmp40 = getelementptr %struct.anon* %tmp39, i32 0, i32 3 ; <[3 x i32]*> [#uses=1]
+ %tmp41 = getelementptr [3 x i32]* %tmp40, i32 0, i32 2 ; <i32*> [#uses=1]
+ %tmp42 = load i32* %tmp41 ; <i32> [#uses=1]
+ %tmp43 = getelementptr [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp38 ; <{ i32, [3 x i32] }*> [#uses=1]
+ %tmp44 = getelementptr { i32, [3 x i32] }* %tmp43, i32 0, i32 1 ; <[3 x i32]*> [#uses=1]
+ %tmp45 = getelementptr [3 x i32]* %tmp44, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %tmp42, i32* %tmp45
+ %tmp46 = load i32* %i ; <i32> [#uses=1]
+ call void @fix_operands( i32 %tmp46 )
+ %tmp47 = load i32* %i ; <i32> [#uses=1]
+ %tmp48 = add i32 %tmp47, 1 ; <i32> [#uses=1]
+ store i32 %tmp48, i32* %i
+ br label %bb49
+
+bb49: ; preds = %bb18, %bb17
+ %tmp50 = load i32* @numi ; <i32> [#uses=1]
+ %tmp51 = load i32* %i ; <i32> [#uses=1]
+ %tmp52 = icmp slt i32 %tmp51, %tmp50 ; <i1> [#uses=1]
+ %tmp5253 = zext i1 %tmp52 to i32 ; <i32> [#uses=1]
+ %toBool54 = icmp ne i32 %tmp5253, 0 ; <i1> [#uses=1]
+ br i1 %toBool54, label %bb18, label %bb55
+
+bb55: ; preds = %bb49
+ %tmp56 = call i32 @search( ) ; <i32> [#uses=1]
+ store i32 %tmp56, i32* %num_sol
+ %tmp57 = getelementptr [21 x i8]* @.str44, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp58 = load i32* %num_sol ; <i32> [#uses=1]
+ %tmp59 = call i32 (i8*, ...)* @printf( i8* %tmp57, i32 %tmp58 ) ; <i32> [#uses=0]
+ %tmp60 = load i32* @counters ; <i32> [#uses=1]
+ %tmp61 = icmp ne i32 %tmp60, 0 ; <i1> [#uses=1]
+ %tmp6162 = zext i1 %tmp61 to i32 ; <i32> [#uses=1]
+ %toBool63 = icmp ne i32 %tmp6162, 0 ; <i1> [#uses=1]
+ br i1 %toBool63, label %cond_true, label %cond_next
+
+cond_true: ; preds = %bb55
+ store i32 0, i32* %total
+ %tmp64 = getelementptr [12 x i8]* @.str45, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp65 = call i32 (i8*, ...)* @printf( i8* %tmp64 ) ; <i32> [#uses=0]
+ store i32 0, i32* %i
+ br label %bb79
+
+bb66: ; preds = %bb79
+ %tmp67 = load i32* %i ; <i32> [#uses=1]
+ %tmp68 = getelementptr [5 x i32]* @counter, i32 0, i32 %tmp67 ; <i32*> [#uses=1]
+ %tmp69 = load i32* %tmp68 ; <i32> [#uses=1]
+ %tmp70 = getelementptr [5 x i8]* @.str46, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp71 = call i32 (i8*, ...)* @printf( i8* %tmp70, i32 %tmp69 ) ; <i32> [#uses=0]
+ %tmp72 = load i32* %i ; <i32> [#uses=1]
+ %tmp73 = getelementptr [5 x i32]* @counter, i32 0, i32 %tmp72 ; <i32*> [#uses=1]
+ %tmp74 = load i32* %tmp73 ; <i32> [#uses=1]
+ %tmp75 = load i32* %total ; <i32> [#uses=1]
+ %tmp76 = add i32 %tmp74, %tmp75 ; <i32> [#uses=1]
+ store i32 %tmp76, i32* %total
+ %tmp77 = load i32* %i ; <i32> [#uses=1]
+ %tmp78 = add i32 %tmp77, 1 ; <i32> [#uses=1]
+ store i32 %tmp78, i32* %i
+ br label %bb79
+
+bb79: ; preds = %bb66, %cond_true
+ %tmp80 = load i32* @numi ; <i32> [#uses=1]
+ %tmp81 = load i32* %i ; <i32> [#uses=1]
+ %tmp82 = icmp slt i32 %tmp81, %tmp80 ; <i1> [#uses=1]
+ %tmp8283 = zext i1 %tmp82 to i32 ; <i32> [#uses=1]
+ %toBool84 = icmp ne i32 %tmp8283, 0 ; <i1> [#uses=1]
+ br i1 %toBool84, label %bb66, label %bb85
+
+bb85: ; preds = %bb79
+ %tmp86 = getelementptr [12 x i8]* @.str47, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp87 = load i32* %total ; <i32> [#uses=1]
+ %tmp88 = call i32 (i8*, ...)* @printf( i8* %tmp86, i32 %tmp87 ) ; <i32> [#uses=0]
+ br label %cond_next
+
+cond_next: ; preds = %bb85, %bb55
+ %tmp89 = load i32* @numi ; <i32> [#uses=1]
+ %tmp90 = add i32 %tmp89, 1 ; <i32> [#uses=1]
+ store i32 %tmp90, i32* @numi
+ br label %bb91
+
+bb91: ; preds = %cond_next, %entry
+ %tmp92 = load i32* @numi ; <i32> [#uses=1]
+ %tmp93 = icmp sgt i32 %tmp92, 5 ; <i1> [#uses=1]
+ %tmp9394 = zext i1 %tmp93 to i32 ; <i32> [#uses=1]
+ %toBool95 = icmp ne i32 %tmp9394, 0 ; <i1> [#uses=1]
+ br i1 %toBool95, label %cond_true96, label %cond_next97
+
+cond_true96: ; preds = %bb91
+ br label %bb102
+
+cond_next97: ; preds = %bb91
+ %tmp98 = load i32* %num_sol ; <i32> [#uses=1]
+ %tmp99 = icmp eq i32 %tmp98, 0 ; <i1> [#uses=1]
+ %tmp99100 = zext i1 %tmp99 to i32 ; <i32> [#uses=1]
+ %toBool101 = icmp ne i32 %tmp99100, 0 ; <i1> [#uses=1]
+ br i1 %toBool101, label %bb, label %bb102
+
+bb102: ; preds = %cond_next97, %cond_true96
+ store i32 0, i32* %tmp
+ %tmp103 = load i32* %tmp ; <i32> [#uses=1]
+ store i32 %tmp103, i32* %retval
+ br label %return
+
+return: ; preds = %bb102
+ %retval104 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval104
+}
+
+declare i32 @userfun(i32)
diff --git a/test/Transforms/GVN/2007-07-31-RedundantPhi.ll b/test/Transforms/GVN/2007-07-31-RedundantPhi.ll
new file mode 100644
index 000000000000..a9ca71ac81d4
--- /dev/null
+++ b/test/Transforms/GVN/2007-07-31-RedundantPhi.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {tmp701 =}
+
+@img_width = external global i16 ; <i16*> [#uses=2]
+
+define i32 @smpUMHEXBipredIntegerPelBlockMotionSearch(i16* %cur_pic, i16 signext %ref, i32 %list, i32 %pic_pix_x, i32 %pic_pix_y, i32 %blocktype, i16 signext %pred_mv_x1, i16 signext %pred_mv_y1, i16 signext %pred_mv_x2, i16 signext %pred_mv_y2, i16* %mv_x, i16* %mv_y, i16* %s_mv_x, i16* %s_mv_y, i32 %search_range, i32 %min_mcost, i32 %lambda_factor) {
+cond_next143: ; preds = %entry
+ store i16 0, i16* @img_width, align 2
+ br i1 false, label %cond_next449, label %cond_false434
+
+cond_false434: ; preds = %cond_true415
+ br label %cond_next449
+
+cond_next449: ; preds = %cond_false434, %cond_true415
+ br i1 false, label %cond_next698, label %cond_false470
+
+cond_false470: ; preds = %cond_next449
+ br label %cond_next698
+
+cond_next698: ; preds = %cond_true492
+ %tmp701 = load i16* @img_width, align 2 ; <i16> [#uses=0]
+ ret i32 0
+}
diff --git a/test/Transforms/GVN/2008-02-12-UndefLoad.ll b/test/Transforms/GVN/2008-02-12-UndefLoad.ll
new file mode 100644
index 000000000000..5ee3d6cbe643
--- /dev/null
+++ b/test/Transforms/GVN/2008-02-12-UndefLoad.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep load
+; PR1996
+
+%struct.anon = type { i32, i8, i8, i8, i8 }
+
+define i32 @a() {
+entry:
+ %c = alloca %struct.anon ; <%struct.anon*> [#uses=2]
+ %tmp = getelementptr %struct.anon* %c, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp1 = getelementptr i32* %tmp, i32 1 ; <i32*> [#uses=2]
+ %tmp2 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ %tmp3 = or i32 %tmp2, 11 ; <i32> [#uses=1]
+ %tmp4 = and i32 %tmp3, -21 ; <i32> [#uses=1]
+ store i32 %tmp4, i32* %tmp1, align 4
+ %call = call i32 (...)* @x( %struct.anon* %c ) ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+
+declare i32 @x(...)
diff --git a/test/Transforms/GVN/2008-02-13-NewPHI.ll b/test/Transforms/GVN/2008-02-13-NewPHI.ll
new file mode 100644
index 000000000000..d3e325146812
--- /dev/null
+++ b/test/Transforms/GVN/2008-02-13-NewPHI.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -anders-aa -gvn
+; PR2032
+
+define i32 @sscal(i32 %n, double %sa1, float* %sx, i32 %incx) {
+entry:
+ %sx_addr = alloca float* ; <float**> [#uses=3]
+ store float* %sx, float** %sx_addr, align 4
+ br label %bb33
+
+bb: ; preds = %bb33
+ %tmp27 = load float** %sx_addr, align 4 ; <float*> [#uses=1]
+ store float 0.000000e+00, float* %tmp27, align 4
+ store float* null, float** %sx_addr, align 4
+ br label %bb33
+
+bb33: ; preds = %bb, %entry
+ br i1 false, label %bb, label %return
+
+return: ; preds = %bb33
+ %retval59 = load i32* null, align 4 ; <i32> [#uses=1]
+ ret i32 %retval59
+}
diff --git a/test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll b/test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll
new file mode 100644
index 000000000000..54a2201d2d7d
--- /dev/null
+++ b/test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -gvn -dse | llvm-dis | grep {call.*memcpy} | count 1
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+ %struct.ggFrame3 = type { %struct.ggPoint3, %struct.ggONB3 }
+ %struct.ggHMatrix3 = type { [4 x [4 x double]] }
+ %struct.ggONB3 = type { %struct.ggPoint3, %struct.ggPoint3, %struct.ggPoint3 }
+ %struct.ggPoint3 = type { [3 x double] }
+ %struct.ggQuaternion = type { [4 x double], i32, %struct.ggHMatrix3 }
+
+declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind
+
+define void @_Z10ggCRSplineRK8ggFrame3S1_S1_S1_d(%struct.ggFrame3* noalias sret %agg.result, %struct.ggFrame3* %f0, %struct.ggFrame3* %f1, %struct.ggFrame3* %f2, %struct.ggFrame3* %f3, double %t) nounwind {
+entry:
+ %qresult = alloca %struct.ggQuaternion ; <%struct.ggQuaternion*> [#uses=1]
+ %tmp = alloca %struct.ggONB3 ; <%struct.ggONB3*> [#uses=2]
+ call void @_ZN12ggQuaternion7getONB3Ev( %struct.ggONB3* noalias sret %tmp, %struct.ggQuaternion* %qresult ) nounwind
+ %tmp1.i = getelementptr %struct.ggFrame3* %agg.result, i32 0, i32 1 ; <%struct.ggONB3*> [#uses=1]
+ %tmp13.i = bitcast %struct.ggONB3* %tmp1.i to i8* ; <i8*> [#uses=1]
+ %tmp24.i = bitcast %struct.ggONB3* %tmp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i64( i8* %tmp13.i, i8* %tmp24.i, i64 72, i32 8 ) nounwind
+ ret void
+}
+
+declare void @_ZN12ggQuaternion7getONB3Ev(%struct.ggONB3* noalias sret , %struct.ggQuaternion*) nounwind
diff --git a/test/Transforms/GVN/2008-02-26-MemCpySize.ll b/test/Transforms/GVN/2008-02-26-MemCpySize.ll
new file mode 100644
index 000000000000..92cac077711c
--- /dev/null
+++ b/test/Transforms/GVN/2008-02-26-MemCpySize.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -gvn -dse | llvm-dis | grep {call.*memcpy.*cell} | count 2
+; PR2099
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin9"
+ %struct.s = type { [11 x i8], i32 }
+@.str = internal constant [11 x i8] c"0123456789\00" ; <[11 x i8]*> [#uses=1]
+@cell = weak global %struct.s zeroinitializer ; <%struct.s*> [#uses=2]
+
+declare i32 @check(%struct.s* byval %p) nounwind
+
+declare i32 @strcmp(i8*, i8*) nounwind readonly
+
+define i32 @main() noreturn nounwind {
+entry:
+ %p = alloca %struct.s, align 8 ; <%struct.s*> [#uses=2]
+ store i32 99, i32* getelementptr (%struct.s* @cell, i32 0, i32 1), align 4
+ call void @llvm.memcpy.i32( i8* getelementptr (%struct.s* @cell, i32 0, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str, i32 0, i32 0), i32 11, i32 1 )
+ %tmp = getelementptr %struct.s* %p, i32 0, i32 0, i32 0 ; <i8*> [#uses=2]
+ call void @llvm.memcpy.i64( i8* %tmp, i8* getelementptr (%struct.s* @cell, i32 0, i32 0, i32 0), i64 16, i32 8 )
+ %tmp1.i = getelementptr %struct.s* %p, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp2.i = load i32* %tmp1.i, align 4 ; <i32> [#uses=1]
+ %tmp3.i = icmp eq i32 %tmp2.i, 99 ; <i1> [#uses=1]
+ br i1 %tmp3.i, label %bb5.i, label %bb
+
+bb5.i: ; preds = %entry
+ %tmp91.i = call i32 @strcmp( i8* %tmp, i8* getelementptr ([11 x i8]* @.str, i32 0, i32 0) ) nounwind readonly ; <i32> [#uses=1]
+ %tmp53 = icmp eq i32 %tmp91.i, 0 ; <i1> [#uses=1]
+ br i1 %tmp53, label %bb7, label %bb
+
+bb: ; preds = %bb5.i, %entry
+ call void @abort( ) noreturn nounwind
+ unreachable
+
+bb7: ; preds = %bb5.i
+ call void @exit( i32 0 ) noreturn nounwind
+ unreachable
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
+
+declare void @abort() noreturn nounwind
+
+declare void @exit(i32) noreturn nounwind
+
+declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind
diff --git a/test/Transforms/GVN/2008-07-02-Unreachable.ll b/test/Transforms/GVN/2008-07-02-Unreachable.ll
new file mode 100644
index 000000000000..15667d2bfb21
--- /dev/null
+++ b/test/Transforms/GVN/2008-07-02-Unreachable.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep undef
+; PR2503
+
+@g_3 = external global i8 ; <i8*> [#uses=2]
+
+define i8 @func_1() nounwind {
+entry:
+ br i1 false, label %ifelse, label %ifthen
+
+ifthen: ; preds = %entry
+ br label %ifend
+
+ifelse: ; preds = %entry
+ %tmp3 = load i8* @g_3 ; <i8> [#uses=0]
+ br label %forcond.thread
+
+forcond.thread: ; preds = %ifelse
+ br label %afterfor
+
+forcond: ; preds = %forinc
+ br i1 false, label %afterfor, label %forbody
+
+forbody: ; preds = %forcond
+ br label %forinc
+
+forinc: ; preds = %forbody
+ br label %forcond
+
+afterfor: ; preds = %forcond, %forcond.thread
+ %tmp10 = load i8* @g_3 ; <i8> [#uses=0]
+ ret i8 %tmp10
+
+ifend: ; preds = %afterfor, %ifthen
+ ret i8 0
+}
diff --git a/test/Transforms/GVN/2008-12-09-SelfRemove.ll b/test/Transforms/GVN/2008-12-09-SelfRemove.ll
new file mode 100644
index 000000000000..48ce8f6ff461
--- /dev/null
+++ b/test/Transforms/GVN/2008-12-09-SelfRemove.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep getelementptr | count 1
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.5"
+ %struct.anon = type { i8*, i32 }
+ %struct.d_print_info = type { i32, i8*, i32, i32, %struct.d_print_template*, %struct.d_print_mod*, i32 }
+ %struct.d_print_mod = type { %struct.d_print_mod*, %struct.demangle_component*, i32, %struct.d_print_template* }
+ %struct.d_print_template = type { %struct.d_print_template*, %struct.demangle_component* }
+ %struct.demangle_component = type { i32, { %struct.anon } }
+
+define void @d_print_mod_list(%struct.d_print_info* %dpi, %struct.d_print_mod* %mods, i32 %suffix) nounwind {
+entry:
+ %0 = getelementptr %struct.d_print_info* %dpi, i32 0, i32 1 ; <i8**> [#uses=1]
+ br i1 false, label %return, label %bb
+
+bb: ; preds = %entry
+ %1 = load i8** %0, align 4 ; <i8*> [#uses=0]
+ %2 = getelementptr %struct.d_print_info* %dpi, i32 0, i32 1 ; <i8**> [#uses=0]
+ br label %bb21
+
+bb21: ; preds = %bb21, %bb
+ br label %bb21
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/GVN/2008-12-12-RLE-Crash.ll b/test/Transforms/GVN/2008-12-12-RLE-Crash.ll
new file mode 100644
index 000000000000..99fadc716c7e
--- /dev/null
+++ b/test/Transforms/GVN/2008-12-12-RLE-Crash.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+ br label %bb84
+
+bb41: ; preds = %bb82
+ %tmp = load i8* %opt.0, align 1 ; <i8> [#uses=0]
+ %tmp1 = getelementptr i8* %opt.0, i32 1 ; <i8*> [#uses=2]
+ switch i32 0, label %bb81 [
+ i32 102, label %bb82
+ i32 110, label %bb79
+ i32 118, label %bb80
+ ]
+
+bb79: ; preds = %bb41
+ br label %bb82
+
+bb80: ; preds = %bb41
+ ret i32 0
+
+bb81: ; preds = %bb41
+ ret i32 1
+
+bb82: ; preds = %bb84, %bb79, %bb41
+ %opt.0 = phi i8* [ %tmp3, %bb84 ], [ %tmp1, %bb79 ], [ %tmp1, %bb41 ] ; <i8*> [#uses=3]
+ %tmp2 = load i8* %opt.0, align 1 ; <i8> [#uses=0]
+ br i1 false, label %bb84, label %bb41
+
+bb84: ; preds = %bb82, %entry
+ %tmp3 = getelementptr i8* null, i32 1 ; <i8*> [#uses=1]
+ br label %bb82
+}
diff --git a/test/Transforms/GVN/2008-12-14-rle-reanalyze.ll b/test/Transforms/GVN/2008-12-14-rle-reanalyze.ll
new file mode 100644
index 000000000000..9bcfcac1ccdb
--- /dev/null
+++ b/test/Transforms/GVN/2008-12-14-rle-reanalyze.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+@sort_value = external global [256 x i32], align 32 ; <[256 x i32]*> [#uses=2]
+
+define i32 @Quiesce(i32 %alpha, i32 %beta, i32 %wtm, i32 %ply) nounwind {
+entry:
+ br label %bb22
+
+bb22: ; preds = %bb23, %bb22, %entry
+ br i1 false, label %bb23, label %bb22
+
+bb23: ; preds = %bb23, %bb22
+ %sortv.233 = phi i32* [ getelementptr ([256 x i32]* @sort_value, i32 0, i32 0), %bb22 ], [ %sortv.2, %bb23 ] ; <i32*> [#uses=1]
+ %0 = load i32* %sortv.233, align 4 ; <i32> [#uses=0]
+ %sortv.2 = getelementptr [256 x i32]* @sort_value, i32 0, i32 0 ; <i32*> [#uses=1]
+ br i1 false, label %bb23, label %bb22
+}
diff --git a/test/Transforms/GVN/2008-12-15-CacheVisited.ll b/test/Transforms/GVN/2008-12-15-CacheVisited.ll
new file mode 100644
index 000000000000..b547003b25ee
--- /dev/null
+++ b/test/Transforms/GVN/2008-12-15-CacheVisited.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+; Cached results must be added to and verified against the visited sets.
+; PR3217
+
+define fastcc void @gen_field_die(i32* %decl) nounwind {
+entry:
+ br i1 false, label %bb203, label %bb202
+
+bb202: ; preds = %entry
+ unreachable
+
+bb203: ; preds = %entry
+ %tmp = getelementptr i32* %decl, i32 1 ; <i32*> [#uses=1]
+ %tmp1 = load i32* %tmp, align 4 ; <i32> [#uses=0]
+ br i1 false, label %bb207, label %bb204
+
+bb204: ; preds = %bb203
+ %tmp2 = getelementptr i32* %decl, i32 1 ; <i32*> [#uses=1]
+ br label %bb208
+
+bb207: ; preds = %bb203
+ br label %bb208
+
+bb208: ; preds = %bb207, %bb204
+ %iftmp.1374.0.in = phi i32* [ null, %bb207 ], [ %tmp2, %bb204 ] ; <i32*> [#uses=1]
+ %iftmp.1374.0 = load i32* %iftmp.1374.0.in ; <i32> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/GVN/2009-01-21-SortInvalidation.ll b/test/Transforms/GVN/2009-01-21-SortInvalidation.ll
new file mode 100644
index 000000000000..51ca6cb34ee5
--- /dev/null
+++ b/test/Transforms/GVN/2009-01-21-SortInvalidation.ll
@@ -0,0 +1,55 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+; PR3358
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.re_pattern_buffer = type { i8*, i64, i64, i64, i8*, i8*, i64, i8 }
+ %struct.re_registers = type { i32, i32*, i32* }
+
+define fastcc i32 @byte_re_match_2_internal(%struct.re_pattern_buffer* nocapture %bufp, i8* %string1, i32 %size1, i8* %string2, i32 %size2, i32 %pos, %struct.re_registers* %regs, i32 %stop) nounwind {
+entry:
+ br label %bb159
+
+succeed_label: ; preds = %bb159
+ ret i32 0
+
+bb159: ; preds = %bb664, %bb554, %bb159, %bb159, %bb159, %entry
+ %d.0 = phi i8* [ null, %entry ], [ %d.0, %bb159 ], [ %d.0, %bb554 ], [ %d.0, %bb159 ], [ %d.0, %bb159 ], [ %d.12, %bb664 ] ; <i8*> [#uses=5]
+ switch i32 0, label %bb661 [
+ i32 0, label %bb159
+ i32 1, label %succeed_label
+ i32 13, label %bb159
+ i32 14, label %bb159
+ i32 16, label %bb411
+ i32 24, label %bb622
+ i32 28, label %bb543
+ ]
+
+bb411: ; preds = %bb411, %bb159
+ br label %bb411
+
+bb543: ; preds = %bb159
+ br i1 false, label %bb549, label %bb550
+
+bb549: ; preds = %bb543
+ br label %bb554
+
+bb550: ; preds = %bb543
+ br i1 false, label %bb554, label %bb552
+
+bb552: ; preds = %bb550
+ %0 = load i8* %d.0, align 8 ; <i8> [#uses=0]
+ br label %bb554
+
+bb554: ; preds = %bb552, %bb550, %bb549
+ br i1 false, label %bb159, label %bb661
+
+bb622: ; preds = %bb622, %bb159
+ br label %bb622
+
+bb661: ; preds = %bb554, %bb159
+ %d.12 = select i1 false, i8* null, i8* null ; <i8*> [#uses=1]
+ br label %bb664
+
+bb664: ; preds = %bb664, %bb661
+ br i1 false, label %bb159, label %bb664
+}
diff --git a/test/Transforms/GVN/2009-01-22-SortInvalidation.ll b/test/Transforms/GVN/2009-01-22-SortInvalidation.ll
new file mode 100644
index 000000000000..9b7fa0622ab8
--- /dev/null
+++ b/test/Transforms/GVN/2009-01-22-SortInvalidation.ll
@@ -0,0 +1,100 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct..4sPragmaType = type { i8*, i32 }
+ %struct.AggInfo = type { i8, i8, i32, %struct.ExprList*, i32, %struct.AggInfo_col*, i32, i32, i32, %struct.AggInfo_func*, i32, i32 }
+ %struct.AggInfo_col = type { %struct.Table*, i32, i32, i32, i32, %struct.Expr* }
+ %struct.AggInfo_func = type { %struct.Expr*, %struct.FuncDef*, i32, i32 }
+ %struct.AuxData = type { i8*, void (i8*)* }
+ %struct.Bitvec = type { i32, i32, i32, { [125 x i32] } }
+ %struct.BtCursor = type { %struct.Btree*, %struct.BtShared*, %struct.BtCursor*, %struct.BtCursor*, i32 (i8*, i32, i8*, i32, i8*)*, i8*, i32, %struct.MemPage*, i32, %struct.CellInfo, i8, i8, i8*, i64, i32, i8, i32* }
+ %struct.BtLock = type { %struct.Btree*, i32, i8, %struct.BtLock* }
+ %struct.BtShared = type { %struct.Pager*, %struct.sqlite3*, %struct.BtCursor*, %struct.MemPage*, i8, i8, i8, i8, i8, i8, i8, i8, i32, i16, i16, i32, i32, i32, i32, i8, i32, i8*, void (i8*)*, %struct.sqlite3_mutex*, %struct.BusyHandler, i32, %struct.BtShared*, %struct.BtLock*, %struct.Btree* }
+ %struct.Btree = type { %struct.sqlite3*, %struct.BtShared*, i8, i8, i8, i32, %struct.Btree*, %struct.Btree* }
+ %struct.BtreeMutexArray = type { i32, [11 x %struct.Btree*] }
+ %struct.BusyHandler = type { i32 (i8*, i32)*, i8*, i32 }
+ %struct.CellInfo = type { i8*, i64, i32, i32, i16, i16, i16, i16 }
+ %struct.CollSeq = type { i8*, i8, i8, i8*, i32 (i8*, i32, i8*, i32, i8*)*, void (i8*)* }
+ %struct.Column = type { i8*, %struct.Expr*, i8*, i8*, i8, i8, i8, i8 }
+ %struct.Context = type { i64, i32, %struct.Fifo }
+ %struct.CountCtx = type { i64 }
+ %struct.Cursor = type { %struct.BtCursor*, i32, i64, i64, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i64, %struct.Btree*, i32, i8*, i64, i8*, %struct.KeyInfo*, i32, i64, %struct.sqlite3_vtab_cursor*, %struct.sqlite3_module*, i32, i32, i32*, i32*, i8* }
+ %struct.Db = type { i8*, %struct.Btree*, i8, i8, i8*, void (i8*)*, %struct.Schema* }
+ %struct.Expr = type { i8, i8, i16, %struct.CollSeq*, %struct.Expr*, %struct.Expr*, %struct.ExprList*, %struct..4sPragmaType, %struct..4sPragmaType, i32, i32, %struct.AggInfo*, i32, i32, %struct.Select*, %struct.Table*, i32 }
+ %struct.ExprList = type { i32, i32, i32, %struct.ExprList_item* }
+ %struct.ExprList_item = type { %struct.Expr*, i8*, i8, i8, i8 }
+ %struct.FKey = type { %struct.Table*, %struct.FKey*, i8*, %struct.FKey*, i32, %struct.sColMap*, i8, i8, i8, i8 }
+ %struct.Fifo = type { i32, %struct.FifoPage*, %struct.FifoPage* }
+ %struct.FifoPage = type { i32, i32, i32, %struct.FifoPage*, [1 x i64] }
+ %struct.FuncDef = type { i16, i8, i8, i8, i8*, %struct.FuncDef*, void (%struct.sqlite3_context*, i32, %struct.Mem**)*, void (%struct.sqlite3_context*, i32, %struct.Mem**)*, void (%struct.sqlite3_context*)*, [1 x i8] }
+ %struct.Hash = type { i8, i8, i32, i32, %struct.HashElem*, %struct._ht* }
+ %struct.HashElem = type { %struct.HashElem*, %struct.HashElem*, i8*, i8*, i32 }
+ %struct.IdList = type { %struct..4sPragmaType*, i32, i32 }
+ %struct.Index = type { i8*, i32, i32*, i32*, %struct.Table*, i32, i8, i8, i8*, %struct.Index*, %struct.Schema*, i8*, i8** }
+ %struct.KeyInfo = type { %struct.sqlite3*, i8, i8, i8, i32, i8*, [1 x %struct.CollSeq*] }
+ %struct.Mem = type { %struct.CountCtx, double, %struct.sqlite3*, i8*, i32, i16, i8, i8, void (i8*)* }
+ %struct.MemPage = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i16, i16, i16, [5 x %struct._OvflCell], %struct.BtShared*, i8*, %struct.PgHdr*, i32, %struct.MemPage* }
+ %struct.Module = type { %struct.sqlite3_module*, i8*, i8*, void (i8*)* }
+ %struct.Op = type { i8, i8, i8, i8, i32, i32, i32, { i32 } }
+ %struct.Pager = type { %struct.sqlite3_vfs*, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.Bitvec*, %struct.Bitvec*, i8*, i8*, i8*, i8*, %struct.sqlite3_file*, %struct.sqlite3_file*, %struct.sqlite3_file*, %struct.BusyHandler*, %struct.PagerLruList, %struct.PgHdr*, %struct.PgHdr*, %struct.PgHdr*, i64, i64, i64, i64, i64, i32, void (%struct.PgHdr*, i32)*, void (%struct.PgHdr*, i32)*, i32, %struct.PgHdr**, i8*, [16 x i8] }
+ %struct.PagerLruLink = type { %struct.PgHdr*, %struct.PgHdr* }
+ %struct.PagerLruList = type { %struct.PgHdr*, %struct.PgHdr*, %struct.PgHdr* }
+ %struct.Parse = type { %struct.sqlite3*, i32, i8*, %struct.Vdbe*, i8, i8, i8, i8, i8, i8, i8, [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [12 x i32], i32, %struct.TableLock*, i32, i32, i32, i32, i32, %struct.Expr**, i8, %struct..4sPragmaType, %struct..4sPragmaType, %struct..4sPragmaType, i8*, i8*, %struct.Table*, %struct.Trigger*, %struct.TriggerStack*, i8*, %struct..4sPragmaType, i8, %struct.Table*, i32 }
+ %struct.PgHdr = type { %struct.Pager*, i32, %struct.PgHdr*, %struct.PgHdr*, %struct.PagerLruLink, %struct.PgHdr*, i8, i8, i8, i8, i8, i16, %struct.PgHdr*, %struct.PgHdr*, i8* }
+ %struct.Schema = type { i32, %struct.Hash, %struct.Hash, %struct.Hash, %struct.Hash, %struct.Table*, i8, i8, i16, i32, %struct.sqlite3* }
+ %struct.Select = type { %struct.ExprList*, i8, i8, i8, i8, i8, i8, i8, %struct.SrcList*, %struct.Expr*, %struct.ExprList*, %struct.Expr*, %struct.ExprList*, %struct.Select*, %struct.Select*, %struct.Select*, %struct.Expr*, %struct.Expr*, i32, i32, [3 x i32] }
+ %struct.SrcList = type { i16, i16, [1 x %struct.SrcList_item] }
+ %struct.SrcList_item = type { i8*, i8*, i8*, %struct.Table*, %struct.Select*, i8, i8, i32, %struct.Expr*, %struct.IdList*, i64 }
+ %struct.Table = type { i8*, i32, %struct.Column*, i32, %struct.Index*, i32, %struct.Select*, i32, %struct.Trigger*, %struct.FKey*, i8*, %struct.Expr*, i32, i8, i8, i8, i8, i8, i8, i8, %struct.Module*, %struct.sqlite3_vtab*, i32, i8**, %struct.Schema* }
+ %struct.TableLock = type { i32, i32, i8, i8* }
+ %struct.Trigger = type { i8*, i8*, i8, i8, %struct.Expr*, %struct.IdList*, %struct..4sPragmaType, %struct.Schema*, %struct.Schema*, %struct.TriggerStep*, %struct.Trigger* }
+ %struct.TriggerStack = type { %struct.Table*, i32, i32, i32, i32, i32, i32, %struct.Trigger*, %struct.TriggerStack* }
+ %struct.TriggerStep = type { i32, i32, %struct.Trigger*, %struct.Select*, %struct..4sPragmaType, %struct.Expr*, %struct.ExprList*, %struct.IdList*, %struct.TriggerStep*, %struct.TriggerStep* }
+ %struct.Vdbe = type { %struct.sqlite3*, %struct.Vdbe*, %struct.Vdbe*, i32, i32, %struct.Op*, i32, i32, i32*, %struct.Mem**, %struct.Mem*, i32, %struct.Cursor**, i32, %struct.Mem*, i8**, i32, i32, i32, %struct.Mem*, i32, i32, %struct.Fifo, i32, i32, %struct.Context*, i32, i32, i32, i32, i32, [25 x i32], i32, i32, i8**, i8*, %struct.Mem*, i8, i8, i8, i8, i8, i8, i32, i64, i32, %struct.BtreeMutexArray, i32, i8*, i32 }
+ %struct.VdbeFunc = type { %struct.FuncDef*, i32, [1 x %struct.AuxData] }
+ %struct._OvflCell = type { i8*, i16 }
+ %struct._ht = type { i32, %struct.HashElem* }
+ %struct.anon = type { double }
+ %struct.sColMap = type { i32, i8* }
+ %struct.sqlite3 = type { %struct.sqlite3_vfs*, i32, %struct.Db*, i32, i32, i32, i32, i8, i8, i8, i8, i32, %struct.CollSeq*, i64, i64, i32, i32, i32, %struct.sqlite3_mutex*, %struct.sqlite3InitInfo, i32, i8**, %struct.Vdbe*, i32, void (i8*, i8*)*, i8*, void (i8*, i8*, i64)*, i8*, i8*, i32 (i8*)*, i8*, void (i8*)*, i8*, void (i8*, i32, i8*, i8*, i64)*, void (i8*, %struct.sqlite3*, i32, i8*)*, void (i8*, %struct.sqlite3*, i32, i8*)*, i8*, %struct.Mem*, i8*, i8*, %struct.anon, i32 (i8*, i32, i8*, i8*, i8*, i8*)*, i8*, i32 (i8*)*, i8*, i32, %struct.Hash, %struct.Table*, %struct.sqlite3_vtab**, i32, %struct.Hash, %struct.Hash, %struct.BusyHandler, i32, [2 x %struct.Db], i8 }
+ %struct.sqlite3InitInfo = type { i32, i32, i8 }
+ %struct.sqlite3_context = type { %struct.FuncDef*, %struct.VdbeFunc*, %struct.Mem, %struct.Mem*, i32, %struct.CollSeq* }
+ %struct.sqlite3_file = type { %struct.sqlite3_io_methods* }
+ %struct.sqlite3_index_constraint = type { i32, i8, i8, i32 }
+ %struct.sqlite3_index_constraint_usage = type { i32, i8 }
+ %struct.sqlite3_index_info = type { i32, %struct.sqlite3_index_constraint*, i32, %struct.sqlite3_index_constraint_usage*, %struct.sqlite3_index_constraint_usage*, i32, i8*, i32, i32, double }
+ %struct.sqlite3_io_methods = type { i32, i32 (%struct.sqlite3_file*)*, i32 (%struct.sqlite3_file*, i8*, i32, i64)*, i32 (%struct.sqlite3_file*, i8*, i32, i64)*, i32 (%struct.sqlite3_file*, i64)*, i32 (%struct.sqlite3_file*, i32)*, i32 (%struct.sqlite3_file*, i64*)*, i32 (%struct.sqlite3_file*, i32)*, i32 (%struct.sqlite3_file*, i32)*, i32 (%struct.sqlite3_file*)*, i32 (%struct.sqlite3_file*, i32, i8*)*, i32 (%struct.sqlite3_file*)*, i32 (%struct.sqlite3_file*)* }
+ %struct.sqlite3_module = type { i32, i32 (%struct.sqlite3*, i8*, i32, i8**, %struct.sqlite3_vtab**, i8**)*, i32 (%struct.sqlite3*, i8*, i32, i8**, %struct.sqlite3_vtab**, i8**)*, i32 (%struct.sqlite3_vtab*, %struct.sqlite3_index_info*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*, %struct.sqlite3_vtab_cursor**)*, i32 (%struct.sqlite3_vtab_cursor*)*, i32 (%struct.sqlite3_vtab_cursor*, i32, i8*, i32, %struct.Mem**)*, i32 (%struct.sqlite3_vtab_cursor*)*, i32 (%struct.sqlite3_vtab_cursor*)*, i32 (%struct.sqlite3_vtab_cursor*, %struct.sqlite3_context*, i32)*, i32 (%struct.sqlite3_vtab_cursor*, i64*)*, i32 (%struct.sqlite3_vtab*, i32, %struct.Mem**, i64*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*, i32, i8*, void (%struct.sqlite3_context*, i32, %struct.Mem**)**, i8**)*, i32 (%struct.sqlite3_vtab*, i8*)* }
+ %struct.sqlite3_mutex = type opaque
+ %struct.sqlite3_vfs = type { i32, i32, i32, %struct.sqlite3_vfs*, i8*, i8*, i32 (%struct.sqlite3_vfs*, i8*, %struct.sqlite3_file*, i32, i32*)*, i32 (%struct.sqlite3_vfs*, i8*, i32)*, i32 (%struct.sqlite3_vfs*, i8*, i32)*, i32 (%struct.sqlite3_vfs*, i32, i8*)*, i32 (%struct.sqlite3_vfs*, i8*, i32, i8*)*, i8* (%struct.sqlite3_vfs*, i8*)*, void (%struct.sqlite3_vfs*, i32, i8*)*, i8* (%struct.sqlite3_vfs*, i8*, i8*)*, void (%struct.sqlite3_vfs*, i8*)*, i32 (%struct.sqlite3_vfs*, i32, i8*)*, i32 (%struct.sqlite3_vfs*, i32)*, i32 (%struct.sqlite3_vfs*, double*)* }
+ %struct.sqlite3_vtab = type { %struct.sqlite3_module*, i32, i8* }
+ %struct.sqlite3_vtab_cursor = type { %struct.sqlite3_vtab* }
+
+define fastcc void @sqlite3Insert(%struct.Parse* %pParse, %struct.SrcList* %pTabList, %struct.ExprList* %pList, %struct.Select* %pSelect, %struct.IdList* %pColumn, i32 %onError) nounwind {
+entry:
+ br i1 false, label %bb54, label %bb69.loopexit
+
+bb54: ; preds = %entry
+ br label %bb69.loopexit
+
+bb59: ; preds = %bb63.preheader
+ %0 = load %struct..4sPragmaType** %3, align 4 ; <%struct..4sPragmaType*> [#uses=0]
+ br label %bb65
+
+bb65: ; preds = %bb63.preheader, %bb59
+ %1 = load %struct..4sPragmaType** %4, align 4 ; <%struct..4sPragmaType*> [#uses=0]
+ br i1 false, label %bb67, label %bb63.preheader
+
+bb67: ; preds = %bb65
+ %2 = getelementptr %struct.IdList* %pColumn, i32 0, i32 0 ; <%struct..4sPragmaType**> [#uses=0]
+ unreachable
+
+bb69.loopexit: ; preds = %bb54, %entry
+ %3 = getelementptr %struct.IdList* %pColumn, i32 0, i32 0 ; <%struct..4sPragmaType**> [#uses=1]
+ %4 = getelementptr %struct.IdList* %pColumn, i32 0, i32 0 ; <%struct..4sPragmaType**> [#uses=1]
+ br label %bb63.preheader
+
+bb63.preheader: ; preds = %bb69.loopexit, %bb65
+ br i1 false, label %bb59, label %bb65
+}
diff --git a/test/Transforms/GVN/2009-02-17-LoadPRECrash.ll b/test/Transforms/GVN/2009-02-17-LoadPRECrash.ll
new file mode 100644
index 000000000000..34dc3441dd1a
--- /dev/null
+++ b/test/Transforms/GVN/2009-02-17-LoadPRECrash.ll
@@ -0,0 +1,193 @@
+; RUN: llvm-as < %s | opt -gvn -enable-load-pre -disable-output
+
+ %struct.VEC_rtx_base = type { i32, i32, [1 x %struct.rtx_def*] }
+ %struct.VEC_rtx_gc = type { %struct.VEC_rtx_base }
+ %struct.block_symbol = type { [3 x %struct.cgraph_rtl_info], %struct.object_block*, i64 }
+ %struct.cgraph_rtl_info = type { i32 }
+ %struct.object_block = type { %struct.section*, i32, i64, %struct.VEC_rtx_gc*, %struct.VEC_rtx_gc* }
+ %struct.rtvec_def = type { i32, [1 x %struct.rtx_def*] }
+ %struct.rtx_def = type { i16, i8, i8, %struct.u }
+ %struct.section = type { %struct.unnamed_section }
+ %struct.u = type { %struct.block_symbol }
+ %struct.unnamed_section = type { %struct.cgraph_rtl_info, void (i8*)*, i8*, %struct.section* }
+
+declare %struct.rtvec_def* @gen_rtvec(i32, ...)
+
+declare %struct.rtx_def* @plus_constant(%struct.rtx_def*, i64)
+
+declare %struct.rtx_def* @gen_rtx_fmt_Ei(i32, i32, %struct.rtvec_def*, i32)
+
+declare i32 @local_symbolic_operand(%struct.rtx_def*, i32)
+
+define %struct.rtx_def* @legitimize_pic_address(%struct.rtx_def* %orig, %struct.rtx_def* %reg) nounwind {
+entry:
+ %addr = alloca %struct.rtx_def* ; <%struct.rtx_def**> [#uses=5]
+ %iftmp.1532 = alloca %struct.rtx_def* ; <%struct.rtx_def**> [#uses=3]
+ store %struct.rtx_def* %orig, %struct.rtx_def** null
+ %0 = load %struct.rtx_def** null, align 4 ; <%struct.rtx_def*> [#uses=0]
+ br i1 false, label %bb96, label %bb59
+
+bb59: ; preds = %entry
+ %1 = load %struct.rtx_def** %addr, align 4 ; <%struct.rtx_def*> [#uses=1]
+ %2 = call i32 @local_symbolic_operand(%struct.rtx_def* %1, i32 0) nounwind ; <i32> [#uses=0]
+ br i1 false, label %bb96, label %bb63
+
+bb63: ; preds = %bb59
+ br i1 false, label %bb64, label %bb74
+
+bb64: ; preds = %bb63
+ br i1 false, label %bb72, label %bb65
+
+bb65: ; preds = %bb64
+ br label %bb72
+
+bb72: ; preds = %bb65, %bb64
+ br label %bb74
+
+bb74: ; preds = %bb72, %bb63
+ br i1 false, label %bb75, label %bb76
+
+bb75: ; preds = %bb74
+ br label %bb76
+
+bb76: ; preds = %bb75, %bb74
+ br i1 false, label %bb77, label %bb84
+
+bb77: ; preds = %bb76
+ %3 = getelementptr [1 x %struct.cgraph_rtl_info]* null, i32 0, i32 0 ; <%struct.cgraph_rtl_info*> [#uses=0]
+ unreachable
+
+bb84: ; preds = %bb76
+ br i1 false, label %bb85, label %bb86
+
+bb85: ; preds = %bb84
+ br label %bb87
+
+bb86: ; preds = %bb84
+ br label %bb87
+
+bb87: ; preds = %bb86, %bb85
+ %4 = call %struct.rtx_def* @gen_rtx_fmt_Ei(i32 16, i32 0, %struct.rtvec_def* null, i32 1) nounwind ; <%struct.rtx_def*> [#uses=0]
+ br i1 false, label %bb89, label %bb90
+
+bb89: ; preds = %bb87
+ br label %bb91
+
+bb90: ; preds = %bb87
+ br label %bb91
+
+bb91: ; preds = %bb90, %bb89
+ br i1 false, label %bb92, label %bb93
+
+bb92: ; preds = %bb91
+ br label %bb94
+
+bb93: ; preds = %bb91
+ br label %bb94
+
+bb94: ; preds = %bb93, %bb92
+ unreachable
+
+bb96: ; preds = %bb59, %entry
+ %5 = load %struct.rtx_def** %addr, align 4 ; <%struct.rtx_def*> [#uses=1]
+ %6 = getelementptr %struct.rtx_def* %5, i32 0, i32 0 ; <i16*> [#uses=1]
+ %7 = load i16* %6, align 2 ; <i16> [#uses=0]
+ br i1 false, label %bb147, label %bb97
+
+bb97: ; preds = %bb96
+ %8 = load %struct.rtx_def** %addr, align 4 ; <%struct.rtx_def*> [#uses=0]
+ br i1 false, label %bb147, label %bb99
+
+bb99: ; preds = %bb97
+ unreachable
+
+bb147: ; preds = %bb97, %bb96
+ %9 = load %struct.rtx_def** %addr, align 4 ; <%struct.rtx_def*> [#uses=1]
+ %10 = getelementptr %struct.rtx_def* %9, i32 0, i32 0 ; <i16*> [#uses=1]
+ %11 = load i16* %10, align 2 ; <i16> [#uses=0]
+ br i1 false, label %bb164, label %bb148
+
+bb148: ; preds = %bb147
+ br i1 false, label %bb164, label %bb149
+
+bb149: ; preds = %bb148
+ br i1 false, label %bb150, label %bb152
+
+bb150: ; preds = %bb149
+ unreachable
+
+bb152: ; preds = %bb149
+ br label %bb164
+
+bb164: ; preds = %bb152, %bb148, %bb147
+ %12 = getelementptr [1 x %struct.cgraph_rtl_info]* null, i32 0, i32 1 ; <%struct.cgraph_rtl_info*> [#uses=0]
+ br i1 false, label %bb165, label %bb166
+
+bb165: ; preds = %bb164
+ br label %bb167
+
+bb166: ; preds = %bb164
+ br label %bb167
+
+bb167: ; preds = %bb166, %bb165
+ br i1 false, label %bb211, label %bb168
+
+bb168: ; preds = %bb167
+ br i1 false, label %bb211, label %bb170
+
+bb170: ; preds = %bb168
+ br i1 false, label %bb172, label %bb181
+
+bb172: ; preds = %bb170
+ br i1 false, label %bb179, label %bb174
+
+bb174: ; preds = %bb172
+ br i1 false, label %bb177, label %bb175
+
+bb175: ; preds = %bb174
+ br i1 false, label %bb177, label %bb176
+
+bb176: ; preds = %bb175
+ br label %bb178
+
+bb177: ; preds = %bb175, %bb174
+ br label %bb178
+
+bb178: ; preds = %bb177, %bb176
+ br label %bb180
+
+bb179: ; preds = %bb172
+ br label %bb180
+
+bb180: ; preds = %bb179, %bb178
+ br label %bb181
+
+bb181: ; preds = %bb180, %bb170
+ %13 = call %struct.rtvec_def* (i32, ...)* @gen_rtvec(i32 1, %struct.rtx_def* null) nounwind ; <%struct.rtvec_def*> [#uses=0]
+ unreachable
+
+bb211: ; preds = %bb168, %bb167
+ %14 = load %struct.rtx_def** %addr, align 4 ; <%struct.rtx_def*> [#uses=0]
+ %15 = getelementptr [1 x %struct.cgraph_rtl_info]* null, i32 0, i32 0 ; <%struct.cgraph_rtl_info*> [#uses=0]
+ store %struct.rtx_def* null, %struct.rtx_def** null, align 4
+ br i1 false, label %bb212, label %bb213
+
+bb212: ; preds = %bb211
+ store %struct.rtx_def* null, %struct.rtx_def** %iftmp.1532, align 4
+ br label %bb214
+
+bb213: ; preds = %bb211
+ store %struct.rtx_def* null, %struct.rtx_def** %iftmp.1532, align 4
+ br label %bb214
+
+bb214: ; preds = %bb213, %bb212
+ %16 = bitcast %struct.block_symbol* null to [1 x %struct.cgraph_rtl_info]* ; <[1 x %struct.cgraph_rtl_info]*> [#uses=1]
+ %17 = getelementptr [1 x %struct.cgraph_rtl_info]* %16, i32 0, i32 1 ; <%struct.cgraph_rtl_info*> [#uses=0]
+ %18 = load %struct.rtx_def** %iftmp.1532, align 4 ; <%struct.rtx_def*> [#uses=0]
+ %19 = getelementptr %struct.rtx_def* null, i32 0, i32 3 ; <%struct.u*> [#uses=1]
+ %20 = getelementptr %struct.u* %19, i32 0, i32 0 ; <%struct.block_symbol*> [#uses=1]
+ %21 = bitcast %struct.block_symbol* %20 to [1 x i64]* ; <[1 x i64]*> [#uses=1]
+ %22 = getelementptr [1 x i64]* %21, i32 0, i32 0 ; <i64*> [#uses=0]
+ %23 = call %struct.rtx_def* @plus_constant(%struct.rtx_def* null, i64 0) nounwind ; <%struct.rtx_def*> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/GVN/2009-03-05-dbg.ll b/test/Transforms/GVN/2009-03-05-dbg.ll
new file mode 100644
index 000000000000..0450a7a7aaf2
--- /dev/null
+++ b/test/Transforms/GVN/2009-03-05-dbg.ll
@@ -0,0 +1,66 @@
+; RUN: llvm-as < %s | opt -gvn -disable-output
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
+@llvm.dbg.compile_unit298 = external constant %llvm.dbg.compile_unit.type ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+define i8* @__deregister_frame_info_bases(i8* %begin) {
+entry:
+ br i1 false, label %bb17, label %bb
+
+bb: ; preds = %entry
+ br i1 false, label %bb17, label %bb6.preheader
+
+bb6.preheader: ; preds = %bb
+ br label %bb6
+
+bb3: ; preds = %bb6
+ br i1 false, label %bb4, label %bb6
+
+bb4: ; preds = %bb3
+ br label %out
+
+bb6: ; preds = %bb3, %bb6.preheader
+ br i1 false, label %bb14.loopexit, label %bb3
+
+bb8: ; preds = %bb14
+ br i1 false, label %bb9, label %bb11
+
+bb9: ; preds = %bb8
+ br i1 false, label %bb10, label %bb13
+
+bb10: ; preds = %bb9
+ br label %out
+
+bb11: ; preds = %bb8
+ br i1 false, label %bb12, label %bb13
+
+bb12: ; preds = %bb11
+ br label %out
+
+bb13: ; preds = %bb11, %bb9
+ br label %bb14
+
+bb14.loopexit: ; preds = %bb6
+ br label %bb14
+
+bb14: ; preds = %bb14.loopexit, %bb13
+ br i1 false, label %bb15.loopexit, label %bb8
+
+out: ; preds = %bb12, %bb10, %bb4
+ tail call void @llvm.dbg.stoppoint(i32 217, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit298 to { }*))
+ br i1 false, label %bb15, label %bb16
+
+bb15.loopexit: ; preds = %bb14
+ br label %bb15
+
+bb15: ; preds = %bb15.loopexit, %out
+ tail call void @llvm.dbg.stoppoint(i32 217, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit298 to { }*))
+ unreachable
+
+bb16: ; preds = %out
+ ret i8* null
+
+bb17: ; preds = %bb, %entry
+ ret i8* null
+}
diff --git a/test/Transforms/GVN/2009-03-10-PREOnVoid.ll b/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
new file mode 100644
index 000000000000..63ddc450869e
--- /dev/null
+++ b/test/Transforms/GVN/2009-03-10-PREOnVoid.ll
@@ -0,0 +1,82 @@
+; RUN: llvm-as < %s | opt -gvn -disable-output
+; PR3775
+
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %"struct.__gnu_cxx::hash<void*>" = type <{ i8 }>
+ %struct.__sched_param = type { i32 }
+ %struct._pthread_descr_struct = type opaque
+ %struct.pthread_attr_t = type { i32, i32, %struct.__sched_param, i32, i32, i32, i32, i8*, i32 }
+ %struct.pthread_mutex_t = type { i32, i32, %struct._pthread_descr_struct*, i32, %llvm.dbg.anchor.type }
+ %"struct.std::_Rb_tree<void*,std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<void*>,std::allocator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >" = type { %"struct.std::_Rb_tree<void*,std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<void*>,std::allocator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >::_Rb_tree_impl<std::less<void*>,false>" }
+ %"struct.std::_Rb_tree<void*,std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<void*>,std::allocator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >::_Rb_tree_impl<std::less<void*>,false>" = type { %"struct.__gnu_cxx::hash<void*>", %"struct.std::_Rb_tree_node_base", i32 }
+ %"struct.std::_Rb_tree_iterator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >" = type { %"struct.std::_Rb_tree_node_base"* }
+ %"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
+ %"struct.std::pair<std::_Rb_tree_iterator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,bool>" = type { %"struct.std::_Rb_tree_iterator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >", i8 }
+ %"struct.std::pair<void* const,void*>" = type { i8*, i8* }
+
+@_ZL20__gthrw_pthread_oncePiPFvvE = alias weak i32 (i32*, void ()*)* @pthread_once ; <i32 (i32*, void ()*)*> [#uses=0]
+@_ZL27__gthrw_pthread_getspecificj = alias weak i8* (i32)* @pthread_getspecific ; <i8* (i32)*> [#uses=0]
+@_ZL27__gthrw_pthread_setspecificjPKv = alias weak i32 (i32, i8*)* @pthread_setspecific ; <i32 (i32, i8*)*> [#uses=0]
+@_ZL22__gthrw_pthread_createPmPK16__pthread_attr_sPFPvS3_ES3_ = alias weak i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; <i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)*> [#uses=0]
+@_ZL22__gthrw_pthread_cancelm = alias weak i32 (i32)* @pthread_cancel ; <i32 (i32)*> [#uses=0]
+@_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+@_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+@_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+@_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = alias weak i32 (%struct.pthread_mutex_t*, %struct.__sched_param*)* @pthread_mutex_init ; <i32 (%struct.pthread_mutex_t*, %struct.__sched_param*)*> [#uses=0]
+@_ZL26__gthrw_pthread_key_createPjPFvPvE = alias weak i32 (i32*, void (i8*)*)* @pthread_key_create ; <i32 (i32*, void (i8*)*)*> [#uses=0]
+@_ZL26__gthrw_pthread_key_deletej = alias weak i32 (i32)* @pthread_key_delete ; <i32 (i32)*> [#uses=0]
+@_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = alias weak i32 (%struct.__sched_param*)* @pthread_mutexattr_init ; <i32 (%struct.__sched_param*)*> [#uses=0]
+@_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = alias weak i32 (%struct.__sched_param*, i32)* @pthread_mutexattr_settype ; <i32 (%struct.__sched_param*, i32)*> [#uses=0]
+@_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = alias weak i32 (%struct.__sched_param*)* @pthread_mutexattr_destroy ; <i32 (%struct.__sched_param*)*> [#uses=0]
+
+declare fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind readnone
+
+define fastcc void @_ZNSt8_Rb_treeIPvSt4pairIKS0_S0_ESt10_Select1stIS3_ESt4lessIS0_ESaIS3_EE16_M_insert_uniqueERKS3_(%"struct.std::pair<std::_Rb_tree_iterator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,bool>"* noalias nocapture sret %agg.result, %"struct.std::_Rb_tree<void*,std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > >,std::_Select1st<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > >,std::less<void*>,std::allocator<std::pair<void* const, std::vector<ShadowInfo, std::allocator<ShadowInfo> > > > >"* %this, %"struct.std::pair<void* const,void*>"* %__v) nounwind {
+entry:
+ br i1 false, label %bb7, label %bb
+
+bb: ; preds = %bb, %entry
+ br i1 false, label %bb5, label %bb
+
+bb5: ; preds = %bb
+ call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind
+ br i1 false, label %bb11, label %bb7
+
+bb7: ; preds = %bb5, %entry
+ br label %bb11
+
+bb11: ; preds = %bb7, %bb5
+ call fastcc void @_ZNSt10_Select1stISt4pairIKPvS1_EEC1Ev() nounwind
+ unreachable
+}
+
+declare i32 @pthread_once(i32*, void ()*)
+
+declare i8* @pthread_getspecific(i32)
+
+declare i32 @pthread_setspecific(i32, i8*)
+
+declare i32 @pthread_create(i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)
+
+declare i32 @pthread_cancel(i32)
+
+declare i32 @pthread_mutex_lock(%struct.pthread_mutex_t*)
+
+declare i32 @pthread_mutex_trylock(%struct.pthread_mutex_t*)
+
+declare i32 @pthread_mutex_unlock(%struct.pthread_mutex_t*)
+
+declare i32 @pthread_mutex_init(%struct.pthread_mutex_t*, %struct.__sched_param*)
+
+declare i32 @pthread_key_create(i32*, void (i8*)*)
+
+declare i32 @pthread_key_delete(i32)
+
+declare i32 @pthread_mutexattr_init(%struct.__sched_param*)
+
+declare i32 @pthread_mutexattr_settype(%struct.__sched_param*, i32)
+
+declare i32 @pthread_mutexattr_destroy(%struct.__sched_param*)
diff --git a/test/Transforms/GVN/basic.ll b/test/Transforms/GVN/basic.ll
new file mode 100644
index 000000000000..ebf5daaf9272
--- /dev/null
+++ b/test/Transforms/GVN/basic.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep {%z2 =}
+
+define i32 @main() {
+block1:
+ %z1 = bitcast i32 0 to i32
+ br label %block2
+block2:
+ %z2 = bitcast i32 0 to i32
+ ret i32 %z2
+}
diff --git a/test/Transforms/GVN/bitcast-of-call.ll b/test/Transforms/GVN/bitcast-of-call.ll
new file mode 100644
index 000000000000..0a045c8bd50c
--- /dev/null
+++ b/test/Transforms/GVN/bitcast-of-call.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep tmp2
+; PR2213
+
+define i32* @f(i8* %x) {
+entry:
+ %tmp = call i8* @m( i32 12 ) ; <i8*> [#uses=2]
+ %tmp1 = bitcast i8* %tmp to i32* ; <i32*> [#uses=0]
+ %tmp2 = bitcast i8* %tmp to i32* ; <i32*> [#uses=0]
+ ret i32* %tmp2
+}
+
+declare i8* @m(i32)
diff --git a/test/Transforms/GVN/calls-nonlocal.ll b/test/Transforms/GVN/calls-nonlocal.ll
new file mode 100644
index 000000000000..0d1c8a38ad48
--- /dev/null
+++ b/test/Transforms/GVN/calls-nonlocal.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep strlen | count 2
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+
+define i32 @test(i32 %g, i8* %P) nounwind {
+entry:
+ %tmp2 = call i32 @strlen( i8* %P ) nounwind readonly ; <i32> [#uses=1]
+ %tmp3 = icmp eq i32 %tmp2, 100 ; <i1> [#uses=1]
+ %tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp34, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb, label %bb6
+
+bb: ; preds = %entry
+ br label %bb27
+
+bb6: ; preds = %entry
+ %tmp8 = add i32 %g, 42 ; <i32> [#uses=2]
+ %tmp10 = call i32 @strlen( i8* %P ) nounwind readonly ; <i32> [#uses=1]
+ %tmp11 = icmp eq i32 %tmp10, 100 ; <i1> [#uses=1]
+ %tmp1112 = zext i1 %tmp11 to i8 ; <i8> [#uses=1]
+ %toBool13 = icmp ne i8 %tmp1112, 0 ; <i1> [#uses=1]
+ br i1 %toBool13, label %bb14, label %bb16
+
+bb14: ; preds = %bb6
+ br label %bb27
+
+bb16: ; preds = %bb6
+ %tmp18 = mul i32 %tmp8, 2 ; <i32> [#uses=1]
+ %tmp20 = call i32 @strlen( i8* %P ) nounwind readonly ; <i32> [#uses=1]
+ %tmp21 = icmp eq i32 %tmp20, 100 ; <i1> [#uses=1]
+ %tmp2122 = zext i1 %tmp21 to i8 ; <i8> [#uses=1]
+ %toBool23 = icmp ne i8 %tmp2122, 0 ; <i1> [#uses=1]
+ br i1 %toBool23, label %bb24, label %bb26
+
+bb24: ; preds = %bb16
+ br label %bb27
+
+bb26: ; preds = %bb16
+ br label %bb27
+
+bb27: ; preds = %bb26, %bb24, %bb14, %bb
+ %tmp.0 = phi i32 [ 11, %bb26 ], [ %tmp18, %bb24 ], [ %tmp8, %bb14 ], [ %g, %bb ] ; <i32> [#uses=1]
+ br label %return
+
+return: ; preds = %bb27
+ ret i32 %tmp.0
+}
+
+declare i32 @strlen(i8*) nounwind readonly
diff --git a/test/Transforms/GVN/calls-readonly.ll b/test/Transforms/GVN/calls-readonly.ll
new file mode 100644
index 000000000000..723ef7749298
--- /dev/null
+++ b/test/Transforms/GVN/calls-readonly.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -basicaa -gvn | llvm-dis | grep {call.*strlen} | count 1
+; Should delete the second call to strlen even though the intervening strchr call exists.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+
+define i8* @test(i8* %P, i8* %Q, i32 %x, i32 %y) nounwind readonly {
+entry:
+ %0 = tail call i32 @strlen(i8* %P) nounwind readonly ; <i32> [#uses=2]
+ %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %2 = sdiv i32 %x, %y ; <i32> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %x_addr.0 = phi i32 [ %2, %bb ], [ %x, %entry ] ; <i32> [#uses=1]
+ %3 = tail call i8* @strchr(i8* %Q, i32 97) nounwind readonly ; <i8*> [#uses=1]
+ %4 = tail call i32 @strlen(i8* %P) nounwind readonly ; <i32> [#uses=1]
+ %5 = add i32 %x_addr.0, %0 ; <i32> [#uses=1]
+ %.sum = sub i32 %5, %4 ; <i32> [#uses=1]
+ %6 = getelementptr i8* %3, i32 %.sum ; <i8*> [#uses=1]
+ ret i8* %6
+}
+
+declare i32 @strlen(i8*) nounwind readonly
+
+declare i8* @strchr(i8*, i32) nounwind readonly
diff --git a/test/Transforms/GVN/condprop.ll b/test/Transforms/GVN/condprop.ll
new file mode 100644
index 000000000000..53cbb509fcb2
--- /dev/null
+++ b/test/Transforms/GVN/condprop.ll
@@ -0,0 +1,52 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {br i1 false}
+
+@a = external global i32 ; <i32*> [#uses=7]
+
+define i32 @foo() nounwind {
+entry:
+ %0 = load i32* @a, align 4 ; <i32> [#uses=1]
+ %1 = icmp eq i32 %0, 4 ; <i1> [#uses=1]
+ br i1 %1, label %bb, label %bb1
+
+bb: ; preds = %entry
+ br label %bb8
+
+bb1: ; preds = %entry
+ %2 = load i32* @a, align 4 ; <i32> [#uses=1]
+ %3 = icmp eq i32 %2, 5 ; <i1> [#uses=1]
+ br i1 %3, label %bb2, label %bb3
+
+bb2: ; preds = %bb1
+ br label %bb8
+
+bb3: ; preds = %bb1
+ %4 = load i32* @a, align 4 ; <i32> [#uses=1]
+ %5 = icmp eq i32 %4, 4 ; <i1> [#uses=1]
+ br i1 %5, label %bb4, label %bb5
+
+bb4: ; preds = %bb3
+ %6 = load i32* @a, align 4 ; <i32> [#uses=1]
+ %7 = add i32 %6, 5 ; <i32> [#uses=1]
+ br label %bb8
+
+bb5: ; preds = %bb3
+ %8 = load i32* @a, align 4 ; <i32> [#uses=1]
+ %9 = icmp eq i32 %8, 5 ; <i1> [#uses=1]
+ br i1 %9, label %bb6, label %bb7
+
+bb6: ; preds = %bb5
+ %10 = load i32* @a, align 4 ; <i32> [#uses=1]
+ %11 = add i32 %10, 4 ; <i32> [#uses=1]
+ br label %bb8
+
+bb7: ; preds = %bb5
+ %12 = load i32* @a, align 4 ; <i32> [#uses=1]
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6, %bb4, %bb2, %bb
+ %.0 = phi i32 [ %12, %bb7 ], [ %11, %bb6 ], [ %7, %bb4 ], [ 4, %bb2 ], [ 5, %bb ] ; <i32> [#uses=1]
+ br label %return
+
+return: ; preds = %bb8
+ ret i32 %.0
+}
diff --git a/test/Transforms/GVN/dg.exp b/test/Transforms/GVN/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/GVN/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/GVN/load-constant-mem.ll b/test/Transforms/GVN/load-constant-mem.ll
new file mode 100644
index 000000000000..83b9d3846c17
--- /dev/null
+++ b/test/Transforms/GVN/load-constant-mem.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep {ret i32 0}
+; PR4189
+@G = external constant [4 x i32]
+
+define i32 @test(i8* %p, i32 %i) nounwind {
+entry:
+ %P = getelementptr [4 x i32]* @G, i32 0, i32 %i
+ %A = load i32* %P
+ store i8 4, i8* %p
+ %B = load i32* %P
+ %C = sub i32 %A, %B
+ ret i32 %C
+}
diff --git a/test/Transforms/GVN/local-pre.ll b/test/Transforms/GVN/local-pre.ll
new file mode 100644
index 000000000000..59158cc0fcae
--- /dev/null
+++ b/test/Transforms/GVN/local-pre.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvn -enable-pre | llvm-dis | grep {b.pre}
+
+define i32 @main(i32 %p) {
+block1:
+
+ br i1 true, label %block2, label %block3
+
+block2:
+ %a = add i32 %p, 1
+ br label %block4
+
+block3:
+ br label %block4
+
+block4:
+ %b = add i32 %p, 1
+ ret i32 %b
+}
diff --git a/test/Transforms/GVN/lpre-basic.ll b/test/Transforms/GVN/lpre-basic.ll
new file mode 100644
index 000000000000..5b52863b1c8d
--- /dev/null
+++ b/test/Transforms/GVN/lpre-basic.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | grep {%PRE = phi}
+
+define i32 @test(i32* %p, i1 %C) {
+block1:
+ br i1 %C, label %block2, label %block3
+
+block2:
+ br label %block4
+
+block3:
+ %b = bitcast i32 0 to i32
+ store i32 %b, i32* %p
+ br label %block4
+
+block4:
+ %PRE = load i32* %p
+ ret i32 %PRE
+}
diff --git a/test/Transforms/GVN/lpre-call-wrap-2.ll b/test/Transforms/GVN/lpre-call-wrap-2.ll
new file mode 100644
index 000000000000..c9f93526fea4
--- /dev/null
+++ b/test/Transforms/GVN/lpre-call-wrap-2.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis > %t
+; RUN: %prcontext bb1: 2 < %t | grep phi
+; RUN: %prcontext bb1: 2 < %t | not grep load
+;
+; The partially redundant load in bb1 should be hoisted to "bb". This comes
+; from this C code (GCC PR 23455):
+; unsigned outcnt; extern void flush_outbuf(void);
+; void bi_windup(unsigned char *outbuf, unsigned char bi_buf) {
+; outbuf[outcnt] = bi_buf;
+; if (outcnt == 16384)
+; flush_outbuf();
+; outbuf[outcnt] = bi_buf;
+; }
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+@outcnt = common global i32 0 ; <i32*> [#uses=3]
+
+define void @bi_windup(i8* %outbuf, i8 zeroext %bi_buf) nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = load i32* @outcnt, align 4 ; <i32> [#uses=1]
+ %1 = getelementptr i8* %outbuf, i32 %0 ; <i8*> [#uses=1]
+ store i8 %bi_buf, i8* %1, align 1
+ %2 = load i32* @outcnt, align 4 ; <i32> [#uses=1]
+ %3 = icmp eq i32 %2, 16384 ; <i1> [#uses=1]
+ br i1 %3, label %bb, label %bb1
+
+bb: ; preds = %entry
+ call void @flush_outbuf() nounwind
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %4 = load i32* @outcnt, align 4 ; <i32> [#uses=1]
+ %5 = getelementptr i8* %outbuf, i32 %4 ; <i8*> [#uses=1]
+ store i8 %bi_buf, i8* %5, align 1
+ ret void
+}
+
+declare void @flush_outbuf()
diff --git a/test/Transforms/GVN/lpre-call-wrap.ll b/test/Transforms/GVN/lpre-call-wrap.ll
new file mode 100644
index 000000000000..7470953bb9b0
--- /dev/null
+++ b/test/Transforms/GVN/lpre-call-wrap.ll
@@ -0,0 +1,54 @@
+; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis > %t
+; RUN: %prcontext bb3.backedge: 2 < %t | grep phi
+; RUN: %prcontext bb3.backedge: 2 < %t | not grep load
+;
+; Make sure the load in bb3.backedge is removed and moved into bb1 after the
+; call. This makes the non-call case faster.
+;
+; This test is derived from this C++ code (GCC PR 37810):
+; void g();
+; struct A {
+; int n; int m;
+; A& operator++(void) { ++n; if (n == m) g(); return *this; }
+; A() : n(0), m(0) { }
+; friend bool operator!=(A const& a1, A const& a2) { return a1.n != a2.n; }
+; };
+; void testfunction(A& iter) { A const end; while (iter != end) ++iter; }
+;
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct.A = type { i32, i32 }
+
+define void @_Z12testfunctionR1A(%struct.A* %iter) {
+entry:
+ %0 = getelementptr %struct.A* %iter, i32 0, i32 0 ; <i32*> [#uses=3]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=2]
+ %2 = icmp eq i32 %1, 0 ; <i1> [#uses=1]
+ br i1 %2, label %return, label %bb.nph
+
+bb.nph: ; preds = %entry
+ %3 = getelementptr %struct.A* %iter, i32 0, i32 1 ; <i32*> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb3.backedge, %bb.nph
+ %.rle = phi i32 [ %1, %bb.nph ], [ %7, %bb3.backedge ] ; <i32> [#uses=1]
+ %4 = add i32 %.rle, 1 ; <i32> [#uses=2]
+ store i32 %4, i32* %0, align 4
+ %5 = load i32* %3, align 4 ; <i32> [#uses=1]
+ %6 = icmp eq i32 %4, %5 ; <i1> [#uses=1]
+ br i1 %6, label %bb1, label %bb3.backedge
+
+bb1: ; preds = %bb
+ tail call void @_Z1gv()
+ br label %bb3.backedge
+
+bb3.backedge: ; preds = %bb, %bb1
+ %7 = load i32* %0, align 4 ; <i32> [#uses=2]
+ %8 = icmp eq i32 %7, 0 ; <i1> [#uses=1]
+ br i1 %8, label %return, label %bb
+
+return: ; preds = %bb3.backedge, %entry
+ ret void
+}
+
+declare void @_Z1gv()
diff --git a/test/Transforms/GVN/mixed.ll b/test/Transforms/GVN/mixed.ll
new file mode 100644
index 000000000000..0c4f65cf9651
--- /dev/null
+++ b/test/Transforms/GVN/mixed.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep DEADLOAD
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep DEADGEP
+
+define i32 @main(i32** %p) {
+block1:
+ %z1 = load i32** %p
+ %z2 = getelementptr i32* %z1, i32 0
+ %z3 = load i32* %z2
+ %DEADLOAD = load i32** %p
+ %DEADGEP = getelementptr i32* %DEADLOAD, i32 0
+ %DEADLOAD2 = load i32* %DEADGEP
+ ret i32 %DEADLOAD2
+}
diff --git a/test/Transforms/GVN/pre-basic-add.ll b/test/Transforms/GVN/pre-basic-add.ll
new file mode 100644
index 000000000000..f00bda3c4469
--- /dev/null
+++ b/test/Transforms/GVN/pre-basic-add.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -gvn -enable-pre | llvm-dis | grep {.pre}
+
+@H = common global i32 0 ; <i32*> [#uses=2]
+@G = common global i32 0 ; <i32*> [#uses=1]
+
+define i32 @test() nounwind {
+entry:
+ %0 = load i32* @H, align 4 ; <i32> [#uses=2]
+ %1 = call i32 (...)* @foo() nounwind ; <i32> [#uses=1]
+ %2 = icmp ne i32 %1, 0 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %3 = add i32 %0, 42 ; <i32> [#uses=1]
+ store i32 %3, i32* @G, align 4
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %4 = add i32 %0, 42 ; <i32> [#uses=1]
+ store i32 %4, i32* @H, align 4
+ br label %return
+
+return: ; preds = %bb1
+ ret i32 0
+}
+
+declare i32 @foo(...)
diff --git a/test/Transforms/GVN/pre-single-pred.ll b/test/Transforms/GVN/pre-single-pred.ll
new file mode 100644
index 000000000000..b735ea9827c2
--- /dev/null
+++ b/test/Transforms/GVN/pre-single-pred.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -gvn -enable-load-pre | llvm-dis | not grep {tmp3 = load}
+
+define i32 @f(i32* nocapture %p, i32 %n) nounwind {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %for.inc ] ; <i32> [#uses=2]
+ %cmp = icmp slt i32 %i.0, %n ; <i1> [#uses=1]
+ br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
+
+for.cond.for.end_crit_edge: ; preds = %for.cond
+ br label %for.end
+
+for.body: ; preds = %for.cond
+ %tmp3 = load i32* %p ; <i32> [#uses=1]
+ %dec = add i32 %tmp3, -1 ; <i32> [#uses=2]
+ store i32 %dec, i32* %p
+ %cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1]
+ br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc
+
+for.body.for.end_crit_edge: ; preds = %for.body
+ br label %for.end
+
+for.inc: ; preds = %for.body
+ %indvar.next = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %for.cond
+
+for.end: ; preds = %for.body.for.end_crit_edge, %for.cond.for.end_crit_edge
+ %tmp9 = load i32* %p ; <i32> [#uses=1]
+ ret i32 %tmp9
+}
diff --git a/test/Transforms/GVN/rle-dominated.ll b/test/Transforms/GVN/rle-dominated.ll
new file mode 100644
index 000000000000..0d517178675e
--- /dev/null
+++ b/test/Transforms/GVN/rle-dominated.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep load | count 2
+
+define i32 @main(i32** %p) {
+block1:
+ %z = load i32** %p
+ br i1 true, label %block2, label %block3
+
+block2:
+ %a = load i32** %p
+ br label %block4
+
+block3:
+ %b = load i32** %p
+ br label %block4
+
+block4:
+ %c = load i32** %p
+ %d = load i32* %c
+ ret i32 %d
+}
diff --git a/test/Transforms/GVN/rle-must-alias.ll b/test/Transforms/GVN/rle-must-alias.ll
new file mode 100644
index 000000000000..ada439857189
--- /dev/null
+++ b/test/Transforms/GVN/rle-must-alias.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {DEAD = phi i32 }
+; XFAIL: *
+
+; FIXME: GVN should eliminate the fully redundant %9 GEP which
+; allows DEAD to be removed. This is PR3198.
+
+; The %7 and %4 loads combine to make %DEAD unneeded.
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+@H = common global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=3]
+@G = common global i32 0 ; <i32*> [#uses=2]
+
+define i32 @test(i32 %i) nounwind {
+entry:
+ %0 = tail call i32 (...)* @foo() nounwind ; <i32> [#uses=1]
+ %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb1, label %bb
+
+bb: ; preds = %entry
+ %2 = tail call i32 (...)* @bar() nounwind ; <i32> [#uses=0]
+ %3 = getelementptr [100 x i32]* @H, i32 0, i32 %i ; <i32*> [#uses=1]
+ %4 = load i32* %3, align 4 ; <i32> [#uses=1]
+ store i32 %4, i32* @G, align 4
+ br label %bb3
+
+bb1: ; preds = %entry
+ %5 = tail call i32 (...)* @baz() nounwind ; <i32> [#uses=0]
+ %6 = getelementptr [100 x i32]* @H, i32 0, i32 %i ; <i32*> [#uses=1]
+ %7 = load i32* %6, align 4 ; <i32> [#uses=2]
+ store i32 %7, i32* @G, align 4
+ %8 = icmp eq i32 %7, 0 ; <i1> [#uses=1]
+ br i1 %8, label %bb3, label %bb4
+
+bb3: ; preds = %bb1, %bb
+ %9 = getelementptr [100 x i32]* @H, i32 0, i32 %i ; <i32*> [#uses=1]
+ %DEAD = load i32* %9, align 4 ; <i32> [#uses=1]
+ ret i32 %DEAD
+
+bb4: ; preds = %bb1
+ ret i32 0
+}
+
+declare i32 @foo(...)
+
+declare i32 @bar(...)
+
+declare i32 @baz(...)
diff --git a/test/Transforms/GVN/rle-no-phi-translate.ll b/test/Transforms/GVN/rle-no-phi-translate.ll
new file mode 100644
index 000000000000..9ffbe217dba5
--- /dev/null
+++ b/test/Transforms/GVN/rle-no-phi-translate.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep load
+; FIXME: This should be promotable, but memdep/gvn don't track values
+; path/edge sensitively enough.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+
+define i32 @g(i32* %b, i32* %c) nounwind {
+entry:
+ store i32 1, i32* %b
+ store i32 2, i32* %c
+
+ %t1 = icmp eq i32* %b, null ; <i1> [#uses=1]
+ br i1 %t1, label %bb, label %bb2
+
+bb: ; preds = %entry
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %c_addr.0 = phi i32* [ %b, %entry ], [ %c, %bb ] ; <i32*> [#uses=1]
+ %cv = load i32* %c_addr.0, align 4 ; <i32> [#uses=1]
+ ret i32 %cv
+}
+
diff --git a/test/Transforms/GVN/rle-nonlocal.ll b/test/Transforms/GVN/rle-nonlocal.ll
new file mode 100644
index 000000000000..d93223131d79
--- /dev/null
+++ b/test/Transforms/GVN/rle-nonlocal.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%DEAD = phi i32. }
+
+define i32 @main(i32** %p) {
+block1:
+ br i1 true, label %block2, label %block3
+
+block2:
+ %a = load i32** %p
+ br label %block4
+
+block3:
+ %b = load i32** %p
+ br label %block4
+
+block4:
+ %DEAD = load i32** %p
+ %c = load i32* %DEAD
+ ret i32 %c
+}
diff --git a/test/Transforms/GVN/rle-phi-translate.ll b/test/Transforms/GVN/rle-phi-translate.ll
new file mode 100644
index 000000000000..b5311eec59c4
--- /dev/null
+++ b/test/Transforms/GVN/rle-phi-translate.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%cv = phi i32}
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {%bv = phi i32}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+
+define i32 @g(i32* %b, i32* %c) nounwind {
+entry:
+ %g = alloca i32 ; <i32*> [#uses=4]
+ %t1 = icmp eq i32* %b, null ; <i1> [#uses=1]
+ br i1 %t1, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %t2 = load i32* %c, align 4 ; <i32> [#uses=1]
+ %t3 = add i32 %t2, 1 ; <i32> [#uses=1]
+ store i32 %t3, i32* %g, align 4
+ br label %bb2
+
+bb1: ; preds = %entry
+ %t5 = load i32* %b, align 4 ; <i32> [#uses=1]
+ %t6 = add i32 %t5, 1 ; <i32> [#uses=1]
+ store i32 %t6, i32* %g, align 4
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %c_addr.0 = phi i32* [ %g, %bb1 ], [ %c, %bb ] ; <i32*> [#uses=1]
+ %b_addr.0 = phi i32* [ %b, %bb1 ], [ %g, %bb ] ; <i32*> [#uses=1]
+ %cv = load i32* %c_addr.0, align 4 ; <i32> [#uses=1]
+ %bv = load i32* %b_addr.0, align 4 ; <i32> [#uses=1]
+ %ret = add i32 %cv, %bv ; <i32> [#uses=1]
+ ret i32 %ret
+}
+
diff --git a/test/Transforms/GVN/rle-semidominated.ll b/test/Transforms/GVN/rle-semidominated.ll
new file mode 100644
index 000000000000..5c11b06e7327
--- /dev/null
+++ b/test/Transforms/GVN/rle-semidominated.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep {DEAD = phi i32 }
+
+define i32 @main(i32* %p) {
+block1:
+ %z = load i32* %p
+ br i1 true, label %block2, label %block3
+
+block2:
+ br label %block4
+
+block3:
+ %b = bitcast i32 0 to i32
+ store i32 %b, i32* %p
+ br label %block4
+
+block4:
+ %DEAD = load i32* %p
+ ret i32 %DEAD
+}
diff --git a/test/Transforms/GVNPRE/2007-06-12-NoExit.ll b/test/Transforms/GVNPRE/2007-06-12-NoExit.ll
new file mode 100644
index 000000000000..b93a956b2f15
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-06-12-NoExit.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define void @_Z4sortI3Lit16LessThan_defaultIS0_EEvPT_iT0_() {
+entry:
+ br label %cond_false
+
+cond_false: ; preds = %cond_false, %entry
+ br label %cond_false
+}
diff --git a/test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll b/test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll
new file mode 100644
index 000000000000..3a6ac679cbc9
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define void @strength_test5(i32* %data) {
+entry:
+ br i1 false, label %cond_next16.preheader, label %cond_true
+
+cond_true: ; preds = %entry
+ %tmp12 = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp12, label %return, label %cond_next16.preheader
+
+cond_next16.preheader: ; preds = %cond_true, %entry
+ %i.01.1.ph = phi i32 [ 1, %entry ], [ 1, %cond_true ] ; <i32> [#uses=1]
+ %i.01.1 = add i32 0, %i.01.1.ph ; <i32> [#uses=0]
+ %indvar.next = add i32 0, 1 ; <i32> [#uses=0]
+ ret void
+
+return: ; preds = %cond_true
+ ret void
+}
diff --git a/test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll b/test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll
new file mode 100644
index 000000000000..86187b291b87
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll
@@ -0,0 +1,70 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+@.str1 = external constant [4 x i8] ; <[4 x i8]*> [#uses=1]
+@.str2 = external constant [5 x i8] ; <[5 x i8]*> [#uses=1]
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ br i1 false, label %cond_next, label %cond_true
+
+cond_true: ; preds = %entry
+ ret i32 0
+
+cond_next: ; preds = %entry
+ %tmp10 = invoke i16 @_ZN12token_stream4openEPKc( i8* null, i8* null ) signext
+ to label %invcont unwind label %cleanup690 ; <i16> [#uses=0]
+
+invcont: ; preds = %cond_next
+ %tmp15 = invoke i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @.str1, i32 0, i32 0) )
+ to label %invcont14 unwind label %cleanup685 ; <i32> [#uses=0]
+
+invcont14: ; preds = %invcont
+ %tmp17 = invoke i8* @_ZN24lambda_expression_parser10expressionEPP11arglst_node( i8* null, i8** null )
+ to label %cond_true22 unwind label %cleanup685
+
+cond_true22: ; preds = %invcont14
+ %tmp35 = invoke i32 null( i8* null )
+ to label %cond_next56 unwind label %cleanup685 ; <i32> [#uses=0]
+
+cond_next56: ; preds = %cond_true22
+ %tmp59 = invoke i32 (i8*, ...)* @printf( i8* getelementptr ([5 x i8]* @.str2, i32 0, i32 0) )
+ to label %invcont58 unwind label %cleanup685 ; <i32> [#uses=0]
+
+invcont58: ; preds = %cond_next56
+ invoke void null( i8* null, i8* null, i32 0 )
+ to label %invcont72 unwind label %cleanup685
+
+invcont72: ; preds = %invcont58
+ %tmp143 = invoke i32 null( i8* null )
+ to label %invcont142 unwind label %cleanup685 ; <i32> [#uses=0]
+
+invcont142: ; preds = %invcont72
+ br i1 false, label %cond_false407, label %cond_true150
+
+cond_true150: ; preds = %invcont142
+ ret i32 0
+
+cond_false407: ; preds = %invcont142
+ %tmp431 = invoke i8* null( i8* null, i8* null, i32 0, i32* null )
+ to label %bb432 unwind label %cleanup685
+
+bb432: ; preds = %bb432, %cond_false407
+ %rexp413.7 = phi i8* [ %tmp431, %cond_false407 ], [ %rexp413.7, %bb432 ]
+ %tmp434 = icmp eq i8* %rexp413.7, null ; <i1> [#uses=1]
+ br i1 %tmp434, label %bb432, label %cond_true437
+
+cond_true437: ; preds = %bb432
+ ret i32 0
+
+cleanup685: ; preds = %cond_false407, %invcont72, %invcont58, %cond_next56, %cond_true22, %invcont14, %invcont
+ ret i32 0
+
+cleanup690: ; preds = %cond_next
+ ret i32 0
+}
+
+declare i16 @_ZN12token_stream4openEPKc(i8*, i8*) signext
+
+declare i32 @printf(i8*, ...)
+
+declare i8* @_ZN24lambda_expression_parser10expressionEPP11arglst_node(i8*, i8**)
diff --git a/test/Transforms/GVNPRE/2007-06-15-Looping.ll b/test/Transforms/GVNPRE/2007-06-15-Looping.ll
new file mode 100644
index 000000000000..92d2288f8969
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-06-15-Looping.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define fastcc void @compute_max_score_1() {
+entry:
+ %tmp7 = sub i32 0, 0 ; <i32> [#uses=0]
+ br label %bb
+
+bb: ; preds = %bb212, %entry
+ %indvar29 = phi i32 [ 0, %entry ], [ %indvar.next30, %bb212 ] ; <i32> [#uses=2]
+ %j.01.0 = sub i32 %indvar29, 0 ; <i32> [#uses=0]
+ br label %cond_next166
+
+cond_next166: ; preds = %cond_next166, %bb
+ br i1 false, label %bb212, label %cond_next166
+
+bb212: ; preds = %cond_next166
+ %indvar.next30 = add i32 %indvar29, 1 ; <i32> [#uses=1]
+ br i1 false, label %return, label %bb
+
+return: ; preds = %bb212
+ ret void
+}
diff --git a/test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll b/test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll
new file mode 100644
index 000000000000..b4cb5178c4ca
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define void @vorbis_lsp_to_curve() {
+entry:
+ br i1 false, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ br label %bb34
+
+bb34: ; preds = %bb34, %bb.nph
+ %p.1 = phi float [ 0x3FE6A09E60000000, %bb.nph ], [ %tmp48, %bb34 ] ; <float> [#uses=1]
+ %tmp44 = load float* null ; <float> [#uses=1]
+ %tmp46 = sub float %tmp44, 0.000000e+00 ; <float> [#uses=1]
+ %tmp48 = mul float %tmp46, %p.1 ; <float> [#uses=1]
+ br i1 false, label %bb57, label %bb34
+
+bb57: ; preds = %bb34
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/GVNPRE/2007-06-18-EraseNumbering.ll b/test/Transforms/GVNPRE/2007-06-18-EraseNumbering.ll
new file mode 100644
index 000000000000..af51a032cab4
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-06-18-EraseNumbering.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define i32 @TreeCCStreamFlush(i8* %stream) {
+entry:
+ br i1 false, label %bb55.preheader, label %cond_true
+
+cond_true: ; preds = %entry
+ ret i32 0
+
+bb55.preheader: ; preds = %entry
+ %tmp57 = icmp eq i8* null, null ; <i1> [#uses=0]
+ br i1 false, label %cond_next106, label %bb124
+
+cond_next106: ; preds = %bb55.preheader
+ %tmp109 = load i8** null
+ br i1 false, label %bb124, label %bb116
+
+bb116: ; preds = %cond_next106
+ ret i32 0
+
+bb124: ; preds = %cond_next106, %bb55.preheader
+ %buffer.4 = phi i8* [ null, %bb55.preheader ], [ %tmp109, %cond_next106 ]
+ %tmp131 = icmp eq i8* %buffer.4, null
+ %bothcond = or i1 %tmp131, false
+ ret i32 0
+}
diff --git a/test/Transforms/GVNPRE/2007-07-03-PhiTranslateGEP.ll b/test/Transforms/GVNPRE/2007-07-03-PhiTranslateGEP.ll
new file mode 100644
index 000000000000..65d70d95820e
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-07-03-PhiTranslateGEP.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define i64 @foo({ i32, i32 }** %__v) {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %__x.066.0 = phi { i32, i32 }* [ null, %entry ], [ null, %bb ]
+ %tmp2.i.i63 = getelementptr { i32, i32 }* %__x.066.0, i32 0, i32 1
+ br i1 false, label %bb, label %cond_true
+
+cond_true: ; preds = %bb
+ ret i64 0
+}
diff --git a/test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll b/test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll
new file mode 100644
index 000000000000..d72e2e1eb519
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define i32* @_ZN6Solver9propagateEv(i32* %this) {
+entry:
+ %tmp15.i48 = load i8* null ; <i8> [#uses=2]
+ %tmp64.i.i51 = sub i8 0, %tmp15.i48 ; <i8> [#uses=1]
+ %tmp231.i52 = select i1 false, i8 %tmp15.i48, i8 %tmp64.i.i51 ; <i8> [#uses=0]
+ ret i32* null
+}
diff --git a/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll b/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll
new file mode 100644
index 000000000000..944a70059386
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define void @set_depth_values(i32 %level) {
+cond_true90: ; preds = %cond_next84
+ br i1 false, label %cond_true105, label %cond_true151
+
+cond_true105: ; preds = %cond_true90
+ %tmp132 = add i32 %level, -3 ; <i32> [#uses=2]
+ %tmp133 = icmp sgt i32 %tmp132, 0 ; <i1> [#uses=1]
+ %max134 = select i1 %tmp133, i32 %tmp132, i32 1 ; <i32> [#uses=0]
+ br label %cond_true151
+
+cond_true151: ; preds = %cond_true140, %cond_true105
+ %tmp153 = add i32 %level, -3 ; <i32> [#uses=2]
+ %tmp154 = icmp sgt i32 %tmp153, 0 ; <i1> [#uses=1]
+ %max155 = select i1 %tmp154, i32 %tmp153, i32 1 ; <i32> [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/GVNPRE/2007-07-05-AvailabilityUpdating.ll b/test/Transforms/GVNPRE/2007-07-05-AvailabilityUpdating.ll
new file mode 100644
index 000000000000..5510935ebbc4
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-07-05-AvailabilityUpdating.ll
@@ -0,0 +1,54 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep tmp114115.gvnpre
+
+ %struct.AV = type { %struct.XPVAV*, i32, i32 }
+ %struct.CLONE_PARAMS = type { %struct.AV*, i32, %struct.PerlInterpreter* }
+ %struct.HE = type { %struct.HE*, %struct.HEK*, %struct.SV* }
+ %struct.HEK = type { i32, i32, [1 x i8] }
+ %struct.HV = type { %struct.XPVHV*, i32, i32 }
+ %struct.MAGIC = type { %struct.MAGIC*, %struct.MGVTBL*, i16, i8, i8, %struct.SV*, i8*, i32 }
+ %struct.MGVTBL = type { i32 (%struct.SV*, %struct.MAGIC*)*, i32 (%struct.SV*, %struct.MAGIC*)*, i32 (%struct.SV*, %struct.MAGIC*)*, i32 (%struct.SV*, %struct.MAGIC*)*, i32 (%struct.SV*, %struct.MAGIC*)*, i32 (%struct.SV*, %struct.MAGIC*, %struct.SV*, i8*, i32)*, i32 (%struct.MAGIC*, %struct.CLONE_PARAMS*)* }
+ %struct.OP = type { %struct.OP*, %struct.OP*, %struct.OP* ()*, i32, i16, i16, i8, i8 }
+ %struct.PMOP = type { %struct.OP*, %struct.OP*, %struct.OP* ()*, i32, i16, i16, i8, i8, %struct.OP*, %struct.OP*, %struct.OP*, %struct.OP*, %struct.PMOP*, %struct.REGEXP*, i32, i32, i8, %struct.HV* }
+ %struct.PerlInterpreter = type { i8 }
+ %struct.REGEXP = type { i32*, i32*, %struct.regnode*, %struct.reg_substr_data*, i8*, %struct.reg_data*, i8*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, [1 x %struct.regnode] }
+ %struct.SV = type { i8*, i32, i32 }
+ %struct.XPVAV = type { i8*, i32, i32, i32, double, %struct.MAGIC*, %struct.HV*, %struct.SV**, %struct.SV*, i8 }
+ %struct.XPVHV = type { i8*, i32, i32, i32, double, %struct.MAGIC*, %struct.HV*, i32, %struct.HE*, %struct.PMOP*, i8* }
+ %struct.reg_data = type { i32, i8*, [1 x i8*] }
+ %struct.reg_substr_data = type { [3 x %struct.reg_substr_datum] }
+ %struct.reg_substr_datum = type { i32, i32, %struct.SV*, %struct.SV* }
+ %struct.regnode = type { i8, i8, i16 }
+
+define void @Perl_op_clear(%struct.OP* %o) {
+entry:
+ switch i32 0, label %bb106 [
+ i32 13, label %bb106
+ i32 31, label %clear_pmop
+ i32 32, label %clear_pmop
+ i32 33, label %bb101
+ ]
+
+bb101: ; preds = %entry
+ %tmp102103 = bitcast %struct.OP* %o to %struct.PMOP* ; <%struct.PMOP*> [#uses=1]
+ %tmp104 = getelementptr %struct.PMOP* %tmp102103, i32 0, i32 10 ; <%struct.OP**> [#uses=0]
+ br i1 false, label %cond_next174, label %cond_true122
+
+bb106: ; preds = %entry, %entry
+ %tmp107108 = bitcast %struct.OP* %o to %struct.PMOP* ; <%struct.PMOP*> [#uses=0]
+ br label %clear_pmop
+
+clear_pmop: ; preds = %bb106, %entry, %entry
+ %tmp114115 = bitcast %struct.OP* %o to %struct.PMOP* ; <%struct.PMOP*> [#uses=0]
+ br label %cond_true122
+
+cond_true122: ; preds = %clear_pmop, %bb101
+ br i1 false, label %cond_next174, label %cond_true129
+
+cond_true129: ; preds = %cond_true122
+ ret void
+
+cond_next174: ; preds = %cond_true122, %bb101
+ %tmp175176 = bitcast %struct.OP* %o to %struct.PMOP* ; <%struct.PMOP*> [#uses=1]
+ %tmp177 = getelementptr %struct.PMOP* %tmp175176, i32 0, i32 10 ; <%struct.OP**> [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll b/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll
new file mode 100644
index 000000000000..2a7e49c6cd9e
--- /dev/null
+++ b/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+ %"struct.ObjectArena<char>" = type { i32, i32, %"struct.ResizeArray<char*>", i8*, i8* }
+ %"struct.ResizeArray<char*>" = type { i32 (...)**, %"struct.ResizeArrayRaw<char*>"* }
+ %"struct.ResizeArrayRaw<char*>" = type { i8**, i8*, i32, i32, i32, float, i32 }
+
+define void @_ZN11ObjectArenaIcED1Ev(%"struct.ObjectArena<char>"* %this) {
+entry:
+ br label %cond_true21
+
+cond_true21: ; preds = %cond_true21, %entry
+ %tmp215.0 = phi %"struct.ResizeArray<char*>"* [ null, %entry ], [ null, %cond_true21 ] ; <%"struct.ResizeArray<char*>"*> [#uses=1]
+ %tmp2.i2 = getelementptr %"struct.ResizeArray<char*>"* %tmp215.0, i32 0, i32 1 ; <%"struct.ResizeArrayRaw<char*>"**> [#uses=0]
+ br label %cond_true21
+}
diff --git a/test/Transforms/GVNPRE/basic.ll b/test/Transforms/GVNPRE/basic.ll
new file mode 100644
index 000000000000..b74687394ac7
--- /dev/null
+++ b/test/Transforms/GVNPRE/basic.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | not grep {%z3 =}
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | not grep {%z9 =}
+
+define i32 @main() {
+block1:
+ %z1 = bitcast i32 0 to i32 ; <i32> [#uses=5]
+ br label %block2
+
+block2: ; preds = %block6, %block1
+ %z2 = phi i32 [ %z1, %block1 ], [ %z3, %block6 ] ; <i32> [#uses=3]
+ %z3 = add i32 %z2, 1 ; <i32> [#uses=5]
+ br i1 false, label %block3, label %block7
+
+block3: ; preds = %block2
+ br i1 true, label %block4, label %block5
+
+block4: ; preds = %block3
+ %z4 = add i32 %z2, %z3 ; <i32> [#uses=1]
+ %z5 = bitcast i32 %z4 to i32 ; <i32> [#uses=1]
+ %z6 = add i32 %z1, %z5 ; <i32> [#uses=0]
+ br label %block6
+
+block5: ; preds = %block3
+ %z7 = add i32 %z3, 1 ; <i32> [#uses=1]
+ br label %block6
+
+block6: ; preds = %block5, %block4
+ %z8 = phi i32 [ %z1, %block4 ], [ %z7, %block5 ] ; <i32> [#uses=1]
+ %z9 = add i32 %z2, %z3 ; <i32> [#uses=2]
+ %z10 = add i32 %z9, %z8 ; <i32> [#uses=0]
+ %z11 = bitcast i32 12 to i32 ; <i32> [#uses=1]
+ %z12 = add i32 %z9, %z11 ; <i32> [#uses=1]
+ %z13 = add i32 %z12, %z3 ; <i32> [#uses=0]
+ br label %block2
+
+block7: ; preds = %block2
+ ret i32 %z1
+}
diff --git a/test/Transforms/GVNPRE/cast.ll b/test/Transforms/GVNPRE/cast.ll
new file mode 100644
index 000000000000..3536a14571fb
--- /dev/null
+++ b/test/Transforms/GVNPRE/cast.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep b.gvnpre
+
+define i32 @extract() {
+entry: ; preds = %cond_false, %entry
+ br i1 true, label %cond_true, label %cond_false
+
+cond_true:
+ br label %end
+
+cond_false:
+ %a = sext i16 0 to i32
+ br label %end
+
+end:
+ %b = sext i16 0 to i32
+ ret i32 %b
+}
diff --git a/test/Transforms/GVNPRE/dg.exp b/test/Transforms/GVNPRE/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/GVNPRE/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/GVNPRE/extractelement.ll b/test/Transforms/GVNPRE/extractelement.ll
new file mode 100644
index 000000000000..7d05c8f1d6f3
--- /dev/null
+++ b/test/Transforms/GVNPRE/extractelement.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep b.gvnpre
+
+define i32 @extract() {
+entry: ; preds = %cond_false, %entry
+ %foo = add <2 x i32> < i32 1, i32 1 >, < i32 1, i32 1 >
+ br i1 true, label %cond_true, label %cond_false
+
+cond_true:
+ br label %end
+
+cond_false:
+ %a = extractelement <2 x i32> %foo, i32 0
+ br label %end
+
+end:
+ %b = extractelement <2 x i32> %foo, i32 0
+ ret i32 %b
+}
diff --git a/test/Transforms/GVNPRE/gep.ll b/test/Transforms/GVNPRE/gep.ll
new file mode 100644
index 000000000000..34bc4c79ab12
--- /dev/null
+++ b/test/Transforms/GVNPRE/gep.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep b.gvnpre
+
+define i32 @extract({ i32 }* %P) {
+entry: ; preds = %cond_false, %entry
+ br i1 true, label %cond_true, label %cond_false
+
+cond_true:
+ br label %end
+
+cond_false:
+ %a = getelementptr { i32 }* %P, i32 0, i32 0
+ br label %end
+
+end:
+ %b = getelementptr { i32 }* %P, i32 0, i32 0
+ ret i32 0
+}
diff --git a/test/Transforms/GVNPRE/insertelement.ll b/test/Transforms/GVNPRE/insertelement.ll
new file mode 100644
index 000000000000..caf8474bba7d
--- /dev/null
+++ b/test/Transforms/GVNPRE/insertelement.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep b.gvnpre
+
+define i32 @extract() {
+entry: ; preds = %cond_false, %entry
+ %foo = add <2 x i32> < i32 1, i32 1 >, < i32 1, i32 1 >
+ br i1 true, label %cond_true, label %cond_false
+
+cond_true:
+ br label %end
+
+cond_false:
+ %a = insertelement <2 x i32> %foo, i32 0, i32 3
+ br label %end
+
+end:
+ %b = insertelement <2 x i32> %foo, i32 0, i32 3
+ ret i32 0
+}
diff --git a/test/Transforms/GVNPRE/select.ll b/test/Transforms/GVNPRE/select.ll
new file mode 100644
index 000000000000..c73c8579db5d
--- /dev/null
+++ b/test/Transforms/GVNPRE/select.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep b.gvnpre
+
+define i32 @extract() {
+entry: ; preds = %cond_false, %entry
+ br i1 true, label %cond_true, label %cond_false
+
+cond_true:
+ br label %end
+
+cond_false:
+ %a = select i1 true, i32 0, i32 1
+ br label %end
+
+end:
+ %b = select i1 true, i32 0, i32 1
+ ret i32 %b
+}
diff --git a/test/Transforms/GVNPRE/shufflevector.ll b/test/Transforms/GVNPRE/shufflevector.ll
new file mode 100644
index 000000000000..9fc35925322c
--- /dev/null
+++ b/test/Transforms/GVNPRE/shufflevector.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis | grep b.gvnpre
+
+define i32 @extract() {
+entry: ; preds = %cond_false, %entry
+ %foo = add <2 x i32> < i32 1, i32 1 >, < i32 1, i32 1 >
+ br i1 true, label %cond_true, label %cond_false
+
+cond_true:
+ br label %end
+
+cond_false:
+ %a = shufflevector <2 x i32> %foo, <2 x i32> undef, <2 x i32> < i32 0, i32 1 >
+ br label %end
+
+end:
+ %b = shufflevector <2 x i32> %foo, <2 x i32> undef, <2 x i32> < i32 0, i32 1 >
+ ret i32 0
+}
diff --git a/test/Transforms/GlobalDCE/2002-07-17-CastRef.ll b/test/Transforms/GlobalDCE/2002-07-17-CastRef.ll
new file mode 100644
index 000000000000..a79f6738f190
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2002-07-17-CastRef.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -globaldce
+;
+define internal void @func() {
+ ret void
+}
+
+define void @main() {
+ %X = bitcast void ()* @func to i32* ; <i32*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/GlobalDCE/2002-07-17-ConstantRef.ll b/test/Transforms/GlobalDCE/2002-07-17-ConstantRef.ll
new file mode 100644
index 000000000000..2a398468beec
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2002-07-17-ConstantRef.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -globaldce
+;
+
+@X = global void ()* @func ; <void ()**> [#uses=0]
+
+; Not dead, can be reachable via X
+define internal void @func() {
+ ret void
+}
+
+define void @main() {
+ ret void
+}
diff --git a/test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll b/test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll
new file mode 100644
index 000000000000..dac81a39990a
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll
@@ -0,0 +1,17 @@
+; Make sure that functions are removed successfully if they are referred to by
+; a global that is dead. Make sure any globals they refer to die as well.
+
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep foo
+
+;; Unused, kills %foo
+@b = internal global i32 ()* @foo ; <i32 ()**> [#uses=0]
+
+;; Should die when function %foo is killed
+@foo.upgrd.1 = internal global i32 7 ; <i32*> [#uses=1]
+
+ ;; dies when %b dies.
+define internal i32 @foo() {
+ %ret = load i32* @foo.upgrd.1 ; <i32> [#uses=1]
+ ret i32 %ret
+}
+
diff --git a/test/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll b/test/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll
new file mode 100644
index 000000000000..d07f0140c46c
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll
@@ -0,0 +1,12 @@
+; This testcase tests that a worklist is being used, and that globals can be
+; removed if they are the subject of a constexpr and ConstantPointerRef
+
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep global
+
+@t0 = internal global [4 x i8] c"foo\00" ; <[4 x i8]*> [#uses=1]
+@t1 = internal global [4 x i8] c"bar\00" ; <[4 x i8]*> [#uses=1]
+@s1 = internal global [1 x i8*] [ i8* getelementptr ([4 x i8]* @t0, i32 0, i32 0) ] ; <[1 x i8*]*> [#uses=0]
+@s2 = internal global [1 x i8*] [ i8* getelementptr ([4 x i8]* @t1, i64 0, i64 0) ] ; <[1 x i8*]*> [#uses=0]
+@b = internal global i32* @a ; <i32**> [#uses=0]
+@a = internal global i32 7 ; <i32*> [#uses=1]
+
diff --git a/test/Transforms/GlobalDCE/2002-09-12-Redeletion.ll b/test/Transforms/GlobalDCE/2002-09-12-Redeletion.ll
new file mode 100644
index 000000000000..b49bfcc49403
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2002-09-12-Redeletion.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -globaldce
+
+;; Should die when function %foo is killed
+@foo.upgrd.1 = internal global i32 7 ; <i32*> [#uses=3]
+@bar = internal global [2 x { i32*, i32 }] [ { i32*, i32 } { i32* @foo.upgrd.1, i32 7 }, { i32*, i32 } { i32* @foo.upgrd.1, i32 1 } ] ; <[2 x { i32*, i32 }]*> [#uses=0]
+
+define internal i32 @foo() {
+ %ret = load i32* @foo.upgrd.1 ; <i32> [#uses=1]
+ ret i32 %ret
+}
+
diff --git a/test/Transforms/GlobalDCE/2003-07-01-SelfReference.ll b/test/Transforms/GlobalDCE/2003-07-01-SelfReference.ll
new file mode 100644
index 000000000000..c6c51df94cf3
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2003-07-01-SelfReference.ll
@@ -0,0 +1,11 @@
+; distilled from 255.vortex
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep testfunc
+
+declare i1 ()* @getfunc()
+
+define internal i1 @testfunc() {
+ %F = call i1 ()* ()* @getfunc( ) ; <i1 ()*> [#uses=1]
+ %c = icmp eq i1 ()* %F, @testfunc ; <i1> [#uses=1]
+ ret i1 %c
+}
+
diff --git a/test/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll b/test/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll
new file mode 100644
index 000000000000..12d4736d2749
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2003-10-09-PreserveWeakGlobals.ll
@@ -0,0 +1,6 @@
+; Weak variables should be preserved by global DCE!
+
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | grep @A
+
+
+@A = weak global i32 54
diff --git a/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll b/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll
new file mode 100644
index 000000000000..264b81dca032
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep @D
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | grep @L | count 3
+
+@A = global i32 0
+@D = alias internal i32* @A
+@L1 = alias i32* @A
+@L2 = alias internal i32* @L1
+@L3 = alias i32* @L2
diff --git a/test/Transforms/GlobalDCE/2009-02-17-AliasUsesAliasee.ll b/test/Transforms/GlobalDCE/2009-02-17-AliasUsesAliasee.ll
new file mode 100644
index 000000000000..8c15c51a4e56
--- /dev/null
+++ b/test/Transforms/GlobalDCE/2009-02-17-AliasUsesAliasee.ll
@@ -0,0 +1,4 @@
+; RUN: llvm-as < %s | opt -globaldce
+
+@A = alias internal void ()* @F
+define internal void @F() { ret void }
diff --git a/test/Transforms/GlobalDCE/basicvariabletest.ll b/test/Transforms/GlobalDCE/basicvariabletest.ll
new file mode 100644
index 000000000000..c883e58b84ce
--- /dev/null
+++ b/test/Transforms/GlobalDCE/basicvariabletest.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep global
+
+@X = external global i32
+@Y = internal global i32 7
+
diff --git a/test/Transforms/GlobalDCE/dg.exp b/test/Transforms/GlobalDCE/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/GlobalDCE/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/GlobalDCE/externally_available.ll b/test/Transforms/GlobalDCE/externally_available.ll
new file mode 100644
index 000000000000..ccdf7e198fab
--- /dev/null
+++ b/test/Transforms/GlobalDCE/externally_available.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -globaldce | llvm-dis | not grep test_
+
+; test_function should not be emitted to the .s file.
+define available_externally i32 @test_function() {
+ ret i32 4
+}
+
+; test_global should not be emitted to the .s file.
+@test_global = available_externally global i32 4
+
diff --git a/test/Transforms/GlobalOpt/2004-10-10-CastStoreOnce.ll b/test/Transforms/GlobalOpt/2004-10-10-CastStoreOnce.ll
new file mode 100644
index 000000000000..5f784e065fb1
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2004-10-10-CastStoreOnce.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -globalopt
+
+@V = global float 1.200000e+01 ; <float*> [#uses=1]
+@G = internal global i32* null ; <i32**> [#uses=2]
+
+define i32 @user() {
+ %P = load i32** @G ; <i32*> [#uses=1]
+ %Q = load i32* %P ; <i32> [#uses=1]
+ ret i32 %Q
+}
+
+define void @setter() {
+ %Vi = bitcast float* @V to i32* ; <i32*> [#uses=1]
+ store i32* %Vi, i32** @G
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/2005-06-15-LocalizeConstExprCrash.ll b/test/Transforms/GlobalOpt/2005-06-15-LocalizeConstExprCrash.ll
new file mode 100644
index 000000000000..80f824392492
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2005-06-15-LocalizeConstExprCrash.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+; PR579
+
+@g_40507551 = internal global i16 31038 ; <i16*> [#uses=1]
+
+define void @main() {
+ %tmp.4.i.1 = load i8* getelementptr (i8* bitcast (i16* @g_40507551 to i8*), i32 1) ; <i8> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/2005-09-27-Crash.ll b/test/Transforms/GlobalOpt/2005-09-27-Crash.ll
new file mode 100644
index 000000000000..5eac431d9c64
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2005-09-27-Crash.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+ %RPyString = type { i32, %arraytype.Char }
+ %arraytype.Char = type { i32, [0 x i8] }
+ %arraytype.Signed = type { i32, [0 x i32] }
+ %functiontype.1 = type %RPyString* (i32)
+ %structtype.test = type { i32, %arraytype.Signed }
+@structinstance.test = internal global { i32, { i32, [2 x i32] } } { i32 41, { i32, [2 x i32] } { i32 2, [2 x i32] [ i32 100, i32 101 ] } } ; <{ i32, { i32, [2 x i32] } }*> [#uses=1]
+
+define fastcc void @pypy_array_constant() {
+block0:
+ %tmp.9 = getelementptr %structtype.test* bitcast ({ i32, { i32, [2 x i32] } }* @structinstance.test to %structtype.test*), i32 0, i32 0 ; <i32*> [#uses=0]
+ ret void
+}
+
+define fastcc void @new.varsizestruct.rpy_string() {
+ unreachable
+}
+
+define void @__entrypoint__pypy_array_constant() {
+ call fastcc void @pypy_array_constant( )
+ ret void
+}
+
+define void @__entrypoint__raised_LLVMException() {
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll b/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll
new file mode 100644
index 000000000000..5559ef18b5b8
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll
@@ -0,0 +1,135 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+; PR820
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct..0FileDescriptor = type { i32 }
+ %"struct.FlagDescription<int32>" = type { i8*, i32*, i1, i1, i32, i8* }
+ %"struct.FlagRegisterer<bool>" = type { i8 }
+ %struct.MutexLock = type { %struct..0FileDescriptor* }
+ %"struct.std::DisabledRangeMap" = type { %"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >" }
+ %"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >" = type { %"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >::_Rb_tree_impl<StringCmp,false>" }
+ %"struct.std::_Rb_tree<const char*,std::pair<const char* const, FlagDescription<bool> >,std::_Select1st<std::pair<const char* const, FlagDescription<bool> > >,StringCmp,std::allocator<std::pair<const char* const, FlagDescription<bool> > > >::_Rb_tree_impl<StringCmp,false>" = type { %"struct.FlagRegisterer<bool>", %"struct.std::_Rb_tree_node_base", i32 }
+ %"struct.std::_Rb_tree_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { %"struct.std::_Rb_tree_node_base"* }
+ %"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
+ %"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" }
+ %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* }
+ %"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" }
+@registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0]
+@_ZN61FLAG__foo_int32_44FLAGS_E = external global %"struct.FlagRegisterer<bool>" ; <%"struct.FlagRegisterer<bool>"*> [#uses=0]
+@llvm.global_ctors = appending global [20 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN7ScannerC2Ev }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z11StripStringPSsPKcc }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_ }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN8Hasher325ResetEj }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z25ACLRv }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_eventbuf }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__checker_bcad_variable } ] ; <[20 x { i32, void ()* }]*> [#uses=0]
+
+declare void @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E()
+
+declare void @_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E()
+
+declare void @_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv()
+
+declare void @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E()
+
+declare void @_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E()
+
+define void @_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE() {
+entry:
+ call void @_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E( )
+ ret void
+}
+
+define void @_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E() {
+entry:
+ call void @_ZN9MutexLockC1EP5Mutex( )
+ ret void
+}
+
+declare void @_GLOBAL__I__ZN7ScannerC2Ev()
+
+declare void @_GLOBAL__I__Z11StripStringPSsPKcc()
+
+define void @_ZNSt6vectorIiSaIiEEC1ERKS0_() {
+entry:
+ unreachable
+}
+
+declare void @_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_()
+
+declare void @_GLOBAL__I__ZN8Hasher325ResetEj()
+
+declare void @_GLOBAL__I__Z25ACLRv()
+
+define void @_ZN9MutexLockC1EP5Mutex() {
+entry:
+ call void @_ZN5Mutex4LockEv( )
+ ret void
+}
+
+define void @_ZN5Mutex4LockEv() {
+entry:
+ call void @_Z22Acquire_CASPViii( )
+ ret void
+}
+
+define void @_ZNSt3mapIPKc15FlagDescriptionIiE9StringCmpSaISt4pairIKS1_S3_EEE3endEv(%"struct.std::_Rb_tree_const_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >"* sret %agg.result) {
+entry:
+ unreachable
+}
+
+declare void @_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E()
+
+define void @_Z14CASPViii() {
+entry:
+ %tmp3 = call i32 asm sideeffect "lock; cmpxchg $1,$2", "={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( i32 0, i32* null, i32 0 ) ; <i32> [#uses=0]
+ unreachable
+}
+
+declare void @_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E()
+
+declare void @_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E()
+
+define void @_Z22Acquire_CASPViii() {
+entry:
+ call void @_Z14CASPViii( )
+ unreachable
+}
+
+declare void @_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E()
+
+declare void @_GLOBAL__I_eventbuf()
+
+define void @_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E() {
+entry:
+ call void @_Z41__static_initialization_and_destruction_0ii1662( i32 1, i32 65535 )
+ ret void
+}
+
+define void @_Z41__static_initialization_and_destruction_0ii1662(i32 %__initialize_p, i32 %__priority) {
+entry:
+ %__initialize_p_addr = alloca i32 ; <i32*> [#uses=2]
+ %__priority_addr = alloca i32 ; <i32*> [#uses=2]
+ store i32 %__initialize_p, i32* %__initialize_p_addr
+ store i32 %__priority, i32* %__priority_addr
+ %tmp = load i32* %__priority_addr ; <i32> [#uses=1]
+ %tmp.upgrd.1 = icmp eq i32 %tmp, 65535 ; <i1> [#uses=1]
+ br i1 %tmp.upgrd.1, label %cond_true, label %cond_next14
+
+cond_true: ; preds = %entry
+ %tmp8 = load i32* %__initialize_p_addr ; <i32> [#uses=1]
+ %tmp9 = icmp eq i32 %tmp8, 1 ; <i1> [#uses=1]
+ br i1 %tmp9, label %cond_true10, label %cond_next14
+
+cond_true10: ; preds = %cond_true
+ call void @_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE( )
+ ret void
+
+cond_next14: ; preds = %cond_true, %entry
+ ret void
+}
+
+declare void @_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E()
+
+define void @_ZN9__gnu_cxx13new_allocatorIPNS_15_Hashtable_nodeIjEEEC2Ev() {
+entry:
+ unreachable
+}
+
+declare void @_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE()
+
+declare void @_GLOBAL__I__checker_bcad_variable()
diff --git a/test/Transforms/GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll b/test/Transforms/GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll
new file mode 100644
index 000000000000..39be6c40413b
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+
+ %struct._list = type { i32*, %struct._list* }
+ %struct._play = type { i32, i32*, %struct._list*, %struct._play* }
+@nrow = internal global i32 0 ; <i32*> [#uses=2]
+
+define void @make_play() {
+entry:
+ br label %cond_true16.i
+
+cond_true16.i: ; preds = %cond_true16.i, %entry
+ %low.0.in.i.0 = phi i32* [ @nrow, %entry ], [ null, %cond_true16.i ] ; <i32*> [#uses=1]
+ %low.0.i = load i32* %low.0.in.i.0 ; <i32> [#uses=0]
+ br label %cond_true16.i
+}
+
+define void @make_wanted() {
+entry:
+ unreachable
+}
+
+define void @get_good_move() {
+entry:
+ ret void
+}
+
+define void @main() {
+entry:
+ store i32 8, i32* @nrow
+ tail call void @make_play( )
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/2007-04-05-Crash.ll b/test/Transforms/GlobalOpt/2007-04-05-Crash.ll
new file mode 100644
index 000000000000..1991d90b8fa6
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2007-04-05-Crash.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32"
+target triple = "thumb-apple-darwin8"
+@replacementUnichar = internal global i16 -3 ; <i16*> [#uses=2]
+@"L_OBJC_IMAGE_INFO" = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=1]
+@llvm.used = appending global [1 x i8*] [ i8* bitcast ([2 x i32]* @"L_OBJC_IMAGE_INFO" to i8*) ] ; <[1 x i8*]*> [#uses=0]
+
+define i16 @__NSCharToUnicharCFWrapper(i8 zeroext %ch) zeroext {
+entry:
+ %iftmp.0.0.in.in = select i1 false, i16* @replacementUnichar, i16* null ; <i16*> [#uses=1]
+ %iftmp.0.0.in = load i16* %iftmp.0.0.in.in ; <i16> [#uses=1]
+ ret i16 %iftmp.0.0.in
+}
+
+define void @__NSASCIICharToUnichar() {
+entry:
+ ret void
+}
+
+define void @_NSDefaultCStringEncoding() {
+entry:
+ call void @__NSSetCStringCharToUnichar( )
+ br i1 false, label %cond_true6, label %cond_next8
+
+cond_true6: ; preds = %entry
+ store i16 -2, i16* @replacementUnichar
+ ret void
+
+cond_next8: ; preds = %entry
+ ret void
+}
+
+declare void @__NSSetCStringCharToUnichar()
diff --git a/test/Transforms/GlobalOpt/2007-05-13-Crash.ll b/test/Transforms/GlobalOpt/2007-05-13-Crash.ll
new file mode 100644
index 000000000000..22fee779338c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2007-05-13-Crash.ll
@@ -0,0 +1,74 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+ %struct.SFLMutableListItem = type { i16 }
+ %struct.__CFDictionary = type opaque
+ %struct.__CFString = type opaque
+ %struct.__builtin_CFString = type { i32*, i32, i8*, i32 }
+@_ZZ19SFLGetVisibilityKeyvE19_kSFLLVisibilityKey = internal global %struct.__CFString* null ; <%struct.__CFString**> [#uses=2]
+@_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey = internal global %struct.__CFString* null ; <%struct.__CFString**> [#uses=7]
+internal constant %struct.__builtin_CFString {
+ i32* getelementptr ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0),
+ i32 1992,
+ i8* getelementptr ([14 x i8]* @.str, i32 0, i32 0),
+ i32 13 }, section "__DATA,__cfstring" ; <%struct.__builtin_CFString*>:0 [#uses=1]
+@__CFConstantStringClassReference = external global [0 x i32] ; <[0 x i32]*> [#uses=1]
+@.str = internal constant [14 x i8] c"AlwaysVisible\00" ; <[14 x i8]*> [#uses=1]
+@_ZZ21SFLGetNeverVisibleKeyvE21_kSFLLNeverVisibleKey = internal global %struct.__CFString* null ; <%struct.__CFString**> [#uses=2]
+
+define %struct.__CFString* @_Z19SFLGetVisibilityKeyv() {
+entry:
+ %tmp1 = load %struct.__CFString** @_ZZ19SFLGetVisibilityKeyvE19_kSFLLVisibilityKey ; <%struct.__CFString*> [#uses=1]
+ ret %struct.__CFString* %tmp1
+}
+
+define %struct.__CFString* @_Z22SFLGetAlwaysVisibleKeyv() {
+entry:
+ %tmp1 = load %struct.__CFString** @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey ; <%struct.__CFString*> [#uses=1]
+ %tmp2 = icmp eq %struct.__CFString* %tmp1, null ; <i1> [#uses=1]
+ br i1 %tmp2, label %cond_true, label %cond_next
+
+cond_true: ; preds = %entry
+ store %struct.__CFString* bitcast (%struct.__builtin_CFString* @0 to %struct.__CFString*), %struct.__CFString** @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey
+ br label %cond_next
+
+cond_next: ; preds = %entry, %cond_true
+ %tmp4 = load %struct.__CFString** @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey ; <%struct.__CFString*> [#uses=1]
+ ret %struct.__CFString* %tmp4
+}
+
+define %struct.__CFString* @_Z21SFLGetNeverVisibleKeyv() {
+entry:
+ %tmp1 = load %struct.__CFString** @_ZZ21SFLGetNeverVisibleKeyvE21_kSFLLNeverVisibleKey ; <%struct.__CFString*> [#uses=1]
+ ret %struct.__CFString* %tmp1
+}
+
+define %struct.__CFDictionary* @_ZN18SFLMutableListItem18GetPrefsDictionaryEv(%struct.SFLMutableListItem* %this) {
+entry:
+ %tmp4 = getelementptr %struct.SFLMutableListItem* %this, i32 0, i32 0 ; <i16*> [#uses=1]
+ %tmp5 = load i16* %tmp4 ; <i16> [#uses=1]
+ %tmp6 = icmp eq i16 %tmp5, 0 ; <i1> [#uses=1]
+ br i1 %tmp6, label %cond_next22, label %cond_true
+
+cond_true: ; preds = %entry
+ %tmp9 = load %struct.__CFString** @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey ; <%struct.__CFString*> [#uses=1]
+ %tmp10 = icmp eq %struct.__CFString* %tmp9, null ; <i1> [#uses=1]
+ br i1 %tmp10, label %cond_true13, label %cond_next22
+
+cond_true13: ; preds = %cond_true
+ store %struct.__CFString* bitcast (%struct.__builtin_CFString* @0 to %struct.__CFString*), %struct.__CFString** @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey
+ br label %cond_next22
+
+cond_next22: ; preds = %entry, %cond_true13, %cond_true
+ %iftmp.1.0.in = phi %struct.__CFString** [ @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey, %cond_true ], [ @_ZZ22SFLGetAlwaysVisibleKeyvE22_kSFLLAlwaysVisibleKey, %cond_true13 ], [ @_ZZ21SFLGetNeverVisibleKeyvE21_kSFLLNeverVisibleKey, %entry ] ; <%struct.__CFString**> [#uses=1]
+ %iftmp.1.0 = load %struct.__CFString** %iftmp.1.0.in ; <%struct.__CFString*> [#uses=1]
+ %tmp24 = load %struct.__CFString** @_ZZ19SFLGetVisibilityKeyvE19_kSFLLVisibilityKey ; <%struct.__CFString*> [#uses=1]
+ %tmp2728 = bitcast %struct.__CFString* %tmp24 to i8* ; <i8*> [#uses=1]
+ %tmp2930 = bitcast %struct.__CFString* %iftmp.1.0 to i8* ; <i8*> [#uses=1]
+ call void @_Z20CFDictionaryAddValuePKvS0_( i8* %tmp2728, i8* %tmp2930 )
+ ret %struct.__CFDictionary* undef
+}
+
+declare void @_Z20CFDictionaryAddValuePKvS0_(i8*, i8*)
+
diff --git a/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll b/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll
new file mode 100644
index 000000000000..7394f047f4fe
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+; PR1491
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+ %"struct.__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const int, int> > >" = type <{ i8 }>
+ %"struct.std::_Rb_tree<int,std::pair<const int, int>,std::_Select1st<std::pair<const int, int> >,std::less<int>,std::allocator<std::pair<const int, int> > >" = type { %"struct.std::_Rb_tree<int,std::pair<const int, int>,std::_Select1st<std::pair<const int, int> >,std::less<int>,std::allocator<std::pair<const int, int> > >::_Rb_tree_impl<std::less<int>,false>" }
+ %"struct.std::_Rb_tree<int,std::pair<const int, int>,std::_Select1st<std::pair<const int, int> >,std::less<int>,std::allocator<std::pair<const int, int> > >::_Rb_tree_impl<std::less<int>,false>" = type { %"struct.__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const int, int> > >", %"struct.std::_Rb_tree_node_base", i32 }
+ %"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
+ %"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >" = type { %"struct.std::_Rb_tree<int,std::pair<const int, int>,std::_Select1st<std::pair<const int, int> >,std::less<int>,std::allocator<std::pair<const int, int> > >" }
+@someMap = global %"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >" zeroinitializer ; <%"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >"*> [#uses=1]
+@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_someMap } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
+@llvm.global_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__D_someMap } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
+
+define void @_GLOBAL__I_someMap() {
+entry:
+ call void @_Z41__static_initialization_and_destruction_0ii( i32 1, i32 65535 )
+ ret void
+}
+
+declare void @_GLOBAL__D_someMap()
+
+define void @_Z41__static_initialization_and_destruction_0ii(i32 %__initialize_p, i32 %__priority) {
+entry:
+ %tmp1 = icmp eq i32 %__priority, 65535 ; <i1> [#uses=1]
+ %tmp4 = icmp eq i32 %__initialize_p, 1 ; <i1> [#uses=1]
+ %tmp7 = and i1 %tmp1, %tmp4 ; <i1> [#uses=1]
+ br i1 %tmp7, label %cond_true, label %cond_next
+
+cond_true: ; preds = %entry
+ store i8 0, i8* getelementptr (%"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >"* @someMap, i32 0, i32 0, i32 0, i32 0, i32 0)
+ ret void
+
+cond_next: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll b/test/Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll
new file mode 100644
index 000000000000..0d7d0364029d
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -globalopt -disable-output
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin8"
+ %struct.empty0 = type { }
+ %struct.es = type { %struct.empty0 }
+ %struct.es1 = type { %struct.empty0 }
+@aaui1 = internal global [6 x [2 x i32]] [ [2 x i32] [ i32 1, i32 1 ], [2 x i32] [ i32 1, i32 1 ], [2 x i32] [ i32 1, i32 1 ], [2 x i32] [ i32 1, i32 1 ], [2 x i32] [ i32 1, i32 1 ], [2 x i32] [ i32 1, i32 1 ] ] ; <[6 x [2 x i32]]*> [#uses=1]
+@aaui0 = internal global [0 x [2 x i32]] zeroinitializer ; <[0 x [2 x i32]]*> [#uses=1]
+
+define i8 @func() {
+entry:
+ %tmp10 = getelementptr [2 x i32]* getelementptr ([6 x [2 x i32]]* @aaui1, i32 0, i32 0), i32 5, i32 1 ; <i32*> [#uses=1]
+ %tmp11 = load i32* %tmp10, align 4 ; <i32> [#uses=1]
+ %tmp12 = call i32 (...)* @func3( i32* null, i32 0, i32 %tmp11 ) ; <i32> [#uses=0]
+ ret i8 undef
+}
+
+declare i32 @func3(...)
+
diff --git a/test/Transforms/GlobalOpt/2008-01-03-Crash.ll b/test/Transforms/GlobalOpt/2008-01-03-Crash.ll
new file mode 100644
index 000000000000..3d8c77db4f36
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-01-03-Crash.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis
+; PR1896
+
+@indirect1 = internal global void (i32)* null ; <void (i32)**> [#uses=2]
+
+declare void @indirectmarked(i32)
+
+define i32 @main() {
+entry:
+ br i1 false, label %cond_next20.i, label %cond_true.i9
+
+cond_true.i9: ; preds = %entry
+ ret i32 0
+
+cond_next20.i: ; preds = %entry
+ store void (i32)* @indirectmarked, void (i32)** @indirect1, align 4
+ br i1 false, label %cond_next21.i.i23.i, label %stack_restore
+
+stack_restore: ; preds = %cond_next20.i
+ ret i32 0
+
+cond_next21.i.i23.i: ; preds = %cond_next20.i
+ %tmp6.i4.i = load i32* bitcast (void (i32)** @indirect1 to i32*), align 4 ; <i32> [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll b/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll
new file mode 100644
index 000000000000..aace34654976
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-01-13-OutOfRangeSROA.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {16 x .31 x double.. zeroinitializer}
+
+; The 'X' indices could be larger than 31. Do not SROA the outer indices of this array.
+@mm = internal global [16 x [31 x double]] zeroinitializer, align 32
+
+define void @test(i32 %X) {
+ %P = getelementptr [16 x [31 x double]]* @mm, i32 0, i32 0, i32 %X
+ store double 1.0, double* %P
+ ret void
+}
+
+define double @get(i32 %X) {
+ %P = getelementptr [16 x [31 x double]]* @mm, i32 0, i32 0, i32 %X
+ %V = load double* %P
+ ret double %V
+}
diff --git a/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll b/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll
new file mode 100644
index 000000000000..0a8dd499c656
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-01-29-VolatileGlobal.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {volatile load}
+@t0.1441 = internal global double 0x3FD5555555555555, align 8 ; <double*> [#uses=1]
+
+define double @foo() nounwind {
+entry:
+ %tmp1 = volatile load double* @t0.1441, align 8 ; <double> [#uses=2]
+ %tmp4 = mul double %tmp1, %tmp1 ; <double> [#uses=1]
+ ret double %tmp4
+}
diff --git a/test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll b/test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
new file mode 100644
index 000000000000..59996c5a98bc
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
@@ -0,0 +1,57 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep { nest } | count 1
+ %struct.FRAME.nest = type { i32, i32 (i32)* }
+ %struct.__builtin_trampoline = type { [10 x i8] }
+@.str = internal constant [7 x i8] c"%d %d\0A\00" ; <[7 x i8]*> [#uses=1]
+
+define i32 @process(i32 (i32)* %func) nounwind {
+entry:
+ %tmp2 = tail call i32 %func( i32 1 ) nounwind ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define internal fastcc i32 @g.1478(%struct.FRAME.nest* nest %CHAIN.1, i32 %m) nounwind {
+entry:
+ %tmp3 = getelementptr %struct.FRAME.nest* %CHAIN.1, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp4 = load i32* %tmp3, align 4 ; <i32> [#uses=1]
+ %tmp7 = icmp eq i32 %tmp4, %m ; <i1> [#uses=1]
+ %tmp78 = zext i1 %tmp7 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp78
+}
+
+define internal i32 @f.1481(%struct.FRAME.nest* nest %CHAIN.2, i32 %m) nounwind {
+entry:
+ %tmp4 = tail call fastcc i32 @g.1478( %struct.FRAME.nest* nest %CHAIN.2, i32 %m ) nounwind ; <i32> [#uses=1]
+ %tmp6 = getelementptr %struct.FRAME.nest* %CHAIN.2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp7 = load i32* %tmp6, align 4 ; <i32> [#uses=1]
+ %tmp9 = icmp eq i32 %tmp4, %tmp7 ; <i1> [#uses=1]
+ %tmp910 = zext i1 %tmp9 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp910
+}
+
+define i32 @nest(i32 %n) nounwind {
+entry:
+ %TRAMP.316 = alloca [10 x i8] ; <[10 x i8]*> [#uses=1]
+ %FRAME.0 = alloca %struct.FRAME.nest ; <%struct.FRAME.nest*> [#uses=3]
+ %TRAMP.316.sub = getelementptr [10 x i8]* %TRAMP.316, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %n, i32* %tmp3, align 8
+ %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1]
+ %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.316.sub, i8* bitcast (i32 (%struct.FRAME.nest*, i32)* @f.1481 to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
+ %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1]
+ %tmp89 = bitcast i8* %tramp to i32 (i32)* ; <i32 (i32)*> [#uses=2]
+ store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 4
+ %tmp13 = call i32 @process( i32 (i32)* %tmp89 ) nounwind ; <i32> [#uses=1]
+ ret i32 %tmp13
+}
+
+declare i8* @llvm.init.trampoline(i8*, i8*, i8*) nounwind
+
+define i32 @main() nounwind {
+entry:
+ %tmp = tail call i32 @nest( i32 2 ) nounwind ; <i32> [#uses=1]
+ %tmp1 = tail call i32 @nest( i32 1 ) nounwind ; <i32> [#uses=1]
+ %tmp3 = tail call i32 (i8*, ...)* @printf( i8* noalias getelementptr ([7 x i8]* @.str, i32 0, i32 0), i32 %tmp1, i32 %tmp ) nounwind ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll b/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll
new file mode 100644
index 000000000000..3464be901844
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll
@@ -0,0 +1,32 @@
+; Verify that when @G is SROA'd that the new globals have correct
+; alignments. Elements 0 and 2 must be 16-byte aligned, and element
+; 1 must be at least 8 byte aligned (but could be more).
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@G.0 = internal global .*align 16}
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@G.1 = internal global .*align 8}
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@G.2 = internal global .*align 16}
+; rdar://5891920
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+
+%T = type { double, double, double }
+
+@G = internal global %T zeroinitializer, align 16
+
+
+define void @test() {
+ store double 1.0, double* getelementptr (%T* @G, i32 0, i32 0), align 16
+ store double 2.0, double* getelementptr (%T* @G, i32 0, i32 1), align 8
+ store double 3.0, double* getelementptr (%T* @G, i32 0, i32 2), align 16
+ ret void
+}
+
+define double @test2() {
+ %V1 = load double* getelementptr (%T* @G, i32 0, i32 0), align 16
+ %V2 = load double* getelementptr (%T* @G, i32 0, i32 1), align 8
+ %V3 = load double* getelementptr (%T* @G, i32 0, i32 2), align 16
+ %R = add double %V1, %V2
+ %R2 = add double %R, %V3
+ ret double %R2
+}
diff --git a/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll b/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll
new file mode 100644
index 000000000000..735a84d6fcb5
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-07-17-addrspace.ll
@@ -0,0 +1,28 @@
+; This test lets globalopt split the global struct and array into different
+; values. This used to crash, because globalopt forgot to put the new var in the
+; same address space as the old one.
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis > %t
+; Check that the new global values still have their address space
+; RUN: cat %t | grep global.*addrspace
+
+@struct = internal addrspace(1) global { i32, i32 } zeroinitializer
+@array = internal addrspace(1) global [ 2 x i32 ] zeroinitializer
+
+define i32 @foo() {
+ %A = load i32 addrspace(1) * getelementptr ({ i32, i32 } addrspace(1) * @struct, i32 0, i32 0)
+ %B = load i32 addrspace(1) * getelementptr ([ 2 x i32 ] addrspace(1) * @array, i32 0, i32 0)
+ ; Use the loaded values, so they won't get removed completely
+ %R = add i32 %A, %B
+ ret i32 %R
+}
+
+; We put stores in a different function, so that the global variables won't get
+; optimized away completely.
+define void @bar(i32 %R) {
+ store i32 %R, i32 addrspace(1) * getelementptr ([ 2 x i32 ] addrspace(1) * @array, i32 0, i32 0)
+ store i32 %R, i32 addrspace(1) * getelementptr ({ i32, i32 } addrspace(1) * @struct, i32 0, i32 0)
+ ret void
+}
+
+
diff --git a/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll
new file mode 100644
index 000000000000..cdc27714c79c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct.foo = type { i32, i32 }
+@X = internal global %struct.foo* null ; <%struct.foo**> [#uses=2]
+
+define void @bar(i32 %Size) nounwind noinline {
+entry:
+ %tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1]
+ %.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
+ store %struct.foo* %.sub, %struct.foo** @X, align 4
+ ret void
+}
+
+define i32 @baz() nounwind readonly noinline {
+bb1.thread:
+ %tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=2]
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %tmp = phi %struct.foo* [ %tmpLD1, %bb1.thread ], [ %tmpLD1, %bb1 ] ; <%struct.foo*> [#uses=1]
+ %0 = getelementptr %struct.foo* %tmp, i32 1 ; <%struct.foo*> [#uses=0]
+ br label %bb1
+}
diff --git a/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll
new file mode 100644
index 000000000000..f284840802e7
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct.foo = type { i32, i32 }
+@X = internal global %struct.foo* null ; <%struct.foo**> [#uses=2]
+
+define void @bar(i32 %Size) nounwind noinline {
+entry:
+ %tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1]
+ %.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
+ store %struct.foo* %.sub, %struct.foo** @X, align 4
+ ret void
+}
+
+define i32 @baz() nounwind readonly noinline {
+bb1.thread:
+ %tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=3]
+ store %struct.foo* %tmpLD1, %struct.foo** null
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %tmp = phi %struct.foo* [ %tmpLD1, %bb1.thread ], [ %tmpLD1, %bb1 ] ; <%struct.foo*> [#uses=0]
+ br i1 false, label %bb2, label %bb1
+
+bb2: ; preds = %bb1
+ ret i32 0
+}
diff --git a/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll b/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll
new file mode 100644
index 000000000000..03ec3b6a5255
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-01-13-phi-user.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {phi.*@head}
+; PR3321
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.node = type { %struct.node*, i32 }
+@head = internal global %struct.node* null ; <%struct.node**> [#uses=2]
+@node = internal global %struct.node { %struct.node* null, i32 42 }, align 16 ; <%struct.node*> [#uses=1]
+
+define i32 @f() nounwind {
+entry:
+ store %struct.node* @node, %struct.node** @head, align 8
+ br label %bb1
+
+bb: ; preds = %bb1
+ %0 = getelementptr %struct.node* %t.0, i64 0, i32 1 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ %2 = getelementptr %struct.node* %t.0, i64 0, i32 0 ; <%struct.node**> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %value.0 = phi i32 [ undef, %entry ], [ %1, %bb ] ; <i32> [#uses=1]
+ %t.0.in = phi %struct.node** [ @head, %entry ], [ %2, %bb ] ; <%struct.node**> [#uses=1]
+ %t.0 = load %struct.node** %t.0.in ; <%struct.node*> [#uses=3]
+ %3 = icmp eq %struct.node* %t.0, null ; <i1> [#uses=1]
+ br i1 %3, label %bb2, label %bb
+
+bb2: ; preds = %bb1
+ ret i32 %value.0
+}
+
+define i32 @main() nounwind {
+entry:
+ %0 = call i32 @f() nounwind ; <i32> [#uses=1]
+ ret i32 %0
+}
diff --git a/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll b/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
new file mode 100644
index 000000000000..e59c8df55700
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -globalopt
+
+@g = external global i32
+
+@a = alias bitcast (i32* @g to i8*)
+
+define void @f() {
+ %tmp = load i8* @a
+ ret void
+}
diff --git a/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll b/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll
new file mode 100644
index 000000000000..f042e59c19d4
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-02-15-ResolveAlias.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {define void @a}
+
+define internal void @f() {
+ ret void
+}
+
+@a = alias void ()* @f
+
+define void @g() {
+ call void()* @a()
+ ret void
+}
diff --git a/test/Transforms/GlobalOpt/2009-03-03-dbg.ll b/test/Transforms/GlobalOpt/2009-03-03-dbg.ll
new file mode 100644
index 000000000000..1996f621912b
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-03-03-dbg.ll
@@ -0,0 +1,54 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global_variable42
+; XFAIL: *
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.subrange.type = type { i32, i64, i64 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str2 = internal constant [57 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 2099)\00", section "llvm.metadata" ; <[57 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([57 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1]
+@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str4 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str5 = internal constant [6 x i8] c"i_ptr\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([6 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0]
+@sillyArray.1433 = internal global [8 x i32] [ i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19 ] ; <[8 x i32]*> [#uses=1]
+@llvm.dbg.subrange = internal constant %llvm.dbg.subrange.type { i32 458785, i64 0, i64 7 }, section "llvm.metadata" ; <%llvm.dbg.subrange.type*> [#uses=1]
+@llvm.dbg.array6 = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.subrange.type* @llvm.dbg.subrange to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1]
+@llvm.dbg.composite7 = internal constant %llvm.dbg.composite.type { i32 458753, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 256, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast ([1 x { }*]* @llvm.dbg.array6 to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str8 = internal constant [16 x i8] c"sillyArray.1433\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str9 = internal constant [11 x i8] c"sillyArray\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.global_variable42 = internal constant %llvm.dbg.global_variable.type { i32 458804, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([16 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str9, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite7 to { }*), i1 true, i1 true, { }* bitcast ([8 x i32]* @sillyArray.1433 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0]
+
+define i32 @main() nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ ret i32 0
+}
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
diff --git a/test/Transforms/GlobalOpt/2009-03-05-dbg.ll b/test/Transforms/GlobalOpt/2009-03-05-dbg.ll
new file mode 100644
index 000000000000..30e9a63f3b46
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-03-05-dbg.ll
@@ -0,0 +1,67 @@
+; RUN: llvm-as < %s | opt -globalopt -stats -disable-output |& grep "1 globalopt - Number of global vars shrunk to booleans"
+; XFAIL: *
+
+ type { } ; type %0
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
+ %llvm.dbg.composite.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0*, %0*, i32 }
+ %llvm.dbg.global_variable.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1, %0* }
+ %llvm.dbg.subprogram.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, %0*, i8*, %0*, i32, %0* }
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str = internal constant [5 x i8] c"gs.c\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 1, i8* getelementptr ([5 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str4 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 4, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str5 = internal constant [2 x i8] c"i\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 4, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@Stop = internal global i32 0 ; <i32*> [#uses=4]
+@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str6 = internal constant [5 x i8] c"Stop\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 2, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), i1 true, i1 true, %0* bitcast (i32* @Stop to %0*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0]
+
+define i32 @foo(i32 %i) nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*))
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = load i32* @Stop, align 4 ; <i32> [#uses=1]
+ %1 = icmp eq i32 %0, 1 ; <i1> [#uses=1]
+ br i1 %1, label %bb, label %bb1
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ store i32 0, i32* @Stop, align 4
+ call void @llvm.dbg.stoppoint(i32 7, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %2 = mul i32 %i, 42 ; <i32> [#uses=1]
+ br label %bb2
+
+bb1: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 9, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ store i32 1, i32* @Stop, align 4
+ call void @llvm.dbg.stoppoint(i32 10, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %.0 = phi i32 [ %i, %bb1 ], [ %2, %bb ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 10, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.stoppoint(i32 10, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*))
+ ret i32 %.0
+}
+
+declare void @llvm.dbg.func.start(%0*) nounwind readnone
+
+declare void @llvm.dbg.declare(%0*, %0*) nounwind readnone
+
+declare void @llvm.dbg.stoppoint(i32, i32, %0*) nounwind readnone
+
+declare void @llvm.dbg.region.end(%0*) nounwind readnone
diff --git a/test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll b/test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll
new file mode 100644
index 000000000000..ea13d293d5fa
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep internal | count 2
+
+global i32 0
+define i32* @1() {
+ ret i32* @0
+}
+define i32* @f() {
+entry:
+ call i32* @1()
+ ret i32* %0
+}
diff --git a/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll b/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll
new file mode 100644
index 000000000000..8dba5b1c213c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-03-07-PromotePtrToBool.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@X = internal global i32}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+@X = internal global i32* null ; <i32**> [#uses=2]
+@Y = internal global i32 0 ; <i32*> [#uses=1]
+
+define void @foo() nounwind {
+entry:
+ store i32* @Y, i32** @X, align 4
+ ret void
+}
+
+define i32* @get() nounwind {
+entry:
+ %0 = load i32** @X, align 4 ; <i32*> [#uses=1]
+ ret i32* %0
+}
diff --git a/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll b/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
new file mode 100644
index 000000000000..0ce16ddb9e2b
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-06-01-RecursivePHI.ll
@@ -0,0 +1,117 @@
+; RUN: llvm-as < %s | opt -globalopt
+
+ %struct.s_annealing_sched = type { i32, float, float, float, float }
+ %struct.s_bb = type { i32, i32, i32, i32 }
+ %struct.s_net = type { i8*, i32, i32*, float, float }
+ %struct.s_placer_opts = type { i32, float, i32, i32, i8*, i32, i32 }
+@net = internal global %struct.s_net* null ; <%struct.s_net**> [#uses=4]
+
+define fastcc void @alloc_and_load_placement_structs(i32 %place_cost_type, i32 %num_regions, float %place_cost_exp, float*** nocapture %old_region_occ_x, float*** nocapture %old_region_occ_y) nounwind ssp {
+entry:
+ br i1 undef, label %bb.i, label %my_malloc.exit
+
+bb.i: ; preds = %entry
+ unreachable
+
+my_malloc.exit: ; preds = %entry
+ br i1 undef, label %bb.i81, label %my_malloc.exit83
+
+bb.i81: ; preds = %my_malloc.exit
+ unreachable
+
+my_malloc.exit83: ; preds = %my_malloc.exit
+ br i1 undef, label %bb.i.i57, label %my_calloc.exit.i
+
+bb.i.i57: ; preds = %my_malloc.exit83
+ unreachable
+
+my_calloc.exit.i: ; preds = %my_malloc.exit83
+ br i1 undef, label %bb.i4.i, label %my_calloc.exit5.i
+
+bb.i4.i: ; preds = %my_calloc.exit.i
+ unreachable
+
+my_calloc.exit5.i: ; preds = %my_calloc.exit.i
+ %.pre.i58 = load %struct.s_net** @net, align 4 ; <%struct.s_net*> [#uses=1]
+ br label %bb17.i78
+
+bb1.i61: ; preds = %bb4.preheader.i, %bb1.i61
+ br i1 undef, label %bb1.i61, label %bb5.i62
+
+bb5.i62: ; preds = %bb1.i61
+ br i1 undef, label %bb6.i64, label %bb15.preheader.i
+
+bb15.preheader.i: ; preds = %bb4.preheader.i, %bb5.i62
+ br label %bb16.i77
+
+bb6.i64: ; preds = %bb5.i62
+ br i1 undef, label %bb7.i65, label %bb8.i67
+
+bb7.i65: ; preds = %bb6.i64
+ unreachable
+
+bb8.i67: ; preds = %bb6.i64
+ br i1 undef, label %bb.i1.i68, label %my_malloc.exit.i70
+
+bb.i1.i68: ; preds = %bb8.i67
+ unreachable
+
+my_malloc.exit.i70: ; preds = %bb8.i67
+ %0 = load %struct.s_net** @net, align 4 ; <%struct.s_net*> [#uses=1]
+ br i1 undef, label %bb9.i71, label %bb16.i77
+
+bb9.i71: ; preds = %bb9.i71, %my_malloc.exit.i70
+ %1 = load %struct.s_net** @net, align 4 ; <%struct.s_net*> [#uses=1]
+ br i1 undef, label %bb9.i71, label %bb16.i77
+
+bb16.i77: ; preds = %bb9.i71, %my_malloc.exit.i70, %bb15.preheader.i
+ %.pre41.i.rle244 = phi %struct.s_net* [ %.pre41.i, %bb15.preheader.i ], [ %0, %my_malloc.exit.i70 ], [ %1, %bb9.i71 ] ; <%struct.s_net*> [#uses=1]
+ br label %bb17.i78
+
+bb17.i78: ; preds = %bb16.i77, %my_calloc.exit5.i
+ %.pre41.i = phi %struct.s_net* [ %.pre41.i.rle244, %bb16.i77 ], [ %.pre.i58, %my_calloc.exit5.i ] ; <%struct.s_net*> [#uses=1]
+ br i1 undef, label %bb4.preheader.i, label %alloc_and_load_unique_pin_list.exit
+
+bb4.preheader.i: ; preds = %bb17.i78
+ br i1 undef, label %bb1.i61, label %bb15.preheader.i
+
+alloc_and_load_unique_pin_list.exit: ; preds = %bb17.i78
+ ret void
+}
+
+define void @read_net(i8* %net_file) nounwind ssp {
+entry:
+ br i1 undef, label %bb3.us.us.i, label %bb6.preheader
+
+bb6.preheader: ; preds = %entry
+ br i1 undef, label %bb7, label %bb
+
+bb3.us.us.i: ; preds = %entry
+ unreachable
+
+bb: ; preds = %bb6.preheader
+ br i1 undef, label %bb.i34, label %bb1.i38
+
+bb.i34: ; preds = %bb
+ unreachable
+
+bb1.i38: ; preds = %bb
+ %0 = malloc %struct.s_net, i32 undef ; <%struct.s_net*> [#uses=1]
+ br i1 undef, label %bb.i1.i39, label %my_malloc.exit2.i
+
+bb.i1.i39: ; preds = %bb1.i38
+ unreachable
+
+my_malloc.exit2.i: ; preds = %bb1.i38
+ store %struct.s_net* %0, %struct.s_net** @net, align 4
+ br i1 undef, label %bb.i7.i40, label %my_malloc.exit8.i
+
+bb.i7.i40: ; preds = %my_malloc.exit2.i
+ unreachable
+
+my_malloc.exit8.i: ; preds = %my_malloc.exit2.i
+ unreachable
+
+bb7: ; preds = %bb6.preheader
+ unreachable
+}
diff --git a/test/Transforms/GlobalOpt/alias-resolve.ll b/test/Transforms/GlobalOpt/alias-resolve.ll
new file mode 100644
index 000000000000..3cae4138fde7
--- /dev/null
+++ b/test/Transforms/GlobalOpt/alias-resolve.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis > %t
+; RUN: cat %t | grep foo1 | count 1
+; RUN: cat %t | grep foo2 | count 4
+; RUN: cat %t | grep bar1 | count 1
+; RUN: cat %t | grep bar2 | count 4
+
+@foo1 = alias void ()* @foo2
+@foo2 = alias weak void()* @bar1
+@bar1 = alias void ()* @bar2
+
+declare void @bar2()
+
+define void @baz() {
+entry:
+ call void @foo1()
+ call void @foo2()
+ call void @bar1()
+ ret void
+}
diff --git a/test/Transforms/GlobalOpt/basictest.ll b/test/Transforms/GlobalOpt/basictest.ll
new file mode 100644
index 000000000000..1c3bdbbc495c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/basictest.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
+
+@X = internal global i32 4 ; <i32*> [#uses=1]
+
+define i32 @foo() {
+ %V = load i32* @X ; <i32> [#uses=1]
+ ret i32 %V
+}
+
diff --git a/test/Transforms/GlobalOpt/constantexpr-dangle.ll b/test/Transforms/GlobalOpt/constantexpr-dangle.ll
new file mode 100644
index 000000000000..6e33ae0653d7
--- /dev/null
+++ b/test/Transforms/GlobalOpt/constantexpr-dangle.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -instcombine -globalopt | llvm-dis | \
+; RUN: grep {internal fastcc float @foo}
+
+define internal float @foo() {
+ ret float 0.000000e+00
+}
+
+define float @bar() {
+ %tmp1 = call float (...)* bitcast (float ()* @foo to float (...)*)( )
+ %tmp2 = mul float %tmp1, 1.000000e+01 ; <float> [#uses=1]
+ ret float %tmp2
+}
+
diff --git a/test/Transforms/GlobalOpt/ctor-list-opt-dbg.ll b/test/Transforms/GlobalOpt/ctor-list-opt-dbg.ll
new file mode 100644
index 000000000000..45fb45341cd2
--- /dev/null
+++ b/test/Transforms/GlobalOpt/ctor-list-opt-dbg.ll
@@ -0,0 +1,98 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep CTOR
+@llvm.global_ctors = appending global [10 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
+@G = global i32 0 ; <i32*> [#uses=1]
+@G2 = global i32 0 ; <i32*> [#uses=1]
+@G3 = global i32 -123 ; <i32*> [#uses=2]
+@X = global { i32, [2 x i32] } { i32 0, [2 x i32] [ i32 17, i32 21 ] } ; <{ i32, [2 x i32] }*> [#uses=2]
+@Y = global i32 -1 ; <i32*> [#uses=2]
+@Z = global i32 123 ; <i32*> [#uses=1]
+@D = global double 0.000000e+00 ; <double*> [#uses=1]
+@CTORGV = internal global i1 false ; <i1*> [#uses=2]
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+define internal void @CTOR1() {
+ ret void
+}
+
+define internal void @CTOR2() {
+ %A = add i32 1, 23 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ store i32 %A, i32* @G
+ store i1 true, i1* @CTORGV
+ ret void
+}
+
+define internal void @CTOR3() {
+ %X = or i1 true, false ; <i1> [#uses=1]
+ br label %Cont
+
+Cont: ; preds = %0
+ br i1 %X, label %S, label %T
+
+S: ; preds = %Cont
+ store i32 24, i32* @G2
+ ret void
+
+T: ; preds = %Cont
+ ret void
+}
+
+define internal void @CTOR4() {
+ %X = load i32* @G3 ; <i32> [#uses=1]
+ %Y = add i32 %X, 123 ; <i32> [#uses=1]
+ store i32 %Y, i32* @G3
+ ret void
+}
+
+define internal void @CTOR5() {
+ %X.2p = getelementptr { i32, [2 x i32] }* @X, i32 0, i32 1, i32 0 ; <i32*> [#uses=2]
+ %X.2 = load i32* %X.2p ; <i32> [#uses=1]
+ %X.1p = getelementptr { i32, [2 x i32] }* @X, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %X.2, i32* %X.1p
+ store i32 42, i32* %X.2p
+ ret void
+}
+
+define internal void @CTOR6() {
+ %A = alloca i32 ; <i32*> [#uses=2]
+ %y = load i32* @Y ; <i32> [#uses=1]
+ store i32 %y, i32* %A
+ %Av = load i32* %A ; <i32> [#uses=1]
+ %Av1 = add i32 %Av, 1 ; <i32> [#uses=1]
+ store i32 %Av1, i32* @Y
+ ret void
+}
+
+define internal void @CTOR7() {
+ call void @setto( i32* @Z, i32 0 )
+ ret void
+}
+
+define void @setto(i32* %P, i32 %V) {
+ store i32 %V, i32* %P
+ ret void
+}
+
+declare double @cos(double)
+
+define internal void @CTOR8() {
+ %X = call double @cos( double 1.000000e+00 ) ; <double> [#uses=1]
+ store double %X, double* @D
+ ret void
+}
+
+define i1 @accessor() {
+ %V = load i1* @CTORGV ; <i1> [#uses=1]
+ ret i1 %V
+}
diff --git a/test/Transforms/GlobalOpt/ctor-list-opt.ll b/test/Transforms/GlobalOpt/ctor-list-opt.ll
new file mode 100644
index 000000000000..56aeadb38613
--- /dev/null
+++ b/test/Transforms/GlobalOpt/ctor-list-opt.ll
@@ -0,0 +1,85 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep CTOR
+@llvm.global_ctors = appending global [10 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR1 }, { i32, void ()* } { i32 65535, void ()* @CTOR2 }, { i32, void ()* } { i32 65535, void ()* @CTOR3 }, { i32, void ()* } { i32 65535, void ()* @CTOR4 }, { i32, void ()* } { i32 65535, void ()* @CTOR5 }, { i32, void ()* } { i32 65535, void ()* @CTOR6 }, { i32, void ()* } { i32 65535, void ()* @CTOR7 }, { i32, void ()* } { i32 65535, void ()* @CTOR8 }, { i32, void ()* } { i32 2147483647, void ()* null } ] ; <[10 x { i32, void ()* }]*> [#uses=0]
+@G = global i32 0 ; <i32*> [#uses=1]
+@G2 = global i32 0 ; <i32*> [#uses=1]
+@G3 = global i32 -123 ; <i32*> [#uses=2]
+@X = global { i32, [2 x i32] } { i32 0, [2 x i32] [ i32 17, i32 21 ] } ; <{ i32, [2 x i32] }*> [#uses=2]
+@Y = global i32 -1 ; <i32*> [#uses=2]
+@Z = global i32 123 ; <i32*> [#uses=1]
+@D = global double 0.000000e+00 ; <double*> [#uses=1]
+@CTORGV = internal global i1 false ; <i1*> [#uses=2]
+
+define internal void @CTOR1() {
+ ret void
+}
+
+define internal void @CTOR2() {
+ %A = add i32 1, 23 ; <i32> [#uses=1]
+ store i32 %A, i32* @G
+ store i1 true, i1* @CTORGV
+ ret void
+}
+
+define internal void @CTOR3() {
+ %X = or i1 true, false ; <i1> [#uses=1]
+ br label %Cont
+
+Cont: ; preds = %0
+ br i1 %X, label %S, label %T
+
+S: ; preds = %Cont
+ store i32 24, i32* @G2
+ ret void
+
+T: ; preds = %Cont
+ ret void
+}
+
+define internal void @CTOR4() {
+ %X = load i32* @G3 ; <i32> [#uses=1]
+ %Y = add i32 %X, 123 ; <i32> [#uses=1]
+ store i32 %Y, i32* @G3
+ ret void
+}
+
+define internal void @CTOR5() {
+ %X.2p = getelementptr { i32, [2 x i32] }* @X, i32 0, i32 1, i32 0 ; <i32*> [#uses=2]
+ %X.2 = load i32* %X.2p ; <i32> [#uses=1]
+ %X.1p = getelementptr { i32, [2 x i32] }* @X, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %X.2, i32* %X.1p
+ store i32 42, i32* %X.2p
+ ret void
+}
+
+define internal void @CTOR6() {
+ %A = alloca i32 ; <i32*> [#uses=2]
+ %y = load i32* @Y ; <i32> [#uses=1]
+ store i32 %y, i32* %A
+ %Av = load i32* %A ; <i32> [#uses=1]
+ %Av1 = add i32 %Av, 1 ; <i32> [#uses=1]
+ store i32 %Av1, i32* @Y
+ ret void
+}
+
+define internal void @CTOR7() {
+ call void @setto( i32* @Z, i32 0 )
+ ret void
+}
+
+define void @setto(i32* %P, i32 %V) {
+ store i32 %V, i32* %P
+ ret void
+}
+
+declare double @cos(double)
+
+define internal void @CTOR8() {
+ %X = call double @cos( double 1.000000e+00 ) ; <double> [#uses=1]
+ store double %X, double* @D
+ ret void
+}
+
+define i1 @accessor() {
+ %V = load i1* @CTORGV ; <i1> [#uses=1]
+ ret i1 %V
+}
diff --git a/test/Transforms/GlobalOpt/deadglobal-2.ll b/test/Transforms/GlobalOpt/deadglobal-2.ll
new file mode 100644
index 000000000000..def6a09d2781
--- /dev/null
+++ b/test/Transforms/GlobalOpt/deadglobal-2.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep internal
+
+; This is a harder case to delete as the GEP has a variable index.
+
+@G = internal global [4 x i32] zeroinitializer
+
+define void @foo(i32 %X) {
+ %Ptr = getelementptr [4 x i32]* @G, i32 0, i32 %X
+ store i32 1, i32* %Ptr
+ ret void
+}
diff --git a/test/Transforms/GlobalOpt/deadglobal.ll b/test/Transforms/GlobalOpt/deadglobal.ll
new file mode 100644
index 000000000000..7a47b8ea30bb
--- /dev/null
+++ b/test/Transforms/GlobalOpt/deadglobal.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep internal
+
+@G = internal global i32 123 ; <i32*> [#uses=1]
+
+define void @foo() {
+ store i32 1, i32* @G
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/dg.exp b/test/Transforms/GlobalOpt/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/GlobalOpt/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/GlobalOpt/globalsra-partial.ll b/test/Transforms/GlobalOpt/globalsra-partial.ll
new file mode 100644
index 000000000000..e52e7feab169
--- /dev/null
+++ b/test/Transforms/GlobalOpt/globalsra-partial.ll
@@ -0,0 +1,23 @@
+; In this case, the global can only be broken up by one level.
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep 12345
+
+@G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
+
+define void @onlystore() {
+ store i32 12345, i32* getelementptr ({ i32, [4 x float] }* @G, i32 0, i32 0)
+ ret void
+}
+
+define void @storeinit(i32 %i) {
+ %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; <float*> [#uses=1]
+ store float 1.000000e+00, float* %Ptr
+ ret void
+}
+
+define float @readval(i32 %i) {
+ %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; <float*> [#uses=1]
+ %V = load float* %Ptr ; <float> [#uses=1]
+ ret float %V
+}
+
diff --git a/test/Transforms/GlobalOpt/globalsra.ll b/test/Transforms/GlobalOpt/globalsra.ll
new file mode 100644
index 000000000000..36235552ae82
--- /dev/null
+++ b/test/Transforms/GlobalOpt/globalsra.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
+
+@G = internal global { i32, float, { double } } {
+ i32 1,
+ float 1.000000e+00,
+ { double } { double 1.727000e+01 } } ; <{ i32, float, { double } }*> [#uses=3]
+
+define void @onlystore() {
+ store i32 123, i32* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 0)
+ ret void
+}
+
+define float @storeinit() {
+ store float 1.000000e+00, float* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 1)
+ %X = load float* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 1) ; <float> [#uses=1]
+ ret float %X
+}
+
+define double @constantize() {
+ %X = load double* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 2, i32 0) ; <double> [#uses=1]
+ ret double %X
+}
+
diff --git a/test/Transforms/GlobalOpt/heap-sra-1.ll b/test/Transforms/GlobalOpt/heap-sra-1.ll
new file mode 100644
index 000000000000..37e6d477a402
--- /dev/null
+++ b/test/Transforms/GlobalOpt/heap-sra-1.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@X.f0}
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@X.f1}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+
+ %struct.foo = type { i32, i32 }
+@X = internal global %struct.foo* null
+
+define void @bar(i32 %Size) nounwind noinline {
+entry:
+ %.sub = malloc %struct.foo, i32 %Size
+ store %struct.foo* %.sub, %struct.foo** @X, align 4
+ ret void
+}
+
+define i32 @baz() nounwind readonly noinline {
+bb1.thread:
+ %0 = load %struct.foo** @X, align 4
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %i.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %indvar.next, %bb1 ]
+ %sum.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %3, %bb1 ]
+ %1 = getelementptr %struct.foo* %0, i32 %i.0.reg2mem.0, i32 0
+ %2 = load i32* %1, align 4
+ %3 = add i32 %2, %sum.0.reg2mem.0
+ %indvar.next = add i32 %i.0.reg2mem.0, 1
+ %exitcond = icmp eq i32 %indvar.next, 1200
+ br i1 %exitcond, label %bb2, label %bb1
+
+bb2: ; preds = %bb1
+ ret i32 %3
+}
+
diff --git a/test/Transforms/GlobalOpt/heap-sra-2.ll b/test/Transforms/GlobalOpt/heap-sra-2.ll
new file mode 100644
index 000000000000..98f4a5022749
--- /dev/null
+++ b/test/Transforms/GlobalOpt/heap-sra-2.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@X.f0}
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {@X.f1}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct.foo = type { i32, i32 }
+@X = internal global %struct.foo* null ; <%struct.foo**> [#uses=2]
+
+define void @bar(i32 %Size) nounwind noinline {
+entry:
+ %0 = malloc [1000000 x %struct.foo]
+ ;%.sub = bitcast [1000000 x %struct.foo]* %0 to %struct.foo*
+ %.sub = getelementptr [1000000 x %struct.foo]* %0, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
+ store %struct.foo* %.sub, %struct.foo** @X, align 4
+ ret void
+}
+
+define i32 @baz() nounwind readonly noinline {
+bb1.thread:
+ %0 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %i.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %indvar.next, %bb1 ] ; <i32> [#uses=2]
+ %sum.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %3, %bb1 ] ; <i32> [#uses=1]
+ %1 = getelementptr %struct.foo* %0, i32 %i.0.reg2mem.0, i32 0 ; <i32*> [#uses=1]
+ %2 = load i32* %1, align 4 ; <i32> [#uses=1]
+ %3 = add i32 %2, %sum.0.reg2mem.0 ; <i32> [#uses=2]
+ %indvar.next = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, 1200 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb2, label %bb1
+
+bb2: ; preds = %bb1
+ ret i32 %3
+}
+
diff --git a/test/Transforms/GlobalOpt/heap-sra-phi.ll b/test/Transforms/GlobalOpt/heap-sra-phi.ll
new file mode 100644
index 000000000000..5f46a77f6b7c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/heap-sra-phi.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {tmp.f1 = phi i32. }
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep {tmp.f0 = phi i32. }
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+ %struct.foo = type { i32, i32 }
+@X = internal global %struct.foo* null ; <%struct.foo**> [#uses=2]
+
+define void @bar(i32 %Size) nounwind noinline {
+entry:
+ %tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1]
+ %.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
+ store %struct.foo* %.sub, %struct.foo** @X, align 4
+ ret void
+}
+
+define i32 @baz() nounwind readonly noinline {
+bb1.thread:
+ %tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %tmp = phi %struct.foo* [%tmpLD1, %bb1.thread ], [ %tmpLD2, %bb1 ] ; <i32> [#uses=2]
+ %i.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %indvar.next, %bb1 ] ; <i32> [#uses=2]
+ %sum.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %tmp3, %bb1 ] ; <i32> [#uses=1]
+ %tmp1 = getelementptr %struct.foo* %tmp, i32 %i.0.reg2mem.0, i32 0 ; <i32*> [#uses=1]
+ %tmp2 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp2, %sum.0.reg2mem.0 ; <i32> [#uses=2]
+ %tmp4 = getelementptr %struct.foo* %tmp, i32 %i.0.reg2mem.0, i32 1 ; <i32*> [#uses=1]
+ %tmp5 = load i32 * %tmp4
+ %tmp3 = add i32 %tmp5, %tmp6
+ %indvar.next = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
+
+ %tmpLD2 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=1]
+
+ %exitcond = icmp eq i32 %indvar.next, 1200 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb2, label %bb1
+
+bb2: ; preds = %bb1
+ ret i32 %tmp3
+}
diff --git a/test/Transforms/GlobalOpt/integer-bool.ll b/test/Transforms/GlobalOpt/integer-bool.ll
new file mode 100644
index 000000000000..9fbbe357617d
--- /dev/null
+++ b/test/Transforms/GlobalOpt/integer-bool.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -globalopt -instcombine | \
+; RUN: llvm-dis | grep {ret i1 true}
+
+;; check that global opt turns integers that only hold 0 or 1 into bools.
+
+@G = internal global i32 0 ; <i32*> [#uses=3]
+
+define void @set1() {
+ store i32 0, i32* @G
+ ret void
+}
+
+define void @set2() {
+ store i32 1, i32* @G
+ ret void
+}
+
+define i1 @get() {
+ %A = load i32* @G ; <i32> [#uses=1]
+ %C = icmp slt i32 %A, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
diff --git a/test/Transforms/GlobalOpt/iterate.ll b/test/Transforms/GlobalOpt/iterate.ll
new file mode 100644
index 000000000000..d764c5d31b4c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/iterate.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep %G
+
+@G = internal global i32 0 ; <i32*> [#uses=1]
+@H = internal global { i32* } { i32* @G } ; <{ i32* }*> [#uses=1]
+
+define i32 @loadg() {
+ %G = load i32** getelementptr ({ i32* }* @H, i32 0, i32 0) ; <i32*> [#uses=1]
+ %GV = load i32* %G ; <i32> [#uses=1]
+ ret i32 %GV
+}
+
diff --git a/test/Transforms/GlobalOpt/load-store-global.ll b/test/Transforms/GlobalOpt/load-store-global.ll
new file mode 100644
index 000000000000..d89d2263955c
--- /dev/null
+++ b/test/Transforms/GlobalOpt/load-store-global.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep G
+
+@G = internal global i32 17 ; <i32*> [#uses=3]
+
+define void @foo() {
+ %V = load i32* @G ; <i32> [#uses=1]
+ store i32 %V, i32* @G
+ ret void
+}
+
+define i32 @bar() {
+ %X = load i32* @G ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/GlobalOpt/malloc-promote-1.ll b/test/Transforms/GlobalOpt/malloc-promote-1.ll
new file mode 100644
index 000000000000..fea4dbdd65c3
--- /dev/null
+++ b/test/Transforms/GlobalOpt/malloc-promote-1.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
+
+@G = internal global i32* null ; <i32**> [#uses=3]
+
+define void @init() {
+ %P = malloc i32 ; <i32*> [#uses=1]
+ store i32* %P, i32** @G
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ store i32 0, i32* %GV
+ ret void
+}
+
+define i32 @get() {
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ %V = load i32* %GV ; <i32> [#uses=1]
+ ret i32 %V
+}
+
diff --git a/test/Transforms/GlobalOpt/malloc-promote-2.ll b/test/Transforms/GlobalOpt/malloc-promote-2.ll
new file mode 100644
index 000000000000..1b3363295421
--- /dev/null
+++ b/test/Transforms/GlobalOpt/malloc-promote-2.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
+
+@G = internal global i32* null ; <i32**> [#uses=3]
+
+define void @init() {
+ %P = malloc i32, i32 100 ; <i32*> [#uses=1]
+ store i32* %P, i32** @G
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ %GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
+ store i32 20, i32* %GVe
+ ret void
+}
+
+define i32 @get() {
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ %GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
+ %V = load i32* %GVe ; <i32> [#uses=1]
+ ret i32 %V
+}
+
diff --git a/test/Transforms/GlobalOpt/malloc-promote-3.ll b/test/Transforms/GlobalOpt/malloc-promote-3.ll
new file mode 100644
index 000000000000..26ce8fd6f855
--- /dev/null
+++ b/test/Transforms/GlobalOpt/malloc-promote-3.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
+
+@G = internal global i32* null ; <i32**> [#uses=4]
+
+define void @init() {
+ %P = malloc i32, i32 100 ; <i32*> [#uses=1]
+ store i32* %P, i32** @G
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ %GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
+ store i32 20, i32* %GVe
+ ret void
+}
+
+define i32 @get() {
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ %GVe = getelementptr i32* %GV, i32 40 ; <i32*> [#uses=1]
+ %V = load i32* %GVe ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i1 @check() {
+ %GV = load i32** @G ; <i32*> [#uses=1]
+ %V = icmp eq i32* %GV, null ; <i1> [#uses=1]
+ ret i1 %V
+}
+
diff --git a/test/Transforms/GlobalOpt/memcpy.ll b/test/Transforms/GlobalOpt/memcpy.ll
new file mode 100644
index 000000000000..b51aedb13fbb
--- /dev/null
+++ b/test/Transforms/GlobalOpt/memcpy.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | \
+; RUN: grep {G1 = internal constant}
+
+@G1 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1]
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+define void @foo() {
+ %Blah = alloca [58 x i8] ; <[58 x i8]*> [#uses=1]
+ %tmp.0 = getelementptr [58 x i8]* %Blah, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp.0, i8* getelementptr ([58 x i8]* @G1, i32 0, i32 0), i32 58, i32 1 )
+ ret void
+}
+
+
diff --git a/test/Transforms/GlobalOpt/memset.ll b/test/Transforms/GlobalOpt/memset.ll
new file mode 100644
index 000000000000..0ee851f40aef
--- /dev/null
+++ b/test/Transforms/GlobalOpt/memset.ll
@@ -0,0 +1,21 @@
+; both globals are write only, delete them.
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | \
+; RUN: not grep internal
+
+@G0 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1]
+@G1 = internal global [4 x i32] [ i32 1, i32 2, i32 3, i32 4 ] ; <[4 x i32]*> [#uses=1]
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32)
+
+define void @foo() {
+ %Blah = alloca [58 x i8] ; <[58 x i8]*> [#uses=1]
+ %tmp3 = bitcast [58 x i8]* %Blah to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* bitcast ([4 x i32]* @G1 to i8*), i8* %tmp3, i32 16, i32 1 )
+ call void @llvm.memset.i32( i8* getelementptr ([58 x i8]* @G0, i32 0, i32 0), i8 17, i32 58, i32 1 )
+ ret void
+}
+
+
diff --git a/test/Transforms/GlobalOpt/phi-select.ll b/test/Transforms/GlobalOpt/phi-select.ll
new file mode 100644
index 000000000000..da1314f76199
--- /dev/null
+++ b/test/Transforms/GlobalOpt/phi-select.ll
@@ -0,0 +1,31 @@
+; Test that PHI nodes and select instructions do not necessarily make stuff
+; non-constant.
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
+
+@X = internal global i32 4 ; <i32*> [#uses=2]
+@Y = internal global i32 5 ; <i32*> [#uses=2]
+
+define i32 @test1(i1 %C) {
+ %P = select i1 %C, i32* @X, i32* @Y ; <i32*> [#uses=1]
+ %V = load i32* %P ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @test2(i1 %C) {
+; <label>:0
+ br i1 %C, label %T, label %Cont
+
+T: ; preds = %0
+ br label %Cont
+
+Cont: ; preds = %T, %0
+ %P = phi i32* [ @X, %0 ], [ @Y, %T ] ; <i32*> [#uses=1]
+ %V = load i32* %P ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+
+
+
+
diff --git a/test/Transforms/GlobalOpt/storepointer-compare.ll b/test/Transforms/GlobalOpt/storepointer-compare.ll
new file mode 100644
index 000000000000..86eff5172526
--- /dev/null
+++ b/test/Transforms/GlobalOpt/storepointer-compare.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | \
+; RUN: grep {call void @Actual}
+
+; Check that a comparison does not prevent an indirect call from being made
+; direct. The global will still remain, but indirect call elim is still good.
+
+@G = internal global void ()* null ; <void ()**> [#uses=2]
+
+define internal void @Actual() {
+ ret void
+}
+
+define void @init() {
+ store void ()* @Actual, void ()** @G
+ ret void
+}
+
+define void @doit() {
+ %FP = load void ()** @G ; <void ()*> [#uses=2]
+ %CC = icmp eq void ()* %FP, null ; <i1> [#uses=1]
+ br i1 %CC, label %isNull, label %DoCall
+
+DoCall: ; preds = %0
+ call void %FP( )
+ ret void
+
+isNull: ; preds = %0
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/storepointer.ll b/test/Transforms/GlobalOpt/storepointer.ll
new file mode 100644
index 000000000000..d57a6ac4fad9
--- /dev/null
+++ b/test/Transforms/GlobalOpt/storepointer.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
+
+@G = internal global void ()* null ; <void ()**> [#uses=2]
+
+define internal void @Actual() {
+ ret void
+}
+
+define void @init() {
+ store void ()* @Actual, void ()** @G
+ ret void
+}
+
+define void @doit() {
+ %FP = load void ()** @G ; <void ()*> [#uses=1]
+ call void %FP( )
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/trivialstore.ll b/test/Transforms/GlobalOpt/trivialstore.ll
new file mode 100644
index 000000000000..a662565cd24f
--- /dev/null
+++ b/test/Transforms/GlobalOpt/trivialstore.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep G
+
+@G = internal global i32 17 ; <i32*> [#uses=3]
+
+define void @foo() {
+ store i32 17, i32* @G
+ ret void
+}
+
+define i32 @bar() {
+ %X = load i32* @G ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+define internal void @dead() {
+ store i32 123, i32* @G
+ ret void
+}
+
diff --git a/test/Transforms/GlobalOpt/undef-init.ll b/test/Transforms/GlobalOpt/undef-init.ll
new file mode 100644
index 000000000000..bb483fc37690
--- /dev/null
+++ b/test/Transforms/GlobalOpt/undef-init.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep store
+
+@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z3foov } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
+@X.0 = internal global i32 undef ; <i32*> [#uses=2]
+
+define i32 @_Z3foov() {
+entry:
+ %tmp.1 = load i32* @X.0 ; <i32> [#uses=1]
+ ret i32 %tmp.1
+}
+
+define internal void @_GLOBAL__I__Z3foov() {
+entry:
+ store i32 1, i32* @X.0
+ ret void
+}
+
diff --git a/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll b/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll
new file mode 100644
index 000000000000..fc7e3bba38a5
--- /dev/null
+++ b/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis | grep {ret i32 %r}
+; Should not propagate the result of a weak function.
+; PR2411
+
+define weak i32 @foo() nounwind {
+entry:
+ ret i32 1
+}
+
+define i32 @main() nounwind {
+entry:
+ %r = call i32 @foo( ) nounwind
+ ret i32 %r
+}
+
diff --git a/test/Transforms/IPConstantProp/deadarg.ll b/test/Transforms/IPConstantProp/deadarg.ll
new file mode 100644
index 000000000000..18b8f7da8443
--- /dev/null
+++ b/test/Transforms/IPConstantProp/deadarg.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | opt -ipconstprop -disable-output
+define internal void @foo(i32 %X) {
+ call void @foo( i32 %X )
+ ret void
+}
+
diff --git a/test/Transforms/IPConstantProp/dg.exp b/test/Transforms/IPConstantProp/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/IPConstantProp/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/IPConstantProp/recursion.ll b/test/Transforms/IPConstantProp/recursion.ll
new file mode 100644
index 000000000000..27c381af3ab3
--- /dev/null
+++ b/test/Transforms/IPConstantProp/recursion.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -ipconstprop -deadargelim | llvm-dis | not grep %X
+define internal i32 @foo(i32 %X) {
+ %Y = call i32 @foo( i32 %X ) ; <i32> [#uses=1]
+ %Z = add i32 %Y, 1 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define void @bar() {
+ call i32 @foo( i32 17 ) ; <i32>:1 [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/IPConstantProp/return-argument.ll b/test/Transforms/IPConstantProp/return-argument.ll
new file mode 100644
index 000000000000..f8605107bdce
--- /dev/null
+++ b/test/Transforms/IPConstantProp/return-argument.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis > %t
+; RUN: cat %t | grep {store i32 %Z, i32\\* %Q}
+; RUN: cat %t | grep {add i32 1, 3}
+
+;; This function returns its second argument on all return statements
+define internal i32* @incdec(i1 %C, i32* %V) {
+ %X = load i32* %V
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ %X1 = add i32 %X, 1
+ store i32 %X1, i32* %V
+ ret i32* %V
+
+F: ; preds = %0
+ %X2 = sub i32 %X, 1
+ store i32 %X2, i32* %V
+ ret i32* %V
+}
+
+;; This function returns its first argument as a part of a multiple return
+;; value
+define internal { i32, i32 } @foo(i32 %A, i32 %B) {
+ %X = add i32 %A, %B
+ %Y = insertvalue { i32, i32 } undef, i32 %A, 0
+ %Z = insertvalue { i32, i32 } %Y, i32 %X, 1
+ ret { i32, i32 } %Z
+}
+
+define void @caller(i1 %C) {
+ %Q = alloca i32
+ ;; Call incdec to see if %W is properly replaced by %Q
+ %W = call i32* @incdec(i1 %C, i32* %Q ) ; <i32> [#uses=1]
+ ;; Call @foo twice, to prevent the arguments from propagating into the
+ ;; function (so we can check the returned argument is properly
+ ;; propagated per-caller).
+ %S1 = call { i32, i32 } @foo(i32 1, i32 2);
+ %X1 = extractvalue { i32, i32 } %S1, 0
+ %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %RET;
+OK:
+ %X2 = extractvalue { i32, i32 } %S2, 0
+ ;; Do some stuff with the returned values which we can grep for
+ %Z = add i32 %X1, %X2
+ store i32 %Z, i32* %W
+ br label %RET
+RET:
+ ret void
+}
+
diff --git a/test/Transforms/IPConstantProp/return-constant.ll b/test/Transforms/IPConstantProp/return-constant.ll
new file mode 100644
index 000000000000..381ef63cc88e
--- /dev/null
+++ b/test/Transforms/IPConstantProp/return-constant.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -ipconstprop -instcombine | \
+; RUN: llvm-dis | grep {ret i1 true} | count 2
+define internal i32 @foo(i1 %C) {
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ ret i32 52
+
+F: ; preds = %0
+ ret i32 52
+}
+
+define i1 @caller(i1 %C) {
+ %X = call i32 @foo( i1 %C ) ; <i32> [#uses=1]
+ %Y = icmp ne i32 %X, 0 ; <i1> [#uses=1]
+ ret i1 %Y
+}
+
+define i1 @invokecaller(i1 %C) {
+ %X = invoke i32 @foo( i1 %C ) to label %OK unwind label %FAIL ; <i32> [#uses=1]
+OK:
+ %Y = icmp ne i32 %X, 0 ; <i1> [#uses=1]
+ ret i1 %Y
+FAIL:
+ ret i1 false
+}
diff --git a/test/Transforms/IPConstantProp/return-constants.ll b/test/Transforms/IPConstantProp/return-constants.ll
new file mode 100644
index 000000000000..7205c2820a71
--- /dev/null
+++ b/test/Transforms/IPConstantProp/return-constants.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis > %t
+;; Check that the 21 constants got propagated properly
+; RUN: cat %t | grep {%M = add i32 21, 21}
+;; Check that the second return values didn't get propagated
+; RUN: cat %t | grep {%N = add i32 %B, %D}
+
+define internal {i32, i32} @foo(i1 %Q) {
+ br i1 %Q, label %T, label %F
+
+T: ; preds = %0
+ ret i32 21, i32 22
+
+F: ; preds = %0
+ ret i32 21, i32 23
+}
+
+define internal {i32, i32} @bar(i1 %Q) {
+ %A = insertvalue { i32, i32 } undef, i32 21, 0
+ br i1 %Q, label %T, label %F
+
+T: ; preds = %0
+ %B = insertvalue { i32, i32 } %A, i32 22, 1
+ ret { i32, i32 } %B
+
+F: ; preds = %0
+ %C = insertvalue { i32, i32 } %A, i32 23, 1
+ ret { i32, i32 } %C
+}
+
+define { i32, i32 } @caller(i1 %Q) {
+ %X = call {i32, i32} @foo( i1 %Q )
+ %A = getresult {i32, i32} %X, 0
+ %B = getresult {i32, i32} %X, 1
+ %Y = call {i32, i32} @bar( i1 %Q )
+ %C = extractvalue {i32, i32} %Y, 0
+ %D = extractvalue {i32, i32} %Y, 1
+ %M = add i32 %A, %C
+ %N = add i32 %B, %D
+ ret { i32, i32 } %X
+}
+
diff --git a/test/Transforms/IndMemRem/2009-01-24-Noalias.ll b/test/Transforms/IndMemRem/2009-01-24-Noalias.ll
new file mode 100644
index 000000000000..bc3d0bfe5e3f
--- /dev/null
+++ b/test/Transforms/IndMemRem/2009-01-24-Noalias.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -indmemrem | llvm-dis | grep bounce | grep noalias
+
+declare i8* @malloc(i32)
+
+@g = external global i8*
+
+define void @test() {
+ %A = bitcast i8* (i32) * @malloc to i8*
+ store i8* %A, i8** @g
+ ret void
+}
diff --git a/test/Transforms/IndMemRem/dg.exp b/test/Transforms/IndMemRem/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/IndMemRem/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll b/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll
new file mode 100644
index 000000000000..228772eb82cc
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll
@@ -0,0 +1,17 @@
+; Induction variable pass is doing bad things with pointer induction vars,
+; trying to do arithmetic on them directly.
+;
+; RUN: llvm-as < %s | opt -indvars
+;
+define void @test(i32 %A, i32 %S, i8* %S.upgrd.1) {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %PIV = phi i8* [ %S.upgrd.1, %0 ], [ %PIVNext.upgrd.3, %Loop ] ; <i8*> [#uses=1]
+ %PIV.upgrd.2 = ptrtoint i8* %PIV to i64 ; <i64> [#uses=1]
+ %PIVNext = add i64 %PIV.upgrd.2, 8 ; <i64> [#uses=1]
+ %PIVNext.upgrd.3 = inttoptr i64 %PIVNext to i8* ; <i8*> [#uses=1]
+ br label %Loop
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll b/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll
new file mode 100644
index 000000000000..2487ea95e27d
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll
@@ -0,0 +1,17 @@
+; This is a test case for the expression analysis code, not really indvars.
+; It was assuming any constant of int type was a ConstantInteger.
+;
+; RUN: llvm-as < %s | opt -indvars
+
+@X = global i32 7 ; <i32*> [#uses=1]
+
+define void @test(i32 %A) {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %IV = phi i32 [ %A, %0 ], [ %IVNext, %Loop ] ; <i32> [#uses=1]
+ %IVNext = add i32 %IV, ptrtoint (i32* @X to i32) ; <i32> [#uses=1]
+ br label %Loop
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll b/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll
new file mode 100644
index 000000000000..96190991f73a
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+
+define i32 @test() {
+; <label>:0
+ br i1 true, label %LoopHead, label %LoopHead
+
+LoopHead: ; preds = %LoopHead, %0, %0
+ %A = phi i32 [ 7, %0 ], [ 7, %0 ], [ %B, %LoopHead ] ; <i32> [#uses=1]
+ %B = add i32 %A, 1 ; <i32> [#uses=2]
+ br i1 false, label %LoopHead, label %Out
+
+Out: ; preds = %LoopHead
+ ret i32 %B
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll b/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll
new file mode 100644
index 000000000000..d70e60497978
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | %prcontext Loop: 1 | grep %indvar
+
+; The indvar simplification code should ensure that the first PHI in the block
+; is the canonical one!
+
+define i32 @test() {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %NonIndvar = phi i32 [ 200, %0 ], [ %NonIndvarNext, %Loop ] ; <i32> [#uses=1]
+ %Canonical = phi i32 [ 0, %0 ], [ %CanonicalNext, %Loop ] ; <i32> [#uses=2]
+ store i32 %Canonical, i32* null
+ %NonIndvarNext = sdiv i32 %NonIndvar, 2 ; <i32> [#uses=1]
+ %CanonicalNext = add i32 %Canonical, 1 ; <i32> [#uses=1]
+ br label %Loop
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll b/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll
new file mode 100644
index 000000000000..bd9d1ef5cb9d
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll
@@ -0,0 +1,25 @@
+; The induction variable canonicalization pass shouldn't leave dead
+; instructions laying around!
+;
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | \
+; RUN: not grep {#uses=0}
+
+define i32 @mul(i32 %x, i32 %y) {
+entry:
+ br label %tailrecurse
+
+tailrecurse: ; preds = %endif, %entry
+ %accumulator.tr = phi i32 [ %x, %entry ], [ %tmp.9, %endif ] ; <i32> [#uses=2]
+ %y.tr = phi i32 [ %y, %entry ], [ %tmp.8, %endif ] ; <i32> [#uses=2]
+ %tmp.1 = icmp eq i32 %y.tr, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %return, label %endif
+
+endif: ; preds = %tailrecurse
+ %tmp.8 = add i32 %y.tr, -1 ; <i32> [#uses=1]
+ %tmp.9 = add i32 %accumulator.tr, %x ; <i32> [#uses=1]
+ br label %tailrecurse
+
+return: ; preds = %tailrecurse
+ ret i32 %accumulator.tr
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll b/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
new file mode 100644
index 000000000000..11af997e83bd
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+define void @test() {
+entry:
+ %inc.2 = add i32 1, 1 ; <i32> [#uses=1]
+ br i1 false, label %no_exit, label %loopexit
+
+no_exit: ; preds = %no_exit, %entry
+ %j.0.pn = phi i32 [ %inc.3, %no_exit ], [ %inc.2, %entry ] ; <i32> [#uses=1]
+ %k.0.pn = phi i32 [ %inc.4, %no_exit ], [ 1, %entry ] ; <i32> [#uses=1]
+ %inc.3 = add i32 %j.0.pn, 1 ; <i32> [#uses=1]
+ %inc.4 = add i32 %k.0.pn, 1 ; <i32> [#uses=1]
+ br i1 false, label %no_exit, label %loopexit
+
+loopexit: ; preds = %no_exit, %entry
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll b/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
new file mode 100644
index 000000000000..b964d78d6952
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+define void @_ZN17CoinFactorization7cleanupEv() {
+entry:
+ br i1 false, label %loopexit.14, label %cond_continue.3
+
+cond_continue.3: ; preds = %entry
+ ret void
+
+loopexit.14: ; preds = %entry
+ %tmp.738 = sub i32 0, 0 ; <i32> [#uses=1]
+ br i1 false, label %no_exit.15.preheader, label %loopexit.15
+
+no_exit.15.preheader: ; preds = %loopexit.14
+ br label %no_exit.15
+
+no_exit.15: ; preds = %no_exit.15, %no_exit.15.preheader
+ %highC.0 = phi i32 [ %tmp.738, %no_exit.15.preheader ], [ %dec.0, %no_exit.15 ] ; <i32> [#uses=1]
+ %dec.0 = add i32 %highC.0, -1 ; <i32> [#uses=1]
+ br i1 false, label %no_exit.15, label %loopexit.15
+
+loopexit.15: ; preds = %no_exit.15, %loopexit.14
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll b/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll
new file mode 100644
index 000000000000..cf8c80472dfe
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar | not grep i32
+
+@G = global i64 0 ; <i64*> [#uses=1]
+
+define void @test() {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %X = phi i64 [ 1, %0 ], [ %X.next, %Loop ] ; <i64> [#uses=2]
+ %X.next = add i64 %X, 1 ; <i64> [#uses=1]
+ store i64 %X, i64* @G
+ br label %Loop
+}
+
diff --git a/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll b/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll
new file mode 100644
index 000000000000..248b29b32d2c
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+define void @test() {
+ br label %endif.0.i
+
+endif.0.i: ; preds = %0
+ br i1 false, label %then.3.i, label %endif.3.i
+
+then.3.i: ; preds = %endif.0.i
+ br label %endif.3.i
+
+endif.3.i: ; preds = %then.3.i, %endif.0.i
+ %inxm.0.i = phi i32 [ 8, %then.3.i ], [ 0, %endif.0.i ] ; <i32> [#uses=1]
+ %doinner.1.i = phi i32 [ 0, %then.3.i ], [ 0, %endif.0.i ] ; <i32> [#uses=0]
+ br label %loopentry.2.i
+
+loopentry.2.i: ; preds = %no_exit.2.i, %endif.3.i
+ %inxk.0.i = phi i32 [ %tmp.210.i, %no_exit.2.i ], [ 0, %endif.3.i ] ; <i32> [#uses=1]
+ br label %no_exit.2.i
+
+no_exit.2.i: ; preds = %loopentry.2.i
+ %tmp.210.i = sub i32 %inxk.0.i, %inxm.0.i ; <i32> [#uses=2]
+ %tmp.213.i = add i32 %tmp.210.i, 0 ; <i32> [#uses=0]
+ br label %loopentry.2.i
+}
+
diff --git a/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll b/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll
new file mode 100644
index 000000000000..54d85472a891
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll
@@ -0,0 +1,283 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; ModuleID = '2004-04-05-InvokeCastCrash.ll'
+ %struct.__false_type = type { i8 }
+ %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>" = type { %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>"*, %"struct.llvm::Constant"* }
+ %"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >" = type { %"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >"*, %"struct.std::pair<const llvm::Value* const,int>" }
+ %"struct.__gnu_cxx::hash_map<const llvm::Value*,int,__gnu_cxx::hash<const llvm::Value*>,std::equal_to<const llvm::Value*>,std::allocator<int> >" = type { %"struct.__gnu_cxx::hashtable<std::pair<const llvm::Value* const, int>,const llvm::Value*,__gnu_cxx::hash<const llvm::Value*>,std::_Select1st<std::pair<const llvm::Value* const, int> >,std::equal_to<const llvm::Value*>,std::allocator<int> >" }
+ %"struct.__gnu_cxx::hash_set<const llvm::Constant*,__gnu_cxx::hash<const llvm::Constant*>,std::equal_to<const llvm::Constant*>,std::allocator<const llvm::Constant*> >" = type { %"struct.__gnu_cxx::hashtable<const llvm::Constant*,const llvm::Constant*,__gnu_cxx::hash<const llvm::Constant*>,std::_Identity<const llvm::Constant*>,std::equal_to<const llvm::Constant*>,std::allocator<const llvm::Constant*> >" }
+ %"struct.__gnu_cxx::hashtable<const llvm::Constant*,const llvm::Constant*,__gnu_cxx::hash<const llvm::Constant*>,std::_Identity<const llvm::Constant*>,std::equal_to<const llvm::Constant*>,std::allocator<const llvm::Constant*> >" = type { %struct.__false_type, %struct.__false_type, %struct.__false_type, %struct.__false_type, %"struct.std::vector<__gnu_cxx::_Hashtable_node<const llvm::Constant*>*,std::allocator<const llvm::Constant*> >", i32 }
+ %"struct.__gnu_cxx::hashtable<std::pair<const llvm::Value* const, int>,const llvm::Value*,__gnu_cxx::hash<const llvm::Value*>,std::_Select1st<std::pair<const llvm::Value* const, int> >,std::equal_to<const llvm::Value*>,std::allocator<int> >" = type { %struct.__false_type, %struct.__false_type, %struct.__false_type, %struct.__false_type, %"struct.std::vector<__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >*,std::allocator<int> >", i32 }
+ %"struct.llvm::AbstractTypeUser" = type { i32 (...)** }
+ %"struct.llvm::Annotable" = type { i32 (...)**, %"struct.llvm::Annotation"* }
+ %"struct.llvm::Annotation" = type { i32 (...)**, %"struct.llvm::AnnotationID", %"struct.llvm::Annotation"* }
+ %"struct.llvm::AnnotationID" = type { i32 }
+ %"struct.llvm::Argument" = type { %"struct.llvm::Value", %"struct.llvm::Function"*, %"struct.llvm::Argument"*, %"struct.llvm::Argument"* }
+ %"struct.llvm::BasicBlock" = type { %"struct.llvm::Value", %"struct.llvm::iplist<llvm::Instruction,llvm::ilist_traits<llvm::Instruction> >", %"struct.llvm::BasicBlock"*, %"struct.llvm::BasicBlock"* }
+ %"struct.llvm::Constant" = type opaque
+ %"struct.llvm::DerivedType" = type { %"struct.llvm::Type", %"struct.llvm::AbstractTypeUser", %"struct.std::vector<llvm::AbstractTypeUser*,std::allocator<llvm::AbstractTypeUser*> >" }
+ %"struct.llvm::Function" = type { %"struct.llvm::GlobalValue", %"struct.llvm::Annotable", %"struct.llvm::iplist<llvm::BasicBlock,llvm::ilist_traits<llvm::BasicBlock> >", %"struct.llvm::iplist<llvm::Argument,llvm::ilist_traits<llvm::Argument> >", %"struct.llvm::SymbolTable"*, %"struct.llvm::Function"*, %"struct.llvm::Function"* }
+ %"struct.llvm::FunctionPass" = type { %"struct.llvm::Pass" }
+ %"struct.llvm::FunctionType" = type { %"struct.llvm::DerivedType", i1 }
+ %"struct.llvm::GlobalValue" = type { %"struct.llvm::User", i32, %"struct.llvm::Module"* }
+ %"struct.llvm::Instruction" = type { %"struct.llvm::User", %"struct.llvm::Annotable", %"struct.llvm::BasicBlock"*, %"struct.llvm::Instruction"*, %"struct.llvm::Instruction"*, i32 }
+ %"struct.llvm::IntrinsicLowering" = type opaque
+ %"struct.llvm::MachineBasicBlock" = type { %"struct.llvm::ilist<llvm::MachineInstr>", %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::BasicBlock"* }
+ %"struct.llvm::MachineConstantPool" = type opaque
+ %"struct.llvm::MachineFrameInfo" = type opaque
+ %"struct.llvm::MachineFunction" = type { %"struct.llvm::Annotation", %"struct.llvm::Function"*, %"struct.llvm::TargetMachine"*, %"struct.llvm::iplist<llvm::MachineBasicBlock,llvm::ilist_traits<llvm::MachineBasicBlock> >", %"struct.llvm::SSARegMap"*, %"struct.llvm::MachineFunctionInfo"*, %"struct.llvm::MachineFrameInfo"*, %"struct.llvm::MachineConstantPool"* }
+ %"struct.llvm::MachineFunctionInfo" = type { %"struct.__gnu_cxx::hash_set<const llvm::Constant*,__gnu_cxx::hash<const llvm::Constant*>,std::equal_to<const llvm::Constant*>,std::allocator<const llvm::Constant*> >", %"struct.__gnu_cxx::hash_map<const llvm::Value*,int,__gnu_cxx::hash<const llvm::Value*>,std::equal_to<const llvm::Value*>,std::allocator<int> >", i32, i32, i32, i32, i32, i32, i32, i1, i1, i1, %"struct.llvm::MachineFunction"* }
+ %"struct.llvm::MachineFunctionPass" = type { %"struct.llvm::FunctionPass" }
+ %"struct.llvm::MachineInstr" = type { i16, i8, %"struct.std::vector<llvm::MachineOperand,std::allocator<llvm::MachineOperand> >", %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineBasicBlock"* }
+ %"struct.llvm::MachineInstrBuilder" = type { %"struct.llvm::MachineInstr"* }
+ %"struct.llvm::MachineOperand" = type { %"union.llvm::MachineOperand::._65", i32, i32 }
+ %"struct.llvm::Module" = type opaque
+ %"struct.llvm::PATypeHandle" = type { %"struct.llvm::Type"*, %"struct.llvm::AbstractTypeUser"* }
+ %"struct.llvm::PATypeHolder" = type { %"struct.llvm::Type"* }
+ %"struct.llvm::Pass" = type { i32 (...)**, %"struct.llvm::AbstractTypeUser"*, %"struct.llvm::PassInfo"*, %"struct.std::vector<std::pair<const llvm::PassInfo*, llvm::Pass*>,std::allocator<std::pair<const llvm::PassInfo*, llvm::Pass*> > >" }
+ %"struct.llvm::PassInfo" = type { i8*, i8*, %"struct.std::type_info"*, i8, %"struct.std::vector<const llvm::PassInfo*,std::allocator<const llvm::PassInfo*> >", %"struct.llvm::Pass"* ()*, %"struct.llvm::Pass"* (%"struct.llvm::TargetMachine"*)* }
+ %"struct.llvm::SSARegMap" = type opaque
+ %"struct.llvm::SymbolTable" = type opaque
+ %"struct.llvm::SymbolTableListTraits<llvm::Argument,llvm::Function,llvm::Function,llvm::ilist_traits<llvm::Argument> >" = type { %"struct.llvm::Function"*, %"struct.llvm::Function"* }
+ %"struct.llvm::SymbolTableListTraits<llvm::Instruction,llvm::BasicBlock,llvm::Function,llvm::ilist_traits<llvm::Instruction> >" = type { %"struct.llvm::Function"*, %"struct.llvm::BasicBlock"* }
+ %"struct.llvm::TargetData" = type { %"struct.llvm::FunctionPass", i1, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %"struct.llvm::TargetFrameInfo" = type { i32 (...)**, i32, i32, i32 }
+ %"struct.llvm::TargetInstrDescriptor" = type { i8*, i32, i32, i32, i1, i32, i32, i32, i32, i32, i32*, i32* }
+ %"struct.llvm::TargetInstrInfo" = type { i32 (...)**, %"struct.llvm::TargetInstrDescriptor"*, i32, i32 }
+ %"struct.llvm::TargetMachine" = type { i32 (...)**, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >", %"struct.llvm::TargetData", %"struct.llvm::IntrinsicLowering"* }
+ %"struct.llvm::TargetRegClassInfo" = type { i32 (...)**, i32, i32, i32 }
+ %"struct.llvm::TargetRegInfo" = type { i32 (...)**, %"struct.std::vector<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*> >", %"struct.llvm::TargetMachine"* }
+ %"struct.llvm::Type" = type { %"struct.llvm::Value", i32, i32, i1, i32, %"struct.llvm::Type"*, %"struct.std::vector<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle> >" }
+ %"struct.llvm::Use" = type { %"struct.llvm::Value"*, %"struct.llvm::User"*, %"struct.llvm::Use"*, %"struct.llvm::Use"* }
+ %"struct.llvm::User" = type { %"struct.llvm::Value", %"struct.std::vector<llvm::Use,std::allocator<llvm::Use> >" }
+ %"struct.llvm::Value" = type { i32 (...)**, %"struct.llvm::iplist<llvm::Use,llvm::ilist_traits<llvm::Use> >", %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >", %"struct.llvm::PATypeHolder", i32 }
+ %"struct.llvm::_GLOBAL__N_::InsertPrologEpilogCode" = type { %"struct.llvm::MachineFunctionPass" }
+ %"struct.llvm::ilist<llvm::MachineInstr>" = type { %"struct.llvm::iplist<llvm::MachineInstr,llvm::ilist_traits<llvm::MachineInstr> >" }
+ %"struct.llvm::ilist_iterator<const llvm::MachineBasicBlock>" = type { %"struct.llvm::MachineBasicBlock"* }
+ %"struct.llvm::ilist_traits<llvm::Argument>" = type { %"struct.llvm::SymbolTableListTraits<llvm::Argument,llvm::Function,llvm::Function,llvm::ilist_traits<llvm::Argument> >" }
+ %"struct.llvm::ilist_traits<llvm::Instruction>" = type { %"struct.llvm::SymbolTableListTraits<llvm::Instruction,llvm::BasicBlock,llvm::Function,llvm::ilist_traits<llvm::Instruction> >" }
+ %"struct.llvm::iplist<llvm::Argument,llvm::ilist_traits<llvm::Argument> >" = type { %"struct.llvm::ilist_traits<llvm::Argument>", %"struct.llvm::Argument"*, %"struct.llvm::Argument"* }
+ %"struct.llvm::iplist<llvm::BasicBlock,llvm::ilist_traits<llvm::BasicBlock> >" = type { %"struct.llvm::ilist_traits<llvm::Argument>", %"struct.llvm::BasicBlock"*, %"struct.llvm::BasicBlock"* }
+ %"struct.llvm::iplist<llvm::Instruction,llvm::ilist_traits<llvm::Instruction> >" = type { %"struct.llvm::ilist_traits<llvm::Instruction>", %"struct.llvm::Instruction"*, %"struct.llvm::Instruction"* }
+ %"struct.llvm::iplist<llvm::MachineBasicBlock,llvm::ilist_traits<llvm::MachineBasicBlock> >" = type { %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::MachineBasicBlock"* }
+ %"struct.llvm::iplist<llvm::MachineInstr,llvm::ilist_traits<llvm::MachineInstr> >" = type { %"struct.llvm::ilist_iterator<const llvm::MachineBasicBlock>", %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineInstr"* }
+ %"struct.llvm::iplist<llvm::Use,llvm::ilist_traits<llvm::Use> >" = type { %"struct.llvm::Use"*, %"struct.llvm::Use"* }
+ %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node<const llvm::Constant*>*,std::allocator<const llvm::Constant*>, true>" = type { %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>"**, %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>"**, %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>"** }
+ %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >*,std::allocator<int>, true>" = type { %"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >"**, %"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >"**, %"struct.__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >"** }
+ %"struct.std::_Vector_alloc_base<const llvm::PassInfo*,std::allocator<const llvm::PassInfo*>, true>" = type { %"struct.llvm::PassInfo"**, %"struct.llvm::PassInfo"**, %"struct.llvm::PassInfo"** }
+ %"struct.std::_Vector_alloc_base<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*>, true>" = type { %"struct.llvm::TargetFrameInfo"**, %"struct.llvm::TargetFrameInfo"**, %"struct.llvm::TargetFrameInfo"** }
+ %"struct.std::_Vector_alloc_base<llvm::AbstractTypeUser*,std::allocator<llvm::AbstractTypeUser*>, true>" = type { %"struct.llvm::AbstractTypeUser"**, %"struct.llvm::AbstractTypeUser"**, %"struct.llvm::AbstractTypeUser"** }
+ %"struct.std::_Vector_alloc_base<llvm::MachineInstr*,std::allocator<llvm::MachineInstr*>, true>" = type { %"struct.llvm::MachineInstr"**, %"struct.llvm::MachineInstr"**, %"struct.llvm::MachineInstr"** }
+ %"struct.std::_Vector_alloc_base<llvm::MachineOperand,std::allocator<llvm::MachineOperand>, true>" = type { %"struct.llvm::MachineOperand"*, %"struct.llvm::MachineOperand"*, %"struct.llvm::MachineOperand"* }
+ %"struct.std::_Vector_alloc_base<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle>, true>" = type { %"struct.llvm::PATypeHandle"*, %"struct.llvm::PATypeHandle"*, %"struct.llvm::PATypeHandle"* }
+ %"struct.std::_Vector_alloc_base<llvm::Use,std::allocator<llvm::Use>, true>" = type { %"struct.llvm::Use"*, %"struct.llvm::Use"*, %"struct.llvm::Use"* }
+ %"struct.std::_Vector_alloc_base<std::pair<const llvm::PassInfo*, llvm::Pass*>,std::allocator<std::pair<const llvm::PassInfo*, llvm::Pass*> >, true>" = type { %"struct.std::pair<const llvm::PassInfo*,llvm::Pass*>"*, %"struct.std::pair<const llvm::PassInfo*,llvm::Pass*>"*, %"struct.std::pair<const llvm::PassInfo*,llvm::Pass*>"* }
+ %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node<const llvm::Constant*>*,std::allocator<const llvm::Constant*> >" = type { %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node<const llvm::Constant*>*,std::allocator<const llvm::Constant*>, true>" }
+ %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >*,std::allocator<int> >" = type { %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >*,std::allocator<int>, true>" }
+ %"struct.std::_Vector_base<const llvm::PassInfo*,std::allocator<const llvm::PassInfo*> >" = type { %"struct.std::_Vector_alloc_base<const llvm::PassInfo*,std::allocator<const llvm::PassInfo*>, true>" }
+ %"struct.std::_Vector_base<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*> >" = type { %"struct.std::_Vector_alloc_base<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*>, true>" }
+ %"struct.std::_Vector_base<llvm::AbstractTypeUser*,std::allocator<llvm::AbstractTypeUser*> >" = type { %"struct.std::_Vector_alloc_base<llvm::AbstractTypeUser*,std::allocator<llvm::AbstractTypeUser*>, true>" }
+ %"struct.std::_Vector_base<llvm::MachineInstr*,std::allocator<llvm::MachineInstr*> >" = type { %"struct.std::_Vector_alloc_base<llvm::MachineInstr*,std::allocator<llvm::MachineInstr*>, true>" }
+ %"struct.std::_Vector_base<llvm::MachineOperand,std::allocator<llvm::MachineOperand> >" = type { %"struct.std::_Vector_alloc_base<llvm::MachineOperand,std::allocator<llvm::MachineOperand>, true>" }
+ %"struct.std::_Vector_base<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle> >" = type { %"struct.std::_Vector_alloc_base<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle>, true>" }
+ %"struct.std::_Vector_base<llvm::Use,std::allocator<llvm::Use> >" = type { %"struct.std::_Vector_alloc_base<llvm::Use,std::allocator<llvm::Use>, true>" }
+ %"struct.std::_Vector_base<std::pair<const llvm::PassInfo*, llvm::Pass*>,std::allocator<std::pair<const llvm::PassInfo*, llvm::Pass*> > >" = type { %"struct.std::_Vector_alloc_base<std::pair<const llvm::PassInfo*, llvm::Pass*>,std::allocator<std::pair<const llvm::PassInfo*, llvm::Pass*> >, true>" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" = type { i8* }
+ %"struct.std::pair<const llvm::PassInfo*,llvm::Pass*>" = type { %"struct.llvm::PassInfo"*, %"struct.llvm::Pass"* }
+ %"struct.std::pair<const llvm::Value* const,int>" = type { %"struct.llvm::Value"*, i32 }
+ %"struct.std::type_info" = type { i32 (...)**, i8* }
+ %"struct.std::vector<__gnu_cxx::_Hashtable_node<const llvm::Constant*>*,std::allocator<const llvm::Constant*> >" = type { %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node<const llvm::Constant*>*,std::allocator<const llvm::Constant*> >" }
+ %"struct.std::vector<__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >*,std::allocator<int> >" = type { %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node<std::pair<const llvm::Value* const, int> >*,std::allocator<int> >" }
+ %"struct.std::vector<const llvm::PassInfo*,std::allocator<const llvm::PassInfo*> >" = type { %"struct.std::_Vector_base<const llvm::PassInfo*,std::allocator<const llvm::PassInfo*> >" }
+ %"struct.std::vector<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*> >" = type { %"struct.std::_Vector_base<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*> >" }
+ %"struct.std::vector<llvm::AbstractTypeUser*,std::allocator<llvm::AbstractTypeUser*> >" = type { %"struct.std::_Vector_base<llvm::AbstractTypeUser*,std::allocator<llvm::AbstractTypeUser*> >" }
+ %"struct.std::vector<llvm::MachineInstr*,std::allocator<llvm::MachineInstr*> >" = type { %"struct.std::_Vector_base<llvm::MachineInstr*,std::allocator<llvm::MachineInstr*> >" }
+ %"struct.std::vector<llvm::MachineOperand,std::allocator<llvm::MachineOperand> >" = type { %"struct.std::_Vector_base<llvm::MachineOperand,std::allocator<llvm::MachineOperand> >" }
+ %"struct.std::vector<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle> >" = type { %"struct.std::_Vector_base<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle> >" }
+ %"struct.std::vector<llvm::Use,std::allocator<llvm::Use> >" = type { %"struct.std::_Vector_base<llvm::Use,std::allocator<llvm::Use> >" }
+ %"struct.std::vector<std::pair<const llvm::PassInfo*, llvm::Pass*>,std::allocator<std::pair<const llvm::PassInfo*, llvm::Pass*> > >" = type { %"struct.std::_Vector_base<std::pair<const llvm::PassInfo*, llvm::Pass*>,std::allocator<std::pair<const llvm::PassInfo*, llvm::Pass*> > >" }
+ %"union.llvm::MachineOperand::._65" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* }
+
+declare void @_Znwj()
+
+declare void @_ZN4llvm12MachineInstrC1Esjbb()
+
+declare void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_()
+
+declare void @_ZNK4llvm8Function15getFunctionTypeEv()
+
+declare void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE()
+
+declare void @_ZNK4llvm19MachineInstrBuilder7addSImmEi()
+
+define void @_ZN4llvm11_GLOBAL__N_22InsertPrologEpilogCode20runOnMachineFunctionERNS_15MachineFunctionE(%"struct.llvm::MachineFunction"* %F) {
+entry:
+ %tmp.8.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.0.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=0]
+
+invoke_catch.0.i: ; preds = %invoke_cont.49.i, %invoke_cont.48.i, %invoke_cont.47.i, %invoke_cont.i53.i, %no_exit.i, %invoke_cont.44.i, %invoke_cont.43.i, %invoke_cont.42.i, %invoke_cont.41.i, %invoke_cont.40.i, %invoke_cont.39.i, %invoke_cont.38.i, %invoke_cont.37.i, %then.2.i, %invoke_cont.35.i, %invoke_cont.34.i, %then.1.i, %endif.0.i, %invoke_cont.9.i, %invoke_cont.8.i, %invoke_cont.7.i, %invoke_cont.i.i, %then.0.i, %invoke_cont.4.i, %invoke_cont.3.i, %invoke_cont.2.i, %invoke_cont.1.i, %endif.0.i.i, %tmp.7.i.noexc.i, %invoke_cont.0.i, %entry
+ ret void
+
+invoke_cont.0.i: ; preds = %entry
+ %tmp.7.i1.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %tmp.7.i.noexc.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=2]
+
+tmp.7.i.noexc.i: ; preds = %invoke_cont.0.i
+ %tmp.17.i2.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.7.i1.i )
+ to label %endif.0.i.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+endif.0.i.i: ; preds = %tmp.7.i.noexc.i
+ %tmp.38.i4.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.7.i1.i )
+ to label %tmp.38.i.noexc.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+tmp.38.i.noexc.i: ; preds = %endif.0.i.i
+ br i1 false, label %invoke_cont.1.i, label %then.1.i.i
+
+then.1.i.i: ; preds = %tmp.38.i.noexc.i
+ ret void
+
+invoke_cont.1.i: ; preds = %tmp.38.i.noexc.i
+ %tmp.21.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.2.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
+
+invoke_cont.2.i: ; preds = %invoke_cont.1.i
+ %tmp.28.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.21.i )
+ to label %invoke_cont.3.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+invoke_cont.3.i: ; preds = %invoke_cont.2.i
+ %tmp.36.i = invoke %"struct.llvm::TargetInstrInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.4.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetInstrInfo"*> [#uses=1]
+
+invoke_cont.4.i: ; preds = %invoke_cont.3.i
+ %tmp.43.i = invoke i1 null( %"struct.llvm::TargetInstrInfo"* %tmp.36.i, i16 383, i64 0 )
+ to label %invoke_cont.5.i unwind label %invoke_catch.0.i ; <i1> [#uses=1]
+
+invoke_cont.5.i: ; preds = %invoke_cont.4.i
+ br i1 %tmp.43.i, label %then.0.i, label %else.i
+
+then.0.i: ; preds = %invoke_cont.5.i
+ invoke void @_Znwj( )
+ to label %tmp.0.i.noexc.i unwind label %invoke_catch.0.i
+
+tmp.0.i.noexc.i: ; preds = %then.0.i
+ invoke void @_ZN4llvm12MachineInstrC1Esjbb( )
+ to label %invoke_cont.i.i unwind label %cond_true.i.i
+
+cond_true.i.i: ; preds = %tmp.0.i.noexc.i
+ ret void
+
+invoke_cont.i.i: ; preds = %tmp.0.i.noexc.i
+ invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
+ to label %invoke_cont.7.i unwind label %invoke_catch.0.i
+
+invoke_cont.7.i: ; preds = %invoke_cont.i.i
+ invoke void @_ZNK4llvm19MachineInstrBuilder7addSImmEi( )
+ to label %invoke_cont.8.i unwind label %invoke_catch.0.i
+
+invoke_cont.8.i: ; preds = %invoke_cont.7.i
+ invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
+ to label %invoke_cont.9.i unwind label %invoke_catch.0.i
+
+invoke_cont.9.i: ; preds = %invoke_cont.8.i
+ invoke void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_( )
+ to label %endif.0.i unwind label %invoke_catch.0.i
+
+else.i: ; preds = %invoke_cont.5.i
+ ret void
+
+endif.0.i: ; preds = %invoke_cont.9.i
+ invoke void @_ZNK4llvm8Function15getFunctionTypeEv( )
+ to label %invoke_cont.33.i unwind label %invoke_catch.0.i
+
+invoke_cont.33.i: ; preds = %endif.0.i
+ br i1 false, label %then.1.i, label %endif.1.i
+
+then.1.i: ; preds = %invoke_cont.33.i
+ invoke void @_ZNK4llvm8Function15getFunctionTypeEv( )
+ to label %invoke_cont.34.i unwind label %invoke_catch.0.i
+
+invoke_cont.34.i: ; preds = %then.1.i
+ %tmp.121.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.35.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
+
+invoke_cont.35.i: ; preds = %invoke_cont.34.i
+ %tmp.128.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.121.i )
+ to label %invoke_cont.36.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+invoke_cont.36.i: ; preds = %invoke_cont.35.i
+ br i1 false, label %then.2.i, label %endif.1.i
+
+then.2.i: ; preds = %invoke_cont.36.i
+ %tmp.140.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.37.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=0]
+
+invoke_cont.37.i: ; preds = %then.2.i
+ %tmp.148.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.38.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
+
+invoke_cont.38.i: ; preds = %invoke_cont.37.i
+ %tmp.155.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.148.i, %"struct.llvm::Type"* null, i1 false )
+ to label %invoke_cont.39.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+invoke_cont.39.i: ; preds = %invoke_cont.38.i
+ %tmp.163.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.40.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
+
+invoke_cont.40.i: ; preds = %invoke_cont.39.i
+ %tmp.170.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.163.i )
+ to label %invoke_cont.41.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+invoke_cont.41.i: ; preds = %invoke_cont.40.i
+ %tmp.177.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.42.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
+
+invoke_cont.42.i: ; preds = %invoke_cont.41.i
+ %tmp.184.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.177.i )
+ to label %invoke_cont.43.i unwind label %invoke_catch.0.i ; <i32> [#uses=1]
+
+invoke_cont.43.i: ; preds = %invoke_cont.42.i
+ %tmp.191.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
+ to label %invoke_cont.44.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
+
+invoke_cont.44.i: ; preds = %invoke_cont.43.i
+ %tmp.198.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.191.i, %"struct.llvm::MachineFunction"* %F, i1* null )
+ to label %invoke_cont.45.i unwind label %invoke_catch.0.i ; <i32> [#uses=0]
+
+invoke_cont.45.i: ; preds = %invoke_cont.44.i
+ br i1 false, label %no_exit.i, label %endif.1.i
+
+no_exit.i: ; preds = %invoke_cont.50.i, %invoke_cont.45.i
+ %nextArgOffset.0.i.1 = phi i32 [ %tmp.221.i, %invoke_cont.50.i ], [ 0, %invoke_cont.45.i ] ; <i32> [#uses=1]
+ invoke void @_Znwj( )
+ to label %tmp.0.i.noexc55.i unwind label %invoke_catch.0.i
+
+tmp.0.i.noexc55.i: ; preds = %no_exit.i
+ invoke void @_ZN4llvm12MachineInstrC1Esjbb( )
+ to label %invoke_cont.i53.i unwind label %cond_true.i52.i
+
+cond_true.i52.i: ; preds = %tmp.0.i.noexc55.i
+ ret void
+
+invoke_cont.i53.i: ; preds = %tmp.0.i.noexc55.i
+ invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
+ to label %invoke_cont.47.i unwind label %invoke_catch.0.i
+
+invoke_cont.47.i: ; preds = %invoke_cont.i53.i
+ invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
+ to label %invoke_cont.48.i unwind label %invoke_catch.0.i
+
+invoke_cont.48.i: ; preds = %invoke_cont.47.i
+ invoke void @_ZNK4llvm19MachineInstrBuilder7addSImmEi( )
+ to label %invoke_cont.49.i unwind label %invoke_catch.0.i
+
+invoke_cont.49.i: ; preds = %invoke_cont.48.i
+ invoke void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_( )
+ to label %invoke_cont.50.i unwind label %invoke_catch.0.i
+
+invoke_cont.50.i: ; preds = %invoke_cont.49.i
+ %tmp.221.i = add i32 %nextArgOffset.0.i.1, %tmp.184.i ; <i32> [#uses=1]
+ br i1 false, label %no_exit.i, label %endif.1.i
+
+endif.1.i: ; preds = %invoke_cont.50.i, %invoke_cont.45.i, %invoke_cont.36.i, %invoke_cont.33.i
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll b/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll
new file mode 100644
index 000000000000..b4eb3db19095
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+define void @.outPlank_21() {
+entry:
+ br i1 false, label %loopexit.0, label %no_exit.0
+
+no_exit.0: ; preds = %entry
+ ret void
+
+loopexit.0: ; preds = %entry
+ br i1 false, label %no_exit.1, label %loopexit.1
+
+no_exit.1: ; preds = %loopexit.2, %loopexit.0
+ %i.0.0 = phi i32 [ %inc, %loopexit.2 ], [ 0, %loopexit.0 ] ; <i32> [#uses=1]
+ br i1 false, label %loopexit.2, label %no_exit.2
+
+no_exit.2: ; preds = %no_exit.1
+ ret void
+
+loopexit.2: ; preds = %no_exit.1
+ %inc = add i32 %i.0.0, 1 ; <i32> [#uses=1]
+ br i1 false, label %no_exit.1, label %loopexit.1
+
+loopexit.1: ; preds = %loopexit.2, %loopexit.0
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll b/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll
new file mode 100644
index 000000000000..afee7e189180
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+define void @_ZN5ArrayISt7complexIdEEC2ERK10dim_vector() {
+entry:
+ %tmp.7 = invoke i32 @_ZN5ArrayISt7complexIdEE8get_sizeERK10dim_vector( )
+ to label %invoke_cont.0 unwind label %cond_true.1 ; <i32> [#uses=2]
+
+cond_true.1: ; preds = %entry
+ unwind
+
+invoke_cont.0: ; preds = %entry
+ %tmp.4.i = bitcast i32 %tmp.7 to i32 ; <i32> [#uses=0]
+ %tmp.14.0.i5 = add i32 %tmp.7, -1 ; <i32> [#uses=1]
+ br label %no_exit.i
+
+no_exit.i: ; preds = %no_exit.i, %invoke_cont.0
+ %tmp.14.0.i.0 = phi i32 [ %tmp.14.0.i, %no_exit.i ], [ %tmp.14.0.i5, %invoke_cont.0 ] ; <i32> [#uses=1]
+ %tmp.14.0.i = add i32 %tmp.14.0.i.0, -1 ; <i32> [#uses=1]
+ br label %no_exit.i
+}
+
+declare i32 @_ZN5ArrayISt7complexIdEE8get_sizeERK10dim_vector()
+
diff --git a/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll b/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll
new file mode 100644
index 000000000000..a1beec646891
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll
@@ -0,0 +1,61 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+declare void @q_atomic_increment()
+
+declare void @_Z9qt_assertPKcS0_i()
+
+define void @_ZN13QMetaResourceC1EPKh() {
+entry:
+ invoke void @_Z9qt_assertPKcS0_i( )
+ to label %endif.1 unwind label %then.i.i551
+
+then.i.i551: ; preds = %entry
+ ret void
+
+endif.1: ; preds = %entry
+ br i1 false, label %then.2, label %then.i.i
+
+then.2: ; preds = %endif.1
+ invoke void @q_atomic_increment( )
+ to label %loopentry.0 unwind label %invoke_catch.6
+
+invoke_catch.6: ; preds = %then.2
+ ret void
+
+loopentry.0: ; preds = %then.2
+ br i1 false, label %shortcirc_next.i, label %endif.3
+
+endif.3: ; preds = %loopentry.0
+ ret void
+
+shortcirc_next.i: ; preds = %loopentry.0
+ br i1 false, label %_ZNK7QString2atEi.exit, label %then.i
+
+then.i: ; preds = %shortcirc_next.i
+ ret void
+
+_ZNK7QString2atEi.exit: ; preds = %shortcirc_next.i
+ br i1 false, label %endif.4, label %then.4
+
+then.4: ; preds = %_ZNK7QString2atEi.exit
+ ret void
+
+endif.4: ; preds = %_ZNK7QString2atEi.exit
+ %tmp.115 = load i8* null ; <i8> [#uses=1]
+ br i1 false, label %loopexit.1, label %no_exit.0
+
+no_exit.0: ; preds = %no_exit.0, %endif.4
+ %bytes_in_len.4.5 = phi i8 [ %dec, %no_exit.0 ], [ %tmp.115, %endif.4 ] ; <i8> [#uses=1]
+ %off.5.5.in = phi i32 [ %off.5.5, %no_exit.0 ], [ 0, %endif.4 ] ; <i32> [#uses=1]
+ %off.5.5 = add i32 %off.5.5.in, 1 ; <i32> [#uses=2]
+ %dec = add i8 %bytes_in_len.4.5, -1 ; <i8> [#uses=2]
+ %tmp.123631 = icmp eq i8 %dec, 0 ; <i1> [#uses=1]
+ br i1 %tmp.123631, label %loopexit.1, label %no_exit.0
+
+loopexit.1: ; preds = %no_exit.0, %endif.4
+ %off.5.in.6 = phi i32 [ 0, %endif.4 ], [ %off.5.5, %no_exit.0 ] ; <i32> [#uses=0]
+ ret void
+
+then.i.i: ; preds = %endif.1
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll b/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll
new file mode 100644
index 000000000000..853d5ad50146
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | \
+; RUN: grep {ret i32 152}
+
+define i32 @main() {
+entry:
+ br label %no_exit
+
+no_exit: ; preds = %no_exit, %entry
+ %i.1.0 = phi i32 [ 0, %entry ], [ %inc, %no_exit ] ; <i32> [#uses=2]
+ %tmp.4 = icmp sgt i32 %i.1.0, 50 ; <i1> [#uses=1]
+ %tmp.7 = select i1 %tmp.4, i32 100, i32 0 ; <i32> [#uses=1]
+ %i.0 = add i32 %i.1.0, 1 ; <i32> [#uses=1]
+ %inc = add i32 %i.0, %tmp.7 ; <i32> [#uses=3]
+ %tmp.1 = icmp slt i32 %inc, 100 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %no_exit, label %loopexit
+
+loopexit: ; preds = %no_exit
+ ret i32 %inc
+}
+
diff --git a/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll b/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
new file mode 100644
index 000000000000..ba4db9f95995
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
@@ -0,0 +1,37 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+define void @main() {
+entry:
+ br label %no_exit.1.outer
+
+no_exit.1.outer: ; preds = %endif.0, %entry
+ %l_14237116.1.0.ph = phi i8 [ -46, %entry ], [ 0, %endif.0 ] ; <i8> [#uses=1]
+ %i.0.0.0.ph = phi i32 [ 0, %entry ], [ %inc.1, %endif.0 ] ; <i32> [#uses=1]
+ br label %no_exit.1
+
+no_exit.1: ; preds = %_Z13func_47880058cc.exit, %no_exit.1.outer
+ br i1 false, label %_Z13func_47880058cc.exit, label %then.i
+
+then.i: ; preds = %no_exit.1
+ br label %_Z13func_47880058cc.exit
+
+_Z13func_47880058cc.exit: ; preds = %then.i, %no_exit.1
+ br i1 false, label %then.0, label %no_exit.1
+
+then.0: ; preds = %_Z13func_47880058cc.exit
+ %tmp.6 = bitcast i8 %l_14237116.1.0.ph to i8 ; <i8> [#uses=1]
+ br i1 false, label %endif.0, label %then.1
+
+then.1: ; preds = %then.0
+ br label %endif.0
+
+endif.0: ; preds = %then.1, %then.0
+ %inc.1 = add i32 %i.0.0.0.ph, 1 ; <i32> [#uses=2]
+ %tmp.2 = icmp sgt i32 %inc.1, 99 ; <i1> [#uses=1]
+ br i1 %tmp.2, label %loopexit.0, label %no_exit.1.outer
+
+loopexit.0: ; preds = %endif.0
+ %tmp.28 = zext i8 %tmp.6 to i32 ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll b/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
new file mode 100644
index 000000000000..5ee8cea74a38
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+@fixtab = external global [29 x [29 x [2 x i32]]] ; <[29 x [29 x [2 x i32]]]*> [#uses=1]
+
+define void @init_optabs() {
+entry:
+ br label %no_exit.0
+
+no_exit.0: ; preds = %no_exit.0, %entry
+ %p.0.0 = phi i32* [ getelementptr ([29 x [29 x [2 x i32]]]* @fixtab, i32 0, i32 0, i32 0, i32 0), %entry ], [ %inc.0, %no_exit.0 ] ; <i32*> [#uses=1]
+ %inc.0 = getelementptr i32* %p.0.0, i32 1 ; <i32*> [#uses=1]
+ br i1 false, label %no_exit.0, label %no_exit.1
+
+no_exit.1: ; preds = %no_exit.0
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll b/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll
new file mode 100644
index 000000000000..32abee9d1cc8
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll
@@ -0,0 +1,22 @@
+; PR726
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | \
+; RUN: grep {ret i32 27}
+
+; Make sure to compute the right exit value based on negative strides.
+
+define i32 @test() {
+entry:
+ br label %cond_true
+
+cond_true: ; preds = %cond_true, %entry
+ %a.0.0 = phi i32 [ 10, %entry ], [ %tmp4, %cond_true ] ; <i32> [#uses=2]
+ %b.0.0 = phi i32 [ 0, %entry ], [ %tmp2, %cond_true ] ; <i32> [#uses=1]
+ %tmp2 = add i32 %b.0.0, %a.0.0 ; <i32> [#uses=2]
+ %tmp4 = add i32 %a.0.0, -1 ; <i32> [#uses=2]
+ %tmp = icmp sgt i32 %tmp4, 7 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %bb7
+
+bb7: ; preds = %cond_true
+ ret i32 %tmp2
+}
+
diff --git a/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll b/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll
new file mode 100644
index 000000000000..986831b9a6e4
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+define void @get_block() {
+endif.0:
+ br label %no_exit.30
+
+no_exit.30: ; preds = %no_exit.30, %endif.0
+ %x.12.0 = phi i32 [ %inc.28, %no_exit.30 ], [ -2, %endif.0 ] ; <i32> [#uses=1]
+ %tmp.583 = load i16* null ; <i16> [#uses=1]
+ %tmp.584 = zext i16 %tmp.583 to i32 ; <i32> [#uses=1]
+ %tmp.588 = load i32* null ; <i32> [#uses=1]
+ %tmp.589 = mul i32 %tmp.584, %tmp.588 ; <i32> [#uses=1]
+ %tmp.591 = add i32 %tmp.589, 0 ; <i32> [#uses=1]
+ %inc.28 = add i32 %x.12.0, 1 ; <i32> [#uses=2]
+ %tmp.565 = icmp sgt i32 %inc.28, 3 ; <i1> [#uses=1]
+ br i1 %tmp.565, label %loopexit.30, label %no_exit.30
+
+loopexit.30: ; preds = %no_exit.30
+ %tmp.591.lcssa = phi i32 [ %tmp.591, %no_exit.30 ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll b/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll
new file mode 100644
index 000000000000..6a478ab5f5fd
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll
@@ -0,0 +1,44 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; ModuleID = '2006-09-20-LFTR-Crash.ll'
+ %struct.p7prior_s = type { i32, i32, [200 x float], [200 x [7 x float]], i32, [200 x float], [200 x [20 x float]], i32, [200 x float], [200 x [20 x float]] }
+
+define void @P7DefaultPrior() {
+entry:
+ switch i32 0, label %UnifiedReturnBlock [
+ i32 2, label %bb160
+ i32 3, label %bb
+ ]
+
+bb: ; preds = %entry
+ br i1 false, label %cond_true.i, label %sre_malloc.exit
+
+cond_true.i: ; preds = %bb
+ unreachable
+
+sre_malloc.exit: ; preds = %bb
+ br label %cond_true
+
+cond_true: ; preds = %cond_true66, %cond_true, %sre_malloc.exit
+ %tmp59 = phi i32 [ 1, %sre_malloc.exit ], [ %phitmp, %cond_true66 ], [ %tmp59, %cond_true ] ; <i32> [#uses=2]
+ %indvar245.0.ph = phi i32 [ 0, %sre_malloc.exit ], [ %indvar.next246, %cond_true66 ], [ %indvar245.0.ph, %cond_true ] ; <i32> [#uses=2]
+ br i1 false, label %bb57, label %cond_true
+
+bb57: ; preds = %cond_true
+ %tmp65 = icmp sgt i32 0, %tmp59 ; <i1> [#uses=1]
+ %indvar.next246 = add i32 %indvar245.0.ph, 1 ; <i32> [#uses=2]
+ br i1 %tmp65, label %cond_true66, label %bb69
+
+cond_true66: ; preds = %bb57
+ %q.1.0 = bitcast i32 %indvar.next246 to i32 ; <i32> [#uses=1]
+ %phitmp = add i32 %q.1.0, 1 ; <i32> [#uses=1]
+ br label %cond_true
+
+bb69: ; preds = %bb57
+ ret void
+
+bb160: ; preds = %entry
+ ret void
+
+UnifiedReturnBlock: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll b/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
new file mode 100644
index 000000000000..903e81d3bf96
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8"
+ %struct.vorbis_dsp_state = type { i32, %struct.vorbis_info*, float**, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
+ %struct.vorbis_info = type { i32, i32, i32, i32, i32, i32, i32, i8* }
+
+define void @_ve_envelope_search() {
+entry:
+ br i1 false, label %cond_true27, label %bb137
+
+cond_true27: ; preds = %entry
+ br i1 false, label %cond_true52, label %bb80
+
+cond_true52: ; preds = %cond_true27
+ %tmp152.i = bitcast float 0.000000e+00 to i32 ; <i32> [#uses=1]
+ br label %cond_next182.i
+
+cond_next182.i: ; preds = %cond_next182.i, %cond_true52
+ %decay.i.0 = phi i32 [ %tmp195.i.upgrd.1, %cond_next182.i ], [ %tmp152.i, %cond_true52 ] ; <i32> [#uses=1]
+ %tmp194.i53 = bitcast i32 %decay.i.0 to float ; <float> [#uses=1]
+ %tmp195.i = sub float %tmp194.i53, 8.000000e+00 ; <float> [#uses=1]
+ %tmp195.i.upgrd.1 = bitcast float %tmp195.i to i32 ; <i32> [#uses=1]
+ br i1 false, label %cond_next182.i, label %bb418.i.preheader
+
+bb418.i.preheader: ; preds = %cond_next182.i
+ ret void
+
+bb80: ; preds = %cond_true27
+ ret void
+
+bb137: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll b/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll
new file mode 100644
index 000000000000..dd151e84d00e
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll
@@ -0,0 +1,38 @@
+; PR1015
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep {ret i32 0}
+
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8"
+@foo = internal constant [5 x i8] c"\00abc\00" ; <[5 x i8]*> [#uses=1]
+@str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+
+define i32 @test(i32 %J) {
+entry:
+ br label %bb2
+
+bb: ; preds = %cond_next, %cond_true
+ %tmp1 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb2
+
+bb2: ; preds = %bb, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %tmp1, %bb ] ; <i32> [#uses=4]
+ %tmp = icmp eq i32 %i.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %cond_next
+
+cond_true: ; preds = %bb2
+ br label %bb
+
+cond_next: ; preds = %bb2
+ %tmp2 = getelementptr [5 x i8]* @foo, i32 0, i32 %i.0 ; <i8*> [#uses=1]
+ %tmp3 = load i8* %tmp2 ; <i8> [#uses=1]
+ %tmp5 = icmp eq i8 %tmp3, 0 ; <i1> [#uses=1]
+ br i1 %tmp5, label %bb6, label %bb
+
+bb6: ; preds = %cond_next
+ br label %return
+
+return: ; preds = %bb6
+ ret i32 %i.0
+}
+
diff --git a/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll b/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll
new file mode 100644
index 000000000000..7078494a9295
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep {(%rdi,%rax,8)}
+; RUN: llvm-as < %s | llc -march=x86-64 | not grep {addq.*8}
+
+define void @foo(double* %y) nounwind {
+entry:
+ br label %bb
+
+bb:
+ %i = phi i64 [ 0, %entry ], [ %k, %bb ]
+ %j = getelementptr double* %y, i64 %i
+ store double 0.000000e+00, double* %j
+ %k = add i64 %i, 1
+ %n = icmp eq i64 %k, 0
+ br i1 %n, label %return, label %bb
+
+return:
+ ret void
+}
+
diff --git a/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll b/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
new file mode 100644
index 000000000000..363c98c493bf
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
@@ -0,0 +1,117 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; PR1487
+
+ %struct.AVClass = type { i8*, i8* (i8*)*, %struct.AVOption* }
+ %struct.AVCodec = type { i8*, i32, i32, i32, i32 (%struct.AVCodecContext*)*, i32 (%struct.AVCodecContext*, i8*, i32, i8*)*, i32 (%struct.AVCodecContext*)*, i32 (%struct.AVCodecContext*, i8*, i32*, i8*, i32)*, i32, %struct.AVCodec*, void (%struct.AVCodecContext*)*, %struct.AVCodecTag*, i32* }
+ %struct.AVCodecContext = type { %struct.AVClass*, i32, i32, i32, i32, i32, i8*, i32, %struct.AVCodecTag, i32, i32, i32, i32, i32, void (%struct.AVCodecContext*, %struct.AVFrame*, i32*, i32, i32, i32)*, i32, i32, i32, i32, i32, i32, i32, float, float, i32, i32, i32, i32, float, i32, i32, i32, %struct.AVCodec*, i8*, i32, i32, void (%struct.AVCodecContext*, i8*, i32, i32)*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, [32 x i8], i32, i32, i32, i32, i32, i32, i32, float, i32, i32 (%struct.AVCodecContext*, %struct.AVFrame*)*, void (%struct.AVCodecContext*, %struct.AVFrame*)*, i32, i32, i32, i32, i8*, i8*, float, float, i32, %struct.RcOverride*, i32, i8*, i32, i32, i32, float, float, float, float, i32, float, float, float, float, float, i32, i32, i32, i32*, i32, i32, i32, i32, %struct.AVCodecTag, %struct.AVFrame*, i32, i32, [4 x i64], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 (%struct.AVCodecContext*, i32*)*, i32, i32, i32, i32, i32, i32, i8*, i32, i32, i32, i32, i32, i32, i16*, i16*, i32, i32, i32, i32, %struct.AVPaletteControl*, i32, i32 (%struct.AVCodecContext*, %struct.AVFrame*)*, i32, i32, i32, i32, i32, i32, i32, i32 (%struct.AVCodecContext*, i32 (%struct.AVCodecContext*, i8*)*, i8**, i32*, i32)*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64 }
+ %struct.AVCodecTag = type { i32, i32 }
+ %struct.AVFrame = type { [4 x i8*], [4 x i32], [4 x i8*], i32, i32, i64, i32, i32, i32, i32, i32, i8*, i32, i8*, [2 x [2 x i16]*], i32*, i8, i8*, [4 x i64], i32, i32, i32, i32, i32, %struct.AVPanScan*, i32, i32, i16*, [2 x i8*] }
+ %struct.AVOption = type { i8*, i8*, i32, i32, double, double, double, i32, i8* }
+ %struct.AVPaletteControl = type { i32, [256 x i32] }
+ %struct.AVPanScan = type { i32, i32, i32, [3 x [2 x i16]] }
+ %struct.RcOverride = type { i32, i32, i32, float }
+
+define i32 @smc_decode_frame(%struct.AVCodecContext* %avctx, i8* %data, i32* %data_size, i8* %buf, i32 %buf_size) {
+entry:
+ br i1 false, label %cond_next, label %cond_true
+
+cond_true: ; preds = %entry
+ ret i32 -1
+
+cond_next: ; preds = %entry
+ br i1 false, label %bb.outer5.split.split.split.us, label %cond_true194.split
+
+bb.outer5.split.split.split.us: ; preds = %cond_next
+ br i1 false, label %cond_next188.us503.us, label %bb.us481
+
+bb275.us493.us: ; preds = %cond_next188.us503.us, %cond_next188.us503.us
+ ret i32 0
+
+cond_next188.us503.us: ; preds = %bb.outer5.split.split.split.us
+ switch i32 0, label %bb1401 [
+ i32 0, label %cond_next202.bb215_crit_edge.split
+ i32 16, label %bb215
+ i32 32, label %bb275.us493.us
+ i32 48, label %bb275.us493.us
+ i32 64, label %cond_next202.bb417_crit_edge.split
+ i32 80, label %bb417
+ i32 96, label %cond_next202.bb615_crit_edge.split
+ i32 112, label %bb615
+ i32 128, label %cond_next202.bb716_crit_edge.split
+ i32 144, label %bb716
+ i32 160, label %cond_next202.bb882_crit_edge.split
+ i32 176, label %bb882
+ i32 192, label %cond_next202.bb1062_crit_edge.split
+ i32 208, label %bb1062
+ i32 224, label %bb1326.us.outer.outer
+ ]
+
+bb.us481: ; preds = %bb.outer5.split.split.split.us
+ ret i32 0
+
+cond_true194.split: ; preds = %cond_next
+ ret i32 %buf_size
+
+cond_next202.bb1062_crit_edge.split: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+cond_next202.bb882_crit_edge.split: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+cond_next202.bb716_crit_edge.split: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+cond_next202.bb615_crit_edge.split: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+cond_next202.bb417_crit_edge.split: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+cond_next202.bb215_crit_edge.split: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb215: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb417: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb615: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb716: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb882: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb1062: ; preds = %cond_next188.us503.us
+ ret i32 0
+
+bb1326.us: ; preds = %bb1326.us.outer.outer, %bb1347.loopexit.us, %bb1326.us
+ %pixel_y.162036.us.ph = phi i32 [ %tmp1352.us, %bb1347.loopexit.us ], [ 0, %bb1326.us.outer.outer ], [ %pixel_y.162036.us.ph, %bb1326.us ] ; <i32> [#uses=2]
+ %stream_ptr.142038.us.ph = phi i32 [ %tmp1339.us, %bb1347.loopexit.us ], [ %stream_ptr.142038.us.ph.ph, %bb1326.us.outer.outer ], [ %stream_ptr.142038.us.ph, %bb1326.us ] ; <i32> [#uses=2]
+ %pixel_x.232031.us = phi i32 [ %tmp1341.us, %bb1326.us ], [ 0, %bb1326.us.outer.outer ], [ 0, %bb1347.loopexit.us ] ; <i32> [#uses=3]
+ %block_ptr.222030.us = add i32 0, %pixel_x.232031.us ; <i32> [#uses=1]
+ %stream_ptr.132032.us = add i32 %pixel_x.232031.us, %stream_ptr.142038.us.ph ; <i32> [#uses=1]
+ %tmp1341.us = add i32 %pixel_x.232031.us, 1 ; <i32> [#uses=2]
+ %tmp1344.us = icmp slt i32 %tmp1341.us, 4 ; <i1> [#uses=1]
+ br i1 %tmp1344.us, label %bb1326.us, label %bb1347.loopexit.us
+
+bb1347.loopexit.us: ; preds = %bb1326.us
+ %tmp1339.us = add i32 %stream_ptr.132032.us, 1 ; <i32> [#uses=2]
+ %tmp1337.us = add i32 %block_ptr.222030.us, 1 ; <i32> [#uses=0]
+ %tmp1352.us = add i32 %pixel_y.162036.us.ph, 1 ; <i32> [#uses=2]
+ %tmp1355.us = icmp slt i32 %tmp1352.us, 4 ; <i1> [#uses=1]
+ br i1 %tmp1355.us, label %bb1326.us, label %bb1358
+
+bb1358: ; preds = %bb1347.loopexit.us
+ br label %bb1326.us.outer.outer
+
+bb1326.us.outer.outer: ; preds = %bb1358, %cond_next188.us503.us
+ %stream_ptr.142038.us.ph.ph = phi i32 [ %tmp1339.us, %bb1358 ], [ 0, %cond_next188.us503.us ] ; <i32> [#uses=1]
+ br label %bb1326.us
+
+bb1401: ; preds = %cond_next188.us503.us
+ ret i32 0
+}
diff --git a/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll b/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll
new file mode 100644
index 000000000000..555cadda6de3
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; PR1814
+target datalayout = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32"
+
+define void @FuncAt1938470480(i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i1, i1, i1, i1, i1, i1) {
+EntryBlock:
+ br label %asmBlockAt738ab7f3
+
+asmBlockAt738ab9b0: ; preds = %asmBlockAt738ab7f3
+ %.lcssa6 = phi i64 [ %23, %asmBlockAt738ab7f3 ] ; <i64> [#uses=0]
+ ret void
+
+asmBlockAt738ab7f3: ; preds = %asmBlockAt738ab7f3, %EntryBlock
+ %ebp95 = phi i32 [ 128, %EntryBlock ], [ %24, %asmBlockAt738ab7f3 ] ; <i32> [#uses=2]
+ sub <4 x i16> zeroinitializer, zeroinitializer ; <<4 x i16>>:22 [#uses=1]
+ bitcast <4 x i16> %22 to i64 ; <i64>:23 [#uses=1]
+ add i32 %ebp95, -64 ; <i32>:24 [#uses=1]
+ icmp ult i32 %ebp95, 64 ; <i1>:25 [#uses=1]
+ br i1 %25, label %asmBlockAt738ab9b0, label %asmBlockAt738ab7f3
+}
diff --git a/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll b/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll
new file mode 100644
index 000000000000..aac8d9789464
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; PR2434
+
+define fastcc void @regcppop() nounwind {
+entry:
+ %tmp61 = add i32 0, -5 ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %PL_savestack_ix.tmp.0 = phi i32 [ %tmp61, %entry ], [ %tmp127, %bb ] ; <i32> [#uses=2]
+ %indvar10 = phi i32 [ 0, %entry ], [ %indvar.next11, %bb ] ; <i32> [#uses=2]
+ %tmp13 = mul i32 %indvar10, -4 ; <i32> [#uses=0]
+ %tmp111 = add i32 %PL_savestack_ix.tmp.0, -3 ; <i32> [#uses=0]
+ %tmp127 = add i32 %PL_savestack_ix.tmp.0, -4 ; <i32> [#uses=1]
+ %indvar.next11 = add i32 %indvar10, 1 ; <i32> [#uses=1]
+ br label %bb
+}
diff --git a/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll b/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll
new file mode 100644
index 000000000000..8111cbe3a489
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep sext | count 1
+; ModuleID = '<stdin>'
+
+ %struct.App1Marker = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }>
+ %struct.ComponentInstanceRecord = type <{ [1 x i32] }>
+ %struct.DCPredictors = type { [5 x i16] }
+ %struct.DecodeTable = type { i16, i16, i16, i16, i8**, i8** }
+ %struct.ICMDataProcRecord = type <{ i16 (i8**, i32, i32)*, i32 }>
+ %struct.JPEGBitStream = type { i8*, i32, i32, i32, i32, i32, %struct.App1Marker*, i8*, i32, i16, i16, i32 }
+ %struct.JPEGGlobals = type { [2048 x i8], %struct.JPEGBitStream, i8*, i32, i32, %struct.ComponentInstanceRecord*, %struct.ComponentInstanceRecord*, i32, %struct.OpaqueQTMLMutex*, %struct.Rect, i32, i32, %struct.SharedGlobals, %struct.DCPredictors, i8, i8, void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, %struct.YUVGeneralParams, i16, i16, i32, [5 x i16*], [5 x %struct.DecodeTable*], [5 x %struct.DecodeTable*], [5 x i8], [5 x i8], [4 x [65 x i16]], [4 x %struct.DecodeTable], [4 x %struct.DecodeTable], [4 x i8*], [4 x i8*], i16, i16, i32, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, [18 x i8], [18 x i8], [18 x i8], [18 x i8], i32, i32, i8**, i8**, i8, i8, i8, i8, i16, i16, %struct.App1Marker*, i8, i8, i8, i8, i32**, i8*, i16*, i8*, i16*, i8, [3 x i8], i32, [3 x i32], [3 x i32], [3 x i32], [3 x i32], [3 x i32], [3 x i16*], [3 x i16*], [3 x i8**], [3 x %struct.DecodeTable*], [3 x %struct.DecodeTable*], [3 x i32], i32, [3 x i16*], i32, i32, i32, [3 x i32], i8, i8, i8, i8, %struct.ICMDataProcRecord*, i32, i32, i8**, i8**, i8**, i8**, i32, i32, i8*, i32, i32, i16*, i16*, i8*, i32, i32, i32, i32, i32, i32, i32, [16 x <2 x i64>], [1280 x i8], i8 }
+ %struct.OpaqueQTMLMutex = type opaque
+ %struct.Rect = type { i16, i16, i16, i16 }
+ %struct.SharedDGlobals = type { %struct.DecodeTable, %struct.DecodeTable, %struct.DecodeTable, %struct.DecodeTable }
+ %struct.SharedEGlobals = type { i8**, i8**, i8**, i8** }
+ %struct.SharedGlobals = type { %struct.SharedEGlobals*, %struct.SharedDGlobals* }
+ %struct.YUVGeneralParams = type { i16*, i8*, i8*, i8*, i8*, i8*, void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, i16, i16, i16, [6 x i8], void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, i16, i16 }
+@llvm.used = appending global [1 x i8*] [ i8* bitcast (i16 (%struct.JPEGGlobals*)* @ExtractBufferedBlocksIgnored to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
+
+define i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) signext nounwind {
+entry:
+ %tmp4311 = getelementptr %struct.JPEGGlobals* %globp, i32 0, i32 70 ; <i32*> [#uses=1]
+ %tmp4412 = load i32* %tmp4311, align 16 ; <i32> [#uses=2]
+ %tmp4613 = icmp sgt i32 %tmp4412, 0 ; <i1> [#uses=1]
+ br i1 %tmp4613, label %bb, label %bb49
+
+bb: ; preds = %bb28, %entry
+ %component.09 = phi i16 [ 0, %entry ], [ %tmp37, %bb28 ] ; <i16> [#uses=2]
+ %tmp12 = sext i16 %component.09 to i32 ; <i32> [#uses=2]
+ %tmp6 = getelementptr %struct.JPEGGlobals* %globp, i32 0, i32 77, i32 %tmp12 ; <i16**> [#uses=2]
+ %tmp7 = load i16** %tmp6, align 4 ; <i16*> [#uses=2]
+ %tmp235 = getelementptr %struct.JPEGGlobals* %globp, i32 0, i32 71, i32 %tmp12 ; <i32*> [#uses=1]
+ %tmp246 = load i32* %tmp235, align 4 ; <i32> [#uses=2]
+ %tmp267 = icmp sgt i32 %tmp246, 0 ; <i1> [#uses=1]
+ br i1 %tmp267, label %bb8, label %bb28
+
+bb8: ; preds = %bb8, %bb
+ %indvar = phi i32 [ 0, %bb ], [ %indvar.next2, %bb8 ] ; <i32> [#uses=3]
+ %theDCTBufferIter.01.rec = shl i32 %indvar, 6 ; <i32> [#uses=1]
+ %tmp10.rec = add i32 %theDCTBufferIter.01.rec, 64 ; <i32> [#uses=1]
+ %tmp10 = getelementptr i16* %tmp7, i32 %tmp10.rec ; <i16*> [#uses=1]
+ %i.02 = trunc i32 %indvar to i16 ; <i16> [#uses=1]
+ %tmp13 = add i16 %i.02, 1 ; <i16> [#uses=1]
+ %phitmp = sext i16 %tmp13 to i32 ; <i32> [#uses=1]
+ %tmp26 = icmp slt i32 %phitmp, %tmp246 ; <i1> [#uses=1]
+ %indvar.next2 = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp26, label %bb8, label %bb28
+
+bb28: ; preds = %bb8, %bb
+ %theDCTBufferIter.0.lcssa = phi i16* [ %tmp7, %bb ], [ %tmp10, %bb8 ] ; <i16*> [#uses=1]
+ store i16* %theDCTBufferIter.0.lcssa, i16** %tmp6, align 4
+ %tmp37 = add i16 %component.09, 1 ; <i16> [#uses=2]
+ %phitmp15 = sext i16 %tmp37 to i32 ; <i32> [#uses=1]
+ %tmp46 = icmp slt i32 %phitmp15, 42 ; <i1> [#uses=1]
+ br i1 %tmp46, label %bb, label %bb49
+
+bb49: ; preds = %bb28, %entry
+ ret i16 0
+}
diff --git a/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll b/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
new file mode 100644
index 000000000000..c78188d4d223
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -indvars
+; PR2857
+
+@foo = external global i32 ; <i32*> [#uses=1]
+
+define void @test(i32 %n, i32 %arg) {
+entry:
+ br i1 false, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ %0 = load i32* @foo, align 4 ; <i32> [#uses=1]
+ %1 = sext i32 %0 to i64 ; <i64> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %.in = phi i32 [ %2, %bb ], [ %n, %bb.nph ] ; <i32> [#uses=1]
+ %val.02 = phi i64 [ %5, %bb ], [ 0, %bb.nph ] ; <i64> [#uses=2]
+ %result.01 = phi i64 [ %4, %bb ], [ 0, %bb.nph ] ; <i64> [#uses=1]
+ %2 = add i32 %.in, -1 ; <i32> [#uses=2]
+ %3 = mul i64 %1, %val.02 ; <i64> [#uses=1]
+ %4 = add i64 %3, %result.01 ; <i64> [#uses=2]
+ %5 = add i64 %val.02, 1 ; <i64> [#uses=1]
+ %6 = icmp sgt i32 %2, 0 ; <i1> [#uses=1]
+ br i1 %6, label %bb, label %bb3.bb4_crit_edge
+
+bb3.bb4_crit_edge: ; preds = %bb
+ %.lcssa = phi i64 [ %4, %bb ] ; <i64> [#uses=0]
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll b/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll
new file mode 100644
index 000000000000..6fc065f83f63
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll
@@ -0,0 +1,65 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep icmp | count 4
+define void @bar() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
+ %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
+ %1 = add double %x.0.reg2mem.0, 1.000000e+00 ; <double> [#uses=2]
+ %2 = fcmp olt double %1, 1.000000e+04 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+declare i32 @foo(double)
+
+define void @bar2() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %x.0.reg2mem.0 = phi double [ -10.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
+ %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
+ %1 = add double %x.0.reg2mem.0, 2.000000e+00 ; <double> [#uses=2]
+ %2 = fcmp olt double %1, -1.000000e+00 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+
+define void @bar3() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
+ %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
+ %1 = add double %x.0.reg2mem.0, 1.000000e+00 ; <double> [#uses=2]
+ %2 = fcmp olt double %1, -1.000000e+00 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+define void @bar4() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %x.0.reg2mem.0 = phi double [ 40.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
+ %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
+ %1 = add double %x.0.reg2mem.0, -1.000000e+00 ; <double> [#uses=2]
+ %2 = fcmp olt double %1, 1.000000e+00 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+
diff --git a/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll b/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll
new file mode 100644
index 000000000000..faf1da3058c4
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep icmp | count 2
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep sitofp | count 1
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep uitofp | count 1
+
+define void @bar() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
+ %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
+ %1 = add double %x.0.reg2mem.0, 1.0e+0 ; <double> [#uses=2]
+ %2 = fcmp olt double %1, 2147483646.0e+0 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+define void @bar1() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %x.0.reg2mem.0 = phi double [ 0.000000e+00, %entry ], [ %1, %bb ] ; <double> [#uses=2]
+ %0 = tail call i32 @foo(double %x.0.reg2mem.0) nounwind ; <i32> [#uses=0]
+ %1 = add double %x.0.reg2mem.0, 1.0e+0 ; <double> [#uses=2]
+ %2 = fcmp olt double %1, 2147483647.0e+0 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+declare i32 @foo(double)
diff --git a/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll b/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll
new file mode 100644
index 000000000000..9fd0eb9e65ae
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -indvars
+
+define void @t() nounwind {
+entry:
+ br label %bb23.i91
+
+bb23.i91: ; preds = %bb23.i91, %entry
+ %result.0.i89 = phi ppc_fp128 [ 0xM00000000000000000000000000000000, %entry ], [ %0, %bb23.i91 ] ; <ppc_fp128> [#uses=2]
+ %0 = mul ppc_fp128 %result.0.i89, %result.0.i89 ; <ppc_fp128> [#uses=1]
+ br label %bb23.i91
+}
diff --git a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll
new file mode 100644
index 000000000000..134c9c74d3a9
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll
@@ -0,0 +1,114 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep {sext}
+; ModuleID = '<stdin>'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin9.6"
+@a = external global i32* ; <i32**> [#uses=3]
+@b = external global i32* ; <i32**> [#uses=3]
+@c = external global i32* ; <i32**> [#uses=3]
+@d = external global i32* ; <i32**> [#uses=3]
+@e = external global i32* ; <i32**> [#uses=3]
+@f = external global i32* ; <i32**> [#uses=3]
+
+define void @foo() nounwind {
+bb1.thread:
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %i.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %84, %bb1 ] ; <i32> [#uses=19]
+ %0 = load i32** @a, align 8 ; <i32*> [#uses=1]
+ %1 = load i32** @b, align 8 ; <i32*> [#uses=1]
+ %2 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %3 = getelementptr i32* %1, i64 %2 ; <i32*> [#uses=1]
+ %4 = load i32* %3, align 1 ; <i32> [#uses=1]
+ %5 = load i32** @c, align 8 ; <i32*> [#uses=1]
+ %6 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %7 = getelementptr i32* %5, i64 %6 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 1 ; <i32> [#uses=1]
+ %9 = add i32 %8, %4 ; <i32> [#uses=1]
+ %10 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %11 = getelementptr i32* %0, i64 %10 ; <i32*> [#uses=1]
+ store i32 %9, i32* %11, align 1
+ %12 = load i32** @a, align 8 ; <i32*> [#uses=1]
+ %13 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %14 = load i32** @b, align 8 ; <i32*> [#uses=1]
+ %15 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %16 = sext i32 %15 to i64 ; <i64> [#uses=1]
+ %17 = getelementptr i32* %14, i64 %16 ; <i32*> [#uses=1]
+ %18 = load i32* %17, align 1 ; <i32> [#uses=1]
+ %19 = load i32** @c, align 8 ; <i32*> [#uses=1]
+ %20 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %21 = sext i32 %20 to i64 ; <i64> [#uses=1]
+ %22 = getelementptr i32* %19, i64 %21 ; <i32*> [#uses=1]
+ %23 = load i32* %22, align 1 ; <i32> [#uses=1]
+ %24 = add i32 %23, %18 ; <i32> [#uses=1]
+ %25 = sext i32 %13 to i64 ; <i64> [#uses=1]
+ %26 = getelementptr i32* %12, i64 %25 ; <i32*> [#uses=1]
+ store i32 %24, i32* %26, align 1
+ %27 = load i32** @a, align 8 ; <i32*> [#uses=1]
+ %28 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %29 = load i32** @b, align 8 ; <i32*> [#uses=1]
+ %30 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %31 = sext i32 %30 to i64 ; <i64> [#uses=1]
+ %32 = getelementptr i32* %29, i64 %31 ; <i32*> [#uses=1]
+ %33 = load i32* %32, align 1 ; <i32> [#uses=1]
+ %34 = load i32** @c, align 8 ; <i32*> [#uses=1]
+ %35 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %36 = sext i32 %35 to i64 ; <i64> [#uses=1]
+ %37 = getelementptr i32* %34, i64 %36 ; <i32*> [#uses=1]
+ %38 = load i32* %37, align 1 ; <i32> [#uses=1]
+ %39 = add i32 %38, %33 ; <i32> [#uses=1]
+ %40 = sext i32 %28 to i64 ; <i64> [#uses=1]
+ %41 = getelementptr i32* %27, i64 %40 ; <i32*> [#uses=1]
+ store i32 %39, i32* %41, align 1
+ %42 = load i32** @d, align 8 ; <i32*> [#uses=1]
+ %43 = load i32** @e, align 8 ; <i32*> [#uses=1]
+ %44 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %45 = getelementptr i32* %43, i64 %44 ; <i32*> [#uses=1]
+ %46 = load i32* %45, align 1 ; <i32> [#uses=1]
+ %47 = load i32** @f, align 8 ; <i32*> [#uses=1]
+ %48 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %49 = getelementptr i32* %47, i64 %48 ; <i32*> [#uses=1]
+ %50 = load i32* %49, align 1 ; <i32> [#uses=1]
+ %51 = add i32 %50, %46 ; <i32> [#uses=1]
+ %52 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %53 = getelementptr i32* %42, i64 %52 ; <i32*> [#uses=1]
+ store i32 %51, i32* %53, align 1
+ %54 = load i32** @d, align 8 ; <i32*> [#uses=1]
+ %55 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %56 = load i32** @e, align 8 ; <i32*> [#uses=1]
+ %57 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %58 = sext i32 %57 to i64 ; <i64> [#uses=1]
+ %59 = getelementptr i32* %56, i64 %58 ; <i32*> [#uses=1]
+ %60 = load i32* %59, align 1 ; <i32> [#uses=1]
+ %61 = load i32** @f, align 8 ; <i32*> [#uses=1]
+ %62 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %63 = sext i32 %62 to i64 ; <i64> [#uses=1]
+ %64 = getelementptr i32* %61, i64 %63 ; <i32*> [#uses=1]
+ %65 = load i32* %64, align 1 ; <i32> [#uses=1]
+ %66 = add i32 %65, %60 ; <i32> [#uses=1]
+ %67 = sext i32 %55 to i64 ; <i64> [#uses=1]
+ %68 = getelementptr i32* %54, i64 %67 ; <i32*> [#uses=1]
+ store i32 %66, i32* %68, align 1
+ %69 = load i32** @d, align 8 ; <i32*> [#uses=1]
+ %70 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %71 = load i32** @e, align 8 ; <i32*> [#uses=1]
+ %72 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %73 = sext i32 %72 to i64 ; <i64> [#uses=1]
+ %74 = getelementptr i32* %71, i64 %73 ; <i32*> [#uses=1]
+ %75 = load i32* %74, align 1 ; <i32> [#uses=1]
+ %76 = load i32** @f, align 8 ; <i32*> [#uses=1]
+ %77 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %78 = sext i32 %77 to i64 ; <i64> [#uses=1]
+ %79 = getelementptr i32* %76, i64 %78 ; <i32*> [#uses=1]
+ %80 = load i32* %79, align 1 ; <i32> [#uses=1]
+ %81 = add i32 %80, %75 ; <i32> [#uses=1]
+ %82 = sext i32 %70 to i64 ; <i64> [#uses=1]
+ %83 = getelementptr i32* %69, i64 %82 ; <i32*> [#uses=1]
+ store i32 %81, i32* %83, align 1
+ %84 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %85 = icmp sgt i32 %84, 23646 ; <i1> [#uses=1]
+ br i1 %85, label %return, label %bb1
+
+return: ; preds = %bb1
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll
new file mode 100644
index 000000000000..4d26803b437d
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll
@@ -0,0 +1,160 @@
+; RUN: llvm-as < %s | opt -indvars -instcombine | llvm-dis | not grep {\[sz\]ext}
+; ModuleID = '<stdin>'
+;extern int *a, *b, *c, *d, *e, *f; /* 64 bit */
+;extern int K[256];
+;void foo () {
+; int i;
+; for (i=0; i<23647; i++) {
+; a[(i&15)] = b[i&15]+c[i&15];
+; a[(i+1)&15] = b[(i+1)&15]+c[(i+1)&15];
+; a[(i+2)&15] = b[(i+2)&15]+c[(i+2)&15];
+; d[i&15] = e[i&15]+f[i&15] +K[i];
+; d[(i+1)&15] = e[(i+1)&15]+f[(i+1)&15]+K[i+1];
+; d[(i+2)&15] = e[(i+2)&15]+f[(i+2)&15]+K[i+2];
+; }
+;}
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin9.6"
+@a = external global i32* ; <i32**> [#uses=3]
+@b = external global i32* ; <i32**> [#uses=3]
+@c = external global i32* ; <i32**> [#uses=3]
+@d = external global i32* ; <i32**> [#uses=3]
+@e = external global i32* ; <i32**> [#uses=3]
+@f = external global i32* ; <i32**> [#uses=3]
+@K = external global [256 x i32] ; <[256 x i32]*> [#uses=3]
+
+define void @foo() nounwind {
+bb1.thread:
+ br label %bb1
+
+bb1: ; preds = %bb1, %bb1.thread
+ %i.0.reg2mem.0 = phi i32 [ 0, %bb1.thread ], [ %116, %bb1 ] ; <i32> [#uses=22]
+ %0 = load i32** @a, align 8 ; <i32*> [#uses=1]
+ %1 = and i32 %i.0.reg2mem.0, 15 ; <i32> [#uses=1]
+ %2 = load i32** @b, align 8 ; <i32*> [#uses=1]
+ %3 = and i32 %i.0.reg2mem.0, 15 ; <i32> [#uses=1]
+ %4 = zext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr i32* %2, i64 %4 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 1 ; <i32> [#uses=1]
+ %7 = load i32** @c, align 8 ; <i32*> [#uses=1]
+ %8 = and i32 %i.0.reg2mem.0, 15 ; <i32> [#uses=1]
+ %9 = zext i32 %8 to i64 ; <i64> [#uses=1]
+ %10 = getelementptr i32* %7, i64 %9 ; <i32*> [#uses=1]
+ %11 = load i32* %10, align 1 ; <i32> [#uses=1]
+ %12 = add i32 %11, %6 ; <i32> [#uses=1]
+ %13 = zext i32 %1 to i64 ; <i64> [#uses=1]
+ %14 = getelementptr i32* %0, i64 %13 ; <i32*> [#uses=1]
+ store i32 %12, i32* %14, align 1
+ %15 = load i32** @a, align 8 ; <i32*> [#uses=1]
+ %16 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %17 = and i32 %16, 15 ; <i32> [#uses=1]
+ %18 = load i32** @b, align 8 ; <i32*> [#uses=1]
+ %19 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %20 = and i32 %19, 15 ; <i32> [#uses=1]
+ %21 = zext i32 %20 to i64 ; <i64> [#uses=1]
+ %22 = getelementptr i32* %18, i64 %21 ; <i32*> [#uses=1]
+ %23 = load i32* %22, align 1 ; <i32> [#uses=1]
+ %24 = load i32** @c, align 8 ; <i32*> [#uses=1]
+ %25 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %26 = and i32 %25, 15 ; <i32> [#uses=1]
+ %27 = zext i32 %26 to i64 ; <i64> [#uses=1]
+ %28 = getelementptr i32* %24, i64 %27 ; <i32*> [#uses=1]
+ %29 = load i32* %28, align 1 ; <i32> [#uses=1]
+ %30 = add i32 %29, %23 ; <i32> [#uses=1]
+ %31 = zext i32 %17 to i64 ; <i64> [#uses=1]
+ %32 = getelementptr i32* %15, i64 %31 ; <i32*> [#uses=1]
+ store i32 %30, i32* %32, align 1
+ %33 = load i32** @a, align 8 ; <i32*> [#uses=1]
+ %34 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %35 = and i32 %34, 15 ; <i32> [#uses=1]
+ %36 = load i32** @b, align 8 ; <i32*> [#uses=1]
+ %37 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %38 = and i32 %37, 15 ; <i32> [#uses=1]
+ %39 = zext i32 %38 to i64 ; <i64> [#uses=1]
+ %40 = getelementptr i32* %36, i64 %39 ; <i32*> [#uses=1]
+ %41 = load i32* %40, align 1 ; <i32> [#uses=1]
+ %42 = load i32** @c, align 8 ; <i32*> [#uses=1]
+ %43 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %44 = and i32 %43, 15 ; <i32> [#uses=1]
+ %45 = zext i32 %44 to i64 ; <i64> [#uses=1]
+ %46 = getelementptr i32* %42, i64 %45 ; <i32*> [#uses=1]
+ %47 = load i32* %46, align 1 ; <i32> [#uses=1]
+ %48 = add i32 %47, %41 ; <i32> [#uses=1]
+ %49 = zext i32 %35 to i64 ; <i64> [#uses=1]
+ %50 = getelementptr i32* %33, i64 %49 ; <i32*> [#uses=1]
+ store i32 %48, i32* %50, align 1
+ %51 = load i32** @d, align 8 ; <i32*> [#uses=1]
+ %52 = and i32 %i.0.reg2mem.0, 15 ; <i32> [#uses=1]
+ %53 = load i32** @e, align 8 ; <i32*> [#uses=1]
+ %54 = and i32 %i.0.reg2mem.0, 15 ; <i32> [#uses=1]
+ %55 = zext i32 %54 to i64 ; <i64> [#uses=1]
+ %56 = getelementptr i32* %53, i64 %55 ; <i32*> [#uses=1]
+ %57 = load i32* %56, align 1 ; <i32> [#uses=1]
+ %58 = load i32** @f, align 8 ; <i32*> [#uses=1]
+ %59 = and i32 %i.0.reg2mem.0, 15 ; <i32> [#uses=1]
+ %60 = zext i32 %59 to i64 ; <i64> [#uses=1]
+ %61 = getelementptr i32* %58, i64 %60 ; <i32*> [#uses=1]
+ %62 = load i32* %61, align 1 ; <i32> [#uses=1]
+ %63 = sext i32 %i.0.reg2mem.0 to i64 ; <i64> [#uses=1]
+ %64 = getelementptr [256 x i32]* @K, i64 0, i64 %63 ; <i32*> [#uses=1]
+ %65 = load i32* %64, align 4 ; <i32> [#uses=1]
+ %66 = add i32 %62, %57 ; <i32> [#uses=1]
+ %67 = add i32 %66, %65 ; <i32> [#uses=1]
+ %68 = zext i32 %52 to i64 ; <i64> [#uses=1]
+ %69 = getelementptr i32* %51, i64 %68 ; <i32*> [#uses=1]
+ store i32 %67, i32* %69, align 1
+ %70 = load i32** @d, align 8 ; <i32*> [#uses=1]
+ %71 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %72 = and i32 %71, 15 ; <i32> [#uses=1]
+ %73 = load i32** @e, align 8 ; <i32*> [#uses=1]
+ %74 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %75 = and i32 %74, 15 ; <i32> [#uses=1]
+ %76 = zext i32 %75 to i64 ; <i64> [#uses=1]
+ %77 = getelementptr i32* %73, i64 %76 ; <i32*> [#uses=1]
+ %78 = load i32* %77, align 1 ; <i32> [#uses=1]
+ %79 = load i32** @f, align 8 ; <i32*> [#uses=1]
+ %80 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %81 = and i32 %80, 15 ; <i32> [#uses=1]
+ %82 = zext i32 %81 to i64 ; <i64> [#uses=1]
+ %83 = getelementptr i32* %79, i64 %82 ; <i32*> [#uses=1]
+ %84 = load i32* %83, align 1 ; <i32> [#uses=1]
+ %85 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=1]
+ %86 = sext i32 %85 to i64 ; <i64> [#uses=1]
+ %87 = getelementptr [256 x i32]* @K, i64 0, i64 %86 ; <i32*> [#uses=1]
+ %88 = load i32* %87, align 4 ; <i32> [#uses=1]
+ %89 = add i32 %84, %78 ; <i32> [#uses=1]
+ %90 = add i32 %89, %88 ; <i32> [#uses=1]
+ %91 = zext i32 %72 to i64 ; <i64> [#uses=1]
+ %92 = getelementptr i32* %70, i64 %91 ; <i32*> [#uses=1]
+ store i32 %90, i32* %92, align 1
+ %93 = load i32** @d, align 8 ; <i32*> [#uses=1]
+ %94 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %95 = and i32 %94, 15 ; <i32> [#uses=1]
+ %96 = load i32** @e, align 8 ; <i32*> [#uses=1]
+ %97 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %98 = and i32 %97, 15 ; <i32> [#uses=1]
+ %99 = zext i32 %98 to i64 ; <i64> [#uses=1]
+ %100 = getelementptr i32* %96, i64 %99 ; <i32*> [#uses=1]
+ %101 = load i32* %100, align 1 ; <i32> [#uses=1]
+ %102 = load i32** @f, align 8 ; <i32*> [#uses=1]
+ %103 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %104 = and i32 %103, 15 ; <i32> [#uses=1]
+ %105 = zext i32 %104 to i64 ; <i64> [#uses=1]
+ %106 = getelementptr i32* %102, i64 %105 ; <i32*> [#uses=1]
+ %107 = load i32* %106, align 1 ; <i32> [#uses=1]
+ %108 = add i32 %i.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %109 = sext i32 %108 to i64 ; <i64> [#uses=1]
+ %110 = getelementptr [256 x i32]* @K, i64 0, i64 %109 ; <i32*> [#uses=1]
+ %111 = load i32* %110, align 4 ; <i32> [#uses=1]
+ %112 = add i32 %107, %101 ; <i32> [#uses=1]
+ %113 = add i32 %112, %111 ; <i32> [#uses=1]
+ %114 = zext i32 %95 to i64 ; <i64> [#uses=1]
+ %115 = getelementptr i32* %93, i64 %114 ; <i32*> [#uses=1]
+ store i32 %113, i32* %115, align 1
+ %116 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %117 = icmp sgt i32 %116, 23646 ; <i1> [#uses=1]
+ br i1 %117, label %return, label %bb1
+
+return: ; preds = %bb1
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll b/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll
new file mode 100644
index 000000000000..f39458f17968
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -indvars
+; rdar://6817574
+
+define i32 @t1() nounwind ssp {
+entry:
+ br label %bb32
+
+bb32: ; preds = %bb32, %entry
+ %mbPartIdx.0.reg2mem.0 = phi i8 [ %2, %bb32 ], [ 0, %entry ] ; <i8> [#uses=3]
+ %0 = and i8 %mbPartIdx.0.reg2mem.0, 1 ; <i8> [#uses=0]
+ %1 = zext i8 %mbPartIdx.0.reg2mem.0 to i64 ; <i64> [#uses=0]
+ %2 = add i8 %mbPartIdx.0.reg2mem.0, 1 ; <i8> [#uses=2]
+ %3 = icmp ugt i8 %2, 3 ; <i1> [#uses=1]
+ br i1 %3, label %bb41, label %bb32
+
+bb41: ; preds = %bb32
+ ret i32 0
+}
+
+define i32 @t2() nounwind ssp {
+entry:
+ br label %bb116
+
+bb116: ; preds = %bb116, %entry
+ %mbPartIdx.1.reg2mem.0 = phi i8 [ %3, %bb116 ], [ 0, %entry ] ; <i8> [#uses=3]
+ %0 = and i8 %mbPartIdx.1.reg2mem.0, 1 ; <i8> [#uses=1]
+ %1 = zext i8 %mbPartIdx.1.reg2mem.0 to i64 ; <i64> [#uses=0]
+ %2 = zext i8 %0 to i32 ; <i32> [#uses=0]
+ %3 = add i8 %mbPartIdx.1.reg2mem.0, 1 ; <i8> [#uses=2]
+ %4 = icmp ugt i8 %3, 3 ; <i1> [#uses=1]
+ br i1 %4, label %bb131, label %bb116
+
+bb131: ; preds = %bb116
+ unreachable
+}
diff --git a/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll b/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll
new file mode 100644
index 000000000000..700f294eb885
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep icmp | grep next
+; PR4086
+declare void @foo()
+
+define void @test() {
+entry:
+ br label %loop_body
+
+loop_body:
+ %i = phi float [ %nexti, %loop_body ], [ 0.0, %entry ]
+ tail call void @foo()
+ %nexti = add float %i, 1.0
+ %less = fcmp olt float %nexti, 2.0
+ br i1 %less, label %loop_body, label %done
+
+done:
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll b/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
new file mode 100644
index 000000000000..ecbb23192e92
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -indvars
+; PR4258
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-linux-gnu"
+
+define void @0(i32*, i32*, i32, i32) nounwind {
+ br i1 false, label %bb.nph1.preheader, label %.outer._crit_edge
+
+bb.nph1.preheader: ; preds = %4
+ %smax = select i1 false, i32 -1, i32 0 ; <i32> [#uses=1]
+ %tmp12 = sub i32 0, %smax ; <i32> [#uses=1]
+ br label %bb.nph1
+
+bb.nph1: ; preds = %.outer, %bb.nph1.preheader
+ br i1 false, label %bb.nph3.preheader, label %.outer
+
+bb.nph3.preheader: ; preds = %bb.nph1
+ br label %bb.nph3
+
+bb.nph3: ; preds = %bb.nph3, %bb.nph3.preheader
+ %indvar7 = phi i32 [ %indvar.next8, %bb.nph3 ], [ 0, %bb.nph3.preheader ] ; <i32> [#uses=3]
+ %tmp9 = mul i32 %indvar7, -1 ; <i32> [#uses=1]
+ %tmp13 = add i32 %tmp9, %tmp12 ; <i32> [#uses=1]
+ %tmp14 = add i32 %tmp13, -2 ; <i32> [#uses=1]
+ %5 = icmp sgt i32 %tmp14, 0 ; <i1> [#uses=1]
+ %indvar.next8 = add i32 %indvar7, 1 ; <i32> [#uses=1]
+ br i1 %5, label %bb.nph3, label %.outer.loopexit
+
+.outer.loopexit: ; preds = %bb.nph3
+ %indvar7.lcssa = phi i32 [ %indvar7, %bb.nph3 ] ; <i32> [#uses=0]
+ br label %.outer
+
+.outer: ; preds = %.outer.loopexit, %bb.nph1
+ br i1 false, label %bb.nph1, label %.outer._crit_edge.loopexit
+
+.outer._crit_edge.loopexit: ; preds = %.outer
+ br label %.outer._crit_edge
+
+.outer._crit_edge: ; preds = %.outer._crit_edge.loopexit, %4
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/ada-loops.ll b/test/Transforms/IndVarSimplify/ada-loops.ll
new file mode 100644
index 000000000000..56325b36cbbe
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/ada-loops.ll
@@ -0,0 +1,90 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: grep phi %t | count 4
+; RUN: grep {= phi i32} %t | count 4
+; RUN: not grep {sext i} %t
+; RUN: not grep {zext i} %t
+; RUN: not grep {trunc i} %t
+; RUN: not grep {add i8} %t
+; PR1301
+
+; Do a bunch of analysis and prove that the loops can use an i32 trip
+; count without casting.
+
+; ModuleID = 'ada.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+
+define void @kinds__sbytezero([256 x i32]* nocapture %a) nounwind {
+bb.thread:
+ %tmp46 = getelementptr [256 x i32]* %a, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp46
+ br label %bb
+
+bb: ; preds = %bb, %bb.thread
+ %i.0.reg2mem.0 = phi i8 [ -128, %bb.thread ], [ %tmp8, %bb ] ; <i8> [#uses=1]
+ %tmp8 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=3]
+ %tmp1 = sext i8 %tmp8 to i32 ; <i32> [#uses=1]
+ %tmp3 = add i32 %tmp1, 128 ; <i32> [#uses=1]
+ %tmp4 = getelementptr [256 x i32]* %a, i32 0, i32 %tmp3 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp4
+ %0 = icmp eq i8 %tmp8, 127 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
+
+define void @kinds__ubytezero([256 x i32]* nocapture %a) nounwind {
+bb.thread:
+ %tmp35 = getelementptr [256 x i32]* %a, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp35
+ br label %bb
+
+bb: ; preds = %bb, %bb.thread
+ %i.0.reg2mem.0 = phi i8 [ 0, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=1]
+ %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=3]
+ %tmp1 = zext i8 %tmp7 to i32 ; <i32> [#uses=1]
+ %tmp3 = getelementptr [256 x i32]* %a, i32 0, i32 %tmp1 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp3
+ %0 = icmp eq i8 %tmp7, -1 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
+
+define void @kinds__srangezero([21 x i32]* nocapture %a) nounwind {
+bb.thread:
+ br label %bb
+
+bb: ; preds = %bb, %bb.thread
+ %i.0.reg2mem.0 = phi i8 [ -10, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=2]
+ %tmp12 = sext i8 %i.0.reg2mem.0 to i32 ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp12, 10 ; <i32> [#uses=1]
+ %tmp5 = getelementptr [21 x i32]* %a, i32 0, i32 %tmp4 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp5
+ %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=2]
+ %0 = icmp sgt i8 %tmp7, 10 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
+
+define void @kinds__urangezero([21 x i32]* nocapture %a) nounwind {
+bb.thread:
+ br label %bb
+
+bb: ; preds = %bb, %bb.thread
+ %i.0.reg2mem.0 = phi i8 [ 10, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=2]
+ %tmp12 = sext i8 %i.0.reg2mem.0 to i32 ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp12, -10 ; <i32> [#uses=1]
+ %tmp5 = getelementptr [21 x i32]* %a, i32 0, i32 %tmp4 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp5
+ %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=2]
+ %0 = icmp sgt i8 %tmp7, 30 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/addrec-gep.ll b/test/Transforms/IndVarSimplify/addrec-gep.ll
new file mode 100644
index 000000000000..132d4f8a871c
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/addrec-gep.ll
@@ -0,0 +1,78 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: grep getelementptr %t | count 1
+; RUN: grep {mul .*, 37} %t | count 1
+; RUN: grep {add .*, 5203} %t | count 1
+; RUN: not grep cast %t
+
+; This test tests several things. The load and store should use the
+; same address instead of having it computed twice, and SCEVExpander should
+; be able to reconstruct the full getelementptr, despite it having a few
+; obstacles set in its way.
+
+target datalayout = "e-p:64:64:64"
+
+define void @foo(i64 %n, i64 %m, i64 %o, i64 %q, double* nocapture %p) nounwind {
+entry:
+ %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %bb.nph3, label %return
+
+bb.nph: ; preds = %bb2.preheader
+ %tmp1 = mul i64 %tmp16, %i.02 ; <i64> [#uses=1]
+ %tmp2 = mul i64 %tmp19, %i.02 ; <i64> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb2, %bb.nph
+ %j.01 = phi i64 [ %tmp9, %bb2 ], [ 0, %bb.nph ] ; <i64> [#uses=3]
+ %tmp3 = add i64 %j.01, %tmp1 ; <i64> [#uses=1]
+ %tmp4 = add i64 %j.01, %tmp2 ; <i64> [#uses=1]
+ %z0 = add i64 %tmp4, 5203
+ %tmp5 = getelementptr double* %p, i64 %z0 ; <double*> [#uses=1]
+ %tmp6 = load double* %tmp5, align 8 ; <double> [#uses=1]
+ %tmp7 = fdiv double %tmp6, 2.100000e+00 ; <double> [#uses=1]
+ %z1 = add i64 %tmp4, 5203
+ %tmp8 = getelementptr double* %p, i64 %z1 ; <double*> [#uses=1]
+ store double %tmp7, double* %tmp8, align 8
+ %tmp9 = add i64 %j.01, 1 ; <i64> [#uses=2]
+ br label %bb2
+
+bb2: ; preds = %bb1
+ %tmp10 = icmp slt i64 %tmp9, %m ; <i1> [#uses=1]
+ br i1 %tmp10, label %bb1, label %bb2.bb3_crit_edge
+
+bb2.bb3_crit_edge: ; preds = %bb2
+ br label %bb3
+
+bb3: ; preds = %bb2.preheader, %bb2.bb3_crit_edge
+ %tmp11 = add i64 %i.02, 1 ; <i64> [#uses=2]
+ br label %bb4
+
+bb4: ; preds = %bb3
+ %tmp12 = icmp slt i64 %tmp11, %n ; <i1> [#uses=1]
+ br i1 %tmp12, label %bb2.preheader, label %bb4.return_crit_edge
+
+bb4.return_crit_edge: ; preds = %bb4
+ br label %bb4.return_crit_edge.split
+
+bb4.return_crit_edge.split: ; preds = %bb.nph3, %bb4.return_crit_edge
+ br label %return
+
+bb.nph3: ; preds = %entry
+ %tmp13 = icmp sgt i64 %m, 0 ; <i1> [#uses=1]
+ %tmp14 = mul i64 %n, 37 ; <i64> [#uses=1]
+ %tmp15 = mul i64 %tmp14, %o ; <i64> [#uses=1]
+ %tmp16 = mul i64 %tmp15, %q ; <i64> [#uses=1]
+ %tmp17 = mul i64 %n, 37 ; <i64> [#uses=1]
+ %tmp18 = mul i64 %tmp17, %o ; <i64> [#uses=1]
+ %tmp19 = mul i64 %tmp18, %q ; <i64> [#uses=1]
+ br i1 %tmp13, label %bb.nph3.split, label %bb4.return_crit_edge.split
+
+bb.nph3.split: ; preds = %bb.nph3
+ br label %bb2.preheader
+
+bb2.preheader: ; preds = %bb.nph3.split, %bb4
+ %i.02 = phi i64 [ %tmp11, %bb4 ], [ 0, %bb.nph3.split ] ; <i64> [#uses=3]
+ br i1 true, label %bb.nph, label %bb3
+
+return: ; preds = %bb4.return_crit_edge.split, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/avoid-i0.ll b/test/Transforms/IndVarSimplify/avoid-i0.ll
new file mode 100644
index 000000000000..3456bd3d6c9c
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/avoid-i0.ll
@@ -0,0 +1,126 @@
+; RUN: llvm-as < %s | opt -indvars
+; PR4052
+; PR4054
+
+; Don't treat an and with 0 as a mask (trunc+zext).
+
+define i32 @int80(i8 signext %p_71) nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb6, %entry
+ %p_71_addr.0 = phi i8 [ %p_71, %entry ], [ %0, %bb6 ] ; <i8> [#uses=0]
+ br i1 false, label %bb4, label %bb1
+
+bb1: ; preds = %bb
+ ret i32 0
+
+bb4: ; preds = %bb4, %bb
+ br i1 false, label %bb6, label %bb4
+
+bb6: ; preds = %bb4
+ %0 = and i8 0, 0 ; <i8> [#uses=1]
+ br label %bb
+}
+
+@x = common global i32 0 ; <i32*> [#uses=1]
+
+define signext i8 @safe_sub_func_int32_t_s_s(i32 %_si1, i8 signext %_si2) nounwind {
+entry:
+ %_si1_addr = alloca i32 ; <i32*> [#uses=3]
+ %_si2_addr = alloca i8 ; <i8*> [#uses=3]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %0 = alloca i32 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %_si1, i32* %_si1_addr
+ store i8 %_si2, i8* %_si2_addr
+ %1 = load i8* %_si2_addr, align 1 ; <i8> [#uses=1]
+ %2 = sext i8 %1 to i32 ; <i32> [#uses=1]
+ %3 = load i32* %_si1_addr, align 4 ; <i32> [#uses=1]
+ %4 = xor i32 %2, %3 ; <i32> [#uses=1]
+ %5 = load i8* %_si2_addr, align 1 ; <i8> [#uses=1]
+ %6 = sext i8 %5 to i32 ; <i32> [#uses=1]
+ %7 = sub i32 7, %6 ; <i32> [#uses=1]
+ %8 = load i32* %_si1_addr, align 4 ; <i32> [#uses=1]
+ %9 = shl i32 %8, %7 ; <i32> [#uses=1]
+ %10 = and i32 %4, %9 ; <i32> [#uses=1]
+ %11 = icmp slt i32 %10, 0 ; <i1> [#uses=1]
+ %12 = zext i1 %11 to i32 ; <i32> [#uses=1]
+ store i32 %12, i32* %0, align 4
+ %13 = load i32* %0, align 4 ; <i32> [#uses=1]
+ store i32 %13, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; <i32> [#uses=1]
+ %retval12 = trunc i32 %retval1 to i8 ; <i8> [#uses=1]
+ ret i8 %retval12
+}
+
+define i32 @safe_sub_func_uint64_t_u_u(i32 %_ui1, i32 %_ui2) nounwind {
+entry:
+ %_ui1_addr = alloca i32 ; <i32*> [#uses=2]
+ %_ui2_addr = alloca i32 ; <i32*> [#uses=1]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %0 = alloca i32 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %_ui1, i32* %_ui1_addr
+ store i32 %_ui2, i32* %_ui2_addr
+ %1 = load i32* %_ui1_addr, align 4 ; <i32> [#uses=1]
+ %2 = sub i32 %1, 1 ; <i32> [#uses=1]
+ store i32 %2, i32* %0, align 4
+ %3 = load i32* %0, align 4 ; <i32> [#uses=1]
+ store i32 %3, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval1
+}
+
+define void @int87(i8 signext %p_48, i8 signext %p_49) nounwind {
+entry:
+ %p_48_addr = alloca i8 ; <i8*> [#uses=1]
+ %p_49_addr = alloca i8 ; <i8*> [#uses=1]
+ %l_52 = alloca i32 ; <i32*> [#uses=7]
+ %vol.0 = alloca i32 ; <i32*> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i8 %p_48, i8* %p_48_addr
+ store i8 %p_49, i8* %p_49_addr
+ br label %bb4
+
+bb: ; preds = %bb4
+ %0 = volatile load i32* @x, align 4 ; <i32> [#uses=1]
+ store i32 %0, i32* %vol.0, align 4
+ store i32 0, i32* %l_52, align 4
+ br label %bb2
+
+bb1: ; preds = %bb2
+ %1 = load i32* %l_52, align 4 ; <i32> [#uses=1]
+ %2 = call i32 @safe_sub_func_uint64_t_u_u(i32 %1, i32 1) nounwind ; <i32> [#uses=1]
+ store i32 %2, i32* %l_52, align 4
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %3 = load i32* %l_52, align 4 ; <i32> [#uses=1]
+ %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1]
+ br i1 %4, label %bb1, label %bb3
+
+bb3: ; preds = %bb2
+ %5 = load i32* %l_52, align 4 ; <i32> [#uses=1]
+ %6 = call signext i8 @safe_sub_func_int32_t_s_s(i32 %5, i8 signext 1) nounwind ; <i8> [#uses=1]
+ %7 = sext i8 %6 to i32 ; <i32> [#uses=1]
+ store i32 %7, i32* %l_52, align 4
+ br label %bb4
+
+bb4: ; preds = %bb3, %entry
+ %8 = load i32* %l_52, align 4 ; <i32> [#uses=1]
+ %9 = icmp ne i32 %8, 0 ; <i1> [#uses=1]
+ br i1 %9, label %bb, label %bb5
+
+bb5: ; preds = %bb4
+ br label %return
+
+return: ; preds = %bb5
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/casted-argument.ll b/test/Transforms/IndVarSimplify/casted-argument.ll
new file mode 100644
index 000000000000..6d7aaa9161ad
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/casted-argument.ll
@@ -0,0 +1,50 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+; PR4009
+; PR4038
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define void @safe_bcopy(i8* %to) nounwind {
+entry:
+ %cmp11 = icmp ult i8* %to, null ; <i1> [#uses=1]
+ br i1 %cmp11, label %loop, label %return
+
+return: ; preds = %entry
+ ret void
+
+loop: ; preds = %loop, %if.else
+ %pn = phi i8* [ %ge, %loop ], [ null, %entry ] ; <i8*> [#uses=1]
+ %cp = ptrtoint i8* %to to i32 ; <i32> [#uses=1]
+ %su = sub i32 0, %cp ; <i32> [#uses=1]
+ %ge = getelementptr i8* %pn, i32 %su ; <i8*> [#uses=2]
+ tail call void @bcopy(i8* %ge) nounwind
+ br label %loop
+}
+
+define void @safe_bcopy_4038(i8* %from, i8* %to, i32 %size) nounwind {
+entry:
+ br i1 false, label %if.else, label %if.then12
+
+if.then12: ; preds = %entry
+ ret void
+
+if.else: ; preds = %entry
+ %sub.ptr.rhs.cast40 = ptrtoint i8* %from to i32 ; <i32> [#uses=1]
+ br label %if.end54
+
+if.end54: ; preds = %if.end54, %if.else
+ %sub.ptr4912.pn = phi i8* [ %sub.ptr4912, %if.end54 ], [ null, %if.else ] ; <i8*> [#uses=1]
+ %sub.ptr7 = phi i8* [ %sub.ptr, %if.end54 ], [ null, %if.else ] ; <i8*> [#uses=2]
+ %sub.ptr.rhs.cast46.pn = ptrtoint i8* %from to i32 ; <i32> [#uses=1]
+ %sub.ptr.lhs.cast45.pn = ptrtoint i8* %to to i32 ; <i32> [#uses=1]
+ %sub.ptr.sub47.pn = sub i32 %sub.ptr.rhs.cast46.pn, %sub.ptr.lhs.cast45.pn ; <i32> [#uses=1]
+ %sub.ptr4912 = getelementptr i8* %sub.ptr4912.pn, i32 %sub.ptr.sub47.pn ; <i8*> [#uses=2]
+ tail call void @bcopy_4038(i8* %sub.ptr4912, i8* %sub.ptr7, i32 0) nounwind
+ %sub.ptr = getelementptr i8* %sub.ptr7, i32 %sub.ptr.rhs.cast40 ; <i8*> [#uses=1]
+ br label %if.end54
+}
+
+declare void @bcopy(i8* nocapture) nounwind
+
+declare void @bcopy_4038(i8*, i32) nounwind
diff --git a/test/Transforms/IndVarSimplify/complex-scev.ll b/test/Transforms/IndVarSimplify/complex-scev.ll
new file mode 100644
index 000000000000..4bfc4e981af5
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/complex-scev.ll
@@ -0,0 +1,29 @@
+; The i induction variable looks like a wrap-around, but it really is just
+; a simple affine IV. Make sure that indvars eliminates it.
+
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep phi | count 1
+
+define void @foo() {
+entry:
+ br label %bb6
+
+bb6: ; preds = %cond_true, %entry
+ %j.0 = phi i32 [ 1, %entry ], [ %tmp5, %cond_true ] ; <i32> [#uses=3]
+ %i.0 = phi i32 [ 0, %entry ], [ %j.0, %cond_true ] ; <i32> [#uses=1]
+ %tmp7 = call i32 (...)* @foo2( ) ; <i32> [#uses=1]
+ %tmp = icmp ne i32 %tmp7, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %return
+
+cond_true: ; preds = %bb6
+ %tmp2 = call i32 (...)* @bar( i32 %i.0, i32 %j.0 ) ; <i32> [#uses=0]
+ %tmp5 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %bb6
+
+return: ; preds = %bb6
+ ret void
+}
+
+declare i32 @bar(...)
+
+declare i32 @foo2(...)
+
diff --git a/test/Transforms/IndVarSimplify/dg.exp b/test/Transforms/IndVarSimplify/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/IndVarSimplify/divide-pointer.ll b/test/Transforms/IndVarSimplify/divide-pointer.ll
new file mode 100644
index 000000000000..747d47eb8690
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/divide-pointer.ll
@@ -0,0 +1,95 @@
+; RUN: llvm-as < %s | opt -indvars
+; PR4271
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin10.0"
+ %struct.xyz = type <{ i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, [8 x i8], i64, i64, i32, i32, [4 x i32], i32, i32, i32, i32, i32, i32, [76 x i32], i32, [2 x %struct.uvw] }>
+ %struct.uvw = type <{ i64, i64 }>
+
+define i32 @foo(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
+entry:
+ br label %while.body.i
+
+while.body.i: ; preds = %while.body.i, %entry
+ br i1 undef, label %while.body.i, label %bcopy_internal.exit
+
+bcopy_internal.exit: ; preds = %while.body.i
+ %conv135 = ptrtoint %struct.xyz* %header to i32 ; <i32> [#uses=1]
+ %shr136 = lshr i32 %conv135, 12 ; <i32> [#uses=1]
+ br label %for.body
+
+for.body: ; preds = %for.body, %bcopy_internal.exit
+ %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
+ %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
+ %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
+ br i1 %cmp, label %if.then199, label %for.body
+
+if.then199: ; preds = %if.then199, %for.body
+ br label %if.then199
+}
+
+define i32 @same_thing_but_signed(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
+entry:
+ br label %while.body.i
+
+while.body.i: ; preds = %while.body.i, %entry
+ br i1 undef, label %while.body.i, label %bcopy_internal.exit
+
+bcopy_internal.exit: ; preds = %while.body.i
+ %conv135 = ptrtoint %struct.xyz* %header to i32 ; <i32> [#uses=1]
+ %shr136 = ashr i32 %conv135, 12 ; <i32> [#uses=1]
+ br label %for.body
+
+for.body: ; preds = %for.body, %bcopy_internal.exit
+ %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
+ %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
+ %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
+ br i1 %cmp, label %if.then199, label %for.body
+
+if.then199: ; preds = %if.then199, %for.body
+ br label %if.then199
+}
+
+define i32 @same_thing_but_multiplied(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
+entry:
+ br label %while.body.i
+
+while.body.i: ; preds = %while.body.i, %entry
+ br i1 undef, label %while.body.i, label %bcopy_internal.exit
+
+bcopy_internal.exit: ; preds = %while.body.i
+ %conv135 = ptrtoint %struct.xyz* %header to i32 ; <i32> [#uses=1]
+ %shr136 = shl i32 %conv135, 12 ; <i32> [#uses=1]
+ br label %for.body
+
+for.body: ; preds = %for.body, %bcopy_internal.exit
+ %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
+ %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
+ %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
+ br i1 %cmp, label %if.then199, label %for.body
+
+if.then199: ; preds = %if.then199, %for.body
+ br label %if.then199
+}
+
+define i32 @same_thing_but_xored(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
+entry:
+ br label %while.body.i
+
+while.body.i: ; preds = %while.body.i, %entry
+ br i1 undef, label %while.body.i, label %bcopy_internal.exit
+
+bcopy_internal.exit: ; preds = %while.body.i
+ %conv135 = ptrtoint %struct.xyz* %header to i32 ; <i32> [#uses=1]
+ %shr136 = xor i32 %conv135, 12 ; <i32> [#uses=1]
+ br label %for.body
+
+for.body: ; preds = %for.body, %bcopy_internal.exit
+ %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
+ %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
+ %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
+ br i1 %cmp, label %if.then199, label %for.body
+
+if.then199: ; preds = %if.then199, %for.body
+ br label %if.then199
+}
diff --git a/test/Transforms/IndVarSimplify/exit_value_tests.ll b/test/Transforms/IndVarSimplify/exit_value_tests.ll
new file mode 100644
index 000000000000..b39f40f48664
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/exit_value_tests.ll
@@ -0,0 +1,114 @@
+; Test that we can evaluate the exit values of various expression types. Since
+; these loops all have predictable exit values we can replace the use outside
+; of the loop with a closed-form computation, making the loop dead.
+;
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | \
+; RUN: llvm-dis | not grep br
+
+define i32 @polynomial_constant() {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; <i32> [#uses=3]
+ %B1 = phi i32 [ 0, %0 ], [ %B2, %Loop ] ; <i32> [#uses=1]
+ %A2 = add i32 %A1, 1 ; <i32> [#uses=1]
+ %B2 = add i32 %B1, %A1 ; <i32> [#uses=2]
+ %C = icmp eq i32 %A1, 1000 ; <i1> [#uses=1]
+ br i1 %C, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret i32 %B2
+}
+
+define i32 @NSquare(i32 %N) {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %X = phi i32 [ 0, %0 ], [ %X2, %Loop ] ; <i32> [#uses=4]
+ %X2 = add i32 %X, 1 ; <i32> [#uses=1]
+ %c = icmp eq i32 %X, %N ; <i1> [#uses=1]
+ br i1 %c, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ %Y = mul i32 %X, %X ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
+define i32 @NSquareOver2(i32 %N) {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %X = phi i32 [ 0, %0 ], [ %X2, %Loop ] ; <i32> [#uses=3]
+ %Y = phi i32 [ 15, %0 ], [ %Y2, %Loop ] ; <i32> [#uses=1]
+ %Y2 = add i32 %Y, %X ; <i32> [#uses=2]
+ %X2 = add i32 %X, 1 ; <i32> [#uses=1]
+ %c = icmp eq i32 %X, %N ; <i1> [#uses=1]
+ br i1 %c, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret i32 %Y2
+}
+
+define i32 @strength_reduced() {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; <i32> [#uses=3]
+ %B1 = phi i32 [ 0, %0 ], [ %B2, %Loop ] ; <i32> [#uses=1]
+ %A2 = add i32 %A1, 1 ; <i32> [#uses=1]
+ %B2 = add i32 %B1, %A1 ; <i32> [#uses=2]
+ %C = icmp eq i32 %A1, 1000 ; <i1> [#uses=1]
+ br i1 %C, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret i32 %B2
+}
+
+define i32 @chrec_equals() {
+entry:
+ br label %no_exit
+
+no_exit: ; preds = %no_exit, %entry
+ %i0 = phi i32 [ 0, %entry ], [ %i1, %no_exit ] ; <i32> [#uses=3]
+ %ISq = mul i32 %i0, %i0 ; <i32> [#uses=1]
+ %i1 = add i32 %i0, 1 ; <i32> [#uses=2]
+ %tmp.1 = icmp ne i32 %ISq, 10000 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %no_exit, label %loopexit
+
+loopexit: ; preds = %no_exit
+ ret i32 %i1
+}
+
+define i16 @cast_chrec_test() {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; <i32> [#uses=2]
+ %B1 = trunc i32 %A1 to i16 ; <i16> [#uses=2]
+ %A2 = add i32 %A1, 1 ; <i32> [#uses=1]
+ %C = icmp eq i16 %B1, 1000 ; <i1> [#uses=1]
+ br i1 %C, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret i16 %B1
+}
+
+define i32 @linear_div_fold() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 4, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 8 ; <i32> [#uses=1]
+ %RV = udiv i32 %i, 2 ; <i32> [#uses=1]
+ %c = icmp ne i32 %i, 68 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %RV
+}
diff --git a/test/Transforms/IndVarSimplify/gep-with-mul-base.ll b/test/Transforms/IndVarSimplify/gep-with-mul-base.ll
new file mode 100644
index 000000000000..e63c88c65e68
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/gep-with-mul-base.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: grep add %t | count 8
+; RUN: grep mul %t | count 7
+
+define void @foo(i64 %n, i64 %m, i64 %o, double* nocapture %p) nounwind {
+entry:
+ %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ %tmp1 = mul i64 %n, 37 ; <i64> [#uses=1]
+ %tmp2 = mul i64 %tmp1, %m ; <i64> [#uses=1]
+ %tmp3 = mul i64 %tmp2, %o ; <i64> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %i.01 = phi i64 [ %tmp3, %bb.nph ], [ %tmp13, %bb ] ; <i64> [#uses=3]
+ %tmp9 = getelementptr double* %p, i64 %i.01 ; <double*> [#uses=1]
+ %tmp10 = load double* %tmp9, align 8 ; <double> [#uses=1]
+ %tmp11 = fdiv double %tmp10, 2.100000e+00 ; <double> [#uses=1]
+ store double %tmp11, double* %tmp9, align 8
+ %tmp13 = add i64 %i.01, 1 ; <i64> [#uses=2]
+ %tmp14 = icmp slt i64 %tmp13, %n ; <i1> [#uses=1]
+ br i1 %tmp14, label %bb, label %return.loopexit
+
+return.loopexit: ; preds = %bb
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
+define void @bar(i64 %n, i64 %m, i64 %o, i64 %q, double* nocapture %p) nounwind {
+entry:
+ %tmp = icmp sgt i64 %n, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ %tmp1 = mul i64 %n, %q ; <i64> [#uses=1]
+ %tmp2 = mul i64 %tmp1, %m ; <i64> [#uses=1]
+ %tmp3 = mul i64 %tmp2, %o ; <i64> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %i.01 = phi i64 [ %tmp3, %bb.nph ], [ %tmp13, %bb ] ; <i64> [#uses=3]
+ %tmp9 = getelementptr double* %p, i64 %i.01 ; <double*> [#uses=1]
+ %tmp10 = load double* %tmp9, align 8 ; <double> [#uses=1]
+ %tmp11 = fdiv double %tmp10, 2.100000e+00 ; <double> [#uses=1]
+ store double %tmp11, double* %tmp9, align 8
+ %tmp13 = add i64 %i.01, 1 ; <i64> [#uses=2]
+ %tmp14 = icmp slt i64 %tmp13, %n ; <i1> [#uses=1]
+ br i1 %tmp14, label %bb, label %return.loopexit
+
+return.loopexit: ; preds = %bb
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/interesting-invoke-use.ll b/test/Transforms/IndVarSimplify/interesting-invoke-use.ll
new file mode 100644
index 000000000000..b90d1e0ecf35
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/interesting-invoke-use.ll
@@ -0,0 +1,57 @@
+; RUN: llvm-as < %s | opt -indvars
+
+; An invoke has a result value which is used in an "Interesting"
+; expression inside the loop. IndVars should be able to rewrite
+; the expression in the correct place.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+ %struct.string___XUB = type { i32, i32 }
+ %struct.string___XUP = type { [0 x i8]*, %struct.string___XUB* }
+@.str7 = external constant [24 x i8] ; <[24 x i8]*> [#uses=1]
+@C.17.316 = external constant %struct.string___XUB ; <%struct.string___XUB*> [#uses=1]
+
+define void @_ada_c35503g() {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ br i1 false, label %bb65.loopexit, label %bb
+
+bb65.loopexit: ; preds = %bb
+ br label %bb123
+
+bb123: ; preds = %bb178, %bb65.loopexit
+ %i.0 = phi i32 [ %3, %bb178 ], [ 0, %bb65.loopexit ] ; <i32> [#uses=3]
+ %0 = invoke i32 @report__ident_int(i32 1)
+ to label %invcont127 unwind label %lpad266 ; <i32> [#uses=1]
+
+invcont127: ; preds = %bb123
+ %1 = sub i32 %i.0, %0 ; <i32> [#uses=1]
+ %2 = icmp eq i32 0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %bb178, label %bb128
+
+bb128: ; preds = %invcont127
+ invoke void @system__img_int__image_integer(%struct.string___XUP* noalias sret null, i32 %i.0)
+ to label %invcont129 unwind label %lpad266
+
+invcont129: ; preds = %bb128
+ invoke void @system__string_ops__str_concat(%struct.string___XUP* noalias sret null, [0 x i8]* bitcast ([24 x i8]* @.str7 to [0 x i8]*), %struct.string___XUB* @C.17.316, [0 x i8]* null, %struct.string___XUB* null)
+ to label %invcont138 unwind label %lpad266
+
+invcont138: ; preds = %invcont129
+ unreachable
+
+bb178: ; preds = %invcont127
+ %3 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb123
+
+lpad266: ; preds = %invcont129, %bb128, %bb123
+ unreachable
+}
+
+declare void @system__img_int__image_integer(%struct.string___XUP* noalias sret, i32)
+
+declare void @system__string_ops__str_concat(%struct.string___XUP* noalias sret, [0 x i8]*, %struct.string___XUB*, [0 x i8]*, %struct.string___XUB*)
+
+declare i32 @report__ident_int(i32)
diff --git a/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll b/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll
new file mode 100644
index 000000000000..747c781e993f
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+; ModuleID = 'testcase.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+
+define i32 @testcase(i5 zeroext %k) {
+entry:
+ br label %bb2
+
+bb: ; preds = %bb2
+ %tmp1 = add i32 %tmp2, %result ; <i32> [#uses=1]
+ %indvar_next1 = add i5 %k_0, 1 ; <i5> [#uses=1]
+ br label %bb2
+
+bb2: ; preds = %bb, %entry
+ %k_0 = phi i5 [ 0, %entry ], [ %indvar_next1, %bb ] ; <i5> [#uses=2]
+ %result = phi i32 [ 0, %entry ], [ %tmp1, %bb ] ; <i32> [#uses=2]
+ %tmp2 = zext i5 %k_0 to i32 ; <i32> [#uses=1]
+ %exitcond = icmp eq i32 %tmp2, 16 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb3, label %bb
+
+bb3: ; preds = %bb2
+ ret i32 %result
+}
diff --git a/test/Transforms/IndVarSimplify/iv-zext.ll b/test/Transforms/IndVarSimplify/iv-zext.ll
new file mode 100644
index 000000000000..76d48de0d3c5
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/iv-zext.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: not grep and %t
+; RUN: not grep zext %t
+
+target datalayout = "-p:64:64:64"
+
+define void @foo(double* %d, i64 %n) nounwind {
+entry:
+ br label %loop
+
+loop:
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
+ %indvar.i8 = and i64 %indvar, 255
+ %t0 = getelementptr double* %d, i64 %indvar.i8
+ %t1 = load double* %t0
+ %t2 = mul double %t1, 0.1
+ store double %t2, double* %t0
+ %indvar.i24 = and i64 %indvar, 16777215
+ %t3 = getelementptr double* %d, i64 %indvar.i24
+ %t4 = load double* %t3
+ %t5 = mul double %t4, 2.3
+ store double %t5, double* %t3
+ %t6 = getelementptr double* %d, i64 %indvar
+ %t7 = load double* %t6
+ %t8 = mul double %t7, 4.5
+ store double %t8, double* %t6
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, 10
+ br i1 %exitcond, label %return, label %loop
+
+return:
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/lftr-other-uses.ll b/test/Transforms/IndVarSimplify/lftr-other-uses.ll
new file mode 100644
index 000000000000..c8f1e9598340
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/lftr-other-uses.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -indvars -disable-output
+
+; Don't RAUW the loop's original comparison instruction if it has
+; other uses which aren't dominated by the new comparison instruction.
+
+ %struct.DecRefPicMarking_s = type { i32, i32, i32, i32, i32, %struct.DecRefPicMarking_s* }
+ %struct.datapartition = type { %typedef.Bitstream*, %typedef.DecodingEnvironment, i32 (%struct.syntaxelement*, %struct.img_par*, %struct.inp_par*, %struct.datapartition*)* }
+ %struct.img_par = type { i32, i32, i32, i32, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x [16 x i16]], [6 x [32 x i32]], [16 x [16 x i32]], [4 x [12 x [4 x [4 x i32]]]], [16 x i32], i32**, i32*, i32***, i32**, i32, i32, i32, i32, %typedef.Slice*, %struct.macroblock*, i32, i32, i32, i32, i32, i32, i32**, %struct.DecRefPicMarking_s*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32***, i32***, i32****, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.timeb, %struct.timeb, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.inp_par = type { [100 x i8], [100 x i8], [100 x i8], i32, i32, i32, i32, i32, i32, i32 }
+ %struct.macroblock = type { i32, i32, i32, %struct.macroblock*, %struct.macroblock*, i32, [2 x [4 x [4 x [2 x i32]]]], i32, i64, i64, i32, i32, [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.syntaxelement = type { i32, i32, i32, i32, i32, i32, i32, i32, void (i32, i32, i32*, i32*)*, void (%struct.syntaxelement*, %struct.inp_par*, %struct.img_par*, %typedef.DecodingEnvironment*)* }
+ %struct.timeb = type { i32, i16, i16, i16 }
+ %typedef.BiContextType = type { i16, i8 }
+ %typedef.Bitstream = type { i32, i32, i32, i32, i8*, i32 }
+ %typedef.DecodingEnvironment = type { i32, i32, i32, i32, i32, i8*, i32* }
+ %typedef.MotionInfoContexts = type { [4 x [11 x %typedef.BiContextType]], [2 x [9 x %typedef.BiContextType]], [2 x [10 x %typedef.BiContextType]], [2 x [6 x %typedef.BiContextType]], [4 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x %typedef.BiContextType] }
+ %typedef.Slice = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.datapartition*, %typedef.MotionInfoContexts*, %typedef.TextureInfoContexts*, i32, i32*, i32*, i32*, i32, i32*, i32*, i32*, i32 (%struct.img_par*, %struct.inp_par*)*, i32, i32, i32, i32 }
+ %typedef.TextureInfoContexts = type { [2 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x [4 x %typedef.BiContextType]], [10 x [4 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]] }
+
+define void @readCBP_CABAC(%struct.syntaxelement* %se, %struct.inp_par* %inp, %struct.img_par* %img.1, %typedef.DecodingEnvironment* %dep_dp) {
+entry:
+ br label %loopentry.0
+
+loopentry.0: ; preds = %loopentry.1, %entry
+ %mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopentry.1 ] ; <i32> [#uses=2]
+ %tmp.14 = icmp sle i32 %mb_y.0, 3 ; <i1> [#uses=2]
+ %tmp.15 = zext i1 %tmp.14 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.14, label %loopentry.1, label %loopexit.0
+
+loopentry.1: ; preds = %loopentry.0
+ %tmp.152 = add i32 %mb_y.0, 2 ; <i32> [#uses=1]
+ br label %loopentry.0
+
+loopexit.0: ; preds = %loopentry.0
+ unreachable
+}
diff --git a/test/Transforms/IndVarSimplify/lftr_simple.ll b/test/Transforms/IndVarSimplify/lftr_simple.ll
new file mode 100644
index 000000000000..3f7c289a4885
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/lftr_simple.ll
@@ -0,0 +1,22 @@
+; LFTR should eliminate the need for the computation of i*i completely. It
+; is only used to compute the exit value.
+; RUN: llvm-as < %s | opt -indvars -dce | llvm-dis | not grep mul
+
+@A = external global i32 ; <i32*> [#uses=1]
+
+define i32 @quadratic_setlt() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] ; <i32> [#uses=5]
+ %i.next = add i32 %i, 1 ; <i32> [#uses=1]
+ store i32 %i, i32* @A
+ %i2 = mul i32 %i, %i ; <i32> [#uses=1]
+ %c = icmp slt i32 %i2, 1000 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_1.ll b/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
new file mode 100644
index 000000000000..dfb42e4feae3
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
+;
+; Testcase distilled from 256.bzip2
+
+define i32 @main() {
+entry:
+ br label %loopentry
+
+loopentry: ; preds = %loopentry, %entry
+ %indvar1 = phi i32 [ 0, %entry ], [ %indvar.next2, %loopentry ] ; <i32> [#uses=1]
+ %h.0 = phi i32 [ %tmp.2, %loopentry ], [ 4, %entry ] ; <i32> [#uses=1]
+ %tmp.1 = mul i32 %h.0, 3 ; <i32> [#uses=1]
+ %tmp.2 = add i32 %tmp.1, 1 ; <i32> [#uses=2]
+ %indvar.next2 = add i32 %indvar1, 1 ; <i32> [#uses=2]
+ %exitcond3 = icmp ne i32 %indvar.next2, 4 ; <i1> [#uses=1]
+ br i1 %exitcond3, label %loopentry, label %loopexit
+
+loopexit: ; preds = %loopentry
+ ret i32 %tmp.2
+}
+
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_2.ll b/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
new file mode 100644
index 000000000000..efcf20a93442
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | opt \
+; RUN: -analyze -loops | not grep "^Loop Containing"
+; PR1179
+
+define i32 @ltst(i32 %x) {
+entry:
+ icmp sgt i32 %x, 0 ; <i1>:0 [#uses=1]
+ br i1 %0, label %bb.preheader, label %bb8
+
+bb.preheader: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb, %bb.preheader
+ %i.01.0 = phi i32 [ %tmp4, %bb ], [ 0, %bb.preheader ] ; <i32> [#uses=1]
+ %j.03.0 = phi i32 [ %tmp2, %bb ], [ 0, %bb.preheader ] ; <i32> [#uses=1]
+ %tmp4 = add i32 %i.01.0, 1 ; <i32> [#uses=2]
+ %tmp2 = add i32 %j.03.0, 1 ; <i32> [#uses=2]
+ icmp slt i32 %tmp4, %x ; <i1>:1 [#uses=1]
+ br i1 %1, label %bb, label %bb8.loopexit
+
+bb8.loopexit: ; preds = %bb
+ br label %bb8
+
+bb8: ; preds = %bb8.loopexit, %entry
+ %j.03.1 = phi i32 [ 0, %entry ], [ %tmp2, %bb8.loopexit ] ; <i32> [#uses=1]
+ ret i32 %j.03.1
+}
+
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_3.ll b/test/Transforms/IndVarSimplify/loop_evaluate_3.ll
new file mode 100644
index 000000000000..2a2f69dd4866
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_3.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep {ret i32 600000}
+; PR1179
+
+define i32 @foo() {
+entry:
+ br label %bb5
+
+bb5: ; preds = %bb5, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb5 ] ; <i32> [#uses=1]
+ %x.03.0 = phi i32 [ 0, %entry ], [ %tmp4, %bb5 ] ; <i32> [#uses=1]
+ %tmp2 = add i32 %i.01.0, 3 ; <i32> [#uses=2]
+ %tmp4 = add i32 %x.03.0, 1 ; <i32> [#uses=2]
+ icmp slt i32 %tmp4, 200000 ; <i1>:0 [#uses=1]
+ br i1 %0, label %bb5, label %bb7
+
+bb7: ; preds = %bb5
+ ret i32 %tmp2
+}
+
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_4.ll b/test/Transforms/IndVarSimplify/loop_evaluate_4.ll
new file mode 100644
index 000000000000..6c6a362f48e6
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_4.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep {ret i32 9900}
+; PR1179
+
+define i32 @test4() {
+entry:
+ br label %bb7
+
+bb7: ; preds = %bb7, %entry
+ %v.01.0 = phi i32 [ 0, %entry ], [ %tmp4, %bb7 ] ; <i32> [#uses=1]
+ %i.03.0 = phi i32 [ 0, %entry ], [ %tmp6, %bb7 ] ; <i32> [#uses=2]
+ %tmp2 = shl i32 %i.03.0, 1 ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp2, %v.01.0 ; <i32> [#uses=2]
+ %tmp6 = add i32 %i.03.0, 1 ; <i32> [#uses=2]
+ icmp slt i32 %tmp6, 100 ; <i1>:0 [#uses=1]
+ br i1 %0, label %bb7, label %bb9
+
+bb9: ; preds = %bb7
+ ret i32 %tmp4
+}
+
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_5.ll b/test/Transforms/IndVarSimplify/loop_evaluate_5.ll
new file mode 100644
index 000000000000..c6ce4a2122da
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_5.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep {120, %bb2.bb3_crit_edge}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+
+; Indvars should be able to compute an exit value for %tmp1.
+
+define i32 @testcase(i5 zeroext %k) nounwind readnone {
+entry:
+ br i1 false, label %bb3, label %bb.nph
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb2, %bb.nph
+ %result2 = phi i32 [ %tmp1, %bb2 ], [ 0, %bb.nph ] ; <i32> [#uses=1]
+ %k_01 = phi i5 [ %indvar_next1, %bb2 ], [ 0, %bb.nph ] ; <i5> [#uses=2]
+ %tmp2 = zext i5 %k_01 to i32 ; <i32> [#uses=1]
+ %tmp1 = add i32 %tmp2, %result2 ; <i32> [#uses=2]
+ %indvar_next1 = add i5 %k_01, 1 ; <i5> [#uses=2]
+ br label %bb2
+
+bb2: ; preds = %bb
+ %phitmp = icmp eq i5 %indvar_next1, -16 ; <i1> [#uses=1]
+ br i1 %phitmp, label %bb2.bb3_crit_edge, label %bb
+
+bb2.bb3_crit_edge: ; preds = %bb2
+ br label %bb3
+
+bb3: ; preds = %bb2.bb3_crit_edge, %entry
+ %result.lcssa = phi i32 [ %tmp1, %bb2.bb3_crit_edge ], [ 0, %entry ] ; <i32> [#uses=1]
+ ret i32 %result.lcssa
+}
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
new file mode 100644
index 000000000000..35fbf52b7ef0
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -indvars -loop-deletion | llvm-dis | grep phi | count 1
+
+; Indvars should be able to evaluate this loop, allowing loop deletion
+; to delete it.
+
+define i32 @test(i32 %x_offs) nounwind readnone {
+entry:
+ %0 = icmp sgt i32 %x_offs, 4 ; <i1> [#uses=1]
+ br i1 %0, label %bb.nph, label %bb2
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb1, %bb.nph
+ %x_offs_addr.01 = phi i32 [ %1, %bb1 ], [ %x_offs, %bb.nph ] ; <i32> [#uses=1]
+ %1 = add i32 %x_offs_addr.01, -4 ; <i32> [#uses=3]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %2 = icmp sgt i32 %1, 4 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb1.bb2_crit_edge
+
+bb1.bb2_crit_edge: ; preds = %bb1
+ br label %bb2
+
+bb2: ; preds = %bb1.bb2_crit_edge, %entry
+ %x_offs_addr.0.lcssa = phi i32 [ %1, %bb1.bb2_crit_edge ], [ %x_offs, %entry ] ; <i32> [#uses=1]
+ ret i32 %x_offs_addr.0.lcssa
+}
diff --git a/test/Transforms/IndVarSimplify/pointer-indvars.ll b/test/Transforms/IndVarSimplify/pointer-indvars.ll
new file mode 100644
index 000000000000..c9da1579e983
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/pointer-indvars.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+@G = global i32* null ; <i32**> [#uses=1]
+@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=1]
+
+define void @test() {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %X = phi i32* [ getelementptr ([40 x i32]* @Array, i64 0, i64 0), %0 ], [ %X.next, %Loop ] ; <i32*> [#uses=2]
+ %X.next = getelementptr i32* %X, i64 1 ; <i32*> [#uses=1]
+ store i32* %X, i32** @G
+ br label %Loop
+}
+
diff --git a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll
new file mode 100644
index 000000000000..95726ea08189
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis \
+; RUN: | grep {\[%\]p.2.ip.1 = getelementptr \\\[3 x \\\[3 x double\\\]\\\]\\* \[%\]p, i64 2, i64 \[%\]tmp, i64 1}
+
+; Indvars shouldn't expand this to
+; %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19
+; or something. That's valid, but more obscure.
+
+define void @foo([3 x [3 x double]]* noalias %p) nounwind {
+entry:
+ br label %loop
+
+loop:
+ %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
+ %ip = add i64 %i, 1
+ %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %ip, i64 1
+ volatile store double 0.0, double* %p.2.ip.1
+ %i.next = add i64 %i, 1
+ br label %loop
+}
diff --git a/test/Transforms/IndVarSimplify/preserve-gep.ll b/test/Transforms/IndVarSimplify/preserve-gep.ll
new file mode 100644
index 000000000000..2c8c224fb905
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/preserve-gep.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: not grep ptrtoint %t
+; RUN: not grep inttoptr %t
+; RUN: grep getelementptr %t | count 1
+
+; Indvars shouldn't leave getelementptrs expanded out as
+; inttoptr+ptrtoint in its output in common cases.
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.Foo = type { i32, i32, [10 x i32], i32 }
+
+define void @me(%struct.Foo* nocapture %Bar) nounwind {
+entry:
+ br i1 false, label %return, label %bb.nph
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb1, %bb.nph
+ %i.01 = phi i64 [ %4, %bb1 ], [ 0, %bb.nph ] ; <i64> [#uses=3]
+ %0 = getelementptr %struct.Foo* %Bar, i64 %i.01, i32 2, i64 3 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ %2 = mul i32 %1, 113 ; <i32> [#uses=1]
+ %3 = getelementptr %struct.Foo* %Bar, i64 %i.01, i32 2, i64 3 ; <i32*> [#uses=1]
+ store i32 %2, i32* %3, align 4
+ %4 = add i64 %i.01, 1 ; <i64> [#uses=2]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %phitmp = icmp sgt i64 %4, 19999 ; <i1> [#uses=1]
+ br i1 %phitmp, label %bb1.return_crit_edge, label %bb
+
+bb1.return_crit_edge: ; preds = %bb1
+ br label %return
+
+return: ; preds = %bb1.return_crit_edge, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
new file mode 100644
index 000000000000..0a91ec88064f
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: grep sext %t | count 1
+; RUN: grep phi %t | count 1
+; RUN: grep {phi i64} %t
+
+; Indvars should insert a 64-bit induction variable to eliminate the
+; sext for the addressing, however it shouldn't eliminate the sext
+; on the other phi, since that value undergoes signed wrapping.
+
+define void @foo(i32* nocapture %d, i32 %n) nounwind {
+entry:
+ %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb1, %bb.nph
+ %i.02 = phi i32 [ %5, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=2]
+ %p.01 = phi i8 [ %4, %bb1 ], [ -1, %bb.nph ] ; <i8> [#uses=2]
+ %1 = sext i8 %p.01 to i32 ; <i32> [#uses=1]
+ %2 = sext i32 %i.02 to i64 ; <i64> [#uses=1]
+ %3 = getelementptr i32* %d, i64 %2 ; <i32*> [#uses=1]
+ store i32 %1, i32* %3, align 4
+ %4 = add i8 %p.01, 1 ; <i8> [#uses=1]
+ %5 = add i32 %i.02, 1 ; <i32> [#uses=2]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %6 = icmp slt i32 %5, %n ; <i1> [#uses=1]
+ br i1 %6, label %bb, label %bb1.return_crit_edge
+
+bb1.return_crit_edge: ; preds = %bb1
+ br label %return
+
+return: ; preds = %bb1.return_crit_edge, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll b/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
new file mode 100644
index 000000000000..48c060c48d22
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
@@ -0,0 +1,99 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: not grep sext %t
+
+define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly {
+entry:
+ %t0 = icmp sgt i32 %count, 0 ; <i1> [#uses=1]
+ br i1 %t0, label %bb.nph, label %bb2
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb1, %bb.nph
+ %result.02 = phi i64 [ %t5, %bb1 ], [ 0, %bb.nph ] ; <i64> [#uses=1]
+ %n.01 = phi i32 [ %t6, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=2]
+ %t1 = sext i32 %n.01 to i64 ; <i64> [#uses=1]
+ %t2 = getelementptr i64* %first, i64 %t1 ; <i64*> [#uses=1]
+ %t3 = load i64* %t2, align 8 ; <i64> [#uses=1]
+ %t4 = lshr i64 %t3, 4 ; <i64> [#uses=1]
+ %t5 = add i64 %t4, %result.02 ; <i64> [#uses=2]
+ %t6 = add i32 %n.01, 1 ; <i32> [#uses=2]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %t7 = icmp slt i32 %t6, %count ; <i1> [#uses=1]
+ br i1 %t7, label %bb, label %bb1.bb2_crit_edge
+
+bb1.bb2_crit_edge: ; preds = %bb1
+ %.lcssa = phi i64 [ %t5, %bb1 ] ; <i64> [#uses=1]
+ br label %bb2
+
+bb2: ; preds = %bb1.bb2_crit_edge, %entry
+ %result.0.lcssa = phi i64 [ %.lcssa, %bb1.bb2_crit_edge ], [ 0, %entry ] ; <i64> [#uses=1]
+ ret i64 %result.0.lcssa
+}
+
+define void @foo(i16 signext %N, i32* nocapture %P) nounwind {
+entry:
+ %t0 = icmp sgt i16 %N, 0 ; <i1> [#uses=1]
+ br i1 %t0, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb1, %bb.nph
+ %i.01 = phi i16 [ %t3, %bb1 ], [ 0, %bb.nph ] ; <i16> [#uses=2]
+ %t1 = sext i16 %i.01 to i64 ; <i64> [#uses=1]
+ %t2 = getelementptr i32* %P, i64 %t1 ; <i32*> [#uses=1]
+ store i32 123, i32* %t2, align 4
+ %t3 = add i16 %i.01, 1 ; <i16> [#uses=2]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %t4 = icmp slt i16 %t3, %N ; <i1> [#uses=1]
+ br i1 %t4, label %bb, label %bb1.return_crit_edge
+
+bb1.return_crit_edge: ; preds = %bb1
+ br label %return
+
+return: ; preds = %bb1.return_crit_edge, %entry
+ ret void
+}
+
+; Test cases from PR1301:
+
+define void @kinds__srangezero([21 x i32]* nocapture %a) nounwind {
+bb.thread:
+ br label %bb
+
+bb: ; preds = %bb, %bb.thread
+ %i.0.reg2mem.0 = phi i8 [ -10, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=2]
+ %tmp12 = sext i8 %i.0.reg2mem.0 to i32 ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp12, 10 ; <i32> [#uses=1]
+ %tmp5 = getelementptr [21 x i32]* %a, i32 0, i32 %tmp4 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp5
+ %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=2]
+ %0 = icmp sgt i8 %tmp7, 10 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
+
+define void @kinds__urangezero([21 x i32]* nocapture %a) nounwind {
+bb.thread:
+ br label %bb
+
+bb: ; preds = %bb, %bb.thread
+ %i.0.reg2mem.0 = phi i8 [ 10, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=2]
+ %tmp12 = sext i8 %i.0.reg2mem.0 to i32 ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp12, -10 ; <i32> [#uses=1]
+ %tmp5 = getelementptr [21 x i32]* %a, i32 0, i32 %tmp4 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp5
+ %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=2]
+ %0 = icmp sgt i8 %tmp7, 30 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/signed-trip-count.ll b/test/Transforms/IndVarSimplify/signed-trip-count.ll
new file mode 100644
index 000000000000..cd61d11394ee
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/signed-trip-count.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: not grep sext %t
+; RUN: grep phi %t | count 1
+
+define void @foo(i64* nocapture %x, i32 %n) nounwind {
+entry:
+ %tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
+ br i1 %tmp102, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb7, %bb.nph
+ %i.01 = phi i32 [ %tmp6, %bb7 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
+ %tmp1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+ %tmp4 = getelementptr i64* %x, i32 %i.01 ; <i64*> [#uses=1]
+ store i64 %tmp1, i64* %tmp4, align 8
+ %tmp6 = add i32 %i.01, 1 ; <i32> [#uses=2]
+ br label %bb7
+
+bb7: ; preds = %bb
+ %tmp10 = icmp slt i32 %tmp6, %n ; <i1> [#uses=1]
+ br i1 %tmp10, label %bb, label %bb7.return_crit_edge
+
+bb7.return_crit_edge: ; preds = %bb7
+ br label %return
+
+return: ; preds = %bb7.return_crit_edge, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/subtract.ll b/test/Transforms/IndVarSimplify/subtract.ll
new file mode 100644
index 000000000000..51065cc1a8a3
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/subtract.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+
+@G = global i64 0 ; <i64*> [#uses=1]
+
+define void @test(i64 %V) {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %X = phi i64 [ 1, %0 ], [ %X.next, %Loop ] ; <i64> [#uses=2]
+ %X.next = sub i64 %X, %V ; <i64> [#uses=1]
+ store i64 %X, i64* @G
+ br label %Loop
+}
+
diff --git a/test/Transforms/IndVarSimplify/tripcount_compute.ll b/test/Transforms/IndVarSimplify/tripcount_compute.ll
new file mode 100644
index 000000000000..9ffce813023a
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/tripcount_compute.ll
@@ -0,0 +1,100 @@
+; These tests ensure that we can compute the trip count of various forms of
+; loops. If the trip count of the loop is computable, then we will know what
+; the exit value of the loop will be for some value, allowing us to substitute
+; it directly into users outside of the loop, making the loop dead.
+;
+; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
+
+define i32 @linear_setne() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 1 ; <i32> [#uses=1]
+ %c = icmp ne i32 %i, 100 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
+define i32 @linear_setne_2() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 2 ; <i32> [#uses=1]
+ %c = icmp ne i32 %i, 100 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
+define i32 @linear_setne_overflow() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 1024, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 1024 ; <i32> [#uses=1]
+ %c = icmp ne i32 %i, 0 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
+define i32 @linear_setlt() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 1 ; <i32> [#uses=1]
+ %c = icmp slt i32 %i, 100 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
+define i32 @quadratic_setlt() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] ; <i32> [#uses=4]
+ %i.next = add i32 %i, 3 ; <i32> [#uses=1]
+ %i2 = mul i32 %i, %i ; <i32> [#uses=1]
+ %c = icmp slt i32 %i2, 1000 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
+define i32 @chained() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 1 ; <i32> [#uses=1]
+ %c = icmp ne i32 %i, 100 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ br label %loop2
+
+loop2: ; preds = %loop2, %loopexit
+ %j = phi i32 [ %i, %loopexit ], [ %j.next, %loop2 ] ; <i32> [#uses=3]
+ %j.next = add i32 %j, 1 ; <i32> [#uses=1]
+ %c2 = icmp ne i32 %j, 200 ; <i1> [#uses=1]
+ br i1 %c2, label %loop2, label %loopexit2
+
+loopexit2: ; preds = %loop2
+ ret i32 %j
+}
diff --git a/test/Transforms/IndVarSimplify/tripcount_infinite.ll b/test/Transforms/IndVarSimplify/tripcount_infinite.ll
new file mode 100644
index 000000000000..d5965f4ed6f0
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/tripcount_infinite.ll
@@ -0,0 +1,38 @@
+; These tests have an infinite trip count. We obviously shouldn't remove the
+; loops! :)
+;
+; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2
+; RUN: llvm-as < %s | llvm-dis | grep icmp | wc -l > %t1
+; RUN: diff %t1 %t2
+
+;; test for (i = 1; i != 100; i += 2)
+define i32 @infinite_linear() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; <i32> [#uses=3]
+ %i.next = add i32 %i, 2 ; <i32> [#uses=1]
+ %c = icmp ne i32 %i, 100 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
+;; test for (i = 1; i*i != 63; ++i)
+define i32 @infinite_quadratic() {
+entry:
+ br label %loop
+
+loop: ; preds = %loop, %entry
+ %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; <i32> [#uses=4]
+ %isquare = mul i32 %i, %i ; <i32> [#uses=1]
+ %i.next = add i32 %i, 1 ; <i32> [#uses=1]
+ %c = icmp ne i32 %isquare, 63 ; <i1> [#uses=1]
+ br i1 %c, label %loop, label %loopexit
+
+loopexit: ; preds = %loop
+ ret i32 %i
+}
+
diff --git a/test/Transforms/IndVarSimplify/variable-stride-ivs.ll b/test/Transforms/IndVarSimplify/variable-stride-ivs.ll
new file mode 100644
index 000000000000..759ba8e177bc
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/variable-stride-ivs.ll
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -indvars -instcombine | llvm-dis | \
+; RUN: grep {store i32 0}
+; Test that -indvars can reduce variable stride IVs. If it can reduce variable
+; stride iv's, it will make %iv. and %m.0.0 isomorphic to each other without
+; cycles, allowing the tmp.21 subtraction to be eliminated.
+; END.
+
+define void @vnum_test8(i32* %data) {
+entry:
+ %tmp.1 = getelementptr i32* %data, i32 3 ; <i32*> [#uses=1]
+ %tmp.2 = load i32* %tmp.1 ; <i32> [#uses=2]
+ %tmp.4 = getelementptr i32* %data, i32 4 ; <i32*> [#uses=1]
+ %tmp.5 = load i32* %tmp.4 ; <i32> [#uses=2]
+ %tmp.8 = getelementptr i32* %data, i32 2 ; <i32*> [#uses=1]
+ %tmp.9 = load i32* %tmp.8 ; <i32> [#uses=3]
+ %tmp.125 = icmp sgt i32 %tmp.2, 0 ; <i1> [#uses=1]
+ br i1 %tmp.125, label %no_exit.preheader, label %return
+
+no_exit.preheader: ; preds = %entry
+ %tmp.16 = getelementptr i32* %data, i32 %tmp.9 ; <i32*> [#uses=1]
+ br label %no_exit
+
+no_exit: ; preds = %no_exit, %no_exit.preheader
+ %iv.ui = phi i32 [ 0, %no_exit.preheader ], [ %iv..inc.ui, %no_exit ] ; <i32> [#uses=1]
+ %iv. = phi i32 [ %tmp.5, %no_exit.preheader ], [ %iv..inc, %no_exit ] ; <i32> [#uses=2]
+ %m.0.0 = phi i32 [ %tmp.5, %no_exit.preheader ], [ %tmp.24, %no_exit ] ; <i32> [#uses=2]
+ store i32 2, i32* %tmp.16
+ %tmp.21 = sub i32 %m.0.0, %iv. ; <i32> [#uses=1]
+ store i32 %tmp.21, i32* %data
+ %tmp.24 = add i32 %m.0.0, %tmp.9 ; <i32> [#uses=1]
+ %iv..inc = add i32 %tmp.9, %iv. ; <i32> [#uses=1]
+ %iv..inc.ui = add i32 %iv.ui, 1 ; <i32> [#uses=2]
+ %iv..inc1 = bitcast i32 %iv..inc.ui to i32 ; <i32> [#uses=1]
+ %tmp.12 = icmp slt i32 %iv..inc1, %tmp.2 ; <i1> [#uses=1]
+ br i1 %tmp.12, label %no_exit, label %return.loopexit
+
+return.loopexit: ; preds = %no_exit
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2003-09-14-InlineValue.ll b/test/Transforms/Inline/2003-09-14-InlineValue.ll
new file mode 100644
index 000000000000..edc9b474e064
--- /dev/null
+++ b/test/Transforms/Inline/2003-09-14-InlineValue.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+declare i32 @External()
+
+define internal i32 @Callee() {
+ %I = call i32 @External( ) ; <i32> [#uses=2]
+ %J = add i32 %I, %I ; <i32> [#uses=1]
+ ret i32 %J
+}
+
+define i32 @Caller() {
+ %V = invoke i32 @Callee( )
+ to label %Ok unwind label %Bad ; <i32> [#uses=1]
+
+Ok: ; preds = %0
+ ret i32 %V
+
+Bad: ; preds = %0
+ ret i32 0
+}
+
diff --git a/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll b/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll
new file mode 100644
index 000000000000..d57aee01c609
--- /dev/null
+++ b/test/Transforms/Inline/2003-09-22-PHINodeInlineFail.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+define i32 @main() {
+entry:
+ invoke void @__main( )
+ to label %LongJmpBlkPre unwind label %LongJmpBlkPre
+
+LongJmpBlkPre: ; preds = %entry, %entry
+ %i.3 = phi i32 [ 0, %entry ], [ 0, %entry ] ; <i32> [#uses=0]
+ ret i32 0
+}
+
+define void @__main() {
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll b/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll
new file mode 100644
index 000000000000..d75999b9768d
--- /dev/null
+++ b/test/Transforms/Inline/2003-09-22-PHINodesInExceptionDest.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+define i32 @main() {
+entry:
+ invoke void @__main( )
+ to label %Call2Invoke unwind label %LongJmpBlkPre
+
+Call2Invoke: ; preds = %entry
+ br label %LongJmpBlkPre
+
+LongJmpBlkPre: ; preds = %Call2Invoke, %entry
+ %i.3 = phi i32 [ 0, %entry ], [ 0, %Call2Invoke ] ; <i32> [#uses=0]
+ ret i32 0
+}
+
+define void @__main() {
+ call void @__llvm_getGlobalCtors( )
+ call void @__llvm_getGlobalDtors( )
+ ret void
+}
+
+declare void @__llvm_getGlobalCtors()
+
+declare void @__llvm_getGlobalDtors()
+
diff --git a/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll b/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
new file mode 100644
index 000000000000..09d516f48223
--- /dev/null
+++ b/test/Transforms/Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+define i32 @main() {
+entry:
+ invoke void @__main( )
+ to label %else unwind label %RethrowExcept
+
+else: ; preds = %LJDecisionBB, %entry
+ %i.2 = phi i32 [ 36, %entry ], [ %i.2, %LJDecisionBB ] ; <i32> [#uses=1]
+ br label %LJDecisionBB
+
+LJDecisionBB: ; preds = %else
+ br label %else
+
+RethrowExcept: ; preds = %entry
+ ret i32 0
+}
+
+define void @__main() {
+ ret void
+}
+
+
diff --git a/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll b/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll
new file mode 100644
index 000000000000..6b6cf06abb29
--- /dev/null
+++ b/test/Transforms/Inline/2003-10-13-AllocaDominanceProblem.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+define i32 @reload() {
+reloadentry:
+ br label %A
+
+A: ; preds = %reloadentry
+ call void @callee( )
+ ret i32 0
+}
+
+define internal void @callee() {
+entry:
+ %X = alloca i8, i32 0 ; <i8*> [#uses=0]
+ %Y = bitcast i32 0 to i32 ; <i32> [#uses=1]
+ %Z = alloca i8, i32 %Y ; <i8*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll b/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll
new file mode 100644
index 000000000000..675454e13482
--- /dev/null
+++ b/test/Transforms/Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll
@@ -0,0 +1,20 @@
+; The inliner is breaking inlining invoke instructions where there is a PHI
+; node in the exception destination, and the inlined function contains an
+; unwind instruction.
+
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+define linkonce void @foo() {
+ unwind
+}
+
+define i32 @test() {
+BB1:
+ invoke void @foo( )
+ to label %Cont unwind label %Cont
+
+Cont: ; preds = %BB1, %BB1
+ %A = phi i32 [ 0, %BB1 ], [ 0, %BB1 ] ; <i32> [#uses=1]
+ ret i32 %A
+}
+
diff --git a/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll b/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll
new file mode 100644
index 000000000000..8a2f8e29edff
--- /dev/null
+++ b/test/Transforms/Inline/2004-04-15-InlineDeletesCall.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+; Inlining the first call caused the inliner function to delete the second
+; call. Then the inliner tries to inline the second call, which no longer
+; exists.
+
+define internal void @Callee1() {
+ unwind
+}
+
+define void @Callee2() {
+ ret void
+}
+
+define void @caller() {
+ call void @Callee1( )
+ call void @Callee2( )
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll b/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll
new file mode 100644
index 000000000000..d9f09a06e7da
--- /dev/null
+++ b/test/Transforms/Inline/2004-04-20-InlineLinkOnce.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
+
+define linkonce void @caller() {
+ call void @callee( )
+ ret void
+}
+
+define linkonce void @callee() {
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll b/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll
new file mode 100644
index 000000000000..09666ec8e65b
--- /dev/null
+++ b/test/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+
+define i32 @test() {
+ unwind
+}
+
+define i32 @caller() {
+ %X = call i32 @test( ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll b/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll
new file mode 100644
index 000000000000..acdf6ab766b1
--- /dev/null
+++ b/test/Transforms/Inline/2006-01-14-CallGraphUpdate.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
+
+ %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" }
+ %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, i32*, i32*, i32*, i32*, i32*, i32*, %"struct.std::locale" }
+ %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
+ %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
+ %"struct.std::ios_base::_Words" = type { i8*, i32 }
+ %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
+ %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+ %"struct.std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"*, i32 }
+
+define void @_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewl(%"struct.std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t> >"* %agg.result, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* %this, %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"* %__s.0__, i32 %__s.1__, %"struct.std::ios_base"* %__io, i32 %__fill, i32 %__v) {
+entry:
+ tail call fastcc void @_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_( )
+ ret void
+}
+
+define fastcc void @_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_() {
+entry:
+ %tmp.38 = shl i32 0, 3 ; <i32> [#uses=1]
+ %tmp.39 = alloca i8, i32 %tmp.38 ; <i8*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll b/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll
new file mode 100644
index 000000000000..5215bec92909
--- /dev/null
+++ b/test/Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll
@@ -0,0 +1,840 @@
+; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
+; PR827
+@_ZTV8CRjii = internal global [1 x i32 (...)*] [ i32 (...)* @_ZN8CRjii12NlFeeEPN5Jr7sE ] ; <[1 x i32 (...)*]*> [#uses=0]
+
+define internal i32 @_ZN8CRjii12NlFeeEPN5Jr7sE(...) {
+entry:
+ br i1 false, label %cond_true, label %cond_false179
+
+cond_true: ; preds = %entry
+ br label %bb9
+
+bb: ; preds = %cond_true14
+ br label %bb9
+
+bb9: ; preds = %bb, %cond_true
+ br i1 false, label %cond_true14, label %cond_false
+
+cond_true14: ; preds = %bb9
+ br label %bb
+
+cond_false: ; preds = %bb9
+ br label %bb15
+
+cond_next: ; No predecessors!
+ br label %bb15
+
+bb15: ; preds = %cond_next, %cond_false
+ br label %bb24
+
+bb17: ; preds = %cond_true29
+ br label %bb24
+
+bb24: ; preds = %bb17, %bb15
+ br i1 false, label %cond_true29, label %cond_false30
+
+cond_true29: ; preds = %bb24
+ br label %bb17
+
+cond_false30: ; preds = %bb24
+ br label %bb32
+
+cond_next31: ; No predecessors!
+ br label %bb32
+
+bb32: ; preds = %cond_next31, %cond_false30
+ br label %bb41
+
+bb34: ; preds = %cond_true46
+ br label %bb41
+
+bb41: ; preds = %bb34, %bb32
+ br i1 false, label %cond_true46, label %cond_false47
+
+cond_true46: ; preds = %bb41
+ br label %bb34
+
+cond_false47: ; preds = %bb41
+ br label %bb49
+
+cond_next48: ; No predecessors!
+ br label %bb49
+
+bb49: ; preds = %cond_next48, %cond_false47
+ br label %bb58
+
+bb51: ; preds = %cond_true63
+ br label %bb58
+
+bb58: ; preds = %bb51, %bb49
+ br i1 false, label %cond_true63, label %cond_false64
+
+cond_true63: ; preds = %bb58
+ br label %bb51
+
+cond_false64: ; preds = %bb58
+ br label %bb66
+
+cond_next65: ; No predecessors!
+ br label %bb66
+
+bb66: ; preds = %cond_next65, %cond_false64
+ br label %bb76
+
+bb68: ; preds = %cond_true81
+ br label %bb76
+
+bb76: ; preds = %bb68, %bb66
+ br i1 false, label %cond_true81, label %cond_false82
+
+cond_true81: ; preds = %bb76
+ br label %bb68
+
+cond_false82: ; preds = %bb76
+ br label %bb84
+
+cond_next83: ; No predecessors!
+ br label %bb84
+
+bb84: ; preds = %cond_next83, %cond_false82
+ br label %bb94
+
+bb86: ; preds = %cond_true99
+ br label %bb94
+
+bb94: ; preds = %bb86, %bb84
+ br i1 false, label %cond_true99, label %cond_false100
+
+cond_true99: ; preds = %bb94
+ br label %bb86
+
+cond_false100: ; preds = %bb94
+ br label %bb102
+
+cond_next101: ; No predecessors!
+ br label %bb102
+
+bb102: ; preds = %cond_next101, %cond_false100
+ br label %bb112
+
+bb104: ; preds = %cond_true117
+ br label %bb112
+
+bb112: ; preds = %bb104, %bb102
+ br i1 false, label %cond_true117, label %cond_false118
+
+cond_true117: ; preds = %bb112
+ br label %bb104
+
+cond_false118: ; preds = %bb112
+ br label %bb120
+
+cond_next119: ; No predecessors!
+ br label %bb120
+
+bb120: ; preds = %cond_next119, %cond_false118
+ br label %bb130
+
+bb122: ; preds = %cond_true135
+ br label %bb130
+
+bb130: ; preds = %bb122, %bb120
+ br i1 false, label %cond_true135, label %cond_false136
+
+cond_true135: ; preds = %bb130
+ br label %bb122
+
+cond_false136: ; preds = %bb130
+ br label %bb138
+
+cond_next137: ; No predecessors!
+ br label %bb138
+
+bb138: ; preds = %cond_next137, %cond_false136
+ br label %bb148
+
+bb140: ; preds = %cond_true153
+ call fastcc void @_Zjrf1( )
+ br label %bb148
+
+bb148: ; preds = %bb140, %bb138
+ br i1 false, label %cond_true153, label %cond_false154
+
+cond_true153: ; preds = %bb148
+ br label %bb140
+
+cond_false154: ; preds = %bb148
+ br label %bb156
+
+cond_next155: ; No predecessors!
+ br label %bb156
+
+bb156: ; preds = %cond_next155, %cond_false154
+ br label %bb166
+
+bb158: ; preds = %cond_true171
+ br label %bb166
+
+bb166: ; preds = %bb158, %bb156
+ br i1 false, label %cond_true171, label %cond_false172
+
+cond_true171: ; preds = %bb166
+ br label %bb158
+
+cond_false172: ; preds = %bb166
+ br label %bb174
+
+cond_next173: ; No predecessors!
+ br label %bb174
+
+bb174: ; preds = %cond_next173, %cond_false172
+ br label %cleanup
+
+cleanup: ; preds = %bb174
+ br label %finally
+
+finally: ; preds = %cleanup
+ br label %cond_next180
+
+cond_false179: ; preds = %entry
+ br label %cond_next180
+
+cond_next180: ; preds = %cond_false179, %finally
+ br label %return
+
+return: ; preds = %cond_next180
+ ret i32 0
+}
+
+define internal fastcc void @_Zjrf2() {
+entry:
+ br label %bb3
+
+bb: ; preds = %cond_true
+ br label %bb3
+
+bb3: ; preds = %bb, %entry
+ %tmp5 = load i8** null ; <i8*> [#uses=1]
+ %tmp = icmp ne i8* null, %tmp5 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb3
+ br label %bb
+
+cond_false: ; preds = %bb3
+ br label %bb6
+
+cond_next: ; No predecessors!
+ br label %bb6
+
+bb6: ; preds = %cond_next, %cond_false
+ br label %return
+
+return: ; preds = %bb6
+ ret void
+}
+
+define internal fastcc void @_Zjrf3() {
+entry:
+ call fastcc void @_Zjrf2( )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal fastcc void @_Zjrf4() {
+entry:
+ br label %bb6
+
+bb: ; preds = %cond_true
+ br label %bb6
+
+bb6: ; preds = %bb, %entry
+ br i1 false, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb6
+ br label %bb
+
+cond_false: ; preds = %bb6
+ br label %bb8
+
+cond_next: ; No predecessors!
+ br label %bb8
+
+bb8: ; preds = %cond_next, %cond_false
+ br i1 false, label %cond_true9, label %cond_false12
+
+cond_true9: ; preds = %bb8
+ call fastcc void @_Zjrf3( )
+ br label %cond_next13
+
+cond_false12: ; preds = %bb8
+ br label %cond_next13
+
+cond_next13: ; preds = %cond_false12, %cond_true9
+ br label %return
+
+return: ; preds = %cond_next13
+ ret void
+}
+
+define internal fastcc void @_Zjrf5() {
+entry:
+ call fastcc void @_Zjrf4( )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal fastcc void @_Zjrf6() {
+entry:
+ call fastcc void @_Zjrf5( )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal fastcc void @_Zjrf7() {
+entry:
+ br label %cleanup
+
+cleanup: ; preds = %entry
+ br label %finally
+
+finally: ; preds = %cleanup
+ call fastcc void @_Zjrf6( )
+ br label %cleanup9
+
+cleanup9: ; preds = %finally
+ br label %finally8
+
+finally8: ; preds = %cleanup9
+ br label %cleanup11
+
+cleanup11: ; preds = %finally8
+ br label %finally10
+
+finally10: ; preds = %cleanup11
+ br label %finally23
+
+finally23: ; preds = %finally10
+ br label %return
+
+return: ; preds = %finally23
+ ret void
+}
+
+define internal fastcc void @_Zjrf11() {
+entry:
+ br label %bb7
+
+bb: ; preds = %cond_true
+ br label %bb7
+
+bb7: ; preds = %bb, %entry
+ br i1 false, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb7
+ br label %bb
+
+cond_false: ; preds = %bb7
+ br label %bb9
+
+cond_next: ; No predecessors!
+ br label %bb9
+
+bb9: ; preds = %cond_next, %cond_false
+ br label %return
+ ; No predecessors!
+ br i1 false, label %cond_true12, label %cond_false15
+
+cond_true12: ; preds = %0
+ call fastcc void @_Zjrf3( )
+ br label %cond_next16
+
+cond_false15: ; preds = %0
+ br label %cond_next16
+
+cond_next16: ; preds = %cond_false15, %cond_true12
+ br label %return
+
+return: ; preds = %cond_next16, %bb9
+ ret void
+}
+
+define internal fastcc void @_Zjrf9() {
+entry:
+ call fastcc void @_Zjrf11( )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal fastcc void @_Zjrf10() {
+entry:
+ call fastcc void @_Zjrf9( )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal fastcc void @_Zjrf8() {
+entry:
+ br i1 false, label %cond_true, label %cond_false201
+
+cond_true: ; preds = %entry
+ br i1 false, label %cond_true36, label %cond_false
+
+cond_true36: ; preds = %cond_true
+ br label %cleanup
+
+cleanup: ; preds = %cond_true36
+ br label %finally
+
+finally: ; preds = %cleanup
+ br label %cond_next189
+
+cond_false: ; preds = %cond_true
+ br i1 false, label %cond_true99, label %cond_false137
+
+cond_true99: ; preds = %cond_false
+ br label %cleanup136
+
+cleanup136: ; preds = %cond_true99
+ br label %finally135
+
+finally135: ; preds = %cleanup136
+ br label %cond_next
+
+cond_false137: ; preds = %cond_false
+ call fastcc void @_Zjrf10( )
+ br label %cleanup188
+
+cleanup188: ; preds = %cond_false137
+ br label %finally187
+
+finally187: ; preds = %cleanup188
+ br label %cond_next
+
+cond_next: ; preds = %finally187, %finally135
+ br label %cond_next189
+
+cond_next189: ; preds = %cond_next, %finally
+ br label %cond_next202
+
+cond_false201: ; preds = %entry
+ br label %cond_next202
+
+cond_next202: ; preds = %cond_false201, %cond_next189
+ br label %return
+
+return: ; preds = %cond_next202
+ ret void
+}
+
+define internal fastcc void @_Zjrf1() {
+entry:
+ br label %bb492
+
+bb: ; preds = %cond_true499
+ br label %cleanup
+
+cleanup: ; preds = %bb
+ br label %finally
+
+finally: ; preds = %cleanup
+ br label %cleanup11
+
+cleanup11: ; preds = %finally
+ br label %finally10
+
+finally10: ; preds = %cleanup11
+ br i1 false, label %cond_true, label %cond_false286
+
+cond_true: ; preds = %finally10
+ br label %cleanup26
+
+cleanup26: ; preds = %cond_true
+ br label %finally25
+
+finally25: ; preds = %cleanup26
+ br label %bb30
+
+bb27: ; preds = %cond_true37
+ br label %bb30
+
+bb30: ; preds = %bb27, %finally25
+ br i1 false, label %cond_true37, label %cond_false
+
+cond_true37: ; preds = %bb30
+ br label %bb27
+
+cond_false: ; preds = %bb30
+ br label %bb38
+
+cond_next: ; No predecessors!
+ br label %bb38
+
+bb38: ; preds = %cond_next, %cond_false
+ br label %bb148
+
+bb40: ; preds = %cond_true156
+ br label %bb139
+
+bb41: ; preds = %cond_true142
+ call fastcc void @_Zjrf7( )
+ br label %bb105
+
+bb44: ; preds = %cond_true112
+ br label %bb74
+
+bb66: ; preds = %cond_true80
+ br label %bb74
+
+bb74: ; preds = %bb66, %bb44
+ br i1 false, label %cond_true80, label %cond_false81
+
+cond_true80: ; preds = %bb74
+ br label %bb66
+
+cond_false81: ; preds = %bb74
+ br label %bb83
+
+cond_next82: ; No predecessors!
+ br label %bb83
+
+bb83: ; preds = %cond_next82, %cond_false81
+ br label %cleanup97
+
+cleanup97: ; preds = %bb83
+ br label %finally96
+
+finally96: ; preds = %cleanup97
+ br label %cleanup99
+
+cleanup99: ; preds = %finally96
+ br label %finally98
+
+finally98: ; preds = %cleanup99
+ br label %bb105
+
+bb105: ; preds = %finally98, %bb41
+ br i1 false, label %cond_true112, label %cond_false113
+
+cond_true112: ; preds = %bb105
+ br label %bb44
+
+cond_false113: ; preds = %bb105
+ br label %bb115
+
+cond_next114: ; No predecessors!
+ br label %bb115
+
+bb115: ; preds = %cond_next114, %cond_false113
+ br i1 false, label %cond_true119, label %cond_false123
+
+cond_true119: ; preds = %bb115
+ call fastcc void @_Zjrf8( )
+ br label %cond_next124
+
+cond_false123: ; preds = %bb115
+ br label %cond_next124
+
+cond_next124: ; preds = %cond_false123, %cond_true119
+ br i1 false, label %cond_true131, label %cond_false132
+
+cond_true131: ; preds = %cond_next124
+ br label %cleanup135
+
+cond_false132: ; preds = %cond_next124
+ br label %cond_next133
+
+cond_next133: ; preds = %cond_false132
+ br label %cleanup136
+
+cleanup135: ; preds = %cond_true131
+ br label %done
+
+cleanup136: ; preds = %cond_next133
+ br label %finally134
+
+finally134: ; preds = %cleanup136
+ br label %bb139
+
+bb139: ; preds = %finally134, %bb40
+ br i1 false, label %cond_true142, label %cond_false143
+
+cond_true142: ; preds = %bb139
+ br label %bb41
+
+cond_false143: ; preds = %bb139
+ br label %bb145
+
+cond_next144: ; No predecessors!
+ br label %bb145
+
+bb145: ; preds = %cond_next144, %cond_false143
+ br label %bb148
+
+bb148: ; preds = %bb145, %bb38
+ br i1 false, label %cond_true156, label %cond_false157
+
+cond_true156: ; preds = %bb148
+ br label %bb40
+
+cond_false157: ; preds = %bb148
+ br label %bb159
+
+cond_next158: ; No predecessors!
+ br label %bb159
+
+bb159: ; preds = %cond_next158, %cond_false157
+ br label %done
+
+done: ; preds = %bb159, %cleanup135
+ br label %bb214
+
+bb185: ; preds = %cond_true218
+ br i1 false, label %cond_true193, label %cond_false206
+
+cond_true193: ; preds = %bb185
+ br label %cond_next211
+
+cond_false206: ; preds = %bb185
+ br label %cond_next211
+
+cond_next211: ; preds = %cond_false206, %cond_true193
+ br label %bb214
+
+bb214: ; preds = %cond_next211, %done
+ br i1 false, label %cond_true218, label %cond_false219
+
+cond_true218: ; preds = %bb214
+ br label %bb185
+
+cond_false219: ; preds = %bb214
+ br label %bb221
+
+cond_next220: ; No predecessors!
+ br label %bb221
+
+bb221: ; preds = %cond_next220, %cond_false219
+ br i1 false, label %cond_true236, label %cond_false245
+
+cond_true236: ; preds = %bb221
+ br label %cond_next249
+
+cond_false245: ; preds = %bb221
+ br label %cond_next249
+
+cond_next249: ; preds = %cond_false245, %cond_true236
+ br i1 false, label %cond_true272, label %cond_false277
+
+cond_true272: ; preds = %cond_next249
+ br label %cond_next278
+
+cond_false277: ; preds = %cond_next249
+ br label %cond_next278
+
+cond_next278: ; preds = %cond_false277, %cond_true272
+ br label %cleanup285
+
+cleanup285: ; preds = %cond_next278
+ br label %finally284
+
+finally284: ; preds = %cleanup285
+ br label %cond_next287
+
+cond_false286: ; preds = %finally10
+ br label %cond_next287
+
+cond_next287: ; preds = %cond_false286, %finally284
+ br i1 false, label %cond_true317, label %cond_false319
+
+cond_true317: ; preds = %cond_next287
+ br label %cond_next321
+
+cond_false319: ; preds = %cond_next287
+ br label %cond_next321
+
+cond_next321: ; preds = %cond_false319, %cond_true317
+ br label %bb348
+
+bb335: ; preds = %cond_true355
+ br label %bb348
+
+bb348: ; preds = %bb335, %cond_next321
+ br i1 false, label %cond_true355, label %cond_false356
+
+cond_true355: ; preds = %bb348
+ br label %bb335
+
+cond_false356: ; preds = %bb348
+ br label %bb358
+
+cond_next357: ; No predecessors!
+ br label %bb358
+
+bb358: ; preds = %cond_next357, %cond_false356
+ br i1 false, label %cond_true363, label %cond_false364
+
+cond_true363: ; preds = %bb358
+ br label %bb388
+
+cond_false364: ; preds = %bb358
+ br label %cond_next365
+
+cond_next365: ; preds = %cond_false364
+ br i1 false, label %cond_true370, label %cond_false371
+
+cond_true370: ; preds = %cond_next365
+ br label %bb388
+
+cond_false371: ; preds = %cond_next365
+ br label %cond_next372
+
+cond_next372: ; preds = %cond_false371
+ br i1 false, label %cond_true385, label %cond_false386
+
+cond_true385: ; preds = %cond_next372
+ br label %bb388
+
+cond_false386: ; preds = %cond_next372
+ br label %cond_next387
+
+cond_next387: ; preds = %cond_false386
+ br label %bb389
+
+bb388: ; preds = %cond_true385, %cond_true370, %cond_true363
+ br label %bb389
+
+bb389: ; preds = %bb388, %cond_next387
+ br i1 false, label %cond_true392, label %cond_false443
+
+cond_true392: ; preds = %bb389
+ br label %bb419
+
+bb402: ; preds = %cond_true425
+ br i1 false, label %cond_true406, label %cond_false412
+
+cond_true406: ; preds = %bb402
+ br label %cond_next416
+
+cond_false412: ; preds = %bb402
+ br label %cond_next416
+
+cond_next416: ; preds = %cond_false412, %cond_true406
+ br label %bb419
+
+bb419: ; preds = %cond_next416, %cond_true392
+ br i1 false, label %cond_true425, label %cond_false426
+
+cond_true425: ; preds = %bb419
+ br label %bb402
+
+cond_false426: ; preds = %bb419
+ br label %bb428
+
+cond_next427: ; No predecessors!
+ br label %bb428
+
+bb428: ; preds = %cond_next427, %cond_false426
+ br label %cond_next478
+
+cond_false443: ; preds = %bb389
+ br label %bb460
+
+bb450: ; preds = %cond_true466
+ br label %bb460
+
+bb460: ; preds = %bb450, %cond_false443
+ br i1 false, label %cond_true466, label %cond_false467
+
+cond_true466: ; preds = %bb460
+ br label %bb450
+
+cond_false467: ; preds = %bb460
+ br label %bb469
+
+cond_next468: ; No predecessors!
+ br label %bb469
+
+bb469: ; preds = %cond_next468, %cond_false467
+ br label %cond_next478
+
+cond_next478: ; preds = %bb469, %bb428
+ br label %cleanup485
+
+cleanup485: ; preds = %cond_next478
+ br label %finally484
+
+finally484: ; preds = %cleanup485
+ br label %cleanup487
+
+cleanup487: ; preds = %finally484
+ br label %finally486
+
+finally486: ; preds = %cleanup487
+ br label %cleanup489
+
+cleanup489: ; preds = %finally486
+ br label %finally488
+
+finally488: ; preds = %cleanup489
+ br label %bb492
+
+bb492: ; preds = %finally488, %entry
+ br i1 false, label %cond_true499, label %cond_false500
+
+cond_true499: ; preds = %bb492
+ br label %bb
+
+cond_false500: ; preds = %bb492
+ br label %bb502
+
+cond_next501: ; No predecessors!
+ br label %bb502
+
+bb502: ; preds = %cond_next501, %cond_false500
+ br label %return
+
+return: ; preds = %bb502
+ ret void
+}
+
+define internal fastcc void @_ZSt26__unguarded_insertion_sortIN9__gnu_cxx17__normal_iteratorIPSsSt6vectorISsSaISsEEEEEvT_S7_() {
+entry:
+ br label %bb12
+
+bb: ; preds = %cond_true
+ br label %cleanup
+
+cleanup: ; preds = %bb
+ br label %finally
+
+finally: ; preds = %cleanup
+ br label %bb12
+
+bb12: ; preds = %finally, %entry
+ br i1 false, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb12
+ br label %bb
+
+cond_false: ; preds = %bb12
+ br label %bb14
+
+cond_next: ; No predecessors!
+ br label %bb14
+
+bb14: ; preds = %cond_next, %cond_false
+ br label %return
+
+return: ; preds = %bb14
+ ret void
+}
diff --git a/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll b/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll
new file mode 100644
index 000000000000..bd2885dab425
--- /dev/null
+++ b/test/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll
@@ -0,0 +1,245 @@
+; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
+; PR993
+target datalayout = "e-p:32:32"
+target triple = "i386-unknown-openbsd3.9"
+deplibs = [ "stdc++", "c", "crtend" ]
+ %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { i8* }
+ %"struct.__gnu_cxx::char_producer<char>" = type { i32 (...)** }
+ %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.__sbuf = type { i8*, i32 }
+ %"struct.std::__basic_file<char>" = type { %struct.__sFILE*, i1 }
+ %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" }
+ %"struct.std::bad_alloc" = type { %"struct.__gnu_cxx::char_producer<char>" }
+ %"struct.std::basic_filebuf<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", i32, %"struct.std::__basic_file<char>", i32, %union.__mbstate_t, %union.__mbstate_t, i8*, i32, i1, i1, i1, i1, i8, i8*, i8*, i1, %"struct.std::codecvt<char,char,__mbstate_t>"*, i8*, i32, i8*, i8* }
+ %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i1, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* }
+ %"struct.std::basic_iostream<char,std::char_traits<char> >" = type { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_ofstream<char,std::char_traits<char> >" = type { %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_filebuf<char,std::char_traits<char> >", %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" = type { i32, i32, i32 }
+ %"struct.std::codecvt<char,char,__mbstate_t>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", i32* }
+ %"struct.std::ctype<char>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", i32*, i1, i32*, i32*, i32* }
+ %"struct.std::domain_error" = type { %"struct.std::logic_error" }
+ %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %struct.__sbuf, [8 x %struct.__sbuf], i32, %struct.__sbuf*, %"struct.std::locale" }
+ %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
+ %"struct.std::ios_base::_Words" = type { i8*, i32 }
+ %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
+ %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+ %"struct.std::logic_error" = type { %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" }
+ %union.__mbstate_t = type { i64, [120 x i8] }
+@.str_1 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_9 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+
+define void @main() {
+entry:
+ call fastcc void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode( )
+ ret void
+}
+
+define fastcc void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode() {
+entry:
+ %tmp.6 = icmp eq %"struct.std::basic_filebuf<char,std::char_traits<char> >"* null, null ; <i1> [#uses=1]
+ br i1 %tmp.6, label %then, label %UnifiedReturnBlock
+
+then: ; preds = %entry
+ tail call fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate( )
+ ret void
+
+UnifiedReturnBlock: ; preds = %entry
+ ret void
+}
+
+define fastcc void @_ZN10__cxxabiv111__terminateEPFvvE() {
+entry:
+ unreachable
+}
+
+define void @_ZNSdD0Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZThn8_NSdD1Ev() {
+entry:
+ ret void
+}
+
+define void @_ZNSt13basic_filebufIcSt11char_traitsIcEED0Ev() {
+entry:
+ ret void
+}
+
+define void @_ZNSt13basic_filebufIcSt11char_traitsIcEE9pbackfailEi() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSoD2Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEED2Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate() {
+entry:
+ tail call fastcc void @_ZSt19__throw_ios_failurePKc( )
+ ret void
+}
+
+declare fastcc void @_ZNSaIcED1Ev()
+
+define fastcc void @_ZNSsC1EPKcRKSaIcE() {
+entry:
+ tail call fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type( )
+ unreachable
+}
+
+define fastcc void @_ZSt14__convert_to_vIyEvPKcRT_RSt12_Ios_IostateRKPii() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEC1Ej() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZSt19__throw_ios_failurePKc() {
+entry:
+ call fastcc void @_ZNSsC1EPKcRKSaIcE( )
+ unwind
+}
+
+define void @_GLOBAL__D__ZSt23lexicographical_compareIPKaS1_EbT_S2_T0_S3_() {
+entry:
+ ret void
+}
+
+define void @_ZNSt9bad_allocD1Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZSt19__throw_logic_errorPKc() {
+entry:
+ invoke fastcc void @_ZNSt11logic_errorC1ERKSs( )
+ to label %try_exit.0 unwind label %try_catch.0
+
+try_catch.0: ; preds = %entry
+ unreachable
+
+try_exit.0: ; preds = %entry
+ unwind
+}
+
+define fastcc void @_ZNSt11logic_errorC1ERKSs() {
+entry:
+ call fastcc void @_ZNSsC1ERKSs( )
+ ret void
+}
+
+define void @_ZNSt12domain_errorD1Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZSt20__throw_length_errorPKc() {
+entry:
+ call fastcc void @_ZNSt12length_errorC1ERKSs( )
+ unwind
+}
+
+define fastcc void @_ZNSt12length_errorC1ERKSs() {
+entry:
+ invoke fastcc void @_ZNSsC1ERKSs( )
+ to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i
+
+invoke_catch.i: ; preds = %entry
+ unwind
+
+_ZNSt11logic_errorC2ERKSs.exit: ; preds = %entry
+ ret void
+}
+
+define fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE() {
+entry:
+ call fastcc void @_ZSt20__throw_length_errorPKc( )
+ unreachable
+}
+
+define fastcc void @_ZNSs12_S_constructIN9__gnu_cxx17__normal_iteratorIPcSsEEEES2_T_S4_RKSaIcESt20forward_iterator_tag() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type() {
+entry:
+ br i1 false, label %then.1.i, label %endif.1.i
+
+then.1.i: ; preds = %entry
+ call fastcc void @_ZSt19__throw_logic_errorPKc( )
+ br label %endif.1.i
+
+endif.1.i: ; preds = %then.1.i, %entry
+ call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
+ unreachable
+}
+
+define fastcc void @_ZNSsC1ERKSs() {
+entry:
+ call fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_( )
+ invoke fastcc void @_ZNSaIcEC1ERKS_( )
+ to label %invoke_cont.1 unwind label %invoke_catch.1
+
+invoke_catch.1: ; preds = %entry
+ call fastcc void @_ZNSaIcED1Ev( )
+ unwind
+
+invoke_cont.1: ; preds = %entry
+ call fastcc void @_ZNSaIcEC2ERKS_( )
+ ret void
+}
+
+define fastcc void @_ZNSaIcEC1ERKS_() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_jc() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_() {
+entry:
+ br i1 false, label %else.i, label %cond_true
+
+cond_true: ; preds = %entry
+ ret void
+
+else.i: ; preds = %entry
+ tail call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
+ unreachable
+}
+
+define fastcc void @_ZNSaIcEC2ERKS_() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZN9__gnu_cxx12__pool_allocILb1ELi0EE8allocateEj() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZN9__gnu_cxx12__pool_allocILb1ELi0EE9_S_refillEj() {
+entry:
+ unreachable
+}
diff --git a/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll b/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll
new file mode 100644
index 000000000000..05096f425fde
--- /dev/null
+++ b/test/Transforms/Inline/2006-11-09-InlineCGUpdate.ll
@@ -0,0 +1,338 @@
+; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
+; PR992
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+deplibs = [ "stdc++", "c", "crtend" ]
+ %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
+ %"struct.__cxxabiv1::__array_type_info" = type { %"struct.std::type_info" }
+ %"struct.__cxxabiv1::__si_class_type_info" = type { %"struct.__cxxabiv1::__array_type_info", %"struct.__cxxabiv1::__array_type_info"* }
+ %"struct.__gnu_cxx::_Rope_rep_alloc_base<char,std::allocator<char>, true>" = type { i32 }
+ %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { i8* }
+ %"struct.__gnu_cxx::__normal_iterator<const wchar_t*,std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >" = type { i32* }
+ %"struct.__gnu_cxx::char_producer<char>" = type { i32 (...)** }
+ %"struct.__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", %struct._IO_FILE*, i32 }
+ %"struct.__gnu_cxx::stdio_sync_filebuf<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >", %struct._IO_FILE*, i32 }
+ %struct.__locale_struct = type { [13 x %struct.locale_data*], i16*, i32*, i32*, [13 x i8*] }
+ %struct.__mbstate_t = type { i32, %"struct.__gnu_cxx::_Rope_rep_alloc_base<char,std::allocator<char>, true>" }
+ %struct.locale_data = type opaque
+ %"struct.std::__basic_file<char>" = type { %struct._IO_FILE*, i1 }
+ %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" }
+ %"struct.std::basic_filebuf<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", i32, %"struct.std::__basic_file<char>", i32, %struct.__mbstate_t, %struct.__mbstate_t, i8*, i32, i1, i1, i1, i1, i8, i8*, i8*, i1, %"struct.std::codecvt<char,char,__mbstate_t>"*, i8*, i32, i8*, i8* }
+ %"struct.std::basic_filebuf<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >", i32, %"struct.std::__basic_file<char>", i32, %struct.__mbstate_t, %struct.__mbstate_t, i32*, i32, i1, i1, i1, i1, i32, i32*, i32*, i1, %"struct.std::codecvt<char,char,__mbstate_t>"*, i8*, i32, i8*, i8* }
+ %"struct.std::basic_fstream<char,std::char_traits<char> >" = type { { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>" }, %"struct.std::basic_filebuf<char,std::char_traits<char> >", %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_fstream<wchar_t,std::char_traits<wchar_t> >" = type { { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>" }, %"struct.std::basic_filebuf<wchar_t,std::char_traits<wchar_t> >", %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" }
+ %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i1, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* }
+ %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >"*, i32, i1, %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"*, %"struct.std::codecvt<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* }
+ %"struct.std::basic_iostream<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" }
+ %"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" }
+ %"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
+ %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, i32*, i32*, i32*, i32*, i32*, i32*, %"struct.std::locale" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" = type { i32, i32, i32 }
+ %"struct.std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >" = type { %"struct.__gnu_cxx::__normal_iterator<const wchar_t*,std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >" }
+ %"struct.std::codecvt<char,char,__mbstate_t>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", %struct.__locale_struct* }
+ %"struct.std::collate<char>" = type { %"struct.std::locale::facet", %struct.__locale_struct* }
+ %"struct.std::collate_byname<char>" = type { %"struct.std::collate<char>" }
+ %"struct.std::ctype<char>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", %struct.__locale_struct*, i1, i32*, i32*, i16* }
+ %"struct.std::ctype_byname<char>" = type { %"struct.std::ctype<char>" }
+ %"struct.std::domain_error" = type { %"struct.std::logic_error" }
+ %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
+ %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
+ %"struct.std::ios_base::_Words" = type { i8*, i32 }
+ %"struct.std::istreambuf_iterator<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, i32 }
+ %"struct.std::istreambuf_iterator<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"*, i32 }
+ %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
+ %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+ %"struct.std::logic_error" = type { %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" }
+ %"struct.std::type_info" = type { i32 (...)**, i8* }
+@.str_11 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_9 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_1 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+
+define void @main() {
+entry:
+ tail call fastcc void @_ZNSolsEi( )
+ ret void
+}
+
+define fastcc void @_ZNSolsEi() {
+entry:
+ %tmp.22 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.22, label %else, label %then
+
+then: ; preds = %entry
+ ret void
+
+else: ; preds = %entry
+ tail call fastcc void @_ZNSolsEl( )
+ ret void
+}
+
+define void @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate() {
+entry:
+ tail call fastcc void @_ZSt19__throw_ios_failurePKc( )
+ ret void
+}
+
+define fastcc void @_ZNSo3putEc() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSolsEl() {
+entry:
+ %tmp.21.i = icmp eq %"struct.std::basic_ostream<char,std::char_traits<char> >"* null, null ; <i1> [#uses=1]
+ br i1 %tmp.21.i, label %endif.0.i, label %shortcirc_next.i
+
+shortcirc_next.i: ; preds = %entry
+ ret void
+
+endif.0.i: ; preds = %entry
+ call fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate( )
+ ret void
+}
+
+define fastcc void @_ZSt19__throw_ios_failurePKc() {
+entry:
+ call fastcc void @_ZNSsC1EPKcRKSaIcE( )
+ ret void
+}
+
+define fastcc void @_ZNSt8ios_baseD2Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZN9__gnu_cxx18stdio_sync_filebufIwSt11char_traitsIwEE5uflowEv() {
+entry:
+ unreachable
+}
+
+define void @_ZN9__gnu_cxx18stdio_sync_filebufIcSt11char_traitsIcEED1Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZNSt15basic_streambufIcSt11char_traitsIcEE6setbufEPci() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale() {
+entry:
+ ret void
+}
+
+declare fastcc void @_ZNSaIcED1Ev()
+
+define fastcc void @_ZSt19__throw_logic_errorPKc() {
+entry:
+ call fastcc void @_ZNSt11logic_errorC1ERKSs( )
+ ret void
+}
+
+define fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE() {
+entry:
+ br i1 false, label %then.0, label %endif.0
+
+then.0: ; preds = %entry
+ call fastcc void @_ZSt20__throw_length_errorPKc( )
+ ret void
+
+endif.0: ; preds = %entry
+ ret void
+}
+
+define fastcc void @_ZSt20__throw_length_errorPKc() {
+entry:
+ call fastcc void @_ZNSt12length_errorC1ERKSs( )
+ unwind
+}
+
+define fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type() {
+entry:
+ br i1 false, label %then.1.i, label %endif.1.i
+
+then.1.i: ; preds = %entry
+ call fastcc void @_ZSt19__throw_logic_errorPKc( )
+ ret void
+
+endif.1.i: ; preds = %entry
+ call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
+ unreachable
+}
+
+define fastcc void @_ZNSsC1ERKSs() {
+entry:
+ call fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_( )
+ invoke fastcc void @_ZNSaIcEC1ERKS_( )
+ to label %invoke_cont.1 unwind label %invoke_catch.1
+
+invoke_catch.1: ; preds = %entry
+ call fastcc void @_ZNSaIcED1Ev( )
+ unwind
+
+invoke_cont.1: ; preds = %entry
+ call fastcc void @_ZNSaIcEC2ERKS_( )
+ ret void
+}
+
+define fastcc void @_ZNSs7reserveEj() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSaIcEC1ERKS_() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_() {
+entry:
+ br i1 false, label %else.i, label %cond_true
+
+cond_true: ; preds = %entry
+ ret void
+
+else.i: ; preds = %entry
+ tail call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
+ ret void
+}
+
+define fastcc void @_ZNSsC1EPKcRKSaIcE() {
+entry:
+ tail call fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type( )
+ unreachable
+}
+
+define fastcc void @_ZNSaIcEC2ERKS_() {
+entry:
+ ret void
+}
+
+define void @_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZNSt14collate_bynameIcED1Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateRy() {
+entry:
+ ret void
+}
+
+define void @_ZNSt23__codecvt_abstract_baseIcc11__mbstate_tED1Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZNSt12ctype_bynameIcED0Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSt8messagesIwEC1Ej() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZSt14__convert_to_vIlEvPKcRT_RSt12_Ios_IostateRKP15__locale_structi() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEEC1Ej() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEC1Ej() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE16_M_extract_floatES3_S3_RSt8ios_baseRSt12_Ios_IostateRSs() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSbIwSt11char_traitsIwESaIwEE4swapERS2_() {
+entry:
+ ret void
+}
+
+define void @_ZNSt14basic_iostreamIwSt11char_traitsIwEED0Ev() {
+entry:
+ unreachable
+}
+
+define void @_ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv() {
+entry:
+ ret void
+}
+
+define void @_ZNSt9exceptionD0Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSt11logic_errorC1ERKSs() {
+entry:
+ call fastcc void @_ZNSsC1ERKSs( )
+ ret void
+}
+
+define fastcc void @_ZNSt11logic_errorD2Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSt12length_errorC1ERKSs() {
+entry:
+ invoke fastcc void @_ZNSsC1ERKSs( )
+ to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i
+
+invoke_catch.i: ; preds = %entry
+ unwind
+
+_ZNSt11logic_errorC2ERKSs.exit: ; preds = %entry
+ ret void
+}
+
+define void @_ZNK10__cxxabiv120__si_class_type_info20__do_find_public_srcEiPKvPKNS_17__class_type_infoES2_() {
+entry:
+ ret void
+}
+
+define fastcc void @_ZNSbIwSt11char_traitsIwESaIwEE16_S_construct_auxIPKwEEPwT_S7_RKS1_12__false_type() {
+entry:
+ ret void
+}
+
+define void @_ZTv0_n12_NSt13basic_fstreamIwSt11char_traitsIwEED1Ev() {
+entry:
+ ret void
+}
+
+define void @_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev() {
+entry:
+ unreachable
+}
+
+define fastcc void @_ZNSt5ctypeIcEC1EPKtbj() {
+entry:
+ ret void
+}
diff --git a/test/Transforms/Inline/2007-04-15-InlineEH.ll b/test/Transforms/Inline/2007-04-15-InlineEH.ll
new file mode 100644
index 000000000000..083a328ae673
--- /dev/null
+++ b/test/Transforms/Inline/2007-04-15-InlineEH.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep {invoke void asm}
+; PR1335
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+ %struct.gnat__strings__string_access = type { i8*, %struct.string___XUB* }
+ %struct.string___XUB = type { i32, i32 }
+
+define void @bc__support__high_resolution_time__clock() {
+entry:
+ call void asm "rdtsc\0A\09movl %eax, $0\0A\09movl %edx, $1", "=*imr,=*imr,~{dirflag},~{fpsr},~{flags},~{dx},~{ax}"( i32* null, i32* null ) nounwind
+ unreachable
+}
+
+define fastcc void @bc__support__high_resolution_time__initialize_clock_rate() {
+entry:
+ invoke void @gnat__os_lib__getenv( %struct.gnat__strings__string_access* null )
+ to label %invcont unwind label %cleanup144
+
+invcont: ; preds = %entry
+ invoke void @ada__calendar__delays__delay_for( )
+ to label %invcont64 unwind label %cleanup144
+
+invcont64: ; preds = %invcont
+ invoke void @ada__calendar__clock( )
+ to label %invcont65 unwind label %cleanup144
+
+invcont65: ; preds = %invcont64
+ invoke void @bc__support__high_resolution_time__clock( )
+ to label %invcont67 unwind label %cleanup144
+
+invcont67: ; preds = %invcont65
+ ret void
+
+cleanup144: ; preds = %invcont65, %invcont64, %invcont, %entry
+ unwind
+}
+
+declare void @gnat__os_lib__getenv(%struct.gnat__strings__string_access*)
+
+declare void @ada__calendar__delays__delay_for()
+
+declare void @ada__calendar__clock()
+
+define void @bc__support__high_resolution_time___elabb() {
+entry:
+ call fastcc void @bc__support__high_resolution_time__initialize_clock_rate( )
+ ret void
+}
diff --git a/test/Transforms/Inline/2007-06-06-NoInline.ll b/test/Transforms/Inline/2007-06-06-NoInline.ll
new file mode 100644
index 000000000000..51bba0705338
--- /dev/null
+++ b/test/Transforms/Inline/2007-06-06-NoInline.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -inline -f - | llvm-dis | grep "define internal i32 @bar"
+@llvm.noinline = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32)* @bar to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
+
+define internal i32 @bar(i32 %x, i32 %y) {
+entry:
+ %x_addr = alloca i32 ; <i32*> [#uses=2]
+ %y_addr = alloca i32 ; <i32*> [#uses=2]
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %x, i32* %x_addr
+ store i32 %y, i32* %y_addr
+ %tmp1 = load i32* %x_addr ; <i32> [#uses=1]
+ %tmp2 = load i32* %y_addr ; <i32> [#uses=1]
+ %tmp3 = add i32 %tmp1, %tmp2 ; <i32> [#uses=1]
+ store i32 %tmp3, i32* %tmp
+ %tmp4 = load i32* %tmp ; <i32> [#uses=1]
+ store i32 %tmp4, i32* %retval
+ br label %return
+
+return: ; preds = %entry
+ %retval5 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval5
+}
+
+define i32 @foo(i32 %a, i32 %b) {
+entry:
+ %a_addr = alloca i32 ; <i32*> [#uses=2]
+ %b_addr = alloca i32 ; <i32*> [#uses=2]
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %a, i32* %a_addr
+ store i32 %b, i32* %b_addr
+ %tmp1 = load i32* %b_addr ; <i32> [#uses=1]
+ %tmp2 = load i32* %a_addr ; <i32> [#uses=1]
+ %tmp3 = call i32 @bar( i32 %tmp1, i32 %tmp2 ) ; <i32> [#uses=1]
+ store i32 %tmp3, i32* %tmp
+ %tmp4 = load i32* %tmp ; <i32> [#uses=1]
+ store i32 %tmp4, i32* %retval
+ br label %return
+
+return: ; preds = %entry
+ %retval5 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval5
+}
diff --git a/test/Transforms/Inline/2007-06-25-WeakInline.ll b/test/Transforms/Inline/2007-06-25-WeakInline.ll
new file mode 100644
index 000000000000..3cf758ca8c8e
--- /dev/null
+++ b/test/Transforms/Inline/2007-06-25-WeakInline.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep call
+
+; 'bar' can be overridden at link-time, don't inline it.
+
+define void @foo() {
+entry:
+ tail call void @bar( ) ; <i32> [#uses=0]
+ ret void
+}
+
+define weak void @bar() {
+ ret void
+}
+
diff --git a/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll b/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll
new file mode 100644
index 000000000000..5f7da15fc1b2
--- /dev/null
+++ b/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep nounwind
+; RUN: llvm-as %s -o - | opt -inline | llvm-dis | grep unreachable
+
+declare i1 @extern()
+
+define internal i32 @test() {
+entry:
+ %n = call i1 @extern( )
+ br i1 %n, label %r, label %u
+r:
+ ret i32 0;
+u:
+ unwind
+}
+
+define i32 @caller() {
+ %X = call i32 @test( ) nounwind
+ ret i32 %X
+}
diff --git a/test/Transforms/Inline/2008-03-04-StructRet.ll b/test/Transforms/Inline/2008-03-04-StructRet.ll
new file mode 100644
index 000000000000..fc7ebc4d8095
--- /dev/null
+++ b/test/Transforms/Inline/2008-03-04-StructRet.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+ %struct.Benchmark = type { i32 (...)** }
+ %struct.Complex = type { double, double }
+ %struct.ComplexBenchmark = type { %struct.Benchmark }
+
+define %struct.Complex @_Zml7ComplexS_1(double %a.0, double %a.1, double %b.0, double %b.1) nounwind {
+entry:
+ %mrv = alloca %struct.Complex ; <%struct.Complex*> [#uses=2]
+ %mrv.gep = getelementptr %struct.Complex* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
+ %mrv.gep1 = getelementptr %struct.Complex* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
+ ret double %mrv.ld, double %mrv.ld2
+}
+
+define void @_ZNK16ComplexBenchmark9oop_styleEv(%struct.ComplexBenchmark* %this) nounwind {
+entry:
+ %tmp = alloca %struct.Complex ; <%struct.Complex*> [#uses=0]
+ br label %bb31
+bb: ; preds = %bb31
+ call %struct.Complex @_Zml7ComplexS_1( double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Complex>:0 [#uses=1]
+ %gr = getresult %struct.Complex %0, 1 ; <double> [#uses=0]
+ br label %bb31
+bb31: ; preds = %bb, %entry
+ br i1 false, label %bb, label %return
+return: ; preds = %bb31
+ ret void
+}
diff --git a/test/Transforms/Inline/2008-03-07-Inline-2.ll b/test/Transforms/Inline/2008-03-07-Inline-2.ll
new file mode 100644
index 000000000000..0c256906a072
--- /dev/null
+++ b/test/Transforms/Inline/2008-03-07-Inline-2.ll
@@ -0,0 +1,53 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+ %struct.Demand = type { double, double }
+ %struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] }
+ %struct.leaf = type { %struct.Demand, double, double }
+@P = external global double ; <double*> [#uses=1]
+
+define %struct.leaf* @build_leaf() nounwind {
+entry:
+ unreachable
+}
+
+define %struct.Demand @Compute_Branch2(%struct.branch* %br, double %theta_R, double %theta_I, double %pi_R, double %pi_I) nounwind {
+entry:
+ %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4]
+ %a2 = alloca %struct.Demand ; <%struct.Demand*> [#uses=0]
+ br i1 false, label %bb46, label %bb
+bb: ; preds = %entry
+ %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
+ %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
+ ret double %mrv.ld, double %mrv.ld2
+bb46: ; preds = %entry
+ br label %bb72
+bb49: ; preds = %bb72
+ call %struct.Demand @Compute_Leaf1( %struct.leaf* null, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Demand>:0 [#uses=1]
+ %gr = getresult %struct.Demand %0, 1 ; <double> [#uses=0]
+ br label %bb72
+bb72: ; preds = %bb49, %bb46
+ br i1 false, label %bb49, label %bb77
+bb77: ; preds = %bb72
+ %mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1]
+ %mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1]
+ ret double %mrv.ld4, double %mrv.ld6
+}
+
+define %struct.Demand @Compute_Leaf1(%struct.leaf* %l, double %pi_R, double %pi_I) nounwind {
+entry:
+ %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=2]
+ %tmp10 = load double* @P, align 8 ; <double> [#uses=1]
+ %tmp11 = fcmp olt double %tmp10, 0.000000e+00 ; <i1> [#uses=1]
+ br i1 %tmp11, label %bb, label %bb13
+bb: ; preds = %entry
+ br label %bb13
+bb13: ; preds = %bb, %entry
+ %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
+ %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
+ ret double %mrv.ld, double %mrv.ld2
+}
diff --git a/test/Transforms/Inline/2008-03-07-Inline.ll b/test/Transforms/Inline/2008-03-07-Inline.ll
new file mode 100644
index 000000000000..09d14f021343
--- /dev/null
+++ b/test/Transforms/Inline/2008-03-07-Inline.ll
@@ -0,0 +1,57 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+ %struct.Demand = type { double, double }
+ %struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] }
+ %struct.leaf = type { %struct.Demand, double, double }
+@P = external global double ; <double*> [#uses=1]
+
+define %struct.leaf* @build_leaf() nounwind {
+entry:
+ unreachable
+}
+
+define %struct.Demand @Compute_Branch2(%struct.branch* %br, double %theta_R, double %theta_I, double %pi_R, double %pi_I) nounwind {
+entry:
+ %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4]
+ %a2 = alloca %struct.Demand ; <%struct.Demand*> [#uses=0]
+ br i1 false, label %bb46, label %bb
+bb: ; preds = %entry
+ %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
+ %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
+ ret double %mrv.ld, double %mrv.ld2
+bb46: ; preds = %entry
+ br label %bb72
+bb49: ; preds = %bb72
+ call %struct.Demand @Compute_Leaf1( %struct.leaf* null, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Demand>:0 [#uses=1]
+ %gr = getresult %struct.Demand %0, 1 ; <double> [#uses=0]
+ br label %bb72
+bb72: ; preds = %bb49, %bb46
+ br i1 false, label %bb49, label %bb77
+bb77: ; preds = %bb72
+ %mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1]
+ %mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1]
+ ret double %mrv.ld4, double %mrv.ld6
+}
+
+define %struct.Demand @Compute_Leaf1(%struct.leaf* %l, double %pi_R, double %pi_I) nounwind {
+entry:
+ %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4]
+ %tmp10 = load double* @P, align 8 ; <double> [#uses=1]
+ %tmp11 = fcmp olt double %tmp10, 0.000000e+00 ; <i1> [#uses=1]
+ br i1 %tmp11, label %bb, label %bb13
+bb: ; preds = %entry
+ %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld = load double* %mrv.gep ; <double> [#uses=1]
+ %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1]
+ ret double %mrv.ld, double %mrv.ld2
+bb13: ; preds = %entry
+ %mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1]
+ %mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1]
+ %mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1]
+ %mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1]
+ ret double %mrv.ld4, double %mrv.ld6
+}
diff --git a/test/Transforms/Inline/2008-09-02-AlwaysInline.ll b/test/Transforms/Inline/2008-09-02-AlwaysInline.ll
new file mode 100644
index 000000000000..b42e559c5af0
--- /dev/null
+++ b/test/Transforms/Inline/2008-09-02-AlwaysInline.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -inline-threshold=0 -inline | llvm-dis | not grep call
+
+define i32 @fn2() alwaysinline {
+ ret i32 1
+}
+
+define i32 @fn3() {
+ %r = call i32 @fn2()
+ ret i32 %r
+}
diff --git a/test/Transforms/Inline/2008-09-02-NoInline.ll b/test/Transforms/Inline/2008-09-02-NoInline.ll
new file mode 100644
index 000000000000..35b4b4678b7e
--- /dev/null
+++ b/test/Transforms/Inline/2008-09-02-NoInline.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep call | count 1
+
+define i32 @fn2() noinline {
+ ret i32 1
+}
+
+define i32 @fn3() {
+ %r = call i32 @fn2()
+ ret i32 %r
+}
diff --git a/test/Transforms/Inline/2008-10-30-AlwaysInline.ll b/test/Transforms/Inline/2008-10-30-AlwaysInline.ll
new file mode 100644
index 000000000000..765fc7578769
--- /dev/null
+++ b/test/Transforms/Inline/2008-10-30-AlwaysInline.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -always-inline | llvm-dis | not grep call
+
+; Ensure that threshold doesn't disrupt always inline.
+; RUN: llvm-as < %s | opt -inline-threshold=-2000000001 -always-inline | llvm-dis | not grep call
+
+
+define internal i32 @if0() alwaysinline {
+ ret i32 1
+}
+
+define i32 @f0() {
+ %r = call i32 @if0()
+ ret i32 %r
+}
diff --git a/test/Transforms/Inline/2008-11-04-AlwaysInline.ll b/test/Transforms/Inline/2008-11-04-AlwaysInline.ll
new file mode 100644
index 000000000000..753985239b3b
--- /dev/null
+++ b/test/Transforms/Inline/2008-11-04-AlwaysInline.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -always-inline | llvm-dis | grep {@foo}
+; Ensure that foo is not removed by always inliner
+; PR 2945
+
+define internal i32 @foo() nounwind {
+ ret i32 0
+}
diff --git a/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll b/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll
new file mode 100644
index 000000000000..14840bac676d
--- /dev/null
+++ b/test/Transforms/Inline/2009-01-08-NoInlineDynamicAlloca.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep call
+; Do not inline calls to variable-sized alloca.
+
+@q = common global i8* null ; <i8**> [#uses=1]
+
+define i8* @a(i32 %i) nounwind {
+entry:
+ %i_addr = alloca i32 ; <i32*> [#uses=2]
+ %retval = alloca i8* ; <i8**> [#uses=1]
+ %p = alloca i8* ; <i8**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %i, i32* %i_addr
+ %0 = load i32* %i_addr, align 4 ; <i32> [#uses=1]
+ %1 = alloca i8, i32 %0 ; <i8*> [#uses=1]
+ store i8* %1, i8** %p, align 4
+ %2 = load i8** %p, align 4 ; <i8*> [#uses=1]
+ store i8* %2, i8** @q, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i8** %retval ; <i8*> [#uses=1]
+ ret i8* %retval1
+}
+
+define void @b(i32 %i) nounwind {
+entry:
+ %i_addr = alloca i32 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %i, i32* %i_addr
+ %0 = load i32* %i_addr, align 4 ; <i32> [#uses=1]
+ %1 = call i8* @a(i32 %0) nounwind ; <i8*> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/Inline/2009-01-12-RecursiveInline.ll b/test/Transforms/Inline/2009-01-12-RecursiveInline.ll
new file mode 100644
index 000000000000..8a4b2e052f31
--- /dev/null
+++ b/test/Transforms/Inline/2009-01-12-RecursiveInline.ll
@@ -0,0 +1,92 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep {call.*fib} | count 4
+; First call to fib from fib is inlined, producing 2 instead of 1, total 3.
+; Second call to fib from fib is not inlined because new body of fib exceeds
+; inlining limit of 200. Plus call in main = 4 total.
+
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+@"\01LC" = internal constant [5 x i8] c"%ld\0A\00" ; <[5 x i8]*> [#uses=1]
+
+define i32 @fib(i32 %n) nounwind {
+entry:
+ %n_addr = alloca i32 ; <i32*> [#uses=4]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %0 = alloca i32 ; <i32*> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %n, i32* %n_addr
+ %1 = load i32* %n_addr, align 4 ; <i32> [#uses=1]
+ %2 = icmp ule i32 %1, 1 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb1
+
+bb: ; preds = %entry
+ store i32 1, i32* %0, align 4
+ br label %bb2
+
+bb1: ; preds = %entry
+ %3 = load i32* %n_addr, align 4 ; <i32> [#uses=1]
+ %4 = sub i32 %3, 2 ; <i32> [#uses=1]
+ %5 = call i32 @fib(i32 %4) nounwind ; <i32> [#uses=1]
+ %6 = load i32* %n_addr, align 4 ; <i32> [#uses=1]
+ %7 = sub i32 %6, 1 ; <i32> [#uses=1]
+ %8 = call i32 @fib(i32 %7) nounwind ; <i32> [#uses=1]
+ %9 = add i32 %5, %8 ; <i32> [#uses=1]
+ store i32 %9, i32* %0, align 4
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %10 = load i32* %0, align 4 ; <i32> [#uses=1]
+ store i32 %10, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval3
+}
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+ %argc_addr = alloca i32 ; <i32*> [#uses=2]
+ %argv_addr = alloca i8** ; <i8***> [#uses=2]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %N = alloca i32 ; <i32*> [#uses=2]
+ %0 = alloca i32 ; <i32*> [#uses=2]
+ %iftmp.0 = alloca i32 ; <i32*> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %argc, i32* %argc_addr
+ store i8** %argv, i8*** %argv_addr
+ %1 = load i32* %argc_addr, align 4 ; <i32> [#uses=1]
+ %2 = icmp eq i32 %1, 2 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %3 = load i8*** %argv_addr, align 4 ; <i8**> [#uses=1]
+ %4 = getelementptr i8** %3, i32 1 ; <i8**> [#uses=1]
+ %5 = load i8** %4, align 4 ; <i8*> [#uses=1]
+ %6 = call i32 @atoi(i8* %5) nounwind ; <i32> [#uses=1]
+ store i32 %6, i32* %iftmp.0, align 4
+ br label %bb2
+
+bb1: ; preds = %entry
+ store i32 43, i32* %iftmp.0, align 4
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %7 = load i32* %iftmp.0, align 4 ; <i32> [#uses=1]
+ store i32 %7, i32* %N, align 4
+ %8 = load i32* %N, align 4 ; <i32> [#uses=1]
+ %9 = call i32 @fib(i32 %8) nounwind ; <i32> [#uses=1]
+ %10 = call i32 (i8*, ...)* @printf(i8* getelementptr ([5 x i8]* @"\01LC", i32 0, i32 0), i32 %9) nounwind ; <i32> [#uses=0]
+ store i32 0, i32* %0, align 4
+ %11 = load i32* %0, align 4 ; <i32> [#uses=1]
+ store i32 %11, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval3
+}
+
+declare i32 @atoi(i8*)
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll b/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll
new file mode 100644
index 000000000000..3702afa8611c
--- /dev/null
+++ b/test/Transforms/Inline/2009-01-13-RecursiveInlineCrash.ll
@@ -0,0 +1,293 @@
+; RUN: llvm-as < %s | opt -inline -argpromotion -disable-output
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+ %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* }
+@NumNodes = external global i32 ; <i32*> [#uses=0]
+@"\01LC" = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
+@"\01LC1" = external constant [19 x i8] ; <[19 x i8]*> [#uses=0]
+@"\01LC2" = external constant [17 x i8] ; <[17 x i8]*> [#uses=0]
+
+declare i32 @dealwithargs(i32, i8** nocapture) nounwind
+
+declare i32 @atoi(i8*)
+
+define internal fastcc i32 @adj(i32 %d, i32 %ct) nounwind readnone {
+entry:
+ switch i32 %d, label %return [
+ i32 0, label %bb
+ i32 1, label %bb10
+ i32 2, label %bb5
+ i32 3, label %bb15
+ ]
+
+bb: ; preds = %entry
+ switch i32 %ct, label %bb3 [
+ i32 1, label %return
+ i32 0, label %return
+ ]
+
+bb3: ; preds = %bb
+ ret i32 0
+
+bb5: ; preds = %entry
+ switch i32 %ct, label %bb8 [
+ i32 3, label %return
+ i32 2, label %return
+ ]
+
+bb8: ; preds = %bb5
+ ret i32 0
+
+bb10: ; preds = %entry
+ switch i32 %ct, label %bb13 [
+ i32 1, label %return
+ i32 3, label %return
+ ]
+
+bb13: ; preds = %bb10
+ ret i32 0
+
+bb15: ; preds = %entry
+ switch i32 %ct, label %bb18 [
+ i32 2, label %return
+ i32 0, label %return
+ ]
+
+bb18: ; preds = %bb15
+ ret i32 0
+
+return: ; preds = %bb15, %bb15, %bb10, %bb10, %bb5, %bb5, %bb, %bb, %entry
+ ret i32 1
+}
+
+declare fastcc i32 @reflect(i32, i32) nounwind readnone
+
+declare i32 @CountTree(%struct.quad_struct* nocapture) nounwind readonly
+
+define internal fastcc %struct.quad_struct* @child(%struct.quad_struct* nocapture %tree, i32 %ct) nounwind readonly {
+entry:
+ switch i32 %ct, label %bb5 [
+ i32 0, label %bb1
+ i32 1, label %bb
+ i32 2, label %bb3
+ i32 3, label %bb2
+ ]
+
+bb: ; preds = %entry
+ %0 = getelementptr %struct.quad_struct* %tree, i32 0, i32 3 ; <%struct.quad_struct**> [#uses=1]
+ %1 = load %struct.quad_struct** %0, align 4 ; <%struct.quad_struct*> [#uses=1]
+ ret %struct.quad_struct* %1
+
+bb1: ; preds = %entry
+ %2 = getelementptr %struct.quad_struct* %tree, i32 0, i32 2 ; <%struct.quad_struct**> [#uses=1]
+ %3 = load %struct.quad_struct** %2, align 4 ; <%struct.quad_struct*> [#uses=1]
+ ret %struct.quad_struct* %3
+
+bb2: ; preds = %entry
+ %4 = getelementptr %struct.quad_struct* %tree, i32 0, i32 5 ; <%struct.quad_struct**> [#uses=1]
+ %5 = load %struct.quad_struct** %4, align 4 ; <%struct.quad_struct*> [#uses=1]
+ ret %struct.quad_struct* %5
+
+bb3: ; preds = %entry
+ %6 = getelementptr %struct.quad_struct* %tree, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1]
+ %7 = load %struct.quad_struct** %6, align 4 ; <%struct.quad_struct*> [#uses=1]
+ ret %struct.quad_struct* %7
+
+bb5: ; preds = %entry
+ ret %struct.quad_struct* null
+}
+
+define internal fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* nocapture %tree, i32 %d) nounwind readonly {
+entry:
+ %0 = getelementptr %struct.quad_struct* %tree, i32 0, i32 6 ; <%struct.quad_struct**> [#uses=1]
+ %1 = load %struct.quad_struct** %0, align 4 ; <%struct.quad_struct*> [#uses=4]
+ %2 = getelementptr %struct.quad_struct* %tree, i32 0, i32 1 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=2]
+ %4 = icmp eq %struct.quad_struct* %1, null ; <i1> [#uses=1]
+ br i1 %4, label %bb3, label %bb
+
+bb: ; preds = %entry
+ %5 = call fastcc i32 @adj(i32 %d, i32 %3) nounwind ; <i32> [#uses=1]
+ %6 = icmp eq i32 %5, 0 ; <i1> [#uses=1]
+ br i1 %6, label %bb3, label %bb1
+
+bb1: ; preds = %bb
+ %7 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %1, i32 %d) nounwind ; <%struct.quad_struct*> [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb1, %bb, %entry
+ %q.0 = phi %struct.quad_struct* [ %7, %bb1 ], [ %1, %bb ], [ %1, %entry ] ; <%struct.quad_struct*> [#uses=4]
+ %8 = icmp eq %struct.quad_struct* %q.0, null ; <i1> [#uses=1]
+ br i1 %8, label %bb7, label %bb4
+
+bb4: ; preds = %bb3
+ %9 = getelementptr %struct.quad_struct* %q.0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %10 = load i32* %9, align 4 ; <i32> [#uses=1]
+ %11 = icmp eq i32 %10, 2 ; <i1> [#uses=1]
+ br i1 %11, label %bb5, label %bb7
+
+bb5: ; preds = %bb4
+ %12 = call fastcc i32 @reflect(i32 %d, i32 %3) nounwind ; <i32> [#uses=1]
+ %13 = call fastcc %struct.quad_struct* @child(%struct.quad_struct* %q.0, i32 %12) nounwind ; <%struct.quad_struct*> [#uses=1]
+ ret %struct.quad_struct* %13
+
+bb7: ; preds = %bb4, %bb3
+ ret %struct.quad_struct* %q.0
+}
+
+declare fastcc i32 @sum_adjacent(%struct.quad_struct* nocapture, i32, i32, i32) nounwind readonly
+
+define i32 @perimeter(%struct.quad_struct* nocapture %tree, i32 %size) nounwind readonly {
+entry:
+ %0 = getelementptr %struct.quad_struct* %tree, i32 0, i32 0 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ %2 = icmp eq i32 %1, 2 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb2
+
+bb: ; preds = %entry
+ %3 = getelementptr %struct.quad_struct* %tree, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1]
+ %4 = load %struct.quad_struct** %3, align 4 ; <%struct.quad_struct*> [#uses=1]
+ %5 = sdiv i32 %size, 2 ; <i32> [#uses=1]
+ %6 = call i32 @perimeter(%struct.quad_struct* %4, i32 %5) nounwind ; <i32> [#uses=1]
+ %7 = getelementptr %struct.quad_struct* %tree, i32 0, i32 5 ; <%struct.quad_struct**> [#uses=1]
+ %8 = load %struct.quad_struct** %7, align 4 ; <%struct.quad_struct*> [#uses=1]
+ %9 = sdiv i32 %size, 2 ; <i32> [#uses=1]
+ %10 = call i32 @perimeter(%struct.quad_struct* %8, i32 %9) nounwind ; <i32> [#uses=1]
+ %11 = add i32 %10, %6 ; <i32> [#uses=1]
+ %12 = getelementptr %struct.quad_struct* %tree, i32 0, i32 3 ; <%struct.quad_struct**> [#uses=1]
+ %13 = load %struct.quad_struct** %12, align 4 ; <%struct.quad_struct*> [#uses=1]
+ %14 = sdiv i32 %size, 2 ; <i32> [#uses=1]
+ %15 = call i32 @perimeter(%struct.quad_struct* %13, i32 %14) nounwind ; <i32> [#uses=1]
+ %16 = add i32 %15, %11 ; <i32> [#uses=1]
+ %17 = getelementptr %struct.quad_struct* %tree, i32 0, i32 2 ; <%struct.quad_struct**> [#uses=1]
+ %18 = load %struct.quad_struct** %17, align 4 ; <%struct.quad_struct*> [#uses=1]
+ %19 = sdiv i32 %size, 2 ; <i32> [#uses=1]
+ %20 = call i32 @perimeter(%struct.quad_struct* %18, i32 %19) nounwind ; <i32> [#uses=1]
+ %21 = add i32 %20, %16 ; <i32> [#uses=1]
+ ret i32 %21
+
+bb2: ; preds = %entry
+ %22 = getelementptr %struct.quad_struct* %tree, i32 0, i32 0 ; <i32*> [#uses=1]
+ %23 = load i32* %22, align 4 ; <i32> [#uses=1]
+ %24 = icmp eq i32 %23, 0 ; <i1> [#uses=1]
+ br i1 %24, label %bb3, label %bb23
+
+bb3: ; preds = %bb2
+ %25 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 0) nounwind ; <%struct.quad_struct*> [#uses=4]
+ %26 = icmp eq %struct.quad_struct* %25, null ; <i1> [#uses=1]
+ br i1 %26, label %bb8, label %bb4
+
+bb4: ; preds = %bb3
+ %27 = getelementptr %struct.quad_struct* %25, i32 0, i32 0 ; <i32*> [#uses=1]
+ %28 = load i32* %27, align 4 ; <i32> [#uses=1]
+ %29 = icmp eq i32 %28, 1 ; <i1> [#uses=1]
+ br i1 %29, label %bb8, label %bb6
+
+bb6: ; preds = %bb4
+ %30 = getelementptr %struct.quad_struct* %25, i32 0, i32 0 ; <i32*> [#uses=1]
+ %31 = load i32* %30, align 4 ; <i32> [#uses=1]
+ %32 = icmp eq i32 %31, 2 ; <i1> [#uses=1]
+ br i1 %32, label %bb7, label %bb8
+
+bb7: ; preds = %bb6
+ %33 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %25, i32 3, i32 2, i32 %size) nounwind ; <i32> [#uses=1]
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6, %bb4, %bb3
+ %retval1.1 = phi i32 [ 0, %bb6 ], [ %33, %bb7 ], [ %size, %bb4 ], [ %size, %bb3 ] ; <i32> [#uses=3]
+ %34 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 1) nounwind ; <%struct.quad_struct*> [#uses=4]
+ %35 = icmp eq %struct.quad_struct* %34, null ; <i1> [#uses=1]
+ br i1 %35, label %bb10, label %bb9
+
+bb9: ; preds = %bb8
+ %36 = getelementptr %struct.quad_struct* %34, i32 0, i32 0 ; <i32*> [#uses=1]
+ %37 = load i32* %36, align 4 ; <i32> [#uses=1]
+ %38 = icmp eq i32 %37, 1 ; <i1> [#uses=1]
+ br i1 %38, label %bb10, label %bb11
+
+bb10: ; preds = %bb9, %bb8
+ %39 = add i32 %retval1.1, %size ; <i32> [#uses=1]
+ br label %bb13
+
+bb11: ; preds = %bb9
+ %40 = getelementptr %struct.quad_struct* %34, i32 0, i32 0 ; <i32*> [#uses=1]
+ %41 = load i32* %40, align 4 ; <i32> [#uses=1]
+ %42 = icmp eq i32 %41, 2 ; <i1> [#uses=1]
+ br i1 %42, label %bb12, label %bb13
+
+bb12: ; preds = %bb11
+ %43 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %34, i32 2, i32 0, i32 %size) nounwind ; <i32> [#uses=1]
+ %44 = add i32 %43, %retval1.1 ; <i32> [#uses=1]
+ br label %bb13
+
+bb13: ; preds = %bb12, %bb11, %bb10
+ %retval1.2 = phi i32 [ %retval1.1, %bb11 ], [ %44, %bb12 ], [ %39, %bb10 ] ; <i32> [#uses=3]
+ %45 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 2) nounwind ; <%struct.quad_struct*> [#uses=4]
+ %46 = icmp eq %struct.quad_struct* %45, null ; <i1> [#uses=1]
+ br i1 %46, label %bb15, label %bb14
+
+bb14: ; preds = %bb13
+ %47 = getelementptr %struct.quad_struct* %45, i32 0, i32 0 ; <i32*> [#uses=1]
+ %48 = load i32* %47, align 4 ; <i32> [#uses=1]
+ %49 = icmp eq i32 %48, 1 ; <i1> [#uses=1]
+ br i1 %49, label %bb15, label %bb16
+
+bb15: ; preds = %bb14, %bb13
+ %50 = add i32 %retval1.2, %size ; <i32> [#uses=1]
+ br label %bb18
+
+bb16: ; preds = %bb14
+ %51 = getelementptr %struct.quad_struct* %45, i32 0, i32 0 ; <i32*> [#uses=1]
+ %52 = load i32* %51, align 4 ; <i32> [#uses=1]
+ %53 = icmp eq i32 %52, 2 ; <i1> [#uses=1]
+ br i1 %53, label %bb17, label %bb18
+
+bb17: ; preds = %bb16
+ %54 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %45, i32 0, i32 1, i32 %size) nounwind ; <i32> [#uses=1]
+ %55 = add i32 %54, %retval1.2 ; <i32> [#uses=1]
+ br label %bb18
+
+bb18: ; preds = %bb17, %bb16, %bb15
+ %retval1.3 = phi i32 [ %retval1.2, %bb16 ], [ %55, %bb17 ], [ %50, %bb15 ] ; <i32> [#uses=3]
+ %56 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 3) nounwind ; <%struct.quad_struct*> [#uses=4]
+ %57 = icmp eq %struct.quad_struct* %56, null ; <i1> [#uses=1]
+ br i1 %57, label %bb20, label %bb19
+
+bb19: ; preds = %bb18
+ %58 = getelementptr %struct.quad_struct* %56, i32 0, i32 0 ; <i32*> [#uses=1]
+ %59 = load i32* %58, align 4 ; <i32> [#uses=1]
+ %60 = icmp eq i32 %59, 1 ; <i1> [#uses=1]
+ br i1 %60, label %bb20, label %bb21
+
+bb20: ; preds = %bb19, %bb18
+ %61 = add i32 %retval1.3, %size ; <i32> [#uses=1]
+ ret i32 %61
+
+bb21: ; preds = %bb19
+ %62 = getelementptr %struct.quad_struct* %56, i32 0, i32 0 ; <i32*> [#uses=1]
+ %63 = load i32* %62, align 4 ; <i32> [#uses=1]
+ %64 = icmp eq i32 %63, 2 ; <i1> [#uses=1]
+ br i1 %64, label %bb22, label %bb23
+
+bb22: ; preds = %bb21
+ %65 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %56, i32 1, i32 3, i32 %size) nounwind ; <i32> [#uses=1]
+ %66 = add i32 %65, %retval1.3 ; <i32> [#uses=1]
+ ret i32 %66
+
+bb23: ; preds = %bb21, %bb2
+ %retval1.0 = phi i32 [ 0, %bb2 ], [ %retval1.3, %bb21 ] ; <i32> [#uses=1]
+ ret i32 %retval1.0
+}
+
+declare i32 @main(i32, i8** nocapture) noreturn nounwind
+
+declare i32 @printf(i8*, ...) nounwind
+
+declare void @exit(i32) noreturn nounwind
+
+declare fastcc i32 @CheckOutside(i32, i32) nounwind readnone
+
+declare fastcc i32 @CheckIntersect(i32, i32, i32) nounwind readnone
+
+declare %struct.quad_struct* @MakeTree(i32, i32, i32, i32, i32, %struct.quad_struct*, i32, i32) nounwind
diff --git a/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll b/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll
new file mode 100644
index 000000000000..067fd72e939b
--- /dev/null
+++ b/test/Transforms/Inline/2009-05-07-CallUsingSelfCrash.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -inline -disable-output
+; PR4123
+ %struct.S0 = type <{ i32 }>
+ %struct.S1 = type <{ i8, i8, i8, i8, %struct.S0 }>
+ %struct.S2 = type <{ %struct.S1, i32 }>
+
+define void @func_113(%struct.S1* noalias nocapture sret %agg.result, i8 signext %p_114) noreturn nounwind {
+entry:
+ unreachable
+
+for.inc: ; preds = %for.inc
+ %call48 = call fastcc signext i8 @safe_sub_func_uint8_t_u_u(i8 signext %call48) ; <i8> [#uses=1]
+ br label %for.inc
+}
+
+define fastcc signext i8 @safe_sub_func_uint8_t_u_u(i8 signext %_ui1) nounwind readnone {
+entry:
+ ret i8 %_ui1
+}
+
diff --git a/test/Transforms/Inline/alloca_test.ll b/test/Transforms/Inline/alloca_test.ll
new file mode 100644
index 000000000000..1fbd095354a9
--- /dev/null
+++ b/test/Transforms/Inline/alloca_test.ll
@@ -0,0 +1,21 @@
+; This test ensures that alloca instructions in the entry block for an inlined
+; function are moved to the top of the function they are inlined into.
+;
+; RUN: llvm-as < %s | opt -inline | llvm-dis | %prcontext alloca 1 | grep Entry:
+
+define i32 @func(i32 %i) {
+ %X = alloca i32 ; <i32*> [#uses=1]
+ store i32 %i, i32* %X
+ ret i32 %i
+}
+
+declare void @bar()
+
+define i32 @main(i32 %argc) {
+Entry:
+ call void @bar( )
+ %X = call i32 @func( i32 7 ) ; <i32> [#uses=1]
+ %Y = add i32 %X, %argc ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/Inline/always_inline_dyn_alloca.ll b/test/Transforms/Inline/always_inline_dyn_alloca.ll
new file mode 100644
index 000000000000..933925e50251
--- /dev/null
+++ b/test/Transforms/Inline/always_inline_dyn_alloca.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
+; rdar://6655932
+
+; If callee is marked alwaysinline, inline it! Even if callee has dynamic
+; alloca and caller does not,
+
+define internal void @callee(i32 %N) alwaysinline {
+ %P = alloca i32, i32 %N
+ ret void
+}
+
+define void @foo(i32 %N) {
+ call void @callee( i32 %N )
+ ret void
+}
diff --git a/test/Transforms/Inline/basictest.ll b/test/Transforms/Inline/basictest.ll
new file mode 100644
index 000000000000..d954238dabe4
--- /dev/null
+++ b/test/Transforms/Inline/basictest.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -inline -disable-output -print-function 2> /dev/null
+
+define i32 @func(i32 %i) {
+ ret i32 %i
+}
+
+define i32 @main(i32 %argc) {
+ %X = call i32 @func( i32 7 ) ; <i32> [#uses=1]
+ %Y = add i32 %X, %argc ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/Inline/byval.ll b/test/Transforms/Inline/byval.ll
new file mode 100644
index 000000000000..ea8c35760386
--- /dev/null
+++ b/test/Transforms/Inline/byval.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep {llvm.memcpy}
+
+; Inlining a byval struct should cause an explicit copy into an alloca.
+
+ %struct.ss = type { i32, i64 }
+@.str = internal constant [10 x i8] c"%d, %lld\0A\00" ; <[10 x i8]*> [#uses=1]
+
+define internal void @f(%struct.ss* byval %b) nounwind {
+entry:
+ %tmp = getelementptr %struct.ss* %b, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp1 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmp1, 1 ; <i32> [#uses=1]
+ store i32 %tmp2, i32* %tmp, align 4
+ ret void
+}
+
+declare i32 @printf(i8*, ...) nounwind
+
+define i32 @main() nounwind {
+entry:
+ %S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
+ %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp1, align 8
+ %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ store i64 2, i64* %tmp4, align 4
+ call void @f( %struct.ss* byval %S ) nounwind
+ ret i32 0
+}
diff --git a/test/Transforms/Inline/byval2.ll b/test/Transforms/Inline/byval2.ll
new file mode 100644
index 000000000000..e949d01856d4
--- /dev/null
+++ b/test/Transforms/Inline/byval2.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep {llvm.memcpy}
+
+; Inlining a byval struct should NOT cause an explicit copy
+; into an alloca if the function is readonly
+
+ %struct.ss = type { i32, i64 }
+@.str = internal constant [10 x i8] c"%d, %lld\0A\00" ; <[10 x i8]*> [#uses=1]
+
+define internal i32 @f(%struct.ss* byval %b) nounwind readonly {
+entry:
+ %tmp = getelementptr %struct.ss* %b, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp1 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmp1, 1 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+declare i32 @printf(i8*, ...) nounwind
+
+define i32 @main() nounwind {
+entry:
+ %S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
+ %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp1, align 8
+ %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ store i64 2, i64* %tmp4, align 4
+ %X = call i32 @f( %struct.ss* byval %S ) nounwind
+ ret i32 %X
+}
diff --git a/test/Transforms/Inline/casts.ll b/test/Transforms/Inline/casts.ll
new file mode 100644
index 000000000000..029d309fd8e0
--- /dev/null
+++ b/test/Transforms/Inline/casts.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep {ret i32 1}
+; ModuleID = 'short.opt.bc'
+
+define i32 @testBool(i1 %X) {
+ %tmp = zext i1 %X to i32 ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+define i32 @testByte(i8 %X) {
+ %tmp = icmp ne i8 %X, 0 ; <i1> [#uses=1]
+ %tmp.i = zext i1 %tmp to i32 ; <i32> [#uses=1]
+ ret i32 %tmp.i
+}
+
+define i32 @main() {
+ %rslt = call i32 @testByte( i8 123 ) ; <i32> [#uses=1]
+ ret i32 %rslt
+}
+
diff --git a/test/Transforms/Inline/cfg_preserve_test.ll b/test/Transforms/Inline/cfg_preserve_test.ll
new file mode 100644
index 000000000000..6b6ff18ecfd0
--- /dev/null
+++ b/test/Transforms/Inline/cfg_preserve_test.ll
@@ -0,0 +1,16 @@
+; This test ensures that inlining an "empty" function does not destroy the CFG
+;
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep br
+
+define i32 @func(i32 %i) {
+ ret i32 %i
+}
+
+declare void @bar()
+
+define i32 @main(i32 %argc) {
+Entry:
+ %X = call i32 @func( i32 7 ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/Inline/dg.exp b/test/Transforms/Inline/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/Inline/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/Inline/dynamic_alloca_test.ll b/test/Transforms/Inline/dynamic_alloca_test.ll
new file mode 100644
index 000000000000..b8ff7dedc493
--- /dev/null
+++ b/test/Transforms/Inline/dynamic_alloca_test.ll
@@ -0,0 +1,35 @@
+; Test that functions with dynamic allocas get inlined in a case where
+; naively inlining it would result in a miscompilation.
+; Functions with dynamic allocas can only be inlined into functions that
+; already have dynamic allocas.
+
+; RUN: llvm-as < %s | opt -inline | llvm-dis | \
+; RUN: grep llvm.stacksave
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
+
+
+declare void @ext(i32*)
+
+define internal void @callee(i32 %N) {
+ %P = alloca i32, i32 %N ; <i32*> [#uses=1]
+ call void @ext( i32* %P )
+ ret void
+}
+
+define void @foo(i32 %N) {
+; <label>:0
+ %P = alloca i32, i32 %N ; <i32*> [#uses=1]
+ call void @ext( i32* %P )
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %count = phi i32 [ 0, %0 ], [ %next, %Loop ] ; <i32> [#uses=2]
+ %next = add i32 %count, 1 ; <i32> [#uses=1]
+ call void @callee( i32 %N )
+ %cond = icmp eq i32 %count, 100000 ; <i1> [#uses=1]
+ br i1 %cond, label %out, label %Loop
+
+out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/Inline/externally_available.ll b/test/Transforms/Inline/externally_available.ll
new file mode 100644
index 000000000000..68f7d65d6595
--- /dev/null
+++ b/test/Transforms/Inline/externally_available.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -inline -constprop | llvm-dis > %t
+; RUN: not grep test_function %t
+; RUN: grep {ret i32 5} %t
+
+
+; test_function should not be emitted to the .s file.
+define available_externally i32 @test_function() {
+ ret i32 4
+}
+
+
+define i32 @result() {
+ %A = call i32 @test_function()
+ %B = add i32 %A, 1
+ ret i32 %B
+} \ No newline at end of file
diff --git a/test/Transforms/Inline/inline-invoke-tail.ll b/test/Transforms/Inline/inline-invoke-tail.ll
new file mode 100644
index 000000000000..53f755e44564
--- /dev/null
+++ b/test/Transforms/Inline/inline-invoke-tail.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep {tail call void @llvm.memcpy.i32}
+; PR3550
+
+define internal void @foo(i32* %p, i32* %q) {
+ %pp = bitcast i32* %p to i8*
+ %qq = bitcast i32* %q to i8*
+ tail call void @llvm.memcpy.i32(i8* %pp, i8* %qq, i32 4, i32 1)
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind
+
+define i32 @main() {
+ %a = alloca i32 ; <i32*> [#uses=3]
+ %b = alloca i32 ; <i32*> [#uses=2]
+ store i32 1, i32* %a, align 4
+ store i32 0, i32* %b, align 4
+ invoke void @foo(i32* %a, i32* %b)
+ to label %invcont unwind label %lpad
+
+invcont:
+ %retval = load i32* %a, align 4
+ ret i32 %retval
+
+lpad:
+ %eh_ptr = call i8* @llvm.eh.exception()
+ %eh_select = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null)
+ unreachable
+}
+
+declare i8* @llvm.eh.exception() nounwind
+
+declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/test/Transforms/Inline/inline-tail.ll b/test/Transforms/Inline/inline-tail.ll
new file mode 100644
index 000000000000..5921655b7364
--- /dev/null
+++ b/test/Transforms/Inline/inline-tail.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep tail
+
+declare void @bar(i32*)
+
+define internal void @foo(i32* %P) {
+ tail call void @bar( i32* %P )
+ ret void
+}
+
+define void @caller() {
+ %A = alloca i32 ; <i32*> [#uses=1]
+ call void @foo( i32* %A )
+ ret void
+}
+
diff --git a/test/Transforms/Inline/inline_cleanup.ll b/test/Transforms/Inline/inline_cleanup.ll
new file mode 100644
index 000000000000..89b3a8283c06
--- /dev/null
+++ b/test/Transforms/Inline/inline_cleanup.ll
@@ -0,0 +1,63 @@
+; Test that the inliner doesn't leave around dead allocas, and that it folds
+; uncond branches away after it is done specializing.
+
+; RUN: llvm-as < %s | opt -inline | llvm-dis | \
+; RUN: not grep {alloca.*uses=0}
+; RUN: llvm-as < %s | opt -inline | llvm-dis | \
+; RUN: not grep {br label}
+@A = weak global i32 0 ; <i32*> [#uses=1]
+@B = weak global i32 0 ; <i32*> [#uses=1]
+@C = weak global i32 0 ; <i32*> [#uses=1]
+
+define internal fastcc void @foo(i32 %X) {
+entry:
+ %ALL = alloca i32, align 4 ; <i32*> [#uses=1]
+ %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
+ %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
+ br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
+
+cond_true: ; preds = %entry
+ store i32 1, i32* @A
+ br label %cond_next
+
+cond_next: ; preds = %cond_true, %entry
+ %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
+ %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
+ br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
+
+cond_true5: ; preds = %cond_next
+ store i32 1, i32* @B
+ br label %cond_next7
+
+cond_next7: ; preds = %cond_true5, %cond_next
+ %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
+ %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
+ br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
+
+cond_true11: ; preds = %cond_next7
+ store i32 1, i32* @C
+ br label %cond_next13
+
+cond_next13: ; preds = %cond_true11, %cond_next7
+ %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
+ %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
+ br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
+
+cond_true17: ; preds = %cond_next13
+ call void @ext( i32* %ALL )
+ ret void
+
+UnifiedReturnBlock: ; preds = %cond_next13
+ ret void
+}
+
+declare void @ext(i32*)
+
+define void @test() {
+entry:
+ tail call fastcc void @foo( i32 1 )
+ tail call fastcc void @foo( i32 2 )
+ tail call fastcc void @foo( i32 3 )
+ tail call fastcc void @foo( i32 8 )
+ ret void
+}
diff --git a/test/Transforms/Inline/inline_constprop.ll b/test/Transforms/Inline/inline_constprop.ll
new file mode 100644
index 000000000000..4744c862335b
--- /dev/null
+++ b/test/Transforms/Inline/inline_constprop.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep div
+
+
+define internal i32 @callee(i32 %A, i32 %B) {
+ %C = sdiv i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test() {
+ %X = call i32 @callee( i32 10, i32 3 ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/Inline/inline_dce.ll b/test/Transforms/Inline/inline_dce.ll
new file mode 100644
index 000000000000..dd971bee9300
--- /dev/null
+++ b/test/Transforms/Inline/inline_dce.ll
@@ -0,0 +1,25 @@
+; This checks to ensure that the inline pass deletes functions if they get
+; inlined into all of their callers.
+
+; RUN: llvm-as < %s | opt -inline | llvm-dis | \
+; RUN: not grep @reallysmall
+
+define internal i32 @reallysmall(i32 %A) {
+ ret i32 %A
+}
+
+define void @caller1() {
+ call i32 @reallysmall( i32 5 ) ; <i32>:1 [#uses=0]
+ ret void
+}
+
+define void @caller2(i32 %A) {
+ call i32 @reallysmall( i32 %A ) ; <i32>:1 [#uses=0]
+ ret void
+}
+
+define i32 @caller3(i32 %A) {
+ %B = call i32 @reallysmall( i32 %A ) ; <i32> [#uses=1]
+ ret i32 %B
+}
+
diff --git a/test/Transforms/Inline/inline_prune.ll b/test/Transforms/Inline/inline_prune.ll
new file mode 100644
index 000000000000..fcd8321d5a0f
--- /dev/null
+++ b/test/Transforms/Inline/inline_prune.ll
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | \
+; RUN: not grep {callee\[12\](}
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep mul
+
+define internal i32 @callee1(i32 %A, i32 %B) {
+ %cond = icmp eq i32 %A, 123 ; <i1> [#uses=1]
+ br i1 %cond, label %T, label %F
+
+T: ; preds = %0
+ %C = mul i32 %B, %B ; <i32> [#uses=1]
+ ret i32 %C
+
+F: ; preds = %0
+ ret i32 0
+}
+
+define internal i32 @callee2(i32 %A, i32 %B) {
+ switch i32 %A, label %T [
+ i32 10, label %F
+ i32 1234, label %G
+ ]
+ ; No predecessors!
+ %cond = icmp eq i32 %A, 123 ; <i1> [#uses=1]
+ br i1 %cond, label %T, label %F
+
+T: ; preds = %1, %0
+ %C = mul i32 %B, %B ; <i32> [#uses=1]
+ ret i32 %C
+
+F: ; preds = %1, %0
+ ret i32 0
+
+G: ; preds = %0
+ %D = mul i32 %B, %B ; <i32> [#uses=1]
+ %E = mul i32 %D, %B ; <i32> [#uses=1]
+ ret i32 %E
+}
+
+define i32 @test(i32 %A) {
+ %X = call i32 @callee1( i32 10, i32 %A ) ; <i32> [#uses=1]
+ %Y = call i32 @callee2( i32 10, i32 %A ) ; <i32> [#uses=1]
+ %Z = add i32 %X, %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/Inline/invoke_test-1.ll b/test/Transforms/Inline/invoke_test-1.ll
new file mode 100644
index 000000000000..1fd3317fd1f2
--- /dev/null
+++ b/test/Transforms/Inline/invoke_test-1.ll
@@ -0,0 +1,24 @@
+; Test that we can inline a simple function, turning the calls in it into invoke
+; instructions
+
+; RUN: llvm-as < %s | opt -inline | llvm-dis | \
+; RUN: not grep {call\[^e\]}
+
+declare void @might_throw()
+
+define internal void @callee() {
+ call void @might_throw( )
+ ret void
+}
+
+; caller returns true if might_throw throws an exception...
+define i32 @caller() {
+ invoke void @callee( )
+ to label %cont unwind label %exc
+
+cont: ; preds = %0
+ ret i32 0
+
+exc: ; preds = %0
+ ret i32 1
+}
diff --git a/test/Transforms/Inline/invoke_test-2.ll b/test/Transforms/Inline/invoke_test-2.ll
new file mode 100644
index 000000000000..68b8bd8b65a3
--- /dev/null
+++ b/test/Transforms/Inline/invoke_test-2.ll
@@ -0,0 +1,30 @@
+; Test that if an invoked function is inlined, and if that function cannot
+; throw, that the dead handler is now unreachable.
+
+; RUN: llvm-as < %s | opt -inline -simplifycfg | llvm-dis | \
+; RUN: not grep UnreachableExceptionHandler
+
+declare void @might_throw()
+
+define internal i32 @callee() {
+ invoke void @might_throw( )
+ to label %cont unwind label %exc
+
+cont: ; preds = %0
+ ret i32 0
+
+exc: ; preds = %0
+ ret i32 1
+}
+
+; caller returns true if might_throw throws an exception... callee cannot throw.
+define i32 @caller() {
+ %X = invoke i32 @callee( )
+ to label %cont unwind label %UnreachableExceptionHandler ; <i32> [#uses=1]
+
+cont: ; preds = %0
+ ret i32 %X
+
+UnreachableExceptionHandler: ; preds = %0
+ ret i32 -1
+}
diff --git a/test/Transforms/Inline/invoke_test-3.ll b/test/Transforms/Inline/invoke_test-3.ll
new file mode 100644
index 000000000000..a5deec6aa881
--- /dev/null
+++ b/test/Transforms/Inline/invoke_test-3.ll
@@ -0,0 +1,32 @@
+; Test that any rethrown exceptions in an inlined function are automatically
+; turned into branches to the invoke destination.
+
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep unwind$
+
+declare void @might_throw()
+
+define internal i32 @callee() {
+ invoke void @might_throw( )
+ to label %cont unwind label %exc
+
+cont: ; preds = %0
+ ret i32 0
+
+exc: ; preds = %0a
+ ; This just rethrows the exception!
+ unwind
+}
+
+; caller returns true if might_throw throws an exception... which gets
+; propagated by callee.
+define i32 @caller() {
+ %X = invoke i32 @callee( )
+ to label %cont unwind label %Handler ; <i32> [#uses=1]
+
+cont: ; preds = %0
+ ret i32 %X
+
+Handler: ; preds = %0
+; This consumes an exception thrown by might_throw
+ ret i32 1
+}
diff --git a/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll b/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll
new file mode 100644
index 000000000000..94ce68e989b3
--- /dev/null
+++ b/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll
@@ -0,0 +1,9 @@
+; This testcase causes instcombine to hang.
+;
+; RUN: llvm-as < %s | opt -instcombine
+
+define void @test(i32 %X) {
+ %reg117 = add i32 %X, 0 ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll
new file mode 100644
index 000000000000..34c2df605e42
--- /dev/null
+++ b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll
@@ -0,0 +1,10 @@
+; Instcombine was missing a test that caused it to make illegal transformations
+; sometimes. In this case, it transforms the sub into an add:
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub
+;
+define i32 @test(i32 %i, i32 %j) {
+ %A = mul i32 %i, %j
+ %B = sub i32 2, %A
+ ret i32 %B
+}
+
diff --git a/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll b/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll
new file mode 100644
index 000000000000..4ebbe2470fa4
--- /dev/null
+++ b/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll
@@ -0,0 +1,508 @@
+; This testcase, obviously distilled from a large program (bzip2 from
+; Specint2000) caused instcombine to fail because it got the same instruction
+; on it's worklist more than once (which is ok), but then deleted the
+; instruction. Since the inst stayed on the worklist, as soon as it came back
+; up to be processed, bad things happened, and opt asserted.
+;
+; RUN: llvm-as < %s | opt -instcombine
+;
+; END.
+
+@.LC0 = internal global [21 x i8] c"hbMakeCodeLengths(1)\00" ; <[21 x i8]*> [#uses=1]
+@.LC1 = internal global [21 x i8] c"hbMakeCodeLengths(2)\00" ; <[21 x i8]*> [#uses=1]
+
+define void @hbMakeCodeLengths(i8* %len, i32* %freq, i32 %alphaSize, i32 %maxLen) {
+bb0:
+ %len.upgrd.1 = alloca i8* ; <i8**> [#uses=2]
+ store i8* %len, i8** %len.upgrd.1
+ %freq.upgrd.2 = alloca i32* ; <i32**> [#uses=2]
+ store i32* %freq, i32** %freq.upgrd.2
+ %alphaSize.upgrd.3 = alloca i32 ; <i32*> [#uses=2]
+ store i32 %alphaSize, i32* %alphaSize.upgrd.3
+ %maxLen.upgrd.4 = alloca i32 ; <i32*> [#uses=2]
+ store i32 %maxLen, i32* %maxLen.upgrd.4
+ %heap = alloca i32, i32 260 ; <i32*> [#uses=27]
+ %weight = alloca i32, i32 516 ; <i32*> [#uses=18]
+ %parent = alloca i32, i32 516 ; <i32*> [#uses=7]
+ br label %bb1
+
+bb1: ; preds = %bb0
+ %reg107 = load i8** %len.upgrd.1 ; <i8*> [#uses=1]
+ %reg108 = load i32** %freq.upgrd.2 ; <i32*> [#uses=1]
+ %reg109 = load i32* %alphaSize.upgrd.3 ; <i32> [#uses=10]
+ %reg110 = load i32* %maxLen.upgrd.4 ; <i32> [#uses=1]
+ %cond747 = icmp sge i32 0, %reg109 ; <i1> [#uses=1]
+ br i1 %cond747, label %bb6, label %bb2
+
+bb2: ; preds = %bb5, %bb1
+ %reg591 = phi i32 [ %reg594, %bb5 ], [ 0, %bb1 ] ; <i32> [#uses=3]
+ %reg591-idxcast1 = bitcast i32 %reg591 to i32 ; <i32> [#uses=1]
+ %reg591-idxcast1-offset = add i32 %reg591-idxcast1, 1 ; <i32> [#uses=1]
+ %reg591-idxcast1-offset.upgrd.5 = zext i32 %reg591-idxcast1-offset to i64 ; <i64> [#uses=1]
+ %reg126 = getelementptr i32* %weight, i64 %reg591-idxcast1-offset.upgrd.5 ; <i32*> [#uses=1]
+ %reg591-idxcast = sext i32 %reg591 to i64 ; <i64> [#uses=1]
+ %reg132 = getelementptr i32* %reg108, i64 %reg591-idxcast ; <i32*> [#uses=1]
+ %reg133 = load i32* %reg132 ; <i32> [#uses=2]
+ %cond748 = icmp eq i32 %reg133, 0 ; <i1> [#uses=1]
+ br i1 %cond748, label %bb4, label %bb3
+
+bb3: ; preds = %bb2
+ %reg127 = shl i32 %reg133, 8 ; <i32> [#uses=1]
+ br label %bb5
+
+bb4: ; preds = %bb2
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb3
+ %reg593 = phi i32 [ 256, %bb4 ], [ %reg127, %bb3 ] ; <i32> [#uses=1]
+ store i32 %reg593, i32* %reg126
+ %reg594 = add i32 %reg591, 1 ; <i32> [#uses=2]
+ %cond749 = icmp slt i32 %reg594, %reg109 ; <i1> [#uses=1]
+ br i1 %cond749, label %bb2, label %bb6
+
+bb6: ; preds = %bb43, %bb41, %bb5, %bb1
+ store i32 0, i32* %heap
+ store i32 0, i32* %weight
+ store i32 -2, i32* %parent
+ %cond750 = icmp sgt i32 1, %reg109 ; <i1> [#uses=1]
+ br i1 %cond750, label %bb11, label %bb7
+
+bb7: ; preds = %bb10, %bb6
+ %reg597 = phi i32 [ %reg598, %bb10 ], [ 0, %bb6 ] ; <i32> [#uses=5]
+ %reg597-casted = bitcast i32 %reg597 to i32 ; <i32> [#uses=1]
+ %reg596 = add i32 %reg597-casted, 1 ; <i32> [#uses=3]
+ %reg597-offset = add i32 %reg597, 1 ; <i32> [#uses=1]
+ %reg597-offset.upgrd.6 = zext i32 %reg597-offset to i64 ; <i64> [#uses=1]
+ %reg149 = getelementptr i32* %parent, i64 %reg597-offset.upgrd.6 ; <i32*> [#uses=1]
+ store i32 -1, i32* %reg149
+ %reg598 = add i32 %reg597, 1 ; <i32> [#uses=3]
+ %reg597-offset1 = add i32 %reg597, 1 ; <i32> [#uses=1]
+ %reg597-offset1.upgrd.7 = zext i32 %reg597-offset1 to i64 ; <i64> [#uses=1]
+ %reg157 = getelementptr i32* %heap, i64 %reg597-offset1.upgrd.7 ; <i32*> [#uses=1]
+ store i32 %reg596, i32* %reg157
+ br label %bb9
+
+bb8: ; preds = %bb9
+ %reg599 = zext i32 %reg599.upgrd.8 to i64 ; <i64> [#uses=1]
+ %reg198 = getelementptr i32* %heap, i64 %reg599 ; <i32*> [#uses=1]
+ store i32 %reg182, i32* %reg198
+ %cast938 = bitcast i32 %reg174 to i32 ; <i32> [#uses=1]
+ br label %bb9
+
+bb9: ; preds = %bb8, %bb7
+ %reg599.upgrd.8 = phi i32 [ %cast938, %bb8 ], [ %reg598, %bb7 ] ; <i32> [#uses=3]
+ %cast807 = bitcast i32 %reg599.upgrd.8 to i32 ; <i32> [#uses=1]
+ %reg597-offset2 = add i32 %reg597, 1 ; <i32> [#uses=1]
+ %reg597-offset2.upgrd.9 = zext i32 %reg597-offset2 to i64 ; <i64> [#uses=1]
+ %reg173 = getelementptr i32* %weight, i64 %reg597-offset2.upgrd.9 ; <i32*> [#uses=1]
+ %reg174 = ashr i32 %cast807, 1 ; <i32> [#uses=2]
+ %reg174-idxcast = bitcast i32 %reg174 to i32 ; <i32> [#uses=1]
+ zext i32 %reg174-idxcast to i64 ; <i64>:0 [#uses=1]
+ %reg181 = getelementptr i32* %heap, i64 %0 ; <i32*> [#uses=1]
+ %reg182 = load i32* %reg181 ; <i32> [#uses=2]
+ %reg182-idxcast = bitcast i32 %reg182 to i32 ; <i32> [#uses=1]
+ zext i32 %reg182-idxcast to i64 ; <i64>:1 [#uses=1]
+ %reg189 = getelementptr i32* %weight, i64 %1 ; <i32*> [#uses=1]
+ %reg190 = load i32* %reg173 ; <i32> [#uses=1]
+ %reg191 = load i32* %reg189 ; <i32> [#uses=1]
+ %cond751 = icmp slt i32 %reg190, %reg191 ; <i1> [#uses=1]
+ br i1 %cond751, label %bb8, label %bb10
+
+bb10: ; preds = %bb9
+ zext i32 %reg599.upgrd.8 to i64 ; <i64>:2 [#uses=1]
+ %reg214 = getelementptr i32* %heap, i64 %2 ; <i32*> [#uses=1]
+ store i32 %reg596, i32* %reg214
+ %reg601 = add i32 %reg596, 1 ; <i32> [#uses=1]
+ %cond752 = icmp sle i32 %reg601, %reg109 ; <i1> [#uses=1]
+ br i1 %cond752, label %bb7, label %bb11
+
+bb11: ; preds = %bb10, %bb6
+ %reg602 = phi i32 [ %reg598, %bb10 ], [ 0, %bb6 ] ; <i32> [#uses=3]
+ %cast819 = bitcast i32 %reg602 to i32 ; <i32> [#uses=1]
+ %cast818 = bitcast i32 %reg602 to i32 ; <i32> [#uses=1]
+ %cond753 = icmp sle i32 %cast818, 259 ; <i1> [#uses=1]
+ br i1 %cond753, label %bb13, label %bb12
+
+bb12: ; preds = %bb11
+ zext i32 0 to i64 ; <i64>:3 [#uses=1]
+ zext i32 0 to i64 ; <i64>:4 [#uses=1]
+ %cast784 = getelementptr [21 x i8]* @.LC0, i64 %3, i64 %4 ; <i8*> [#uses=1]
+ call void @panic( i8* %cast784 )
+ br label %bb13
+
+bb13: ; preds = %bb12, %bb11
+ %cond754 = icmp sle i32 %cast819, 1 ; <i1> [#uses=1]
+ %cast918 = bitcast i32 %reg109 to i32 ; <i32> [#uses=1]
+ %cast940 = bitcast i32 %reg602 to i32 ; <i32> [#uses=1]
+ %cast942 = bitcast i32 %reg109 to i32 ; <i32> [#uses=1]
+ br i1 %cond754, label %bb32, label %bb14
+
+bb14: ; preds = %bb31, %bb13
+ %cann-indvar1 = phi i32 [ 0, %bb13 ], [ %add1-indvar1, %bb31 ] ; <i32> [#uses=3]
+ %cann-indvar1-casted = bitcast i32 %cann-indvar1 to i32 ; <i32> [#uses=1]
+ %reg603-scale = mul i32 %cann-indvar1-casted, -1 ; <i32> [#uses=1]
+ %reg603 = add i32 %reg603-scale, %cast940 ; <i32> [#uses=4]
+ %reg604 = add i32 %cann-indvar1, %cast942 ; <i32> [#uses=4]
+ %add1-indvar1 = add i32 %cann-indvar1, 1 ; <i32> [#uses=1]
+ zext i32 1 to i64 ; <i64>:5 [#uses=1]
+ %reg7551 = getelementptr i32* %heap, i64 %5 ; <i32*> [#uses=1]
+ %reg113 = load i32* %reg7551 ; <i32> [#uses=2]
+ %reg603-idxcast = bitcast i32 %reg603 to i32 ; <i32> [#uses=1]
+ zext i32 %reg603-idxcast to i64 ; <i64>:6 [#uses=1]
+ %reg222 = getelementptr i32* %heap, i64 %6 ; <i32*> [#uses=1]
+ %reg223 = load i32* %reg222 ; <i32> [#uses=1]
+ zext i32 1 to i64 ; <i64>:7 [#uses=1]
+ %reg7561 = getelementptr i32* %heap, i64 %7 ; <i32*> [#uses=1]
+ store i32 %reg223, i32* %reg7561
+ %reg605 = add i32 %reg603, -1 ; <i32> [#uses=4]
+ zext i32 1 to i64 ; <i64>:8 [#uses=1]
+ %reg757 = getelementptr i32* %heap, i64 %8 ; <i32*> [#uses=1]
+ %reg226 = load i32* %reg757 ; <i32> [#uses=2]
+ %cond758 = icmp sgt i32 2, %reg605 ; <i1> [#uses=1]
+ br i1 %cond758, label %bb20, label %bb15
+
+bb15: ; preds = %bb19, %bb14
+ %reg606 = phi i32 [ %reg611, %bb19 ], [ 2, %bb14 ] ; <i32> [#uses=6]
+ %reg607 = phi i32 [ %reg609, %bb19 ], [ 1, %bb14 ] ; <i32> [#uses=2]
+ %cond759 = icmp sge i32 %reg606, %reg605 ; <i1> [#uses=1]
+ br i1 %cond759, label %bb18, label %bb16
+
+bb16: ; preds = %bb15
+ %reg606-idxcast = bitcast i32 %reg606 to i32 ; <i32> [#uses=1]
+ %reg606-idxcast-offset = add i32 %reg606-idxcast, 1 ; <i32> [#uses=1]
+ zext i32 %reg606-idxcast-offset to i64 ; <i64>:9 [#uses=1]
+ %reg241 = getelementptr i32* %heap, i64 %9 ; <i32*> [#uses=1]
+ %reg242 = load i32* %reg241 ; <i32> [#uses=1]
+ %reg242-idxcast = bitcast i32 %reg242 to i32 ; <i32> [#uses=1]
+ zext i32 %reg242-idxcast to i64 ; <i64>:10 [#uses=1]
+ %reg249 = getelementptr i32* %weight, i64 %10 ; <i32*> [#uses=1]
+ %reg606-idxcast1 = bitcast i32 %reg606 to i32 ; <i32> [#uses=1]
+ zext i32 %reg606-idxcast1 to i64 ; <i64>:11 [#uses=1]
+ %reg256 = getelementptr i32* %heap, i64 %11 ; <i32*> [#uses=1]
+ %reg257 = load i32* %reg256 ; <i32> [#uses=1]
+ %reg257-idxcast = bitcast i32 %reg257 to i32 ; <i32> [#uses=1]
+ zext i32 %reg257-idxcast to i64 ; <i64>:12 [#uses=1]
+ %reg264 = getelementptr i32* %weight, i64 %12 ; <i32*> [#uses=1]
+ %reg265 = load i32* %reg249 ; <i32> [#uses=1]
+ %reg266 = load i32* %reg264 ; <i32> [#uses=1]
+ %cond760 = icmp sge i32 %reg265, %reg266 ; <i1> [#uses=1]
+ br i1 %cond760, label %bb18, label %bb17
+
+bb17: ; preds = %bb16
+ %reg608 = add i32 %reg606, 1 ; <i32> [#uses=1]
+ br label %bb18
+
+bb18: ; preds = %bb17, %bb16, %bb15
+ %reg609 = phi i32 [ %reg608, %bb17 ], [ %reg606, %bb16 ], [ %reg606, %bb15 ] ; <i32> [#uses=4]
+ %reg226-idxcast = bitcast i32 %reg226 to i32 ; <i32> [#uses=1]
+ zext i32 %reg226-idxcast to i64 ; <i64>:13 [#uses=1]
+ %reg273 = getelementptr i32* %weight, i64 %13 ; <i32*> [#uses=1]
+ %reg609-idxcast = bitcast i32 %reg609 to i32 ; <i32> [#uses=1]
+ zext i32 %reg609-idxcast to i64 ; <i64>:14 [#uses=1]
+ %reg280 = getelementptr i32* %heap, i64 %14 ; <i32*> [#uses=1]
+ %reg281 = load i32* %reg280 ; <i32> [#uses=2]
+ %reg281-idxcast = bitcast i32 %reg281 to i32 ; <i32> [#uses=1]
+ zext i32 %reg281-idxcast to i64 ; <i64>:15 [#uses=1]
+ %reg288 = getelementptr i32* %weight, i64 %15 ; <i32*> [#uses=1]
+ %reg289 = load i32* %reg273 ; <i32> [#uses=1]
+ %reg290 = load i32* %reg288 ; <i32> [#uses=1]
+ %cond761 = icmp slt i32 %reg289, %reg290 ; <i1> [#uses=1]
+ br i1 %cond761, label %bb20, label %bb19
+
+bb19: ; preds = %bb18
+ %reg607-idxcast = bitcast i32 %reg607 to i32 ; <i32> [#uses=1]
+ zext i32 %reg607-idxcast to i64 ; <i64>:16 [#uses=1]
+ %reg297 = getelementptr i32* %heap, i64 %16 ; <i32*> [#uses=1]
+ store i32 %reg281, i32* %reg297
+ %reg611 = shl i32 %reg609, 1 ; <i32> [#uses=2]
+ %cond762 = icmp sle i32 %reg611, %reg605 ; <i1> [#uses=1]
+ br i1 %cond762, label %bb15, label %bb20
+
+bb20: ; preds = %bb19, %bb18, %bb14
+ %reg612 = phi i32 [ %reg609, %bb19 ], [ %reg607, %bb18 ], [ 1, %bb14 ] ; <i32> [#uses=1]
+ %reg612-idxcast = bitcast i32 %reg612 to i32 ; <i32> [#uses=1]
+ zext i32 %reg612-idxcast to i64 ; <i64>:17 [#uses=1]
+ %reg312 = getelementptr i32* %heap, i64 %17 ; <i32*> [#uses=1]
+ store i32 %reg226, i32* %reg312
+ zext i32 1 to i64 ; <i64>:18 [#uses=1]
+ %reg7631 = getelementptr i32* %heap, i64 %18 ; <i32*> [#uses=1]
+ %reg114 = load i32* %reg7631 ; <i32> [#uses=2]
+ %reg603-idxcast1 = bitcast i32 %reg603 to i32 ; <i32> [#uses=1]
+ %reg603-idxcast1-offset = add i32 %reg603-idxcast1, 1073741823 ; <i32> [#uses=1]
+ zext i32 %reg603-idxcast1-offset to i64 ; <i64>:19 [#uses=1]
+ %reg319 = getelementptr i32* %heap, i64 %19 ; <i32*> [#uses=1]
+ %reg320 = load i32* %reg319 ; <i32> [#uses=1]
+ zext i32 1 to i64 ; <i64>:20 [#uses=1]
+ %reg7641 = getelementptr i32* %heap, i64 %20 ; <i32*> [#uses=1]
+ store i32 %reg320, i32* %reg7641
+ %reg613 = add i32 %reg605, -1 ; <i32> [#uses=4]
+ zext i32 1 to i64 ; <i64>:21 [#uses=1]
+ %reg765 = getelementptr i32* %heap, i64 %21 ; <i32*> [#uses=1]
+ %reg323 = load i32* %reg765 ; <i32> [#uses=2]
+ %cond766 = icmp sgt i32 2, %reg613 ; <i1> [#uses=1]
+ br i1 %cond766, label %bb26, label %bb21
+
+bb21: ; preds = %bb25, %bb20
+ %reg614 = phi i32 [ %reg619, %bb25 ], [ 2, %bb20 ] ; <i32> [#uses=6]
+ %reg615 = phi i32 [ %reg617, %bb25 ], [ 1, %bb20 ] ; <i32> [#uses=2]
+ %cond767 = icmp sge i32 %reg614, %reg613 ; <i1> [#uses=1]
+ br i1 %cond767, label %bb24, label %bb22
+
+bb22: ; preds = %bb21
+ %reg614-idxcast = bitcast i32 %reg614 to i32 ; <i32> [#uses=1]
+ %reg614-idxcast-offset = add i32 %reg614-idxcast, 1 ; <i32> [#uses=1]
+ zext i32 %reg614-idxcast-offset to i64 ; <i64>:22 [#uses=1]
+ %reg338 = getelementptr i32* %heap, i64 %22 ; <i32*> [#uses=1]
+ %reg339 = load i32* %reg338 ; <i32> [#uses=1]
+ %reg339-idxcast = bitcast i32 %reg339 to i32 ; <i32> [#uses=1]
+ zext i32 %reg339-idxcast to i64 ; <i64>:23 [#uses=1]
+ %reg346 = getelementptr i32* %weight, i64 %23 ; <i32*> [#uses=1]
+ %reg614-idxcast1 = bitcast i32 %reg614 to i32 ; <i32> [#uses=1]
+ zext i32 %reg614-idxcast1 to i64 ; <i64>:24 [#uses=1]
+ %reg353 = getelementptr i32* %heap, i64 %24 ; <i32*> [#uses=1]
+ %reg354 = load i32* %reg353 ; <i32> [#uses=1]
+ %reg354-idxcast = bitcast i32 %reg354 to i32 ; <i32> [#uses=1]
+ zext i32 %reg354-idxcast to i64 ; <i64>:25 [#uses=1]
+ %reg361 = getelementptr i32* %weight, i64 %25 ; <i32*> [#uses=1]
+ %reg362 = load i32* %reg346 ; <i32> [#uses=1]
+ %reg363 = load i32* %reg361 ; <i32> [#uses=1]
+ %cond768 = icmp sge i32 %reg362, %reg363 ; <i1> [#uses=1]
+ br i1 %cond768, label %bb24, label %bb23
+
+bb23: ; preds = %bb22
+ %reg616 = add i32 %reg614, 1 ; <i32> [#uses=1]
+ br label %bb24
+
+bb24: ; preds = %bb23, %bb22, %bb21
+ %reg617 = phi i32 [ %reg616, %bb23 ], [ %reg614, %bb22 ], [ %reg614, %bb21 ] ; <i32> [#uses=4]
+ %reg323-idxcast = bitcast i32 %reg323 to i32 ; <i32> [#uses=1]
+ zext i32 %reg323-idxcast to i64 ; <i64>:26 [#uses=1]
+ %reg370 = getelementptr i32* %weight, i64 %26 ; <i32*> [#uses=1]
+ %reg617-idxcast = bitcast i32 %reg617 to i32 ; <i32> [#uses=1]
+ zext i32 %reg617-idxcast to i64 ; <i64>:27 [#uses=1]
+ %reg377 = getelementptr i32* %heap, i64 %27 ; <i32*> [#uses=1]
+ %reg378 = load i32* %reg377 ; <i32> [#uses=2]
+ %reg378-idxcast = bitcast i32 %reg378 to i32 ; <i32> [#uses=1]
+ zext i32 %reg378-idxcast to i64 ; <i64>:28 [#uses=1]
+ %reg385 = getelementptr i32* %weight, i64 %28 ; <i32*> [#uses=1]
+ %reg386 = load i32* %reg370 ; <i32> [#uses=1]
+ %reg387 = load i32* %reg385 ; <i32> [#uses=1]
+ %cond769 = icmp slt i32 %reg386, %reg387 ; <i1> [#uses=1]
+ br i1 %cond769, label %bb26, label %bb25
+
+bb25: ; preds = %bb24
+ %reg615-idxcast = bitcast i32 %reg615 to i32 ; <i32> [#uses=1]
+ zext i32 %reg615-idxcast to i64 ; <i64>:29 [#uses=1]
+ %reg394 = getelementptr i32* %heap, i64 %29 ; <i32*> [#uses=1]
+ store i32 %reg378, i32* %reg394
+ %reg619 = shl i32 %reg617, 1 ; <i32> [#uses=2]
+ %cond770 = icmp sle i32 %reg619, %reg613 ; <i1> [#uses=1]
+ br i1 %cond770, label %bb21, label %bb26
+
+bb26: ; preds = %bb25, %bb24, %bb20
+ %reg620 = phi i32 [ %reg617, %bb25 ], [ %reg615, %bb24 ], [ 1, %bb20 ] ; <i32> [#uses=1]
+ %reg620-idxcast = bitcast i32 %reg620 to i32 ; <i32> [#uses=1]
+ zext i32 %reg620-idxcast to i64 ; <i64>:30 [#uses=1]
+ %reg409 = getelementptr i32* %heap, i64 %30 ; <i32*> [#uses=1]
+ store i32 %reg323, i32* %reg409
+ %reg621 = add i32 %reg604, 1 ; <i32> [#uses=5]
+ %reg113-idxcast = bitcast i32 %reg113 to i32 ; <i32> [#uses=1]
+ zext i32 %reg113-idxcast to i64 ; <i64>:31 [#uses=1]
+ %reg416 = getelementptr i32* %parent, i64 %31 ; <i32*> [#uses=1]
+ %reg114-idxcast = bitcast i32 %reg114 to i32 ; <i32> [#uses=1]
+ zext i32 %reg114-idxcast to i64 ; <i64>:32 [#uses=1]
+ %reg423 = getelementptr i32* %parent, i64 %32 ; <i32*> [#uses=1]
+ %cast889 = bitcast i32 %reg621 to i32 ; <i32> [#uses=1]
+ store i32 %cast889, i32* %reg423
+ %cast890 = bitcast i32 %reg621 to i32 ; <i32> [#uses=1]
+ store i32 %cast890, i32* %reg416
+ %reg604-offset = add i32 %reg604, 1 ; <i32> [#uses=1]
+ zext i32 %reg604-offset to i64 ; <i64>:33 [#uses=1]
+ %reg431 = getelementptr i32* %weight, i64 %33 ; <i32*> [#uses=1]
+ %reg113-idxcast2 = bitcast i32 %reg113 to i32 ; <i32> [#uses=1]
+ zext i32 %reg113-idxcast2 to i64 ; <i64>:34 [#uses=1]
+ %reg4381 = getelementptr i32* %weight, i64 %34 ; <i32*> [#uses=1]
+ %reg439 = load i32* %reg4381 ; <i32> [#uses=2]
+ %reg440 = and i32 %reg439, -256 ; <i32> [#uses=1]
+ %reg114-idxcast2 = bitcast i32 %reg114 to i32 ; <i32> [#uses=1]
+ zext i32 %reg114-idxcast2 to i64 ; <i64>:35 [#uses=1]
+ %reg4471 = getelementptr i32* %weight, i64 %35 ; <i32*> [#uses=1]
+ %reg448 = load i32* %reg4471 ; <i32> [#uses=2]
+ %reg449 = and i32 %reg448, -256 ; <i32> [#uses=1]
+ %reg450 = add i32 %reg440, %reg449 ; <i32> [#uses=1]
+ %reg460 = and i32 %reg439, 255 ; <i32> [#uses=2]
+ %reg451 = and i32 %reg448, 255 ; <i32> [#uses=2]
+ %cond771 = icmp sge i32 %reg451, %reg460 ; <i1> [#uses=1]
+ br i1 %cond771, label %bb28, label %bb27
+
+bb27: ; preds = %bb26
+ br label %bb28
+
+bb28: ; preds = %bb27, %bb26
+ %reg623 = phi i32 [ %reg460, %bb27 ], [ %reg451, %bb26 ] ; <i32> [#uses=1]
+ %reg469 = add i32 %reg623, 1 ; <i32> [#uses=1]
+ %reg470 = or i32 %reg450, %reg469 ; <i32> [#uses=1]
+ store i32 %reg470, i32* %reg431
+ %reg604-offset1 = add i32 %reg604, 1 ; <i32> [#uses=1]
+ zext i32 %reg604-offset1 to i64 ; <i64>:36 [#uses=1]
+ %reg4771 = getelementptr i32* %parent, i64 %36 ; <i32*> [#uses=1]
+ store i32 -1, i32* %reg4771
+ %reg624 = add i32 %reg613, 1 ; <i32> [#uses=2]
+ %reg603-idxcast2 = bitcast i32 %reg603 to i32 ; <i32> [#uses=1]
+ %reg603-idxcast2-offset = add i32 %reg603-idxcast2, 1073741823 ; <i32> [#uses=1]
+ zext i32 %reg603-idxcast2-offset to i64 ; <i64>:37 [#uses=1]
+ %reg485 = getelementptr i32* %heap, i64 %37 ; <i32*> [#uses=1]
+ %cast902 = bitcast i32 %reg621 to i32 ; <i32> [#uses=1]
+ store i32 %cast902, i32* %reg485
+ br label %bb30
+
+bb29: ; preds = %bb30
+ %reg625-idxcast = bitcast i32 %reg625 to i32 ; <i32> [#uses=1]
+ zext i32 %reg625-idxcast to i64 ; <i64>:38 [#uses=1]
+ %reg526 = getelementptr i32* %heap, i64 %38 ; <i32*> [#uses=1]
+ store i32 %reg510, i32* %reg526
+ br label %bb30
+
+bb30: ; preds = %bb29, %bb28
+ %reg625 = phi i32 [ %reg502, %bb29 ], [ %reg624, %bb28 ] ; <i32> [#uses=3]
+ %reg604-offset2 = add i32 %reg604, 1 ; <i32> [#uses=1]
+ zext i32 %reg604-offset2 to i64 ; <i64>:39 [#uses=1]
+ %reg501 = getelementptr i32* %weight, i64 %39 ; <i32*> [#uses=1]
+ %reg502 = ashr i32 %reg625, 1 ; <i32> [#uses=2]
+ %reg502-idxcast = bitcast i32 %reg502 to i32 ; <i32> [#uses=1]
+ zext i32 %reg502-idxcast to i64 ; <i64>:40 [#uses=1]
+ %reg509 = getelementptr i32* %heap, i64 %40 ; <i32*> [#uses=1]
+ %reg510 = load i32* %reg509 ; <i32> [#uses=2]
+ %reg510-idxcast = bitcast i32 %reg510 to i32 ; <i32> [#uses=1]
+ zext i32 %reg510-idxcast to i64 ; <i64>:41 [#uses=1]
+ %reg517 = getelementptr i32* %weight, i64 %41 ; <i32*> [#uses=1]
+ %reg518 = load i32* %reg501 ; <i32> [#uses=1]
+ %reg519 = load i32* %reg517 ; <i32> [#uses=1]
+ %cond772 = icmp slt i32 %reg518, %reg519 ; <i1> [#uses=1]
+ br i1 %cond772, label %bb29, label %bb31
+
+bb31: ; preds = %bb30
+ %reg625-idxcast1 = bitcast i32 %reg625 to i32 ; <i32> [#uses=1]
+ zext i32 %reg625-idxcast1 to i64 ; <i64>:42 [#uses=1]
+ %reg542 = getelementptr i32* %heap, i64 %42 ; <i32*> [#uses=1]
+ %cast916 = bitcast i32 %reg621 to i32 ; <i32> [#uses=1]
+ store i32 %cast916, i32* %reg542
+ %cond773 = icmp sgt i32 %reg624, 1 ; <i1> [#uses=1]
+ br i1 %cond773, label %bb14, label %bb32
+
+bb32: ; preds = %bb31, %bb13
+ %reg627 = phi i32 [ %reg621, %bb31 ], [ %cast918, %bb13 ] ; <i32> [#uses=1]
+ %cast919 = bitcast i32 %reg627 to i32 ; <i32> [#uses=1]
+ %cond774 = icmp sle i32 %cast919, 515 ; <i1> [#uses=1]
+ br i1 %cond774, label %bb34, label %bb33
+
+bb33: ; preds = %bb32
+ zext i32 0 to i64 ; <i64>:43 [#uses=1]
+ zext i32 0 to i64 ; <i64>:44 [#uses=1]
+ %cast785 = getelementptr [21 x i8]* @.LC1, i64 %43, i64 %44 ; <i8*> [#uses=1]
+ call void @panic( i8* %cast785 )
+ br label %bb34
+
+bb34: ; preds = %bb33, %bb32
+ %cond775 = icmp sgt i32 1, %reg109 ; <i1> [#uses=1]
+ br i1 %cond775, label %bb40, label %bb35
+
+bb35: ; preds = %bb39, %bb34
+ %reg629 = phi i8 [ %reg639, %bb39 ], [ 0, %bb34 ] ; <i8> [#uses=1]
+ %cann-indvar = phi i32 [ 0, %bb34 ], [ %add1-indvar, %bb39 ] ; <i32> [#uses=4]
+ %cann-indvar-casted = bitcast i32 %cann-indvar to i32 ; <i32> [#uses=1]
+ %reg630 = add i32 %cann-indvar-casted, 1 ; <i32> [#uses=2]
+ %add1-indvar = add i32 %cann-indvar, 1 ; <i32> [#uses=1]
+ %cann-indvar-offset1 = add i32 %cann-indvar, 1 ; <i32> [#uses=1]
+ zext i32 %cann-indvar-offset1 to i64 ; <i64>:45 [#uses=1]
+ %reg589 = getelementptr i32* %parent, i64 %45 ; <i32*> [#uses=1]
+ %reg590 = load i32* %reg589 ; <i32> [#uses=1]
+ %cond776 = icmp slt i32 %reg590, 0 ; <i1> [#uses=1]
+ %parent-idxcast = ptrtoint i32* %parent to i32 ; <i32> [#uses=1]
+ %cast948 = bitcast i32 %reg630 to i32 ; <i32> [#uses=1]
+ br i1 %cond776, label %bb37, label %bb36
+
+bb36: ; preds = %bb36, %bb35
+ %reg632 = phi i32 [ %reg634, %bb36 ], [ %cast948, %bb35 ] ; <i32> [#uses=1]
+ %reg633 = phi i32 [ %reg635, %bb36 ], [ 0, %bb35 ] ; <i32> [#uses=3]
+ %reg633-casted = inttoptr i32 %reg633 to i8* ; <i8*> [#uses=0]
+ %reg631-scale = mul i32 %reg633, 0 ; <i32> [#uses=1]
+ %reg631-scale.upgrd.10 = inttoptr i32 %reg631-scale to i8* ; <i8*> [#uses=1]
+ zext i32 %parent-idxcast to i64 ; <i64>:46 [#uses=1]
+ %reg6311 = getelementptr i8* %reg631-scale.upgrd.10, i64 %46 ; <i8*> [#uses=2]
+ %reg632-scale = mul i32 %reg632, 4 ; <i32> [#uses=1]
+ zext i32 %reg632-scale to i64 ; <i64>:47 [#uses=1]
+ %reg5581 = getelementptr i8* %reg6311, i64 %47 ; <i8*> [#uses=1]
+ %cast924 = bitcast i8* %reg5581 to i32* ; <i32*> [#uses=1]
+ %reg634 = load i32* %cast924 ; <i32> [#uses=2]
+ %reg635 = add i32 %reg633, 1 ; <i32> [#uses=2]
+ %reg634-scale = mul i32 %reg634, 4 ; <i32> [#uses=1]
+ zext i32 %reg634-scale to i64 ; <i64>:48 [#uses=1]
+ %reg5501 = getelementptr i8* %reg6311, i64 %48 ; <i8*> [#uses=1]
+ %cast925 = bitcast i8* %reg5501 to i32* ; <i32*> [#uses=1]
+ %reg551 = load i32* %cast925 ; <i32> [#uses=1]
+ %cond777 = icmp sge i32 %reg551, 0 ; <i1> [#uses=1]
+ br i1 %cond777, label %bb36, label %bb37
+
+bb37: ; preds = %bb36, %bb35
+ %reg637 = phi i32 [ %reg635, %bb36 ], [ 0, %bb35 ] ; <i32> [#uses=2]
+ %cast928 = bitcast i32 %reg637 to i32 ; <i32> [#uses=1]
+ %cann-indvar-offset = add i32 %cann-indvar, 1 ; <i32> [#uses=1]
+ zext i32 %cann-indvar-offset to i64 ; <i64>:49 [#uses=1]
+ %reg561 = getelementptr i8* %reg107, i64 %49 ; <i8*> [#uses=1]
+ zext i32 -1 to i64 ; <i64>:50 [#uses=1]
+ %reg778 = getelementptr i8* %reg561, i64 %50 ; <i8*> [#uses=1]
+ %cast788 = trunc i32 %reg637 to i8 ; <i8> [#uses=1]
+ store i8 %cast788, i8* %reg778
+ %cond779 = icmp sle i32 %cast928, %reg110 ; <i1> [#uses=1]
+ br i1 %cond779, label %bb39, label %bb38
+
+bb38: ; preds = %bb37
+ br label %bb39
+
+bb39: ; preds = %bb38, %bb37
+ %reg639 = phi i8 [ 1, %bb38 ], [ %reg629, %bb37 ] ; <i8> [#uses=2]
+ %reg640 = add i32 %reg630, 1 ; <i32> [#uses=1]
+ %cond780 = icmp sle i32 %reg640, %reg109 ; <i1> [#uses=1]
+ br i1 %cond780, label %bb35, label %bb40
+
+bb40: ; preds = %bb39, %bb34
+ %reg641 = phi i8 [ %reg639, %bb39 ], [ 0, %bb34 ] ; <i8> [#uses=1]
+ %cond781 = icmp eq i8 %reg641, 0 ; <i1> [#uses=1]
+ br i1 %cond781, label %bb44, label %bb41
+
+bb41: ; preds = %bb40
+ %cond782 = icmp sge i32 1, %reg109 ; <i1> [#uses=1]
+ br i1 %cond782, label %bb6, label %bb42
+
+bb42: ; preds = %bb42, %bb41
+ %cann-indvar2 = phi i32 [ 0, %bb41 ], [ %add1-indvar2, %bb42 ] ; <i32> [#uses=3]
+ %reg643 = add i32 %cann-indvar2, 1 ; <i32> [#uses=1]
+ %add1-indvar2 = add i32 %cann-indvar2, 1 ; <i32> [#uses=1]
+ %cann-indvar2-idxcast = bitcast i32 %cann-indvar2 to i32 ; <i32> [#uses=1]
+ %cann-indvar2-idxcast-offset = add i32 %cann-indvar2-idxcast, 1 ; <i32> [#uses=1]
+ zext i32 %cann-indvar2-idxcast-offset to i64 ; <i64>:51 [#uses=1]
+ %reg569 = getelementptr i32* %weight, i64 %51 ; <i32*> [#uses=2]
+ %reg570 = load i32* %reg569 ; <i32> [#uses=2]
+ %reg644 = ashr i32 %reg570, 8 ; <i32> [#uses=1]
+ %reg572 = ashr i32 %reg570, 31 ; <i32> [#uses=1]
+ %cast933 = bitcast i32 %reg572 to i32 ; <i32> [#uses=1]
+ %reg573 = lshr i32 %cast933, 31 ; <i32> [#uses=1]
+ %cast934 = bitcast i32 %reg573 to i32 ; <i32> [#uses=1]
+ %reg574 = add i32 %reg644, %cast934 ; <i32> [#uses=1]
+ %reg571 = ashr i32 %reg574, 1 ; <i32> [#uses=1]
+ %reg645 = add i32 %reg571, 1 ; <i32> [#uses=1]
+ %reg582 = shl i32 %reg645, 8 ; <i32> [#uses=1]
+ store i32 %reg582, i32* %reg569
+ %reg646 = add i32 %reg643, 1 ; <i32> [#uses=1]
+ %cond783 = icmp slt i32 %reg646, %reg109 ; <i1> [#uses=1]
+ br i1 %cond783, label %bb42, label %bb43
+
+bb43: ; preds = %bb42
+ br label %bb6
+
+bb44: ; preds = %bb40
+ ret void
+}
+
+declare void @panic(i8*)
diff --git a/test/Transforms/InstCombine/2002-08-02-CastTest.ll b/test/Transforms/InstCombine/2002-08-02-CastTest.ll
new file mode 100644
index 000000000000..54c836c1056c
--- /dev/null
+++ b/test/Transforms/InstCombine/2002-08-02-CastTest.ll
@@ -0,0 +1,11 @@
+; This testcase is incorrectly getting completely eliminated. There should be
+; SOME instruction named %c here, even if it's a bitwise and.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep %c
+;
+define i64 @test3(i64 %A) {
+ %c1 = trunc i64 %A to i8 ; <i8> [#uses=1]
+ %c2 = zext i8 %c1 to i64 ; <i64> [#uses=1]
+ ret i64 %c2
+}
+
diff --git a/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll b/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll
new file mode 100644
index 000000000000..5b127d7b7938
--- /dev/null
+++ b/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine
+
+ %bob = type { i32 }
+
+define i32 @alias() {
+ %pbob1 = alloca %bob ; <%bob*> [#uses=1]
+ %pbob2 = getelementptr %bob* %pbob1 ; <%bob*> [#uses=1]
+ %pbobel = getelementptr %bob* %pbob2, i64 0, i32 0 ; <i32*> [#uses=1]
+ %rval = load i32* %pbobel ; <i32> [#uses=1]
+ ret i32 %rval
+}
+
diff --git a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll
new file mode 100644
index 000000000000..e7bd6a8da2fb
--- /dev/null
+++ b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep add
+
+define i32 @test(i32 %A) {
+ %A.neg = sub i32 0, %A ; <i32> [#uses=1]
+ %.neg = sub i32 0, 1 ; <i32> [#uses=1]
+ %X = add i32 %.neg, 1 ; <i32> [#uses=1]
+ %Y.neg.ra = add i32 %A, %X ; <i32> [#uses=1]
+ %r = add i32 %A.neg, %Y.neg.ra ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll b/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll
new file mode 100644
index 000000000000..e7e784882ab5
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 4294967295
+
+define i64 @test(i64 %Val) {
+ %tmp.3 = trunc i64 %Val to i32 ; <i32> [#uses=1]
+ %tmp.8 = zext i32 %tmp.3 to i64 ; <i64> [#uses=1]
+ ret i64 %tmp.8
+}
+
diff --git a/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll b/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll
new file mode 100644
index 000000000000..214fa4d846db
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+@X = global i32 5 ; <i32*> [#uses=1]
+
+define i64 @test() {
+ %C = add i64 1, 2 ; <i64> [#uses=1]
+ %V = add i64 ptrtoint (i32* @X to i64), %C ; <i64> [#uses=1]
+ ret i64 %V
+}
+
diff --git a/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll b/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll
new file mode 100644
index 000000000000..724f30f48894
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll
@@ -0,0 +1,16 @@
+; This testcase causes an infinite loop in the instruction combiner,
+; because it things that the constant value is a not expression... and
+; constantly inverts the branch back and forth.
+;
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define i8 @test19(i1 %c) {
+ br i1 true, label %True, label %False
+
+True: ; preds = %0
+ ret i8 1
+
+False: ; preds = %0
+ ret i8 3
+}
+
diff --git a/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll b/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll
new file mode 100644
index 000000000000..d6cacece0890
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll
@@ -0,0 +1,13 @@
+; This is a bug in the VMcode library, not instcombine, it's just convenient
+; to expose it here.
+
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+@A = global i32 1 ; <i32*> [#uses=1]
+@B = global i32 2 ; <i32*> [#uses=1]
+
+define i1 @test() {
+ %C = icmp ult i32* getelementptr (i32* @A, i64 1), getelementptr (i32* @B, i64 2) ; <i1> [#uses=1]
+ ret i1 %C
+}
+
diff --git a/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
new file mode 100644
index 000000000000..09732d3f636a
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll
@@ -0,0 +1,44 @@
+;
+; Test: ExternalConstant
+;
+; Description:
+; This regression test helps check whether the instruction combining
+; optimization pass correctly handles global variables which are marked
+; as external and constant.
+;
+; If a problem occurs, we should die on an assert(). Otherwise, we
+; should pass through the optimizer without failure.
+;
+; Extra code:
+; RUN: llvm-as < %s | opt -instcombine
+; END.
+
+target datalayout = "e-p:32:32"
+@silly = external constant i32 ; <i32*> [#uses=1]
+
+declare void @bzero(i8*, i32)
+
+declare void @bcopy(i8*, i8*, i32)
+
+declare i32 @bcmp(i8*, i8*, i32)
+
+declare i32 @fputs(i8*, i8*)
+
+declare i32 @fputs_unlocked(i8*, i8*)
+
+define i32 @function(i32 %a.1) {
+entry:
+ %a.0 = alloca i32 ; <i32*> [#uses=2]
+ %result = alloca i32 ; <i32*> [#uses=2]
+ store i32 %a.1, i32* %a.0
+ %tmp.0 = load i32* %a.0 ; <i32> [#uses=1]
+ %tmp.1 = load i32* @silly ; <i32> [#uses=1]
+ %tmp.2 = add i32 %tmp.0, %tmp.1 ; <i32> [#uses=1]
+ store i32 %tmp.2, i32* %result
+ br label %return
+
+return: ; preds = %entry
+ %tmp.3 = load i32* %result ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
diff --git a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
new file mode 100644
index 000000000000..209ab1b33695
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll
@@ -0,0 +1,21 @@
+; This testcase can be simplified by "realizing" that alloca can never return
+; null.
+; RUN: llvm-as < %s | opt -instcombine -simplifycfg | \
+; RUN: llvm-dis | not grep br
+
+declare i32 @bitmap_clear(...)
+
+define i32 @oof() {
+entry:
+ %live_head = alloca i32 ; <i32*> [#uses=2]
+ %tmp.1 = icmp ne i32* %live_head, null ; <i1> [#uses=1]
+ br i1 %tmp.1, label %then, label %UnifiedExitNode
+
+then: ; preds = %entry
+ %tmp.4 = call i32 (...)* @bitmap_clear( i32* %live_head ) ; <i32> [#uses=0]
+ br label %UnifiedExitNode
+
+UnifiedExitNode: ; preds = %then, %entry
+ ret i32 0
+}
+
diff --git a/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll b/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll
new file mode 100644
index 000000000000..9779f21f925c
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load
+
+define void @test(i32* %P) {
+ ; Dead but not deletable!
+ %X = volatile load i32* %P ; <i32> [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll b/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll
new file mode 100644
index 000000000000..7daf7cb632bb
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep false
+;
+; This actually looks like a constant propagation bug
+
+%X = type { [10 x i32], float }
+
+define i1 @test() {
+ %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1]
+ %B = icmp ne i32* %A, null ; <i1> [#uses=1]
+ ret i1 %B
+}
+
diff --git a/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll b/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll
new file mode 100644
index 000000000000..7d219cb35885
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+declare i32* @bar()
+
+define float* @foo() {
+ %tmp.11 = invoke float* bitcast (i32* ()* @bar to float* ()*)( )
+ to label %invoke_cont unwind label %X ; <float*> [#uses=1]
+
+invoke_cont: ; preds = %0
+ ret float* %tmp.11
+
+X: ; preds = %0
+ ret float* null
+}
+
diff --git a/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll b/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll
new file mode 100644
index 000000000000..71585d426645
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll
@@ -0,0 +1,13 @@
+; The cast in this testcase is not eliminable on a 32-bit target!
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep inttoptr
+
+target datalayout = "e-p:32:32"
+
+declare void @foo(...)
+
+define void @test(i64 %X) {
+ %Y = inttoptr i64 %X to i32* ; <i32*> [#uses=1]
+ call void (...)* @foo( i32* %Y )
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll b/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll
new file mode 100644
index 000000000000..b6930b5a65fd
--- /dev/null
+++ b/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep call | notcast
+
+declare void @free(i8*)
+
+define void @test(i32* %X) {
+ call void (...)* bitcast (void (i8*)* @free to void (...)*)( i32* %X ) ; <i32>:1 [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll
new file mode 100644
index 000000000000..c6a6b6afb81d
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll
@@ -0,0 +1,28 @@
+; Test for a problem afflicting several C++ programs in the testsuite. The
+; instcombine pass is trying to get rid of the cast in the invoke instruction,
+; inserting a cast of the return value after the PHI instruction, but which is
+; used by the PHI instruction. This is bad: because of the semantics of the
+; invoke instruction, we really cannot perform this transformation at all at
+; least without splitting the critical edge.
+;
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+declare i8* @test()
+
+define i32 @foo() {
+entry:
+ br i1 true, label %cont, label %call
+
+call: ; preds = %entry
+ %P = invoke i32* bitcast (i8* ()* @test to i32* ()*)( )
+ to label %cont unwind label %N ; <i32*> [#uses=1]
+
+cont: ; preds = %call, %entry
+ %P2 = phi i32* [ %P, %call ], [ null, %entry ] ; <i32*> [#uses=1]
+ %V = load i32* %P2 ; <i32> [#uses=1]
+ ret i32 %V
+
+N: ; preds = %call
+ ret i32 0
+}
+
diff --git a/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll b/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll
new file mode 100644
index 000000000000..3a4b66157dfe
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 34
+
+define i32 @test(i32 %X) {
+ ; Do not fold into shr X, 34, as this uses undefined behavior!
+ %Y = ashr i32 %X, 17 ; <i32> [#uses=1]
+ %Z = ashr i32 %Y, 17 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test2(i32 %X) {
+ ; Do not fold into shl X, 34, as this uses undefined behavior!
+ %Y = shl i32 %X, 17 ; <i32> [#uses=1]
+ %Z = shl i32 %Y, 17 ; <i32> [#uses=1]
+ ret i32 %Z
+}
diff --git a/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll b/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll
new file mode 100644
index 000000000000..2b5481b0195a
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll
@@ -0,0 +1,13 @@
+; This testcase caused the combiner to go into an infinite loop, moving the
+; cast back and forth, changing the seteq to operate on int vs uint and back.
+
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define i1 @test(i32 %A, i32 %B) {
+ %C = sub i32 0, %A ; <i32> [#uses=1]
+ %Cc = bitcast i32 %C to i32 ; <i32> [#uses=1]
+ %D = sub i32 0, %B ; <i32> [#uses=1]
+ %E = icmp eq i32 %Cc, %D ; <i1> [#uses=1]
+ ret i1 %E
+}
+
diff --git a/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll b/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll
new file mode 100644
index 000000000000..0b93eb2322eb
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define i32 @test() {
+ ret i32 0
+
+Loop: ; preds = %Loop
+ %X = add i32 %X, 1 ; <i32> [#uses=1]
+ br label %Loop
+}
+
diff --git a/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll b/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll
new file mode 100644
index 000000000000..66a5a4d78f6a
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+%Ty = type opaque
+
+define i32 @test(%Ty* %X) {
+ %Y = bitcast %Ty* %X to i32* ; <i32*> [#uses=1]
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll b/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll
new file mode 100644
index 000000000000..82eecbb6986b
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+@p = weak global i32 0 ; <i32*> [#uses=1]
+
+define i32 @test(i32 %x) {
+ %y = mul i32 %x, ptrtoint (i32* @p to i32) ; <i32> [#uses=1]
+ ret i32 %y
+}
+
diff --git a/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll b/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll
new file mode 100644
index 000000000000..9fc48de4ec19
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine
+
+; This testcase should not send the instcombiner into an infinite loop!
+
+define i32 @test(i32 %X) {
+ %Y = srem i32 %X, 0 ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll b/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll
new file mode 100644
index 000000000000..5d2ed0b86d9d
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i1 false}
+
+define i1 @test(i1 %V) {
+ %Y = icmp ult i1 %V, false ; <i1> [#uses=1]
+ ret i1 %Y
+}
+
diff --git a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
new file mode 100644
index 000000000000..e56c390d13f4
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \
+; RUN: not grep {i32 1}
+
+; When propagating the load through the select, make sure that the load is
+; inserted where the original load was, not where the select is. Not doing
+; so could produce incorrect results!
+
+define i32 @test(i1 %C) {
+ %X = alloca i32 ; <i32*> [#uses=3]
+ %X2 = alloca i32 ; <i32*> [#uses=2]
+ store i32 1, i32* %X
+ store i32 2, i32* %X2
+ %Y = select i1 %C, i32* %X, i32* %X2 ; <i32*> [#uses=1]
+ store i32 3, i32* %X
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
new file mode 100644
index 000000000000..b89bd228403e
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -instcombine -mem2reg -simplifycfg | \
+; RUN: llvm-dis | grep -v store | not grep {i32 1}
+
+; Test to make sure that instcombine does not accidentally propagate the load
+; into the PHI, which would break the program.
+
+define i32 @test(i1 %C) {
+entry:
+ %X = alloca i32 ; <i32*> [#uses=3]
+ %X2 = alloca i32 ; <i32*> [#uses=2]
+ store i32 1, i32* %X
+ store i32 2, i32* %X2
+ br i1 %C, label %cond_true.i, label %cond_continue.i
+
+cond_true.i: ; preds = %entry
+ br label %cond_continue.i
+
+cond_continue.i: ; preds = %cond_true.i, %entry
+ %mem_tmp.i.0 = phi i32* [ %X, %cond_true.i ], [ %X2, %entry ] ; <i32*> [#uses=1]
+ store i32 3, i32* %X
+ %tmp.3 = load i32* %mem_tmp.i.0 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
+
diff --git a/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll b/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll
new file mode 100644
index 000000000000..ee4f62c8d5ce
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep -- -65536
+
+define i1 @test(i32 %tmp.124) {
+ %tmp.125 = shl i32 %tmp.124, 8 ; <i32> [#uses=1]
+ %tmp.126.mask = and i32 %tmp.125, -16777216 ; <i32> [#uses=1]
+ %tmp.128 = icmp eq i32 %tmp.126.mask, 167772160 ; <i1> [#uses=1]
+ ret i1 %tmp.128
+}
+
diff --git a/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll b/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll
new file mode 100644
index 000000000000..766ba48be63f
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and
+
+define i8 @test21(i8 %A) {
+ ;; sign extend
+ %C = ashr i8 %A, 7 ; <i8> [#uses=1]
+ ;; chop off sign
+ %D = and i8 %C, 1 ; <i8> [#uses=1]
+ ret i8 %D
+}
+
diff --git a/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll b/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll
new file mode 100644
index 000000000000..53bb4965cb49
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll
@@ -0,0 +1,132 @@
+; This test case tests the InstructionCombining optimization that
+; reduces things like:
+; %Y = sext i8 %X to i32
+; %C = icmp ult i32 %Y, 1024
+; to
+; %C = i1 true
+; It includes test cases for different constant values, signedness of the
+; cast operands, and types of setCC operators. In all cases, the cast should
+; be eliminated. In many cases the setCC is also eliminated based on the
+; constant value and the range of the casted value.
+;
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
+; RUN: notcast .*int
+; END.
+define i1 @lt_signed_to_large_unsigned(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp ult i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_signed_to_large_signed(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_signed_to_large_negative(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, -1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_signed_to_small_signed(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, 17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+define i1 @lt_signed_to_small_negative(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, -17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_unsigned_to_large_unsigned(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp ult i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_unsigned_to_large_signed(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_unsigned_to_large_negative(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, -1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_unsigned_to_small_unsigned(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp ult i32 %Y, 17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @lt_unsigned_to_small_negative(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp slt i32 %Y, -17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_signed_to_large_unsigned(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp ugt i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_signed_to_large_signed(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_signed_to_large_negative(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, -1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+define i1 @gt_signed_to_small_signed(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, 17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_signed_to_small_negative(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, -17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_unsigned_to_large_unsigned(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp ugt i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_unsigned_to_large_signed(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, 1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_unsigned_to_large_negative(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, -1024 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_unsigned_to_small_unsigned(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp ugt i32 %Y, 17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @gt_unsigned_to_small_negative(i8 %SB) {
+ %Y = zext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp sgt i32 %Y, -17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
diff --git a/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll b/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll
new file mode 100644
index 000000000000..5908205203e8
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as %s -o - | opt -instcombine
+
+
+%"java/lang/Object" = type { %struct.llvm_java_object_base }
+%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 }
+%struct.llvm_java_object_base = type opaque
+
+define void @"java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;"() {
+bc0:
+ %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp53
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll b/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll
new file mode 100644
index 000000000000..4ea0b5c484bd
--- /dev/null
+++ b/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine
+
+define i32 @test(i32 %X) {
+ %Y = srem i32 %X, undef ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll b/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll
new file mode 100644
index 000000000000..ffaa0051e9f0
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {ret i1 false}
+
+define i1 @test(i64 %tmp.169) {
+ %tmp.1710 = lshr i64 %tmp.169, 1 ; <i64> [#uses=1]
+ %tmp.1912 = icmp ugt i64 %tmp.1710, 0 ; <i1> [#uses=1]
+ ret i1 %tmp.1912
+}
+
diff --git a/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll b/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll
new file mode 100644
index 000000000000..8b2aa35bd754
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define i32 @test(i1 %C, i32 %tmp.15) {
+ %tmp.16 = select i1 %C, i32 8, i32 1 ; <i32> [#uses=1]
+ %tmp.18 = udiv i32 %tmp.15, %tmp.16 ; <i32> [#uses=1]
+ ret i32 %tmp.18
+}
+
diff --git a/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll b/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll
new file mode 100644
index 000000000000..53585f9aa38b
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define i32 @_Z13func_31585107li(i32 %l_39521025, i32 %l_59244666) {
+ %shortcirc_val = select i1 false, i32 1, i32 0 ; <i32> [#uses=1]
+ %tmp.8 = udiv i32 0, %shortcirc_val ; <i32> [#uses=1]
+ %tmp.9 = icmp eq i32 %tmp.8, 0 ; <i1> [#uses=1]
+ %retval = select i1 %tmp.9, i32 %l_59244666, i32 -1621308501 ; <i32> [#uses=1]
+ ret i32 %retval
+}
+
diff --git a/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll b/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll
new file mode 100644
index 000000000000..64bfec18df6b
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR577
+
+define i1 @test() {
+ %tmp.3 = shl i32 0, 41 ; <i32> [#uses=1]
+ %tmp.4 = icmp ne i32 %tmp.3, 0 ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
diff --git a/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll b/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll
new file mode 100644
index 000000000000..10dbfec21ae3
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR585
+
+define i1 @test() {
+ %tmp.26 = sdiv i32 0, -2147483648 ; <i32> [#uses=1]
+ %tmp.27 = icmp eq i32 %tmp.26, 0 ; <i1> [#uses=1]
+ ret i1 %tmp.27
+}
+
diff --git a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
new file mode 100644
index 000000000000..010087b4f472
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i1 true}
+; PR586
+
+@g_07918478 = external global i32 ; <i32*> [#uses=1]
+
+define i1 @test() {
+ %tmp.0 = load i32* @g_07918478 ; <i32> [#uses=2]
+ %tmp.1 = icmp ne i32 %tmp.0, 0 ; <i1> [#uses=1]
+ %tmp.4 = icmp ult i32 %tmp.0, 4111 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp.1, %tmp.4 ; <i1> [#uses=1]
+ ret i1 %bothcond
+}
+
diff --git a/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll b/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll
new file mode 100644
index 000000000000..c58234a54995
--- /dev/null
+++ b/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+; This example caused instcombine to spin into an infinite loop.
+
+define void @test(i32* %P) {
+ ret void
+
+Dead: ; preds = %Dead
+ %X = phi i32 [ %Y, %Dead ] ; <i32> [#uses=1]
+ %Y = sdiv i32 %X, 10 ; <i32> [#uses=2]
+ store i32 %Y, i32* %P
+ br label %Dead
+}
+
diff --git a/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll b/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll
new file mode 100644
index 000000000000..d7df5a01fb4c
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+ %struct.rtx_const = type { i32, { %union.real_extract } }
+ %struct.rtx_def = type { i32, [1 x %union.rtunion_def] }
+ %union.real_extract = type { double }
+ %union.rtunion_def = type { i32 }
+
+define fastcc void @decode_rtx_const(%struct.rtx_def* %x, %struct.rtx_const* %value) {
+ %tmp.54 = getelementptr %struct.rtx_const* %value, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp.56 = getelementptr %struct.rtx_def* %x, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp.57 = load i32* %tmp.56 ; <i32> [#uses=1]
+ %tmp.58 = shl i32 %tmp.57, 8 ; <i32> [#uses=1]
+ %tmp.59 = ashr i32 %tmp.58, 24 ; <i32> [#uses=1]
+ %tmp.60 = trunc i32 %tmp.59 to i16 ; <i16> [#uses=1]
+ %tmp.61 = zext i16 %tmp.60 to i32 ; <i32> [#uses=1]
+ %tmp.62 = shl i32 %tmp.61, 16 ; <i32> [#uses=1]
+ %tmp.65 = or i32 0, %tmp.62 ; <i32> [#uses=1]
+ store i32 %tmp.65, i32* %tmp.54
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll b/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll
new file mode 100644
index 000000000000..c89b0d54a9dd
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep undef
+
+define i32 @test(i8 %A) {
+ %B = sext i8 %A to i32 ; <i32> [#uses=1]
+ %C = ashr i32 %B, 8 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+
diff --git a/test/Transforms/InstCombine/2006-02-28-Crash.ll b/test/Transforms/InstCombine/2006-02-28-Crash.ll
new file mode 100644
index 000000000000..1f3c9e8e6740
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-02-28-Crash.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define i32 @test() {
+ %tmp203 = icmp eq i32 1, 2 ; <i1> [#uses=1]
+ %tmp203.upgrd.1 = zext i1 %tmp203 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp203.upgrd.1
+}
+
diff --git a/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll b/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll
new file mode 100644
index 000000000000..e4b2b3931224
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define float @test(<4 x float> %V) {
+ %V2 = insertelement <4 x float> %V, float 1.000000e+00, i32 3 ; <<4 x float>> [#uses=1]
+ %R = extractelement <4 x float> %V2, i32 2 ; <float> [#uses=1]
+ ret float %R
+}
+
diff --git a/test/Transforms/InstCombine/2006-04-01-InfLoop.ll b/test/Transforms/InstCombine/2006-04-01-InfLoop.ll
new file mode 100644
index 000000000000..6ea3d111203a
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-04-01-InfLoop.ll
@@ -0,0 +1,444 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
+ %struct.DecRefPicMarking_s = type { i32, i32, i32, i32, i32, %struct.DecRefPicMarking_s* }
+ %struct.datapartition = type { %typedef.Bitstream*, %typedef.DecodingEnvironment, i32 (%struct.syntaxelement*, %struct.img_par*, %struct.inp_par*, %struct.datapartition*)* }
+ %struct.img_par = type { i32, i32, i32, i32, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x [16 x i16]], [6 x [32 x i32]], [16 x [16 x i32]], [4 x [12 x [4 x [4 x i32]]]], [16 x i32], i32**, i32*, i32***, i32**, i32, i32, i32, i32, %typedef.Slice*, %struct.macroblock*, i32, i32, i32, i32, i32, i32, i32**, %struct.DecRefPicMarking_s*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32***, i32***, i32****, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.timeb, %struct.timeb, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.inp_par = type { [100 x i8], [100 x i8], [100 x i8], i32, i32, i32, i32, i32, i32, i32 }
+ %struct.macroblock = type { i32, i32, i32, %struct.macroblock*, %struct.macroblock*, i32, [2 x [4 x [4 x [2 x i32]]]], i32, i64, i64, i32, i32, [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.pix_pos = type { i32, i32, i32, i32, i32, i32 }
+ %struct.storable_picture = type { i32, i32, i32, i32, i32, [50 x [6 x [33 x i64]]], [50 x [6 x [33 x i64]]], [50 x [6 x [33 x i64]]], [50 x [6 x [33 x i64]]], i32, i32, i32, i32, i32, i32, i32, i32, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16**, i16***, i8*, i16**, i8***, i64***, i64***, i16****, i8**, i8**, %struct.storable_picture*, %struct.storable_picture*, %struct.storable_picture*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i32], i32, %struct.DecRefPicMarking_s*, i32 }
+ %struct.syntaxelement = type { i32, i32, i32, i32, i32, i32, i32, i32, void (i32, i32, i32*, i32*)*, void (%struct.syntaxelement*, %struct.inp_par*, %struct.img_par*, %typedef.DecodingEnvironment*)* }
+ %struct.timeb = type { i32, i16, i16, i16 }
+ %typedef.BiContextType = type { i16, i8 }
+ %typedef.Bitstream = type { i32, i32, i32, i32, i8*, i32 }
+ %typedef.DecodingEnvironment = type { i32, i32, i32, i32, i32, i8*, i32* }
+ %typedef.MotionInfoContexts = type { [4 x [11 x %typedef.BiContextType]], [2 x [9 x %typedef.BiContextType]], [2 x [10 x %typedef.BiContextType]], [2 x [6 x %typedef.BiContextType]], [4 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x %typedef.BiContextType] }
+ %typedef.Slice = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.datapartition*, %typedef.MotionInfoContexts*, %typedef.TextureInfoContexts*, i32, i32*, i32*, i32*, i32, i32*, i32*, i32*, i32 (%struct.img_par*, %struct.inp_par*)*, i32, i32, i32, i32 }
+ %typedef.TextureInfoContexts = type { [2 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x [4 x %typedef.BiContextType]], [10 x [4 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]] }
+@dec_picture = external global %struct.storable_picture* ; <%struct.storable_picture**> [#uses=1]
+@last_dquant = external global i32 ; <i32*> [#uses=1]
+
+define void @readCBP_CABAC(%struct.syntaxelement* %se, %struct.inp_par* %inp, %struct.img_par* %img.1, %typedef.DecodingEnvironment* %dep_dp) {
+entry:
+ %block_a = alloca %struct.pix_pos ; <%struct.pix_pos*> [#uses=5]
+ %tmp.1 = getelementptr %struct.img_par* %img.1, i32 0, i32 37 ; <%typedef.Slice**> [#uses=1]
+ %tmp.2 = load %typedef.Slice** %tmp.1 ; <%typedef.Slice*> [#uses=1]
+ %tmp.3 = getelementptr %typedef.Slice* %tmp.2, i32 0, i32 11 ; <%typedef.TextureInfoContexts**> [#uses=1]
+ %tmp.4 = load %typedef.TextureInfoContexts** %tmp.3 ; <%typedef.TextureInfoContexts*> [#uses=3]
+ %tmp.6 = getelementptr %struct.img_par* %img.1, i32 0, i32 38 ; <%struct.macroblock**> [#uses=1]
+ %tmp.7 = load %struct.macroblock** %tmp.6 ; <%struct.macroblock*> [#uses=1]
+ %tmp.9 = getelementptr %struct.img_par* %img.1, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.10 = load i32* %tmp.9 ; <i32> [#uses=1]
+ %tmp.11 = bitcast i32 %tmp.10 to i32 ; <i32> [#uses=1]
+ %tmp.12 = getelementptr %struct.macroblock* %tmp.7, i32 %tmp.11 ; <%struct.macroblock*> [#uses=18]
+ br label %loopentry.0
+
+loopentry.0: ; preds = %loopexit.1, %entry
+ %mask.1 = phi i32 [ undef, %entry ], [ %mask.0, %loopexit.1 ] ; <i32> [#uses=1]
+ %cbp_bit.1 = phi i32 [ undef, %entry ], [ %cbp_bit.0, %loopexit.1 ] ; <i32> [#uses=1]
+ %cbp.2 = phi i32 [ 0, %entry ], [ %cbp.1, %loopexit.1 ] ; <i32> [#uses=5]
+ %curr_cbp_ctx.1 = phi i32 [ undef, %entry ], [ %curr_cbp_ctx.0, %loopexit.1 ] ; <i32> [#uses=1]
+ %b.2 = phi i32 [ undef, %entry ], [ %b.1, %loopexit.1 ] ; <i32> [#uses=1]
+ %a.2 = phi i32 [ undef, %entry ], [ %a.1, %loopexit.1 ] ; <i32> [#uses=1]
+ %mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopexit.1 ] ; <i32> [#uses=7]
+ %mb_x.0 = phi i32 [ undef, %entry ], [ %mb_x.1, %loopexit.1 ] ; <i32> [#uses=0]
+ %tmp.14 = icmp sle i32 %mb_y.0, 3 ; <i1> [#uses=2]
+ %tmp.15 = zext i1 %tmp.14 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.14, label %no_exit.0, label %loopexit.0
+
+no_exit.0: ; preds = %loopentry.0
+ br label %loopentry.1
+
+loopentry.1: ; preds = %endif.7, %no_exit.0
+ %mask.0 = phi i32 [ %mask.1, %no_exit.0 ], [ %tmp.131, %endif.7 ] ; <i32> [#uses=1]
+ %cbp_bit.0 = phi i32 [ %cbp_bit.1, %no_exit.0 ], [ %tmp.142, %endif.7 ] ; <i32> [#uses=1]
+ %cbp.1 = phi i32 [ %cbp.2, %no_exit.0 ], [ %cbp.0, %endif.7 ] ; <i32> [#uses=5]
+ %curr_cbp_ctx.0 = phi i32 [ %curr_cbp_ctx.1, %no_exit.0 ], [ %tmp.125, %endif.7 ] ; <i32> [#uses=1]
+ %b.1 = phi i32 [ %b.2, %no_exit.0 ], [ %b.0, %endif.7 ] ; <i32> [#uses=1]
+ %a.1 = phi i32 [ %a.2, %no_exit.0 ], [ %a.0, %endif.7 ] ; <i32> [#uses=1]
+ %mb_x.1 = phi i32 [ 0, %no_exit.0 ], [ %tmp.150, %endif.7 ] ; <i32> [#uses=9]
+ %tmp.17 = icmp sle i32 %mb_x.1, 3 ; <i1> [#uses=2]
+ %tmp.18 = zext i1 %tmp.17 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.17, label %no_exit.1, label %loopexit.1
+
+no_exit.1: ; preds = %loopentry.1
+ %tmp.20 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 12 ; <[4 x i32]*> [#uses=1]
+ %tmp.22 = sdiv i32 %mb_x.1, 2 ; <i32> [#uses=1]
+ %tmp.24 = add i32 %tmp.22, %mb_y.0 ; <i32> [#uses=1]
+ %tmp.25 = getelementptr [4 x i32]* %tmp.20, i32 0, i32 %tmp.24 ; <i32*> [#uses=1]
+ %tmp.26 = load i32* %tmp.25 ; <i32> [#uses=1]
+ %tmp.27 = icmp eq i32 %tmp.26, 11 ; <i1> [#uses=2]
+ %tmp.28 = zext i1 %tmp.27 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.27, label %then.0, label %else.0
+
+then.0: ; preds = %no_exit.1
+ br label %endif.0
+
+else.0: ; preds = %no_exit.1
+ br label %endif.0
+
+endif.0: ; preds = %else.0, %then.0
+ %tmp.30 = icmp eq i32 %mb_y.0, 0 ; <i1> [#uses=2]
+ %tmp.31 = zext i1 %tmp.30 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.30, label %then.1, label %else.1
+
+then.1: ; preds = %endif.0
+ %tmp.33 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.34 = load %struct.macroblock** %tmp.33 ; <%struct.macroblock*> [#uses=1]
+ %tmp.35 = bitcast %struct.macroblock* %tmp.34 to i8* ; <i8*> [#uses=1]
+ %tmp.36 = icmp eq i8* %tmp.35, null ; <i1> [#uses=2]
+ %tmp.37 = zext i1 %tmp.36 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.36, label %then.2, label %else.2
+
+then.2: ; preds = %then.1
+ br label %endif.1
+
+else.2: ; preds = %then.1
+ %tmp.39 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.40 = load %struct.macroblock** %tmp.39 ; <%struct.macroblock*> [#uses=1]
+ %tmp.41 = getelementptr %struct.macroblock* %tmp.40, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp.42 = load i32* %tmp.41 ; <i32> [#uses=1]
+ %tmp.43 = icmp eq i32 %tmp.42, 14 ; <i1> [#uses=2]
+ %tmp.44 = zext i1 %tmp.43 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.43, label %then.3, label %else.3
+
+then.3: ; preds = %else.2
+ br label %endif.1
+
+else.3: ; preds = %else.2
+ %tmp.46 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.47 = load %struct.macroblock** %tmp.46 ; <%struct.macroblock*> [#uses=1]
+ %tmp.48 = getelementptr %struct.macroblock* %tmp.47, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.49 = load i32* %tmp.48 ; <i32> [#uses=1]
+ %tmp.51 = sdiv i32 %mb_x.1, 2 ; <i32> [#uses=1]
+ %tmp.52 = add i32 %tmp.51, 2 ; <i32> [#uses=1]
+ %tmp.53 = trunc i32 %tmp.52 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.1 = zext i8 %tmp.53 to i32 ; <i32> [#uses=1]
+ %tmp.54 = ashr i32 %tmp.49, %shift.upgrd.1 ; <i32> [#uses=1]
+ %tmp.55 = bitcast i32 %tmp.54 to i32 ; <i32> [#uses=1]
+ %tmp.57 = xor i32 %tmp.55, 1 ; <i32> [#uses=1]
+ %tmp.58 = bitcast i32 %tmp.57 to i32 ; <i32> [#uses=1]
+ %tmp.59 = and i32 %tmp.58, 1 ; <i32> [#uses=1]
+ br label %endif.1
+
+else.1: ; preds = %endif.0
+ %tmp.62 = sdiv i32 %mb_x.1, 2 ; <i32> [#uses=1]
+ %tmp.63 = trunc i32 %tmp.62 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.2 = zext i8 %tmp.63 to i32 ; <i32> [#uses=1]
+ %tmp.64 = ashr i32 %cbp.1, %shift.upgrd.2 ; <i32> [#uses=1]
+ %tmp.65 = bitcast i32 %tmp.64 to i32 ; <i32> [#uses=1]
+ %tmp.67 = xor i32 %tmp.65, 1 ; <i32> [#uses=1]
+ %tmp.68 = bitcast i32 %tmp.67 to i32 ; <i32> [#uses=1]
+ %tmp.69 = and i32 %tmp.68, 1 ; <i32> [#uses=1]
+ br label %endif.1
+
+endif.1: ; preds = %else.1, %else.3, %then.3, %then.2
+ %b.0 = phi i32 [ 0, %then.2 ], [ 0, %then.3 ], [ %tmp.59, %else.3 ], [ %tmp.69, %else.1 ] ; <i32> [#uses=2]
+ %tmp.71 = icmp eq i32 %mb_x.1, 0 ; <i1> [#uses=2]
+ %tmp.72 = zext i1 %tmp.71 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.71, label %then.4, label %else.4
+
+then.4: ; preds = %endif.1
+ %tmp.74 = getelementptr %struct.img_par* %img.1, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.75 = load i32* %tmp.74 ; <i32> [#uses=1]
+ %tmp.76 = bitcast i32 %tmp.75 to i32 ; <i32> [#uses=1]
+ call void @getLuma4x4Neighbour( i32 %tmp.76, i32 %mb_x.1, i32 %mb_y.0, i32 -1, i32 0, %struct.pix_pos* %block_a )
+ %tmp.79 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp.80 = load i32* %tmp.79 ; <i32> [#uses=1]
+ %tmp.81 = icmp ne i32 %tmp.80, 0 ; <i1> [#uses=2]
+ %tmp.82 = zext i1 %tmp.81 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.81, label %then.5, label %else.5
+
+then.5: ; preds = %then.4
+ %tmp.84 = getelementptr %struct.img_par* %img.1, i32 0, i32 38 ; <%struct.macroblock**> [#uses=1]
+ %tmp.85 = load %struct.macroblock** %tmp.84 ; <%struct.macroblock*> [#uses=1]
+ %tmp.86 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.87 = load i32* %tmp.86 ; <i32> [#uses=1]
+ %tmp.88 = getelementptr %struct.macroblock* %tmp.85, i32 %tmp.87 ; <%struct.macroblock*> [#uses=1]
+ %tmp.89 = getelementptr %struct.macroblock* %tmp.88, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp.90 = load i32* %tmp.89 ; <i32> [#uses=1]
+ %tmp.91 = icmp eq i32 %tmp.90, 14 ; <i1> [#uses=2]
+ %tmp.92 = zext i1 %tmp.91 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.91, label %then.6, label %else.6
+
+then.6: ; preds = %then.5
+ br label %endif.4
+
+else.6: ; preds = %then.5
+ %tmp.94 = getelementptr %struct.img_par* %img.1, i32 0, i32 38 ; <%struct.macroblock**> [#uses=1]
+ %tmp.95 = load %struct.macroblock** %tmp.94 ; <%struct.macroblock*> [#uses=1]
+ %tmp.96 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.97 = load i32* %tmp.96 ; <i32> [#uses=1]
+ %tmp.98 = getelementptr %struct.macroblock* %tmp.95, i32 %tmp.97 ; <%struct.macroblock*> [#uses=1]
+ %tmp.99 = getelementptr %struct.macroblock* %tmp.98, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.100 = load i32* %tmp.99 ; <i32> [#uses=1]
+ %tmp.101 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 3 ; <i32*> [#uses=1]
+ %tmp.102 = load i32* %tmp.101 ; <i32> [#uses=1]
+ %tmp.103 = sdiv i32 %tmp.102, 2 ; <i32> [#uses=1]
+ %tmp.104 = mul i32 %tmp.103, 2 ; <i32> [#uses=1]
+ %tmp.105 = add i32 %tmp.104, 1 ; <i32> [#uses=1]
+ %tmp.106 = trunc i32 %tmp.105 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.3 = zext i8 %tmp.106 to i32 ; <i32> [#uses=1]
+ %tmp.107 = ashr i32 %tmp.100, %shift.upgrd.3 ; <i32> [#uses=1]
+ %tmp.108 = bitcast i32 %tmp.107 to i32 ; <i32> [#uses=1]
+ %tmp.110 = xor i32 %tmp.108, 1 ; <i32> [#uses=1]
+ %tmp.111 = bitcast i32 %tmp.110 to i32 ; <i32> [#uses=1]
+ %tmp.112 = and i32 %tmp.111, 1 ; <i32> [#uses=1]
+ br label %endif.4
+
+else.5: ; preds = %then.4
+ br label %endif.4
+
+else.4: ; preds = %endif.1
+ %tmp.115 = trunc i32 %mb_y.0 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.4 = zext i8 %tmp.115 to i32 ; <i32> [#uses=1]
+ %tmp.116 = ashr i32 %cbp.1, %shift.upgrd.4 ; <i32> [#uses=1]
+ %tmp.117 = bitcast i32 %tmp.116 to i32 ; <i32> [#uses=1]
+ %tmp.119 = xor i32 %tmp.117, 1 ; <i32> [#uses=1]
+ %tmp.120 = bitcast i32 %tmp.119 to i32 ; <i32> [#uses=1]
+ %tmp.121 = and i32 %tmp.120, 1 ; <i32> [#uses=1]
+ br label %endif.4
+
+endif.4: ; preds = %else.4, %else.5, %else.6, %then.6
+ %a.0 = phi i32 [ 0, %then.6 ], [ %tmp.112, %else.6 ], [ 0, %else.5 ], [ %tmp.121, %else.4 ] ; <i32> [#uses=2]
+ %tmp.123 = mul i32 %b.0, 2 ; <i32> [#uses=1]
+ %tmp.125 = add i32 %tmp.123, %a.0 ; <i32> [#uses=2]
+ %tmp.127 = sdiv i32 %mb_x.1, 2 ; <i32> [#uses=1]
+ %tmp.129 = add i32 %tmp.127, %mb_y.0 ; <i32> [#uses=1]
+ %tmp.130 = trunc i32 %tmp.129 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.5 = zext i8 %tmp.130 to i32 ; <i32> [#uses=1]
+ %tmp.131 = shl i32 1, %shift.upgrd.5 ; <i32> [#uses=2]
+ %tmp.135 = getelementptr %typedef.TextureInfoContexts* %tmp.4, i32 0, i32 2 ; <[3 x [4 x %typedef.BiContextType]]*> [#uses=1]
+ %tmp.136 = getelementptr [3 x [4 x %typedef.BiContextType]]* %tmp.135, i32 0, i32 0 ; <[4 x %typedef.BiContextType]*> [#uses=1]
+ %tmp.137 = getelementptr [4 x %typedef.BiContextType]* %tmp.136, i32 0, i32 0 ; <%typedef.BiContextType*> [#uses=1]
+ %tmp.139 = bitcast i32 %tmp.125 to i32 ; <i32> [#uses=1]
+ %tmp.140 = bitcast i32 %tmp.139 to i32 ; <i32> [#uses=1]
+ %tmp.141 = getelementptr %typedef.BiContextType* %tmp.137, i32 %tmp.140 ; <%typedef.BiContextType*> [#uses=1]
+ %tmp.132 = call i32 @biari_decode_symbol( %typedef.DecodingEnvironment* %dep_dp, %typedef.BiContextType* %tmp.141 ) ; <i32> [#uses=1]
+ %tmp.142 = bitcast i32 %tmp.132 to i32 ; <i32> [#uses=2]
+ %tmp.144 = icmp ne i32 %tmp.142, 0 ; <i1> [#uses=2]
+ %tmp.145 = zext i1 %tmp.144 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.144, label %then.7, label %endif.7
+
+then.7: ; preds = %endif.4
+ %tmp.148 = add i32 %cbp.1, %tmp.131 ; <i32> [#uses=1]
+ br label %endif.7
+
+endif.7: ; preds = %then.7, %endif.4
+ %cbp.0 = phi i32 [ %tmp.148, %then.7 ], [ %cbp.1, %endif.4 ] ; <i32> [#uses=1]
+ %tmp.150 = add i32 %mb_x.1, 2 ; <i32> [#uses=1]
+ br label %loopentry.1
+
+loopexit.1: ; preds = %loopentry.1
+ %tmp.152 = add i32 %mb_y.0, 2 ; <i32> [#uses=1]
+ br label %loopentry.0
+
+loopexit.0: ; preds = %loopentry.0
+ %tmp.153 = load %struct.storable_picture** @dec_picture ; <%struct.storable_picture*> [#uses=1]
+ %tmp.154 = getelementptr %struct.storable_picture* %tmp.153, i32 0, i32 45 ; <i32*> [#uses=1]
+ %tmp.155 = load i32* %tmp.154 ; <i32> [#uses=1]
+ %tmp.156 = icmp ne i32 %tmp.155, 0 ; <i1> [#uses=2]
+ %tmp.157 = zext i1 %tmp.156 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.156, label %then.8, label %endif.8
+
+then.8: ; preds = %loopexit.0
+ %tmp.159 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.160 = load %struct.macroblock** %tmp.159 ; <%struct.macroblock*> [#uses=1]
+ %tmp.161 = bitcast %struct.macroblock* %tmp.160 to i8* ; <i8*> [#uses=1]
+ %tmp.162 = icmp ne i8* %tmp.161, null ; <i1> [#uses=2]
+ %tmp.163 = zext i1 %tmp.162 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.162, label %then.9, label %endif.9
+
+then.9: ; preds = %then.8
+ %tmp.165 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.166 = load %struct.macroblock** %tmp.165 ; <%struct.macroblock*> [#uses=1]
+ %tmp.167 = getelementptr %struct.macroblock* %tmp.166, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp.168 = load i32* %tmp.167 ; <i32> [#uses=1]
+ %tmp.169 = icmp eq i32 %tmp.168, 14 ; <i1> [#uses=2]
+ %tmp.170 = zext i1 %tmp.169 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.169, label %then.10, label %else.7
+
+then.10: ; preds = %then.9
+ br label %endif.9
+
+else.7: ; preds = %then.9
+ %tmp.172 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.173 = load %struct.macroblock** %tmp.172 ; <%struct.macroblock*> [#uses=1]
+ %tmp.174 = getelementptr %struct.macroblock* %tmp.173, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.175 = load i32* %tmp.174 ; <i32> [#uses=1]
+ %tmp.176 = icmp sgt i32 %tmp.175, 15 ; <i1> [#uses=1]
+ %tmp.177 = zext i1 %tmp.176 to i32 ; <i32> [#uses=1]
+ br label %endif.9
+
+endif.9: ; preds = %else.7, %then.10, %then.8
+ %b.4 = phi i32 [ 1, %then.10 ], [ %tmp.177, %else.7 ], [ 0, %then.8 ] ; <i32> [#uses=1]
+ %tmp.179 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.180 = load %struct.macroblock** %tmp.179 ; <%struct.macroblock*> [#uses=1]
+ %tmp.181 = bitcast %struct.macroblock* %tmp.180 to i8* ; <i8*> [#uses=1]
+ %tmp.182 = icmp ne i8* %tmp.181, null ; <i1> [#uses=2]
+ %tmp.183 = zext i1 %tmp.182 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.182, label %then.11, label %endif.11
+
+then.11: ; preds = %endif.9
+ %tmp.185 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.186 = load %struct.macroblock** %tmp.185 ; <%struct.macroblock*> [#uses=1]
+ %tmp.187 = getelementptr %struct.macroblock* %tmp.186, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp.188 = load i32* %tmp.187 ; <i32> [#uses=1]
+ %tmp.189 = icmp eq i32 %tmp.188, 14 ; <i1> [#uses=2]
+ %tmp.190 = zext i1 %tmp.189 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.189, label %then.12, label %else.8
+
+then.12: ; preds = %then.11
+ br label %endif.11
+
+else.8: ; preds = %then.11
+ %tmp.192 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.193 = load %struct.macroblock** %tmp.192 ; <%struct.macroblock*> [#uses=1]
+ %tmp.194 = getelementptr %struct.macroblock* %tmp.193, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.195 = load i32* %tmp.194 ; <i32> [#uses=1]
+ %tmp.196 = icmp sgt i32 %tmp.195, 15 ; <i1> [#uses=1]
+ %tmp.197 = zext i1 %tmp.196 to i32 ; <i32> [#uses=1]
+ br label %endif.11
+
+endif.11: ; preds = %else.8, %then.12, %endif.9
+ %a.4 = phi i32 [ 1, %then.12 ], [ %tmp.197, %else.8 ], [ 0, %endif.9 ] ; <i32> [#uses=1]
+ %tmp.199 = mul i32 %b.4, 2 ; <i32> [#uses=1]
+ %tmp.201 = add i32 %tmp.199, %a.4 ; <i32> [#uses=1]
+ %tmp.205 = getelementptr %typedef.TextureInfoContexts* %tmp.4, i32 0, i32 2 ; <[3 x [4 x %typedef.BiContextType]]*> [#uses=1]
+ %tmp.206 = getelementptr [3 x [4 x %typedef.BiContextType]]* %tmp.205, i32 0, i32 1 ; <[4 x %typedef.BiContextType]*> [#uses=1]
+ %tmp.207 = getelementptr [4 x %typedef.BiContextType]* %tmp.206, i32 0, i32 0 ; <%typedef.BiContextType*> [#uses=1]
+ %tmp.209 = bitcast i32 %tmp.201 to i32 ; <i32> [#uses=1]
+ %tmp.210 = bitcast i32 %tmp.209 to i32 ; <i32> [#uses=1]
+ %tmp.211 = getelementptr %typedef.BiContextType* %tmp.207, i32 %tmp.210 ; <%typedef.BiContextType*> [#uses=1]
+ %tmp.202 = call i32 @biari_decode_symbol( %typedef.DecodingEnvironment* %dep_dp, %typedef.BiContextType* %tmp.211 ) ; <i32> [#uses=1]
+ %tmp.212 = bitcast i32 %tmp.202 to i32 ; <i32> [#uses=1]
+ %tmp.214 = icmp ne i32 %tmp.212, 0 ; <i1> [#uses=2]
+ %tmp.215 = zext i1 %tmp.214 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.214, label %then.13, label %endif.8
+
+then.13: ; preds = %endif.11
+ %tmp.217 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.218 = load %struct.macroblock** %tmp.217 ; <%struct.macroblock*> [#uses=1]
+ %tmp.219 = bitcast %struct.macroblock* %tmp.218 to i8* ; <i8*> [#uses=1]
+ %tmp.220 = icmp ne i8* %tmp.219, null ; <i1> [#uses=2]
+ %tmp.221 = zext i1 %tmp.220 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.220, label %then.14, label %endif.14
+
+then.14: ; preds = %then.13
+ %tmp.223 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.224 = load %struct.macroblock** %tmp.223 ; <%struct.macroblock*> [#uses=1]
+ %tmp.225 = getelementptr %struct.macroblock* %tmp.224, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp.226 = load i32* %tmp.225 ; <i32> [#uses=1]
+ %tmp.227 = icmp eq i32 %tmp.226, 14 ; <i1> [#uses=2]
+ %tmp.228 = zext i1 %tmp.227 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.227, label %then.15, label %else.9
+
+then.15: ; preds = %then.14
+ br label %endif.14
+
+else.9: ; preds = %then.14
+ %tmp.230 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.231 = load %struct.macroblock** %tmp.230 ; <%struct.macroblock*> [#uses=1]
+ %tmp.232 = getelementptr %struct.macroblock* %tmp.231, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.233 = load i32* %tmp.232 ; <i32> [#uses=1]
+ %tmp.234 = icmp sgt i32 %tmp.233, 15 ; <i1> [#uses=2]
+ %tmp.235 = zext i1 %tmp.234 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.234, label %then.16, label %endif.14
+
+then.16: ; preds = %else.9
+ %tmp.237 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1]
+ %tmp.238 = load %struct.macroblock** %tmp.237 ; <%struct.macroblock*> [#uses=1]
+ %tmp.239 = getelementptr %struct.macroblock* %tmp.238, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.240 = load i32* %tmp.239 ; <i32> [#uses=1]
+ %tmp.242 = ashr i32 %tmp.240, 4 ; <i32> [#uses=1]
+ %tmp.243 = icmp eq i32 %tmp.242, 2 ; <i1> [#uses=1]
+ %tmp.244 = zext i1 %tmp.243 to i32 ; <i32> [#uses=1]
+ br label %endif.14
+
+endif.14: ; preds = %then.16, %else.9, %then.15, %then.13
+ %b.5 = phi i32 [ 1, %then.15 ], [ %tmp.244, %then.16 ], [ 0, %else.9 ], [ 0, %then.13 ] ; <i32> [#uses=1]
+ %tmp.246 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.247 = load %struct.macroblock** %tmp.246 ; <%struct.macroblock*> [#uses=1]
+ %tmp.248 = bitcast %struct.macroblock* %tmp.247 to i8* ; <i8*> [#uses=1]
+ %tmp.249 = icmp ne i8* %tmp.248, null ; <i1> [#uses=2]
+ %tmp.250 = zext i1 %tmp.249 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.249, label %then.17, label %endif.17
+
+then.17: ; preds = %endif.14
+ %tmp.252 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.253 = load %struct.macroblock** %tmp.252 ; <%struct.macroblock*> [#uses=1]
+ %tmp.254 = getelementptr %struct.macroblock* %tmp.253, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp.255 = load i32* %tmp.254 ; <i32> [#uses=1]
+ %tmp.256 = icmp eq i32 %tmp.255, 14 ; <i1> [#uses=2]
+ %tmp.257 = zext i1 %tmp.256 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.256, label %then.18, label %else.10
+
+then.18: ; preds = %then.17
+ br label %endif.17
+
+else.10: ; preds = %then.17
+ %tmp.259 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.260 = load %struct.macroblock** %tmp.259 ; <%struct.macroblock*> [#uses=1]
+ %tmp.261 = getelementptr %struct.macroblock* %tmp.260, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.262 = load i32* %tmp.261 ; <i32> [#uses=1]
+ %tmp.263 = icmp sgt i32 %tmp.262, 15 ; <i1> [#uses=2]
+ %tmp.264 = zext i1 %tmp.263 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.263, label %then.19, label %endif.17
+
+then.19: ; preds = %else.10
+ %tmp.266 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1]
+ %tmp.267 = load %struct.macroblock** %tmp.266 ; <%struct.macroblock*> [#uses=1]
+ %tmp.268 = getelementptr %struct.macroblock* %tmp.267, i32 0, i32 7 ; <i32*> [#uses=1]
+ %tmp.269 = load i32* %tmp.268 ; <i32> [#uses=1]
+ %tmp.271 = ashr i32 %tmp.269, 4 ; <i32> [#uses=1]
+ %tmp.272 = icmp eq i32 %tmp.271, 2 ; <i1> [#uses=1]
+ %tmp.273 = zext i1 %tmp.272 to i32 ; <i32> [#uses=1]
+ br label %endif.17
+
+endif.17: ; preds = %then.19, %else.10, %then.18, %endif.14
+ %a.5 = phi i32 [ 1, %then.18 ], [ %tmp.273, %then.19 ], [ 0, %else.10 ], [ 0, %endif.14 ] ; <i32> [#uses=1]
+ %tmp.275 = mul i32 %b.5, 2 ; <i32> [#uses=1]
+ %tmp.277 = add i32 %tmp.275, %a.5 ; <i32> [#uses=1]
+ %tmp.281 = getelementptr %typedef.TextureInfoContexts* %tmp.4, i32 0, i32 2 ; <[3 x [4 x %typedef.BiContextType]]*> [#uses=1]
+ %tmp.282 = getelementptr [3 x [4 x %typedef.BiContextType]]* %tmp.281, i32 0, i32 2 ; <[4 x %typedef.BiContextType]*> [#uses=1]
+ %tmp.283 = getelementptr [4 x %typedef.BiContextType]* %tmp.282, i32 0, i32 0 ; <%typedef.BiContextType*> [#uses=1]
+ %tmp.285 = bitcast i32 %tmp.277 to i32 ; <i32> [#uses=1]
+ %tmp.286 = bitcast i32 %tmp.285 to i32 ; <i32> [#uses=1]
+ %tmp.287 = getelementptr %typedef.BiContextType* %tmp.283, i32 %tmp.286 ; <%typedef.BiContextType*> [#uses=1]
+ %tmp.278 = call i32 @biari_decode_symbol( %typedef.DecodingEnvironment* %dep_dp, %typedef.BiContextType* %tmp.287 ) ; <i32> [#uses=1]
+ %tmp.288 = bitcast i32 %tmp.278 to i32 ; <i32> [#uses=1]
+ %tmp.290 = icmp eq i32 %tmp.288, 1 ; <i1> [#uses=2]
+ %tmp.291 = zext i1 %tmp.290 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.290, label %cond_true, label %cond_false
+
+cond_true: ; preds = %endif.17
+ %tmp.293 = add i32 %cbp.2, 32 ; <i32> [#uses=1]
+ br label %cond_continue
+
+cond_false: ; preds = %endif.17
+ %tmp.295 = add i32 %cbp.2, 16 ; <i32> [#uses=1]
+ br label %cond_continue
+
+cond_continue: ; preds = %cond_false, %cond_true
+ %mem_tmp.0 = phi i32 [ %tmp.293, %cond_true ], [ %tmp.295, %cond_false ] ; <i32> [#uses=1]
+ br label %endif.8
+
+endif.8: ; preds = %cond_continue, %endif.11, %loopexit.0
+ %cbp.3 = phi i32 [ %mem_tmp.0, %cond_continue ], [ %cbp.2, %endif.11 ], [ %cbp.2, %loopexit.0 ] ; <i32> [#uses=2]
+ %tmp.298 = getelementptr %struct.syntaxelement* %se, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %cbp.3, i32* %tmp.298
+ %tmp.301 = icmp eq i32 %cbp.3, 0 ; <i1> [#uses=2]
+ %tmp.302 = zext i1 %tmp.301 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.301, label %then.20, label %return
+
+then.20: ; preds = %endif.8
+ store i32 0, i32* @last_dquant
+ ret void
+
+return: ; preds = %endif.8
+ ret void
+}
+
+declare i32 @biari_decode_symbol(%typedef.DecodingEnvironment*, %typedef.BiContextType*)
+
+declare void @getLuma4x4Neighbour(i32, i32, i32, i32, i32, %struct.pix_pos*)
diff --git a/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll b/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll
new file mode 100644
index 000000000000..2541eb733031
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shl
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+; This cannot be turned into a sign extending cast!
+
+define i64 @test(i64 %X) {
+ %Y = shl i64 %X, 16 ; <i64> [#uses=1]
+ %Z = ashr i64 %Y, 16 ; <i64> [#uses=1]
+ ret i64 %Z
+}
+
diff --git a/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll b/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll
new file mode 100644
index 000000000000..1b9df405c5ad
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll
@@ -0,0 +1,51 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
+
+define void @test() {
+bb38.i:
+ %varspec.0.i1014 = bitcast i64 123814269237067777 to i64 ; <i64> [#uses=1]
+ %locspec.0.i1015 = bitcast i32 1 to i32 ; <i32> [#uses=2]
+ %tmp51391.i1018 = lshr i64 %varspec.0.i1014, 16 ; <i64> [#uses=1]
+ %tmp51392.i1019 = trunc i64 %tmp51391.i1018 to i32 ; <i32> [#uses=2]
+ %tmp51392.mask.i1020 = lshr i32 %tmp51392.i1019, 29 ; <i32> [#uses=1]
+ %tmp7.i1021 = and i32 %tmp51392.mask.i1020, 1 ; <i32> [#uses=2]
+ %tmp18.i1026 = lshr i32 %tmp51392.i1019, 31 ; <i32> [#uses=2]
+ %tmp18.i1027 = trunc i32 %tmp18.i1026 to i8 ; <i8> [#uses=1]
+ br i1 false, label %cond_false1148.i1653, label %bb377.i1259
+
+bb377.i1259: ; preds = %bb38.i
+ br i1 false, label %cond_true541.i1317, label %cond_false1148.i1653
+
+cond_true541.i1317: ; preds = %bb377.i1259
+ %tmp545.i1318 = lshr i32 %locspec.0.i1015, 10 ; <i32> [#uses=1]
+ %tmp550.i1319 = lshr i32 %locspec.0.i1015, 4 ; <i32> [#uses=1]
+ %tmp550551.i1320 = and i32 %tmp550.i1319, 63 ; <i32> [#uses=1]
+ %tmp553.i1321 = icmp ult i32 %tmp550551.i1320, 4 ; <i1> [#uses=1]
+ %tmp558.i1322 = icmp eq i32 %tmp7.i1021, 0 ; <i1> [#uses=1]
+ %bothcond.i1326 = or i1 %tmp553.i1321, false ; <i1> [#uses=1]
+ %bothcond1.i1327 = or i1 %bothcond.i1326, false ; <i1> [#uses=1]
+ %bothcond2.not.i1328 = or i1 %bothcond1.i1327, false ; <i1> [#uses=1]
+ %bothcond3.i1329 = or i1 %bothcond2.not.i1328, %tmp558.i1322 ; <i1> [#uses=0]
+ br i1 false, label %cond_true583.i1333, label %cond_next592.i1337
+
+cond_true583.i1333: ; preds = %cond_true541.i1317
+ br i1 false, label %cond_true586.i1335, label %cond_next592.i1337
+
+cond_true586.i1335: ; preds = %cond_true583.i1333
+ br label %cond_true.i
+
+cond_next592.i1337: ; preds = %cond_true583.i1333, %cond_true541.i1317
+ %mask_z.0.i1339 = phi i32 [ %tmp18.i1026, %cond_true541.i1317 ], [ 0, %cond_true583.i1333 ] ; <i32> [#uses=0]
+ %tmp594.i1340 = and i32 %tmp545.i1318, 15 ; <i32> [#uses=0]
+ br label %cond_true.i
+
+cond_false1148.i1653: ; preds = %bb377.i1259, %bb38.i
+ %tmp1150.i1654 = icmp eq i32 %tmp7.i1021, 0 ; <i1> [#uses=1]
+ %tmp1160.i1656 = icmp eq i8 %tmp18.i1027, 0 ; <i1> [#uses=1]
+ %bothcond8.i1658 = or i1 %tmp1150.i1654, %tmp1160.i1656 ; <i1> [#uses=1]
+ %bothcond9.i1659 = or i1 %bothcond8.i1658, false ; <i1> [#uses=0]
+ br label %cond_true.i
+
+cond_true.i: ; preds = %cond_false1148.i1653, %cond_next592.i1337, %cond_true586.i1335
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2006-05-06-Infloop.ll b/test/Transforms/InstCombine/2006-05-06-Infloop.ll
new file mode 100644
index 000000000000..ec67d7178eb7
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-05-06-Infloop.ll
@@ -0,0 +1,519 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
+ %struct.gs_matrix = type { float, i32, float, i32, float, i32, float, i32, float, i32, float, i32 }
+ %struct.gx_bitmap = type { i8*, i32, i32, i32 }
+ %struct.gx_device = type { i32, %struct.gx_device_procs*, i8*, i32, i32, float, float, i32, i16, i32, i32 }
+ %struct.gx_device_memory = type { i32, %struct.gx_device_procs*, i8*, i32, i32, float, float, i32, i16, i32, i32, %struct.gs_matrix, i32, i8*, i8**, i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)*, i32, i32, i8* }
+ %struct.gx_device_procs = type { i32 (%struct.gx_device*)*, void (%struct.gx_device*, %struct.gs_matrix*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*, i16, i16, i16)*, i32 (%struct.gx_device*, i32, i16*)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, %struct.gx_bitmap*, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, %struct.gx_bitmap*, i32, i32, i32, i32, i32, i32, i32, i32)* }
+
+define i32 @mem_mono_copy_mono(%struct.gx_device* %dev, i8* %base, i32 %sourcex, i32 %raster, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero, i32 %one) {
+entry:
+ %tmp = icmp eq i32 %one, %zero ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %cond_next
+
+cond_true: ; preds = %entry
+ %tmp6 = tail call i32 @mem_mono_fill_rectangle( %struct.gx_device* %dev, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero ) ; <i32> [#uses=1]
+ ret i32 %tmp6
+
+cond_next: ; preds = %entry
+ %tmp8 = bitcast %struct.gx_device* %dev to %struct.gx_device_memory* ; <%struct.gx_device_memory*> [#uses=6]
+ %tmp.upgrd.1 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 15 ; <i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)**> [#uses=1]
+ %tmp.upgrd.2 = load i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)** %tmp.upgrd.1 ; <i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)*> [#uses=2]
+ %tmp9 = icmp eq i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)* %tmp.upgrd.2, @mem_no_fault_proc ; <i1> [#uses=1]
+ br i1 %tmp9, label %cond_next46, label %cond_true10
+
+cond_true10: ; preds = %cond_next
+ %tmp16 = add i32 %x, 7 ; <i32> [#uses=1]
+ %tmp17 = add i32 %tmp16, %w ; <i32> [#uses=1]
+ %tmp18 = ashr i32 %tmp17, 3 ; <i32> [#uses=1]
+ %tmp20 = ashr i32 %x, 3 ; <i32> [#uses=2]
+ %tmp21 = sub i32 %tmp18, %tmp20 ; <i32> [#uses=1]
+ %tmp27 = tail call i32 %tmp.upgrd.2( %struct.gx_device_memory* %tmp8, i32 %tmp20, i32 %y, i32 %tmp21, i32 %h, i32 1 ) ; <i32> [#uses=2]
+ %tmp29 = icmp slt i32 %tmp27, 0 ; <i1> [#uses=1]
+ br i1 %tmp29, label %cond_true30, label %cond_next46
+
+cond_true30: ; preds = %cond_true10
+ %tmp41 = tail call i32 @mem_copy_mono_recover( %struct.gx_device* %dev, i8* %base, i32 %sourcex, i32 %raster, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero, i32 %one, i32 %tmp27 ) ; <i32> [#uses=1]
+ ret i32 %tmp41
+
+cond_next46: ; preds = %cond_true10, %cond_next
+ %tmp48 = icmp sgt i32 %w, 0 ; <i1> [#uses=1]
+ %tmp53 = icmp sgt i32 %h, 0 ; <i1> [#uses=1]
+ %bothcond = and i1 %tmp53, %tmp48 ; <i1> [#uses=1]
+ br i1 %bothcond, label %bb58, label %return
+
+bb58: ; preds = %cond_next46
+ %tmp60 = icmp slt i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %tmp60, label %return, label %cond_next63
+
+cond_next63: ; preds = %bb58
+ %tmp65 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 3 ; <i32*> [#uses=1]
+ %tmp66 = load i32* %tmp65 ; <i32> [#uses=1]
+ %tmp68 = sub i32 %tmp66, %w ; <i32> [#uses=1]
+ %tmp70 = icmp slt i32 %tmp68, %x ; <i1> [#uses=1]
+ %tmp75 = icmp slt i32 %y, 0 ; <i1> [#uses=1]
+ %bothcond1 = or i1 %tmp70, %tmp75 ; <i1> [#uses=1]
+ br i1 %bothcond1, label %return, label %cond_next78
+
+cond_next78: ; preds = %cond_next63
+ %tmp80 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 4 ; <i32*> [#uses=1]
+ %tmp81 = load i32* %tmp80 ; <i32> [#uses=1]
+ %tmp83 = sub i32 %tmp81, %h ; <i32> [#uses=1]
+ %tmp85 = icmp slt i32 %tmp83, %y ; <i1> [#uses=1]
+ br i1 %tmp85, label %return, label %bb91
+
+bb91: ; preds = %cond_next78
+ %tmp93 = ashr i32 %x, 3 ; <i32> [#uses=4]
+ %tmp.upgrd.3 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 14 ; <i8***> [#uses=1]
+ %tmp.upgrd.4 = load i8*** %tmp.upgrd.3 ; <i8**> [#uses=1]
+ %tmp96 = getelementptr i8** %tmp.upgrd.4, i32 %y ; <i8**> [#uses=4]
+ %tmp98 = load i8** %tmp96 ; <i8*> [#uses=1]
+ %tmp100 = getelementptr i8* %tmp98, i32 %tmp93 ; <i8*> [#uses=3]
+ %tmp102 = ashr i32 %sourcex, 3 ; <i32> [#uses=3]
+ %tmp106 = and i32 %sourcex, 7 ; <i32> [#uses=1]
+ %tmp107 = sub i32 8, %tmp106 ; <i32> [#uses=4]
+ %tmp109 = and i32 %x, 7 ; <i32> [#uses=3]
+ %tmp110 = sub i32 8, %tmp109 ; <i32> [#uses=8]
+ %tmp112 = sub i32 8, %tmp110 ; <i32> [#uses=1]
+ %tmp112.upgrd.5 = trunc i32 %tmp112 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.6 = zext i8 %tmp112.upgrd.5 to i32 ; <i32> [#uses=1]
+ %tmp113464 = lshr i32 255, %shift.upgrd.6 ; <i32> [#uses=4]
+ %tmp116 = icmp sgt i32 %tmp110, %w ; <i1> [#uses=1]
+ %tmp132 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 16 ; <i32*> [#uses=2]
+ br i1 %tmp116, label %cond_true117, label %cond_false123
+
+cond_true117: ; preds = %bb91
+ %tmp119 = trunc i32 %w to i8 ; <i8> [#uses=1]
+ %shift.upgrd.7 = zext i8 %tmp119 to i32 ; <i32> [#uses=1]
+ %tmp120 = lshr i32 %tmp113464, %shift.upgrd.7 ; <i32> [#uses=1]
+ %tmp122 = sub i32 %tmp113464, %tmp120 ; <i32> [#uses=2]
+ %tmp13315 = load i32* %tmp132 ; <i32> [#uses=1]
+ %tmp13416 = icmp eq i32 %tmp13315, 0 ; <i1> [#uses=1]
+ br i1 %tmp13416, label %cond_next151, label %cond_true135
+
+cond_false123: ; preds = %bb91
+ %tmp126 = sub i32 %w, %tmp110 ; <i32> [#uses=1]
+ %tmp126.upgrd.8 = trunc i32 %tmp126 to i8 ; <i8> [#uses=1]
+ %tmp127 = and i8 %tmp126.upgrd.8, 7 ; <i8> [#uses=1]
+ %shift.upgrd.9 = zext i8 %tmp127 to i32 ; <i32> [#uses=1]
+ %tmp128 = lshr i32 255, %shift.upgrd.9 ; <i32> [#uses=1]
+ %tmp1295 = sub i32 255, %tmp128 ; <i32> [#uses=2]
+ %tmp133 = load i32* %tmp132 ; <i32> [#uses=1]
+ %tmp134 = icmp eq i32 %tmp133, 0 ; <i1> [#uses=1]
+ br i1 %tmp134, label %cond_next151, label %cond_true135
+
+cond_true135: ; preds = %cond_false123, %cond_true117
+ %rmask.0.0 = phi i32 [ undef, %cond_true117 ], [ %tmp1295, %cond_false123 ] ; <i32> [#uses=2]
+ %mask.1.0 = phi i32 [ %tmp122, %cond_true117 ], [ %tmp113464, %cond_false123 ] ; <i32> [#uses=2]
+ %not.tmp137 = icmp ne i32 %zero, -1 ; <i1> [#uses=1]
+ %tmp140 = zext i1 %not.tmp137 to i32 ; <i32> [#uses=1]
+ %zero_addr.0 = xor i32 %tmp140, %zero ; <i32> [#uses=2]
+ %tmp144 = icmp eq i32 %one, -1 ; <i1> [#uses=1]
+ br i1 %tmp144, label %cond_next151, label %cond_true145
+
+cond_true145: ; preds = %cond_true135
+ %tmp147 = xor i32 %one, 1 ; <i32> [#uses=1]
+ br label %cond_next151
+
+cond_next151: ; preds = %cond_true145, %cond_true135, %cond_false123, %cond_true117
+ %rmask.0.1 = phi i32 [ %rmask.0.0, %cond_true145 ], [ undef, %cond_true117 ], [ %tmp1295, %cond_false123 ], [ %rmask.0.0, %cond_true135 ] ; <i32> [#uses=4]
+ %mask.1.1 = phi i32 [ %mask.1.0, %cond_true145 ], [ %tmp122, %cond_true117 ], [ %tmp113464, %cond_false123 ], [ %mask.1.0, %cond_true135 ] ; <i32> [#uses=4]
+ %one_addr.0 = phi i32 [ %tmp147, %cond_true145 ], [ %one, %cond_true117 ], [ %one, %cond_false123 ], [ %one, %cond_true135 ] ; <i32> [#uses=2]
+ %zero_addr.1 = phi i32 [ %zero_addr.0, %cond_true145 ], [ %zero, %cond_true117 ], [ %zero, %cond_false123 ], [ %zero_addr.0, %cond_true135 ] ; <i32> [#uses=2]
+ %tmp153 = icmp eq i32 %zero_addr.1, 1 ; <i1> [#uses=2]
+ %tmp158 = icmp eq i32 %one_addr.0, 0 ; <i1> [#uses=2]
+ %bothcond2 = or i1 %tmp153, %tmp158 ; <i1> [#uses=1]
+ %iftmp.35.0 = select i1 %bothcond2, i32 -1, i32 0 ; <i32> [#uses=9]
+ %tmp167 = icmp eq i32 %zero_addr.1, 0 ; <i1> [#uses=1]
+ %bothcond3 = or i1 %tmp167, %tmp158 ; <i1> [#uses=1]
+ %iftmp.36.0 = select i1 %bothcond3, i32 0, i32 -1 ; <i32> [#uses=4]
+ %tmp186 = icmp eq i32 %one_addr.0, 1 ; <i1> [#uses=1]
+ %bothcond4 = or i1 %tmp153, %tmp186 ; <i1> [#uses=1]
+ %iftmp.37.0 = select i1 %bothcond4, i32 -1, i32 0 ; <i32> [#uses=6]
+ %tmp196 = icmp eq i32 %tmp107, %tmp110 ; <i1> [#uses=1]
+ br i1 %tmp196, label %cond_true197, label %cond_false299
+
+cond_true197: ; preds = %cond_next151
+ %tmp29222 = add i32 %h, -1 ; <i32> [#uses=3]
+ %tmp29424 = icmp slt i32 %tmp29222, 0 ; <i1> [#uses=1]
+ br i1 %tmp29424, label %return, label %cond_true295.preheader
+
+cond_true249.preheader: ; preds = %cond_true295
+ br label %cond_true249
+
+cond_true249: ; preds = %cond_true249, %cond_true249.preheader
+ %indvar = phi i32 [ 0, %cond_true249.preheader ], [ %indvar.next, %cond_true249 ] ; <i32> [#uses=3]
+ %optr.3.2 = phi i8* [ %tmp232.upgrd.12, %cond_true249 ], [ %dest.1.0, %cond_true249.preheader ] ; <i8*> [#uses=1]
+ %bptr.3.2 = phi i8* [ %tmp226.upgrd.10, %cond_true249 ], [ %line.1.0, %cond_true249.preheader ] ; <i8*> [#uses=1]
+ %tmp. = add i32 %tmp109, %w ; <i32> [#uses=1]
+ %tmp.58 = mul i32 %indvar, -8 ; <i32> [#uses=1]
+ %tmp.57 = add i32 %tmp., -16 ; <i32> [#uses=1]
+ %tmp246.2 = add i32 %tmp.58, %tmp.57 ; <i32> [#uses=1]
+ %tmp225 = ptrtoint i8* %bptr.3.2 to i32 ; <i32> [#uses=1]
+ %tmp226 = add i32 %tmp225, 1 ; <i32> [#uses=1]
+ %tmp226.upgrd.10 = inttoptr i32 %tmp226 to i8* ; <i8*> [#uses=3]
+ %tmp228 = load i8* %tmp226.upgrd.10 ; <i8> [#uses=1]
+ %tmp228.upgrd.11 = zext i8 %tmp228 to i32 ; <i32> [#uses=1]
+ %tmp230 = xor i32 %tmp228.upgrd.11, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp231 = ptrtoint i8* %optr.3.2 to i32 ; <i32> [#uses=1]
+ %tmp232 = add i32 %tmp231, 1 ; <i32> [#uses=1]
+ %tmp232.upgrd.12 = inttoptr i32 %tmp232 to i8* ; <i8*> [#uses=4]
+ %tmp235 = or i32 %tmp230, %iftmp.36.0 ; <i32> [#uses=1]
+ %tmp235.upgrd.13 = trunc i32 %tmp235 to i8 ; <i8> [#uses=1]
+ %tmp237 = load i8* %tmp232.upgrd.12 ; <i8> [#uses=1]
+ %tmp238 = and i8 %tmp235.upgrd.13, %tmp237 ; <i8> [#uses=1]
+ %tmp241 = and i32 %tmp230, %iftmp.37.0 ; <i32> [#uses=1]
+ %tmp241.upgrd.14 = trunc i32 %tmp241 to i8 ; <i8> [#uses=1]
+ %tmp242 = or i8 %tmp238, %tmp241.upgrd.14 ; <i8> [#uses=1]
+ store i8 %tmp242, i8* %tmp232.upgrd.12
+ %tmp24629 = add i32 %tmp246.2, -8 ; <i32> [#uses=2]
+ %tmp24831 = icmp slt i32 %tmp24629, 0 ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp24831, label %bb252.loopexit, label %cond_true249
+
+bb252.loopexit: ; preds = %cond_true249
+ br label %bb252
+
+bb252: ; preds = %cond_true295, %bb252.loopexit
+ %optr.3.3 = phi i8* [ %dest.1.0, %cond_true295 ], [ %tmp232.upgrd.12, %bb252.loopexit ] ; <i8*> [#uses=1]
+ %bptr.3.3 = phi i8* [ %line.1.0, %cond_true295 ], [ %tmp226.upgrd.10, %bb252.loopexit ] ; <i8*> [#uses=1]
+ %tmp246.3 = phi i32 [ %tmp246, %cond_true295 ], [ %tmp24629, %bb252.loopexit ] ; <i32> [#uses=1]
+ %tmp254 = icmp sgt i32 %tmp246.3, -8 ; <i1> [#uses=1]
+ br i1 %tmp254, label %cond_true255, label %cond_next280
+
+cond_true255: ; preds = %bb252
+ %tmp256 = ptrtoint i8* %bptr.3.3 to i32 ; <i32> [#uses=1]
+ %tmp257 = add i32 %tmp256, 1 ; <i32> [#uses=1]
+ %tmp257.upgrd.15 = inttoptr i32 %tmp257 to i8* ; <i8*> [#uses=1]
+ %tmp259 = load i8* %tmp257.upgrd.15 ; <i8> [#uses=1]
+ %tmp259.upgrd.16 = zext i8 %tmp259 to i32 ; <i32> [#uses=1]
+ %tmp261 = xor i32 %tmp259.upgrd.16, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp262 = ptrtoint i8* %optr.3.3 to i32 ; <i32> [#uses=1]
+ %tmp263 = add i32 %tmp262, 1 ; <i32> [#uses=1]
+ %tmp263.upgrd.17 = inttoptr i32 %tmp263 to i8* ; <i8*> [#uses=2]
+ %tmp265 = trunc i32 %tmp261 to i8 ; <i8> [#uses=1]
+ %tmp268 = or i8 %tmp266, %tmp265 ; <i8> [#uses=1]
+ %tmp270 = load i8* %tmp263.upgrd.17 ; <i8> [#uses=1]
+ %tmp271 = and i8 %tmp268, %tmp270 ; <i8> [#uses=1]
+ %tmp276 = and i32 %tmp274, %tmp261 ; <i32> [#uses=1]
+ %tmp276.upgrd.18 = trunc i32 %tmp276 to i8 ; <i8> [#uses=1]
+ %tmp277 = or i8 %tmp271, %tmp276.upgrd.18 ; <i8> [#uses=1]
+ store i8 %tmp277, i8* %tmp263.upgrd.17
+ br label %cond_next280
+
+cond_next280: ; preds = %cond_true255, %bb252
+ %tmp281 = ptrtoint i8** %dest_line.1.0 to i32 ; <i32> [#uses=1]
+ %tmp282 = add i32 %tmp281, 4 ; <i32> [#uses=1]
+ %tmp282.upgrd.19 = inttoptr i32 %tmp282 to i8** ; <i8**> [#uses=2]
+ %tmp284 = load i8** %tmp282.upgrd.19 ; <i8*> [#uses=1]
+ %tmp286 = getelementptr i8* %tmp284, i32 %tmp93 ; <i8*> [#uses=1]
+ %tmp292 = add i32 %tmp292.0, -1 ; <i32> [#uses=1]
+ %tmp294 = icmp slt i32 %tmp292, 0 ; <i1> [#uses=1]
+ %indvar.next61 = add i32 %indvar60, 1 ; <i32> [#uses=1]
+ br i1 %tmp294, label %return.loopexit, label %cond_true295
+
+cond_true295.preheader: ; preds = %cond_true197
+ %tmp200 = sub i32 %w, %tmp110 ; <i32> [#uses=1]
+ %tmp209 = trunc i32 %mask.1.1 to i8 ; <i8> [#uses=1]
+ %tmp209not = xor i8 %tmp209, -1 ; <i8> [#uses=1]
+ %tmp212 = trunc i32 %iftmp.36.0 to i8 ; <i8> [#uses=2]
+ %tmp211 = or i8 %tmp212, %tmp209not ; <i8> [#uses=2]
+ %tmp219 = and i32 %iftmp.37.0, %mask.1.1 ; <i32> [#uses=2]
+ %tmp246 = add i32 %tmp200, -8 ; <i32> [#uses=3]
+ %tmp248 = icmp slt i32 %tmp246, 0 ; <i1> [#uses=1]
+ %tmp264 = trunc i32 %rmask.0.1 to i8 ; <i8> [#uses=1]
+ %tmp264not = xor i8 %tmp264, -1 ; <i8> [#uses=1]
+ %tmp266 = or i8 %tmp212, %tmp264not ; <i8> [#uses=2]
+ %tmp274 = and i32 %iftmp.37.0, %rmask.0.1 ; <i32> [#uses=2]
+ br i1 %tmp248, label %cond_true295.preheader.split.us, label %cond_true295.preheader.split
+
+cond_true295.preheader.split.us: ; preds = %cond_true295.preheader
+ br label %cond_true295.us
+
+cond_true295.us: ; preds = %cond_next280.us, %cond_true295.preheader.split.us
+ %indvar86 = phi i32 [ 0, %cond_true295.preheader.split.us ], [ %indvar.next87, %cond_next280.us ] ; <i32> [#uses=3]
+ %dest.1.0.us = phi i8* [ %tmp286.us, %cond_next280.us ], [ %tmp100, %cond_true295.preheader.split.us ] ; <i8*> [#uses=3]
+ %dest_line.1.0.us = phi i8** [ %tmp282.us.upgrd.21, %cond_next280.us ], [ %tmp96, %cond_true295.preheader.split.us ] ; <i8**> [#uses=1]
+ %tmp.89 = sub i32 0, %indvar86 ; <i32> [#uses=2]
+ %tmp292.0.us = add i32 %tmp.89, %tmp29222 ; <i32> [#uses=1]
+ %tmp.91 = mul i32 %indvar86, %raster ; <i32> [#uses=2]
+ %tmp104.sum101 = add i32 %tmp102, %tmp.91 ; <i32> [#uses=1]
+ %line.1.0.us = getelementptr i8* %base, i32 %tmp104.sum101 ; <i8*> [#uses=2]
+ %tmp.us = load i8* %line.1.0.us ; <i8> [#uses=1]
+ %tmp206.us = zext i8 %tmp.us to i32 ; <i32> [#uses=1]
+ %tmp208.us = xor i32 %tmp206.us, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp210.us = trunc i32 %tmp208.us to i8 ; <i8> [#uses=1]
+ %tmp213.us = or i8 %tmp211, %tmp210.us ; <i8> [#uses=1]
+ %tmp215.us = load i8* %dest.1.0.us ; <i8> [#uses=1]
+ %tmp216.us = and i8 %tmp213.us, %tmp215.us ; <i8> [#uses=1]
+ %tmp221.us = and i32 %tmp219, %tmp208.us ; <i32> [#uses=1]
+ %tmp221.us.upgrd.20 = trunc i32 %tmp221.us to i8 ; <i8> [#uses=1]
+ %tmp222.us = or i8 %tmp216.us, %tmp221.us.upgrd.20 ; <i8> [#uses=1]
+ store i8 %tmp222.us, i8* %dest.1.0.us
+ br i1 true, label %bb252.us, label %cond_true249.preheader.us
+
+cond_next280.us: ; preds = %bb252.us, %cond_true255.us
+ %tmp281.us = ptrtoint i8** %dest_line.1.0.us to i32 ; <i32> [#uses=1]
+ %tmp282.us = add i32 %tmp281.us, 4 ; <i32> [#uses=1]
+ %tmp282.us.upgrd.21 = inttoptr i32 %tmp282.us to i8** ; <i8**> [#uses=2]
+ %tmp284.us = load i8** %tmp282.us.upgrd.21 ; <i8*> [#uses=1]
+ %tmp286.us = getelementptr i8* %tmp284.us, i32 %tmp93 ; <i8*> [#uses=1]
+ %tmp292.us = add i32 %tmp292.0.us, -1 ; <i32> [#uses=1]
+ %tmp294.us = icmp slt i32 %tmp292.us, 0 ; <i1> [#uses=1]
+ %indvar.next87 = add i32 %indvar86, 1 ; <i32> [#uses=1]
+ br i1 %tmp294.us, label %return.loopexit.us, label %cond_true295.us
+
+cond_true255.us: ; preds = %bb252.us
+ %tmp256.us = ptrtoint i8* %bptr.3.3.us to i32 ; <i32> [#uses=1]
+ %tmp257.us = add i32 %tmp256.us, 1 ; <i32> [#uses=1]
+ %tmp257.us.upgrd.22 = inttoptr i32 %tmp257.us to i8* ; <i8*> [#uses=1]
+ %tmp259.us = load i8* %tmp257.us.upgrd.22 ; <i8> [#uses=1]
+ %tmp259.us.upgrd.23 = zext i8 %tmp259.us to i32 ; <i32> [#uses=1]
+ %tmp261.us = xor i32 %tmp259.us.upgrd.23, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp262.us = ptrtoint i8* %optr.3.3.us to i32 ; <i32> [#uses=1]
+ %tmp263.us = add i32 %tmp262.us, 1 ; <i32> [#uses=1]
+ %tmp263.us.upgrd.24 = inttoptr i32 %tmp263.us to i8* ; <i8*> [#uses=2]
+ %tmp265.us = trunc i32 %tmp261.us to i8 ; <i8> [#uses=1]
+ %tmp268.us = or i8 %tmp266, %tmp265.us ; <i8> [#uses=1]
+ %tmp270.us = load i8* %tmp263.us.upgrd.24 ; <i8> [#uses=1]
+ %tmp271.us = and i8 %tmp268.us, %tmp270.us ; <i8> [#uses=1]
+ %tmp276.us = and i32 %tmp274, %tmp261.us ; <i32> [#uses=1]
+ %tmp276.us.upgrd.25 = trunc i32 %tmp276.us to i8 ; <i8> [#uses=1]
+ %tmp277.us = or i8 %tmp271.us, %tmp276.us.upgrd.25 ; <i8> [#uses=1]
+ store i8 %tmp277.us, i8* %tmp263.us.upgrd.24
+ br label %cond_next280.us
+
+bb252.us: ; preds = %bb252.loopexit.us, %cond_true295.us
+ %optr.3.3.us = phi i8* [ %dest.1.0.us, %cond_true295.us ], [ undef, %bb252.loopexit.us ] ; <i8*> [#uses=1]
+ %bptr.3.3.us = phi i8* [ %line.1.0.us, %cond_true295.us ], [ undef, %bb252.loopexit.us ] ; <i8*> [#uses=1]
+ %tmp246.3.us = phi i32 [ %tmp246, %cond_true295.us ], [ undef, %bb252.loopexit.us ] ; <i32> [#uses=1]
+ %tmp254.us = icmp sgt i32 %tmp246.3.us, -8 ; <i1> [#uses=1]
+ br i1 %tmp254.us, label %cond_true255.us, label %cond_next280.us
+
+cond_true249.us: ; preds = %cond_true249.preheader.us, %cond_true249.us
+ br i1 undef, label %bb252.loopexit.us, label %cond_true249.us
+
+cond_true249.preheader.us: ; preds = %cond_true295.us
+ br label %cond_true249.us
+
+bb252.loopexit.us: ; preds = %cond_true249.us
+ br label %bb252.us
+
+return.loopexit.us: ; preds = %cond_next280.us
+ br label %return.loopexit.split
+
+cond_true295.preheader.split: ; preds = %cond_true295.preheader
+ br label %cond_true295
+
+cond_true295: ; preds = %cond_true295.preheader.split, %cond_next280
+ %indvar60 = phi i32 [ 0, %cond_true295.preheader.split ], [ %indvar.next61, %cond_next280 ] ; <i32> [#uses=3]
+ %dest.1.0 = phi i8* [ %tmp286, %cond_next280 ], [ %tmp100, %cond_true295.preheader.split ] ; <i8*> [#uses=4]
+ %dest_line.1.0 = phi i8** [ %tmp282.upgrd.19, %cond_next280 ], [ %tmp96, %cond_true295.preheader.split ] ; <i8**> [#uses=1]
+ %tmp.63 = sub i32 0, %indvar60 ; <i32> [#uses=2]
+ %tmp292.0 = add i32 %tmp.63, %tmp29222 ; <i32> [#uses=1]
+ %tmp.65 = mul i32 %indvar60, %raster ; <i32> [#uses=2]
+ %tmp104.sum97 = add i32 %tmp102, %tmp.65 ; <i32> [#uses=1]
+ %line.1.0 = getelementptr i8* %base, i32 %tmp104.sum97 ; <i8*> [#uses=3]
+ %tmp.upgrd.26 = load i8* %line.1.0 ; <i8> [#uses=1]
+ %tmp206 = zext i8 %tmp.upgrd.26 to i32 ; <i32> [#uses=1]
+ %tmp208 = xor i32 %tmp206, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp210 = trunc i32 %tmp208 to i8 ; <i8> [#uses=1]
+ %tmp213 = or i8 %tmp211, %tmp210 ; <i8> [#uses=1]
+ %tmp215 = load i8* %dest.1.0 ; <i8> [#uses=1]
+ %tmp216 = and i8 %tmp213, %tmp215 ; <i8> [#uses=1]
+ %tmp221 = and i32 %tmp219, %tmp208 ; <i32> [#uses=1]
+ %tmp221.upgrd.27 = trunc i32 %tmp221 to i8 ; <i8> [#uses=1]
+ %tmp222 = or i8 %tmp216, %tmp221.upgrd.27 ; <i8> [#uses=1]
+ store i8 %tmp222, i8* %dest.1.0
+ br i1 false, label %bb252, label %cond_true249.preheader
+
+cond_false299: ; preds = %cond_next151
+ %tmp302 = sub i32 %tmp107, %tmp110 ; <i32> [#uses=1]
+ %tmp303 = and i32 %tmp302, 7 ; <i32> [#uses=3]
+ %tmp305 = sub i32 8, %tmp303 ; <i32> [#uses=1]
+ %tmp45438 = add i32 %h, -1 ; <i32> [#uses=2]
+ %tmp45640 = icmp slt i32 %tmp45438, 0 ; <i1> [#uses=1]
+ br i1 %tmp45640, label %return, label %cond_true457.preheader
+
+cond_true316: ; preds = %cond_true457
+ %tmp318 = zext i8 %tmp318.upgrd.48 to i32 ; <i32> [#uses=1]
+ %shift.upgrd.28 = zext i8 %tmp319 to i32 ; <i32> [#uses=1]
+ %tmp320 = lshr i32 %tmp318, %shift.upgrd.28 ; <i32> [#uses=1]
+ br label %cond_next340
+
+cond_false321: ; preds = %cond_true457
+ %tmp3188 = zext i8 %tmp318.upgrd.48 to i32 ; <i32> [#uses=1]
+ %shift.upgrd.29 = zext i8 %tmp324 to i32 ; <i32> [#uses=1]
+ %tmp325 = shl i32 %tmp3188, %shift.upgrd.29 ; <i32> [#uses=2]
+ %tmp326 = ptrtoint i8* %line.3.0 to i32 ; <i32> [#uses=1]
+ %tmp327 = add i32 %tmp326, 1 ; <i32> [#uses=1]
+ %tmp327.upgrd.30 = inttoptr i32 %tmp327 to i8* ; <i8*> [#uses=3]
+ br i1 %tmp330, label %cond_true331, label %cond_next340
+
+cond_true331: ; preds = %cond_false321
+ %tmp333 = load i8* %tmp327.upgrd.30 ; <i8> [#uses=1]
+ %tmp333.upgrd.31 = zext i8 %tmp333 to i32 ; <i32> [#uses=1]
+ %shift.upgrd.32 = zext i8 %tmp319 to i32 ; <i32> [#uses=1]
+ %tmp335 = lshr i32 %tmp333.upgrd.31, %shift.upgrd.32 ; <i32> [#uses=1]
+ %tmp337 = add i32 %tmp335, %tmp325 ; <i32> [#uses=1]
+ br label %cond_next340
+
+cond_next340: ; preds = %cond_true331, %cond_false321, %cond_true316
+ %bits.0 = phi i32 [ %tmp320, %cond_true316 ], [ %tmp337, %cond_true331 ], [ %tmp325, %cond_false321 ] ; <i32> [#uses=1]
+ %bptr307.3 = phi i8* [ %line.3.0, %cond_true316 ], [ %tmp327.upgrd.30, %cond_true331 ], [ %tmp327.upgrd.30, %cond_false321 ] ; <i8*> [#uses=2]
+ %tmp343 = xor i32 %bits.0, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp345 = trunc i32 %tmp343 to i8 ; <i8> [#uses=1]
+ %tmp348 = or i8 %tmp346, %tmp345 ; <i8> [#uses=1]
+ %tmp350 = load i8* %dest.3.0 ; <i8> [#uses=1]
+ %tmp351 = and i8 %tmp348, %tmp350 ; <i8> [#uses=1]
+ %tmp356 = and i32 %tmp354, %tmp343 ; <i32> [#uses=1]
+ %tmp356.upgrd.33 = trunc i32 %tmp356 to i8 ; <i8> [#uses=1]
+ %tmp357 = or i8 %tmp351, %tmp356.upgrd.33 ; <i8> [#uses=1]
+ store i8 %tmp357, i8* %dest.3.0
+ %tmp362 = ptrtoint i8* %dest.3.0 to i32 ; <i32> [#uses=1]
+ %optr309.3.in51 = add i32 %tmp362, 1 ; <i32> [#uses=2]
+ %optr309.353 = inttoptr i32 %optr309.3.in51 to i8* ; <i8*> [#uses=2]
+ br i1 %tmp39755, label %cond_true398.preheader, label %bb401
+
+cond_true398.preheader: ; preds = %cond_next340
+ br label %cond_true398
+
+cond_true398: ; preds = %cond_true398, %cond_true398.preheader
+ %indvar66 = phi i32 [ 0, %cond_true398.preheader ], [ %indvar.next67, %cond_true398 ] ; <i32> [#uses=4]
+ %bptr307.4.0 = phi i8* [ %tmp370.upgrd.35, %cond_true398 ], [ %bptr307.3, %cond_true398.preheader ] ; <i8*> [#uses=2]
+ %optr309.3.0 = phi i8* [ %optr309.3, %cond_true398 ], [ %optr309.353, %cond_true398.preheader ] ; <i8*> [#uses=2]
+ %optr309.3.in.0 = add i32 %indvar66, %optr309.3.in51 ; <i32> [#uses=1]
+ %tmp.70 = add i32 %tmp109, %w ; <i32> [#uses=1]
+ %tmp.72 = mul i32 %indvar66, -8 ; <i32> [#uses=1]
+ %tmp.71 = add i32 %tmp.70, -8 ; <i32> [#uses=1]
+ %count308.3.0 = add i32 %tmp.72, %tmp.71 ; <i32> [#uses=1]
+ %tmp366 = load i8* %bptr307.4.0 ; <i8> [#uses=1]
+ %tmp366.upgrd.34 = zext i8 %tmp366 to i32 ; <i32> [#uses=1]
+ %tmp369 = ptrtoint i8* %bptr307.4.0 to i32 ; <i32> [#uses=1]
+ %tmp370 = add i32 %tmp369, 1 ; <i32> [#uses=1]
+ %tmp370.upgrd.35 = inttoptr i32 %tmp370 to i8* ; <i8*> [#uses=3]
+ %tmp372 = load i8* %tmp370.upgrd.35 ; <i8> [#uses=1]
+ %tmp372.upgrd.36 = zext i8 %tmp372 to i32 ; <i32> [#uses=1]
+ %shift.upgrd.37 = zext i8 %tmp319 to i32 ; <i32> [#uses=1]
+ %tmp374463 = lshr i32 %tmp372.upgrd.36, %shift.upgrd.37 ; <i32> [#uses=1]
+ %shift.upgrd.38 = zext i8 %tmp324 to i32 ; <i32> [#uses=1]
+ %tmp368 = shl i32 %tmp366.upgrd.34, %shift.upgrd.38 ; <i32> [#uses=1]
+ %tmp377 = add i32 %tmp374463, %tmp368 ; <i32> [#uses=1]
+ %tmp379 = xor i32 %tmp377, %iftmp.35.0 ; <i32> [#uses=2]
+ %tmp382 = or i32 %tmp379, %iftmp.36.0 ; <i32> [#uses=1]
+ %tmp382.upgrd.39 = trunc i32 %tmp382 to i8 ; <i8> [#uses=1]
+ %tmp384 = load i8* %optr309.3.0 ; <i8> [#uses=1]
+ %tmp385 = and i8 %tmp382.upgrd.39, %tmp384 ; <i8> [#uses=1]
+ %tmp388 = and i32 %tmp379, %iftmp.37.0 ; <i32> [#uses=1]
+ %tmp388.upgrd.40 = trunc i32 %tmp388 to i8 ; <i8> [#uses=1]
+ %tmp389 = or i8 %tmp385, %tmp388.upgrd.40 ; <i8> [#uses=1]
+ store i8 %tmp389, i8* %optr309.3.0
+ %tmp392 = add i32 %count308.3.0, -8 ; <i32> [#uses=2]
+ %optr309.3.in = add i32 %optr309.3.in.0, 1 ; <i32> [#uses=1]
+ %optr309.3 = inttoptr i32 %optr309.3.in to i8* ; <i8*> [#uses=2]
+ %tmp397 = icmp sgt i32 %tmp392, 7 ; <i1> [#uses=1]
+ %indvar.next67 = add i32 %indvar66, 1 ; <i32> [#uses=1]
+ br i1 %tmp397, label %cond_true398, label %bb401.loopexit
+
+bb401.loopexit: ; preds = %cond_true398
+ br label %bb401
+
+bb401: ; preds = %bb401.loopexit, %cond_next340
+ %count308.3.1 = phi i32 [ %tmp361, %cond_next340 ], [ %tmp392, %bb401.loopexit ] ; <i32> [#uses=2]
+ %bptr307.4.1 = phi i8* [ %bptr307.3, %cond_next340 ], [ %tmp370.upgrd.35, %bb401.loopexit ] ; <i8*> [#uses=2]
+ %optr309.3.1 = phi i8* [ %optr309.353, %cond_next340 ], [ %optr309.3, %bb401.loopexit ] ; <i8*> [#uses=2]
+ %tmp403 = icmp sgt i32 %count308.3.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp403, label %cond_true404, label %cond_next442
+
+cond_true404: ; preds = %bb401
+ %tmp406 = load i8* %bptr307.4.1 ; <i8> [#uses=1]
+ %tmp406.upgrd.41 = zext i8 %tmp406 to i32 ; <i32> [#uses=1]
+ %shift.upgrd.42 = zext i8 %tmp324 to i32 ; <i32> [#uses=1]
+ %tmp408 = shl i32 %tmp406.upgrd.41, %shift.upgrd.42 ; <i32> [#uses=2]
+ %tmp413 = icmp sgt i32 %count308.3.1, %tmp303 ; <i1> [#uses=1]
+ br i1 %tmp413, label %cond_true414, label %cond_next422
+
+cond_true414: ; preds = %cond_true404
+ %tmp409 = ptrtoint i8* %bptr307.4.1 to i32 ; <i32> [#uses=1]
+ %tmp410 = add i32 %tmp409, 1 ; <i32> [#uses=1]
+ %tmp410.upgrd.43 = inttoptr i32 %tmp410 to i8* ; <i8*> [#uses=1]
+ %tmp416 = load i8* %tmp410.upgrd.43 ; <i8> [#uses=1]
+ %tmp416.upgrd.44 = zext i8 %tmp416 to i32 ; <i32> [#uses=1]
+ %shift.upgrd.45 = zext i8 %tmp319 to i32 ; <i32> [#uses=1]
+ %tmp418 = lshr i32 %tmp416.upgrd.44, %shift.upgrd.45 ; <i32> [#uses=2]
+ %tmp420 = add i32 %tmp418, %tmp408 ; <i32> [#uses=1]
+ br label %cond_next422
+
+cond_next422: ; preds = %cond_true414, %cond_true404
+ %bits.6 = phi i32 [ %tmp420, %cond_true414 ], [ %tmp408, %cond_true404 ] ; <i32> [#uses=1]
+ %tmp425 = xor i32 %bits.6, %iftmp.35.0 ; <i32> [#uses=1]
+ %tmp427 = trunc i32 %tmp425 to i8 ; <i8> [#uses=2]
+ %tmp430 = or i8 %tmp428, %tmp427 ; <i8> [#uses=1]
+ %tmp432 = load i8* %optr309.3.1 ; <i8> [#uses=1]
+ %tmp433 = and i8 %tmp430, %tmp432 ; <i8> [#uses=1]
+ %tmp438 = and i8 %tmp436.upgrd.47, %tmp427 ; <i8> [#uses=1]
+ %tmp439 = or i8 %tmp433, %tmp438 ; <i8> [#uses=1]
+ store i8 %tmp439, i8* %optr309.3.1
+ br label %cond_next442
+
+cond_next442: ; preds = %cond_next422, %bb401
+ %tmp443 = ptrtoint i8** %dest_line.3.0 to i32 ; <i32> [#uses=1]
+ %tmp444 = add i32 %tmp443, 4 ; <i32> [#uses=1]
+ %tmp444.upgrd.46 = inttoptr i32 %tmp444 to i8** ; <i8**> [#uses=2]
+ %tmp446 = load i8** %tmp444.upgrd.46 ; <i8*> [#uses=1]
+ %tmp448 = getelementptr i8* %tmp446, i32 %tmp93 ; <i8*> [#uses=1]
+ %tmp454 = add i32 %tmp454.0, -1 ; <i32> [#uses=1]
+ %tmp456 = icmp slt i32 %tmp454, 0 ; <i1> [#uses=1]
+ %indvar.next75 = add i32 %indvar74, 1 ; <i32> [#uses=1]
+ br i1 %tmp456, label %return.loopexit56, label %cond_true457
+
+cond_true457.preheader: ; preds = %cond_false299
+ %tmp315 = icmp slt i32 %tmp107, %tmp110 ; <i1> [#uses=1]
+ %tmp319 = trunc i32 %tmp303 to i8 ; <i8> [#uses=4]
+ %tmp324 = trunc i32 %tmp305 to i8 ; <i8> [#uses=3]
+ %tmp330 = icmp slt i32 %tmp107, %w ; <i1> [#uses=1]
+ %tmp344 = trunc i32 %mask.1.1 to i8 ; <i8> [#uses=1]
+ %tmp344not = xor i8 %tmp344, -1 ; <i8> [#uses=1]
+ %tmp347 = trunc i32 %iftmp.36.0 to i8 ; <i8> [#uses=2]
+ %tmp346 = or i8 %tmp347, %tmp344not ; <i8> [#uses=1]
+ %tmp354 = and i32 %iftmp.37.0, %mask.1.1 ; <i32> [#uses=1]
+ %tmp361 = sub i32 %w, %tmp110 ; <i32> [#uses=2]
+ %tmp39755 = icmp sgt i32 %tmp361, 7 ; <i1> [#uses=1]
+ %tmp426 = trunc i32 %rmask.0.1 to i8 ; <i8> [#uses=1]
+ %tmp426not = xor i8 %tmp426, -1 ; <i8> [#uses=1]
+ %tmp428 = or i8 %tmp347, %tmp426not ; <i8> [#uses=1]
+ %tmp436 = and i32 %iftmp.37.0, %rmask.0.1 ; <i32> [#uses=1]
+ %tmp436.upgrd.47 = trunc i32 %tmp436 to i8 ; <i8> [#uses=1]
+ br label %cond_true457
+
+cond_true457: ; preds = %cond_true457.preheader, %cond_next442
+ %indvar74 = phi i32 [ 0, %cond_true457.preheader ], [ %indvar.next75, %cond_next442 ] ; <i32> [#uses=3]
+ %dest.3.0 = phi i8* [ %tmp448, %cond_next442 ], [ %tmp100, %cond_true457.preheader ] ; <i8*> [#uses=3]
+ %dest_line.3.0 = phi i8** [ %tmp444.upgrd.46, %cond_next442 ], [ %tmp96, %cond_true457.preheader ] ; <i8**> [#uses=1]
+ %tmp.77 = sub i32 0, %indvar74 ; <i32> [#uses=2]
+ %tmp454.0 = add i32 %tmp.77, %tmp45438 ; <i32> [#uses=1]
+ %tmp.79 = mul i32 %indvar74, %raster ; <i32> [#uses=2]
+ %tmp104.sum = add i32 %tmp102, %tmp.79 ; <i32> [#uses=1]
+ %line.3.0 = getelementptr i8* %base, i32 %tmp104.sum ; <i8*> [#uses=3]
+ %tmp318.upgrd.48 = load i8* %line.3.0 ; <i8> [#uses=2]
+ br i1 %tmp315, label %cond_false321, label %cond_true316
+
+return.loopexit: ; preds = %cond_next280
+ br label %return.loopexit.split
+
+return.loopexit.split: ; preds = %return.loopexit, %return.loopexit.us
+ br label %return
+
+return.loopexit56: ; preds = %cond_next442
+ br label %return
+
+return: ; preds = %return.loopexit56, %return.loopexit.split, %cond_false299, %cond_true197, %cond_next78, %cond_next63, %bb58, %cond_next46
+ %retval.0 = phi i32 [ 0, %cond_next46 ], [ -1, %bb58 ], [ -1, %cond_next63 ], [ -1, %cond_next78 ], [ 0, %cond_true197 ], [ 0, %cond_false299 ], [ 0, %return.loopexit.split ], [ 0, %return.loopexit56 ] ; <i32> [#uses=1]
+ ret i32 %retval.0
+}
+
+declare i32 @mem_no_fault_proc(%struct.gx_device_memory*, i32, i32, i32, i32, i32)
+
+declare i32 @mem_mono_fill_rectangle(%struct.gx_device*, i32, i32, i32, i32, i32)
+
+declare i32 @mem_copy_mono_recover(%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32)
diff --git a/test/Transforms/InstCombine/2006-06-28-infloop.ll b/test/Transforms/InstCombine/2006-06-28-infloop.ll
new file mode 100644
index 000000000000..84e751037b4d
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-06-28-infloop.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8"
+
+define void @test() {
+entry:
+ %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1]
+ %tmp.upgrd.1 = load i64* %tmp ; <i64> [#uses=1]
+ %tmp8.ui = load i64* null ; <i64> [#uses=1]
+ %tmp8 = bitcast i64 %tmp8.ui to i64 ; <i64> [#uses=1]
+ %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; <i64> [#uses=1]
+ %sext = trunc i64 %tmp9 to i32 ; <i32> [#uses=1]
+ %tmp27.i = sext i32 %sext to i64 ; <i64> [#uses=1]
+ tail call void @foo( i32 0, i64 %tmp27.i )
+ unreachable
+}
+
+declare void @foo(i32, i64)
+
diff --git a/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll b/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll
new file mode 100644
index 000000000000..bf9252a349ea
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll
@@ -0,0 +1,46 @@
+; PR905
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
+
+%RPYTHON_EXCEPTION = type { %RPYTHON_EXCEPTION_VTABLE* }
+%RPYTHON_EXCEPTION_VTABLE = type { %RPYTHON_EXCEPTION_VTABLE*, i32, i32, %RPyOpaque_RuntimeTypeInfo*, %arraytype_Char*, %functiontype_12* }
+%RPyOpaque_RuntimeTypeInfo = type opaque*
+%arraytype_Char = type { i32, [0 x i8] }
+%fixarray_array1019 = type [1019 x i8*]
+%functiontype_12 = type %RPYTHON_EXCEPTION* ()
+%functiontype_14 = type void (%structtype_pypy.rpython.memory.gc.MarkSweepGC*)
+%structtype_AddressLinkedListChunk = type { %structtype_AddressLinkedListChunk*, i32, %fixarray_array1019 }
+%structtype_exceptions.Exception = type { %RPYTHON_EXCEPTION }
+%structtype_gc_pool = type { }
+%structtype_gc_pool_node = type { %structtype_header*, %structtype_gc_pool_node* }
+%structtype_header = type { i32, %structtype_header* }
+%structtype_pypy.rpython.memory.gc.MarkSweepGC = type { %structtype_exceptions.Exception, i32, i32, i1, %structtype_gc_pool*, i32, %structtype_header*, %structtype_header*, %structtype_gc_pool_node*, double, double }
+
+define fastcc void @pypy_MarkSweepGC.collect() {
+block0:
+ %v1221 = load %structtype_AddressLinkedListChunk** null ; <%structtype_AddressLinkedListChunk*> [#uses=1]
+ %v1222 = icmp ne %structtype_AddressLinkedListChunk* %v1221, null ; <i1> [#uses=1]
+ br i1 %v1222, label %block79, label %block4
+
+block4: ; preds = %block0
+ ret void
+
+block22: ; preds = %block79
+ ret void
+
+block67: ; preds = %block79
+ %v1459 = load %structtype_gc_pool** null ; <%structtype_gc_pool*> [#uses=1]
+ %v1460 = bitcast %structtype_gc_pool* %v1459 to i8* ; <i8*> [#uses=1]
+ %tmp_873 = ptrtoint i8* %v1460 to i32 ; <i32> [#uses=1]
+ %tmp_874 = sub i32 %tmp_873, 0 ; <i32> [#uses=1]
+ %v1461 = inttoptr i32 %tmp_874 to i8* ; <i8*> [#uses=1]
+ %v1462 = bitcast i8* %v1461 to %structtype_header* ; <%structtype_header*> [#uses=1]
+ %tmp_876 = getelementptr %structtype_header* %v1462, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp_876
+ ret void
+
+block79: ; preds = %block0
+ %v1291 = load %structtype_gc_pool** null ; <%structtype_gc_pool*> [#uses=1]
+ %v1292 = icmp ne %structtype_gc_pool* %v1291, null ; <i1> [#uses=1]
+ br i1 %v1292, label %block67, label %block22
+}
diff --git a/test/Transforms/InstCombine/2006-09-15-CastToBool.ll b/test/Transforms/InstCombine/2006-09-15-CastToBool.ll
new file mode 100644
index 000000000000..043b598c8966
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-09-15-CastToBool.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and
+; PR913
+
+define i32 @test(i32* %tmp1) {
+ %tmp.i = load i32* %tmp1 ; <i32> [#uses=1]
+ %tmp = bitcast i32 %tmp.i to i32 ; <i32> [#uses=1]
+ %tmp2.ui = lshr i32 %tmp, 5 ; <i32> [#uses=1]
+ %tmp2 = bitcast i32 %tmp2.ui to i32 ; <i32> [#uses=1]
+ %tmp3 = and i32 %tmp2, 1 ; <i32> [#uses=1]
+ %tmp3.upgrd.1 = icmp ne i32 %tmp3, 0 ; <i1> [#uses=1]
+ %tmp34 = zext i1 %tmp3.upgrd.1 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp34
+}
+
diff --git a/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll
new file mode 100644
index 000000000000..4ca3dc1ec1c1
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll
@@ -0,0 +1,10 @@
+; The optimizer should be able to remove cast operation here.
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
+; RUN: not grep sext.*i32
+
+define i1 @eq_signed_to_small_unsigned(i8 %SB) {
+ %Y = sext i8 %SB to i32 ; <i32> [#uses=1]
+ %C = icmp eq i32 %Y, 17 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
diff --git a/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll
new file mode 100644
index 000000000000..8678a85c4648
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll
@@ -0,0 +1,12 @@
+; This test case is reduced from llvmAsmParser.cpp
+; The optimizer should not remove the cast here.
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
+; RUN: grep sext.*i32
+
+
+define i1 @test(i16 %X) {
+ %A = sext i16 %X to i32 ; <i32> [#uses=1]
+ %B = icmp ugt i32 %A, 1330 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
diff --git a/test/Transforms/InstCombine/2006-10-20-mask.ll b/test/Transforms/InstCombine/2006-10-20-mask.ll
new file mode 100644
index 000000000000..a5864f1c1831
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-10-20-mask.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
+; RUN: grep and
+
+define i64 @foo(i64 %tmp, i64 %tmp2) {
+ %tmp.upgrd.1 = trunc i64 %tmp to i32 ; <i32> [#uses=1]
+ %tmp2.upgrd.2 = trunc i64 %tmp2 to i32 ; <i32> [#uses=1]
+ %tmp3 = and i32 %tmp.upgrd.1, %tmp2.upgrd.2 ; <i32> [#uses=1]
+ %tmp4 = zext i32 %tmp3 to i64 ; <i64> [#uses=1]
+ ret i64 %tmp4
+}
+
diff --git a/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll b/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll
new file mode 100644
index 000000000000..5ad0af406d48
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep mul | count 2
+
+define <4 x float> @test(<4 x float> %V) {
+ %Y = mul <4 x float> %V, < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 > ; <<4 x float>> [#uses=1]
+ %Z = mul <4 x float> %Y, < float 1.000000e+00, float 2.000000e+05, float -3.000000e+00, float 4.000000e+00 > ; <<4 x float>> [#uses=1]
+ ret <4 x float> %Z
+}
+
diff --git a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll b/test/Transforms/InstCombine/2006-11-03-Memmove64.ll
new file mode 100644
index 000000000000..23e805a9360c
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-11-03-Memmove64.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep memmove.i32
+; Instcombine was trying to turn this into a memmove.i32
+
+target datalayout = "e-p:64:64"
+target triple = "alphaev67-unknown-linux-gnu"
+@str10 = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+
+define void @do_join(i8* %b) {
+entry:
+ call void @llvm.memmove.i64( i8* %b, i8* getelementptr ([1 x i8]* @str10, i32 0, i64 0), i64 1, i32 1 )
+ ret void
+}
+
+declare void @llvm.memmove.i64(i8*, i8*, i64, i32)
+
diff --git a/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll b/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll
new file mode 100644
index 000000000000..8c48d4357bca
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep lshr
+; Verify this is not turned into -1.
+
+define i32 @test(i8 %amt) {
+ %shift.upgrd.1 = zext i8 %amt to i32 ; <i32> [#uses=1]
+ %B = lshr i32 -1, %shift.upgrd.1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
diff --git a/test/Transforms/InstCombine/2006-11-27-XorBug.ll b/test/Transforms/InstCombine/2006-11-27-XorBug.ll
new file mode 100644
index 000000000000..631b43f61f9e
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-11-27-XorBug.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and.*32
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep or.*153
+; PR1014
+
+define i32 @test(i32 %tmp1) {
+ %ovm = and i32 %tmp1, 32 ; <i32> [#uses=1]
+ %ov3 = add i32 %ovm, 145 ; <i32> [#uses=1]
+ %ov110 = xor i32 %ov3, 153 ; <i32> [#uses=1]
+ ret i32 %ov110
+}
+
diff --git a/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll b/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll
new file mode 100644
index 000000000000..60ee50327916
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep add
+
+define <4 x float> @test(<4 x float> %tmp26, <4 x float> %tmp53) {
+ ; (X+Y)-Y != X for fp vectors.
+ %tmp64 = add <4 x float> %tmp26, %tmp53 ; <<4 x float>> [#uses=1]
+ %tmp75 = sub <4 x float> %tmp64, %tmp53 ; <<4 x float>> [#uses=1]
+ ret <4 x float> %tmp75
+}
diff --git a/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll b/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll
new file mode 100644
index 000000000000..2c3313efa2a8
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zext
+
+; Never merge these two conversions, even though it's possible: this is
+; significantly more expensive than the two conversions on some targets
+; and it causes libgcc to be compile __fixunsdfdi into a recursive
+; function.
+define i64 @test(double %D) {
+ %A = fptoui double %D to i32 ; <i32> [#uses=1]
+ %B = zext i32 %A to i64 ; <i64> [#uses=1]
+ ret i64 %B
+}
+
diff --git a/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll b/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll
new file mode 100644
index 000000000000..ddfb88c7bfbb
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {%bothcond =}
+
+define i1 @Doit_bb(i32 %i.0) {
+bb:
+ %tmp = icmp sgt i32 %i.0, 0 ; <i1> [#uses=1]
+ %tmp.not = xor i1 %tmp, true ; <i1> [#uses=1]
+ %tmp2 = icmp sgt i32 %i.0, 8 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp.not, %tmp2 ; <i1> [#uses=1]
+ br i1 %bothcond, label %exitTrue, label %exitFalse
+
+exitTrue: ; preds = %bb
+ ret i1 true
+
+exitFalse: ; preds = %bb
+ ret i1 false
+}
+
diff --git a/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll b/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll
new file mode 100644
index 000000000000..1508a523b7a9
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll
@@ -0,0 +1,51 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {icmp sgt}
+; END.
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.point = type { i32, i32 }
+
+define i32 @visible(i32 %direction, i64 %p1.0, i64 %p2.0, i64 %p3.0) {
+entry:
+ %p1_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
+ %p2_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
+ %p3_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp.upgrd.1 = getelementptr { i64 }* %tmp, i64 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %p1.0, i64* %tmp.upgrd.1
+ %tmp1 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp2 = getelementptr { i64 }* %tmp1, i64 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %p2.0, i64* %tmp2
+ %tmp3 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp4 = getelementptr { i64 }* %tmp3, i64 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %p3.0, i64* %tmp4
+ %tmp.upgrd.2 = icmp eq i32 %direction, 0 ; <i1> [#uses=1]
+ %tmp5 = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp6 = getelementptr { i64 }* %tmp5, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp.upgrd.3 = load i64* %tmp6 ; <i64> [#uses=1]
+ %tmp7 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp8 = getelementptr { i64 }* %tmp7, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp9 = load i64* %tmp8 ; <i64> [#uses=1]
+ %tmp10 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp11 = getelementptr { i64 }* %tmp10, i64 0, i32 0 ; <i64*> [#uses=1]
+ %tmp12 = load i64* %tmp11 ; <i64> [#uses=1]
+ %tmp13 = call i32 @determinant( i64 %tmp.upgrd.3, i64 %tmp9, i64 %tmp12 ) ; <i32> [#uses=2]
+ br i1 %tmp.upgrd.2, label %cond_true, label %cond_false
+
+cond_true: ; preds = %entry
+ %tmp14 = icmp slt i32 %tmp13, 0 ; <i1> [#uses=1]
+ %tmp14.upgrd.4 = zext i1 %tmp14 to i32 ; <i32> [#uses=1]
+ br label %return
+
+cond_false: ; preds = %entry
+ %tmp26 = icmp sgt i32 %tmp13, 0 ; <i1> [#uses=1]
+ %tmp26.upgrd.5 = zext i1 %tmp26 to i32 ; <i32> [#uses=1]
+ br label %return
+
+return: ; preds = %cond_false, %cond_true
+ %retval.0 = phi i32 [ %tmp14.upgrd.4, %cond_true ], [ %tmp26.upgrd.5, %cond_false ] ; <i32> [#uses=1]
+ ret i32 %retval.0
+}
+
+declare i32 @determinant(i64, i64, i64)
diff --git a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
new file mode 100644
index 000000000000..e4aade7b8ea4
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select
+; END.
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.point = type { i32, i32 }
+
+define i32 @visible(i32 %direction, i64 %p1.0, i64 %p2.0, i64 %p3.0) {
+entry:
+ %p1_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
+ %p2_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
+ %p3_addr = alloca %struct.point ; <%struct.point*> [#uses=2]
+ %tmp = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp.upgrd.1 = getelementptr { i64 }* %tmp, i32 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %p1.0, i64* %tmp.upgrd.1
+ %tmp1 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp2 = getelementptr { i64 }* %tmp1, i32 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %p2.0, i64* %tmp2
+ %tmp3 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp4 = getelementptr { i64 }* %tmp3, i32 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %p3.0, i64* %tmp4
+ %tmp.upgrd.2 = icmp eq i32 %direction, 0 ; <i1> [#uses=1]
+ %tmp5 = bitcast %struct.point* %p1_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp6 = getelementptr { i64 }* %tmp5, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp.upgrd.3 = load i64* %tmp6 ; <i64> [#uses=1]
+ %tmp7 = bitcast %struct.point* %p2_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp8 = getelementptr { i64 }* %tmp7, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp9 = load i64* %tmp8 ; <i64> [#uses=1]
+ %tmp10 = bitcast %struct.point* %p3_addr to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp11 = getelementptr { i64 }* %tmp10, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp12 = load i64* %tmp11 ; <i64> [#uses=1]
+ %tmp13 = call i32 @determinant( i64 %tmp.upgrd.3, i64 %tmp9, i64 %tmp12 ) ; <i32> [#uses=2]
+ %tmp14 = icmp slt i32 %tmp13, 0 ; <i1> [#uses=1]
+ %tmp26 = icmp sgt i32 %tmp13, 0 ; <i1> [#uses=1]
+ %retval.0.in = select i1 %tmp.upgrd.2, i1 %tmp14, i1 %tmp26 ; <i1> [#uses=1]
+ %retval.0 = zext i1 %retval.0.in to i32 ; <i32> [#uses=1]
+ ret i32 %retval.0
+}
+
+declare i32 @determinant(i64, i64, i64)
+
diff --git a/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll b/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll
new file mode 100644
index 000000000000..15f73622d614
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll
@@ -0,0 +1,162 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v {icmp ult i32}
+; END.
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.edgeBox = type { i16, i16, i16, i16, i16, i16 }
+@qsz = external global i32 ; <i32*> [#uses=12]
+@thresh = external global i32 ; <i32*> [#uses=2]
+@mthresh = external global i32 ; <i32*> [#uses=1]
+
+define i32 @qsorte(i8* %base, i32 %n, i32 %size) {
+entry:
+ %tmp = icmp sgt i32 %n, 1 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_next, label %return
+
+cond_next: ; preds = %entry
+ store i32 %size, i32* @qsz
+ %tmp3 = shl i32 %size, 2 ; <i32> [#uses=1]
+ store i32 %tmp3, i32* @thresh
+ %tmp4 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp5 = mul i32 %tmp4, 6 ; <i32> [#uses=1]
+ store i32 %tmp5, i32* @mthresh
+ %tmp6 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp8 = mul i32 %tmp6, %n ; <i32> [#uses=1]
+ %tmp9 = getelementptr i8* %base, i32 %tmp8 ; <i8*> [#uses=3]
+ %tmp11 = icmp sgt i32 %n, 3 ; <i1> [#uses=1]
+ br i1 %tmp11, label %cond_true12, label %bb30
+
+cond_true12: ; preds = %cond_next
+ %tmp156 = call i32 @qste( i8* %base, i8* %tmp9 ) ; <i32> [#uses=0]
+ %tmp16 = load i32* @thresh ; <i32> [#uses=1]
+ %tmp18 = getelementptr i8* %base, i32 %tmp16 ; <i8*> [#uses=2]
+ %tmp3117 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp3318 = getelementptr i8* %base, i32 %tmp3117 ; <i8*> [#uses=2]
+ %tmp3621 = icmp ult i8* %tmp3318, %tmp18 ; <i1> [#uses=1]
+ br i1 %tmp3621, label %bb, label %bb37
+
+bb: ; preds = %bb30, %cond_true12
+ %hi.0.0 = phi i8* [ %tmp18, %cond_true12 ], [ %hi.0, %bb30 ] ; <i8*> [#uses=4]
+ %j.1.0 = phi i8* [ %base, %cond_true12 ], [ %j.1, %bb30 ] ; <i8*> [#uses=4]
+ %tmp33.0 = phi i8* [ %tmp3318, %cond_true12 ], [ %tmp33, %bb30 ] ; <i8*> [#uses=6]
+ %tmp3.upgrd.1 = bitcast i8* %j.1.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp4.upgrd.2 = bitcast i8* %tmp33.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp255 = call i32 @comparee( %struct.edgeBox* %tmp3.upgrd.1, %struct.edgeBox* %tmp4.upgrd.2 ) ; <i32> [#uses=1]
+ %tmp26 = icmp sgt i32 %tmp255, 0 ; <i1> [#uses=1]
+ br i1 %tmp26, label %cond_true27, label %bb30
+
+cond_true27: ; preds = %bb
+ br label %bb30
+
+bb30: ; preds = %cond_true27, %bb, %cond_next
+ %hi.0.3 = phi i8* [ %hi.0.0, %cond_true27 ], [ %hi.0.0, %bb ], [ undef, %cond_next ] ; <i8*> [#uses=0]
+ %j.1.3 = phi i8* [ %j.1.0, %cond_true27 ], [ %j.1.0, %bb ], [ undef, %cond_next ] ; <i8*> [#uses=0]
+ %tmp33.3 = phi i8* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ undef, %cond_next ] ; <i8*> [#uses=0]
+ %hi.0 = phi i8* [ %tmp9, %cond_next ], [ %hi.0.0, %bb ], [ %hi.0.0, %cond_true27 ] ; <i8*> [#uses=2]
+ %lo.1 = phi i8* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ %base, %cond_next ] ; <i8*> [#uses=1]
+ %j.1 = phi i8* [ %tmp33.0, %cond_true27 ], [ %j.1.0, %bb ], [ %base, %cond_next ] ; <i8*> [#uses=2]
+ %tmp31 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp33 = getelementptr i8* %lo.1, i32 %tmp31 ; <i8*> [#uses=2]
+ %tmp36 = icmp ult i8* %tmp33, %hi.0 ; <i1> [#uses=1]
+ br i1 %tmp36, label %bb, label %bb37
+
+bb37: ; preds = %bb30, %cond_true12
+ %j.1.1 = phi i8* [ %j.1, %bb30 ], [ %base, %cond_true12 ] ; <i8*> [#uses=4]
+ %tmp40 = icmp eq i8* %j.1.1, %base ; <i1> [#uses=1]
+ br i1 %tmp40, label %bb115, label %cond_true41
+
+cond_true41: ; preds = %bb37
+ %tmp43 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp45 = getelementptr i8* %base, i32 %tmp43 ; <i8*> [#uses=2]
+ %tmp6030 = icmp ult i8* %base, %tmp45 ; <i1> [#uses=1]
+ br i1 %tmp6030, label %bb46, label %bb115
+
+bb46: ; preds = %bb46, %cond_true41
+ %j.2.0 = phi i8* [ %j.1.1, %cond_true41 ], [ %tmp52, %bb46 ] ; <i8*> [#uses=3]
+ %i.2.0 = phi i8* [ %base, %cond_true41 ], [ %tmp56, %bb46 ] ; <i8*> [#uses=3]
+ %tmp.upgrd.3 = load i8* %j.2.0 ; <i8> [#uses=2]
+ %tmp49 = load i8* %i.2.0 ; <i8> [#uses=1]
+ store i8 %tmp49, i8* %j.2.0
+ %tmp52 = getelementptr i8* %j.2.0, i32 1 ; <i8*> [#uses=2]
+ store i8 %tmp.upgrd.3, i8* %i.2.0
+ %tmp56 = getelementptr i8* %i.2.0, i32 1 ; <i8*> [#uses=3]
+ %tmp60 = icmp ult i8* %tmp56, %tmp45 ; <i1> [#uses=1]
+ br i1 %tmp60, label %bb46, label %bb115
+
+bb66: ; preds = %bb115, %bb66
+ %hi.3 = phi i8* [ %tmp118, %bb115 ], [ %tmp70, %bb66 ] ; <i8*> [#uses=2]
+ %tmp67 = load i32* @qsz ; <i32> [#uses=2]
+ %tmp68 = sub i32 0, %tmp67 ; <i32> [#uses=1]
+ %tmp70 = getelementptr i8* %hi.3, i32 %tmp68 ; <i8*> [#uses=2]
+ %tmp.upgrd.4 = bitcast i8* %tmp70 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp1 = bitcast i8* %tmp118 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp732 = call i32 @comparee( %struct.edgeBox* %tmp.upgrd.4, %struct.edgeBox* %tmp1 ) ; <i32> [#uses=1]
+ %tmp74 = icmp sgt i32 %tmp732, 0 ; <i1> [#uses=1]
+ br i1 %tmp74, label %bb66, label %bb75
+
+bb75: ; preds = %bb66
+ %tmp76 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp70.sum = sub i32 %tmp76, %tmp67 ; <i32> [#uses=1]
+ %tmp78 = getelementptr i8* %hi.3, i32 %tmp70.sum ; <i8*> [#uses=3]
+ %tmp81 = icmp eq i8* %tmp78, %tmp118 ; <i1> [#uses=1]
+ br i1 %tmp81, label %bb115, label %cond_true82
+
+cond_true82: ; preds = %bb75
+ %tmp83 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp118.sum = add i32 %tmp116, %tmp83 ; <i32> [#uses=1]
+ %tmp85 = getelementptr i8* %min.1, i32 %tmp118.sum ; <i8*> [#uses=1]
+ %tmp10937 = getelementptr i8* %tmp85, i32 -1 ; <i8*> [#uses=3]
+ %tmp11239 = icmp ult i8* %tmp10937, %tmp118 ; <i1> [#uses=1]
+ br i1 %tmp11239, label %bb115, label %bb86
+
+bb86: ; preds = %bb104, %cond_true82
+ %tmp109.0 = phi i8* [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ] ; <i8*> [#uses=5]
+ %i.5.2 = phi i8* [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ] ; <i8*> [#uses=0]
+ %tmp100.2 = phi i8* [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ] ; <i8*> [#uses=0]
+ %tmp88 = load i8* %tmp109.0 ; <i8> [#uses=2]
+ %tmp9746 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp9847 = sub i32 0, %tmp9746 ; <i32> [#uses=1]
+ %tmp10048 = getelementptr i8* %tmp109.0, i32 %tmp9847 ; <i8*> [#uses=3]
+ %tmp10350 = icmp ult i8* %tmp10048, %tmp78 ; <i1> [#uses=1]
+ br i1 %tmp10350, label %bb104, label %bb91
+
+bb91: ; preds = %bb91, %bb86
+ %i.5.0 = phi i8* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; <i8*> [#uses=1]
+ %tmp100.0 = phi i8* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; <i8*> [#uses=4]
+ %tmp93 = load i8* %tmp100.0 ; <i8> [#uses=1]
+ store i8 %tmp93, i8* %i.5.0
+ %tmp97 = load i32* @qsz ; <i32> [#uses=1]
+ %tmp98 = sub i32 0, %tmp97 ; <i32> [#uses=1]
+ %tmp100 = getelementptr i8* %tmp100.0, i32 %tmp98 ; <i8*> [#uses=3]
+ %tmp103 = icmp ult i8* %tmp100, %tmp78 ; <i1> [#uses=1]
+ br i1 %tmp103, label %bb104, label %bb91
+
+bb104: ; preds = %bb91, %bb86
+ %i.5.1 = phi i8* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; <i8*> [#uses=4]
+ %tmp100.1 = phi i8* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; <i8*> [#uses=3]
+ store i8 %tmp88, i8* %i.5.1
+ %tmp109 = getelementptr i8* %tmp109.0, i32 -1 ; <i8*> [#uses=3]
+ %tmp112 = icmp ult i8* %tmp109, %tmp118 ; <i1> [#uses=1]
+ br i1 %tmp112, label %bb115, label %bb86
+
+bb115: ; preds = %bb104, %cond_true82, %bb75, %bb46, %cond_true41, %bb37
+ %tmp109.1 = phi i8* [ undef, %bb37 ], [ %tmp109.1, %bb75 ], [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <i8*> [#uses=1]
+ %i.5.3 = phi i8* [ undef, %bb37 ], [ %i.5.3, %bb75 ], [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <i8*> [#uses=3]
+ %tmp100.3 = phi i8* [ undef, %bb37 ], [ %tmp100.3, %bb75 ], [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <i8*> [#uses=3]
+ %min.1 = phi i8* [ %tmp118, %bb104 ], [ %tmp118, %bb75 ], [ %base, %bb37 ], [ %base, %bb46 ], [ %base, %cond_true41 ], [ %tmp118, %cond_true82 ] ; <i8*> [#uses=2]
+ %j.5 = phi i8* [ %tmp100.1, %bb104 ], [ %j.5, %bb75 ], [ %tmp52, %bb46 ], [ %j.1.1, %bb37 ], [ %j.1.1, %cond_true41 ], [ %j.5, %cond_true82 ] ; <i8*> [#uses=2]
+ %i.4 = phi i8* [ %i.5.1, %bb104 ], [ %i.4, %bb75 ], [ %tmp56, %bb46 ], [ undef, %bb37 ], [ %base, %cond_true41 ], [ %i.4, %cond_true82 ] ; <i8*> [#uses=2]
+ %c.4 = phi i8 [ %tmp88, %bb104 ], [ %c.4, %bb75 ], [ %tmp.upgrd.3, %bb46 ], [ undef, %bb37 ], [ undef, %cond_true41 ], [ %c.4, %cond_true82 ] ; <i8> [#uses=2]
+ %tmp116 = load i32* @qsz ; <i32> [#uses=2]
+ %tmp118 = getelementptr i8* %min.1, i32 %tmp116 ; <i8*> [#uses=9]
+ %tmp122 = icmp ult i8* %tmp118, %tmp9 ; <i1> [#uses=1]
+ br i1 %tmp122, label %bb66, label %return
+
+return: ; preds = %bb115, %entry
+ ret i32 undef
+}
+
+declare i32 @qste(i8*, i8*)
+
+declare i32 @comparee(%struct.edgeBox*, %struct.edgeBox*)
diff --git a/test/Transforms/InstCombine/2006-12-15-Range-Test.ll b/test/Transforms/InstCombine/2006-12-15-Range-Test.ll
new file mode 100644
index 000000000000..67bc84c4045c
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-15-Range-Test.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep icmp | count 1
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {icmp ugt} | count 1
+; END.
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+@r = external global [17 x i32] ; <[17 x i32]*> [#uses=1]
+
+define i1 @print_pgm_cond_true(i32 %tmp12.reload, i32* %tmp16.out) {
+newFuncRoot:
+ br label %cond_true
+
+bb27.exitStub: ; preds = %cond_true
+ store i32 %tmp16, i32* %tmp16.out
+ ret i1 true
+
+cond_next23.exitStub: ; preds = %cond_true
+ store i32 %tmp16, i32* %tmp16.out
+ ret i1 false
+
+cond_true: ; preds = %newFuncRoot
+ %tmp15 = getelementptr [17 x i32]* @r, i32 0, i32 %tmp12.reload ; <i32*> [#uses=1]
+ %tmp16 = load i32* %tmp15 ; <i32> [#uses=4]
+ %tmp18 = icmp slt i32 %tmp16, -31 ; <i1> [#uses=1]
+ %tmp21 = icmp sgt i32 %tmp16, 31 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp18, %tmp21 ; <i1> [#uses=1]
+ br i1 %bothcond, label %bb27.exitStub, label %cond_next23.exitStub
+}
+
diff --git a/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll b/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll
new file mode 100644
index 000000000000..695aea46ee2c
--- /dev/null
+++ b/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll
@@ -0,0 +1,30 @@
+; For PR1065. This causes an assertion in instcombine if a select with two cmp
+; operands is encountered.
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.internal_state = type { i32 }
+ %struct.mng_data = type { i32, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i8, i32, i32, i32, i32, i16, i16, i16, i8, i8, double, double, double, i8, i8, i8, i8, i32, i32, i32, i32, i32, i8, i32, i32, i8*, i8* (i32)*, void (i8*, i32)*, void (i8*, i8*, i32)*, i8 (%struct.mng_data*)*, i8 (%struct.mng_data*)*, i8 (%struct.mng_data*, i8*, i32, i32*)*, i8 (%struct.mng_data*, i8*, i32, i32*)*, i8 (%struct.mng_data*, i32, i8, i32, i32, i32, i32, i8*)*, i8 (%struct.mng_data*, i32, i32, i8*)*, i8 (%struct.mng_data*, i32, i32)*, i8 (%struct.mng_data*, i8, i8*, i8*, i8*, i8*)*, i8 (%struct.mng_data*)*, i8 (%struct.mng_data*, i8*)*, i8 (%struct.mng_data*, i8*)*, i8 (%struct.mng_data*, i32, i32)*, i8 (%struct.mng_data*, i32, i32, i8*)*, i8 (%struct.mng_data*, i8, i8, i32, i32)*, i8* (%struct.mng_data*, i32)*, i8* (%struct.mng_data*, i32)*, i8* (%struct.mng_data*, i32)*, i8 (%struct.mng_data*, i32, i32, i32, i32)*, i32 (%struct.mng_data*)*, i8 (%struct.mng_data*, i32)*, i8 (%struct.mng_data*, i32)*, i8 (%struct.mng_data*, i32, i32, i32, i32, i32, i32, i32, i32)*, i8 (%struct.mng_data*, i8)*, i8 (%struct.mng_data*, i32, i8*)*, i8 (%struct.mng_data*, i32, i8, i8*)*, i8, i32, i32, i8*, i8*, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, i8, i8, i8, i8, i32, i8, i8, i8, i32, i8*, i32, i8*, i32, i8, i8, i8, i32, i8*, i8*, i32, i32, i8*, i8*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, %struct.mng_pushdata*, i8, i8, i32, i32, i8*, i8, i8, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i8*, i32, i32, i32, i8, i8, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i8*, i8*, i8*, i32, i8*, i8*, i8*, i8*, i8*, %struct.mng_savedata*, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, [256 x i8], double, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, i16, i8, i8, i8, i8, i8, i32, i32, i8, i32, i32, i32, i32, i16, i16, i16, i8, i16, i8, i32, i32, i32, i32, i8, i32, i32, i8, i32, i32, i32, i32, i8, i32, i32, i8, i32, i32, i32, i32, i32, i8, i32, i8, i16, i16, i16, i16, i32, [256 x %struct.mng_palette8e], i32, [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i8*, i16, i16, i16, i8*, i8, i8, i32, i32, i32, i32, i8, void ()*, void ()*, void ()*, void ()*, void ()*, void ()*, i8*, i8, i8, i8, i32, i8*, i8*, i16, i16, i16, i16, i32, i32, i8*, %struct.z_stream, i32, i32, i32, i32, i32, i32, i8, i8, [256 x i32], i8 }
+ %struct.mng_palette8e = type { i8, i8, i8 }
+ %struct.mng_pushdata = type { i8*, i8*, i32, i8, i8*, i32 }
+ %struct.mng_savedata = type { i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i8, i16, i8, i8, i32, i32, i8, i32, i32, i32, i32, i32, [256 x %struct.mng_palette8e], i32, [256 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i8*, i16, i16, i16 }
+ %struct.z_stream = type { i8*, i32, i32, i8*, i32, i32, i8*, %struct.internal_state*, i8* (i8*, i32, i32)*, void (i8*, i8*)*, i8*, i32, i32, i32 }
+
+define void @mng_write_basi() {
+entry:
+ %tmp = load i8* null ; <i8> [#uses=1]
+ %tmp.upgrd.1 = icmp ugt i8 %tmp, 8 ; <i1> [#uses=1]
+ %tmp.upgrd.2 = load i16* null ; <i16> [#uses=2]
+ %tmp3 = icmp eq i16 %tmp.upgrd.2, 255 ; <i1> [#uses=1]
+ %tmp7 = icmp eq i16 %tmp.upgrd.2, -1 ; <i1> [#uses=1]
+ %bOpaque.0.in = select i1 %tmp.upgrd.1, i1 %tmp7, i1 %tmp3 ; <i1> [#uses=1]
+ br i1 %bOpaque.0.in, label %cond_next90, label %bb95
+
+cond_next90: ; preds = %entry
+ ret void
+
+bb95: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll b/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll
new file mode 100644
index 000000000000..edbcfeed923a
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp ugt}
+; PR1107
+; PR1940
+
+define i1 @test(i8 %A, i8 %B) {
+ %a = zext i8 %A to i32
+ %b = zext i8 %B to i32
+ %c = icmp sgt i32 %a, %b
+ ret i1 %c
+}
diff --git a/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll b/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll
new file mode 100644
index 000000000000..073d3a154128
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {fcmp uno.*0.0}
+; PR1111
+define i1 @test(double %X) {
+ %tmp = fcmp une double %X, %X
+ ret i1 %tmp
+}
diff --git a/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll b/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll
new file mode 100644
index 000000000000..83d05d9d94f7
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define <4 x i32> @test(<4 x i32> %A) {
+ %B = xor <4 x i32> %A, < i32 -1, i32 -1, i32 -1, i32 -1 >
+ %C = and <4 x i32> %B, < i32 -1, i32 -1, i32 -1, i32 -1 >
+ ret <4 x i32> %C
+}
diff --git a/test/Transforms/InstCombine/2007-01-27-AndICmp.ll b/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
new file mode 100644
index 000000000000..0e8c5b17666e
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ugt.*, 1}
+
+define i1 @test(i32 %tmp1030) {
+ %tmp1037 = icmp ne i32 %tmp1030, 40 ; <i1> [#uses=1]
+ %tmp1039 = icmp ne i32 %tmp1030, 41 ; <i1> [#uses=1]
+ %tmp1042 = and i1 %tmp1037, %tmp1039 ; <i1> [#uses=1]
+ ret i1 %tmp1042
+}
diff --git a/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll b/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll
new file mode 100644
index 000000000000..e559cdd914a9
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | grep {%A = alloca}
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \
+; RUN: not grep {%B = alloca}
+; END.
+
+; Ensure that instcombine doesn't sink the loads in entry/cond_true into
+; cond_next. Doing so prevents mem2reg from promoting the B alloca.
+
+define i32 @test2(i32 %C) {
+entry:
+ %A = alloca i32
+ %B = alloca i32
+ %tmp = call i32 (...)* @bar( i32* %A ) ; <i32> [#uses=0]
+ %T = load i32* %A ; <i32> [#uses=1]
+ %tmp2 = icmp eq i32 %C, 0 ; <i1> [#uses=1]
+ br i1 %tmp2, label %cond_next, label %cond_true
+
+cond_true: ; preds = %entry
+ store i32 123, i32* %B
+ call i32 @test2( i32 123 ) ; <i32>:0 [#uses=0]
+ %T1 = load i32* %B ; <i32> [#uses=1]
+ br label %cond_next
+
+cond_next: ; preds = %cond_true, %entry
+ %tmp1.0 = phi i32 [ %T1, %cond_true ], [ %T, %entry ] ; <i32> [#uses=1]
+ %tmp7 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp8 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp9 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp10 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp11 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp12 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp13 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp14 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp15 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp16 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp17 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp18 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp19 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ %tmp20 = call i32 (...)* @baq( ) ; <i32> [#uses=0]
+ ret i32 %tmp1.0
+}
+
+declare i32 @bar(...)
+
+declare i32 @baq(...)
diff --git a/test/Transforms/InstCombine/2007-02-07-PointerCast.ll b/test/Transforms/InstCombine/2007-02-07-PointerCast.ll
new file mode 100644
index 000000000000..ce9eb3c69d4b
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-02-07-PointerCast.ll
@@ -0,0 +1,22 @@
+;RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zext
+
+; Make sure the uint isn't removed. Instcombine in llvm 1.9 was dropping the
+; uint cast which was causing a sign extend. This only affected code with
+; pointers in the high half of memory, so it wasn't noticed much
+; compile a kernel though...
+
+target datalayout = "e-p:32:32"
+@str = internal constant [6 x i8] c"%llx\0A\00" ; <[6 x i8]*> [#uses=1]
+
+declare i32 @printf(i8*, ...)
+
+define i32 @main(i32 %x, i8** %a) {
+entry:
+ %tmp = getelementptr [6 x i8]* @str, i32 0, i64 0 ; <i8*> [#uses=1]
+ %tmp1 = load i8** %a ; <i8*> [#uses=1]
+ %tmp2 = ptrtoint i8* %tmp1 to i32 ; <i32> [#uses=1]
+ %tmp3 = zext i32 %tmp2 to i64 ; <i64> [#uses=1]
+ %tmp.upgrd.1 = call i32 (i8*, ...)* @printf( i8* %tmp, i64 %tmp3 ) ; <i32> [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll b/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll
new file mode 100644
index 000000000000..d60da44b7f19
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret
+; PR1217
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.termbox = type { %struct.termbox*, i32, i32, i32, i32, i32 }
+
+
+define void @ggenorien() {
+entry:
+ %tmp68 = icmp eq %struct.termbox* null, null ; <i1> [#uses=1]
+ br i1 %tmp68, label %cond_next448, label %bb80
+
+bb80: ; preds = %entry
+ ret void
+
+cond_next448: ; preds = %entry
+ br i1 false, label %bb756, label %bb595
+
+bb595: ; preds = %cond_next448
+ br label %bb609
+
+bb609: ; preds = %bb756, %bb595
+ %termnum.6240.0 = phi i32 [ 2, %bb595 ], [ %termnum.6, %bb756 ] ; <i32> [#uses=1]
+ %tmp755 = add i32 %termnum.6240.0, 1 ; <i32> [#uses=1]
+ br label %bb756
+
+bb756: ; preds = %bb609, %cond_next448
+ %termnum.6 = phi i32 [ %tmp755, %bb609 ], [ 2, %cond_next448 ] ; <i32> [#uses=1]
+ br label %bb609
+}
diff --git a/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll b/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll
new file mode 100644
index 000000000000..d101050e9307
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp sle}
+; PR1244
+
+define i1 @test(i32 %c.3.i, i32 %d.292.2.i) {
+ %tmp266.i = icmp slt i32 %c.3.i, %d.292.2.i
+ %tmp276.i = icmp eq i32 %c.3.i, %d.292.2.i
+ %sel_tmp80 = or i1 %tmp266.i, %tmp276.i
+ ret i1 %sel_tmp80
+}
diff --git a/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll b/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll
new file mode 100644
index 000000000000..da58dec1dcaa
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep zext
+; PR1261.
+
+define i16 @test(i31 %zzz) {
+ %A = sext i31 %zzz to i32
+ %B = add i32 %A, 16384
+ %C = lshr i32 %B, 15
+ %D = trunc i32 %C to i16
+ ret i16 %D
+}
diff --git a/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll b/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll
new file mode 100644
index 000000000000..c8dafd166299
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll
@@ -0,0 +1,7 @@
+; For PR1248
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep {ugt i32 .*, 11}
+define i1 @test(i32 %tmp6) {
+ %tmp7 = sdiv i32 %tmp6, 12 ; <i32> [#uses=1]
+ icmp ne i32 %tmp7, -6 ; <i1>:1 [#uses=1]
+ ret i1 %1
+}
diff --git a/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll b/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
new file mode 100644
index 000000000000..0b05f7c64320
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
@@ -0,0 +1,29 @@
+; PR1271
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {icmp eq i32 .tmp.*, 2146435072}
+%struct..0anon = type { i32, i32 }
+%struct..1anon = type { double }
+
+define i32 @main() {
+entry:
+ %u = alloca %struct..1anon, align 8 ; <%struct..1anon*> [#uses=4]
+ %tmp1 = getelementptr %struct..1anon* %u, i32 0, i32 0 ; <double*> [#uses=1]
+ store double 0x7FF0000000000000, double* %tmp1
+ %tmp3 = getelementptr %struct..1anon* %u, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp34 = bitcast double* %tmp3 to %struct..0anon* ; <%struct..0anon*> [#uses=1]
+ %tmp5 = getelementptr %struct..0anon* %tmp34, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp6 = load i32* %tmp5 ; <i32> [#uses=1]
+ %tmp7 = shl i32 %tmp6, 1 ; <i32> [#uses=1]
+ %tmp8 = lshr i32 %tmp7, 21 ; <i32> [#uses=1]
+ %tmp89 = trunc i32 %tmp8 to i16 ; <i16> [#uses=1]
+ icmp ne i16 %tmp89, 2047 ; <i1>:0 [#uses=1]
+ zext i1 %0 to i8 ; <i8>:1 [#uses=1]
+ icmp ne i8 %1, 0 ; <i1>:2 [#uses=1]
+ br i1 %2, label %cond_true, label %cond_false
+
+cond_true: ; preds = %entry
+ ret i32 0
+
+cond_false: ; preds = %entry
+ ret i32 1
+}
diff --git a/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll b/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll
new file mode 100644
index 000000000000..d67e1a13cc4e
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll
@@ -0,0 +1,9 @@
+; PR1271
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and
+define i1 @test(i32 %tmp13) {
+entry:
+ %tmp14 = shl i32 %tmp13, 12 ; <i32> [#uses=1]
+ %tmp15 = lshr i32 %tmp14, 12 ; <i32> [#uses=1]
+ %res = icmp ne i32 %tmp15, 0 ; <i1>:3 [#uses=1]
+ ret i1 %res
+}
diff --git a/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll b/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll
new file mode 100644
index 000000000000..4a2e60e7c35c
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll
@@ -0,0 +1,36 @@
+; PR1271
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {ashr i32 %.mp137, 2}
+; END.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+
+
+define i1 @test(i32* %tmp141, i32* %tmp145,
+ i32 %b8, i32 %iftmp.430.0, i32* %tmp134.out, i32* %tmp137.out)
+{
+newFuncRoot:
+ %tmp133 = and i32 %b8, 1 ; <i32> [#uses=1]
+ %tmp134 = shl i32 %tmp133, 3 ; <i32> [#uses=3]
+ %tmp136 = ashr i32 %b8, 1 ; <i32> [#uses=1]
+ %tmp137 = shl i32 %tmp136, 3 ; <i32> [#uses=3]
+ %tmp139 = ashr i32 %tmp134, 2 ; <i32> [#uses=1]
+ store i32 %tmp139, i32* %tmp141
+ %tmp143 = ashr i32 %tmp137, 2 ; <i32> [#uses=1]
+ store i32 %tmp143, i32* %tmp145
+ icmp eq i32 %iftmp.430.0, 0 ; <i1>:0 [#uses=1]
+ zext i1 %0 to i8 ; <i8>:1 [#uses=1]
+ icmp ne i8 %1, 0 ; <i1>:2 [#uses=1]
+ br i1 %2, label %cond_true147.exitStub, label %cond_false252.exitStub
+
+cond_true147.exitStub: ; preds = %newFuncRoot
+ store i32 %tmp134, i32* %tmp134.out
+ store i32 %tmp137, i32* %tmp137.out
+ ret i1 true
+
+cond_false252.exitStub: ; preds = %newFuncRoot
+ store i32 %tmp134, i32* %tmp134.out
+ store i32 %tmp137, i32* %tmp137.out
+ ret i1 false
+}
diff --git a/test/Transforms/InstCombine/2007-03-27-PR1280.ll b/test/Transforms/InstCombine/2007-03-27-PR1280.ll
new file mode 100644
index 000000000000..6cb9aaec0987
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-27-PR1280.ll
@@ -0,0 +1,15 @@
+; PR1280 - we should be able to reduce this function to a trunc/sext but it
+; would involve using a bit width (24) that doesn't match a size that
+; the back end can handle. This test makes sure that such a transform
+; is not done. It should be removed when code gen supports "funny"
+; bit widths.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i49.*-8388608}
+
+define i49 @test5(i49 %x) {
+ ;; If we have ADD(XOR(AND(X, 0xFF), 0x80), 0xF..F80), it's a sext.
+ %X = and i49 %x, 16777215 ; 0x0000000ffffff
+ %tmp.2 = xor i49 %X, 8388608 ; 0x0000000800000
+ %tmp.4 = add i49 %tmp.2, -8388608 ; 0x1FFFFFF800000
+ ret i49 %tmp.4
+}
diff --git a/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll b/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll
new file mode 100644
index 000000000000..640f6d57504b
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll
@@ -0,0 +1,302 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; END.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+ %struct.ZZIP_FILE = type { %struct.zzip_dir*, i32, i32, i32, i32, i32, i32, i64, i8*, i64, %struct.z_stream, %struct.zzip_plugin_io* }
+ %struct.anon = type { %struct.ZZIP_FILE*, i8* }
+ %struct.internal_state = type { i32 }
+ %struct.z_stream = type { i8*, i32, i32, i8*, i32, i32, i8*, %struct.internal_state*, i8* (i8*, i32, i32)*, void (i8*, i8*)*, i8*, i32, i32, i32 }
+ %struct.zzip_dir = type { i32, i32, i32, %struct.anon, %struct.zzip_dir_hdr*, %struct.zzip_dir_hdr*, %struct.ZZIP_FILE*, %struct.zzip_dirent, i8*, i8*, i8**, %struct.zzip_plugin_io* }
+ %struct.zzip_dir_hdr = type { i32, i32, i32, i32, i16, i16, i8, i16, [1 x i8] }
+ %struct.zzip_dirent = type { i32, i32, i32, i16, i8*, i32, i32 }
+ %struct.zzip_plugin_io = type { i32 (i8*, i32, ...)*, i32 (i32)*, i32 (i32, i8*, i32)*, i64 (i32, i64, i32)*, i64 (i32)*, i32 }
+
+define %struct.ZZIP_FILE* @zzip_open_shared_io(%struct.ZZIP_FILE* %stream, i8* %filename, i32 %o_flags, i32 %o_modes, i8** %ext, %struct.zzip_plugin_io* %io) {
+entry:
+ %basename = alloca [1024 x i8], align 16 ; <[1024 x i8]*> [#uses=5]
+ %e = alloca i32, align 4 ; <i32*> [#uses=4]
+ icmp eq %struct.ZZIP_FILE* %stream, null ; <i1>:0 [#uses=1]
+ br i1 %0, label %cond_next22, label %cond_true
+
+cond_true: ; preds = %entry
+ %tmp3 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp4 = load %struct.zzip_dir** %tmp3 ; <%struct.zzip_dir*> [#uses=1]
+ icmp eq %struct.zzip_dir* %tmp4, null ; <i1>:1 [#uses=1]
+ br i1 %1, label %cond_next22, label %cond_true5
+
+cond_true5: ; preds = %cond_true
+ icmp eq i8** %ext, null ; <i1>:2 [#uses=1]
+ br i1 %2, label %cond_true7, label %cond_next
+
+cond_true7: ; preds = %cond_true5
+ %tmp9 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp10 = load %struct.zzip_dir** %tmp9 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp11 = getelementptr %struct.zzip_dir* %tmp10, i32 0, i32 10 ; <i8***> [#uses=1]
+ %tmp12 = load i8*** %tmp11 ; <i8**> [#uses=1]
+ br label %cond_next
+
+cond_next: ; preds = %cond_true7, %cond_true5
+ %ext_addr.0 = phi i8** [ %ext, %cond_true5 ], [ %tmp12, %cond_true7 ] ; <i8**> [#uses=2]
+ icmp eq %struct.zzip_plugin_io* %io, null ; <i1>:3 [#uses=1]
+ br i1 %3, label %cond_true14, label %cond_next22
+
+cond_true14: ; preds = %cond_next
+ %tmp16 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp17 = load %struct.zzip_dir** %tmp16 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp18 = getelementptr %struct.zzip_dir* %tmp17, i32 0, i32 11 ; <%struct.zzip_plugin_io**> [#uses=1]
+ %tmp19 = load %struct.zzip_plugin_io** %tmp18 ; <%struct.zzip_plugin_io*> [#uses=1]
+ br label %cond_next22
+
+cond_next22: ; preds = %cond_true14, %cond_next, %cond_true, %entry
+ %io_addr.0 = phi %struct.zzip_plugin_io* [ %io, %entry ], [ %io, %cond_true ], [ %io, %cond_next ], [ %tmp19, %cond_true14 ] ; <%struct.zzip_plugin_io*> [#uses=2]
+ %ext_addr.1 = phi i8** [ %ext, %entry ], [ %ext, %cond_true ], [ %ext_addr.0, %cond_next ], [ %ext_addr.0, %cond_true14 ] ; <i8**> [#uses=2]
+ icmp eq %struct.zzip_plugin_io* %io_addr.0, null ; <i1>:4 [#uses=1]
+ br i1 %4, label %cond_true24, label %cond_next26
+
+cond_true24: ; preds = %cond_next22
+ %tmp25 = call %struct.zzip_plugin_io* @zzip_get_default_io( ) ; <%struct.zzip_plugin_io*> [#uses=1]
+ br label %cond_next26
+
+cond_next26: ; preds = %cond_true24, %cond_next22
+ %io_addr.1 = phi %struct.zzip_plugin_io* [ %io_addr.0, %cond_next22 ], [ %tmp25, %cond_true24 ] ; <%struct.zzip_plugin_io*> [#uses=4]
+ %tmp28 = and i32 %o_modes, 81920 ; <i32> [#uses=1]
+ icmp eq i32 %tmp28, 0 ; <i1>:5 [#uses=1]
+ br i1 %5, label %try_real, label %try_zzip
+
+try_real: ; preds = %bb223, %cond_next26
+ %fd160.2 = phi i32 [ undef, %cond_next26 ], [ %fd160.0, %bb223 ] ; <i32> [#uses=1]
+ %len.2 = phi i32 [ undef, %cond_next26 ], [ %len.0, %bb223 ] ; <i32> [#uses=1]
+ %o_flags_addr.1 = phi i32 [ %o_flags, %cond_next26 ], [ %o_flags_addr.0, %bb223 ] ; <i32> [#uses=2]
+ %tmp33348 = and i32 %o_modes, 262144 ; <i32> [#uses=1]
+ icmp eq i32 %tmp33348, 0 ; <i1>:6 [#uses=1]
+ br i1 %6, label %cond_next38, label %cond_true35
+
+cond_true35: ; preds = %try_real
+ %tmp36 = call %struct.zzip_plugin_io* @zzip_get_default_io( ) ; <%struct.zzip_plugin_io*> [#uses=1]
+ br label %cond_next38
+
+cond_next38: ; preds = %cond_true35, %try_real
+ %iftmp.21.0 = phi %struct.zzip_plugin_io* [ %tmp36, %cond_true35 ], [ %io_addr.1, %try_real ] ; <%struct.zzip_plugin_io*> [#uses=3]
+ %tmp41 = getelementptr %struct.zzip_plugin_io* %iftmp.21.0, i32 0, i32 0 ; <i32 (i8*, i32, ...)**> [#uses=1]
+ %tmp42 = load i32 (i8*, i32, ...)** %tmp41 ; <i32 (i8*, i32, ...)*> [#uses=1]
+ %tmp45 = call i32 (i8*, i32, ...)* %tmp42( i8* %filename, i32 %o_flags_addr.1 ) ; <i32> [#uses=3]
+ icmp eq i32 %tmp45, -1 ; <i1>:7 [#uses=1]
+ br i1 %7, label %cond_next67, label %cond_true47
+
+cond_true47: ; preds = %cond_next38
+ %tmp48 = call i8* @cli_calloc( i32 1, i32 108 ) ; <i8*> [#uses=2]
+ %tmp4849 = bitcast i8* %tmp48 to %struct.ZZIP_FILE* ; <%struct.ZZIP_FILE*> [#uses=3]
+ icmp eq i8* %tmp48, null ; <i1>:8 [#uses=1]
+ br i1 %8, label %cond_true51, label %cond_next58
+
+cond_true51: ; preds = %cond_true47
+ %tmp53 = getelementptr %struct.zzip_plugin_io* %iftmp.21.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1]
+ %tmp54 = load i32 (i32)** %tmp53 ; <i32 (i32)*> [#uses=1]
+ %tmp56 = call i32 %tmp54( i32 %tmp45 ) ; <i32> [#uses=0]
+ ret %struct.ZZIP_FILE* null
+
+cond_next58: ; preds = %cond_true47
+ %tmp60 = getelementptr %struct.ZZIP_FILE* %tmp4849, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %tmp45, i32* %tmp60
+ %tmp63 = getelementptr %struct.ZZIP_FILE* %tmp4849, i32 0, i32 11 ; <%struct.zzip_plugin_io**> [#uses=1]
+ store %struct.zzip_plugin_io* %iftmp.21.0, %struct.zzip_plugin_io** %tmp63
+ ret %struct.ZZIP_FILE* %tmp4849
+
+cond_next67: ; preds = %cond_next38
+ %tmp70716 = and i32 %o_modes, 16384 ; <i32> [#uses=1]
+ icmp eq i32 %tmp70716, 0 ; <i1>:9 [#uses=1]
+ br i1 %9, label %try_zzip, label %return
+
+try_zzip: ; preds = %cond_next67, %cond_next26
+ %fd160.3 = phi i32 [ %fd160.2, %cond_next67 ], [ undef, %cond_next26 ] ; <i32> [#uses=6]
+ %len.3 = phi i32 [ %len.2, %cond_next67 ], [ undef, %cond_next26 ] ; <i32> [#uses=3]
+ %o_flags_addr.3 = phi i32 [ %o_flags_addr.1, %cond_next67 ], [ %o_flags, %cond_next26 ] ; <i32> [#uses=4]
+ %tmp76 = and i32 %o_flags_addr.3, 513 ; <i32> [#uses=1]
+ icmp eq i32 %tmp76, 0 ; <i1>:10 [#uses=1]
+ br i1 %10, label %cond_next80, label %cond_true77
+
+cond_true77: ; preds = %try_zzip
+ %tmp78 = call i32* @__error( ) ; <i32*> [#uses=1]
+ store i32 22, i32* %tmp78
+ ret %struct.ZZIP_FILE* null
+
+cond_next80: ; preds = %try_zzip
+ %tmp83844 = and i32 %o_flags_addr.3, 2 ; <i32> [#uses=1]
+ icmp eq i32 %tmp83844, 0 ; <i1>:11 [#uses=1]
+ %tmp87 = xor i32 %o_flags_addr.3, 2 ; <i32> [#uses=1]
+ %o_flags_addr.0 = select i1 %11, i32 %o_flags_addr.3, i32 %tmp87 ; <i32> [#uses=2]
+ %basename90 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp92 = call i8* @strcpy( i8* %basename90, i8* %filename ) ; <i8*> [#uses=0]
+ icmp eq %struct.ZZIP_FILE* %stream, null ; <i1>:12 [#uses=1]
+ br i1 %12, label %bb219, label %cond_true94
+
+cond_true94: ; preds = %cond_next80
+ %tmp96 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp97 = load %struct.zzip_dir** %tmp96 ; <%struct.zzip_dir*> [#uses=1]
+ icmp eq %struct.zzip_dir* %tmp97, null ; <i1>:13 [#uses=1]
+ br i1 %13, label %bb219, label %cond_true98
+
+cond_true98: ; preds = %cond_true94
+ %tmp100 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp101 = load %struct.zzip_dir** %tmp100 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp102 = getelementptr %struct.zzip_dir* %tmp101, i32 0, i32 9 ; <i8**> [#uses=1]
+ %tmp103 = load i8** %tmp102 ; <i8*> [#uses=1]
+ icmp eq i8* %tmp103, null ; <i1>:14 [#uses=1]
+ br i1 %14, label %bb219, label %cond_true104
+
+cond_true104: ; preds = %cond_true98
+ %tmp106 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp107 = load %struct.zzip_dir** %tmp106 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp108 = getelementptr %struct.zzip_dir* %tmp107, i32 0, i32 9 ; <i8**> [#uses=1]
+ %tmp109 = load i8** %tmp108 ; <i8*> [#uses=1]
+ %tmp110 = call i32 @strlen( i8* %tmp109 ) ; <i32> [#uses=7]
+ %tmp112 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp113 = load %struct.zzip_dir** %tmp112 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp114 = getelementptr %struct.zzip_dir* %tmp113, i32 0, i32 9 ; <i8**> [#uses=1]
+ %tmp115 = load i8** %tmp114 ; <i8*> [#uses=1]
+ %tmp118 = call i32 @memcmp( i8* %filename, i8* %tmp115, i32 %tmp110 ) ; <i32> [#uses=1]
+ icmp eq i32 %tmp118, 0 ; <i1>:15 [#uses=1]
+ br i1 %15, label %cond_true119, label %bb219
+
+cond_true119: ; preds = %cond_true104
+ %tmp122 = getelementptr i8* %filename, i32 %tmp110 ; <i8*> [#uses=1]
+ %tmp123 = load i8* %tmp122 ; <i8> [#uses=1]
+ icmp eq i8 %tmp123, 47 ; <i1>:16 [#uses=1]
+ br i1 %16, label %cond_true124, label %bb219
+
+cond_true124: ; preds = %cond_true119
+ %tmp126 = add i32 %tmp110, 1 ; <i32> [#uses=1]
+ %tmp128 = getelementptr i8* %filename, i32 %tmp126 ; <i8*> [#uses=1]
+ %tmp129 = load i8* %tmp128 ; <i8> [#uses=1]
+ icmp eq i8 %tmp129, 0 ; <i1>:17 [#uses=1]
+ br i1 %17, label %bb219, label %cond_true130
+
+cond_true130: ; preds = %cond_true124
+ %tmp134.sum = add i32 %tmp110, 1 ; <i32> [#uses=1]
+ %tmp135 = getelementptr i8* %filename, i32 %tmp134.sum ; <i8*> [#uses=1]
+ %tmp137 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp138 = load %struct.zzip_dir** %tmp137 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp140 = call %struct.ZZIP_FILE* @zzip_file_open( %struct.zzip_dir* %tmp138, i8* %tmp135, i32 %o_modes, i32 -1 ) ; <%struct.ZZIP_FILE*> [#uses=3]
+ icmp eq %struct.ZZIP_FILE* %tmp140, null ; <i1>:18 [#uses=1]
+ br i1 %18, label %cond_true142, label %return
+
+cond_true142: ; preds = %cond_true130
+ %tmp144 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1]
+ %tmp145 = load %struct.zzip_dir** %tmp144 ; <%struct.zzip_dir*> [#uses=1]
+ %tmp146 = getelementptr %struct.zzip_dir* %tmp145, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp147 = load i32* %tmp146 ; <i32> [#uses=1]
+ %tmp148 = call i32 @zzip_errno( i32 %tmp147 ) ; <i32> [#uses=1]
+ %tmp149 = call i32* @__error( ) ; <i32*> [#uses=1]
+ store i32 %tmp148, i32* %tmp149
+ ret %struct.ZZIP_FILE* %tmp140
+
+bb: ; preds = %bb219
+ store i32 0, i32* %e
+ store i8 0, i8* %tmp221
+ %basename162 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp166 = call i32 @__zzip_try_open( i8* %basename162, i32 %o_flags_addr.0, i8** %ext_addr.1, %struct.zzip_plugin_io* %io_addr.1 ) ; <i32> [#uses=4]
+ icmp eq i32 %tmp166, -1 ; <i1>:19 [#uses=1]
+ br i1 %19, label %bb219, label %cond_next169
+
+cond_next169: ; preds = %bb
+ %tmp173 = call %struct.zzip_dir* @zzip_dir_fdopen_ext_io( i32 %tmp166, i32* %e, i8** %ext_addr.1, %struct.zzip_plugin_io* %io_addr.1 ) ; <%struct.zzip_dir*> [#uses=7]
+ %tmp174 = load i32* %e ; <i32> [#uses=1]
+ icmp eq i32 %tmp174, 0 ; <i1>:20 [#uses=1]
+ br i1 %20, label %cond_next185, label %cond_true175
+
+cond_true175: ; preds = %cond_next169
+ %tmp176 = load i32* %e ; <i32> [#uses=1]
+ %tmp177 = call i32 @zzip_errno( i32 %tmp176 ) ; <i32> [#uses=1]
+ %tmp178 = call i32* @__error( ) ; <i32*> [#uses=1]
+ store i32 %tmp177, i32* %tmp178
+ %tmp180 = getelementptr %struct.zzip_plugin_io* %io_addr.1, i32 0, i32 1 ; <i32 (i32)**> [#uses=1]
+ %tmp181 = load i32 (i32)** %tmp180 ; <i32 (i32)*> [#uses=1]
+ %tmp183 = call i32 %tmp181( i32 %tmp166 ) ; <i32> [#uses=0]
+ ret %struct.ZZIP_FILE* null
+
+cond_next185: ; preds = %cond_next169
+ %tmp186187 = ptrtoint i8* %tmp221 to i32 ; <i32> [#uses=1]
+ %basename188189 = ptrtoint [1024 x i8]* %basename to i32 ; <i32> [#uses=1]
+ %tmp190 = sub i32 %tmp186187, %basename188189 ; <i32> [#uses=1]
+ %tmp192.sum = add i32 %tmp190, 1 ; <i32> [#uses=1]
+ %tmp193 = getelementptr i8* %filename, i32 %tmp192.sum ; <i8*> [#uses=1]
+ %tmp196 = call %struct.ZZIP_FILE* @zzip_file_open( %struct.zzip_dir* %tmp173, i8* %tmp193, i32 %o_modes, i32 -1 ) ; <%struct.ZZIP_FILE*> [#uses=4]
+ icmp eq %struct.ZZIP_FILE* %tmp196, null ; <i1>:21 [#uses=1]
+ br i1 %21, label %cond_true198, label %cond_false204
+
+cond_true198: ; preds = %cond_next185
+ %tmp200 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp201 = load i32* %tmp200 ; <i32> [#uses=1]
+ %tmp202 = call i32 @zzip_errno( i32 %tmp201 ) ; <i32> [#uses=1]
+ %tmp203 = call i32* @__error( ) ; <i32*> [#uses=1]
+ store i32 %tmp202, i32* %tmp203
+ %tmp2169 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; <i32> [#uses=0]
+ ret %struct.ZZIP_FILE* %tmp196
+
+cond_false204: ; preds = %cond_next185
+ %tmp206 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 9 ; <i8**> [#uses=1]
+ %tmp207 = load i8** %tmp206 ; <i8*> [#uses=1]
+ icmp eq i8* %tmp207, null ; <i1>:22 [#uses=1]
+ br i1 %22, label %cond_true208, label %cond_next214
+
+cond_true208: ; preds = %cond_false204
+ %basename209 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp210 = call i8* @strdup( i8* %basename209 ) ; <i8*> [#uses=1]
+ %tmp212 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 9 ; <i8**> [#uses=1]
+ store i8* %tmp210, i8** %tmp212
+ %tmp21610 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; <i32> [#uses=0]
+ ret %struct.ZZIP_FILE* %tmp196
+
+cond_next214: ; preds = %cond_false204
+ %tmp216 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; <i32> [#uses=0]
+ ret %struct.ZZIP_FILE* %tmp196
+
+bb219: ; preds = %bb, %cond_true124, %cond_true119, %cond_true104, %cond_true98, %cond_true94, %cond_next80
+ %fd160.0 = phi i32 [ %fd160.3, %cond_next80 ], [ %tmp166, %bb ], [ %fd160.3, %cond_true94 ], [ %fd160.3, %cond_true98 ], [ %fd160.3, %cond_true104 ], [ %fd160.3, %cond_true119 ], [ %fd160.3, %cond_true124 ] ; <i32> [#uses=1]
+ %len.0 = phi i32 [ %len.3, %cond_next80 ], [ %len.0, %bb ], [ %len.3, %cond_true94 ], [ %len.3, %cond_true98 ], [ %tmp110, %cond_true104 ], [ %tmp110, %cond_true119 ], [ %tmp110, %cond_true124 ] ; <i32> [#uses=2]
+ %basename220 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp221 = call i8* @strrchr( i8* %basename220, i32 47 ) ; <i8*> [#uses=3]
+ icmp eq i8* %tmp221, null ; <i1>:23 [#uses=1]
+ br i1 %23, label %bb223, label %bb
+
+bb223: ; preds = %bb219
+ %tmp2262272 = and i32 %o_modes, 16384 ; <i32> [#uses=1]
+ icmp eq i32 %tmp2262272, 0 ; <i1>:24 [#uses=1]
+ br i1 %24, label %cond_next229, label %try_real
+
+cond_next229: ; preds = %bb223
+ %tmp230 = call i32* @__error( ) ; <i32*> [#uses=1]
+ store i32 2, i32* %tmp230
+ ret %struct.ZZIP_FILE* null
+
+return: ; preds = %cond_true130, %cond_next67
+ %retval.0 = phi %struct.ZZIP_FILE* [ null, %cond_next67 ], [ %tmp140, %cond_true130 ] ; <%struct.ZZIP_FILE*> [#uses=1]
+ ret %struct.ZZIP_FILE* %retval.0
+}
+
+declare i32 @zzip_dir_close(%struct.zzip_dir*)
+
+declare i8* @strrchr(i8*, i32)
+
+declare %struct.ZZIP_FILE* @zzip_file_open(%struct.zzip_dir*, i8*, i32, i32)
+
+declare i8* @cli_calloc(i32, i32)
+
+declare i32 @zzip_errno(i32)
+
+declare i32* @__error()
+
+declare %struct.zzip_plugin_io* @zzip_get_default_io()
+
+declare i8* @strcpy(i8*, i8*)
+
+declare i32 @strlen(i8*)
+
+declare i32 @memcmp(i8*, i8*, i32)
+
+declare i32 @__zzip_try_open(i8*, i32, i8**, %struct.zzip_plugin_io*)
+
+declare %struct.zzip_dir* @zzip_dir_fdopen_ext_io(i32, i32*, i8**, %struct.zzip_plugin_io*)
+
+declare i8* @strdup(i8*)
diff --git a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll b/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll
new file mode 100644
index 000000000000..e738635be763
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll
@@ -0,0 +1,19 @@
+; In the presence of a negative offset (the -8 below), a fold of a bitcast into
+; a malloc messes up the element count, causing an extra 4GB to be allocated on
+; 64-bit targets.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {= add }
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "x86_64-unknown-freebsd6.2"
+
+define i1 @test(i32 %tmp141, double** %tmp145)
+{
+ %tmp133 = add i32 %tmp141, 1
+ %tmp134 = shl i32 %tmp133, 3
+ %tmp135 = add i32 %tmp134, -8
+ %tmp136 = malloc i8, i32 %tmp135
+ %tmp137 = bitcast i8* %tmp136 to double*
+ store double* %tmp137, double** %tmp145
+ ret i1 false
+}
diff --git a/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll b/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll
new file mode 100644
index 000000000000..34322a2788a2
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1304
+
+define i64 @bork(<1 x i64> %vec) {
+ %tmp = extractelement <1 x i64> %vec, i32 0
+ ret i64 %tmp
+}
diff --git a/test/Transforms/InstCombine/2007-05-04-Crash.ll b/test/Transforms/InstCombine/2007-05-04-Crash.ll
new file mode 100644
index 000000000000..5ad791933574
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-05-04-Crash.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1384
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+ %struct.CFRuntimeBase = type { i32, [4 x i8] }
+ %struct.CGColor = type opaque
+ %struct.CGColorSpace = type { %struct.CFRuntimeBase, i8, i8, i8, i32, i32, i32, %struct.CGColor*, float*, %struct.CGMD5Signature, %struct.CGMD5Signature*, [0 x %struct.CGColorSpaceDescriptor] }
+ %struct.CGColorSpaceCalibratedRGBData = type { [3 x float], [3 x float], [3 x float], [9 x float] }
+ %struct.CGColorSpaceDescriptor = type { %struct.CGColorSpaceCalibratedRGBData }
+ %struct.CGColorSpaceLabData = type { [3 x float], [3 x float], [4 x float] }
+ %struct.CGMD5Signature = type { [16 x i8], i8 }
+
+declare fastcc %struct.CGColorSpace* @CGColorSpaceCreate(i32, i32)
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+define %struct.CGColorSpace* @CGColorSpaceCreateLab(float* %whitePoint, float* %blackPoint, float* %range) {
+entry:
+ %tmp17 = call fastcc %struct.CGColorSpace* @CGColorSpaceCreate( i32 5, i32 3 ) ; <%struct.CGColorSpace*> [#uses=2]
+ %tmp28 = getelementptr %struct.CGColorSpace* %tmp17, i32 0, i32 11 ; <[0 x %struct.CGColorSpaceDescriptor]*> [#uses=1]
+ %tmp29 = getelementptr [0 x %struct.CGColorSpaceDescriptor]* %tmp28, i32 0, i32 0 ; <%struct.CGColorSpaceDescriptor*> [#uses=1]
+ %tmp30 = getelementptr %struct.CGColorSpaceDescriptor* %tmp29, i32 0, i32 0 ; <%struct.CGColorSpaceCalibratedRGBData*> [#uses=1]
+ %tmp3031 = bitcast %struct.CGColorSpaceCalibratedRGBData* %tmp30 to %struct.CGColorSpaceLabData* ; <%struct.CGColorSpaceLabData*> [#uses=1]
+ %tmp45 = getelementptr %struct.CGColorSpaceLabData* %tmp3031, i32 0, i32 2 ; <[4 x float]*> [#uses=1]
+ %tmp46 = getelementptr [4 x float]* %tmp45, i32 0, i32 0 ; <float*> [#uses=1]
+ %tmp4648 = bitcast float* %tmp46 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp4648, i8* null, i32 16, i32 4 )
+ ret %struct.CGColorSpace* %tmp17
+}
diff --git a/test/Transforms/InstCombine/2007-05-10-icmp-or.ll b/test/Transforms/InstCombine/2007-05-10-icmp-or.ll
new file mode 100644
index 000000000000..8769ded67b8e
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-05-10-icmp-or.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+define i1 @test(i32 %tmp9) {
+ %tmp20 = icmp ugt i32 %tmp9, 255 ; <i1> [#uses=1]
+ %tmp11.not = icmp sgt i32 %tmp9, 255 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp20, %tmp11.not ; <i1> [#uses=1]
+ ret i1 %bothcond
+}
+
diff --git a/test/Transforms/InstCombine/2007-05-14-Crash.ll b/test/Transforms/InstCombine/2007-05-14-Crash.ll
new file mode 100644
index 000000000000..ececd350dba9
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-05-14-Crash.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "powerpc-apple-darwin8.8.0"
+
+%struct.abc = type { i32, [32 x i8] }
+%struct.def = type { i8**, %struct.abc }
+ %struct.anon = type <{ }>
+
+define i8* @foo(%struct.anon* %deviceRef, %struct.abc* %pCap) {
+entry:
+ %tmp1 = bitcast %struct.anon* %deviceRef to %struct.def*
+ %tmp3 = getelementptr %struct.def* %tmp1, i32 0, i32 1
+ %tmp35 = bitcast %struct.abc* %tmp3 to i8*
+ ret i8* %tmp35
+}
+
+
diff --git a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll
new file mode 100644
index 000000000000..55bfac581faf
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*sret}
+; Make sure instcombine doesn't drop the sret attribute.
+
+define void @blah(i16* %tmp10) {
+entry:
+ call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* %tmp10 sret )
+ ret void
+}
+
+declare i8* @objc_msgSend_stret(i8*, i8*, ...)
diff --git a/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll b/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll
new file mode 100644
index 000000000000..482c60869600
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ashr}
+; PR1499
+
+define void @av_cmp_q_cond_true(i32* %retval, i32* %tmp9, i64* %tmp10) {
+newFuncRoot:
+ br label %cond_true
+
+return.exitStub: ; preds = %cond_true
+ ret void
+
+cond_true: ; preds = %newFuncRoot
+ %tmp30 = load i64* %tmp10 ; <i64> [#uses=1]
+ %.cast = zext i32 63 to i64 ; <i64> [#uses=1]
+ %tmp31 = ashr i64 %tmp30, %.cast ; <i64> [#uses=1]
+ %tmp3132 = trunc i64 %tmp31 to i32 ; <i32> [#uses=1]
+ %tmp33 = or i32 %tmp3132, 1 ; <i32> [#uses=1]
+ store i32 %tmp33, i32* %tmp9
+ %tmp34 = load i32* %tmp9 ; <i32> [#uses=1]
+ store i32 %tmp34, i32* %retval
+ br label %return.exitStub
+}
+
diff --git a/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll b/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll
new file mode 100644
index 000000000000..ffc402650262
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true}
+; rdar://5278853
+
+define i1 @test(i32 %tmp468) {
+ %tmp470 = udiv i32 %tmp468, 4 ; <i32> [#uses=2]
+ %tmp475 = icmp ult i32 %tmp470, 1073741824 ; <i1> [#uses=1]
+ ret i1 %tmp475
+}
+
diff --git a/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll b/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll
new file mode 100644
index 000000000000..988599ba3f95
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1594
+
+define i64 @test(i16 %tmp510, i16 %tmp512) {
+ %W = sext i16 %tmp510 to i32 ; <i32> [#uses=1]
+ %X = sext i16 %tmp512 to i32 ; <i32> [#uses=1]
+ %Y = add i32 %W, %X ; <i32> [#uses=1]
+ %Z = sext i32 %Y to i64 ; <i64> [#uses=1]
+ ret i64 %Z
+}
diff --git a/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll b/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll
new file mode 100644
index 000000000000..77bae78ccd47
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true}
+; PR1637
+
+define i1 @f(i8* %arr) {
+ %X = getelementptr i8* %arr, i32 1
+ %Y = getelementptr i8* %arr, i32 1
+ %test = icmp uge i8* %X, %Y
+ ret i1 %test
+}
+
diff --git a/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll b/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
new file mode 100644
index 000000000000..2dcb43926ba8
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp
+; PR1646
+
+@__gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel ; <i32 (i32)*> [#uses=1]
+@__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) ; <i8**> [#uses=1]
+declare extern_weak i32 @pthread_cancel(i32)
+
+define i1 @__gthread_active_p() {
+entry:
+ %tmp1 = load i8** @__gthread_active_ptr.5335, align 4 ; <i8*> [#uses=1]
+ %tmp2 = icmp ne i8* %tmp1, null ; <i1> [#uses=1]
+ ret i1 %tmp2
+}
diff --git a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll
new file mode 100644
index 000000000000..c022e571e11f
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call i32 @f}
+
+ %struct.FRAME.nest = type { i32, i32 (i32)* }
+ %struct.__builtin_trampoline = type { [10 x i8] }
+
+declare i8* @llvm.init.trampoline(i8*, i8*, i8*)
+
+declare i32 @f(%struct.FRAME.nest* nest , i32 )
+
+define i32 @nest(i32 %n) {
+entry:
+ %FRAME.0 = alloca %struct.FRAME.nest, align 8 ; <%struct.FRAME.nest*> [#uses=3]
+ %TRAMP.216 = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
+ %TRAMP.216.sub = getelementptr [10 x i8]* %TRAMP.216, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %n, i32* %tmp3, align 8
+ %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1]
+ %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* nest , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
+ %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1]
+ %tmp89 = bitcast i8* %tramp to i32 (i32)* ; <i32 (i32)*> [#uses=2]
+ store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8
+ %tmp2.i = call i32 %tmp89( i32 1 ) ; <i32> [#uses=1]
+ ret i32 %tmp2.i
+}
diff --git a/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll b/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
new file mode 100644
index 000000000000..300edd5e56ee
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp
+; PR1678
+
+@A = alias weak void ()* @B ; <void ()*> [#uses=1]
+
+declare extern_weak void @B()
+
+define i32 @active() {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp1 = icmp ne void ()* @A, null ; <i1> [#uses=1]
+ %tmp12 = zext i1 %tmp1 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp12
+}
diff --git a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll
new file mode 100644
index 000000000000..6d251b12cf4f
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call
+; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | not grep xyz
+
+@.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1]
+
+define void @foo(i8* %P) {
+entry:
+ %P_addr = alloca i8* ; <i8**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i8* %P, i8** %P_addr
+ %tmp = load i8** %P_addr, align 4 ; <i8*> [#uses=1]
+ %tmp1 = getelementptr [4 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp, i8* %tmp1, i32 4, i32 1 )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
diff --git a/test/Transforms/InstCombine/2007-10-12-Crash.ll b/test/Transforms/InstCombine/2007-10-12-Crash.ll
new file mode 100644
index 000000000000..ed98fcdb9cae
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-10-12-Crash.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+ %struct.Ray = type { %struct.Vec, %struct.Vec }
+ %struct.Scene = type { i32 (...)** }
+ %struct.Vec = type { double, double, double }
+
+declare double @_Z9ray_traceRK3VecRK3RayRK5Scene(%struct.Vec*, %struct.Ray*, %struct.Scene*)
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %tmp3 = alloca %struct.Ray, align 4 ; <%struct.Ray*> [#uses=2]
+ %tmp97 = icmp slt i32 0, 512 ; <i1> [#uses=1]
+ br i1 %tmp97, label %bb71, label %bb108
+
+bb29: ; preds = %bb62
+ %tmp322 = bitcast %struct.Ray* %tmp3 to %struct.Vec* ; <%struct.Vec*> [#uses=1]
+ %tmp322.0 = getelementptr %struct.Vec* %tmp322, i32 0, i32 0 ; <double*> [#uses=1]
+ store double 0.000000e+00, double* %tmp322.0
+ %tmp57 = call double @_Z9ray_traceRK3VecRK3RayRK5Scene( %struct.Vec* null, %struct.Ray* %tmp3, %struct.Scene* null ) ; <double> [#uses=0]
+ br label %bb62
+
+bb62: ; preds = %bb71, %bb29
+ %tmp65 = icmp slt i32 0, 4 ; <i1> [#uses=1]
+ br i1 %tmp65, label %bb29, label %bb68
+
+bb68: ; preds = %bb62
+ ret i32 0
+
+bb71: ; preds = %entry
+ %tmp74 = icmp slt i32 0, 4 ; <i1> [#uses=1]
+ br i1 %tmp74, label %bb62, label %bb77
+
+bb77: ; preds = %bb71
+ ret i32 0
+
+bb108: ; preds = %entry
+ ret i32 0
+}
diff --git a/test/Transforms/InstCombine/2007-10-28-EmptyField.ll b/test/Transforms/InstCombine/2007-10-28-EmptyField.ll
new file mode 100644
index 000000000000..31ae985a6dd1
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-10-28-EmptyField.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1749
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.__large_struct = type { [100 x i64] }
+ %struct.compat_siginfo = type { i32, i32, i32, { [29 x i32] } }
+ %struct.siginfo_t = type { i32, i32, i32, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] } }
+ %struct.sigval_t = type { i8* }
+
+define i32 @copy_siginfo_to_user32(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) {
+entry:
+ %from_addr = alloca %struct.siginfo_t* ; <%struct.siginfo_t**> [#uses=1]
+ %tmp344 = load %struct.siginfo_t** %from_addr, align 8 ; <%struct.siginfo_t*> [#uses=1]
+ %tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3 ; <{ { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }*> [#uses=1]
+ %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 ; <{ i32, i32, [0 x i8], %struct.sigval_t, i32 }*> [#uses=1]
+ %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* ; <{ i32, i32, %struct.sigval_t }*> [#uses=1]
+ %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 ; <%struct.sigval_t*> [#uses=1]
+ %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0 ; <i8**> [#uses=1]
+ %tmp349350 = bitcast i8** %tmp349 to i32* ; <i32*> [#uses=1]
+ %tmp351 = load i32* %tmp349350, align 8 ; <i32> [#uses=1]
+ %tmp360 = call i32 asm sideeffect "1:\09movl ${1:k},$2\0A2:\0A.section .fixup,\22ax\22\0A3:\09mov $3,$0\0A\09jmp 2b\0A.previous\0A.section __ex_table,\22a\22\0A\09.align 8\0A\09.quad 1b,3b\0A.previous", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, %struct.__large_struct* null, i32 -14, i32 0 ) ; <i32> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/InstCombine/2007-10-28-stacksave.ll b/test/Transforms/InstCombine/2007-10-28-stacksave.ll
new file mode 100644
index 000000000000..5f884d4a7812
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-10-28-stacksave.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*stacksave}
+; PR1745
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+@p = weak global i8* null ; <i8**> [#uses=1]
+
+define i32 @main() {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ br label %lab
+
+lab: ; preds = %cleanup31, %entry
+ %n.0 = phi i32 [ 0, %entry ], [ %tmp25, %cleanup31 ] ; <i32> [#uses=2]
+ %tmp2 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=2]
+ %tmp4 = srem i32 %n.0, 47 ; <i32> [#uses=1]
+ %tmp5 = add i32 %tmp4, 1 ; <i32> [#uses=5]
+ %tmp7 = sub i32 %tmp5, 1 ; <i32> [#uses=0]
+ %tmp89 = zext i32 %tmp5 to i64 ; <i64> [#uses=1]
+ %tmp10 = mul i64 %tmp89, 32 ; <i64> [#uses=0]
+ %tmp12 = mul i32 %tmp5, 4 ; <i32> [#uses=0]
+ %tmp1314 = zext i32 %tmp5 to i64 ; <i64> [#uses=1]
+ %tmp15 = mul i64 %tmp1314, 32 ; <i64> [#uses=0]
+ %tmp17 = mul i32 %tmp5, 4 ; <i32> [#uses=1]
+ %tmp18 = alloca i8, i32 %tmp17 ; <i8*> [#uses=1]
+ %tmp1819 = bitcast i8* %tmp18 to i32* ; <i32*> [#uses=2]
+ %tmp21 = getelementptr i32* %tmp1819, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp21, align 4
+ %tmp2223 = bitcast i32* %tmp1819 to i8* ; <i8*> [#uses=1]
+ volatile store i8* %tmp2223, i8** @p, align 4
+ %tmp25 = add i32 %n.0, 1 ; <i32> [#uses=2]
+ %tmp27 = icmp sle i32 %tmp25, 999999 ; <i1> [#uses=1]
+ %tmp2728 = zext i1 %tmp27 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp2728, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %cleanup31, label %cond_next
+
+cond_next: ; preds = %lab
+ call void @llvm.stackrestore( i8* %tmp2 )
+ ret i32 0
+
+cleanup31: ; preds = %lab
+ call void @llvm.stackrestore( i8* %tmp2 )
+ br label %lab
+}
+
+declare i8* @llvm.stacksave()
+
+declare void @llvm.stackrestore(i8*)
diff --git a/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll b/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll
new file mode 100644
index 000000000000..15e54b1bf749
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
+target triple = "powerpc-apple-darwin8"
+
+define i32 @test() {
+entry:
+ %tmp50.i17 = icmp slt i32 0, 4 ; <i1> [#uses=1]
+ br i1 %tmp50.i17, label %bb.i, label %calculateColorSpecificBlackLevel.exit
+
+bb.i: ; preds = %entry
+ br label %bb51.i.i
+
+bb27.i.i: ; preds = %bb51.i.i
+ %tmp31.i.i = load i16* null, align 2 ; <i16> [#uses=2]
+ %tmp35.i.i = icmp ult i16 %tmp31.i.i, 1 ; <i1> [#uses=1]
+ %tmp41.i.i = icmp ugt i16 %tmp31.i.i, -1 ; <i1> [#uses=1]
+ %bothcond.i.i = or i1 %tmp35.i.i, %tmp41.i.i ; <i1> [#uses=1]
+ %bothcond1.i.i = zext i1 %bothcond.i.i to i32 ; <i32> [#uses=1]
+ %tmp46.i.i = xor i32 %bothcond1.i.i, 1 ; <i32> [#uses=1]
+ %count.0.i.i = add i32 %count.1.i.i, %tmp46.i.i ; <i32> [#uses=1]
+ %tmp50.i.i = add i32 %x.0.i.i, 2 ; <i32> [#uses=1]
+ br label %bb51.i.i
+
+bb51.i.i: ; preds = %bb27.i.i, %bb.i
+ %count.1.i.i = phi i32 [ %count.0.i.i, %bb27.i.i ], [ 0, %bb.i ] ; <i32> [#uses=1]
+ %x.0.i.i = phi i32 [ %tmp50.i.i, %bb27.i.i ], [ 0, %bb.i ] ; <i32> [#uses=2]
+ %tmp54.i.i = icmp slt i32 %x.0.i.i, 0 ; <i1> [#uses=1]
+ br i1 %tmp54.i.i, label %bb27.i.i, label %bb57.i.i
+
+bb57.i.i: ; preds = %bb51.i.i
+ ret i32 0
+
+calculateColorSpecificBlackLevel.exit: ; preds = %entry
+ ret i32 undef
+}
diff --git a/test/Transforms/InstCombine/2007-10-31-StringCrash.ll b/test/Transforms/InstCombine/2007-10-31-StringCrash.ll
new file mode 100644
index 000000000000..6ba07e8a5a15
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-10-31-StringCrash.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+
+declare void @__darwin_gcc3_preregister_frame_info()
+
+define void @_start(i32 %argc, i8** %argv, i8** %envp) {
+entry:
+ %tmp1 = bitcast void ()* @__darwin_gcc3_preregister_frame_info to i32* ; <i32*> [#uses=1]
+ %tmp2 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ %tmp3 = icmp ne i32 %tmp2, 0 ; <i1> [#uses=1]
+ %tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp34, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %cond_true, label %return
+
+cond_true: ; preds = %entry
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
new file mode 100644
index 000000000000..f3caf0797638
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1780
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+
+%opaque_t = type opaque
+
+%op_ts = type {opaque, i32}
+
+@g = external global %opaque_t
+@h = external global %op_ts
+
+define i32 @foo() {
+entry:
+ %x = load i8* bitcast (%opaque_t* @g to i8*)
+ %y = load i32* bitcast (%op_ts* @h to i32*)
+ %z = zext i8 %x to i32
+ %r = add i32 %y, %z
+ ret i32 %r
+}
+
diff --git a/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll b/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll
new file mode 100644
index 000000000000..d7ac21137287
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %In, 1}
+; PR1800
+
+define i1 @test(i32 %In) {
+ %c1 = icmp sgt i32 %In, -1
+ %c2 = icmp eq i32 %In, 1
+ %V = and i1 %c1, %c2
+ ret i1 %V
+}
+
diff --git a/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll b/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll
new file mode 100644
index 000000000000..1f211b65d3fd
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR1817
+
+define i1 @test1(i32 %X) {
+ %A = icmp slt i32 %X, 10
+ %B = icmp ult i32 %X, 10
+ %C = and i1 %A, %B
+ ret i1 %C
+}
+
+define i1 @test2(i32 %X) {
+ %A = icmp slt i32 %X, 10
+ %B = icmp ult i32 %X, 10
+ %C = or i1 %A, %B
+ ret i1 %C
+}
diff --git a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll
new file mode 100644
index 000000000000..60a4b3b4ab52
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+; PR1716
+
+@.str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %tmp32 = tail call i32 (i8* noalias , ...) nounwind * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) noalias , i32 0 ) nounwind ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll b/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll
new file mode 100644
index 000000000000..80df6fbdce35
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll
@@ -0,0 +1,9 @@
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {ret i1 0}
+; PR1850
+
+define i1 @test() {
+ %cond = icmp ule i8* inttoptr (i64 4294967297 to i8*), inttoptr (i64 5 to i8*)
+ ret i1 %cond
+}
diff --git a/test/Transforms/InstCombine/2007-12-12-GEPScale.ll b/test/Transforms/InstCombine/2007-12-12-GEPScale.ll
new file mode 100644
index 000000000000..6580f90411a6
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-12-12-GEPScale.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 1431655764
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+
+define i8* @foo([100 x {i8,i8,i8}]* %x) {
+entry:
+ %p = bitcast [100 x {i8,i8,i8}]* %x to i8*
+ %q = getelementptr i8* %p, i32 -4
+ ret i8* %q
+}
diff --git a/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll b/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll
new file mode 100644
index 000000000000..336c6d5a2eba
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep nounwind
+
+define void @bar() {
+entry:
+ call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"( )
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll b/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll
new file mode 100644
index 000000000000..e44fc6f099a7
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add} | count 1
+
+define i32 @foo(i32 %a) {
+entry:
+ %tmp15 = sub i32 99, %a ; <i32> [#uses=2]
+ %tmp16 = icmp slt i32 %tmp15, 0 ; <i1> [#uses=1]
+ %smax = select i1 %tmp16, i32 0, i32 %tmp15 ; <i32> [#uses=1]
+ %tmp12 = add i32 %smax, %a ; <i32> [#uses=1]
+ %tmp13 = add i32 %tmp12, 1 ; <i32> [#uses=1]
+ ret i32 %tmp13
+}
+
+define i32 @bar(i32 %a) {
+entry:
+ %tmp15 = sub i32 99, %a ; <i32> [#uses=2]
+ %tmp16 = icmp slt i32 %tmp15, 0 ; <i1> [#uses=1]
+ %smax = select i1 %tmp16, i32 0, i32 %tmp15 ; <i32> [#uses=1]
+ %tmp12 = add i32 %smax, %a ; <i32> [#uses=1]
+ ret i32 %tmp12
+}
+
+define i32 @fun(i32 %a) {
+entry:
+ %tmp15 = sub i32 99, %a ; <i32> [#uses=1]
+ %tmp16 = icmp slt i32 %a, 0 ; <i1> [#uses=1]
+ %smax = select i1 %tmp16, i32 0, i32 %tmp15 ; <i32> [#uses=1]
+ %tmp12 = add i32 %smax, %a ; <i32> [#uses=1]
+ ret i32 %tmp12
+}
diff --git a/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll b/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll
new file mode 100644
index 000000000000..5e95993960c7
--- /dev/null
+++ b/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll
@@ -0,0 +1,89 @@
+; RUN: llvm-as < %s | opt -mem2reg -instcombine | llvm-dis | grep "ret i32 1" | count 8
+
+define i32 @test1() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp ule i32 %sub, 0
+ %retval = select i1 %cmp, i32 0, i32 1
+ ret i32 %retval
+}
+
+define i32 @test2() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp ugt i32 %sub, 0
+ %retval = select i1 %cmp, i32 1, i32 0
+ ret i32 %retval
+}
+
+define i32 @test3() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp slt i32 %sub, 0
+ %retval = select i1 %cmp, i32 1, i32 0
+ ret i32 %retval
+}
+
+define i32 @test4() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp sle i32 %sub, 0
+ %retval = select i1 %cmp, i32 1, i32 0
+ ret i32 %retval
+}
+
+define i32 @test5() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp sge i32 %sub, 0
+ %retval = select i1 %cmp, i32 0, i32 1
+ ret i32 %retval
+}
+
+define i32 @test6() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp sgt i32 %sub, 0
+ %retval = select i1 %cmp, i32 0, i32 1
+ ret i32 %retval
+}
+
+define i32 @test7() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp eq i32 %sub, 0
+ %retval = select i1 %cmp, i32 0, i32 1
+ ret i32 %retval
+}
+
+define i32 @test8() {
+entry:
+ %z = alloca i32
+ store i32 0, i32* %z
+ %tmp = load i32* %z
+ %sub = sub i32 %tmp, 1
+ %cmp = icmp ne i32 %sub, 0
+ %retval = select i1 %cmp, i32 1, i32 0
+ ret i32 %retval
+} \ No newline at end of file
diff --git a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll
new file mode 100644
index 000000000000..277b4f09075e
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll
@@ -0,0 +1,23 @@
+; Ignore stderr, we expect warnings there
+; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | not grep bitcast
+
+define void @a() {
+ ret void
+}
+
+define i32 @b(i32* inreg %x) signext {
+ ret i32 0
+}
+
+define void @c(...) {
+ ret void
+}
+
+define void @g(i32* %y) {
+ call void bitcast (void ()* @a to void (i32*)*)( i32* noalias %y )
+ call <2 x i32> bitcast (i32 (i32*)* @b to <2 x i32> (i32*)*)( i32* inreg null ) ; <<2 x i32>>:1 [#uses=0]
+ %x = call i64 bitcast (i32 (i32*)* @b to i64 (i32)*)( i32 0 ) ; <i64> [#uses=0]
+ call void bitcast (void (...)* @c to void (i32)*)( i32 0 )
+ call void bitcast (void (...)* @c to void (i32)*)( i32 zeroext 0 )
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2008-01-06-CastCrash.ll b/test/Transforms/InstCombine/2008-01-06-CastCrash.ll
new file mode 100644
index 000000000000..1d816d4b9967
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-06-CastCrash.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define <2 x i32> @f() {
+ ret <2 x i32> undef
+}
+
+define i32 @g() {
+ %x = call i32 bitcast (<2 x i32> ()* @f to i32 ()*)( ) ; <i32> [#uses=1]
+ ret i32 %x
+}
diff --git a/test/Transforms/InstCombine/2008-01-06-VoidCast.ll b/test/Transforms/InstCombine/2008-01-06-VoidCast.ll
new file mode 100644
index 000000000000..015210a99831
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-06-VoidCast.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+
+define void @f(i16 %y) {
+ ret void
+}
+
+define i32 @g(i32 %y) {
+ %x = call i32 bitcast (void (i16)* @f to i32 (i32)*)( i32 %y ) ; <i32> [#uses=1]
+ ret i32 %x
+}
diff --git a/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll b/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll
new file mode 100644
index 000000000000..71d5bf762c34
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and
+; PR1907
+
+define i1 @test(i32 %c84.17) {
+ %tmp2696 = icmp ne i32 %c84.17, 34 ; <i1> [#uses=2]
+ %tmp2699 = icmp sgt i32 %c84.17, -1 ; <i1> [#uses=1]
+ %tmp2703 = and i1 %tmp2696, %tmp2699 ; <i1> [#uses=1]
+ ret i1 %tmp2703
+}
diff --git a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll
new file mode 100644
index 000000000000..d791d7be26ec
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast | count 2
+
+define i32 @b(i32* inreg %x) signext {
+ ret i32 0
+}
+
+define void @c(...) {
+ ret void
+}
+
+define void @g(i32* %y) {
+ call i32 bitcast (i32 (i32*)* @b to i32 (i32)*)( i32 zeroext 0 ) ; <i32>:2 [#uses=0]
+ call void bitcast (void (...)* @c to void (i32*)*)( i32* sret null )
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll b/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll
new file mode 100644
index 000000000000..5381db2acbcb
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+ %struct.FRAME.nest = type { i32, i32 (i32*)* }
+ %struct.__builtin_trampoline = type { [10 x i8] }
+
+declare i8* @llvm.init.trampoline(i8*, i8*, i8*) nounwind
+
+declare i32 @f(%struct.FRAME.nest* nest , i32*)
+
+define i32 @nest(i32 %n) {
+entry:
+ %FRAME.0 = alloca %struct.FRAME.nest, align 8 ; <%struct.FRAME.nest*> [#uses=3]
+ %TRAMP.216 = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
+ %TRAMP.216.sub = getelementptr [10 x i8]* %TRAMP.216, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %n, i32* %tmp3, align 8
+ %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1]
+ %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest*, i32*)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
+ %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (i32*)**> [#uses=1]
+ %tmp89 = bitcast i8* %tramp to i32 (i32*)* ; <i32 (i32*)*> [#uses=2]
+ store i32 (i32*)* %tmp89, i32 (i32*)** %tmp7, align 8
+ %tmp2.i = call i32 %tmp89( i32* nest null ) ; <i32> [#uses=1]
+ ret i32 %tmp2.i
+}
diff --git a/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll b/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll
new file mode 100644
index 000000000000..e35794a813b0
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zeroext
+
+ %struct.FRAME.nest = type { i32, i32 (...)* }
+ %struct.__builtin_trampoline = type { [10 x i8] }
+
+declare i8* @llvm.init.trampoline(i8*, i8*, i8*) nounwind
+
+declare i32 @f(%struct.FRAME.nest* nest , ...)
+
+define i32 @nest(i32 %n) {
+entry:
+ %FRAME.0 = alloca %struct.FRAME.nest, align 8 ; <%struct.FRAME.nest*> [#uses=3]
+ %TRAMP.216 = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1]
+ %TRAMP.216.sub = getelementptr [10 x i8]* %TRAMP.216, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %n, i32* %tmp3, align 8
+ %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1]
+ %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest*, ...)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
+ %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (...)**> [#uses=1]
+ %tmp89 = bitcast i8* %tramp to i32 (...)* ; <i32 (...)*> [#uses=2]
+ store i32 (...)* %tmp89, i32 (...)** %tmp7, align 8
+ %tmp2.i = call i32 (...)* %tmp89( i32 zeroext 0 ) ; <i32> [#uses=1]
+ ret i32 %tmp2.i
+}
diff --git a/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll b/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll
new file mode 100644
index 000000000000..0c2cf54369cd
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {icmp s}
+; PR1940
+
+define i1 @test1(i8 %A, i8 %B) {
+ %a = zext i8 %A to i32
+ %b = zext i8 %B to i32
+ %c = icmp sgt i32 %a, %b
+ ret i1 %c
+}
+
+define i1 @test2(i8 %A, i8 %B) {
+ %a = sext i8 %A to i32
+ %b = sext i8 %B to i32
+ %c = icmp ugt i32 %a, %b
+ ret i1 %c
+}
diff --git a/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll b/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll
new file mode 100644
index 000000000000..8de0959bf754
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i16 @test1(i16 %a) {
+ %tmp = zext i16 %a to i32 ; <i32> [#uses=2]
+ %tmp21 = lshr i32 %tmp, 8 ; <i32> [#uses=1]
+ %tmp5 = mul i32 %tmp, 5 ; <i32> [#uses=1]
+ %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1]
+ %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1]
+ ret i16 %tmp.upgrd.3
+}
+
diff --git a/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll b/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll
new file mode 100644
index 000000000000..346f90f8293b
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select
+
+define double @fold(i1 %a, double %b) {
+%s = select i1 %a, double 0., double 1.
+%c = fdiv double %b, %s
+ret double %c
+}
diff --git a/test/Transforms/InstCombine/2008-01-29-AddICmp.ll b/test/Transforms/InstCombine/2008-01-29-AddICmp.ll
new file mode 100644
index 000000000000..d937f7bb2303
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-01-29-AddICmp.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {a.off}
+; PR1949
+
+define i1 @test1(i32 %a) {
+ %a.off = add i32 %a, 4 ; <i32> [#uses=1]
+ %C = icmp ult i32 %a.off, 4 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test2(i32 %a) {
+ %a.off = sub i32 %a, 4 ; <i32> [#uses=1]
+ %C = icmp ugt i32 %a.off, -5 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test3(i32 %a) {
+ %a.off = add i32 %a, 4 ; <i32> [#uses=1]
+ %C = icmp slt i32 %a.off, 2147483652 ; <i1> [#uses=1]
+ ret i1 %C
+}
diff --git a/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll b/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll
new file mode 100644
index 000000000000..6814e2febce1
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %indvar, 0}
+; PR1978
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+ %struct.x = type <{ i8 }>
+@.str = internal constant [6 x i8] c"Main!\00" ; <[6 x i8]*> [#uses=1]
+@.str1 = internal constant [12 x i8] c"destroy %p\0A\00" ; <[12 x i8]*> [#uses=1]
+
+define i32 @main() nounwind {
+entry:
+ %orientations = alloca [1 x [1 x %struct.x]] ; <[1 x [1 x %struct.x]]*> [#uses=2]
+ %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind ; <i32> [#uses=0]
+ %tmp45 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 ; <%struct.x*> [#uses=1]
+ %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 ; <%struct.x*> [#uses=1]
+ br label %bb10
+
+bb10: ; preds = %bb10, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] ; <i32> [#uses=2]
+ %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 ; <i32> [#uses=1]
+ %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 ; <i32> [#uses=1]
+ %tmp12 = getelementptr %struct.x* %tmp45, i32 %tmp12.rec ; <%struct.x*> [#uses=2]
+ %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind ; <i32> [#uses=0]
+ %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp84, label %bb17, label %bb10
+
+bb17: ; preds = %bb10
+ ret i32 0
+}
+
+declare i32 @puts(i8*)
+
+declare i32 @printf(i8*, ...)
diff --git a/test/Transforms/InstCombine/2008-02-13-MulURem.ll b/test/Transforms/InstCombine/2008-02-13-MulURem.ll
new file mode 100644
index 000000000000..669738378970
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-02-13-MulURem.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep rem
+; PR1933
+
+define i32 @fold(i32 %a) {
+ %s = mul i32 %a, 3
+ %c = urem i32 %s, 3
+ ret i32 %c
+}
diff --git a/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll b/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll
new file mode 100644
index 000000000000..cd61a10c5b85
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i.* 0} | count 2
+; PR2048
+
+define i32 @i(i32 %a) {
+ %tmp1 = sdiv i32 %a, -1431655765
+ %tmp2 = sdiv i32 %tmp1, 3
+ ret i32 %tmp2
+}
+
+define i8 @j(i8 %a) {
+ %tmp1 = sdiv i8 %a, 64
+ %tmp2 = sdiv i8 %tmp1, 3
+ ret i8 %tmp2
+}
diff --git a/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll b/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll
new file mode 100644
index 000000000000..0e260c465e32
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {sdiv i8 \%a, 9}
+; PR2048
+
+define i8 @i(i8 %a) {
+ %tmp1 = sdiv i8 %a, -3
+ %tmp2 = sdiv i8 %tmp1, -3
+ ret i8 %tmp2
+}
+
diff --git a/test/Transforms/InstCombine/2008-02-23-MulSub.ll b/test/Transforms/InstCombine/2008-02-23-MulSub.ll
new file mode 100644
index 000000000000..a74e98d44860
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-02-23-MulSub.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
+
+define i26 @test(i26 %a) nounwind {
+entry:
+ %_add = mul i26 %a, 2885 ; <i26> [#uses=1]
+ %_shl2 = mul i26 %a, 2884 ; <i26> [#uses=1]
+ %_sub = sub i26 %_add, %_shl2 ; <i26> [#uses=1]
+ ret i26 %_sub
+}
diff --git a/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll b/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll
new file mode 100644
index 000000000000..ea0240395626
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; rdar://5771353
+
+define float @test(float %x, x86_fp80 %y) nounwind readonly {
+entry:
+ %tmp67 = fcmp uno x86_fp80 %y, 0xK00000000000000000000 ; <i1> [#uses=1]
+ %tmp71 = fcmp uno float %x, 0.000000e+00 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp67, %tmp71 ; <i1> [#uses=1]
+ br i1 %bothcond, label %bb74, label %bb80
+
+bb74: ; preds = %entry
+ ret float 0.000000e+00
+
+bb80: ; preds = %entry
+ ret float 0.000000e+00
+}
diff --git a/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll b/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll
new file mode 100644
index 000000000000..31e7e35bef1f
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {16} | count 1
+
+define i8* @bork(i8** %qux) {
+ %tmp275 = load i8** %qux, align 1
+ %tmp275276 = ptrtoint i8* %tmp275 to i32
+ %tmp277 = add i32 %tmp275276, 16
+ %tmp277278 = inttoptr i32 %tmp277 to i8*
+ ret i8* %tmp277278
+}
diff --git a/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll b/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll
new file mode 100644
index 000000000000..020121375fea
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll
@@ -0,0 +1,15 @@
+;; The bitcast cannot be eliminated because byval arguments need
+;; the correct type, or at least a type of the correct size.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %struct.NSRect = type { [4 x float] }
+
+define void @foo(i8* %context) nounwind {
+entry:
+ %tmp1 = bitcast i8* %context to %struct.NSRect* ; <%struct.NSRect*> [#uses=1]
+ call void (i32, ...)* @bar( i32 3, %struct.NSRect* byval align 4 %tmp1 ) nounwind
+ ret void
+}
+
+declare void @bar(i32, ...)
diff --git a/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll b/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
new file mode 100644
index 000000000000..9bfe7aa14148
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store}
+
+define void @test() {
+ %votf = alloca <4 x float> ; <<4 x float>*> [#uses=1]
+ volatile store <4 x float> zeroinitializer, <4 x float>* %votf, align 16
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll b/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll
new file mode 100644
index 000000000000..e43c22daa42a
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 2
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+@g_1 = internal global i32 0 ; <i32*> [#uses=3]
+
+define i32 @main() nounwind {
+entry:
+ %tmp93 = icmp slt i32 0, 10 ; <i1> [#uses=0]
+ %tmp34 = volatile load i32* @g_1, align 4 ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %b.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp6, %bb ] ; <i32> [#uses=1]
+ %tmp3.reg2mem.0 = phi i32 [ %tmp34, %entry ], [ %tmp3, %bb ] ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp3.reg2mem.0, 5 ; <i32> [#uses=1]
+ volatile store i32 %tmp4, i32* @g_1, align 4
+ %tmp6 = add i32 %b.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp9 = icmp slt i32 %tmp6, 10 ; <i1> [#uses=1]
+ %tmp3 = volatile load i32* @g_1, align 4 ; <i32> [#uses=1]
+ br i1 %tmp9, label %bb, label %bb11
+
+bb11: ; preds = %bb
+ ret i32 0
+}
+
diff --git a/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll b/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll
new file mode 100644
index 000000000000..293052a44711
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 2
+; PR2262
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+@g_1 = internal global i32 0 ; <i32*> [#uses=3]
+
+define i32 @main(i32 %i) nounwind {
+entry:
+ %tmp93 = icmp slt i32 %i, 10 ; <i1> [#uses=0]
+ %tmp34 = volatile load i32* @g_1, align 4 ; <i32> [#uses=1]
+ br i1 %tmp93, label %bb11, label %bb
+
+bb: ; preds = %bb, %entry
+ %tmp3 = volatile load i32* @g_1, align 4 ; <i32> [#uses=1]
+ br label %bb11
+
+bb11: ; preds = %bb
+ %tmp4 = phi i32 [ %tmp34, %entry ], [ %tmp3, %bb ] ; <i32> [#uses=1]
+ ret i32 %tmp4
+}
+
diff --git a/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll b/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll
new file mode 100644
index 000000000000..e9cc97df0c61
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i8} | count 3
+; PR2297
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+
+define i32 @a() nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp1 = call i8* @malloc( i32 10 ) nounwind ; <i8*> [#uses=5]
+ %tmp3 = getelementptr i8* %tmp1, i32 1 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp3, align 1
+ %tmp5 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ store i8 1, i8* %tmp5, align 1
+ %tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; <i32> [#uses=1]
+ %tmp9 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp9, align 1
+ %tmp11 = call i32 (...)* @b( i8* %tmp1 ) nounwind ; <i32> [#uses=0]
+ ret i32 %tmp7
+}
+
+declare i8* @malloc(i32) nounwind
+
+declare i32 @strlen(i8*) nounwind readonly
+
+declare i32 @b(...)
diff --git a/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll b/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll
new file mode 100644
index 000000000000..e81e828d51f3
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | %prcontext strlen 1 | not grep ret
+; PR2297
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+
+define i32 @a() nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp1 = call i8* @malloc( i32 10 ) nounwind ; <i8*> [#uses=5]
+ %tmp3 = getelementptr i8* %tmp1, i32 1 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp3, align 1
+ %tmp5 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ store i8 1, i8* %tmp5, align 1
+ %tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; <i32> [#uses=1]
+ %tmp9 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp9, align 1
+ %tmp11 = call i32 (...)* @b( i8* %tmp1 ) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret i32 %tmp7
+}
+
+declare i8* @malloc(i32) nounwind
+
+declare i32 @strlen(i8*) nounwind readonly
+
+declare i32 @b(...)
diff --git a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll
new file mode 100644
index 000000000000..4dd29a79cd7d
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR2303
+ %"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+
+declare i32* @_ZNSt6locale5facet15_S_get_c_localeEv()
+
+declare i32** @__ctype_toupper_loc() readnone
+
+declare i32** @__ctype_tolower_loc() readnone
+
+define void @_ZNSt5ctypeIcEC2EPiPKtbm(%"struct.std::ctype<char>"* %this, i32* %unnamed_arg, i16* %__table, i8 zeroext %__del, i64 %__refs) {
+entry:
+ %tmp8 = invoke i32* @_ZNSt6locale5facet15_S_get_c_localeEv( )
+ to label %invcont unwind label %lpad ; <i32*> [#uses=0]
+
+invcont: ; preds = %entry
+ %tmp32 = invoke i32** @__ctype_toupper_loc( ) readnone
+ to label %invcont31 unwind label %lpad ; <i32**> [#uses=0]
+
+invcont31: ; preds = %invcont
+ %tmp38 = invoke i32** @__ctype_tolower_loc( ) readnone
+ to label %invcont37 unwind label %lpad ; <i32**> [#uses=1]
+
+invcont37: ; preds = %invcont31
+ %tmp39 = load i32** %tmp38, align 8 ; <i32*> [#uses=1]
+ %tmp41 = getelementptr %"struct.std::ctype<char>"* %this, i32 0, i32 4 ; <i32**> [#uses=1]
+ store i32* %tmp39, i32** %tmp41, align 8
+ ret void
+
+lpad: ; preds = %invcont31, %invcont, %entry
+ unreachable
+}
diff --git a/test/Transforms/InstCombine/2008-05-17-InfLoop.ll b/test/Transforms/InstCombine/2008-05-17-InfLoop.ll
new file mode 100644
index 000000000000..9cfbd6f2c5e2
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-17-InfLoop.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR2339
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-s0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+
+declare void @BZALLOC(i32)
+
+define void @f(i32) {
+entry:
+ %blockSize100k = alloca i32 ; <i32*> [#uses=2]
+ store i32 %0, i32* %blockSize100k
+ %n = alloca i32 ; <i32*> [#uses=2]
+ load i32* %blockSize100k ; <i32>:1 [#uses=1]
+ store i32 %1, i32* %n
+ load i32* %n ; <i32>:2 [#uses=1]
+ add i32 %2, 2 ; <i32>:3 [#uses=1]
+ mul i32 %3, ptrtoint (i32* getelementptr (i32* null, i32 1) to i32) ; <i32>:4 [#uses=1]
+ call void @BZALLOC( i32 %4 )
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll b/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll
new file mode 100644
index 000000000000..e994399e423e
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} | count 2
+; PR2329
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define i1 @f1() {
+ ret i1 icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*))
+}
+
+define i1 @f2() {
+ ret i1 icmp eq (i8* inttoptr (i16 1 to i8*), i8* inttoptr (i16 2 to i8*))
+}
diff --git a/test/Transforms/InstCombine/2008-05-22-IDivVector.ll b/test/Transforms/InstCombine/2008-05-22-IDivVector.ll
new file mode 100644
index 000000000000..ad70b658d3c1
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-22-IDivVector.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+
+define <3 x i8> @f(<3 x i8> %i) {
+ %A = sdiv <3 x i8> %i, %i
+ ret <3 x i8> %A
+}
diff --git a/test/Transforms/InstCombine/2008-05-22-NegValVector.ll b/test/Transforms/InstCombine/2008-05-22-NegValVector.ll
new file mode 100644
index 000000000000..f2511b383254
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-22-NegValVector.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sub
+
+define <3 x i8> @f(<3 x i8> %a) {
+ %A = sub <3 x i8> zeroinitializer, %a
+ %B = mul <3 x i8> %A, <i8 5, i8 5, i8 5>
+ ret <3 x i8> %B
+}
+
diff --git a/test/Transforms/InstCombine/2008-05-23-CompareFold.ll b/test/Transforms/InstCombine/2008-05-23-CompareFold.ll
new file mode 100644
index 000000000000..c0f34e68a9d8
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-23-CompareFold.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2359
+define i1 @f(i8* %x) {
+entry:
+ %tmp462 = load i8* %x, align 1 ; <i8> [#uses=1]
+ %tmp462463 = sitofp i8 %tmp462 to float ; <float> [#uses=1]
+ %tmp464 = fcmp ugt float %tmp462463, 0x47EFFFFFE0000000 ; <i1>
+ ret i1 %tmp464
+}
+
+
diff --git a/test/Transforms/InstCombine/2008-05-31-AddBool.ll b/test/Transforms/InstCombine/2008-05-31-AddBool.ll
new file mode 100644
index 000000000000..7008587c40d9
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-31-AddBool.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {xor}
+; PR2389
+
+define i1 @test(i1 %a, i1 %b) {
+ %A = add i1 %a, %b
+ ret i1 %A
+}
diff --git a/test/Transforms/InstCombine/2008-05-31-Bools.ll b/test/Transforms/InstCombine/2008-05-31-Bools.ll
new file mode 100644
index 000000000000..f3df49b352c3
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-05-31-Bools.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: grep {xor} %t
+; RUN: grep {and} %t
+; RUN: not grep {div} %t
+
+define i1 @foo1(i1 %a, i1 %b) {
+ %A = sub i1 %a, %b
+ ret i1 %A
+}
+
+define i1 @foo2(i1 %a, i1 %b) {
+ %A = mul i1 %a, %b
+ ret i1 %A
+}
+
+define i1 @foo3(i1 %a, i1 %b) {
+ %A = udiv i1 %a, %b
+ ret i1 %A
+}
+
+define i1 @foo4(i1 %a, i1 %b) {
+ %A = sdiv i1 %a, %b
+ ret i1 %A
+}
diff --git a/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll b/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll
new file mode 100644
index 000000000000..ec13bbf65c18
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine
+
+define i65 @foo(i65 %x) nounwind {
+entry:
+ %tmp2 = ashr i65 %x, 65 ; <i65> [#uses=1]
+ ret i65 %tmp2
+}
diff --git a/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll b/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll
new file mode 100644
index 000000000000..da63dd67453f
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {phi i32} | count 2
+
+define void @test() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb16, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %somebb ] ; <i32> [#uses=1]
+ %x.0 = phi i32 [ 37, %entry ], [ %tmp17, %somebb ] ; <i32> [#uses=1]
+ %tmp = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp1 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp2 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=1]
+ %tmp3 = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb7, label %bb5
+
+bb5: ; preds = %bb
+ %tmp6 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ br label %bb7
+
+bb7: ; preds = %bb5, %bb
+ %tmp8 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp9 = tail call i32 (...)* @bork( ) nounwind ; <i32> [#uses=0]
+ %tmp11 = icmp eq i32 %x.0, 37 ; <i1> [#uses=1]
+ br i1 %tmp11, label %bb14, label %bb16
+
+bb14: ; preds = %bb7
+ %tmp15 = tail call i32 (...)* @bar( ) nounwind ; <i32> [#uses=0]
+ br label %bb16
+
+bb16: ; preds = %bb14, %bb7
+ %tmp17 = tail call i32 (...)* @zap( ) nounwind ; <i32> [#uses=1]
+ %indvar.next = add i32 %i.0, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, 42 ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %somebb
+
+somebb:
+ br label %bb
+
+return: ; preds = %bb16
+ ret void
+}
+
+declare i32 @bork(...)
+
+declare i32 @bar(...)
+
+declare i32 @zap(...)
diff --git a/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll b/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll
new file mode 100644
index 000000000000..c671eb8b073e
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i32} | count 2
+
+@g_139 = global i32 0 ; <i32*> [#uses=2]
+
+define void @func_56(i32 %p_60) nounwind {
+entry:
+ store i32 1, i32* @g_139, align 4
+ %tmp1 = icmp ne i32 %p_60, 0 ; <i1> [#uses=1]
+ %tmp12 = zext i1 %tmp1 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp12, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb, label %return
+
+bb: ; preds = %bb, %entry
+ store i32 1, i32* @g_139, align 4
+ br label %bb
+
+return: ; preds = %entry
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll b/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll
new file mode 100644
index 000000000000..3f23098225e1
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i8} | count 2
+
+define i32 @a(i8* %s) nounwind {
+entry:
+ store i8 0, i8* %s, align 1 ; This store cannot be eliminated!
+ %tmp3 = call i32 @strlen( i8* %s ) nounwind readonly
+ %tmp5 = icmp ne i32 %tmp3, 0
+ br i1 %tmp5, label %bb, label %bb8
+
+bb: ; preds = %entry
+ store i8 0, i8* %s, align 1
+ br label %bb8
+
+bb8:
+ ret i32 %tmp3
+}
+
+declare i32 @strlen(i8*) nounwind readonly
+
diff --git a/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll b/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll
new file mode 100644
index 000000000000..fa3dc0ae141e
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load | count 3
+; PR2471
+
+declare i32 @x(i32*)
+define i32 @b(i32* %a, i32* %b) {
+entry:
+ %tmp1 = load i32* %a
+ %tmp3 = load i32* %b
+ %add = add i32 %tmp1, %tmp3
+ %call = call i32 @x( i32* %a )
+ %tobool = icmp ne i32 %add, 0
+ ; not safe to turn into an uncond load
+ %cond = select i1 %tobool, i32* %b, i32* %a
+ %tmp8 = load i32* %cond
+ ret i32 %tmp8
+}
diff --git a/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll b/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll
new file mode 100644
index 000000000000..e2d710078484
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %In, 15}
+; PR2479
+; (See also PR1800.)
+
+define i1 @test(i32 %In) {
+ %c1 = icmp ugt i32 %In, 13
+ %c2 = icmp eq i32 %In, 15
+ %V = and i1 %c1, %c2
+ ret i1 %V
+}
+
diff --git a/test/Transforms/InstCombine/2008-06-24-StackRestore.ll b/test/Transforms/InstCombine/2008-06-24-StackRestore.ll
new file mode 100644
index 000000000000..9ed7be38c6aa
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-06-24-StackRestore.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*llvm.stackrestore}
+; PR2488
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+@p = weak global i8* null ; <i8**> [#uses=2]
+
+define i32 @main() nounwind {
+entry:
+ %tmp248 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp2752 = alloca i32 ; <i32*> [#uses=2]
+ %tmpcast53 = bitcast i32* %tmp2752 to i8* ; <i8*> [#uses=1]
+ store i32 2, i32* %tmp2752, align 4
+ volatile store i8* %tmpcast53, i8** @p, align 4
+ br label %bb44
+
+bb: ; preds = %bb44
+ ret i32 0
+
+bb44: ; preds = %bb44, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %tmp3857, %bb44 ] ; <i32> [#uses=1]
+ %tmp249 = phi i8* [ %tmp248, %entry ], [ %tmp2, %bb44 ] ; <i8*> [#uses=1]
+ %tmp3857 = add i32 %indvar, 1 ; <i32> [#uses=3]
+ call void @llvm.stackrestore( i8* %tmp249 )
+ %tmp2 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp4 = srem i32 %tmp3857, 1000 ; <i32> [#uses=2]
+ %tmp5 = add i32 %tmp4, 1 ; <i32> [#uses=1]
+ %tmp27 = alloca i32, i32 %tmp5 ; <i32*> [#uses=3]
+ %tmpcast = bitcast i32* %tmp27 to i8* ; <i8*> [#uses=1]
+ store i32 1, i32* %tmp27, align 4
+ %tmp34 = getelementptr i32* %tmp27, i32 %tmp4 ; <i32*> [#uses=1]
+ store i32 2, i32* %tmp34, align 4
+ volatile store i8* %tmpcast, i8** @p, align 4
+ %exitcond = icmp eq i32 %tmp3857, 999999 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb, label %bb44
+}
+
+declare i8* @llvm.stacksave() nounwind
+
+declare void @llvm.stackrestore(i8*) nounwind
diff --git a/test/Transforms/InstCombine/2008-07-08-AndICmp.ll b/test/Transforms/InstCombine/2008-07-08-AndICmp.ll
new file mode 100644
index 000000000000..c6002413147e
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-08-AndICmp.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp | count 1
+; PR2330
+
+define i1 @foo(i32 %a, i32 %b) nounwind {
+entry:
+ icmp ult i32 %a, 8 ; <i1>:0 [#uses=1]
+ icmp ult i32 %b, 8 ; <i1>:1 [#uses=1]
+ and i1 %1, %0 ; <i1>:2 [#uses=1]
+ ret i1 %2
+}
diff --git a/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll b/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll
new file mode 100644
index 000000000000..956b9a6ae2e6
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp ne i32 \%a}
+; PR2330
+
+define i1 @foo(i32 %a) nounwind {
+entry:
+ %tmp15 = shl i32 1, %a ; <i32> [#uses=1]
+ %tmp237 = and i32 %tmp15, 1 ; <i32> [#uses=1]
+ %toBool = icmp eq i32 %tmp237, 0 ; <i1> [#uses=1]
+ ret i1 %toBool
+}
diff --git a/test/Transforms/InstCombine/2008-07-08-SubAnd.ll b/test/Transforms/InstCombine/2008-07-08-SubAnd.ll
new file mode 100644
index 000000000000..bf3afb9e3bb1
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-08-SubAnd.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v {i32 8}
+; PR2330
+
+define i32 @a(i32 %a) nounwind {
+entry:
+ %tmp2 = sub i32 8, %a ; <i32> [#uses=1]
+ %tmp3 = and i32 %tmp2, 7 ; <i32> [#uses=1]
+ ret i32 %tmp3
+}
diff --git a/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll b/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll
new file mode 100644
index 000000000000..af728eb207c2
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 2
+; PR2496
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+@g_1 = internal global i32 0 ; <i32*> [#uses=3]
+
+define i32 @main() nounwind {
+entry:
+ %tmp93 = icmp slt i32 0, 10 ; <i1> [#uses=0]
+ %tmp34 = volatile load i32* @g_1, align 4 ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %b.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp6, %bb ] ; <i32> [#uses=1]
+ %tmp3.reg2mem.0 = phi i32 [ %tmp3, %bb ], [ %tmp34, %entry ]
+ %tmp4 = add i32 %tmp3.reg2mem.0, 5 ; <i32> [#uses=1]
+ volatile store i32 %tmp4, i32* @g_1, align 4
+ %tmp6 = add i32 %b.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp9 = icmp slt i32 %tmp6, 10 ; <i1> [#uses=1]
+ %tmp3 = volatile load i32* @g_1, align 4 ; <i32> [#uses=1]
+ br i1 %tmp9, label %bb, label %bb11
+
+bb11: ; preds = %bb
+ ret i32 0
+}
+
diff --git a/test/Transforms/InstCombine/2008-07-09-SubAndError.ll b/test/Transforms/InstCombine/2008-07-09-SubAndError.ll
new file mode 100644
index 000000000000..c5b93586ba38
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-09-SubAndError.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {sub i32 0}
+; PR2330
+
+define i32 @foo(i32 %a) nounwind {
+entry:
+ %A = sub i32 5, %a
+ %B = and i32 %A, 2
+ ret i32 %B
+}
diff --git a/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll b/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll
new file mode 100644
index 000000000000..205e57d79738
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%C = xor i1 %A, true}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2539
+
+define i1 @test1(i1 %A) {
+ %B = zext i1 %A to i32
+ %C = icmp slt i32 %B, 1
+ ret i1 %C
+}
+
+
+define i1 @test2(i1 zeroext %b) {
+entry:
+ %cmptmp = icmp slt i1 %b, true ; <i1> [#uses=1]
+ ret i1 %cmptmp
+}
+
diff --git a/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll b/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll
new file mode 100644
index 000000000000..50533db06d55
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep add
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
+; PR2330
+
+define i1 @f(i32 %x, i32 %y) nounwind {
+entry:
+ %A = add i32 %x, 5
+ %B = add i32 %y, 5
+ %C = icmp eq i32 %A, %B
+ ret i1 %C
+}
+
+define i1 @g(i32 %x, i32 %y) nounwind {
+entry:
+ %A = mul i32 %x, 5
+ %B = mul i32 %y, 5
+ %C = icmp eq i32 %A, %B
+ ret i1 %C
+}
diff --git a/test/Transforms/InstCombine/2008-07-11-RemAnd.ll b/test/Transforms/InstCombine/2008-07-11-RemAnd.ll
new file mode 100644
index 000000000000..0bfd41dd4e7a
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-11-RemAnd.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
+; PR2330
+
+define i32 @a(i32 %b) nounwind {
+entry:
+ srem i32 %b, 8 ; <i32>:0 [#uses=1]
+ and i32 %0, 1 ; <i32>:1 [#uses=1]
+ ret i32 %1
+}
diff --git a/test/Transforms/InstCombine/2008-07-13-DivZero.ll b/test/Transforms/InstCombine/2008-07-13-DivZero.ll
new file mode 100644
index 000000000000..85c3dbc5ff69
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-13-DivZero.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {lshr.*3}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call .*%cond}
+; PR2506
+
+; We can simplify the operand of udiv to '8', but not the operand to the
+; call. If the callee never returns, we can't assume the div is reachable.
+define i32 @a(i32 %x, i32 %y) {
+entry:
+ %tobool = icmp ne i32 %y, 0 ; <i1> [#uses=1]
+ %cond = select i1 %tobool, i32 8, i32 0 ; <i32> [#uses=2]
+ %call = call i32 @b( i32 %cond ) ; <i32> [#uses=0]
+ %div = udiv i32 %x, %cond ; <i32> [#uses=1]
+ ret i32 %div
+}
+
+declare i32 @b(i32)
diff --git a/test/Transforms/InstCombine/2008-07-16-fsub.ll b/test/Transforms/InstCombine/2008-07-16-fsub.ll
new file mode 100644
index 000000000000..1d0554d1810b
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-16-fsub.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub
+; PR2553
+
+define double @test(double %X) nounwind {
+ ; fsub of self can't be optimized away.
+ %Y = sub double %X, %X
+ ret double %Y
+}
diff --git a/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll b/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll
new file mode 100644
index 000000000000..49e6cdd0377d
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {store }
+; PR2296
+
+@G = common global double 0.000000e+00, align 16
+
+define void @x(<2 x i64> %y) nounwind {
+entry:
+ bitcast <2 x i64> %y to <4 x i32>
+ call void @llvm.x86.sse2.storel.dq( i8* bitcast (double* @G to i8*), <4 x i32> %0 ) nounwind
+ ret void
+}
+
+declare void @llvm.x86.sse2.storel.dq(i8*, <4 x i32>) nounwind
diff --git a/test/Transforms/InstCombine/2008-08-05-And.ll b/test/Transforms/InstCombine/2008-08-05-And.ll
new file mode 100644
index 000000000000..939e6b859506
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-08-05-And.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or
+; PR2629
+
+define void @f(i8* %x) nounwind {
+entry:
+ br label %bb
+
+bb:
+ %g1 = getelementptr i8* %x, i32 0
+ %l1 = load i8* %g1, align 1
+ %s1 = sub i8 %l1, 6
+ %c1 = icmp ugt i8 %s1, 2
+ %s2 = sub i8 %l1, 10
+ %c2 = icmp ugt i8 %s2, 2
+ %a1 = and i1 %c1, %c2
+ br i1 %a1, label %incompatible, label %okay
+
+okay:
+ ret void
+
+incompatible:
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll b/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll
new file mode 100644
index 000000000000..428a35947d1d
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor
+
+define i1 @test1(i8 %x, i8 %y) {
+ %X = xor i8 %x, 128
+ %Y = xor i8 %y, 128
+ %tmp = icmp slt i8 %X, %Y
+ ret i1 %tmp
+}
+
+define i1 @test2(i8 %x, i8 %y) {
+ %X = xor i8 %x, 128
+ %Y = xor i8 %y, 128
+ %tmp = icmp ult i8 %X, %Y
+ ret i1 %tmp
+}
+
+define i1 @test3(i8 %x) {
+ %X = xor i8 %x, 128
+ %tmp = icmp uge i8 %X, 15
+ ret i1 %tmp
+}
+
+define i1 @test4(i8 %x, i8 %y) {
+ %X = xor i8 %x, 127
+ %Y = xor i8 %y, 127
+ %tmp = icmp slt i8 %X, %Y
+ ret i1 %tmp
+}
+
+define i1 @test5(i8 %x, i8 %y) {
+ %X = xor i8 %x, 127
+ %Y = xor i8 %y, 127
+ %tmp = icmp ult i8 %X, %Y
+ ret i1 %tmp
+}
+
+define i1 @test6(i8 %x) {
+ %X = xor i8 %x, 127
+ %tmp = icmp uge i8 %X, 15
+ ret i1 %tmp
+}
diff --git a/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll b/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll
new file mode 100644
index 000000000000..4b5dc6a5dfc1
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -instcombine
+
+define void @entry(i32 %m_task_id, i32 %start_x, i32 %end_x, i32 %start_y, i32 %end_y) {
+ br label %1
+
+; <label>:1 ; preds = %4, %0
+ %2 = icmp slt i32 0, %end_y ; <i1> [#uses=1]
+ br i1 %2, label %4, label %3
+
+; <label>:3 ; preds = %1
+ ret void
+
+; <label>:4 ; preds = %6, %1
+ %5 = icmp slt i32 0, %end_x ; <i1> [#uses=1]
+ br i1 %5, label %6, label %1
+
+; <label>:6 ; preds = %4
+ %7 = srem <2 x i32> zeroinitializer, zeroinitializer ; <<2 x i32>> [#uses=1]
+ %8 = extractelement <2 x i32> %7, i32 1 ; <i32> [#uses=1]
+ %9 = select i1 false, i32 0, i32 %8 ; <i32> [#uses=1]
+ %10 = insertelement <2 x i32> zeroinitializer, i32 %9, i32 1 ; <<2 x i32>> [#uses=1]
+ %11 = extractelement <2 x i32> %10, i32 1 ; <i32> [#uses=1]
+ %12 = insertelement <4 x i32> zeroinitializer, i32 %11, i32 3 ; <<4 x i32>> [#uses=1]
+ %13 = sitofp <4 x i32> %12 to <4 x float> ; <<4 x float>> [#uses=1]
+ store <4 x float> %13, <4 x float>* null
+ br label %4
+}
diff --git a/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll b/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll
new file mode 100644
index 000000000000..e7a8ca9b521c
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {or i1}
+; PR2844
+
+define i32 @test(i32 %p_74) {
+ %A = icmp eq i32 %p_74, 0 ; <i1> [#uses=1]
+ %B = icmp slt i32 %p_74, -638208501 ; <i1> [#uses=1]
+ %or.cond = or i1 %A, %B ; <i1> [#uses=1]
+ %iftmp.10.0 = select i1 %or.cond, i32 0, i32 1 ; <i32> [#uses=1]
+ ret i32 %iftmp.10.0
+}
diff --git a/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll b/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll
new file mode 100644
index 000000000000..dfe9c4a16c89
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2697
+
+define i1 @x(i32 %x) nounwind {
+ %div = sdiv i32 %x, 65536 ; <i32> [#uses=1]
+ %cmp = icmp slt i32 %div, -65536
+ ret i1 %cmp
+}
diff --git a/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll b/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll
new file mode 100644
index 000000000000..8f35a8586c73
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine
+; PR2940
+
+define i32 @tstid() {
+ %var0 = inttoptr i32 1 to i8* ; <i8*> [#uses=1]
+ %var2 = ptrtoint i8* %var0 to i32 ; <i32> [#uses=1]
+ ret i32 %var2
+}
diff --git a/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll b/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll
new file mode 100644
index 000000000000..46e98eb3627c
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true}
+; PR2993
+
+define i1 @foo(i32 %x) {
+ %1 = srem i32 %x, -1
+ %2 = icmp eq i32 %1, 0
+ ret i1 %2
+}
diff --git a/test/Transforms/InstCombine/2008-11-08-FCmp.ll b/test/Transforms/InstCombine/2008-11-08-FCmp.ll
new file mode 100644
index 000000000000..c088f3166faf
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-11-08-FCmp.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: grep {icmp eq} %t
+; RUN: grep {ret i1 false} %t | count 2
+; RUN: grep {ret i1 true} %t | count 2
+; RUN: grep {icmp ne} %t
+; RUN: not grep {icmp slt} %t
+; PR3021
+
+; When inst combining an FCMP with the LHS coming from a uitofp instruction, we
+; can't lower it to signed ICMP instructions.
+
+define i1 @test1(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp ole double %1, 0.000000e+00
+ ret i1 %2
+}
+
+define i1 @test2(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp olt double %1, 0.000000e+00
+ ret i1 %2
+}
+
+define i1 @test3(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp oge double %1, 0.000000e+00
+ ret i1 %2
+}
+
+define i1 @test4(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp ogt double %1, 0.000000e+00
+ ret i1 %2
+}
+
+define i1 @test5(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp ogt double %1, -4.400000e+00
+ ret i1 %2
+}
+
+define i1 @test6(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp olt double %1, -4.400000e+00
+ ret i1 %2
+}
diff --git a/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll b/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll
new file mode 100644
index 000000000000..8c58a2ae7f7d
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: grep urem %t | count 3
+; RUN: grep srem %t | count 1
+; RUN: grep sub %t | count 2
+; RUN: grep add %t | count 1
+; PR3103
+
+define i8 @test1(i8 %x, i8 %y) {
+ %A = udiv i8 %x, %y
+ %B = mul i8 %A, %y
+ %C = sub i8 %x, %B
+ ret i8 %C
+}
+
+define i8 @test2(i8 %x, i8 %y) {
+ %A = sdiv i8 %x, %y
+ %B = mul i8 %A, %y
+ %C = sub i8 %x, %B
+ ret i8 %C
+}
+
+define i8 @test3(i8 %x, i8 %y) {
+ %A = udiv i8 %x, %y
+ %B = mul i8 %A, %y
+ %C = sub i8 %B, %x
+ ret i8 %C
+}
+
+define i8 @test4(i8 %x) {
+ %A = udiv i8 %x, 3
+ %B = mul i8 %A, -3
+ %C = sub i8 %x, %B
+ ret i8 %C
+}
diff --git a/test/Transforms/InstCombine/2008-11-27-IDivVector.ll b/test/Transforms/InstCombine/2008-11-27-IDivVector.ll
new file mode 100644
index 000000000000..4275e1191a88
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-11-27-IDivVector.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
+
+define <2 x i8> @f(<2 x i8> %x) {
+ %A = udiv <2 x i8> %x, <i8 1, i8 1>
+ ret <2 x i8> %A
+}
+
+define <2 x i8> @g(<2 x i8> %x) {
+ %A = sdiv <2 x i8> %x, <i8 1, i8 1>
+ ret <2 x i8> %A
+}
diff --git a/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll b/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll
new file mode 100644
index 000000000000..544e9abbbcb7
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
+
+define <2 x i8> @f(<2 x i8> %x) {
+ %A = mul <2 x i8> %x, <i8 1, i8 1>
+ ret <2 x i8> %A
+}
+
+define <2 x i8> @g(<2 x i8> %x) {
+ %A = mul <2 x i8> %x, <i8 -1, i8 -1>
+ ret <2 x i8> %A
+}
diff --git a/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll b/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll
new file mode 100644
index 000000000000..6a6b5f386347
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
+
+define i8 @test(i8 %x) readnone nounwind {
+ %A = udiv i8 %x, 250
+ ret i8 %A
+}
diff --git a/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll b/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll
new file mode 100644
index 000000000000..f970b96ed4d2
--- /dev/null
+++ b/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {i8 2, i8 2}
+; PR2756
+
+define <2 x i8> @foo(<2 x i8> %x) {
+ %A = srem <2 x i8> %x, <i8 2, i8 -2>
+ ret <2 x i8> %A
+}
diff --git a/test/Transforms/InstCombine/2009-01-05-i128-crash.ll b/test/Transforms/InstCombine/2009-01-05-i128-crash.ll
new file mode 100644
index 000000000000..df3a760daf87
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-05-i128-crash.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; PR3235
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define hidden i128 @"\01_gfortrani_max_value"(i32 %length, i32 %signed_flag) nounwind {
+entry:
+ switch i32 %length, label %bb13 [
+ i32 1, label %bb17
+ i32 4, label %bb9
+ i32 8, label %bb5
+ ]
+
+bb5: ; preds = %entry
+ %0 = icmp eq i32 %signed_flag, 0 ; <i1> [#uses=1]
+ %iftmp.28.0 = select i1 %0, i128 18446744073709551615, i128 9223372036854775807 ; <i128> [#uses=1]
+ ret i128 %iftmp.28.0
+
+bb9: ; preds = %entry
+ ret i128 0
+
+bb13: ; preds = %entry
+ ret i128 0
+
+bb17: ; preds = %entry
+ ret i128 0
+}
diff --git a/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll b/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll
new file mode 100644
index 000000000000..82b923ac95c7
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: grep {, align 4} %t | count 3
+; RUN: grep {, align 8} %t | count 3
+; rdar://6480438
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+ %struct.Key = type { { i32, i32 } }
+ %struct.anon = type <{ i8, [3 x i8], i32 }>
+
+define i32 @bar(i64 %key_token2) nounwind {
+entry:
+ %iospec = alloca %struct.Key ; <%struct.Key*> [#uses=3]
+ %ret = alloca i32 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = getelementptr %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=2]
+ %1 = getelementptr { i32, i32 }* %0, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %1, align 4
+ %2 = getelementptr { i32, i32 }* %0, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %2, align 4
+ %3 = getelementptr %struct.Key* %iospec, i32 0, i32 0 ; <{ i32, i32 }*> [#uses=1]
+ %4 = bitcast { i32, i32 }* %3 to i64* ; <i64*> [#uses=1]
+ store i64 %key_token2, i64* %4, align 4
+ %5 = call i32 (...)* @foo(%struct.Key* byval align 4 %iospec, i32* %ret) nounwind ; <i32> [#uses=0]
+ %6 = load i32* %ret, align 4 ; <i32> [#uses=1]
+ ret i32 %6
+}
+
+declare i32 @foo(...)
diff --git a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll
new file mode 100644
index 000000000000..e0a2610c225e
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store.*addrspace(1)}
+; PR3335
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+
+define i32 @test(i32* %P) nounwind {
+entry:
+ %Q = bitcast i32* %P to i32 addrspace(1)*
+ store i32 0, i32 addrspace(1)* %Q, align 4
+ ret i32 0
+}
diff --git a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
new file mode 100644
index 000000000000..cc001f0334c3
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
@@ -0,0 +1,316 @@
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0x7FF8000000000000 | count 7
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0x7FF00000FFFFFFFF | count 5
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep {0\\.0} | count 3
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep {3\\.5} | count 1
+;
+
+; ModuleID = 'apf.c'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+@"\01LC" = internal constant [4 x i8] c"%f\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define void @foo1() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF0000000000000, float* %x, align 4
+ store float 0x7FF8000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+declare i32 @printf(i8*, ...) nounwind
+
+define void @foo2() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF0000000000000, float* %x, align 4
+ store float 0.000000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo3() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF0000000000000, float* %x, align 4
+ store float 3.500000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo4() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF0000000000000, float* %x, align 4
+ store float 0x7FF0000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo5() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF8000000000000, float* %x, align 4
+ store float 0x7FF0000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo6() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF8000000000000, float* %x, align 4
+ store float 0.000000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo7() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF8000000000000, float* %x, align 4
+ store float 3.500000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo8() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0x7FF8000000000000, float* %x, align 4
+ store float 0x7FF8000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo9() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0.000000e+00, float* %x, align 4
+ store float 0x7FF8000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo10() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0.000000e+00, float* %x, align 4
+ store float 0x7FF0000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo11() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0.000000e+00, float* %x, align 4
+ store float 0.000000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo12() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 0.000000e+00, float* %x, align 4
+ store float 3.500000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo13() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 3.500000e+00, float* %x, align 4
+ store float 0x7FF8000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo14() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 3.500000e+00, float* %x, align 4
+ store float 0x7FF0000000000000, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo15() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 3.500000e+00, float* %x, align 4
+ store float 0.000000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define void @foo16() nounwind {
+entry:
+ %y = alloca float ; <float*> [#uses=2]
+ %x = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store float 3.500000e+00, float* %x, align 4
+ store float 3.500000e+00, float* %y, align 4
+ %0 = load float* %y, align 4 ; <float> [#uses=1]
+ %1 = fpext float %0 to double ; <double> [#uses=1]
+ %2 = load float* %x, align 4 ; <float> [#uses=1]
+ %3 = fpext float %2 to double ; <double> [#uses=1]
+ %4 = frem double %3, %1 ; <double> [#uses=1]
+ %5 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), double %4) nounwind ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
new file mode 100644
index 000000000000..9cdb425ab49c
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll
@@ -0,0 +1,75 @@
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0x3FB99999A0000000 | count 2
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0xBFB99999A0000000 | count 2
+; check constant folding for 'frem'. PR 3316.
+
+; ModuleID = 'tt.c'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+
+define float @test1() nounwind {
+entry:
+ %retval = alloca float ; <float*> [#uses=2]
+ %0 = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = frem double 1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
+ %2 = fptrunc double %1 to float ; <float> [#uses=1]
+ store float %2, float* %0, align 4
+ %3 = load float* %0, align 4 ; <float> [#uses=1]
+ store float %3, float* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load float* %retval ; <float> [#uses=1]
+ ret float %retval1
+}
+
+define float @test2() nounwind {
+entry:
+ %retval = alloca float ; <float*> [#uses=2]
+ %0 = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = frem double -1.000000e-01, 1.000000e+00 ; <double> [#uses=1]
+ %2 = fptrunc double %1 to float ; <float> [#uses=1]
+ store float %2, float* %0, align 4
+ %3 = load float* %0, align 4 ; <float> [#uses=1]
+ store float %3, float* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load float* %retval ; <float> [#uses=1]
+ ret float %retval1
+}
+
+define float @test3() nounwind {
+entry:
+ %retval = alloca float ; <float*> [#uses=2]
+ %0 = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = frem double 1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
+ %2 = fptrunc double %1 to float ; <float> [#uses=1]
+ store float %2, float* %0, align 4
+ %3 = load float* %0, align 4 ; <float> [#uses=1]
+ store float %3, float* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load float* %retval ; <float> [#uses=1]
+ ret float %retval1
+}
+
+define float @test4() nounwind {
+entry:
+ %retval = alloca float ; <float*> [#uses=2]
+ %0 = alloca float ; <float*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = frem double -1.000000e-01, -1.000000e+00 ; <double> [#uses=1]
+ %2 = fptrunc double %1 to float ; <float> [#uses=1]
+ store float %2, float* %0, align 4
+ %3 = load float* %0, align 4 ; <float> [#uses=1]
+ store float %3, float* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load float* %retval ; <float> [#uses=1]
+ ret float %retval1
+}
diff --git a/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll b/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll
new file mode 100644
index 000000000000..313e76d028d0
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine
+; PR3381
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.atomic_t = type { i32 }
+ %struct.inode = type { i32, %struct.mutex }
+ %struct.list_head = type { %struct.list_head*, %struct.list_head* }
+ %struct.lock_class_key = type { }
+ %struct.mutex = type { %struct.atomic_t, %struct.rwlock_t, %struct.list_head }
+ %struct.rwlock_t = type { %struct.lock_class_key }
+
+define void @handle_event(%struct.inode* %bar) nounwind {
+entry:
+ %0 = getelementptr %struct.inode* %bar, i64 -1, i32 1, i32 1 ; <%struct.rwlock_t*> [#uses=1]
+ %1 = bitcast %struct.rwlock_t* %0 to i32* ; <i32*> [#uses=1]
+ store i32 1, i32* %1, align 4
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2009-01-31-InfIterate.ll b/test/Transforms/InstCombine/2009-01-31-InfIterate.ll
new file mode 100644
index 000000000000..6620e4fadd64
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-31-InfIterate.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; PR3452
+define i128 @test(i64 %A, i64 %B, i1 %C, i128 %Z, i128 %Y, i64* %P, i64* %Q) {
+entry:
+ %tmp2 = trunc i128 %Z to i64
+ %tmp4 = trunc i128 %Y to i64
+ store i64 %tmp2, i64* %P
+ store i64 %tmp4, i64* %Q
+ %x = sub i64 %tmp2, %tmp4
+ %c = sub i64 %tmp2, %tmp4
+ %tmp137 = zext i1 %C to i64
+ %tmp138 = sub i64 %c, %tmp137
+ br label %T
+
+T:
+ %G = phi i64 [%tmp138, %entry], [%tmp2, %Fal]
+ %F = zext i64 %G to i128
+ ret i128 %F
+
+Fal:
+ br label %T
+}
diff --git a/test/Transforms/InstCombine/2009-01-31-Pressure.ll b/test/Transforms/InstCombine/2009-01-31-Pressure.ll
new file mode 100644
index 000000000000..0c3066bb90c9
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-01-31-Pressure.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%B = add i8 %b, %x}
+; PR2698
+
+declare void @use1(i1)
+declare void @use8(i8)
+
+define void @test1(i8 %a, i8 %b, i8 %x) {
+ %A = add i8 %a, %x
+ %B = add i8 %b, %x
+ %C = icmp eq i8 %A, %B
+ call void @use1(i1 %C)
+ ret void
+}
+
+define void @test2(i8 %a, i8 %b, i8 %x) {
+ %A = add i8 %a, %x
+ %B = add i8 %b, %x
+ %C = icmp eq i8 %A, %B
+ call void @use1(i1 %C)
+ call void @use8(i8 %A)
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll b/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll
new file mode 100644
index 000000000000..b08c9622502a
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine
+; PR3468
+
+define x86_fp80 @cast() {
+ %tmp = bitcast i80 0 to x86_fp80 ; <x86_fp80> [#uses=1]
+ ret x86_fp80 %tmp
+}
+
+define i80 @invcast() {
+ %tmp = bitcast x86_fp80 0xK00000000000000000000 to i80 ; <i80> [#uses=1]
+ ret i80 %tmp
+}
diff --git a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll
new file mode 100644
index 000000000000..52bceadac395
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll
@@ -0,0 +1,278 @@
+; RUN: llvm-as < %s | opt -instcombine -scalarrepl | llvm-dis | not grep { = alloca}
+; rdar://6417724
+; Instcombine shouldn't do anything to this function that prevents promoting the allocas inside it.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+ %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" = type { i32* }
+ %"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" }
+ %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* }
+ %"struct.std::bidirectional_iterator_tag" = type <{ i8 }>
+ %"struct.std::forward_iterator_tag" = type <{ i8 }>
+ %"struct.std::input_iterator_tag" = type <{ i8 }>
+ %"struct.std::random_access_iterator_tag" = type <{ i8 }>
+ %"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" }
+
+define i32* @_Z3fooRSt6vectorIiSaIiEE(%"struct.std::vector<int,std::allocator<int> >"* %X) {
+entry:
+ %0 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2]
+ %__first_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=31]
+ %__last_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=4]
+ %unnamed_arg.i = alloca %"struct.std::bidirectional_iterator_tag", align 8 ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=1]
+ %1 = alloca %"struct.std::bidirectional_iterator_tag" ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=1]
+ %__first_addr.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2]
+ %2 = alloca %"struct.std::bidirectional_iterator_tag" ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=2]
+ %3 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2]
+ %4 = alloca i32 ; <i32*> [#uses=8]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 42, i32* %4, align 4
+ %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >"*> [#uses=1]
+ %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"*> [#uses=1]
+ %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1 ; <i32**> [#uses=1]
+ %8 = load i32** %7, align 4 ; <i32*> [#uses=1]
+ %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %8, i32** %9, align 4
+ %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 ; <i32**> [#uses=1]
+ %11 = load i32** %10, align 4 ; <i32*> [#uses=1]
+ %tmp2.i = ptrtoint i32* %11 to i32 ; <i32> [#uses=1]
+ %tmp1.i = inttoptr i32 %tmp2.i to i32* ; <i32*> [#uses=1]
+ %tmp3 = ptrtoint i32* %tmp1.i to i32 ; <i32> [#uses=1]
+ %tmp2 = inttoptr i32 %tmp3 to i32* ; <i32*> [#uses=1]
+ %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >"*> [#uses=1]
+ %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"*> [#uses=1]
+ %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0 ; <i32**> [#uses=1]
+ %15 = load i32** %14, align 4 ; <i32*> [#uses=1]
+ %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %15, i32** %16, align 4
+ %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 ; <i32**> [#uses=1]
+ %18 = load i32** %17, align 4 ; <i32*> [#uses=1]
+ %tmp2.i17 = ptrtoint i32* %18 to i32 ; <i32> [#uses=1]
+ %tmp1.i18 = inttoptr i32 %tmp2.i17 to i32* ; <i32*> [#uses=1]
+ %tmp8 = ptrtoint i32* %tmp1.i18 to i32 ; <i32> [#uses=1]
+ %tmp6 = inttoptr i32 %tmp8 to i32* ; <i32*> [#uses=1]
+ %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %tmp6, i32** %19
+ %20 = getelementptr %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0 ; <i8*> [#uses=1]
+ %21 = load i8* %20, align 1 ; <i8> [#uses=1]
+ %22 = or i8 %21, 0 ; <i8> [#uses=1]
+ %23 = or i8 %22, 0 ; <i8> [#uses=1]
+ %24 = or i8 %23, 0 ; <i8> [#uses=0]
+ %25 = getelementptr %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0 ; <i8*> [#uses=1]
+ store i8 0, i8* %25, align 1
+ %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %val.i = load i32** %elt.i ; <i32*> [#uses=1]
+ %tmp.i = bitcast %"struct.std::bidirectional_iterator_tag"* %unnamed_arg.i to i8* ; <i8*> [#uses=1]
+ %tmp9.i = bitcast %"struct.std::bidirectional_iterator_tag"* %2 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i64(i8* %tmp.i, i8* %tmp9.i, i64 1, i32 1)
+ %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %val.i, i32** %26
+ %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %tmp2, i32** %27
+ %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %29 = load i32** %28, align 4 ; <i32*> [#uses=1]
+ %30 = ptrtoint i32* %29 to i32 ; <i32> [#uses=1]
+ %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %32 = load i32** %31, align 4 ; <i32*> [#uses=1]
+ %33 = ptrtoint i32* %32 to i32 ; <i32> [#uses=1]
+ %34 = sub i32 %30, %33 ; <i32> [#uses=1]
+ %35 = ashr i32 %34, 2 ; <i32> [#uses=1]
+ %36 = ashr i32 %35, 2 ; <i32> [#uses=1]
+ br label %bb12.i.i
+
+bb.i.i: ; preds = %bb12.i.i
+ %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %38 = load i32** %37, align 4 ; <i32*> [#uses=1]
+ %39 = load i32* %38, align 4 ; <i32> [#uses=1]
+ %40 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %41 = icmp eq i32 %39, %40 ; <i1> [#uses=1]
+ %42 = zext i1 %41 to i8 ; <i8> [#uses=1]
+ %toBool.i.i = icmp ne i8 %42, 0 ; <i1> [#uses=1]
+ br i1 %toBool.i.i, label %bb1.i.i, label %bb2.i.i
+
+bb1.i.i: ; preds = %bb.i.i
+ %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %44 = load i32** %43, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb2.i.i: ; preds = %bb.i.i
+ %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %46 = load i32** %45, align 4 ; <i32*> [#uses=1]
+ %47 = getelementptr i32* %46, i64 1 ; <i32*> [#uses=1]
+ %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %47, i32** %48, align 4
+ %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %50 = load i32** %49, align 4 ; <i32*> [#uses=1]
+ %51 = load i32* %50, align 4 ; <i32> [#uses=1]
+ %52 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %53 = icmp eq i32 %51, %52 ; <i1> [#uses=1]
+ %54 = zext i1 %53 to i8 ; <i8> [#uses=1]
+ %toBool3.i.i = icmp ne i8 %54, 0 ; <i1> [#uses=1]
+ br i1 %toBool3.i.i, label %bb4.i.i, label %bb5.i.i
+
+bb4.i.i: ; preds = %bb2.i.i
+ %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %56 = load i32** %55, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb5.i.i: ; preds = %bb2.i.i
+ %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %58 = load i32** %57, align 4 ; <i32*> [#uses=1]
+ %59 = getelementptr i32* %58, i64 1 ; <i32*> [#uses=1]
+ %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %59, i32** %60, align 4
+ %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %62 = load i32** %61, align 4 ; <i32*> [#uses=1]
+ %63 = load i32* %62, align 4 ; <i32> [#uses=1]
+ %64 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %65 = icmp eq i32 %63, %64 ; <i1> [#uses=1]
+ %66 = zext i1 %65 to i8 ; <i8> [#uses=1]
+ %toBool6.i.i = icmp ne i8 %66, 0 ; <i1> [#uses=1]
+ br i1 %toBool6.i.i, label %bb7.i.i, label %bb8.i.i
+
+bb7.i.i: ; preds = %bb5.i.i
+ %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %68 = load i32** %67, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb8.i.i: ; preds = %bb5.i.i
+ %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %70 = load i32** %69, align 4 ; <i32*> [#uses=1]
+ %71 = getelementptr i32* %70, i64 1 ; <i32*> [#uses=1]
+ %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %71, i32** %72, align 4
+ %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %74 = load i32** %73, align 4 ; <i32*> [#uses=1]
+ %75 = load i32* %74, align 4 ; <i32> [#uses=1]
+ %76 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %77 = icmp eq i32 %75, %76 ; <i1> [#uses=1]
+ %78 = zext i1 %77 to i8 ; <i8> [#uses=1]
+ %toBool9.i.i = icmp ne i8 %78, 0 ; <i1> [#uses=1]
+ br i1 %toBool9.i.i, label %bb10.i.i, label %bb11.i.i
+
+bb10.i.i: ; preds = %bb8.i.i
+ %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %80 = load i32** %79, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb11.i.i: ; preds = %bb8.i.i
+ %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %82 = load i32** %81, align 4 ; <i32*> [#uses=1]
+ %83 = getelementptr i32* %82, i64 1 ; <i32*> [#uses=1]
+ %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %83, i32** %84, align 4
+ %85 = sub i32 %__trip_count.0.i.i, 1 ; <i32> [#uses=1]
+ br label %bb12.i.i
+
+bb12.i.i: ; preds = %bb11.i.i, %entry
+ %__trip_count.0.i.i = phi i32 [ %36, %entry ], [ %85, %bb11.i.i ] ; <i32> [#uses=2]
+ %86 = icmp sgt i32 %__trip_count.0.i.i, 0 ; <i1> [#uses=1]
+ br i1 %86, label %bb.i.i, label %bb13.i.i
+
+bb13.i.i: ; preds = %bb12.i.i
+ %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %88 = load i32** %87, align 4 ; <i32*> [#uses=1]
+ %89 = ptrtoint i32* %88 to i32 ; <i32> [#uses=1]
+ %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %91 = load i32** %90, align 4 ; <i32*> [#uses=1]
+ %92 = ptrtoint i32* %91 to i32 ; <i32> [#uses=1]
+ %93 = sub i32 %89, %92 ; <i32> [#uses=1]
+ %94 = ashr i32 %93, 2 ; <i32> [#uses=1]
+ switch i32 %94, label %bb26.i.i [
+ i32 1, label %bb22.i.i
+ i32 2, label %bb18.i.i
+ i32 3, label %bb14.i.i
+ ]
+
+bb14.i.i: ; preds = %bb13.i.i
+ %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %96 = load i32** %95, align 4 ; <i32*> [#uses=1]
+ %97 = load i32* %96, align 4 ; <i32> [#uses=1]
+ %98 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %99 = icmp eq i32 %97, %98 ; <i1> [#uses=1]
+ %100 = zext i1 %99 to i8 ; <i8> [#uses=1]
+ %toBool15.i.i = icmp ne i8 %100, 0 ; <i1> [#uses=1]
+ br i1 %toBool15.i.i, label %bb16.i.i, label %bb17.i.i
+
+bb16.i.i: ; preds = %bb14.i.i
+ %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %102 = load i32** %101, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb17.i.i: ; preds = %bb14.i.i
+ %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %104 = load i32** %103, align 4 ; <i32*> [#uses=1]
+ %105 = getelementptr i32* %104, i64 1 ; <i32*> [#uses=1]
+ %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %105, i32** %106, align 4
+ br label %bb18.i.i
+
+bb18.i.i: ; preds = %bb17.i.i, %bb13.i.i
+ %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %108 = load i32** %107, align 4 ; <i32*> [#uses=1]
+ %109 = load i32* %108, align 4 ; <i32> [#uses=1]
+ %110 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %111 = icmp eq i32 %109, %110 ; <i1> [#uses=1]
+ %112 = zext i1 %111 to i8 ; <i8> [#uses=1]
+ %toBool19.i.i = icmp ne i8 %112, 0 ; <i1> [#uses=1]
+ br i1 %toBool19.i.i, label %bb20.i.i, label %bb21.i.i
+
+bb20.i.i: ; preds = %bb18.i.i
+ %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %114 = load i32** %113, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb21.i.i: ; preds = %bb18.i.i
+ %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %116 = load i32** %115, align 4 ; <i32*> [#uses=1]
+ %117 = getelementptr i32* %116, i64 1 ; <i32*> [#uses=1]
+ %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %117, i32** %118, align 4
+ br label %bb22.i.i
+
+bb22.i.i: ; preds = %bb21.i.i, %bb13.i.i
+ %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %120 = load i32** %119, align 4 ; <i32*> [#uses=1]
+ %121 = load i32* %120, align 4 ; <i32> [#uses=1]
+ %122 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %123 = icmp eq i32 %121, %122 ; <i1> [#uses=1]
+ %124 = zext i1 %123 to i8 ; <i8> [#uses=1]
+ %toBool23.i.i = icmp ne i8 %124, 0 ; <i1> [#uses=1]
+ br i1 %toBool23.i.i, label %bb24.i.i, label %bb25.i.i
+
+bb24.i.i: ; preds = %bb22.i.i
+ %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %126 = load i32** %125, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+bb25.i.i: ; preds = %bb22.i.i
+ %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %128 = load i32** %127, align 4 ; <i32*> [#uses=1]
+ %129 = getelementptr i32* %128, i64 1 ; <i32*> [#uses=1]
+ %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ store i32* %129, i32** %130, align 4
+ br label %bb26.i.i
+
+bb26.i.i: ; preds = %bb25.i.i, %bb13.i.i
+ %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1]
+ %132 = load i32** %131, align 4 ; <i32*> [#uses=1]
+ br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+
+_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit: ; preds = %bb26.i.i, %bb24.i.i, %bb20.i.i, %bb16.i.i, %bb10.i.i, %bb7.i.i, %bb4.i.i, %bb1.i.i
+ %.0.0.i.i = phi i32* [ %132, %bb26.i.i ], [ %126, %bb24.i.i ], [ %114, %bb20.i.i ], [ %102, %bb16.i.i ], [ %80, %bb10.i.i ], [ %68, %bb7.i.i ], [ %56, %bb4.i.i ], [ %44, %bb1.i.i ] ; <i32*> [#uses=1]
+ %tmp2.i.i = ptrtoint i32* %.0.0.i.i to i32 ; <i32> [#uses=1]
+ %tmp1.i.i = inttoptr i32 %tmp2.i.i to i32* ; <i32*> [#uses=1]
+ %tmp4.i = ptrtoint i32* %tmp1.i.i to i32 ; <i32> [#uses=1]
+ %tmp3.i = inttoptr i32 %tmp4.i to i32* ; <i32*> [#uses=1]
+ %tmp8.i = ptrtoint i32* %tmp3.i to i32 ; <i32> [#uses=1]
+ %tmp6.i = inttoptr i32 %tmp8.i to i32* ; <i32*> [#uses=1]
+ %tmp12 = ptrtoint i32* %tmp6.i to i32 ; <i32> [#uses=1]
+ %tmp10 = inttoptr i32 %tmp12 to i32* ; <i32*> [#uses=1]
+ %tmp16 = ptrtoint i32* %tmp10 to i32 ; <i32> [#uses=1]
+ br label %return
+
+return: ; preds = %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit
+ %tmp14 = inttoptr i32 %tmp16 to i32* ; <i32*> [#uses=1]
+ ret i32* %tmp14
+}
+
+declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind
diff --git a/test/Transforms/InstCombine/2009-02-21-LoadCST.ll b/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
new file mode 100644
index 000000000000..2c126df1f14d
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-02-21-LoadCST.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 3679669}
+; PR3595
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+@.str1 = internal constant [4 x i8] c"\B5%8\00"
+
+define i32 @test() {
+ %rhsv = load i32* bitcast ([4 x i8]* @.str1 to i32*), align 1
+ ret i32 %rhsv
+}
diff --git a/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll b/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll
new file mode 100644
index 000000000000..c59c5edcf2d1
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; PR3667
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define void @_ada_c32001b(i32 %tmp5) {
+entry:
+ %max289 = select i1 false, i32 %tmp5, i32 0 ; <i32> [#uses=1]
+ %tmp6 = mul i32 %max289, 4 ; <i32> [#uses=1]
+ %tmp7 = alloca i8, i32 0 ; <i8*> [#uses=1]
+ %tmp8 = bitcast i8* %tmp7 to [0 x [0 x i32]]* ; <[0 x [0 x i32]]*> [#uses=1]
+ %tmp11 = load i32* null, align 1 ; <i32> [#uses=1]
+ %tmp12 = icmp eq i32 %tmp11, 3 ; <i1> [#uses=1]
+ %tmp13 = zext i1 %tmp12 to i8 ; <i8> [#uses=1]
+ %tmp14 = ashr i32 %tmp6, 2 ; <i32> [#uses=1]
+ %tmp15 = bitcast [0 x [0 x i32]]* %tmp8 to i8* ; <i8*> [#uses=1]
+ %tmp16 = mul i32 %tmp14, 4 ; <i32> [#uses=1]
+ %tmp17 = mul i32 1, %tmp16 ; <i32> [#uses=1]
+ %tmp18 = getelementptr i8* %tmp15, i32 %tmp17 ; <i8*> [#uses=1]
+ %tmp19 = bitcast i8* %tmp18 to [0 x i32]* ; <[0 x i32]*> [#uses=1]
+ %tmp20 = bitcast [0 x i32]* %tmp19 to i32* ; <i32*> [#uses=1]
+ %tmp21 = getelementptr i32* %tmp20, i32 0 ; <i32*> [#uses=1]
+ %tmp22 = load i32* %tmp21, align 1 ; <i32> [#uses=1]
+ %tmp23 = icmp eq i32 %tmp22, 4 ; <i1> [#uses=1]
+ %tmp24 = zext i1 %tmp23 to i8 ; <i8> [#uses=1]
+ %toBool709 = icmp ne i8 %tmp13, 0 ; <i1> [#uses=1]
+ %toBool710 = icmp ne i8 %tmp24, 0 ; <i1> [#uses=1]
+ %tmp25 = and i1 %toBool709, %toBool710 ; <i1> [#uses=1]
+ %tmp26 = zext i1 %tmp25 to i8 ; <i8> [#uses=1]
+ %toBool711 = icmp ne i8 %tmp26, 0 ; <i1> [#uses=1]
+ br i1 %toBool711, label %a, label %b
+
+a: ; preds = %entry
+ ret void
+
+b: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll b/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll
new file mode 100644
index 000000000000..1e136f5eab33
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {getelementptr i32}
+; PR3694
+
+define i32 @e(i32 %m, i32 %n) nounwind {
+entry:
+ %0 = alloca i32, i32 %n, align 4 ; <i32*> [#uses=2]
+ %1 = bitcast i32* %0 to [0 x i32]* ; <[0 x i32]*> [#uses=1]
+ call void @f(i32* %0) nounwind
+ %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ ret i32 %3
+}
+
+declare void @f(i32*)
diff --git a/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll b/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
new file mode 100644
index 000000000000..ae690cf9a519
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; PR3826
+
+define void @0(<4 x i16>*, <4 x i16>*) {
+ %3 = alloca <4 x i16>* ; <<4 x i16>**> [#uses=1]
+ %4 = load <4 x i16>* null, align 1 ; <<4 x i16>> [#uses=1]
+ %5 = ashr <4 x i16> %4, <i16 5, i16 5, i16 5, i16 5> ; <<4 x i16>> [#uses=1]
+ %6 = load <4 x i16>** %3 ; <<4 x i16>*> [#uses=1]
+ store <4 x i16> %5, <4 x i16>* %6, align 1
+ ret void
+}
diff --git a/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll b/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll
new file mode 100644
index 000000000000..92ace11f8f39
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ashr i32 %val, 31}
+; PR3851
+
+define i32 @foo2(i32 %val) nounwind {
+entry:
+ %shr = ashr i32 %val, 15 ; <i32> [#uses=3]
+ %shr4 = ashr i32 %shr, 17 ; <i32> [#uses=1]
+ ret i32 %shr4
+ }
diff --git a/test/Transforms/InstCombine/2009-03-24-InfLoop.ll b/test/Transforms/InstCombine/2009-03-24-InfLoop.ll
new file mode 100644
index 000000000000..6d5a7bf77d2b
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-03-24-InfLoop.ll
@@ -0,0 +1,9 @@
+; PR3874
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+ define i1 @test(i32 %x) {
+ %A = lshr i32 3968, %x
+ %B = and i32 %A, 1
+ %C = icmp eq i32 %B, 0
+ ret i1 %C
+ }
+
diff --git a/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll b/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll
new file mode 100644
index 000000000000..49e1f0af6794
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+; rdar://6762290
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %T = type <{ i64, i64, i64 }>
+
+define i32 @test(i8* %start, i32 %X) nounwind {
+entry:
+ %tmp3 = load i64* null ; <i64> [#uses=1]
+ %add.ptr = getelementptr i8* %start, i64 %tmp3 ; <i8*> [#uses=1]
+ %tmp158 = load i32* null ; <i32> [#uses=1]
+ %add.ptr159 = getelementptr %T* null, i32 %tmp158
+ %add.ptr209 = getelementptr i8* %start, i64 0 ; <i8*> [#uses=1]
+ %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X ; <i8*> [#uses=1]
+ %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr ; <i1> [#uses=1]
+ br i1 %cmp214, label %if.then216, label %if.end363
+
+if.then216: ; preds = %for.body162
+ ret i32 1
+
+if.end363: ; preds = %for.body162
+ ret i32 0
+}
diff --git a/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll b/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll
new file mode 100644
index 000000000000..82f876298191
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {mul i64}
+; rdar://6762288
+
+; Instcombine should not promote the mul to i96 because it is definitely
+; not a legal type for the target, and we don't want a libcall.
+
+define i96 @test(i96 %a.4, i96 %b.2) {
+ %tmp1086 = trunc i96 %a.4 to i64 ; <i64> [#uses=1]
+ %tmp836 = trunc i96 %b.2 to i64 ; <i64> [#uses=1]
+ %mul185 = mul i64 %tmp1086, %tmp836 ; <i64> [#uses=1]
+ %tmp544 = zext i64 %mul185 to i96 ; <i96> [#uses=1]
+ ret i96 %tmp544
+}
diff --git a/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll b/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll
new file mode 100644
index 000000000000..1eda7dfa9ec7
--- /dev/null
+++ b/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep cmp
+; rdar://6903175
+
+define i1 @f0(i32 *%a) nounwind {
+ %b = load i32* %a, align 4
+ %c = uitofp i32 %b to double
+ %d = fcmp ogt double %c, 0x41EFFFFFFFE00000
+ ret i1 %d
+}
diff --git a/test/Transforms/InstCombine/CPP_min_max.ll b/test/Transforms/InstCombine/CPP_min_max.ll
new file mode 100644
index 000000000000..785b91e79e49
--- /dev/null
+++ b/test/Transforms/InstCombine/CPP_min_max.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep select | not grep {i32\\*}
+
+; This testcase corresponds to PR362, which notices that this horrible code
+; is generated by the C++ front-end and LLVM optimizers, which has lots of
+; loads and other stuff that are unneeded.
+;
+; Instcombine should propagate the load through the select instructions to
+; allow elimination of the extra stuff by the mem2reg pass.
+
+define void @_Z5test1RiS_(i32* %x, i32* %y) {
+entry:
+ %tmp.1.i = load i32* %y ; <i32> [#uses=1]
+ %tmp.3.i = load i32* %x ; <i32> [#uses=1]
+ %tmp.4.i = icmp slt i32 %tmp.1.i, %tmp.3.i ; <i1> [#uses=1]
+ %retval.i = select i1 %tmp.4.i, i32* %y, i32* %x ; <i32*> [#uses=1]
+ %tmp.4 = load i32* %retval.i ; <i32> [#uses=1]
+ store i32 %tmp.4, i32* %x
+ ret void
+}
+
+define void @_Z5test2RiS_(i32* %x, i32* %y) {
+entry:
+ %tmp.0 = alloca i32 ; <i32*> [#uses=2]
+ %tmp.2 = load i32* %x ; <i32> [#uses=2]
+ store i32 %tmp.2, i32* %tmp.0
+ %tmp.3.i = load i32* %y ; <i32> [#uses=1]
+ %tmp.4.i = icmp slt i32 %tmp.2, %tmp.3.i ; <i1> [#uses=1]
+ %retval.i = select i1 %tmp.4.i, i32* %y, i32* %tmp.0 ; <i32*> [#uses=1]
+ %tmp.6 = load i32* %retval.i ; <i32> [#uses=1]
+ store i32 %tmp.6, i32* %y
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/GEPIdxCanon.ll b/test/Transforms/InstCombine/GEPIdxCanon.ll
new file mode 100644
index 000000000000..f2e5e6745b48
--- /dev/null
+++ b/test/Transforms/InstCombine/GEPIdxCanon.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \
+; RUN: llvm-dis | not grep getelementptr
+
+define i1 @test(i32* %A) {
+ %B = getelementptr i32* %A, i32 1 ; <i32*> [#uses=1]
+ %C = getelementptr i32* %A, i64 1 ; <i32*> [#uses=1]
+ %V = icmp eq i32* %B, %C ; <i1> [#uses=1]
+ ret i1 %V
+}
+
diff --git a/test/Transforms/InstCombine/IntPtrCast.ll b/test/Transforms/InstCombine/IntPtrCast.ll
new file mode 100644
index 000000000000..e24d199f8c45
--- /dev/null
+++ b/test/Transforms/InstCombine/IntPtrCast.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+target datalayout = "e-p:32:32"
+
+define i32* @test(i32* %P) {
+ %V = ptrtoint i32* %P to i32 ; <i32> [#uses=1]
+ %P2 = inttoptr i32 %V to i32* ; <i32*> [#uses=1]
+ ret i32* %P2
+}
+
diff --git a/test/Transforms/InstCombine/JavaCompare.ll b/test/Transforms/InstCombine/JavaCompare.ll
new file mode 100644
index 000000000000..72cab427d07f
--- /dev/null
+++ b/test/Transforms/InstCombine/JavaCompare.ll
@@ -0,0 +1,14 @@
+; This is the sequence of stuff that the Java front-end expands for a single
+; <= comparison. Check to make sure we turn it into a <= (only)
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%c3 = icmp sle i32 %A, %B}
+
+define i1 @le(i32 %A, i32 %B) {
+ %c1 = icmp sgt i32 %A, %B ; <i1> [#uses=1]
+ %tmp = select i1 %c1, i32 1, i32 0 ; <i32> [#uses=1]
+ %c2 = icmp slt i32 %A, %B ; <i1> [#uses=1]
+ %result = select i1 %c2, i32 -1, i32 %tmp ; <i32> [#uses=1]
+ %c3 = icmp sle i32 %result, 0 ; <i1> [#uses=1]
+ ret i1 %c3
+}
+
diff --git a/test/Transforms/InstCombine/README.txt b/test/Transforms/InstCombine/README.txt
new file mode 100644
index 000000000000..de043c774891
--- /dev/null
+++ b/test/Transforms/InstCombine/README.txt
@@ -0,0 +1,4 @@
+This directory contains test cases for the instcombine transformation. The
+dated tests are actual bug tests, whereas the named tests are used to test
+for features that the this pass should be capable of performing.
+
diff --git a/test/Transforms/InstCombine/add-shrink.ll b/test/Transforms/InstCombine/add-shrink.ll
new file mode 100644
index 000000000000..6dc02f361c97
--- /dev/null
+++ b/test/Transforms/InstCombine/add-shrink.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i32}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sext | count 1
+
+; Should only have one sext and the add should be i32 instead of i64.
+
+define i64 @test1(i32 %A) {
+ %B = ashr i32 %A, 7 ; <i32> [#uses=1]
+ %C = ashr i32 %A, 9 ; <i32> [#uses=1]
+ %D = sext i32 %B to i64 ; <i64> [#uses=1]
+ %E = sext i32 %C to i64 ; <i64> [#uses=1]
+ %F = add i64 %D, %E ; <i64> [#uses=1]
+ ret i64 %F
+}
+
diff --git a/test/Transforms/InstCombine/add-sitofp.ll b/test/Transforms/InstCombine/add-sitofp.ll
new file mode 100644
index 000000000000..35c6567da6d1
--- /dev/null
+++ b/test/Transforms/InstCombine/add-sitofp.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i32}
+
+define double @x(i32 %a, i32 %b) nounwind {
+ %m = lshr i32 %a, 24
+ %n = and i32 %m, %b
+ %o = sitofp i32 %n to double
+ %p = add double %o, 1.0
+ ret double %p
+}
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll
new file mode 100644
index 000000000000..6ff2187474f7
--- /dev/null
+++ b/test/Transforms/InstCombine/add.ll
@@ -0,0 +1,277 @@
+; This test makes sure that add instructions are properly eliminated.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v OK | not grep add
+
+define i32 @test1(i32 %A) {
+ %B = add i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) {
+ %B = add i32 %A, 5 ; <i32> [#uses=1]
+ %C = add i32 %B, -5 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test3(i32 %A) {
+ %B = add i32 %A, 5 ; <i32> [#uses=1]
+ ;; This should get converted to an add
+ %C = sub i32 %B, 5 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test4(i32 %A, i32 %B) {
+ %C = sub i32 0, %A ; <i32> [#uses=1]
+ ; D = B + -A = B - A
+ %D = add i32 %B, %C ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test5(i32 %A, i32 %B) {
+ %C = sub i32 0, %A ; <i32> [#uses=1]
+ ; D = -A + B = B - A
+ %D = add i32 %C, %B ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test6(i32 %A) {
+ %B = mul i32 7, %A ; <i32> [#uses=1]
+ ; C = 7*A+A == 8*A == A << 3
+ %C = add i32 %B, %A ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test7(i32 %A) {
+ %B = mul i32 7, %A ; <i32> [#uses=1]
+ ; C = A+7*A == 8*A == A << 3
+ %C = add i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+; (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+define i32 @test8(i32 %A, i32 %B) {
+ %A1 = and i32 %A, 7 ; <i32> [#uses=1]
+ %B1 = and i32 %B, 128 ; <i32> [#uses=1]
+ %C = add i32 %A1, %B1 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test9(i32 %A) {
+ %B = shl i32 %A, 4 ; <i32> [#uses=2]
+ ; === shl int %A, 5
+ %C = add i32 %B, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i1 @test10(i8 %A, i8 %b) {
+ %B = add i8 %A, %b ; <i8> [#uses=1]
+ ; === A != -b
+ %c = icmp ne i8 %B, 0 ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i1 @test11(i8 %A) {
+ %B = add i8 %A, -1 ; <i8> [#uses=1]
+ ; === A != 1
+ %c = icmp ne i8 %B, 0 ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i32 @test12(i32 %A, i32 %B) {
+ ; Should be transformed into shl A, 1
+ %C_OK = add i32 %B, %A ; <i32> [#uses=1]
+ br label %X
+
+X: ; preds = %0
+ %D = add i32 %C_OK, %A ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test13(i32 %A, i32 %B, i32 %C) {
+ %D_OK = add i32 %A, %B ; <i32> [#uses=1]
+ %E_OK = add i32 %D_OK, %C ; <i32> [#uses=1]
+ ;; shl A, 1
+ %F = add i32 %E_OK, %A ; <i32> [#uses=1]
+ ret i32 %F
+}
+
+define i32 @test14(i32 %offset, i32 %difference) {
+ %tmp.2 = and i32 %difference, 3 ; <i32> [#uses=1]
+ %tmp.3_OK = add i32 %tmp.2, %offset ; <i32> [#uses=1]
+ %tmp.5.mask = and i32 %difference, -4 ; <i32> [#uses=1]
+ ; == add %offset, %difference
+ %tmp.8 = add i32 %tmp.3_OK, %tmp.5.mask ; <i32> [#uses=1]
+ ret i32 %tmp.8
+}
+
+define i8 @test15(i8 %A) {
+ ; Does not effect result
+ %B = add i8 %A, -64 ; <i8> [#uses=1]
+ ; Only one bit set
+ %C = and i8 %B, 16 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i8 @test16(i8 %A) {
+ ; Turn this into a XOR
+ %B = add i8 %A, 16 ; <i8> [#uses=1]
+ ; Only one bit set
+ %C = and i8 %B, 16 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i32 @test17(i32 %A) {
+ %B = xor i32 %A, -1 ; <i32> [#uses=1]
+ ; == sub int 0, %A
+ %C = add i32 %B, 1 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i8 @test18(i8 %A) {
+ %B = xor i8 %A, -1 ; <i8> [#uses=1]
+ ; == sub ubyte 16, %A
+ %C = add i8 %B, 17 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i32 @test19(i1 %C) {
+ %A = select i1 %C, i32 1000, i32 10 ; <i32> [#uses=1]
+ %V = add i32 %A, 123 ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @test20(i32 %x) {
+ %tmp.2 = xor i32 %x, -2147483648 ; <i32> [#uses=1]
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i32 %tmp.2, -2147483648 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+}
+
+define i1 @test21(i32 %x) {
+ %t = add i32 %x, 4 ; <i32> [#uses=1]
+ %y = icmp eq i32 %t, 123 ; <i1> [#uses=1]
+ ret i1 %y
+}
+
+define i32 @test22(i32 %V) {
+ %V2 = add i32 %V, 10 ; <i32> [#uses=1]
+ switch i32 %V2, label %Default [
+ i32 20, label %Lab1
+ i32 30, label %Lab2
+ ]
+
+Default: ; preds = %0
+ ret i32 123
+
+Lab1: ; preds = %0
+ ret i32 12312
+
+Lab2: ; preds = %0
+ ret i32 1231231
+}
+
+define i32 @test23(i1 %C, i32 %a) {
+entry:
+ br i1 %C, label %endif, label %else
+
+else: ; preds = %entry
+ br label %endif
+
+endif: ; preds = %else, %entry
+ %b.0 = phi i32 [ 0, %entry ], [ 1, %else ] ; <i32> [#uses=1]
+ %tmp.4 = add i32 %b.0, 1 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+}
+
+define i32 @test24(i32 %A) {
+ %B = add i32 %A, 1 ; <i32> [#uses=1]
+ %C = shl i32 %B, 1 ; <i32> [#uses=1]
+ %D = sub i32 %C, 2 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i64 @test25(i64 %Y) {
+ %tmp.4 = shl i64 %Y, 2 ; <i64> [#uses=1]
+ %tmp.12 = shl i64 %Y, 2 ; <i64> [#uses=1]
+ %tmp.8 = add i64 %tmp.4, %tmp.12 ; <i64> [#uses=1]
+ ret i64 %tmp.8
+}
+
+define i32 @test26(i32 %A, i32 %B) {
+ %C = add i32 %A, %B ; <i32> [#uses=1]
+ %D = sub i32 %C, %B ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test27(i1 %C, i32 %X, i32 %Y) {
+ %A = add i32 %X, %Y ; <i32> [#uses=1]
+ %B = add i32 %Y, 123 ; <i32> [#uses=1]
+ ;; Fold add through select.
+ %C.upgrd.1 = select i1 %C, i32 %A, i32 %B ; <i32> [#uses=1]
+ %D = sub i32 %C.upgrd.1, %Y ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test28(i32 %X) {
+ %Y = add i32 %X, 1234 ; <i32> [#uses=1]
+ %Z = sub i32 42, %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test29(i32 %X, i32 %x) {
+ %tmp.2 = sub i32 %X, %x ; <i32> [#uses=2]
+ %tmp.2.mask = and i32 %tmp.2, 63 ; <i32> [#uses=1]
+ %tmp.6 = add i32 %tmp.2.mask, %x ; <i32> [#uses=1]
+ %tmp.7 = and i32 %tmp.6, 63 ; <i32> [#uses=1]
+ %tmp.9 = and i32 %tmp.2, -64 ; <i32> [#uses=1]
+ %tmp.10 = or i32 %tmp.7, %tmp.9 ; <i32> [#uses=1]
+ ret i32 %tmp.10
+}
+
+define i64 @test30(i64 %x) {
+ %tmp.2 = xor i64 %x, -9223372036854775808 ; <i64> [#uses=1]
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i64 %tmp.2, -9223372036854775808 ; <i64> [#uses=1]
+ ret i64 %tmp.4
+}
+
+define i32 @test31(i32 %A) {
+ %B = add i32 %A, 4 ; <i32> [#uses=1]
+ %C = mul i32 %B, 5 ; <i32> [#uses=1]
+ %D = sub i32 %C, 20 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test32(i32 %A) {
+ %B = add i32 %A, 4 ; <i32> [#uses=1]
+ %C = shl i32 %B, 2 ; <i32> [#uses=1]
+ %D = sub i32 %C, 16 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i8 @test33(i8 %A) {
+ %B = and i8 %A, -2 ; <i8> [#uses=1]
+ %C = add i8 %B, 1 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i8 @test34(i8 %A) {
+ %B = add i8 %A, 64 ; <i8> [#uses=1]
+ %C = and i8 %B, 12 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i32 @test35(i32 %a) {
+ %tmpnot = xor i32 %a, -1 ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmpnot, %a ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define i32 @test36(i32 %a) {
+ %x = and i32 %a, -2
+ %y = and i32 %a, -126
+ %z = add i32 %x, %y
+ %q = and i32 %z, 1 ; always zero
+ ret i32 %q
+}
diff --git a/test/Transforms/InstCombine/add2.ll b/test/Transforms/InstCombine/add2.ll
new file mode 100644
index 000000000000..161d56b40b57
--- /dev/null
+++ b/test/Transforms/InstCombine/add2.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v OK | not grep add
+
+;; Target triple for gep raising case below.
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+
+define i64 @test1(i64 %A, i32 %B) {
+ %tmp12 = zext i32 %B to i64
+ %tmp3 = shl i64 %tmp12, 32
+ %tmp5 = add i64 %tmp3, %A
+ %tmp6 = and i64 %tmp5, 123
+ ret i64 %tmp6
+}
+
+; PR1795
+define void @test2(i32 %.val24) {
+EntryBlock:
+ add i32 %.val24, -12
+ inttoptr i32 %0 to i32*
+ store i32 1, i32* %1
+ add i32 %.val24, -16
+ inttoptr i32 %2 to i32*
+ getelementptr i32* %3, i32 1
+ load i32* %4
+ tail call i32 @callee( i32 %5 )
+ ret void
+}
+
+declare i32 @callee(i32)
+
+
+define i32 @test3(i32 %A) {
+ %B = and i32 %A, 7
+ %C = and i32 %A, 32
+ %F = add i32 %B, %C
+ ret i32 %F
+}
+
+define i32 @test4(i32 %A) {
+ %B = and i32 %A, 128
+ %C = lshr i32 %A, 30
+ %F = add i32 %B, %C
+ ret i32 %F
+}
+
diff --git a/test/Transforms/InstCombine/addnegneg.ll b/test/Transforms/InstCombine/addnegneg.ll
new file mode 100644
index 000000000000..f3b9565a51e1
--- /dev/null
+++ b/test/Transforms/InstCombine/addnegneg.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep { sub } | count 1
+; PR2047
+
+define i32 @l(i32 %a, i32 %b, i32 %c, i32 %d) {
+entry:
+ %b.neg = sub i32 0, %b ; <i32> [#uses=1]
+ %c.neg = sub i32 0, %c ; <i32> [#uses=1]
+ %sub4 = add i32 %c.neg, %b.neg ; <i32> [#uses=1]
+ %sub6 = add i32 %sub4, %d ; <i32> [#uses=1]
+ ret i32 %sub6
+}
+
diff --git a/test/Transforms/InstCombine/adjust-for-sminmax.ll b/test/Transforms/InstCombine/adjust-for-sminmax.ll
new file mode 100644
index 000000000000..9328ad364995
--- /dev/null
+++ b/test/Transforms/InstCombine/adjust-for-sminmax.ll
@@ -0,0 +1,85 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp s\[lg\]t i32 %n, 0} | count 16
+
+; Instcombine should recognize that this code can be adjusted
+; to fit the canonical smax/smin pattern.
+
+define i32 @floor_a(i32 %n) {
+ %t = icmp sgt i32 %n, -1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_a(i32 %n) {
+ %t = icmp slt i32 %n, 1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_b(i32 %n) {
+ %t = icmp sgt i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_b(i32 %n) {
+ %t = icmp slt i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_c(i32 %n) {
+ %t = icmp sge i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_c(i32 %n) {
+ %t = icmp sle i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_d(i32 %n) {
+ %t = icmp sge i32 %n, 1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_d(i32 %n) {
+ %t = icmp sle i32 %n, -1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_e(i32 %n) {
+ %t = icmp sgt i32 %n, -1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_e(i32 %n) {
+ %t = icmp slt i32 %n, 1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_f(i32 %n) {
+ %t = icmp sgt i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_f(i32 %n) {
+ %t = icmp slt i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_g(i32 %n) {
+ %t = icmp sge i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_g(i32 %n) {
+ %t = icmp sle i32 %n, 0
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @floor_h(i32 %n) {
+ %t = icmp sge i32 %n, 1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
+define i32 @ceil_h(i32 %n) {
+ %t = icmp sle i32 %n, -1
+ %m = select i1 %t, i32 %n, i32 0
+ ret i32 %m
+}
diff --git a/test/Transforms/InstCombine/align-2d-gep.ll b/test/Transforms/InstCombine/align-2d-gep.ll
new file mode 100644
index 000000000000..c826e31da1f9
--- /dev/null
+++ b/test/Transforms/InstCombine/align-2d-gep.ll
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 16} | count 1
+
+; A multi-dimensional array in a nested loop doing vector stores that
+; aren't yet aligned. Instcombine can understand the addressing in the
+; Nice case to prove 16 byte alignment. In the Awkward case, the inner
+; array dimension is not even, so the stores to it won't always be
+; aligned. Instcombine should prove alignment in exactly one of the two
+; stores.
+
+@Nice = global [1001 x [20000 x double]] zeroinitializer, align 32
+@Awkward = global [1001 x [20001 x double]] zeroinitializer, align 32
+
+define void @foo() nounwind {
+entry:
+ br label %bb7.outer
+
+bb7.outer:
+ %i = phi i64 [ 0, %entry ], [ %indvar.next26, %bb11 ]
+ br label %bb1
+
+bb1:
+ %j = phi i64 [ 0, %bb7.outer ], [ %indvar.next, %bb1 ]
+
+ %t4 = getelementptr [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j
+ %q = bitcast double* %t4 to <2 x double>*
+ store <2 x double><double 0.0, double 0.0>, <2 x double>* %q, align 8
+
+ %s4 = getelementptr [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j
+ %r = bitcast double* %s4 to <2 x double>*
+ store <2 x double><double 0.0, double 0.0>, <2 x double>* %r, align 8
+
+ %indvar.next = add i64 %j, 2
+ %exitcond = icmp eq i64 %indvar.next, 557
+ br i1 %exitcond, label %bb11, label %bb1
+
+bb11:
+ %indvar.next26 = add i64 %i, 1
+ %exitcond27 = icmp eq i64 %indvar.next26, 991
+ br i1 %exitcond27, label %return.split, label %bb7.outer
+
+return.split:
+ ret void
+}
diff --git a/test/Transforms/InstCombine/align-addr.ll b/test/Transforms/InstCombine/align-addr.ll
new file mode 100644
index 000000000000..a05c513dcbb3
--- /dev/null
+++ b/test/Transforms/InstCombine/align-addr.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 16} | count 1
+
+; Instcombine should be able to prove vector alignment in the
+; presence of a few mild address computation tricks.
+
+define void @foo(i8* %b, i64 %n, i64 %u, i64 %y) nounwind {
+entry:
+ %c = ptrtoint i8* %b to i64
+ %d = and i64 %c, -16
+ %e = inttoptr i64 %d to double*
+ %v = mul i64 %u, 2
+ %z = and i64 %y, -2
+ %t1421 = icmp eq i64 %n, 0
+ br i1 %t1421, label %return, label %bb
+
+bb:
+ %i = phi i64 [ %indvar.next, %bb ], [ 20, %entry ]
+ %j = mul i64 %i, %v
+ %h = add i64 %j, %z
+ %t8 = getelementptr double* %e, i64 %h
+ %p = bitcast double* %t8 to <2 x double>*
+ store <2 x double><double 0.0, double 0.0>, <2 x double>* %p, align 8
+ %indvar.next = add i64 %i, 1
+ %exitcond = icmp eq i64 %indvar.next, %n
+ br i1 %exitcond, label %return, label %bb
+
+return:
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/align-inc.ll b/test/Transforms/InstCombine/align-inc.ll
new file mode 100644
index 000000000000..104d9918a9c7
--- /dev/null
+++ b/test/Transforms/InstCombine/align-inc.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {GLOBAL.*align 16}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {tmp = load}
+
+@GLOBAL = internal global [4 x i32] zeroinitializer
+
+define <16 x i8> @foo(<2 x i64> %x) {
+entry:
+ %tmp = load <16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x i8>*), align 1
+ ret <16 x i8> %tmp
+}
+
diff --git a/test/Transforms/InstCombine/alloca.ll b/test/Transforms/InstCombine/alloca.ll
new file mode 100644
index 000000000000..95d0f094ae3f
--- /dev/null
+++ b/test/Transforms/InstCombine/alloca.ll
@@ -0,0 +1,31 @@
+; Zero byte allocas should be deleted.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep alloca
+; END.
+
+declare void @use(...)
+
+define void @test() {
+ %X = alloca [0 x i32] ; <[0 x i32]*> [#uses=1]
+ call void (...)* @use( [0 x i32]* %X )
+ %Y = alloca i32, i32 0 ; <i32*> [#uses=1]
+ call void (...)* @use( i32* %Y )
+ %Z = alloca { } ; <{ }*> [#uses=1]
+ call void (...)* @use( { }* %Z )
+ ret void
+}
+
+define void @test2() {
+ %A = alloca i32 ; <i32*> [#uses=1]
+ store i32 123, i32* %A
+ ret void
+}
+
+define void @test3() {
+ %A = alloca { i32 } ; <{ i32 }*> [#uses=1]
+ %B = getelementptr { i32 }* %A, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 123, i32* %B
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/and-compare.ll b/test/Transforms/InstCombine/and-compare.ll
new file mode 100644
index 000000000000..d2f2753f887e
--- /dev/null
+++ b/test/Transforms/InstCombine/and-compare.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep and | count 1
+
+; Should be optimized to one and.
+define i1 @test1(i32 %a, i32 %b) {
+ %tmp1 = and i32 %a, 65280 ; <i32> [#uses=1]
+ %tmp3 = and i32 %b, 65280 ; <i32> [#uses=1]
+ %tmp = icmp ne i32 %tmp1, %tmp3 ; <i1> [#uses=1]
+ ret i1 %tmp
+}
+
diff --git a/test/Transforms/InstCombine/and-fcmp.ll b/test/Transforms/InstCombine/and-fcmp.ll
new file mode 100644
index 000000000000..55efffa34ff5
--- /dev/null
+++ b/test/Transforms/InstCombine/and-fcmp.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fcmp | count 3
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | grep 0
+
+define zeroext i8 @t1(float %x, float %y) nounwind {
+ %a = fcmp ueq float %x, %y
+ %b = fcmp ord float %x, %y
+ %c = and i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
+
+define zeroext i8 @t2(float %x, float %y) nounwind {
+ %a = fcmp olt float %x, %y
+ %b = fcmp ord float %x, %y
+ %c = and i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
+
+define zeroext i8 @t3(float %x, float %y) nounwind {
+ %a = fcmp oge float %x, %y
+ %b = fcmp uno float %x, %y
+ %c = and i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
+
+define zeroext i8 @t4(float %x, float %y) nounwind {
+ %a = fcmp one float %y, %x
+ %b = fcmp ord float %x, %y
+ %c = and i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
diff --git a/test/Transforms/InstCombine/and-not-or.ll b/test/Transforms/InstCombine/and-not-or.ll
new file mode 100644
index 000000000000..9e9f397c4be3
--- /dev/null
+++ b/test/Transforms/InstCombine/and-not-or.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %x, %y} | count 4
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {or}
+
+define i32 @func1(i32 %x, i32 %y) nounwind {
+entry:
+ %n = xor i32 %y, -1
+ %o = or i32 %n, %x
+ %a = and i32 %o, %y
+ ret i32 %a
+}
+
+define i32 @func2(i32 %x, i32 %y) nounwind {
+entry:
+ %n = xor i32 %y, -1
+ %o = or i32 %x, %n
+ %a = and i32 %o, %y
+ ret i32 %a
+}
+
+define i32 @func3(i32 %x, i32 %y) nounwind {
+entry:
+ %n = xor i32 %y, -1
+ %o = or i32 %n, %x
+ %a = and i32 %y, %o
+ ret i32 %a
+}
+
+define i32 @func4(i32 %x, i32 %y) nounwind {
+entry:
+ %n = xor i32 %y, -1
+ %o = or i32 %x, %n
+ %a = and i32 %y, %o
+ ret i32 %a
+}
diff --git a/test/Transforms/InstCombine/and-or-and.ll b/test/Transforms/InstCombine/and-or-and.ll
new file mode 100644
index 000000000000..04d475ccd822
--- /dev/null
+++ b/test/Transforms/InstCombine/and-or-and.ll
@@ -0,0 +1,61 @@
+; If we have an 'and' of the result of an 'or', and one of the 'or' operands
+; cannot have contributed any of the resultant bits, delete the or. This
+; occurs for very common C/C++ code like this:
+;
+; struct foo { int A : 16; int B : 16; };
+; void test(struct foo *F, int X, int Y) {
+; F->A = X; F->B = Y;
+; }
+;
+; Which corresponds to test1.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {or }
+
+define i32 @test1(i32 %X, i32 %Y) {
+ %A = and i32 %X, 7 ; <i32> [#uses=1]
+ %B = and i32 %Y, 8 ; <i32> [#uses=1]
+ %C = or i32 %A, %B ; <i32> [#uses=1]
+ ;; This cannot include any bits from %Y!
+ %D = and i32 %C, 7 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test2(i32 %X, i8 %Y) {
+ %B = zext i8 %Y to i32 ; <i32> [#uses=1]
+ %C = or i32 %X, %B ; <i32> [#uses=1]
+ ;; This cannot include any bits from %Y!
+ %D = and i32 %C, 65536 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test3(i32 %X, i32 %Y) {
+ %B = shl i32 %Y, 1 ; <i32> [#uses=1]
+ %C = or i32 %X, %B ; <i32> [#uses=1]
+ ;; This cannot include any bits from %Y!
+ %D = and i32 %C, 1 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test4(i32 %X, i32 %Y) {
+ %B = lshr i32 %Y, 31 ; <i32> [#uses=1]
+ %C = or i32 %X, %B ; <i32> [#uses=1]
+ ;; This cannot include any bits from %Y!
+ %D = and i32 %C, 2 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @or_test1(i32 %X, i32 %Y) {
+ %A = and i32 %X, 1 ; <i32> [#uses=1]
+ ;; This cannot include any bits from X!
+ %B = or i32 %A, 1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i8 @or_test2(i8 %X, i8 %Y) {
+ %A = shl i8 %X, 7 ; <i8> [#uses=1]
+ ;; This cannot include any bits from X!
+ %B = or i8 %A, -128 ; <i8> [#uses=1]
+ ret i8 %B
+}
+
diff --git a/test/Transforms/InstCombine/and-or-not.ll b/test/Transforms/InstCombine/and-or-not.ll
new file mode 100644
index 000000000000..8fc53a7e0acb
--- /dev/null
+++ b/test/Transforms/InstCombine/and-or-not.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | count 4
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep { or}
+
+; PR1510
+
+; These are all equivelent to A^B
+
+define i32 @test1(i32 %a, i32 %b) {
+entry:
+ %tmp3 = or i32 %b, %a ; <i32> [#uses=1]
+ %tmp3not = xor i32 %tmp3, -1 ; <i32> [#uses=1]
+ %tmp6 = and i32 %b, %a ; <i32> [#uses=1]
+ %tmp7 = or i32 %tmp6, %tmp3not ; <i32> [#uses=1]
+ %tmp7not = xor i32 %tmp7, -1 ; <i32> [#uses=1]
+ ret i32 %tmp7not
+}
+
+define i32 @test2(i32 %a, i32 %b) {
+entry:
+ %tmp3 = or i32 %b, %a ; <i32> [#uses=1]
+ %tmp6 = and i32 %b, %a ; <i32> [#uses=1]
+ %tmp6not = xor i32 %tmp6, -1 ; <i32> [#uses=1]
+ %tmp7 = and i32 %tmp3, %tmp6not ; <i32> [#uses=1]
+ ret i32 %tmp7
+}
+
+define <4 x i32> @test3(<4 x i32> %a, <4 x i32> %b) {
+entry:
+ %tmp3 = or <4 x i32> %a, %b ; <<4 x i32>> [#uses=1]
+ %tmp3not = xor <4 x i32> %tmp3, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
+ %tmp6 = and <4 x i32> %a, %b ; <<4 x i32>> [#uses=1]
+ %tmp7 = or <4 x i32> %tmp6, %tmp3not ; <<4 x i32>> [#uses=1]
+ %tmp7not = xor <4 x i32> %tmp7, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
+ ret <4 x i32> %tmp7not
+}
+
+define <4 x i32> @test4(<4 x i32> %a, <4 x i32> %b) {
+entry:
+ %tmp3 = or <4 x i32> %a, %b ; <<4 x i32>> [#uses=1]
+ %tmp6 = and <4 x i32> %a, %b ; <<4 x i32>> [#uses=1]
+ %tmp6not = xor <4 x i32> %tmp6, < i32 -1, i32 -1, i32 -1, i32 -1 > ; <<4 x i32>> [#uses=1]
+ %tmp7 = and <4 x i32> %tmp3, %tmp6not ; <<4 x i32>> [#uses=1]
+ ret <4 x i32> %tmp7
+}
+
diff --git a/test/Transforms/InstCombine/and-or.ll b/test/Transforms/InstCombine/and-or.ll
new file mode 100644
index 000000000000..38ad842e015f
--- /dev/null
+++ b/test/Transforms/InstCombine/and-or.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %a, 1} | count 4
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {or i32 %0, %b} | count 4
+
+
+define i32 @func1(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %0 = or i32 %b, %a ; <i32> [#uses=1]
+ %1 = and i32 %0, 1 ; <i32> [#uses=1]
+ %2 = and i32 %b, -2 ; <i32> [#uses=1]
+ %3 = or i32 %1, %2 ; <i32> [#uses=1]
+ ret i32 %3
+}
+
+define i32 @func2(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %0 = or i32 %a, %b ; <i32> [#uses=1]
+ %1 = and i32 1, %0 ; <i32> [#uses=1]
+ %2 = and i32 -2, %b ; <i32> [#uses=1]
+ %3 = or i32 %1, %2 ; <i32> [#uses=1]
+ ret i32 %3
+}
+
+define i32 @func3(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %0 = or i32 %b, %a ; <i32> [#uses=1]
+ %1 = and i32 %0, 1 ; <i32> [#uses=1]
+ %2 = and i32 %b, -2 ; <i32> [#uses=1]
+ %3 = or i32 %2, %1 ; <i32> [#uses=1]
+ ret i32 %3
+}
+
+define i32 @func4(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %0 = or i32 %a, %b ; <i32> [#uses=1]
+ %1 = and i32 1, %0 ; <i32> [#uses=1]
+ %2 = and i32 -2, %b ; <i32> [#uses=1]
+ %3 = or i32 %2, %1 ; <i32> [#uses=1]
+ ret i32 %3
+}
diff --git a/test/Transforms/InstCombine/and-xor-merge.ll b/test/Transforms/InstCombine/and-xor-merge.ll
new file mode 100644
index 000000000000..85f8026ab572
--- /dev/null
+++ b/test/Transforms/InstCombine/and-xor-merge.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | count 1
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | count 2
+
+; (x&z) ^ (y&z) -> (x^y)&z
+define i32 @test1(i32 %x, i32 %y, i32 %z) {
+ %tmp3 = and i32 %z, %x
+ %tmp6 = and i32 %z, %y
+ %tmp7 = xor i32 %tmp3, %tmp6
+ ret i32 %tmp7
+}
+
+; (x & y) ^ (x|y) -> x^y
+define i32 @test2(i32 %x, i32 %y, i32 %z) {
+ %tmp3 = and i32 %y, %x
+ %tmp6 = or i32 %y, %x
+ %tmp7 = xor i32 %tmp3, %tmp6
+ ret i32 %tmp7
+}
+
diff --git a/test/Transforms/InstCombine/and.ll b/test/Transforms/InstCombine/and.ll
new file mode 100644
index 000000000000..edab47e87cf1
--- /dev/null
+++ b/test/Transforms/InstCombine/and.ll
@@ -0,0 +1,255 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and
+
+define i32 @test1(i32 %A) {
+ ; zero result
+ %B = and i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) {
+ ; noop
+ %B = and i32 %A, -1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i1 @test3(i1 %A) {
+ ; always = false
+ %B = and i1 %A, false ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test4(i1 %A) {
+ ; noop
+ %B = and i1 %A, true ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i32 @test5(i32 %A) {
+ %B = and i32 %A, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i1 @test6(i1 %A) {
+ %B = and i1 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+; A & ~A == 0
+define i32 @test7(i32 %A) {
+ %NotA = xor i32 %A, -1 ; <i32> [#uses=1]
+ %B = and i32 %A, %NotA ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+; AND associates
+define i8 @test8(i8 %A) {
+ %B = and i8 %A, 3 ; <i8> [#uses=1]
+ %C = and i8 %B, 4 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i1 @test9(i32 %A) {
+ ; Test of sign bit, convert to setle %A, 0
+ %B = and i32 %A, -2147483648 ; <i32> [#uses=1]
+ %C = icmp ne i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test9a(i32 %A) {
+ ; Test of sign bit, convert to setle %A, 0
+ %B = and i32 %A, -2147483648 ; <i32> [#uses=1]
+ %C = icmp ne i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i32 @test10(i32 %A) {
+ %B = and i32 %A, 12 ; <i32> [#uses=1]
+ %C = xor i32 %B, 15 ; <i32> [#uses=1]
+ ; (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
+ %D = and i32 %C, 1 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test11(i32 %A, i32* %P) {
+ %B = or i32 %A, 3 ; <i32> [#uses=1]
+ %C = xor i32 %B, 12 ; <i32> [#uses=2]
+ ; additional use of C
+ store i32 %C, i32* %P
+ ; %C = and uint %B, 3 --> 3
+ %D = and i32 %C, 3 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i1 @test12(i32 %A, i32 %B) {
+ %C1 = icmp ult i32 %A, %B ; <i1> [#uses=1]
+ %C2 = icmp ule i32 %A, %B ; <i1> [#uses=1]
+ ; (A < B) & (A <= B) === (A < B)
+ %D = and i1 %C1, %C2 ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test13(i32 %A, i32 %B) {
+ %C1 = icmp ult i32 %A, %B ; <i1> [#uses=1]
+ %C2 = icmp ugt i32 %A, %B ; <i1> [#uses=1]
+ ; (A < B) & (A > B) === false
+ %D = and i1 %C1, %C2 ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test14(i8 %A) {
+ %B = and i8 %A, -128 ; <i8> [#uses=1]
+ %C = icmp ne i8 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i8 @test15(i8 %A) {
+ %B = lshr i8 %A, 7 ; <i8> [#uses=1]
+ ; Always equals zero
+ %C = and i8 %B, 2 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i8 @test16(i8 %A) {
+ %B = shl i8 %A, 2 ; <i8> [#uses=1]
+ %C = and i8 %B, 3 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+;; ~(~X & Y) --> (X | ~Y)
+define i8 @test17(i8 %X, i8 %Y) {
+ %B = xor i8 %X, -1 ; <i8> [#uses=1]
+ %C = and i8 %B, %Y ; <i8> [#uses=1]
+ %D = xor i8 %C, -1 ; <i8> [#uses=1]
+ ret i8 %D
+}
+
+define i1 @test18(i32 %A) {
+ %B = and i32 %A, -128 ; <i32> [#uses=1]
+ ;; C >= 128
+ %C = icmp ne i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test18a(i8 %A) {
+ %B = and i8 %A, -2 ; <i8> [#uses=1]
+ %C = icmp eq i8 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i32 @test19(i32 %A) {
+ %B = shl i32 %A, 3 ; <i32> [#uses=1]
+ ;; Clearing a zero bit
+ %C = and i32 %B, -2 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i8 @test20(i8 %A) {
+ %C = lshr i8 %A, 7 ; <i8> [#uses=1]
+ ;; Unneeded
+ %D = and i8 %C, 1 ; <i8> [#uses=1]
+ ret i8 %D
+}
+
+define i1 @test22(i32 %A) {
+ %B = icmp eq i32 %A, 1 ; <i1> [#uses=1]
+ %C = icmp sge i32 %A, 3 ; <i1> [#uses=1]
+ ;; false
+ %D = and i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test23(i32 %A) {
+ %B = icmp sgt i32 %A, 1 ; <i1> [#uses=1]
+ %C = icmp sle i32 %A, 2 ; <i1> [#uses=1]
+ ;; A == 2
+ %D = and i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test24(i32 %A) {
+ %B = icmp sgt i32 %A, 1 ; <i1> [#uses=1]
+ %C = icmp ne i32 %A, 2 ; <i1> [#uses=1]
+ ;; A > 2
+ %D = and i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test25(i32 %A) {
+ %B = icmp sge i32 %A, 50 ; <i1> [#uses=1]
+ %C = icmp slt i32 %A, 100 ; <i1> [#uses=1]
+ ;; (A-50) <u 50
+ %D = and i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test26(i32 %A) {
+ %B = icmp ne i32 %A, 50 ; <i1> [#uses=1]
+ %C = icmp ne i32 %A, 51 ; <i1> [#uses=1]
+ ;; (A-50) > 1
+ %D = and i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i8 @test27(i8 %A) {
+ %B = and i8 %A, 4 ; <i8> [#uses=1]
+ %C = sub i8 %B, 16 ; <i8> [#uses=1]
+ ;; 0xF0
+ %D = and i8 %C, -16 ; <i8> [#uses=1]
+ %E = add i8 %D, 16 ; <i8> [#uses=1]
+ ret i8 %E
+}
+
+;; This is juse a zero extending shr.
+define i32 @test28(i32 %X) {
+ ;; Sign extend
+ %Y = ashr i32 %X, 24 ; <i32> [#uses=1]
+ ;; Mask out sign bits
+ %Z = and i32 %Y, 255 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test29(i8 %X) {
+ %Y = zext i8 %X to i32 ; <i32> [#uses=1]
+ ;; Zero extend makes this unneeded.
+ %Z = and i32 %Y, 255 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test30(i1 %X) {
+ %Y = zext i1 %X to i32 ; <i32> [#uses=1]
+ %Z = and i32 %Y, 1 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test31(i1 %X) {
+ %Y = zext i1 %X to i32 ; <i32> [#uses=1]
+ %Z = shl i32 %Y, 4 ; <i32> [#uses=1]
+ %A = and i32 %Z, 16 ; <i32> [#uses=1]
+ ret i32 %A
+}
+
+define i32 @test32(i32 %In) {
+ %Y = and i32 %In, 16 ; <i32> [#uses=1]
+ %Z = lshr i32 %Y, 2 ; <i32> [#uses=1]
+ %A = and i32 %Z, 1 ; <i32> [#uses=1]
+ ret i32 %A
+}
+
+;; Code corresponding to one-bit bitfield ^1.
+define i32 @test33(i32 %b) {
+ %tmp.4.mask = and i32 %b, 1 ; <i32> [#uses=1]
+ %tmp.10 = xor i32 %tmp.4.mask, 1 ; <i32> [#uses=1]
+ %tmp.12 = and i32 %b, -2 ; <i32> [#uses=1]
+ %tmp.13 = or i32 %tmp.12, %tmp.10 ; <i32> [#uses=1]
+ ret i32 %tmp.13
+}
+
+define i32 @test34(i32 %A, i32 %B) {
+ %tmp.2 = or i32 %B, %A ; <i32> [#uses=1]
+ %tmp.4 = and i32 %tmp.2, %B ; <i32> [#uses=1]
+ ret i32 %tmp.4
+}
+
diff --git a/test/Transforms/InstCombine/and2.ll b/test/Transforms/InstCombine/and2.ll
new file mode 100644
index 000000000000..3b80d94e1a61
--- /dev/null
+++ b/test/Transforms/InstCombine/and2.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and
+
+
+; PR1738
+define i1 @test1(double %X, double %Y) {
+ %tmp9 = fcmp ord double %X, 0.000000e+00
+ %tmp13 = fcmp ord double %Y, 0.000000e+00
+ %bothcond = and i1 %tmp13, %tmp9
+ ret i1 %bothcond
+}
+
+
diff --git a/test/Transforms/InstCombine/apint-add1.ll b/test/Transforms/InstCombine/apint-add1.ll
new file mode 100644
index 000000000000..74280ee7f7ca
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-add1.ll
@@ -0,0 +1,34 @@
+; This test makes sure that add instructions are properly eliminated.
+; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v OK | not grep add
+
+
+define i1 @test1(i1 %x) {
+ %tmp.2 = xor i1 %x, 1
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i1 %tmp.2, 1
+ ret i1 %tmp.4
+}
+
+define i47 @test2(i47 %x) {
+ %tmp.2 = xor i47 %x, 70368744177664
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i47 %tmp.2, 70368744177664
+ ret i47 %tmp.4
+}
+
+define i15 @test3(i15 %x) {
+ %tmp.2 = xor i15 %x, 16384
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i15 %tmp.2, 16384
+ ret i15 %tmp.4
+}
+
+define i49 @test6(i49 %x) {
+ ;; (x & 254)+1 -> (x & 254)|1
+ %tmp.2 = and i49 %x, 562949953421310
+ %tmp.4 = add i49 %tmp.2, 1
+ ret i49 %tmp.4
+}
diff --git a/test/Transforms/InstCombine/apint-add2.ll b/test/Transforms/InstCombine/apint-add2.ll
new file mode 100644
index 000000000000..0ddfcc0764d6
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-add2.ll
@@ -0,0 +1,46 @@
+; This test makes sure that add instructions are properly eliminated.
+; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v OK | not grep add
+; END.
+
+define i111 @test1(i111 %x) {
+ %tmp.2 = shl i111 1, 110
+ %tmp.4 = xor i111 %x, %tmp.2
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.6 = add i111 %tmp.4, %tmp.2
+ ret i111 %tmp.6
+}
+
+define i65 @test2(i65 %x) {
+ %tmp.0 = shl i65 1, 64
+ %tmp.2 = xor i65 %x, %tmp.0
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i65 %tmp.2, %tmp.0
+ ret i65 %tmp.4
+}
+
+define i1024 @test3(i1024 %x) {
+ %tmp.0 = shl i1024 1, 1023
+ %tmp.2 = xor i1024 %x, %tmp.0
+ ;; Add of sign bit -> xor of sign bit.
+ %tmp.4 = add i1024 %tmp.2, %tmp.0
+ ret i1024 %tmp.4
+}
+
+define i128 @test4(i128 %x) {
+ ;; If we have ADD(XOR(AND(X, 0xFF), 0xF..F80), 0x80), it's a sext.
+ %tmp.5 = shl i128 1, 127
+ %tmp.1 = ashr i128 %tmp.5, 120
+ %tmp.2 = xor i128 %x, %tmp.1
+ %tmp.4 = add i128 %tmp.2, %tmp.5
+ ret i128 %tmp.4
+}
+
+define i77 @test6(i77 %x) {
+ ;; (x & 254)+1 -> (x & 254)|1
+ %tmp.2 = and i77 %x, 562949953421310
+ %tmp.4 = add i77 %tmp.2, 1
+ ret i77 %tmp.4
+}
diff --git a/test/Transforms/InstCombine/apint-and-compare.ll b/test/Transforms/InstCombine/apint-and-compare.ll
new file mode 100644
index 000000000000..ad2e41d718ef
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-and-compare.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | count 2
+
+; Should be optimized to one and.
+define i1 @test1(i33 %a, i33 %b) {
+ %tmp1 = and i33 %a, 65280
+ %tmp3 = and i33 %b, 65280
+ %tmp = icmp ne i33 %tmp1, %tmp3
+ ret i1 %tmp
+}
+
+define i1 @test2(i999 %a, i999 %b) {
+ %tmp1 = and i999 %a, 65280
+ %tmp3 = and i999 %b, 65280
+ %tmp = icmp ne i999 %tmp1, %tmp3
+ ret i1 %tmp
+}
diff --git a/test/Transforms/InstCombine/apint-and-or-and.ll b/test/Transforms/InstCombine/apint-and-or-and.ll
new file mode 100644
index 000000000000..4630f2867865
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-and-or-and.ll
@@ -0,0 +1,50 @@
+; If we have an 'and' of the result of an 'or', and one of the 'or' operands
+; cannot have contributed any of the resultant bits, delete the or. This
+; occurs for very common C/C++ code like this:
+;
+; struct foo { int A : 16; int B : 16; };
+; void test(struct foo *F, int X, int Y) {
+; F->A = X; F->B = Y;
+; }
+;
+; Which corresponds to test1.
+;
+; This tests arbitrary precision integers.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {or }
+; END.
+
+define i17 @test1(i17 %X, i17 %Y) {
+ %A = and i17 %X, 7
+ %B = and i17 %Y, 8
+ %C = or i17 %A, %B
+ %D = and i17 %C, 7 ;; This cannot include any bits from %Y!
+ ret i17 %D
+}
+
+define i49 @test3(i49 %X, i49 %Y) {
+ %B = shl i49 %Y, 1
+ %C = or i49 %X, %B
+ %D = and i49 %C, 1 ;; This cannot include any bits from %Y!
+ ret i49 %D
+}
+
+define i67 @test4(i67 %X, i67 %Y) {
+ %B = lshr i67 %Y, 66
+ %C = or i67 %X, %B
+ %D = and i67 %C, 2 ;; This cannot include any bits from %Y!
+ ret i67 %D
+}
+
+define i231 @or_test1(i231 %X, i231 %Y) {
+ %A = and i231 %X, 1
+ %B = or i231 %A, 1 ;; This cannot include any bits from X!
+ ret i231 %B
+}
+
+define i7 @or_test2(i7 %X, i7 %Y) {
+ %A = shl i7 %X, 6
+ %B = or i7 %A, 64 ;; This cannot include any bits from X!
+ ret i7 %B
+}
+
diff --git a/test/Transforms/InstCombine/apint-and-xor-merge.ll b/test/Transforms/InstCombine/apint-and-xor-merge.ll
new file mode 100644
index 000000000000..e1e4e3caaef0
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-and-xor-merge.ll
@@ -0,0 +1,22 @@
+; This test case checks that the merge of and/xor can work on arbitrary
+; precision integers.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | count 1
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | count 2
+
+; (x &z ) ^ (y & z) -> (x ^ y) & z
+define i57 @test1(i57 %x, i57 %y, i57 %z) {
+ %tmp3 = and i57 %z, %x
+ %tmp6 = and i57 %z, %y
+ %tmp7 = xor i57 %tmp3, %tmp6
+ ret i57 %tmp7
+}
+
+; (x & y) ^ (x | y) -> x ^ y
+define i23 @test2(i23 %x, i23 %y, i23 %z) {
+ %tmp3 = and i23 %y, %x
+ %tmp6 = or i23 %y, %x
+ %tmp7 = xor i23 %tmp3, %tmp6
+ ret i23 %tmp7
+}
+
diff --git a/test/Transforms/InstCombine/apint-and1.ll b/test/Transforms/InstCombine/apint-and1.ll
new file mode 100644
index 000000000000..eb3b1a64b2ce
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-and1.ll
@@ -0,0 +1,57 @@
+; This test makes sure that and instructions are properly eliminated.
+; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and }
+; END.
+
+define i39 @test0(i39 %A) {
+ %B = and i39 %A, 0 ; zero result
+ ret i39 %B
+}
+
+define i47 @test1(i47 %A, i47 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i47 %A, -1
+ %NotB = xor i47 %B, -1
+ %C1 = and i47 %NotA, %NotB
+ ret i47 %C1
+}
+
+define i15 @test2(i15 %x) {
+ %tmp.2 = and i15 %x, -1 ; noop
+ ret i15 %tmp.2
+}
+
+define i23 @test3(i23 %x) {
+ %tmp.0 = and i23 %x, 127
+ %tmp.2 = and i23 %tmp.0, 128
+ ret i23 %tmp.2
+}
+
+define i1 @test4(i37 %x) {
+ %A = and i37 %x, -2147483648
+ %B = icmp ne i37 %A, 0
+ ret i1 %B
+}
+
+define i7 @test5(i7 %A, i7* %P) {
+ %B = or i7 %A, 3
+ %C = xor i7 %B, 12
+ store i7 %C, i7* %P
+ %r = and i7 %C, 3
+ ret i7 %r
+}
+
+define i7 @test6(i7 %A, i7 %B) {
+ ;; ~(~X & Y) --> (X | ~Y)
+ %t0 = xor i7 %A, -1
+ %t1 = and i7 %t0, %B
+ %r = xor i7 %t1, -1
+ ret i7 %r
+}
+
+define i47 @test7(i47 %A) {
+ %X = ashr i47 %A, 39 ;; sign extend
+ %C1 = and i47 %X, 255
+ ret i47 %C1
+}
diff --git a/test/Transforms/InstCombine/apint-and2.ll b/test/Transforms/InstCombine/apint-and2.ll
new file mode 100644
index 000000000000..f7b3934d5b83
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-and2.ll
@@ -0,0 +1,82 @@
+; This test makes sure that and instructions are properly eliminated.
+; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and }
+; END.
+
+
+define i999 @test0(i999 %A) {
+ %B = and i999 %A, 0 ; zero result
+ ret i999 %B
+}
+
+define i477 @test1(i477 %A, i477 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i477 %A, -1
+ %NotB = xor i477 %B, -1
+ %C1 = and i477 %NotA, %NotB
+ ret i477 %C1
+}
+
+define i129 @tst(i129 %A, i129 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i129 %A, -1
+ %NotB = xor i129 %B, -1
+ %C1 = and i129 %NotA, %NotB
+ ret i129 %C1
+}
+
+define i65 @test(i65 %A, i65 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i65 %A, -1
+ %NotB = xor i65 -1, %B
+ %C1 = and i65 %NotA, %NotB
+ ret i65 %C1
+}
+
+define i66 @tes(i66 %A, i66 %B) {
+ ;; (~A & ~B) == (~(A | B)) - De Morgan's Law
+ %NotA = xor i66 %A, -1
+ %NotB = xor i66 %B, -1
+ %C1 = and i66 %NotA, %NotB
+ ret i66 %C1
+}
+
+define i1005 @test2(i1005 %x) {
+ %tmp.2 = and i1005 %x, -1 ; noop
+ ret i1005 %tmp.2
+}
+
+define i123 @test3(i123 %x) {
+ %tmp.0 = and i123 %x, 127
+ %tmp.2 = and i123 %tmp.0, 128
+ ret i123 %tmp.2
+}
+
+define i1 @test4(i737 %x) {
+ %A = and i737 %x, -2147483648
+ %B = icmp ne i737 %A, 0
+ ret i1 %B
+}
+
+define i117 @test5(i117 %A, i117* %P) {
+ %B = or i117 %A, 3
+ %C = xor i117 %B, 12
+ store i117 %C, i117* %P
+ %r = and i117 %C, 3
+ ret i117 %r
+}
+
+define i117 @test6(i117 %A, i117 %B) {
+ ;; ~(~X & Y) --> (X | ~Y)
+ %t0 = xor i117 %A, -1
+ %t1 = and i117 %t0, %B
+ %r = xor i117 %t1, -1
+ ret i117 %r
+}
+
+define i1024 @test7(i1024 %A) {
+ %X = ashr i1024 %A, 1016 ;; sign extend
+ %C1 = and i1024 %X, 255
+ ret i1024 %C1
+}
diff --git a/test/Transforms/InstCombine/apint-call-cast-target.ll b/test/Transforms/InstCombine/apint-call-cast-target.ll
new file mode 100644
index 000000000000..3688fbe1f293
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-call-cast-target.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep call | not grep bitcast
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+
+
+define i32 @main() {
+entry:
+ %tmp = call i32 bitcast (i7* (i999*)* @ctime to i32 (i99*)*)( i99* null )
+ ret i32 %tmp
+}
+
+define i7* @ctime(i999*) {
+entry:
+ %tmp = call i7* bitcast (i32 ()* @main to i7* ()*)( )
+ ret i7* %tmp
+}
diff --git a/test/Transforms/InstCombine/apint-cast-and-cast.ll b/test/Transforms/InstCombine/apint-cast-and-cast.ll
new file mode 100644
index 000000000000..337fd7c2d722
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-cast-and-cast.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+
+define i19 @test1(i43 %val) {
+ %t1 = bitcast i43 %val to i43
+ %t2 = and i43 %t1, 1
+ %t3 = trunc i43 %t2 to i19
+ ret i19 %t3
+}
+
+define i73 @test2(i677 %val) {
+ %t1 = bitcast i677 %val to i677
+ %t2 = and i677 %t1, 1
+ %t3 = trunc i677 %t2 to i73
+ ret i73 %t3
+}
diff --git a/test/Transforms/InstCombine/apint-cast-cast-to-and.ll b/test/Transforms/InstCombine/apint-cast-cast-to-and.ll
new file mode 100644
index 000000000000..29a88694d5c5
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-cast-cast-to-and.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep i41
+
+define i61 @test1(i61 %X) {
+ %Y = trunc i61 %X to i41 ;; Turn i61o an AND
+ %Z = zext i41 %Y to i61
+ ret i61 %Z
+}
+
diff --git a/test/Transforms/InstCombine/apint-cast.ll b/test/Transforms/InstCombine/apint-cast.ll
new file mode 100644
index 000000000000..dd0014640021
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-cast.ll
@@ -0,0 +1,20 @@
+; Tests to make sure elimination of casts is working correctly
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i17 @test1(i17 %a) {
+ %tmp = zext i17 %a to i37 ; <i37> [#uses=2]
+ %tmp21 = lshr i37 %tmp, 8 ; <i37> [#uses=1]
+ %tmp5 = shl i37 %tmp, 8 ; <i37> [#uses=1]
+ %tmp.upgrd.32 = or i37 %tmp21, %tmp5 ; <i37> [#uses=1]
+ %tmp.upgrd.3 = trunc i37 %tmp.upgrd.32 to i17 ; <i17> [#uses=1]
+ ret i17 %tmp.upgrd.3
+}
+
+define i167 @test2(i167 %a) {
+ %tmp = zext i167 %a to i577 ; <i577> [#uses=2]
+ %tmp21 = lshr i577 %tmp, 9 ; <i577> [#uses=1]
+ %tmp5 = shl i577 %tmp, 8 ; <i577> [#uses=1]
+ %tmp.upgrd.32 = or i577 %tmp21, %tmp5 ; <i577> [#uses=1]
+ %tmp.upgrd.3 = trunc i577 %tmp.upgrd.32 to i167 ; <i167> [#uses=1]
+ ret i167 %tmp.upgrd.3
+}
diff --git a/test/Transforms/InstCombine/apint-div1.ll b/test/Transforms/InstCombine/apint-div1.ll
new file mode 100644
index 000000000000..e9aa579b9583
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-div1.ll
@@ -0,0 +1,22 @@
+; This test makes sure that div instructions are properly eliminated.
+; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
+
+
+define i33 @test1(i33 %X) {
+ %Y = udiv i33 %X, 4096
+ ret i33 %Y
+}
+
+define i49 @test2(i49 %X) {
+ %tmp.0 = shl i49 4096, 17
+ %Y = udiv i49 %X, %tmp.0
+ ret i49 %Y
+}
+
+define i59 @test3(i59 %X, i1 %C) {
+ %V = select i1 %C, i59 1024, i59 4096
+ %R = udiv i59 %X, %V
+ ret i59 %R
+}
diff --git a/test/Transforms/InstCombine/apint-div2.ll b/test/Transforms/InstCombine/apint-div2.ll
new file mode 100644
index 000000000000..2aa2c3a4ac2c
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-div2.ll
@@ -0,0 +1,22 @@
+; This test makes sure that div instructions are properly eliminated.
+; This test is for Integer BitWidth >= 64 && BitWidth <= 1024.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
+
+
+define i333 @test1(i333 %X) {
+ %Y = udiv i333 %X, 70368744177664
+ ret i333 %Y
+}
+
+define i499 @test2(i499 %X) {
+ %tmp.0 = shl i499 4096, 197
+ %Y = udiv i499 %X, %tmp.0
+ ret i499 %Y
+}
+
+define i599 @test3(i599 %X, i1 %C) {
+ %V = select i1 %C, i599 70368744177664, i599 4096
+ %R = udiv i599 %X, %V
+ ret i599 %R
+}
diff --git a/test/Transforms/InstCombine/apint-elim-logicalops.ll b/test/Transforms/InstCombine/apint-elim-logicalops.ll
new file mode 100644
index 000000000000..13d032cacf21
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-elim-logicalops.ll
@@ -0,0 +1,39 @@
+; Test that elimination of logical operators works with
+; arbitrary precision integers.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {(and\|xor\|add\|shl\|shr)}
+; END.
+
+define i33 @test1(i33 %x) {
+ %tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
+ %tmp.2 = xor i33 %tmp.1, -32768 ; <i33> [#uses=1]
+ %tmp.3 = add i33 %tmp.2, 32768 ; <i33> [#uses=1]
+ ret i33 %tmp.3
+}
+
+define i33 @test2(i33 %x) {
+ %tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
+ %tmp.2 = xor i33 %tmp.1, 32768 ; <i33> [#uses=1]
+ %tmp.3 = add i33 %tmp.2, -32768 ; <i33> [#uses=1]
+ ret i33 %tmp.3
+}
+
+define i33 @test3(i16 %P) {
+ %tmp.1 = zext i16 %P to i33 ; <i33> [#uses=1]
+ %tmp.4 = xor i33 %tmp.1, 32768 ; <i33> [#uses=1]
+ %tmp.5 = add i33 %tmp.4, -32768 ; <i33> [#uses=1]
+ ret i33 %tmp.5
+}
+
+define i33 @test5(i33 %x) {
+ %tmp.1 = and i33 %x, 254
+ %tmp.2 = xor i33 %tmp.1, 128
+ %tmp.3 = add i33 %tmp.2, -128
+ ret i33 %tmp.3
+}
+
+define i33 @test6(i33 %x) {
+ %tmp.2 = shl i33 %x, 16 ; <i33> [#uses=1]
+ %tmp.4 = lshr i33 %tmp.2, 16 ; <i33> [#uses=1]
+ ret i33 %tmp.4
+}
diff --git a/test/Transforms/InstCombine/apint-mul1.ll b/test/Transforms/InstCombine/apint-mul1.ll
new file mode 100644
index 000000000000..36b1102580c9
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-mul1.ll
@@ -0,0 +1,11 @@
+; This test makes sure that mul instructions are properly eliminated.
+; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0.
+;
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
+
+
+define i17 @test1(i17 %X) {
+ %Y = mul i17 %X, 1024
+ ret i17 %Y
+}
diff --git a/test/Transforms/InstCombine/apint-mul2.ll b/test/Transforms/InstCombine/apint-mul2.ll
new file mode 100644
index 000000000000..72fd97ac79f0
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-mul2.ll
@@ -0,0 +1,12 @@
+; This test makes sure that mul instructions are properly eliminated.
+; This test is for Integer BitWidth >= 64 && BitWidth % 2 >= 1024.
+;
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
+
+
+define i177 @test1(i177 %X) {
+ %C = shl i177 1, 155
+ %Y = mul i177 %X, %C
+ ret i177 %Y
+}
diff --git a/test/Transforms/InstCombine/apint-not.ll b/test/Transforms/InstCombine/apint-not.ll
new file mode 100644
index 000000000000..f557fa8b1788
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-not.ll
@@ -0,0 +1,42 @@
+; This test makes sure that the xor instructions are properly eliminated
+; when arbitrary precision integers are used.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor
+
+define i33 @test1(i33 %A) {
+ %B = xor i33 %A, -1
+ %C = xor i33 %B, -1
+ ret i33 %C
+}
+
+define i1 @test2(i52 %A, i52 %B) {
+ %cond = icmp ule i52 %A, %B ; Can change into uge
+ %Ret = xor i1 %cond, true
+ ret i1 %Ret
+}
+
+; Test that demorgans law can be instcombined
+define i47 @test3(i47 %A, i47 %B) {
+ %a = xor i47 %A, -1
+ %b = xor i47 %B, -1
+ %c = and i47 %a, %b
+ %d = xor i47 %c, -1
+ ret i47 %d
+}
+
+; Test that demorgens law can work with constants
+define i61 @test4(i61 %A, i61 %B) {
+ %a = xor i61 %A, -1
+ %c = and i61 %a, 5 ; 5 = ~c2
+ %d = xor i61 %c, -1
+ ret i61 %d
+}
+
+; test the mirror of demorgans law...
+define i71 @test5(i71 %A, i71 %B) {
+ %a = xor i71 %A, -1
+ %b = xor i71 %B, -1
+ %c = or i71 %a, %b
+ %d = xor i71 %c, -1
+ ret i71 %d
+}
diff --git a/test/Transforms/InstCombine/apint-or1.ll b/test/Transforms/InstCombine/apint-or1.ll
new file mode 100644
index 000000000000..51b87fe2a200
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-or1.ll
@@ -0,0 +1,36 @@
+; This test makes sure that or instructions are properly eliminated.
+; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0.
+;
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or
+
+
+define i7 @test0(i7 %X) {
+ %Y = or i7 %X, 0
+ ret i7 %Y
+}
+
+define i17 @test1(i17 %X) {
+ %Y = or i17 %X, -1
+ ret i17 %Y
+}
+
+define i23 @test2(i23 %A) {
+ ;; A | ~A == -1
+ %NotA = xor i23 -1, %A
+ %B = or i23 %A, %NotA
+ ret i23 %B
+}
+
+define i39 @test3(i39 %V, i39 %M) {
+ ;; If we have: ((V + N) & C1) | (V & C2)
+ ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
+ ;; replace with V+N.
+ %C1 = xor i39 274877906943, -1 ;; C2 = 274877906943
+ %N = and i39 %M, 274877906944
+ %A = add i39 %V, %N
+ %B = and i39 %A, %C1
+ %D = and i39 %V, 274877906943
+ %R = or i39 %B, %D
+ ret i39 %R
+}
diff --git a/test/Transforms/InstCombine/apint-or2.ll b/test/Transforms/InstCombine/apint-or2.ll
new file mode 100644
index 000000000000..21dc5654ceec
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-or2.ll
@@ -0,0 +1,35 @@
+; This test makes sure that or instructions are properly eliminated.
+; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or
+
+
+define i777 @test0(i777 %X) {
+ %Y = or i777 %X, 0
+ ret i777 %Y
+}
+
+define i117 @test1(i117 %X) {
+ %Y = or i117 %X, -1
+ ret i117 %Y
+}
+
+define i1023 @test2(i1023 %A) {
+ ;; A | ~A == -1
+ %NotA = xor i1023 -1, %A
+ %B = or i1023 %A, %NotA
+ ret i1023 %B
+}
+
+define i399 @test3(i399 %V, i399 %M) {
+ ;; If we have: ((V + N) & C1) | (V & C2)
+ ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
+ ;; replace with V+N.
+ %C1 = xor i399 274877906943, -1 ;; C2 = 274877906943
+ %N = and i399 %M, 18446742974197923840
+ %A = add i399 %V, %N
+ %B = and i399 %A, %C1
+ %D = and i399 %V, 274877906943
+ %R = or i399 %B, %D
+ ret i399 %R
+}
diff --git a/test/Transforms/InstCombine/apint-rem1.ll b/test/Transforms/InstCombine/apint-rem1.ll
new file mode 100644
index 000000000000..2ec8c749972d
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-rem1.ll
@@ -0,0 +1,22 @@
+; This test makes sure that these instructions are properly eliminated.
+; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
+
+
+define i33 @test1(i33 %A) {
+ %B = urem i33 %A, 4096
+ ret i33 %B
+}
+
+define i49 @test2(i49 %A) {
+ %B = shl i49 4096, 11
+ %Y = urem i49 %A, %B
+ ret i49 %Y
+}
+
+define i59 @test3(i59 %X, i1 %C) {
+ %V = select i1 %C, i59 70368744177664, i59 4096
+ %R = urem i59 %X, %V
+ ret i59 %R
+}
diff --git a/test/Transforms/InstCombine/apint-rem2.ll b/test/Transforms/InstCombine/apint-rem2.ll
new file mode 100644
index 000000000000..4d22c22d5401
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-rem2.ll
@@ -0,0 +1,22 @@
+; This test makes sure that these instructions are properly eliminated.
+; This test is for Integer BitWidth >= 64 && BitWidth <= 1024.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
+
+
+define i333 @test1(i333 %A) {
+ %B = urem i333 %A, 70368744177664
+ ret i333 %B
+}
+
+define i499 @test2(i499 %A) {
+ %B = shl i499 4096, 111
+ %Y = urem i499 %A, %B
+ ret i499 %Y
+}
+
+define i599 @test3(i599 %X, i1 %C) {
+ %V = select i1 %C, i599 70368744177664, i599 4096
+ %R = urem i599 %X, %V
+ ret i599 %R
+}
diff --git a/test/Transforms/InstCombine/apint-select.ll b/test/Transforms/InstCombine/apint-select.ll
new file mode 100644
index 000000000000..c2399fb88efe
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-select.ll
@@ -0,0 +1,44 @@
+; This test makes sure that these instructions are properly eliminated.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select
+
+
+define i41 @test1(i1 %C) {
+ %V = select i1 %C, i41 1, i41 0 ; V = C
+ ret i41 %V
+}
+
+define i999 @test2(i1 %C) {
+ %V = select i1 %C, i999 0, i999 1 ; V = C
+ ret i999 %V
+}
+
+define i41 @test3(i41 %X) {
+ ;; (x <s 0) ? -1 : 0 -> ashr x, 31
+ %t = icmp slt i41 %X, 0
+ %V = select i1 %t, i41 -1, i41 0
+ ret i41 %V
+}
+
+define i1023 @test4(i1023 %X) {
+ ;; (x <s 0) ? -1 : 0 -> ashr x, 31
+ %t = icmp slt i1023 %X, 0
+ %V = select i1 %t, i1023 -1, i1023 0
+ ret i1023 %V
+}
+
+define i41 @test5(i41 %X) {
+ ;; ((X & 27) ? 27 : 0)
+ %Y = and i41 %X, 32
+ %t = icmp ne i41 %Y, 0
+ %V = select i1 %t, i41 32, i41 0
+ ret i41 %V
+}
+
+define i1023 @test6(i1023 %X) {
+ ;; ((X & 27) ? 27 : 0)
+ %Y = and i1023 %X, 64
+ %t = icmp ne i1023 %Y, 0
+ %V = select i1 %t, i1023 64, i1023 0
+ ret i1023 %V
+}
diff --git a/test/Transforms/InstCombine/apint-shift-simplify.ll b/test/Transforms/InstCombine/apint-shift-simplify.ll
new file mode 100644
index 000000000000..a0046fbacb6b
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-shift-simplify.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: egrep {shl|lshr|ashr} | count 3
+
+define i41 @test0(i41 %A, i41 %B, i41 %C) {
+ %X = shl i41 %A, %C
+ %Y = shl i41 %B, %C
+ %Z = and i41 %X, %Y
+ ret i41 %Z
+}
+
+define i57 @test1(i57 %A, i57 %B, i57 %C) {
+ %X = lshr i57 %A, %C
+ %Y = lshr i57 %B, %C
+ %Z = or i57 %X, %Y
+ ret i57 %Z
+}
+
+define i49 @test2(i49 %A, i49 %B, i49 %C) {
+ %X = ashr i49 %A, %C
+ %Y = ashr i49 %B, %C
+ %Z = xor i49 %X, %Y
+ ret i49 %Z
+}
diff --git a/test/Transforms/InstCombine/apint-shift.ll b/test/Transforms/InstCombine/apint-shift.ll
new file mode 100644
index 000000000000..afc5360d8de4
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-shift.ll
@@ -0,0 +1,191 @@
+; This test makes sure that shit instructions are properly eliminated
+; even with arbitrary precision integers.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sh
+; END.
+
+define i47 @test1(i47 %A) {
+ %B = shl i47 %A, 0 ; <i47> [#uses=1]
+ ret i47 %B
+}
+
+define i41 @test2(i7 %X) {
+ %A = zext i7 %X to i41 ; <i41> [#uses=1]
+ %B = shl i41 0, %A ; <i41> [#uses=1]
+ ret i41 %B
+}
+
+define i41 @test3(i41 %A) {
+ %B = ashr i41 %A, 0 ; <i41> [#uses=1]
+ ret i41 %B
+}
+
+define i39 @test4(i7 %X) {
+ %A = zext i7 %X to i39 ; <i39> [#uses=1]
+ %B = ashr i39 0, %A ; <i39> [#uses=1]
+ ret i39 %B
+}
+
+define i55 @test5(i55 %A) {
+ %B = lshr i55 %A, 55 ; <i55> [#uses=1]
+ ret i55 %B
+}
+
+define i32 @test5a(i32 %A) {
+ %B = shl i32 %A, 32 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i55 @test6(i55 %A) {
+ %B = shl i55 %A, 1 ; <i55> [#uses=1]
+ %C = mul i55 %B, 3 ; <i55> [#uses=1]
+ ret i55 %C
+}
+
+define i29 @test7(i8 %X) {
+ %A = zext i8 %X to i29 ; <i29> [#uses=1]
+ %B = ashr i29 -1, %A ; <i29> [#uses=1]
+ ret i29 %B
+}
+
+define i7 @test8(i7 %A) {
+ %B = shl i7 %A, 4 ; <i7> [#uses=1]
+ %C = shl i7 %B, 3 ; <i7> [#uses=1]
+ ret i7 %C
+}
+
+define i17 @test9(i17 %A) {
+ %B = shl i17 %A, 16 ; <i17> [#uses=1]
+ %C = lshr i17 %B, 16 ; <i17> [#uses=1]
+ ret i17 %C
+}
+
+define i19 @test10(i19 %A) {
+ %B = lshr i19 %A, 18 ; <i19> [#uses=1]
+ %C = shl i19 %B, 18 ; <i19> [#uses=1]
+ ret i19 %C
+}
+
+define i23 @test11(i23 %A) {
+ %a = mul i23 %A, 3 ; <i23> [#uses=1]
+ %B = lshr i23 %a, 11 ; <i23> [#uses=1]
+ %C = shl i23 %B, 12 ; <i23> [#uses=1]
+ ret i23 %C
+}
+
+define i47 @test12(i47 %A) {
+ %B = ashr i47 %A, 8 ; <i47> [#uses=1]
+ %C = shl i47 %B, 8 ; <i47> [#uses=1]
+ ret i47 %C
+}
+
+define i18 @test13(i18 %A) {
+ %a = mul i18 %A, 3 ; <i18> [#uses=1]
+ %B = ashr i18 %a, 8 ; <i18> [#uses=1]
+ %C = shl i18 %B, 9 ; <i18> [#uses=1]
+ ret i18 %C
+}
+
+define i35 @test14(i35 %A) {
+ %B = lshr i35 %A, 4 ; <i35> [#uses=1]
+ %C = or i35 %B, 1234 ; <i35> [#uses=1]
+ %D = shl i35 %C, 4 ; <i35> [#uses=1]
+ ret i35 %D
+}
+
+define i79 @test14a(i79 %A) {
+ %B = shl i79 %A, 4 ; <i79> [#uses=1]
+ %C = and i79 %B, 1234 ; <i79> [#uses=1]
+ %D = lshr i79 %C, 4 ; <i79> [#uses=1]
+ ret i79 %D
+}
+
+define i45 @test15(i1 %C) {
+ %A = select i1 %C, i45 3, i45 1 ; <i45> [#uses=1]
+ %V = shl i45 %A, 2 ; <i45> [#uses=1]
+ ret i45 %V
+}
+
+define i53 @test15a(i1 %X) {
+ %A = select i1 %X, i8 3, i8 1 ; <i8> [#uses=1]
+ %B = zext i8 %A to i53 ; <i53> [#uses=1]
+ %V = shl i53 64, %B ; <i53> [#uses=1]
+ ret i53 %V
+}
+
+define i1 @test16(i84 %X) {
+ %tmp.3 = ashr i84 %X, 4 ; <i84> [#uses=1]
+ %tmp.6 = and i84 %tmp.3, 1 ; <i84> [#uses=1]
+ %tmp.7 = icmp ne i84 %tmp.6, 0 ; <i1> [#uses=1]
+ ret i1 %tmp.7
+}
+
+define i1 @test17(i106 %A) {
+ %B = lshr i106 %A, 3 ; <i106> [#uses=1]
+ %C = icmp eq i106 %B, 1234 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test18(i11 %A) {
+ %B = lshr i11 %A, 10 ; <i11> [#uses=1]
+ %C = icmp eq i11 %B, 123 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test19(i37 %A) {
+ %B = ashr i37 %A, 2 ; <i37> [#uses=1]
+ %C = icmp eq i37 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test19a(i39 %A) {
+ %B = ashr i39 %A, 2 ; <i39> [#uses=1]
+ %C = icmp eq i39 %B, -1 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test20(i13 %A) {
+ %B = ashr i13 %A, 12 ; <i13> [#uses=1]
+ %C = icmp eq i13 %B, 123 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test21(i12 %A) {
+ %B = shl i12 %A, 6 ; <i12> [#uses=1]
+ %C = icmp eq i12 %B, -128 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test22(i14 %A) {
+ %B = shl i14 %A, 7 ; <i14> [#uses=1]
+ %C = icmp eq i14 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i11 @test23(i44 %A) {
+ %B = shl i44 %A, 33 ; <i44> [#uses=1]
+ %C = ashr i44 %B, 33 ; <i44> [#uses=1]
+ %D = trunc i44 %C to i11 ; <i8> [#uses=1]
+ ret i11 %D
+}
+
+define i17 @test24(i17 %X) {
+ %Y = and i17 %X, -5 ; <i17> [#uses=1]
+ %Z = shl i17 %Y, 9 ; <i17> [#uses=1]
+ %Q = ashr i17 %Z, 9 ; <i17> [#uses=1]
+ ret i17 %Q
+}
+
+define i37 @test25(i37 %tmp.2, i37 %AA) {
+ %x = lshr i37 %AA, 17 ; <i37> [#uses=1]
+ %tmp.3 = lshr i37 %tmp.2, 17 ; <i37> [#uses=1]
+ %tmp.5 = add i37 %tmp.3, %x ; <i37> [#uses=1]
+ %tmp.6 = shl i37 %tmp.5, 17 ; <i37> [#uses=1]
+ ret i37 %tmp.6
+}
+
+define i40 @test26(i40 %A) {
+ %B = lshr i40 %A, 1 ; <i40> [#uses=1]
+ %C = bitcast i40 %B to i40 ; <i40> [#uses=1]
+ %D = shl i40 %C, 1 ; <i40> [#uses=1]
+ ret i40 %D
+}
diff --git a/test/Transforms/InstCombine/apint-shl-trunc.ll b/test/Transforms/InstCombine/apint-shl-trunc.ll
new file mode 100644
index 000000000000..a9cffdef04f4
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-shl-trunc.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shl
+; END.
+
+define i1 @test0(i39 %X, i39 %A) {
+ %B = lshr i39 %X, %A
+ %D = trunc i39 %B to i1
+ ret i1 %D
+}
+
+define i1 @test1(i799 %X, i799 %A) {
+ %B = lshr i799 %X, %A
+ %D = trunc i799 %B to i1
+ ret i1 %D
+}
diff --git a/test/Transforms/InstCombine/apint-sub.ll b/test/Transforms/InstCombine/apint-sub.ll
new file mode 100644
index 000000000000..2ff763c9f5f8
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-sub.ll
@@ -0,0 +1,141 @@
+; This test makes sure that sub instructions are properly eliminated
+; even with arbitrary precision integers.
+;
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v {sub i19 %Cok, %Bok} | grep -v {sub i25 0, %Aok} | not grep sub
+; END.
+
+define i23 @test1(i23 %A) {
+ %B = sub i23 %A, %A ; <i23> [#uses=1]
+ ret i23 %B
+}
+
+define i47 @test2(i47 %A) {
+ %B = sub i47 %A, 0 ; <i47> [#uses=1]
+ ret i47 %B
+}
+
+define i97 @test3(i97 %A) {
+ %B = sub i97 0, %A ; <i97> [#uses=1]
+ %C = sub i97 0, %B ; <i97> [#uses=1]
+ ret i97 %C
+}
+
+define i108 @test4(i108 %A, i108 %x) {
+ %B = sub i108 0, %A ; <i108> [#uses=1]
+ %C = sub i108 %x, %B ; <i108> [#uses=1]
+ ret i108 %C
+}
+
+define i19 @test5(i19 %A, i19 %Bok, i19 %Cok) {
+ %D = sub i19 %Bok, %Cok ; <i19> [#uses=1]
+ %E = sub i19 %A, %D ; <i19> [#uses=1]
+ ret i19 %E
+}
+
+define i57 @test6(i57 %A, i57 %B) {
+ %C = and i57 %A, %B ; <i57> [#uses=1]
+ %D = sub i57 %A, %C ; <i57> [#uses=1]
+ ret i57 %D
+}
+
+define i77 @test7(i77 %A) {
+ %B = sub i77 -1, %A ; <i77> [#uses=1]
+ ret i77 %B
+}
+
+define i27 @test8(i27 %A) {
+ %B = mul i27 9, %A ; <i27> [#uses=1]
+ %C = sub i27 %B, %A ; <i27> [#uses=1]
+ ret i27 %C
+}
+
+define i42 @test9(i42 %A) {
+ %B = mul i42 3, %A ; <i42> [#uses=1]
+ %C = sub i42 %A, %B ; <i42> [#uses=1]
+ ret i42 %C
+}
+
+define i124 @test10(i124 %A, i124 %B) {
+ %C = sub i124 0, %A ; <i124> [#uses=1]
+ %D = sub i124 0, %B ; <i124> [#uses=1]
+ %E = mul i124 %C, %D ; <i124> [#uses=1]
+ ret i124 %E
+}
+
+define i55 @test10a(i55 %A) {
+ %C = sub i55 0, %A ; <i55> [#uses=1]
+ %E = mul i55 %C, 7 ; <i55> [#uses=1]
+ ret i55 %E
+}
+
+define i1 @test11(i9 %A, i9 %B) {
+ %C = sub i9 %A, %B ; <i9> [#uses=1]
+ %cD = icmp ne i9 %C, 0 ; <i1> [#uses=1]
+ ret i1 %cD
+}
+
+define i43 @test12(i43 %A) {
+ %B = ashr i43 %A, 42 ; <i43> [#uses=1]
+ %C = sub i43 0, %B ; <i43> [#uses=1]
+ ret i43 %C
+}
+
+define i79 @test13(i79 %A) {
+ %B = lshr i79 %A, 78 ; <i79> [#uses=1]
+ %C = sub i79 0, %B ; <i79> [#uses=1]
+ ret i79 %C
+}
+
+define i1024 @test14(i1024 %A) {
+ %B = lshr i1024 %A, 1023 ; <i1024> [#uses=1]
+ %C = bitcast i1024 %B to i1024 ; <i1024> [#uses=1]
+ %D = sub i1024 0, %C ; <i1024> [#uses=1]
+ ret i1024 %D
+}
+
+define i14 @test15(i14 %A, i14 %B) {
+ %C = sub i14 0, %A ; <i14> [#uses=1]
+ %D = srem i14 %B, %C ; <i14> [#uses=1]
+ ret i14 %D
+}
+
+define i51 @test16(i51 %A) {
+ %X = sdiv i51 %A, 1123 ; <i51> [#uses=1]
+ %Y = sub i51 0, %X ; <i51> [#uses=1]
+ ret i51 %Y
+}
+
+; Can't fold subtract here because negation it might oveflow.
+; PR3142
+define i25 @test17(i25 %Aok) {
+ %B = sub i25 0, %Aok ; <i25> [#uses=1]
+ %C = sdiv i25 %B, 1234 ; <i25> [#uses=1]
+ ret i25 %C
+}
+
+define i128 @test18(i128 %Y) {
+ %tmp.4 = shl i128 %Y, 2 ; <i128> [#uses=1]
+ %tmp.12 = shl i128 %Y, 2 ; <i128> [#uses=1]
+ %tmp.8 = sub i128 %tmp.4, %tmp.12 ; <i128> [#uses=1]
+ ret i128 %tmp.8
+}
+
+define i39 @test19(i39 %X, i39 %Y) {
+ %Z = sub i39 %X, %Y ; <i39> [#uses=1]
+ %Q = add i39 %Z, %Y ; <i39> [#uses=1]
+ ret i39 %Q
+}
+
+define i1 @test20(i33 %g, i33 %h) {
+ %tmp.2 = sub i33 %g, %h ; <i33> [#uses=1]
+ %tmp.4 = icmp ne i33 %tmp.2, %g ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+define i1 @test21(i256 %g, i256 %h) {
+ %tmp.2 = sub i256 %g, %h ; <i256> [#uses=1]
+ %tmp.4 = icmp ne i256 %tmp.2, %g; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
diff --git a/test/Transforms/InstCombine/apint-xor1.ll b/test/Transforms/InstCombine/apint-xor1.ll
new file mode 100644
index 000000000000..5ddf5cf9c9b6
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-xor1.ll
@@ -0,0 +1,50 @@
+; This test makes sure that xor instructions are properly eliminated.
+; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor }
+
+
+define i47 @test1(i47 %A, i47 %B) {
+ ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+ %A1 = and i47 %A, 70368744177664
+ %B1 = and i47 %B, 70368744177661
+ %C1 = xor i47 %A1, %B1
+ ret i47 %C1
+}
+
+define i15 @test2(i15 %x) {
+ %tmp.2 = xor i15 %x, 0
+ ret i15 %tmp.2
+}
+
+define i23 @test3(i23 %x) {
+ %tmp.2 = xor i23 %x, %x
+ ret i23 %tmp.2
+}
+
+define i37 @test4(i37 %x) {
+ ; x ^ ~x == -1
+ %NotX = xor i37 -1, %x
+ %B = xor i37 %x, %NotX
+ ret i37 %B
+}
+
+define i7 @test5(i7 %A) {
+ ;; (A|B)^B == A & (~B)
+ %t1 = or i7 %A, 23
+ %r = xor i7 %t1, 23
+ ret i7 %r
+}
+
+define i7 @test6(i7 %A) {
+ %t1 = xor i7 %A, 23
+ %r = xor i7 %t1, 23
+ ret i7 %r
+}
+
+define i47 @test7(i47 %A) {
+ ;; (A | C1) ^ C2 -> (A | C1) & ~C2 iff (C1&C2) == C2
+ %B1 = or i47 %A, 70368744177663
+ %C1 = xor i47 %B1, 703687463
+ ret i47 %C1
+}
diff --git a/test/Transforms/InstCombine/apint-xor2.ll b/test/Transforms/InstCombine/apint-xor2.ll
new file mode 100644
index 000000000000..4d2d415f3467
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-xor2.ll
@@ -0,0 +1,51 @@
+; This test makes sure that xor instructions are properly eliminated.
+; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor }
+; END.
+
+
+define i447 @test1(i447 %A, i447 %B) {
+ ;; (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
+ %A1 = and i447 %A, 70368744177664
+ %B1 = and i447 %B, 70368744177663
+ %C1 = xor i447 %A1, %B1
+ ret i447 %C1
+}
+
+define i1005 @test2(i1005 %x) {
+ %tmp.2 = xor i1005 %x, 0
+ ret i1005 %tmp.2
+}
+
+define i123 @test3(i123 %x) {
+ %tmp.2 = xor i123 %x, %x
+ ret i123 %tmp.2
+}
+
+define i737 @test4(i737 %x) {
+ ; x ^ ~x == -1
+ %NotX = xor i737 -1, %x
+ %B = xor i737 %x, %NotX
+ ret i737 %B
+}
+
+define i700 @test5(i700 %A) {
+ ;; (A|B)^B == A & (~B)
+ %t1 = or i700 %A, 288230376151711743
+ %r = xor i700 %t1, 288230376151711743
+ ret i700 %r
+}
+
+define i77 @test6(i77 %A) {
+ %t1 = xor i77 %A, 23
+ %r = xor i77 %t1, 23
+ ret i77 %r
+}
+
+define i1023 @test7(i1023 %A) {
+ ;; (A | C1) ^ C2 -> (A | C1) & ~C2 iff (C1&C2) == C2
+ %B1 = or i1023 %A, 70368744177663
+ %C1 = xor i1023 %B1, 703687463
+ ret i1023 %C1
+}
diff --git a/test/Transforms/InstCombine/apint-zext1.ll b/test/Transforms/InstCombine/apint-zext1.ll
new file mode 100644
index 000000000000..03330c7be966
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-zext1.ll
@@ -0,0 +1,9 @@
+; Tests to make sure elimination of casts is working correctly
+; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast {} {%c1.*}
+
+define i47 @test_sext_zext(i11 %A) {
+ %c1 = zext i11 %A to i39
+ %c2 = sext i39 %c1 to i47
+ ret i47 %c2
+}
diff --git a/test/Transforms/InstCombine/apint-zext2.ll b/test/Transforms/InstCombine/apint-zext2.ll
new file mode 100644
index 000000000000..8350d10282b6
--- /dev/null
+++ b/test/Transforms/InstCombine/apint-zext2.ll
@@ -0,0 +1,9 @@
+; Tests to make sure elimination of casts is working correctly
+; This test is for Integer BitWidth > 64 && BitWidth <= 1024.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast {} {%c1.*}
+
+define i1024 @test_sext_zext(i77 %A) {
+ %c1 = zext i77 %A to i533
+ %c2 = sext i533 %c1 to i1024
+ ret i1024 %c2
+}
diff --git a/test/Transforms/InstCombine/ashr-nop.ll b/test/Transforms/InstCombine/ashr-nop.ll
new file mode 100644
index 000000000000..bb0da346b0c1
--- /dev/null
+++ b/test/Transforms/InstCombine/ashr-nop.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr
+
+define i32 @foo(i32 %x) {
+ %o = and i32 %x, 1
+ %n = add i32 %o, -1
+ %t = ashr i32 %n, 17
+ ret i32 %t
+}
diff --git a/test/Transforms/InstCombine/binop-cast.ll b/test/Transforms/InstCombine/binop-cast.ll
new file mode 100644
index 000000000000..ea5299ba8761
--- /dev/null
+++ b/test/Transforms/InstCombine/binop-cast.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i32 @testAdd(i32 %X, i32 %Y) {
+ %tmp = add i32 %X, %Y
+ %tmp.l = bitcast i32 %tmp to i32
+ ret i32 %tmp.l
+}
diff --git a/test/Transforms/InstCombine/bit-tracking.ll b/test/Transforms/InstCombine/bit-tracking.ll
new file mode 100644
index 000000000000..d090c69d7f3c
--- /dev/null
+++ b/test/Transforms/InstCombine/bit-tracking.ll
@@ -0,0 +1,26 @@
+; This file contains various testcases that require tracking whether bits are
+; set or cleared by various instructions.
+; RUN: llvm-as < %s | opt -instcombine -instcombine | llvm-dis |\
+; RUN: not grep %ELIM
+
+; Reduce down to a single XOR
+define i32 @test3(i32 %B) {
+ %ELIMinc = and i32 %B, 1 ; <i32> [#uses=1]
+ %tmp.5 = xor i32 %ELIMinc, 1 ; <i32> [#uses=1]
+ %ELIM7 = and i32 %B, -2 ; <i32> [#uses=1]
+ %tmp.8 = or i32 %tmp.5, %ELIM7 ; <i32> [#uses=1]
+ ret i32 %tmp.8
+}
+
+; Finally, a bigger case where we chain things together. This corresponds to
+; incrementing a single-bit bitfield, which should become just an xor.
+define i32 @test4(i32 %B) {
+ %ELIM3 = shl i32 %B, 31 ; <i32> [#uses=1]
+ %ELIM4 = ashr i32 %ELIM3, 31 ; <i32> [#uses=1]
+ %inc = add i32 %ELIM4, 1 ; <i32> [#uses=1]
+ %ELIM5 = and i32 %inc, 1 ; <i32> [#uses=1]
+ %ELIM7 = and i32 %B, -2 ; <i32> [#uses=1]
+ %tmp.8 = or i32 %ELIM5, %ELIM7 ; <i32> [#uses=1]
+ ret i32 %tmp.8
+}
+
diff --git a/test/Transforms/InstCombine/bitcast-gep.ll b/test/Transforms/InstCombine/bitcast-gep.ll
new file mode 100644
index 000000000000..2e1f7693fc1b
--- /dev/null
+++ b/test/Transforms/InstCombine/bitcast-gep.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+; RUN: llvm-as < %s | opt -instcombine -scalarrepl | llvm-dis | grep {ret i8. %v}
+; PR1345
+
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "powerpc-apple-darwin8.8.0"
+
+define i8* @test(i8* %v) {
+ %A = alloca [4 x i8*], align 16 ; <[4 x i8*]*> [#uses=3]
+ %B = getelementptr [4 x i8*]* %A, i32 0, i32 0 ; <i8**> [#uses=1]
+ store i8* null, i8** %B
+ %C = bitcast [4 x i8*]* %A to { [16 x i8] }* ; <{ [16 x i8] }*> [#uses=1]
+ %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8 ; <i8*> [#uses=1]
+ %E = bitcast i8* %D to i8** ; <i8**> [#uses=1]
+ store i8* %v, i8** %E
+ %F = getelementptr [4 x i8*]* %A, i32 0, i32 2 ; <i8**> [#uses=1]
+ %G = load i8** %F ; <i8*> [#uses=1]
+ ret i8* %G
+}
+
+; PR3290
+%struct.Key = type { { i32, i32 } }
+%struct.anon = type <{ i8, [3 x i8], i32 }>
+
+define i32 *@test2(%struct.Key *%A) {
+ %B = bitcast %struct.Key* %A to %struct.anon*
+ %C = getelementptr %struct.anon* %B, i32 0, i32 2
+ ret i32 *%C
+}
+
diff --git a/test/Transforms/InstCombine/bitcast-vector-fold.ll b/test/Transforms/InstCombine/bitcast-vector-fold.ll
new file mode 100644
index 000000000000..ded3e2f10aba
--- /dev/null
+++ b/test/Transforms/InstCombine/bitcast-vector-fold.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+
+define <2 x i64> @test1() {
+ %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x i64>
+ ret <2 x i64> %tmp3
+}
+
+define <4 x i32> @test2() {
+ %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x i32>
+ ret <4 x i32> %tmp3
+}
+
+define <2 x double> @test3() {
+ %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x double>
+ ret <2 x double> %tmp3
+}
+
+define <4 x float> @test4() {
+ %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x float>
+ ret <4 x float> %tmp3
+}
+
+define <2 x i64> @test5() {
+ %tmp3 = bitcast <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0> to <2 x i64>
+ ret <2 x i64> %tmp3
+}
+
+define <4 x i32> @test6() {
+ %tmp3 = bitcast <2 x double> <double 0.5, double 1.0> to <4 x i32>
+ ret <4 x i32> %tmp3
+}
diff --git a/test/Transforms/InstCombine/bitcount.ll b/test/Transforms/InstCombine/bitcount.ll
new file mode 100644
index 000000000000..8ebf289eb7d7
--- /dev/null
+++ b/test/Transforms/InstCombine/bitcount.ll
@@ -0,0 +1,19 @@
+; Tests to make sure bit counts of constants are folded
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 19}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v declare | not grep llvm.ct
+
+declare i31 @llvm.ctpop.i31(i31 %val)
+declare i32 @llvm.cttz.i32(i32 %val)
+declare i33 @llvm.ctlz.i33(i33 %val)
+
+define i32 @test(i32 %A) {
+ %c1 = call i31 @llvm.ctpop.i31(i31 12415124)
+ %c2 = call i32 @llvm.cttz.i32(i32 87359874)
+ %c3 = call i33 @llvm.ctlz.i33(i33 87359874)
+ %t1 = zext i31 %c1 to i32
+ %t3 = trunc i33 %c3 to i32
+ %r1 = add i32 %t1, %c2
+ %r2 = add i32 %r1, %t3
+ ret i32 %r2
+}
diff --git a/test/Transforms/InstCombine/bittest.ll b/test/Transforms/InstCombine/bittest.ll
new file mode 100644
index 000000000000..8d45a48aa91d
--- /dev/null
+++ b/test/Transforms/InstCombine/bittest.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -instcombine -simplifycfg | llvm-dis |\
+; RUN: not grep {call void @abort}
+
+@b_rec.0 = external global i32 ; <i32*> [#uses=2]
+
+define void @_Z12h000007_testv(i32* %P) {
+entry:
+ %tmp.2 = load i32* @b_rec.0 ; <i32> [#uses=1]
+ %tmp.9 = or i32 %tmp.2, -989855744 ; <i32> [#uses=2]
+ %tmp.16 = and i32 %tmp.9, -805306369 ; <i32> [#uses=2]
+ %tmp.17 = and i32 %tmp.9, -973078529 ; <i32> [#uses=1]
+ store i32 %tmp.17, i32* @b_rec.0
+ %tmp.17.shrunk = bitcast i32 %tmp.16 to i32 ; <i32> [#uses=1]
+ %tmp.22 = and i32 %tmp.17.shrunk, -1073741824 ; <i32> [#uses=1]
+ %tmp.23 = icmp eq i32 %tmp.22, -1073741824 ; <i1> [#uses=1]
+ br i1 %tmp.23, label %endif.0, label %then.0
+
+then.0: ; preds = %entry
+ tail call void @abort( )
+ unreachable
+
+endif.0: ; preds = %entry
+ %tmp.17.shrunk2 = bitcast i32 %tmp.16 to i32 ; <i32> [#uses=1]
+ %tmp.27.mask = and i32 %tmp.17.shrunk2, 100663295 ; <i32> [#uses=1]
+ store i32 %tmp.27.mask, i32* %P
+ ret void
+}
+
+declare void @abort()
+
diff --git a/test/Transforms/InstCombine/bswap-fold.ll b/test/Transforms/InstCombine/bswap-fold.ll
new file mode 100644
index 000000000000..87d8b0496d26
--- /dev/null
+++ b/test/Transforms/InstCombine/bswap-fold.ll
@@ -0,0 +1,52 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | count 6
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call.*bswap
+
+define i1 @test1(i16 %tmp2) {
+ %tmp10 = call i16 @llvm.bswap.i16( i16 %tmp2 ) ; <i16> [#uses=1]
+ %tmp = icmp eq i16 %tmp10, 1 ; <i1> [#uses=1]
+ ret i1 %tmp
+}
+
+define i1 @test2(i32 %tmp) {
+ %tmp34 = tail call i32 @llvm.bswap.i32( i32 %tmp ) ; <i32> [#uses=1]
+ %tmp.upgrd.1 = icmp eq i32 %tmp34, 1 ; <i1> [#uses=1]
+ ret i1 %tmp.upgrd.1
+}
+
+declare i32 @llvm.bswap.i32(i32)
+
+define i1 @test3(i64 %tmp) {
+ %tmp34 = tail call i64 @llvm.bswap.i64( i64 %tmp ) ; <i64> [#uses=1]
+ %tmp.upgrd.2 = icmp eq i64 %tmp34, 1 ; <i1> [#uses=1]
+ ret i1 %tmp.upgrd.2
+}
+
+declare i64 @llvm.bswap.i64(i64)
+
+declare i16 @llvm.bswap.i16(i16)
+
+; rdar://5992453
+; A & 255
+define i32 @test4(i32 %a) nounwind {
+entry:
+ %tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
+ %tmp4 = lshr i32 %tmp2, 24
+ ret i32 %tmp4
+}
+
+; A
+define i32 @test5(i32 %a) nounwind {
+entry:
+ %tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
+ %tmp4 = tail call i32 @llvm.bswap.i32( i32 %tmp2 )
+ ret i32 %tmp4
+}
+
+; a >> 24
+define i32 @test6(i32 %a) nounwind {
+entry:
+ %tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
+ %tmp4 = and i32 %tmp2, 255
+ ret i32 %tmp4
+}
+
diff --git a/test/Transforms/InstCombine/bswap.ll b/test/Transforms/InstCombine/bswap.ll
new file mode 100644
index 000000000000..2ba718e58478
--- /dev/null
+++ b/test/Transforms/InstCombine/bswap.ll
@@ -0,0 +1,72 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {call.*llvm.bswap} | count 6
+
+define i32 @test1(i32 %i) {
+ %tmp1 = lshr i32 %i, 24 ; <i32> [#uses=1]
+ %tmp3 = lshr i32 %i, 8 ; <i32> [#uses=1]
+ %tmp4 = and i32 %tmp3, 65280 ; <i32> [#uses=1]
+ %tmp5 = or i32 %tmp1, %tmp4 ; <i32> [#uses=1]
+ %tmp7 = shl i32 %i, 8 ; <i32> [#uses=1]
+ %tmp8 = and i32 %tmp7, 16711680 ; <i32> [#uses=1]
+ %tmp9 = or i32 %tmp5, %tmp8 ; <i32> [#uses=1]
+ %tmp11 = shl i32 %i, 24 ; <i32> [#uses=1]
+ %tmp12 = or i32 %tmp9, %tmp11 ; <i32> [#uses=1]
+ ret i32 %tmp12
+}
+
+define i32 @test2(i32 %arg) {
+ %tmp2 = shl i32 %arg, 24 ; <i32> [#uses=1]
+ %tmp4 = shl i32 %arg, 8 ; <i32> [#uses=1]
+ %tmp5 = and i32 %tmp4, 16711680 ; <i32> [#uses=1]
+ %tmp6 = or i32 %tmp2, %tmp5 ; <i32> [#uses=1]
+ %tmp8 = lshr i32 %arg, 8 ; <i32> [#uses=1]
+ %tmp9 = and i32 %tmp8, 65280 ; <i32> [#uses=1]
+ %tmp10 = or i32 %tmp6, %tmp9 ; <i32> [#uses=1]
+ %tmp12 = lshr i32 %arg, 24 ; <i32> [#uses=1]
+ %tmp14 = or i32 %tmp10, %tmp12 ; <i32> [#uses=1]
+ ret i32 %tmp14
+}
+
+define i16 @test3(i16 %s) {
+ %tmp2 = lshr i16 %s, 8 ; <i16> [#uses=1]
+ %tmp4 = shl i16 %s, 8 ; <i16> [#uses=1]
+ %tmp5 = or i16 %tmp2, %tmp4 ; <i16> [#uses=1]
+ ret i16 %tmp5
+}
+
+define i16 @test4(i16 %s) {
+ %tmp2 = lshr i16 %s, 8 ; <i16> [#uses=1]
+ %tmp4 = shl i16 %s, 8 ; <i16> [#uses=1]
+ %tmp5 = or i16 %tmp4, %tmp2 ; <i16> [#uses=1]
+ ret i16 %tmp5
+}
+
+define i16 @test5(i16 %a) {
+ %tmp = zext i16 %a to i32 ; <i32> [#uses=2]
+ %tmp1 = and i32 %tmp, 65280 ; <i32> [#uses=1]
+ %tmp2 = ashr i32 %tmp1, 8 ; <i32> [#uses=1]
+ %tmp2.upgrd.1 = trunc i32 %tmp2 to i16 ; <i16> [#uses=1]
+ %tmp4 = and i32 %tmp, 255 ; <i32> [#uses=1]
+ %tmp5 = shl i32 %tmp4, 8 ; <i32> [#uses=1]
+ %tmp5.upgrd.2 = trunc i32 %tmp5 to i16 ; <i16> [#uses=1]
+ %tmp.upgrd.3 = or i16 %tmp2.upgrd.1, %tmp5.upgrd.2 ; <i16> [#uses=1]
+ %tmp6 = bitcast i16 %tmp.upgrd.3 to i16 ; <i16> [#uses=1]
+ %tmp6.upgrd.4 = zext i16 %tmp6 to i32 ; <i32> [#uses=1]
+ %retval = trunc i32 %tmp6.upgrd.4 to i16 ; <i16> [#uses=1]
+ ret i16 %retval
+}
+
+; PR2842
+define i32 @test6(i32 %x) nounwind readnone {
+ %tmp = shl i32 %x, 16 ; <i32> [#uses=1]
+ %x.mask = and i32 %x, 65280 ; <i32> [#uses=1]
+ %tmp1 = lshr i32 %x, 16 ; <i32> [#uses=1]
+ %tmp2 = and i32 %tmp1, 255 ; <i32> [#uses=1]
+ %tmp3 = or i32 %x.mask, %tmp ; <i32> [#uses=1]
+ %tmp4 = or i32 %tmp3, %tmp2 ; <i32> [#uses=1]
+ %tmp5 = shl i32 %tmp4, 8 ; <i32> [#uses=1]
+ %tmp6 = lshr i32 %x, 24 ; <i32> [#uses=1]
+ %tmp7 = or i32 %tmp5, %tmp6 ; <i32> [#uses=1]
+ ret i32 %tmp7
+}
+
diff --git a/test/Transforms/InstCombine/call-cast-target.ll b/test/Transforms/InstCombine/call-cast-target.ll
new file mode 100644
index 000000000000..1a02514d1a7b
--- /dev/null
+++ b/test/Transforms/InstCombine/call-cast-target.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep call | not grep bitcast
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+
+define i32 @main() {
+entry:
+ %tmp = call i32 bitcast (i8* (i32*)* @ctime to i32 (i32*)*)( i32* null ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+declare i8* @ctime(i32*)
+
diff --git a/test/Transforms/InstCombine/call-intrinsics.ll b/test/Transforms/InstCombine/call-intrinsics.ll
new file mode 100644
index 000000000000..e1c60570f14f
--- /dev/null
+++ b/test/Transforms/InstCombine/call-intrinsics.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+
+@X = global i8 0 ; <i8*> [#uses=3]
+@Y = global i8 12 ; <i8*> [#uses=2]
+
+declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32)
+
+define void @zero_byte_test() {
+ ; These process zero bytes, so they are a noop.
+ call void @llvm.memmove.i32( i8* @X, i8* @Y, i32 0, i32 100 )
+ call void @llvm.memcpy.i32( i8* @X, i8* @Y, i32 0, i32 100 )
+ call void @llvm.memset.i32( i8* @X, i8 123, i32 0, i32 100 )
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/call.ll b/test/Transforms/InstCombine/call.ll
new file mode 100644
index 000000000000..df9b2a68d9dc
--- /dev/null
+++ b/test/Transforms/InstCombine/call.ll
@@ -0,0 +1,78 @@
+; Ignore stderr, we expect warnings there
+; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | \
+; RUN: grep call | notcast
+; END.
+
+
+; Simple case, argument translatable without changing the value
+declare void @test1a(i8*)
+
+define void @test1(i32* %A) {
+ call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
+ ret void
+}
+
+; More complex case, translate argument because of resolution. This is safe
+; because we have the body of the function
+define void @test2a(i8 %A) {
+ ret void
+}
+
+define i32 @test2(i32 %A) {
+ call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
+ ret i32 %A
+}
+
+
+; Resolving this should insert a cast from sbyte to int, following the C
+; promotion rules.
+declare void @test3a(i8, ...)
+
+define void @test3(i8 %A, i8 %B) {
+ call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B
+)
+ ret void
+}
+
+
+; test conversion of return value...
+define i8 @test4a() {
+ ret i8 0
+}
+
+define i32 @test4() {
+ %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+
+; test conversion of return value... no value conversion occurs so we can do
+; this with just a prototype...
+declare i32 @test5a()
+
+define i32 @test5() {
+ %X = call i32 @test5a( ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+
+; test addition of new arguments...
+declare i32 @test6a(i32)
+
+define i32 @test6() {
+ %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+
+; test removal of arguments, only can happen with a function body
+define void @test7a() {
+ ret void
+}
+
+define void @test7() {
+ call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )
+ ret void
+}
+
+
diff --git a/test/Transforms/InstCombine/call2.ll b/test/Transforms/InstCombine/call2.ll
new file mode 100644
index 000000000000..4ba840f7fb96
--- /dev/null
+++ b/test/Transforms/InstCombine/call2.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+
+; This used to crash trying to do a double-to-pointer conversion
+define i32 @bar() {
+entry:
+ %retval = alloca i32, align 4 ; <i32*> [#uses=1]
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp = call i32 (...)* bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; <i32> [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval1
+}
+
+define i32 @f(i8* %p) {
+entry:
+ %p_addr = alloca i8* ; <i8**> [#uses=1]
+ %retval = alloca i32, align 4 ; <i32*> [#uses=1]
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i8* %p, i8** %p_addr
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval1
+}
diff --git a/test/Transforms/InstCombine/canonicalize_branch.ll b/test/Transforms/InstCombine/canonicalize_branch.ll
new file mode 100644
index 000000000000..79f02e73209a
--- /dev/null
+++ b/test/Transforms/InstCombine/canonicalize_branch.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {icmp ne\|icmp ule\|icmp uge}
+
+define i32 @test1(i32 %X, i32 %Y) {
+ %C = icmp ne i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ ret i32 12
+
+F: ; preds = %0
+ ret i32 123
+}
+
+define i32 @test2(i32 %X, i32 %Y) {
+ %C = icmp ule i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ ret i32 12
+
+F: ; preds = %0
+ ret i32 123
+}
+
+define i32 @test3(i32 %X, i32 %Y) {
+ %C = icmp uge i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %C, label %T, label %F
+
+T: ; preds = %0
+ ret i32 12
+
+F: ; preds = %0
+ ret i32 123
+}
+
diff --git a/test/Transforms/InstCombine/cast-and-cast.ll b/test/Transforms/InstCombine/cast-and-cast.ll
new file mode 100644
index 000000000000..f90cb7499aff
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-and-cast.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep bitcast
+
+define i1 @test1(i32 %val) {
+ %t1 = bitcast i32 %val to i32 ; <i32> [#uses=1]
+ %t2 = and i32 %t1, 1 ; <i32> [#uses=1]
+ %t3 = trunc i32 %t2 to i1 ; <i1> [#uses=1]
+ ret i1 %t3
+}
+
+define i16 @test1.upgrd.1(i32 %val) {
+ %t1 = bitcast i32 %val to i32 ; <i32> [#uses=1]
+ %t2 = and i32 %t1, 1 ; <i32> [#uses=1]
+ %t3 = trunc i32 %t2 to i16 ; <i16> [#uses=1]
+ ret i16 %t3
+}
+
diff --git a/test/Transforms/InstCombine/cast-cast-to-and.ll b/test/Transforms/InstCombine/cast-cast-to-and.ll
new file mode 100644
index 000000000000..bb7c3dd754cc
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-cast-to-and.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep i8
+
+define i32 @test1(i32 %X) {
+ %Y = trunc i32 %X to i8 ; <i8> [#uses=1]
+ %Z = zext i8 %Y to i32 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/InstCombine/cast-load-gep.ll b/test/Transforms/InstCombine/cast-load-gep.ll
new file mode 100644
index 000000000000..bc2c7b35163d
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-load-gep.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine -globaldce | llvm-dis | \
+; RUN: not grep Array
+
+; Pulling the cast out of the load allows us to eliminate the load, and then
+; the whole array.
+
+ %op = type { float }
+ %unop = type { i32 }
+@Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* @foo ] ; <[1 x %op* (%op*)*]*> [#uses=1]
+
+define %op* @foo(%op* %X) {
+ ret %op* %X
+}
+
+define %unop* @caller(%op* %O) {
+ %tmp = load %unop* (%op*)** bitcast ([1 x %op* (%op*)*]* @Array to %unop* (%op*)**); <%unop* (%op*)*> [#uses=1]
+ %tmp.2 = call %unop* %tmp( %op* %O ) ; <%unop*> [#uses=1]
+ ret %unop* %tmp.2
+}
+
diff --git a/test/Transforms/InstCombine/cast-malloc.ll b/test/Transforms/InstCombine/cast-malloc.ll
new file mode 100644
index 000000000000..d05f6b04fd07
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-malloc.ll
@@ -0,0 +1,15 @@
+; test that casted mallocs get converted to malloc of the right type
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep bitcast
+
+; The target datalayout is important for this test case. We have to tell
+; instcombine that the ABI alignment for a long is 4-bytes, not 8, otherwise
+; it won't do the transform.
+target datalayout = "e-i64:32:64"
+
+define i32* @test(i32 %size) {
+ %X = malloc i64, i32 %size ; <i64*> [#uses=1]
+ %ret = bitcast i64* %X to i32* ; <i32*> [#uses=1]
+ ret i32* %ret
+}
+
diff --git a/test/Transforms/InstCombine/cast-mul-select.ll b/test/Transforms/InstCombine/cast-mul-select.ll
new file mode 100644
index 000000000000..76e9b24332f5
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-mul-select.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i32 @mul(i32 %x, i32 %y) {
+ %A = trunc i32 %x to i8
+ %B = trunc i32 %y to i8
+ %C = mul i8 %A, %B
+ %D = zext i8 %C to i32
+ ret i32 %D
+}
+
+define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) {
+ %A = trunc i32 %x to i8
+ %B = trunc i32 %y to i8
+ %C = trunc i32 %z to i8
+ %D = add i8 %A, %B
+ %E = select i1 %cond, i8 %C, i8 %D
+ %F = zext i8 %E to i32
+ ret i32 %F
+}
+
+define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) {
+ %A = zext i8 %x to i32
+ %B = zext i8 %y to i32
+ %C = zext i8 %z to i32
+ %D = add i32 %A, %B
+ %E = select i1 %cond, i32 %C, i32 %D
+ %F = trunc i32 %E to i8
+ ret i8 %F
+}
diff --git a/test/Transforms/InstCombine/cast-propagate.ll b/test/Transforms/InstCombine/cast-propagate.ll
new file mode 100644
index 000000000000..c00f9537410a
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-propagate.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \
+; RUN: not grep load
+
+define i32 @test1(i32* %P) {
+ %A = alloca i32 ; <i32*> [#uses=2]
+ store i32 123, i32* %A
+ ; Cast the result of the load not the source
+ %Q = bitcast i32* %A to i32* ; <i32*> [#uses=1]
+ %V = load i32* %Q ; <i32> [#uses=1]
+ ret i32 %V
+}
diff --git a/test/Transforms/InstCombine/cast-set.ll b/test/Transforms/InstCombine/cast-set.ll
new file mode 100644
index 000000000000..091f148a2483
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-set.ll
@@ -0,0 +1,51 @@
+; This tests for various complex cast elimination cases instcombine should
+; handle.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i1 @test1(i32 %X) {
+ %A = bitcast i32 %X to i32 ; <i32> [#uses=1]
+ ; Convert to setne int %X, 12
+ %c = icmp ne i32 %A, 12 ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i1 @test2(i32 %X, i32 %Y) {
+ %A = bitcast i32 %X to i32 ; <i32> [#uses=1]
+ %B = bitcast i32 %Y to i32 ; <i32> [#uses=1]
+ ; Convert to setne int %X, %Y
+ %c = icmp ne i32 %A, %B ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i32 @test4(i32 %A) {
+ %B = bitcast i32 %A to i32 ; <i32> [#uses=1]
+ %C = shl i32 %B, 2 ; <i32> [#uses=1]
+ %D = bitcast i32 %C to i32 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i16 @test5(i16 %A) {
+ %B = sext i16 %A to i32 ; <i32> [#uses=1]
+ %C = and i32 %B, 15 ; <i32> [#uses=1]
+ %D = trunc i32 %C to i16 ; <i16> [#uses=1]
+ ret i16 %D
+}
+
+define i1 @test6(i1 %A) {
+ %B = zext i1 %A to i32 ; <i32> [#uses=1]
+ %C = icmp ne i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test6a(i1 %A) {
+ %B = zext i1 %A to i32 ; <i32> [#uses=1]
+ %C = icmp ne i32 %B, -1 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test7(i8* %A) {
+ %B = bitcast i8* %A to i32* ; <i32*> [#uses=1]
+ %C = icmp eq i32* %B, null ; <i1> [#uses=1]
+ ret i1 %C
+}
diff --git a/test/Transforms/InstCombine/cast-sext-zext.ll b/test/Transforms/InstCombine/cast-sext-zext.ll
new file mode 100644
index 000000000000..1acd7582100f
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-sext-zext.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext
+; XFAIL: *
+
+define zeroext i16 @t(i8 zeroext %on_off, i16* nocapture %puls) nounwind readonly {
+entry:
+ %0 = zext i8 %on_off to i32
+ %1 = add i32 %0, -1
+ %2 = sext i32 %1 to i64
+ %3 = getelementptr i16* %puls, i64 %2
+ %4 = load i16* %3, align 2
+ ret i16 %4
+}
diff --git a/test/Transforms/InstCombine/cast-store-gep.ll b/test/Transforms/InstCombine/cast-store-gep.ll
new file mode 100644
index 000000000000..95a069d60b75
--- /dev/null
+++ b/test/Transforms/InstCombine/cast-store-gep.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep inttoptr
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep alloca
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin10.0"
+ %T = type { i8*, i8 }
+
+define i8* @test(i8* %Val, i64 %V) nounwind {
+entry:
+ %A = alloca %T, align 8
+ %mrv_gep = bitcast %T* %A to i64* ; <i64*> [#uses=1]
+ %B = getelementptr %T* %A, i64 0, i32 0 ; <i8**> [#uses=1]
+
+ store i64 %V, i64* %mrv_gep
+ %C = load i8** %B, align 8 ; <i8*> [#uses=1]
+ ret i8* %C
+}
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll
new file mode 100644
index 000000000000..7a1e7a802dd3
--- /dev/null
+++ b/test/Transforms/InstCombine/cast.ll
@@ -0,0 +1,263 @@
+; Tests to make sure elimination of casts is working correctly
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep %c | notcast
+
+@inbuf = external global [32832 x i8] ; <[32832 x i8]*> [#uses=1]
+
+define i32 @test1(i32 %A) {
+ %c1 = bitcast i32 %A to i32 ; <i32> [#uses=1]
+ %c2 = bitcast i32 %c1 to i32 ; <i32> [#uses=1]
+ ret i32 %c2
+}
+
+define i64 @test2(i8 %A) {
+ %c1 = zext i8 %A to i16 ; <i16> [#uses=1]
+ %c2 = zext i16 %c1 to i32 ; <i32> [#uses=1]
+ %Ret = zext i32 %c2 to i64 ; <i64> [#uses=1]
+ ret i64 %Ret
+}
+
+; This function should just use bitwise AND
+define i64 @test3(i64 %A) {
+ %c1 = trunc i64 %A to i8 ; <i8> [#uses=1]
+ %c2 = zext i8 %c1 to i64 ; <i64> [#uses=1]
+ ret i64 %c2
+}
+
+define i32 @test4(i32 %A, i32 %B) {
+ %COND = icmp slt i32 %A, %B ; <i1> [#uses=1]
+ ; Booleans are unsigned integrals
+ %c = zext i1 %COND to i8 ; <i8> [#uses=1]
+ ; for the cast elim purpose
+ %result = zext i8 %c to i32 ; <i32> [#uses=1]
+ ret i32 %result
+}
+
+define i32 @test5(i1 %B) {
+ ; This cast should get folded into
+ %c = zext i1 %B to i8 ; <i8> [#uses=1]
+ ; this cast
+ %result = zext i8 %c to i32 ; <i32> [#uses=1]
+ ret i32 %result
+}
+
+define i32 @test6(i64 %A) {
+ %c1 = trunc i64 %A to i32 ; <i32> [#uses=1]
+ %res = bitcast i32 %c1 to i32 ; <i32> [#uses=1]
+ ret i32 %res
+}
+
+define i64 @test7(i1 %A) {
+ %c1 = zext i1 %A to i32 ; <i32> [#uses=1]
+ %res = sext i32 %c1 to i64 ; <i64> [#uses=1]
+ ret i64 %res
+}
+
+define i64 @test8(i8 %A) {
+ %c1 = sext i8 %A to i64 ; <i64> [#uses=1]
+ %res = bitcast i64 %c1 to i64 ; <i64> [#uses=1]
+ ret i64 %res
+}
+
+define i16 @test9(i16 %A) {
+ %c1 = sext i16 %A to i32 ; <i32> [#uses=1]
+ %c2 = trunc i32 %c1 to i16 ; <i16> [#uses=1]
+ ret i16 %c2
+}
+
+define i16 @test10(i16 %A) {
+ %c1 = sext i16 %A to i32 ; <i32> [#uses=1]
+ %c2 = trunc i32 %c1 to i16 ; <i16> [#uses=1]
+ ret i16 %c2
+}
+
+declare void @varargs(i32, ...)
+
+define void @test11(i32* %P) {
+ %c = bitcast i32* %P to i16* ; <i16*> [#uses=1]
+ call void (i32, ...)* @varargs( i32 5, i16* %c )
+ ret void
+}
+
+define i32* @test12() {
+ %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1]
+ %c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1]
+ ret i32* %c
+}
+define i8* @test13(i64 %A) {
+ %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1]
+ ret i8* %c
+}
+
+define i1 @test14(i8 %A) {
+ %c = bitcast i8 %A to i8 ; <i8> [#uses=1]
+ %X = icmp ult i8 %c, -128 ; <i1> [#uses=1]
+ ret i1 %X
+}
+
+
+; This just won't occur when there's no difference between ubyte and sbyte
+;bool %test15(ubyte %A) {
+; %c = cast ubyte %A to sbyte
+; %X = setlt sbyte %c, 0 ; setgt %A, 127
+; ret bool %X
+;}
+
+define i1 @test16(i32* %P) {
+ %c = icmp ne i32* %P, null ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i16 @test17(i1 %tmp3) {
+ %c = zext i1 %tmp3 to i32 ; <i32> [#uses=1]
+ %t86 = trunc i32 %c to i16 ; <i16> [#uses=1]
+ ret i16 %t86
+}
+
+define i16 @test18(i8 %tmp3) {
+ %c = sext i8 %tmp3 to i32 ; <i32> [#uses=1]
+ %t86 = trunc i32 %c to i16 ; <i16> [#uses=1]
+ ret i16 %t86
+}
+
+define i1 @test19(i32 %X) {
+ %c = sext i32 %X to i64 ; <i64> [#uses=1]
+ %Z = icmp slt i64 %c, 12345 ; <i1> [#uses=1]
+ ret i1 %Z
+}
+
+define i1 @test20(i1 %B) {
+ %c = zext i1 %B to i32 ; <i32> [#uses=1]
+ %D = icmp slt i32 %c, -1 ; <i1> [#uses=1]
+ ;; false
+ ret i1 %D
+}
+
+define i32 @test21(i32 %X) {
+ %c1 = trunc i32 %X to i8 ; <i8> [#uses=1]
+ ;; sext -> zext -> and -> nop
+ %c2 = sext i8 %c1 to i32 ; <i32> [#uses=1]
+ %RV = and i32 %c2, 255 ; <i32> [#uses=1]
+ ret i32 %RV
+}
+
+define i32 @test22(i32 %X) {
+ %c1 = trunc i32 %X to i8 ; <i8> [#uses=1]
+ ;; sext -> zext -> and -> nop
+ %c2 = sext i8 %c1 to i32 ; <i32> [#uses=1]
+ %RV = shl i32 %c2, 24 ; <i32> [#uses=1]
+ ret i32 %RV
+}
+
+define i32 @test23(i32 %X) {
+ ;; Turn into an AND even though X
+ %c1 = trunc i32 %X to i16 ; <i16> [#uses=1]
+ ;; and Z are signed.
+ %c2 = zext i16 %c1 to i32 ; <i32> [#uses=1]
+ ret i32 %c2
+}
+
+define i1 @test24(i1 %C) {
+ %X = select i1 %C, i32 14, i32 1234 ; <i32> [#uses=1]
+ ;; Fold cast into select
+ %c = icmp ne i32 %X, 0 ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define void @test25(i32** %P) {
+ %c = bitcast i32** %P to float** ; <float**> [#uses=1]
+ ;; Fold cast into null
+ store float* null, float** %c
+ ret void
+}
+
+define i32 @test26(float %F) {
+ ;; no need to cast from float->double.
+ %c = fpext float %F to double ; <double> [#uses=1]
+ %D = fptosi double %c to i32 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define [4 x float]* @test27([9 x [4 x float]]* %A) {
+ %c = bitcast [9 x [4 x float]]* %A to [4 x float]* ; <[4 x float]*> [#uses=1]
+ ret [4 x float]* %c
+}
+
+define float* @test28([4 x float]* %A) {
+ %c = bitcast [4 x float]* %A to float* ; <float*> [#uses=1]
+ ret float* %c
+}
+
+define i32 @test29(i32 %c1, i32 %c2) {
+ %tmp1 = trunc i32 %c1 to i8 ; <i8> [#uses=1]
+ %tmp4.mask = trunc i32 %c2 to i8 ; <i8> [#uses=1]
+ %tmp = or i8 %tmp4.mask, %tmp1 ; <i8> [#uses=1]
+ %tmp10 = zext i8 %tmp to i32 ; <i32> [#uses=1]
+ ret i32 %tmp10
+}
+
+define i32 @test30(i32 %c1) {
+ %c2 = trunc i32 %c1 to i8 ; <i8> [#uses=1]
+ %c3 = xor i8 %c2, 1 ; <i8> [#uses=1]
+ %c4 = zext i8 %c3 to i32 ; <i32> [#uses=1]
+ ret i32 %c4
+}
+
+define i1 @test31(i64 %A) {
+ %B = trunc i64 %A to i32 ; <i32> [#uses=1]
+ %C = and i32 %B, 42 ; <i32> [#uses=1]
+ %D = icmp eq i32 %C, 10 ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define void @test32(double** %tmp) {
+ %tmp8 = malloc [16 x i8] ; <[16 x i8]*> [#uses=1]
+ %tmp8.upgrd.1 = bitcast [16 x i8]* %tmp8 to double* ; <double*> [#uses=1]
+ store double* %tmp8.upgrd.1, double** %tmp
+ ret void
+}
+
+define i32 @test33(i32 %c1) {
+ %x = bitcast i32 %c1 to float ; <float> [#uses=1]
+ %y = bitcast float %x to i32 ; <i32> [#uses=1]
+ ret i32 %y
+}
+
+define i16 @test34(i16 %a) {
+ %c1 = zext i16 %a to i32 ; <i32> [#uses=1]
+ %tmp21 = lshr i32 %c1, 8 ; <i32> [#uses=1]
+ %c2 = trunc i32 %tmp21 to i16 ; <i16> [#uses=1]
+ ret i16 %c2
+}
+
+define i16 @test35(i16 %a) {
+ %c1 = bitcast i16 %a to i16 ; <i16> [#uses=1]
+ %tmp2 = lshr i16 %c1, 8 ; <i16> [#uses=1]
+ %c2 = bitcast i16 %tmp2 to i16 ; <i16> [#uses=1]
+ ret i16 %c2
+}
+
+; icmp sgt i32 %a, -1
+; rdar://6480391
+define i1 @test36(i32 %a) {
+ %b = lshr i32 %a, 31
+ %c = trunc i32 %b to i8
+ %d = icmp eq i8 %c, 0
+ ret i1 %d
+}
+
+; ret i1 false
+define i1 @test37(i32 %a) {
+ %b = lshr i32 %a, 31
+ %c = or i32 %b, 512
+ %d = trunc i32 %c to i8
+ %e = icmp eq i8 %d, 11
+ ret i1 %e
+}
+
+define i64 @test38(i32 %a) {
+ %1 = icmp eq i32 %a, -2
+ %2 = zext i1 %1 to i8
+ %3 = xor i8 %2, 1
+ %4 = zext i8 %3 to i64
+ ret i64 %4
+}
diff --git a/test/Transforms/InstCombine/cast2.ll b/test/Transforms/InstCombine/cast2.ll
new file mode 100644
index 000000000000..5cc9087198b2
--- /dev/null
+++ b/test/Transforms/InstCombine/cast2.ll
@@ -0,0 +1,29 @@
+; Tests to make sure elimination of casts is working correctly
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+define i16 @test1(i16 %a) {
+ %tmp = zext i16 %a to i32 ; <i32> [#uses=2]
+ %tmp21 = lshr i32 %tmp, 8 ; <i32> [#uses=1]
+ %tmp5 = shl i32 %tmp, 8 ; <i32> [#uses=1]
+ %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1]
+ %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1]
+ ret i16 %tmp.upgrd.3
+}
+
+define i16 @test2(i16 %a) {
+ %tmp = zext i16 %a to i32 ; <i32> [#uses=2]
+ %tmp21 = lshr i32 %tmp, 9 ; <i32> [#uses=1]
+ %tmp5 = shl i32 %tmp, 8 ; <i32> [#uses=1]
+ %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1]
+ %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1]
+ ret i16 %tmp.upgrd.3
+}
+
+; PR1263
+define i32* @test3(i32* %tmp1) {
+ %tmp64 = bitcast i32* %tmp1 to { i32 }* ; <{ i32 }*> [#uses=1]
+ %tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0 ; <i32*> [#uses=1]
+ ret i32* %tmp65
+}
+
+
diff --git a/test/Transforms/InstCombine/cast_ld_addr_space.ll b/test/Transforms/InstCombine/cast_ld_addr_space.ll
new file mode 100644
index 000000000000..beb20e38545a
--- /dev/null
+++ b/test/Transforms/InstCombine/cast_ld_addr_space.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast | count 1
+
+; InstCombine can not 'load (cast P)' -> cast (load P)' if the cast changes
+; the address space.
+
+
+define void @test2(i8 addrspace(1)* %source, <2 x i8> addrspace(1)* %dest) {
+entry:
+ %arrayidx1 = bitcast <2 x i8> addrspace(1)* %dest to <2 x i8> addrspace(1)*
+ %conv = bitcast i8 addrspace(1)* %source to <16 x i8>*
+ %arrayidx22 = bitcast <16 x i8>* %conv to <16 x i8>*
+ %tmp3 = load <16 x i8>* %arrayidx22
+ %arrayidx223 = bitcast i8 addrspace(1)* %source to i8*
+ %tmp4 = load i8* %arrayidx223
+ %tmp5 = insertelement <2 x i8> undef, i8 %tmp4, i32 0
+ %splat = shufflevector <2 x i8> %tmp5, <2 x i8> undef, <2 x i32> zeroinitializer
+ store <2 x i8> %splat, <2 x i8> addrspace(1)* %arrayidx1
+ ret void
+} \ No newline at end of file
diff --git a/test/Transforms/InstCombine/cast_ptr.ll b/test/Transforms/InstCombine/cast_ptr.ll
new file mode 100644
index 000000000000..fd600a883047
--- /dev/null
+++ b/test/Transforms/InstCombine/cast_ptr.ll
@@ -0,0 +1,19 @@
+; Tests to make sure elimination of casts is working correctly
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast
+
+target datalayout = "p:32:32"
+
+define i8* @test1(i8* %t) {
+ %tmpc = ptrtoint i8* %t to i32 ; <i32> [#uses=1]
+ %tmpa = add i32 %tmpc, 32 ; <i32> [#uses=1]
+ %tv = inttoptr i32 %tmpa to i8* ; <i8*> [#uses=1]
+ ret i8* %tv
+}
+
+define i1 @test2(i8* %a, i8* %b) {
+ %tmpa = ptrtoint i8* %a to i32 ; <i32> [#uses=1]
+ %tmpb = ptrtoint i8* %b to i32 ; <i32> [#uses=1]
+ %r = icmp eq i32 %tmpa, %tmpb ; <i1> [#uses=1]
+ ret i1 %r
+}
+
diff --git a/test/Transforms/InstCombine/constant-fold-ptr-casts.ll b/test/Transforms/InstCombine/constant-fold-ptr-casts.ll
new file mode 100644
index 000000000000..27c460689184
--- /dev/null
+++ b/test/Transforms/InstCombine/constant-fold-ptr-casts.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 2143034560}
+
+; Instcombine should be able to completely fold this code.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+
+@bar = constant [3 x i64] [i64 9220983451228067448, i64 9220983451228067449, i64 9220983450959631991], align 8
+
+define i32 @foo() nounwind {
+entry:
+ %tmp87.2 = load i64* inttoptr (i32 add (i32 16, i32 ptrtoint ([3 x i64]* @bar to i32)) to i64*), align 8
+ %t0 = bitcast i64 %tmp87.2 to double
+ %tmp9192.2 = fptrunc double %t0 to float
+ %t1 = bitcast float %tmp9192.2 to i32
+ ret i32 %t1
+}
+
diff --git a/test/Transforms/InstCombine/dce-iterate.ll b/test/Transforms/InstCombine/dce-iterate.ll
new file mode 100644
index 000000000000..e222970df6d8
--- /dev/null
+++ b/test/Transforms/InstCombine/dce-iterate.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret double .sy}
+
+define internal double @ScaleObjectAdd(double %sx, double %sy, double %sz) nounwind {
+entry:
+ %sx34 = bitcast double %sx to i64 ; <i64> [#uses=1]
+ %sx3435 = zext i64 %sx34 to i960 ; <i960> [#uses=1]
+ %sy22 = bitcast double %sy to i64 ; <i64> [#uses=1]
+ %sy2223 = zext i64 %sy22 to i960 ; <i960> [#uses=1]
+ %sy222324 = shl i960 %sy2223, 320 ; <i960> [#uses=1]
+ %sy222324.ins = or i960 %sx3435, %sy222324 ; <i960> [#uses=1]
+ %sz10 = bitcast double %sz to i64 ; <i64> [#uses=1]
+ %sz1011 = zext i64 %sz10 to i960 ; <i960> [#uses=1]
+ %sz101112 = shl i960 %sz1011, 640 ; <i960> [#uses=1]
+ %sz101112.ins = or i960 %sy222324.ins, %sz101112
+
+ %a = trunc i960 %sz101112.ins to i64 ; <i64> [#uses=1]
+ %b = bitcast i64 %a to double ; <double> [#uses=1]
+ %c = lshr i960 %sz101112.ins, 320 ; <i960> [#uses=1]
+ %d = trunc i960 %c to i64 ; <i64> [#uses=1]
+ %e = bitcast i64 %d to double ; <double> [#uses=1]
+ %f = add double %b, %e
+
+ ret double %e
+}
diff --git a/test/Transforms/InstCombine/deadcode.ll b/test/Transforms/InstCombine/deadcode.ll
new file mode 100644
index 000000000000..43c179315548
--- /dev/null
+++ b/test/Transforms/InstCombine/deadcode.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 %A}
+; RUN: llvm-as < %s | opt -die | llvm-dis | not grep call.*llvm.stacksave
+
+define i32 @test(i32 %A) {
+ %X = or i1 false, false
+ br i1 %X, label %T, label %C
+
+T: ; preds = %0
+ %B = add i32 %A, 1
+ br label %C
+
+C: ; preds = %T, %0
+ %C.upgrd.1 = phi i32 [ %B, %T ], [ %A, %0 ]
+ ret i32 %C.upgrd.1
+}
+
+define i32* @test2(i32 %width) {
+ %tmp = call i8* @llvm.stacksave( )
+ %tmp14 = alloca i32, i32 %width
+ ret i32* %tmp14
+}
+
+declare i8* @llvm.stacksave()
+
diff --git a/test/Transforms/InstCombine/dg.exp b/test/Transforms/InstCombine/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/InstCombine/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/InstCombine/div-cmp-overflow.ll b/test/Transforms/InstCombine/div-cmp-overflow.ll
new file mode 100644
index 000000000000..9276c96479d7
--- /dev/null
+++ b/test/Transforms/InstCombine/div-cmp-overflow.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sdiv
+; PR2740
+
+define i1 @func_75(i32 %i2) nounwind {
+ %i3 = sdiv i32 %i2, -1328634635
+ %i4 = icmp eq i32 %i3, -1
+ ret i1 %i4
+}
diff --git a/test/Transforms/InstCombine/div.ll b/test/Transforms/InstCombine/div.ll
new file mode 100644
index 000000000000..ea6ea6323c56
--- /dev/null
+++ b/test/Transforms/InstCombine/div.ll
@@ -0,0 +1,84 @@
+; This test makes sure that div instructions are properly eliminated.
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
+
+define i32 @test1(i32 %A) {
+ %B = sdiv i32 %A, 1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) {
+ ; => Shift
+ %B = udiv i32 %A, 8 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test3(i32 %A) {
+ ; => 0, don't need to keep traps
+ %B = sdiv i32 0, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test4(i32 %A) {
+ ; 0-A
+ %B = sdiv i32 %A, -1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test5(i32 %A) {
+ %B = udiv i32 %A, -16 ; <i32> [#uses=1]
+ %C = udiv i32 %B, -4 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i1 @test6(i32 %A) {
+ %B = udiv i32 %A, 123 ; <i32> [#uses=1]
+ ; A < 123
+ %C = icmp eq i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test7(i32 %A) {
+ %B = udiv i32 %A, 10 ; <i32> [#uses=1]
+ ; A >= 20 && A < 30
+ %C = icmp eq i32 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test8(i8 %A) {
+ %B = udiv i8 %A, 123 ; <i8> [#uses=1]
+ ; A >= 246
+ %C = icmp eq i8 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test9(i8 %A) {
+ %B = udiv i8 %A, 123 ; <i8> [#uses=1]
+ ; A < 246
+ %C = icmp ne i8 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i32 @test10(i32 %X, i1 %C) {
+ %V = select i1 %C, i32 64, i32 8 ; <i32> [#uses=1]
+ %R = udiv i32 %X, %V ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test11(i32 %X, i1 %C) {
+ %A = select i1 %C, i32 1024, i32 32 ; <i32> [#uses=1]
+ %B = udiv i32 %X, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+; PR2328
+define i32 @test12(i32 %x) nounwind {
+ %tmp3 = udiv i32 %x, %x ; 1
+ ret i32 %tmp3
+}
+
+define i32 @test13(i32 %x) nounwind {
+ %tmp3 = sdiv i32 %x, %x ; 1
+ ret i32 %tmp3
+}
+
diff --git a/test/Transforms/InstCombine/enforce-known-alignment.ll b/test/Transforms/InstCombine/enforce-known-alignment.ll
new file mode 100644
index 000000000000..6ac24a85a22e
--- /dev/null
+++ b/test/Transforms/InstCombine/enforce-known-alignment.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep alloca | grep {align 16}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+
+define void @foo(i32) {
+ %2 = alloca [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>], align 16 ; <[3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>]*> [#uses=1]
+ %3 = getelementptr [3 x <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>]* %2, i32 0, i32 0 ; <<{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>*> [#uses=1]
+ %4 = getelementptr <{ { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } } }>* %3, i32 0, i32 0 ; <{ { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }*> [#uses=1]
+ %5 = getelementptr { { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 } }* %4, i32 0, i32 0 ; <{ [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 }*> [#uses=1]
+ %6 = bitcast { [2 x { { i32 } }], [2 x i8], { i16 }, [2 x i8], i8, i8 }* %5 to { [8 x i16] }* ; <{ [8 x i16] }*> [#uses=1]
+ %7 = getelementptr { [8 x i16] }* %6, i32 0, i32 0 ; <[8 x i16]*> [#uses=1]
+ %8 = getelementptr [8 x i16]* %7, i32 0, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %8, align 16
+ call void @bar(i16* %8)
+ ret void
+}
+
+declare void @bar(i16*)
diff --git a/test/Transforms/InstCombine/extractvalue.ll b/test/Transforms/InstCombine/extractvalue.ll
new file mode 100644
index 000000000000..59b996e130e1
--- /dev/null
+++ b/test/Transforms/InstCombine/extractvalue.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractvalue
+
+; Instcombine should fold various combinations of insertvalue and extractvalue
+; together
+declare void @bar({i32, i32} %a)
+
+define i32 @foo() {
+ ; Build a simple struct and pull values out again
+ %s1.1 = insertvalue {i32, i32} undef, i32 0, 0
+ %s1 = insertvalue {i32, i32} %s1.1, i32 1, 1
+ %v1 = extractvalue {i32, i32} %s1, 0
+ %v2 = extractvalue {i32, i32} %s1, 1
+
+ ; Build a nested struct and pull a sub struct out of it
+ ; This requires instcombine to insert a few insertvalue instructions
+ %ns1.1 = insertvalue {i32, {i32, i32}} undef, i32 %v1, 0
+ %ns1.2 = insertvalue {i32, {i32, i32}} %ns1.1, i32 %v1, 1, 0
+ %ns1 = insertvalue {i32, {i32, i32}} %ns1.2, i32 %v2, 1, 1
+ %s2 = extractvalue {i32, {i32, i32}} %ns1, 1
+ %v3 = extractvalue {i32, {i32, i32}} %ns1, 1, 1
+ call void @bar({i32, i32} %s2)
+
+ ; Use nested extractvalues to get to a value
+ %s3 = extractvalue {i32, {i32, i32}} %ns1, 1
+ %v4 = extractvalue {i32, i32} %s3, 1
+ call void @bar({i32, i32} %s3)
+
+ ; Use nested insertvalues to build a nested struct
+ %s4.1 = insertvalue {i32, i32} undef, i32 %v3, 0
+ %s4 = insertvalue {i32, i32} %s4.1, i32 %v4, 1
+ %ns2 = insertvalue {i32, {i32, i32}} undef, {i32, i32} %s4, 1
+
+ ; And now extract a single value from there
+ %v5 = extractvalue {i32, {i32, i32}} %ns2, 1, 1
+
+ ret i32 %v5
+}
+
diff --git a/test/Transforms/InstCombine/fold-vector-zero.ll b/test/Transforms/InstCombine/fold-vector-zero.ll
new file mode 100644
index 000000000000..0b5b30a5c6e7
--- /dev/null
+++ b/test/Transforms/InstCombine/fold-vector-zero.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep zeroinitializer
+
+define void @foo(i64 %A, i64 %B) {
+bb8:
+ br label %bb30
+
+bb30:
+ %s0 = phi i64 [ 0, %bb8 ], [ %r21, %bb30 ]
+ %l0 = phi i64 [ -2222, %bb8 ], [ %r23, %bb30 ]
+ %r2 = add i64 %s0, %B
+ %r3 = inttoptr i64 %r2 to <2 x double>*
+ %r4 = load <2 x double>* %r3, align 8
+ %r6 = bitcast <2 x double> %r4 to <2 x i64>
+ %r7 = bitcast <2 x double> zeroinitializer to <2 x i64>
+ %r8 = insertelement <2 x i64> undef, i64 9223372036854775807, i32 0
+ %r9 = insertelement <2 x i64> undef, i64 -9223372036854775808, i32 0
+ %r10 = insertelement <2 x i64> %r8, i64 9223372036854775807, i32 1
+ %r11 = insertelement <2 x i64> %r9, i64 -9223372036854775808, i32 1
+ %r12 = and <2 x i64> %r6, %r10
+ %r13 = and <2 x i64> %r7, %r11
+ %r14 = or <2 x i64> %r12, %r13
+ %r15 = bitcast <2 x i64> %r14 to <2 x double>
+ %r18 = add i64 %s0, %A
+ %r19 = inttoptr i64 %r18 to <2 x double>*
+ store <2 x double> %r15, <2 x double>* %r19, align 8
+ %r21 = add i64 16, %s0
+ %r23 = add i64 1, %l0
+ %r25 = icmp slt i64 %r23, 0
+ %r26 = zext i1 %r25 to i64
+ %r27 = icmp ne i64 %r26, 0
+ br i1 %r27, label %bb30, label %bb5
+
+bb5:
+ ret void
+}
diff --git a/test/Transforms/InstCombine/fp-ret-bitcast.ll b/test/Transforms/InstCombine/fp-ret-bitcast.ll
new file mode 100644
index 000000000000..00c1ea0b96a6
--- /dev/null
+++ b/test/Transforms/InstCombine/fp-ret-bitcast.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {call float bitcast} | count 1
+ %struct.NSObject = type { %struct.objc_class* }
+ %struct.NSArray = type { %struct.NSObject }
+ %struct.objc_class = type opaque
+ %struct.objc_selector = type opaque
+
+@"\01L_OBJC_METH_VAR_NAME_112" = internal global [15 x i8] c"whiteComponent\00", section "__TEXT,__cstring,cstring_literals"
+@"\01L_OBJC_SELECTOR_REFERENCES_81" = internal global %struct.objc_selector* bitcast ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_112" to %struct.objc_selector*), section "__OBJC,__message_refs,literal_pointers,no_dead_strip"
+
+define void @bork() nounwind {
+entry:
+ %color = alloca %struct.NSArray*
+ %color.466 = alloca %struct.NSObject*
+ %tmp103 = load %struct.NSArray** %color, align 4
+ %tmp103104 = getelementptr %struct.NSArray* %tmp103, i32 0, i32 0
+ store %struct.NSObject* %tmp103104, %struct.NSObject** %color.466, align 4
+ %tmp105 = load %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4
+ %tmp106 = load %struct.NSObject** %color.466, align 4
+ %tmp107 = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)( %struct.NSObject* %tmp106, %struct.objc_selector* %tmp105 ) nounwind
+ br label %exit
+
+exit:
+ ret void
+}
+
+declare void @objc_msgSend_fpret(%struct.NSObject*, ...)
diff --git a/test/Transforms/InstCombine/fpcast.ll b/test/Transforms/InstCombine/fpcast.ll
new file mode 100644
index 000000000000..7f25092976f9
--- /dev/null
+++ b/test/Transforms/InstCombine/fpcast.ll
@@ -0,0 +1,15 @@
+; Test some floating point casting cases
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | notcast
+; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \
+; RUN: egrep {ret i8 \(-1\)\|\(255\)}
+
+define i8 @test1() {
+ %x = fptoui float 2.550000e+02 to i8 ; <i8> [#uses=1]
+ ret i8 %x
+}
+
+define i8 @test2() {
+ %x = fptosi float -1.000000e+00 to i8 ; <i8> [#uses=1]
+ ret i8 %x
+}
+
diff --git a/test/Transforms/InstCombine/fpextend.ll b/test/Transforms/InstCombine/fpextend.ll
new file mode 100644
index 000000000000..5971080cef5c
--- /dev/null
+++ b/test/Transforms/InstCombine/fpextend.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep fpext
+@X = external global float
+@Y = external global float
+
+define void @test() nounwind {
+entry:
+ %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
+ %tmp3 = add double %tmp1, 0.000000e+00 ; <double> [#uses=1]
+ %tmp34 = fptrunc double %tmp3 to float ; <float> [#uses=1]
+ store float %tmp34, float* @X, align 4
+ ret void
+}
+
+define void @test3() nounwind {
+entry:
+ %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
+ %tmp2 = load float* @Y, align 4 ; <float> [#uses=1]
+ %tmp23 = fpext float %tmp2 to double ; <double> [#uses=1]
+ %tmp5 = fdiv double %tmp1, %tmp23 ; <double> [#uses=1]
+ %tmp56 = fptrunc double %tmp5 to float ; <float> [#uses=1]
+ store float %tmp56, float* @X, align 4
+ ret void
+}
+
+define void @test4() nounwind {
+entry:
+ %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
+ %tmp2 = sub double -0.000000e+00, %tmp1 ; <double> [#uses=1]
+ %tmp34 = fptrunc double %tmp2 to float ; <float> [#uses=1]
+ store float %tmp34, float* @X, align 4
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/getelementptr-setcc.ll b/test/Transforms/InstCombine/getelementptr-setcc.ll
new file mode 100644
index 000000000000..0a6d720d74f6
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr-setcc.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep getelementptr
+
+define i1 @test1(i16* %P, i32 %I, i32 %J) {
+ %X = getelementptr i16* %P, i32 %I ; <i16*> [#uses=1]
+ %Y = getelementptr i16* %P, i32 %J ; <i16*> [#uses=1]
+ %C = icmp ult i16* %X, %Y ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test2(i16* %P, i32 %I) {
+ %X = getelementptr i16* %P, i32 %I ; <i16*> [#uses=1]
+ %C = icmp ult i16* %X, %P ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i32 @test3(i32* %P, i32 %A, i32 %B) {
+ %tmp.4 = getelementptr i32* %P, i32 %A ; <i32*> [#uses=1]
+ %tmp.9 = getelementptr i32* %P, i32 %B ; <i32*> [#uses=1]
+ %tmp.10 = icmp eq i32* %tmp.4, %tmp.9 ; <i1> [#uses=1]
+ %tmp.11 = zext i1 %tmp.10 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp.11
+}
+
+define i32 @test4(i32* %P, i32 %A, i32 %B) {
+ %tmp.4 = getelementptr i32* %P, i32 %A ; <i32*> [#uses=1]
+ %tmp.6 = icmp eq i32* %tmp.4, %P ; <i1> [#uses=1]
+ %tmp.7 = zext i1 %tmp.6 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp.7
+}
+
diff --git a/test/Transforms/InstCombine/getelementptr-seteq.ll b/test/Transforms/InstCombine/getelementptr-seteq.ll
new file mode 100644
index 000000000000..05cec622b2ac
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr-seteq.ll
@@ -0,0 +1,13 @@
+; Test folding of constantexpr geps into normal geps.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i64 %X, -1}
+; PR2235
+
+%S = type { i32, [ 100 x i32] }
+
+define i1 @test(i64 %X, %S* %P) {
+ %A = getelementptr %S* %P, i32 0, i32 1, i64 %X
+ %B = getelementptr %S* %P, i32 0, i32 0
+ %C = icmp eq i32* %A, %B
+ ret i1 %C
+}
+
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll
new file mode 100644
index 000000000000..c2cb72080319
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr.ll
@@ -0,0 +1,81 @@
+; The %A getelementptr instruction should be eliminated here
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v %B | not grep getelementptr
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep foo1
+; END.
+
+@Global = constant [10 x i8] c"helloworld" ; <[10 x i8]*> [#uses=1]
+
+; Test noop elimination
+define i32* @foo1(i32* %I) {
+ %A = getelementptr i32* %I, i64 0 ; <i32*> [#uses=1]
+ ret i32* %A
+}
+
+; Test noop elimination
+define i32* @foo2(i32* %I) {
+ %A = getelementptr i32* %I ; <i32*> [#uses=1]
+ ret i32* %A
+}
+
+; Test that two array indexing geps fold
+define i32* @foo3(i32* %I) {
+ %A = getelementptr i32* %I, i64 17 ; <i32*> [#uses=1]
+ %B = getelementptr i32* %A, i64 4 ; <i32*> [#uses=1]
+ ret i32* %B
+}
+
+; Test that two getelementptr insts fold
+define i32* @foo4({ i32 }* %I) {
+ %A = getelementptr { i32 }* %I, i64 1 ; <{ i32 }*> [#uses=1]
+ %B = getelementptr { i32 }* %A, i64 0, i32 0 ; <i32*> [#uses=1]
+ ret i32* %B
+}
+
+define void @foo5(i8 %B) {
+ ; This should be turned into a constexpr instead of being an instruction
+ %A = getelementptr [10 x i8]* @Global, i64 0, i64 4 ; <i8*> [#uses=1]
+ store i8 %B, i8* %A
+ ret void
+}
+
+define i32* @foo6() {
+ %M = malloc [4 x i32] ; <[4 x i32]*> [#uses=1]
+ %A = getelementptr [4 x i32]* %M, i64 0, i64 0 ; <i32*> [#uses=1]
+ %B = getelementptr i32* %A, i64 2 ; <i32*> [#uses=1]
+ ret i32* %B
+}
+
+define i32* @foo7(i32* %I, i64 %C, i64 %D) {
+ %A = getelementptr i32* %I, i64 %C ; <i32*> [#uses=1]
+ %B = getelementptr i32* %A, i64 %D ; <i32*> [#uses=1]
+ ret i32* %B
+}
+
+define i8* @foo8([10 x i32]* %X) {
+ ;; Fold into the cast.
+ %A = getelementptr [10 x i32]* %X, i64 0, i64 0 ; <i32*> [#uses=1]
+ %B = bitcast i32* %A to i8* ; <i8*> [#uses=1]
+ ret i8* %B
+}
+
+define i32 @test9() {
+ %A = getelementptr { i32, double }* null, i32 0, i32 1 ; <double*> [#uses=1]
+ %B = ptrtoint double* %A to i32 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) {
+ %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ; <i32*> [#uses=1]
+ ;; seteq x, y
+ %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+define i1 @test11({ i32, i32 }* %X) {
+ %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 ; <i32*> [#uses=1]
+ %Q = icmp eq i32* %P, null ; <i1> [#uses=1]
+ ret i1 %Q
+}
diff --git a/test/Transforms/InstCombine/getelementptr_cast.ll b/test/Transforms/InstCombine/getelementptr_cast.ll
new file mode 100644
index 000000000000..1d2fcce13d39
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr_cast.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: notcast {} {getelementptr.*}
+
+@G = external global [3 x i8] ; <[3 x i8]*> [#uses=1]
+
+define i8* @foo(i32 %Idx) {
+ %gep.upgrd.1 = zext i32 %Idx to i64 ; <i64> [#uses=1]
+ %tmp = getelementptr i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i64 %gep.upgrd.1 ; <i8*> [#uses=1]
+ ret i8* %tmp
+}
+
diff --git a/test/Transforms/InstCombine/getelementptr_const.ll b/test/Transforms/InstCombine/getelementptr_const.ll
new file mode 100644
index 000000000000..823ff5efde99
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr_const.ll
@@ -0,0 +1,15 @@
+; Test folding of constantexpr geps into normal geps.
+; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \
+; RUN: llvm-dis | not grep getelementptr
+
+@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=2]
+
+define i32 @test(i64 %X) {
+ %A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X ; <i32*> [#uses=1]
+ %B = getelementptr [40 x i32]* @Array, i64 0, i64 %X ; <i32*> [#uses=1]
+ %a = ptrtoint i32* %A to i32 ; <i32> [#uses=1]
+ %b = ptrtoint i32* %B to i32 ; <i32> [#uses=1]
+ %c = sub i32 %a, %b ; <i32> [#uses=1]
+ ret i32 %c
+}
+
diff --git a/test/Transforms/InstCombine/getelementptr_index.ll b/test/Transforms/InstCombine/getelementptr_index.ll
new file mode 100644
index 000000000000..556096516f97
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr_index.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep trunc
+
+target datalayout = "e-p:32:32"
+
+define i32* @test(i32* %X, i64 %Idx) {
+ %R = getelementptr i32* %X, i64 %Idx ; <i32*> [#uses=1]
+ ret i32* %R
+}
+
diff --git a/test/Transforms/InstCombine/getelementptr_promote.ll b/test/Transforms/InstCombine/getelementptr_promote.ll
new file mode 100644
index 000000000000..811c5a959169
--- /dev/null
+++ b/test/Transforms/InstCombine/getelementptr_promote.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr | grep {, i64}
+
+; Instcombine should promote the getelementptr index up to the target's
+; pointer size, making the conversion explicit, which helps expose it to
+; other optimizations.
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+
+define i64 @test(i64* %first, i32 %count) nounwind {
+entry:
+ %first_addr = alloca i64* ; <i64**> [#uses=2]
+ %count_addr = alloca i32 ; <i32*> [#uses=2]
+ %retval = alloca i64 ; <i64*> [#uses=2]
+ %n = alloca i32 ; <i32*> [#uses=5]
+ %result = alloca i64 ; <i64*> [#uses=4]
+ %0 = alloca i64 ; <i64*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i64* %first, i64** %first_addr
+ store i32 %count, i32* %count_addr
+ store i64 0, i64* %result, align 8
+ store i32 0, i32* %n, align 4
+ br label %bb1
+
+bb: ; preds = %bb1
+ %1 = load i64** %first_addr, align 8 ; <i64*> [#uses=1]
+ %2 = load i32* %n, align 4 ; <i32> [#uses=1]
+ %3 = bitcast i32 %2 to i32 ; <i64> [#uses=1]
+ %4 = getelementptr i64* %1, i32 %3 ; <i64*> [#uses=1]
+ %5 = load i64* %4, align 8 ; <i64> [#uses=1]
+ %6 = lshr i64 %5, 4 ; <i64> [#uses=1]
+ %7 = load i64* %result, align 8 ; <i64> [#uses=1]
+ %8 = add i64 %6, %7 ; <i64> [#uses=1]
+ store i64 %8, i64* %result, align 8
+ %9 = load i32* %n, align 4 ; <i32> [#uses=1]
+ %10 = add i32 %9, 1 ; <i32> [#uses=1]
+ store i32 %10, i32* %n, align 4
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %11 = load i32* %n, align 4 ; <i32> [#uses=1]
+ %12 = load i32* %count_addr, align 4 ; <i32> [#uses=1]
+ %13 = icmp slt i32 %11, %12 ; <i1> [#uses=1]
+ %14 = zext i1 %13 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %14, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ %15 = load i64* %result, align 8 ; <i64> [#uses=1]
+ store i64 %15, i64* %0, align 8
+ %16 = load i64* %0, align 8 ; <i64> [#uses=1]
+ store i64 %16, i64* %retval, align 8
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i64* %retval ; <i64> [#uses=1]
+ ret i64 %retval3
+}
diff --git a/test/Transforms/InstCombine/hoist_instr.ll b/test/Transforms/InstCombine/hoist_instr.ll
new file mode 100644
index 000000000000..e425bc2a5a90
--- /dev/null
+++ b/test/Transforms/InstCombine/hoist_instr.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: %prcontext div 1 | grep then:
+
+;; This tests that the div is hoisted into the then block.
+define i32 @foo(i1 %C, i32 %A, i32 %B) {
+entry:
+ br i1 %C, label %then, label %endif
+
+then: ; preds = %entry
+ br label %endif
+
+endif: ; preds = %then, %entry
+ %X = phi i32 [ %A, %then ], [ 15, %entry ] ; <i32> [#uses=1]
+ %Y = sdiv i32 %X, 42 ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
new file mode 100644
index 000000000000..27136d69438d
--- /dev/null
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep icmp
+
+define i32 @test1(i32 %X) {
+entry:
+ icmp slt i32 %X, 0 ; <i1>:0 [#uses=1]
+ zext i1 %0 to i32 ; <i32>:1 [#uses=1]
+ ret i32 %1
+}
+
+define i32 @test2(i32 %X) {
+entry:
+ icmp ult i32 %X, -2147483648 ; <i1>:0 [#uses=1]
+ zext i1 %0 to i32 ; <i32>:1 [#uses=1]
+ ret i32 %1
+}
+
+define i32 @test3(i32 %X) {
+entry:
+ icmp slt i32 %X, 0 ; <i1>:0 [#uses=1]
+ sext i1 %0 to i32 ; <i32>:1 [#uses=1]
+ ret i32 %1
+}
+
+define i32 @test4(i32 %X) {
+entry:
+ icmp ult i32 %X, -2147483648 ; <i1>:0 [#uses=1]
+ sext i1 %0 to i32 ; <i32>:1 [#uses=1]
+ ret i32 %1
+}
+
diff --git a/test/Transforms/InstCombine/known_align.ll b/test/Transforms/InstCombine/known_align.ll
new file mode 100644
index 000000000000..a6e340902dfb
--- /dev/null
+++ b/test/Transforms/InstCombine/known_align.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 1}
+; END.
+
+ %struct.p = type <{ i8, i32 }>
+@t = global %struct.p <{ i8 1, i32 10 }> ; <%struct.p*> [#uses=1]
+@u = weak global %struct.p zeroinitializer ; <%struct.p*> [#uses=1]
+
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp1 = alloca i32, align 4 ; <i32*> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp3 = load i32* getelementptr (%struct.p* @t, i32 0, i32 1), align 1 ; <i32> [#uses=1]
+ store i32 %tmp3, i32* %tmp1, align 4
+ %tmp5 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ store i32 %tmp5, i32* getelementptr (%struct.p* @u, i32 0, i32 1), align 1
+ %tmp6 = load i32* %tmp1, align 4 ; <i32> [#uses=1]
+ store i32 %tmp6, i32* %tmp, align 4
+ %tmp7 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ store i32 %tmp7, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval8 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval8
+}
diff --git a/test/Transforms/InstCombine/load.ll b/test/Transforms/InstCombine/load.ll
new file mode 100644
index 000000000000..85a749541e82
--- /dev/null
+++ b/test/Transforms/InstCombine/load.ll
@@ -0,0 +1,78 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep load
+
+@X = constant i32 42 ; <i32*> [#uses=2]
+@X2 = constant i32 47 ; <i32*> [#uses=1]
+@Y = constant [2 x { i32, float }] [ { i32, float } { i32 12, float 1.000000e+00 }, { i32, float } { i32 37, float 0x3FF3B2FEC0000000 } ] ; <[2 x { i32, float }]*> [#uses=2]
+@Z = constant [2 x { i32, float }] zeroinitializer ; <[2 x { i32, float }]*> [#uses=1]
+
+define i32 @test1() {
+ %B = load i32* @X ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define float @test2() {
+ %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; <float*> [#uses=1]
+ %B = load float* %A ; <float> [#uses=1]
+ ret float %B
+}
+
+define i32 @test3() {
+ %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; <i32*> [#uses=1]
+ %B = load i32* %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test4() {
+ %A = getelementptr [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0 ; <i32*> [#uses=1]
+ %B = load i32* %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test5(i1 %C) {
+ %Y = select i1 %C, i32* @X, i32* @X2 ; <i32*> [#uses=1]
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test7(i32 %X) {
+ %V = getelementptr i32* null, i32 %X ; <i32*> [#uses=1]
+ %R = load i32* %V ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test8(i32* %P) {
+ store i32 1, i32* %P
+ %X = load i32* %P ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+define i32 @test9(i32* %P) {
+ %X = load i32* %P ; <i32> [#uses=1]
+ %Y = load i32* %P ; <i32> [#uses=1]
+ %Z = sub i32 %X, %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test10(i1 %C.upgrd.1, i32* %P, i32* %Q) {
+ br i1 %C.upgrd.1, label %T, label %F
+T: ; preds = %0
+ store i32 1, i32* %Q
+ store i32 0, i32* %P
+ br label %C
+F: ; preds = %0
+ store i32 0, i32* %P
+ br label %C
+C: ; preds = %F, %T
+ %V = load i32* %P ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define double @test11(double* %p) {
+ %t0 = getelementptr double* %p, i32 1
+ store double 2.0, double* %t0
+ %t1 = getelementptr double* %p, i32 1
+ %x = load double* %t1
+ ret double %x
+}
diff --git a/test/Transforms/InstCombine/load2.ll b/test/Transforms/InstCombine/load2.ll
new file mode 100644
index 000000000000..5c3cf330543b
--- /dev/null
+++ b/test/Transforms/InstCombine/load2.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep load
+
+@GLOBAL = internal constant [4 x i32] zeroinitializer
+
+
+define <16 x i8> @foo(<2 x i64> %x) {
+entry:
+ %tmp = load <16 x i8> * bitcast ([4 x i32]* @GLOBAL to <16 x i8>*)
+ ret <16 x i8> %tmp
+}
+
diff --git a/test/Transforms/InstCombine/load3.ll b/test/Transforms/InstCombine/load3.ll
new file mode 100644
index 000000000000..e102d39e015d
--- /dev/null
+++ b/test/Transforms/InstCombine/load3.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load | count 1
+
+; Instcombine should be able to do trivial CSE of loads.
+
+declare void @use(double %n)
+define void @bar(double* %p) {
+ %t0 = getelementptr double* %p, i32 1
+ %y = load double* %t0
+ %t1 = getelementptr double* %p, i32 1
+ %x = load double* %t1
+ call void @use(double %x)
+ call void @use(double %y)
+ ret void
+}
diff --git a/test/Transforms/InstCombine/loadstore-alignment.ll b/test/Transforms/InstCombine/loadstore-alignment.ll
new file mode 100644
index 000000000000..ebea3e4fe831
--- /dev/null
+++ b/test/Transforms/InstCombine/loadstore-alignment.ll
@@ -0,0 +1,66 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {, align 16} | count 14
+
+@x = external global <2 x i64>, align 16
+@xx = external global [13 x <2 x i64>], align 16
+
+define <2 x i64> @static_hem() {
+ %t = getelementptr <2 x i64>* @x, i32 7
+ %tmp1 = load <2 x i64>* %t, align 1
+ ret <2 x i64> %tmp1
+}
+
+define <2 x i64> @hem(i32 %i) {
+ %t = getelementptr <2 x i64>* @x, i32 %i
+ %tmp1 = load <2 x i64>* %t, align 1
+ ret <2 x i64> %tmp1
+}
+
+define <2 x i64> @hem_2d(i32 %i, i32 %j) {
+ %t = getelementptr [13 x <2 x i64>]* @xx, i32 %i, i32 %j
+ %tmp1 = load <2 x i64>* %t, align 1
+ ret <2 x i64> %tmp1
+}
+
+define <2 x i64> @foo() {
+ %tmp1 = load <2 x i64>* @x, align 1
+ ret <2 x i64> %tmp1
+}
+
+define <2 x i64> @bar() {
+ %t = alloca <2 x i64>
+ call void @kip(<2 x i64>* %t);
+ %tmp1 = load <2 x i64>* %t, align 1
+ ret <2 x i64> %tmp1
+}
+
+define void @static_hem_store(<2 x i64> %y) {
+ %t = getelementptr <2 x i64>* @x, i32 7
+ store <2 x i64> %y, <2 x i64>* %t, align 1
+ ret void
+}
+
+define void @hem_store(i32 %i, <2 x i64> %y) {
+ %t = getelementptr <2 x i64>* @x, i32 %i
+ store <2 x i64> %y, <2 x i64>* %t, align 1
+ ret void
+}
+
+define void @hem_2d_store(i32 %i, i32 %j, <2 x i64> %y) {
+ %t = getelementptr [13 x <2 x i64>]* @xx, i32 %i, i32 %j
+ store <2 x i64> %y, <2 x i64>* %t, align 1
+ ret void
+}
+
+define void @foo_store(<2 x i64> %y) {
+ store <2 x i64> %y, <2 x i64>* @x, align 1
+ ret void
+}
+
+define void @bar_store(<2 x i64> %y) {
+ %t = alloca <2 x i64>
+ call void @kip(<2 x i64>* %t);
+ store <2 x i64> %y, <2 x i64>* %t, align 1
+ ret void
+}
+
+declare void @kip(<2 x i64>* %t)
diff --git a/test/Transforms/InstCombine/logical-select.ll b/test/Transforms/InstCombine/logical-select.ll
new file mode 100644
index 000000000000..3bb2d348b383
--- /dev/null
+++ b/test/Transforms/InstCombine/logical-select.ll
@@ -0,0 +1,54 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: grep select %t | count 5
+; RUN: not grep and %t
+; RUN: not grep or %t
+
+define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind {
+ %e = icmp slt i32 %a, %b
+ %f = sext i1 %e to i32
+ %g = and i32 %c, %f
+ %h = xor i32 %f, -1
+ %i = and i32 %d, %h
+ %j = or i32 %g, %i
+ ret i32 %j
+}
+define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d) nounwind {
+ %e = icmp slt i32 %a, %b
+ %f = sext i1 %e to i32
+ %g = and i32 %c, %f
+ %h = xor i32 %f, -1
+ %i = and i32 %d, %h
+ %j = or i32 %i, %g
+ ret i32 %j
+}
+define i32 @goo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind {
+entry:
+ %0 = icmp slt i32 %a, %b
+ %iftmp.0.0 = select i1 %0, i32 -1, i32 0
+ %1 = and i32 %iftmp.0.0, %c
+ %not = xor i32 %iftmp.0.0, -1
+ %2 = and i32 %not, %d
+ %3 = or i32 %1, %2
+ ret i32 %3
+}
+define i32 @poo(i32 %a, i32 %b, i32 %c, i32 %d) nounwind {
+entry:
+ %0 = icmp slt i32 %a, %b
+ %iftmp.0.0 = select i1 %0, i32 -1, i32 0
+ %1 = and i32 %iftmp.0.0, %c
+ %iftmp = select i1 %0, i32 0, i32 -1
+ %2 = and i32 %iftmp, %d
+ %3 = or i32 %1, %2
+ ret i32 %3
+}
+
+define i32 @par(i32 %a, i32 %b, i32 %c, i32 %d) nounwind {
+entry:
+ %0 = icmp slt i32 %a, %b
+ %iftmp.1.0 = select i1 %0, i32 -1, i32 0
+ %1 = and i32 %iftmp.1.0, %c
+ %not = xor i32 %iftmp.1.0, -1
+ %2 = and i32 %not, %d
+ %3 = or i32 %1, %2
+ ret i32 %3
+}
diff --git a/test/Transforms/InstCombine/lshr-phi.ll b/test/Transforms/InstCombine/lshr-phi.ll
new file mode 100644
index 000000000000..683eb87931ef
--- /dev/null
+++ b/test/Transforms/InstCombine/lshr-phi.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: not grep lshr %t
+; RUN: grep add %t | count 1
+
+; Instcombine should be able to eliminate the lshr, because only
+; bits in the operand which might be non-zero will be shifted
+; off the end.
+
+define i32 @hash_string(i8* nocapture %key) nounwind readonly {
+entry:
+ %t0 = load i8* %key, align 1 ; <i8> [#uses=1]
+ %t1 = icmp eq i8 %t0, 0 ; <i1> [#uses=1]
+ br i1 %t1, label %bb2, label %bb
+
+bb: ; preds = %bb, %entry
+ %indvar = phi i64 [ 0, %entry ], [ %tmp, %bb ] ; <i64> [#uses=2]
+ %k.04 = phi i32 [ 0, %entry ], [ %t8, %bb ] ; <i32> [#uses=2]
+ %cp.05 = getelementptr i8* %key, i64 %indvar ; <i8*> [#uses=1]
+ %t2 = shl i32 %k.04, 1 ; <i32> [#uses=1]
+ %t3 = lshr i32 %k.04, 14 ; <i32> [#uses=1]
+ %t4 = add i32 %t2, %t3 ; <i32> [#uses=1]
+ %t5 = load i8* %cp.05, align 1 ; <i8> [#uses=1]
+ %t6 = sext i8 %t5 to i32 ; <i32> [#uses=1]
+ %t7 = xor i32 %t6, %t4 ; <i32> [#uses=1]
+ %t8 = and i32 %t7, 16383 ; <i32> [#uses=2]
+ %tmp = add i64 %indvar, 1 ; <i64> [#uses=2]
+ %scevgep = getelementptr i8* %key, i64 %tmp ; <i8*> [#uses=1]
+ %t9 = load i8* %scevgep, align 1 ; <i8> [#uses=1]
+ %t10 = icmp eq i8 %t9, 0 ; <i1> [#uses=1]
+ br i1 %t10, label %bb2, label %bb
+
+bb2: ; preds = %bb, %entry
+ %k.0.lcssa = phi i32 [ 0, %entry ], [ %t8, %bb ] ; <i32> [#uses=1]
+ ret i32 %k.0.lcssa
+}
diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll
new file mode 100644
index 000000000000..24f793f7ca8f
--- /dev/null
+++ b/test/Transforms/InstCombine/malloc-free-delete.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc
+; PR1201
+define i32 @main(i32 %argc, i8** %argv) {
+ %c_19 = alloca i8* ; <i8**> [#uses=2]
+ %malloc_206 = malloc i8, i32 10 ; <i8*> [#uses=1]
+ store i8* %malloc_206, i8** %c_19
+ %tmp_207 = load i8** %c_19 ; <i8*> [#uses=1]
+ free i8* %tmp_207
+ ret i32 0
+}
diff --git a/test/Transforms/InstCombine/malloc.ll b/test/Transforms/InstCombine/malloc.ll
new file mode 100644
index 000000000000..6a4601a2ebee
--- /dev/null
+++ b/test/Transforms/InstCombine/malloc.ll
@@ -0,0 +1,7 @@
+; test that malloc's with a constant argument are promoted to array allocations
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr
+
+define i32* @test() {
+ %X = malloc i32, i32 4
+ ret i32* %X
+}
diff --git a/test/Transforms/InstCombine/malloc2.ll b/test/Transforms/InstCombine/malloc2.ll
new file mode 100644
index 000000000000..eb7c9abfcef5
--- /dev/null
+++ b/test/Transforms/InstCombine/malloc2.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc
+; PR1313
+
+define i32 @test1(i32 %argc, i8* %argv, i8* %envp) {
+ %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1]
+ %c = icmp eq [2564 x i32]* %tmp15.i.i.i23, null ; <i1>:0 [#uses=1]
+ %retval = zext i1 %c to i32 ; <i32> [#uses=1]
+ ret i32 %retval
+}
+
+define i32 @test2(i32 %argc, i8* %argv, i8* %envp) {
+ %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1]
+ %X = bitcast [2564 x i32]* %tmp15.i.i.i23 to i32*
+ %c = icmp ne i32* %X, null
+ %retval = zext i1 %c to i32 ; <i32> [#uses=1]
+ ret i32 %retval
+}
+
diff --git a/test/Transforms/InstCombine/malloc3.ll b/test/Transforms/InstCombine/malloc3.ll
new file mode 100644
index 000000000000..f6f412dfe062
--- /dev/null
+++ b/test/Transforms/InstCombine/malloc3.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {malloc.*struct.foo} | count 2
+; PR1728
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+ %struct.foo = type { %struct.foo*, [10 x i32] }
+@.str = internal constant [21 x i8] c"tmp = %p, next = %p\0A\00" ; <[21 x i8]*> [#uses=1]
+
+define i32 @main() {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp1 = malloc i8, i32 44 ; <i8*> [#uses=1]
+ %tmp12 = bitcast i8* %tmp1 to %struct.foo* ; <%struct.foo*> [#uses=3]
+ %tmp3 = malloc i8, i32 44 ; <i8*> [#uses=1]
+ %tmp34 = bitcast i8* %tmp3 to %struct.foo* ; <%struct.foo*> [#uses=1]
+ %tmp6 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1]
+ store %struct.foo* %tmp34, %struct.foo** %tmp6, align 4
+ %tmp8 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1]
+ %tmp9 = load %struct.foo** %tmp8, align 4 ; <%struct.foo*> [#uses=1]
+ %tmp10 = getelementptr [21 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp13 = call i32 (i8*, ...)* @printf( i8* %tmp10, %struct.foo* %tmp12, %struct.foo* %tmp9 ) ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @printf(i8*, ...)
+
diff --git a/test/Transforms/InstCombine/memcpy-to-load.ll b/test/Transforms/InstCombine/memcpy-to-load.ll
new file mode 100644
index 000000000000..7a0027d7789f
--- /dev/null
+++ b/test/Transforms/InstCombine/memcpy-to-load.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {load double}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+
+define void @foo(double* %X, double* %Y) {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp2 = bitcast double* %X to i8* ; <i8*> [#uses=1]
+ %tmp13 = bitcast double* %Y to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 8, i32 1 )
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/InstCombine/memmove.ll b/test/Transforms/InstCombine/memmove.ll
new file mode 100644
index 000000000000..09ec67d2654e
--- /dev/null
+++ b/test/Transforms/InstCombine/memmove.ll
@@ -0,0 +1,42 @@
+; This test makes sure that memmove instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {call void @llvm.memmove}
+
+@S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1]
+@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
+@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1]
+@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1]
+
+
+declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
+
+define void @test1(i8* %A, i8* %B, i32 %N) {
+ call void @llvm.memmove.i32( i8* %A, i8* %B, i32 0, i32 1 )
+ ret void
+}
+
+define void @test2(i8* %A, i32 %N) {
+ ;; dest can't alias source since we can't write to source!
+ call void @llvm.memmove.i32( i8* %A, i8* getelementptr ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1 )
+ ret void
+}
+
+define i32 @test3() {
+ %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1]
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3]
+ call void @llvm.memmove.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 )
+ call void @llvm.memmove.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 )
+ call void @llvm.memmove.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 )
+ ret i32 0
+}
+
+; PR2370
+define void @test4(i8* %a) {
+ tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 )
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/memset.ll b/test/Transforms/InstCombine/memset.ll
new file mode 100644
index 000000000000..27a5b60cade6
--- /dev/null
+++ b/test/Transforms/InstCombine/memset.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {call.*llvm.memset}
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32)
+
+define i32 @main() {
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=5]
+ call void @llvm.memset.i32( i8* %target_p, i8 1, i32 0, i32 1 )
+ call void @llvm.memset.i32( i8* %target_p, i8 1, i32 1, i32 1 )
+ call void @llvm.memset.i32( i8* %target_p, i8 1, i32 2, i32 2 )
+ call void @llvm.memset.i32( i8* %target_p, i8 1, i32 4, i32 4 )
+ call void @llvm.memset.i32( i8* %target_p, i8 1, i32 8, i32 8 )
+ ret i32 0
+}
+
diff --git a/test/Transforms/InstCombine/mul-masked-bits.ll b/test/Transforms/InstCombine/mul-masked-bits.ll
new file mode 100644
index 000000000000..9b0a5bfe20de
--- /dev/null
+++ b/test/Transforms/InstCombine/mul-masked-bits.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ashr
+
+define i32 @foo(i32 %x, i32 %y) {
+ %a = and i32 %x, 7
+ %b = and i32 %y, 7
+ %c = mul i32 %a, %b
+ %d = shl i32 %c, 26
+ %e = ashr i32 %d, 26
+ ret i32 %e
+}
diff --git a/test/Transforms/InstCombine/mul.ll b/test/Transforms/InstCombine/mul.ll
new file mode 100644
index 000000000000..1a7402543418
--- /dev/null
+++ b/test/Transforms/InstCombine/mul.ll
@@ -0,0 +1,93 @@
+; This test makes sure that mul instructions are properly eliminated.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
+
+define i32 @test1(i32 %A) {
+ %B = mul i32 %A, 1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) {
+ ; Should convert to an add instruction
+ %B = mul i32 %A, 2 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test3(i32 %A) {
+ ; This should disappear entirely
+ %B = mul i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define double @test4(double %A) {
+ ; This is safe for FP
+ %B = mul double 1.000000e+00, %A ; <double> [#uses=1]
+ ret double %B
+}
+
+define i32 @test5(i32 %A) {
+ %B = mul i32 %A, 8 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i8 @test6(i8 %A) {
+ %B = mul i8 %A, 8 ; <i8> [#uses=1]
+ %C = mul i8 %B, 8 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i32 @test7(i32 %i) {
+ %tmp = mul i32 %i, -1 ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+define i64 @test8(i64 %i) {
+ ; tmp = sub 0, %i
+ %j = mul i64 %i, -1 ; <i64> [#uses=1]
+ ret i64 %j
+}
+
+define i32 @test9(i32 %i) {
+ ; %j = sub 0, %i
+ %j = mul i32 %i, -1 ; <i32> [#uses=1]
+ ret i32 %j
+}
+
+define i32 @test10(i32 %a, i32 %b) {
+ %c = icmp slt i32 %a, 0 ; <i1> [#uses=1]
+ %d = zext i1 %c to i32 ; <i32> [#uses=1]
+ ; e = b & (a >> 31)
+ %e = mul i32 %d, %b ; <i32> [#uses=1]
+ ret i32 %e
+}
+
+define i32 @test11(i32 %a, i32 %b) {
+ %c = icmp sle i32 %a, -1 ; <i1> [#uses=1]
+ %d = zext i1 %c to i32 ; <i32> [#uses=1]
+ ; e = b & (a >> 31)
+ %e = mul i32 %d, %b ; <i32> [#uses=1]
+ ret i32 %e
+}
+
+define i32 @test12(i8 %a, i32 %b) {
+ %c = icmp ugt i8 %a, 127 ; <i1> [#uses=1]
+ %d = zext i1 %c to i32 ; <i32> [#uses=1]
+ ; e = b & (a >> 31)
+ %e = mul i32 %d, %b ; <i32> [#uses=1]
+ ret i32 %e
+}
+
+; PR2642
+define internal void @test13(<4 x float>*) {
+ load <4 x float>* %0, align 1
+ mul <4 x float> %2, < float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00 >
+ store <4 x float> %3, <4 x float>* %0, align 1
+ ret void
+}
+
+define internal void @test14(<4 x float>*) {
+ load <4 x float>* %0, align 1
+ mul <4 x float> %2, zeroinitializer
+ store <4 x float> %3, <4 x float>* %0, align 1
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/multi-use-or.ll b/test/Transforms/InstCombine/multi-use-or.ll
new file mode 100644
index 000000000000..85a8b34e2f6e
--- /dev/null
+++ b/test/Transforms/InstCombine/multi-use-or.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add double .sx, .sy}
+; The 'or' has multiple uses, make sure that this doesn't prevent instcombine
+; from propagating the extends to the truncs.
+
+define double @ScaleObjectAdd(double %sx, double %sy, double %sz) nounwind {
+entry:
+ %sx34 = bitcast double %sx to i64 ; <i64> [#uses=1]
+ %sx3435 = zext i64 %sx34 to i192 ; <i192> [#uses=1]
+ %sy22 = bitcast double %sy to i64 ; <i64> [#uses=1]
+ %sy2223 = zext i64 %sy22 to i192 ; <i192> [#uses=1]
+ %sy222324 = shl i192 %sy2223, 128 ; <i192> [#uses=1]
+ %sy222324.ins = or i192 %sx3435, %sy222324 ; <i192> [#uses=1]
+
+
+ %a = trunc i192 %sy222324.ins to i64 ; <i64> [#uses=1]
+ %b = bitcast i64 %a to double ; <double> [#uses=1]
+ %c = lshr i192 %sy222324.ins, 128 ; <i192> [#uses=1]
+ %d = trunc i192 %c to i64 ; <i64> [#uses=1]
+ %e = bitcast i64 %d to double ; <double> [#uses=1]
+ %f = add double %b, %e
+
+; ret double %e
+ ret double %f
+}
diff --git a/test/Transforms/InstCombine/narrow.ll b/test/Transforms/InstCombine/narrow.ll
new file mode 100644
index 000000000000..41106e759ce0
--- /dev/null
+++ b/test/Transforms/InstCombine/narrow.ll
@@ -0,0 +1,18 @@
+; This file contains various testcases that check to see that instcombine
+; is narrowing computations when possible.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i1 false}
+
+; test1 - Eliminating the casts in this testcase (by narrowing the AND
+; operation) allows instcombine to realize the function always returns false.
+;
+define i1 @test1(i32 %A, i32 %B) {
+ %C1 = icmp slt i32 %A, %B ; <i1> [#uses=1]
+ %ELIM1 = zext i1 %C1 to i32 ; <i32> [#uses=1]
+ %C2 = icmp sgt i32 %A, %B ; <i1> [#uses=1]
+ %ELIM2 = zext i1 %C2 to i32 ; <i32> [#uses=1]
+ %C3 = and i32 %ELIM1, %ELIM2 ; <i32> [#uses=1]
+ %ELIM3 = trunc i32 %C3 to i1 ; <i1> [#uses=1]
+ ret i1 %ELIM3
+}
+
diff --git a/test/Transforms/InstCombine/not-fcmp.ll b/test/Transforms/InstCombine/not-fcmp.ll
new file mode 100644
index 000000000000..4560419a35fc
--- /dev/null
+++ b/test/Transforms/InstCombine/not-fcmp.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep "fcmp uge"
+; PR1570
+
+define i1 @f(float %X, float %Y) {
+entry:
+ %tmp3 = fcmp olt float %X, %Y ; <i1> [#uses=1]
+ %toBoolnot5 = xor i1 %tmp3, true ; <i1> [#uses=1]
+ ret i1 %toBoolnot5
+}
+
diff --git a/test/Transforms/InstCombine/not.ll b/test/Transforms/InstCombine/not.ll
new file mode 100644
index 000000000000..a79e51871818
--- /dev/null
+++ b/test/Transforms/InstCombine/not.ll
@@ -0,0 +1,54 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor
+
+define i32 @test1(i32 %A) {
+ %B = xor i32 %A, -1 ; <i32> [#uses=1]
+ %C = xor i32 %B, -1 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i1 @test2(i32 %A, i32 %B) {
+ ; Can change into setge
+ %cond = icmp sle i32 %A, %B ; <i1> [#uses=1]
+ %Ret = xor i1 %cond, true ; <i1> [#uses=1]
+ ret i1 %Ret
+}
+
+; Test that demorgans law can be instcombined
+define i32 @test3(i32 %A, i32 %B) {
+ %a = xor i32 %A, -1 ; <i32> [#uses=1]
+ %b = xor i32 %B, -1 ; <i32> [#uses=1]
+ %c = and i32 %a, %b ; <i32> [#uses=1]
+ %d = xor i32 %c, -1 ; <i32> [#uses=1]
+ ret i32 %d
+}
+
+; Test that demorgens law can work with constants
+define i32 @test4(i32 %A, i32 %B) {
+ %a = xor i32 %A, -1 ; <i32> [#uses=1]
+ %c = and i32 %a, 5 ; <i32> [#uses=1]
+ %d = xor i32 %c, -1 ; <i32> [#uses=1]
+ ret i32 %d
+}
+
+; test the mirror of demorgans law...
+define i32 @test5(i32 %A, i32 %B) {
+ %a = xor i32 %A, -1 ; <i32> [#uses=1]
+ %b = xor i32 %B, -1 ; <i32> [#uses=1]
+ %c = or i32 %a, %b ; <i32> [#uses=1]
+ %d = xor i32 %c, -1 ; <i32> [#uses=1]
+ ret i32 %d
+}
+
+; PR2298
+define i8 @test6(i32 %a, i32 %b) zeroext nounwind {
+entry:
+ %tmp1not = xor i32 %a, -1 ; <i32> [#uses=1]
+ %tmp2not = xor i32 %b, -1 ; <i32> [#uses=1]
+ %tmp3 = icmp slt i32 %tmp1not, %tmp2not ; <i1> [#uses=1]
+ %retval67 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
+ ret i8 %retval67
+}
+
diff --git a/test/Transforms/InstCombine/nothrow.ll b/test/Transforms/InstCombine/nothrow.ll
new file mode 100644
index 000000000000..fbf162a1db84
--- /dev/null
+++ b/test/Transforms/InstCombine/nothrow.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call
+; rdar://6880732
+declare double @t1(i32) readonly
+
+define void @t2() nounwind {
+ call double @t1(i32 42) ;; dead call even though callee is not nothrow.
+ ret void
+}
diff --git a/test/Transforms/InstCombine/odr-linkage.ll b/test/Transforms/InstCombine/odr-linkage.ll
new file mode 100644
index 000000000000..96f883335bcc
--- /dev/null
+++ b/test/Transforms/InstCombine/odr-linkage.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 10}
+
+@g1 = available_externally constant i32 1
+@g2 = linkonce_odr constant i32 2
+@g3 = weak_odr constant i32 3
+@g4 = internal constant i32 4
+
+define i32 @test() {
+ %A = load i32* @g1
+ %B = load i32* @g2
+ %C = load i32* @g3
+ %D = load i32* @g4
+
+ %a = add i32 %A, %B
+ %b = add i32 %a, %C
+ %c = add i32 %b, %D
+ ret i32 %c
+}
+ \ No newline at end of file
diff --git a/test/Transforms/InstCombine/or-fcmp.ll b/test/Transforms/InstCombine/or-fcmp.ll
new file mode 100644
index 000000000000..3833c6f706fb
--- /dev/null
+++ b/test/Transforms/InstCombine/or-fcmp.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fcmp | count 3
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | grep 1
+
+define zeroext i8 @t1(float %x, float %y) nounwind {
+ %a = fcmp ueq float %x, %y ; <i1> [#uses=1]
+ %b = fcmp uno float %x, %y ; <i1> [#uses=1]
+ %c = or i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
+
+define zeroext i8 @t2(float %x, float %y) nounwind {
+ %a = fcmp olt float %x, %y ; <i1> [#uses=1]
+ %b = fcmp oeq float %x, %y ; <i1> [#uses=1]
+ %c = or i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
+
+define zeroext i8 @t3(float %x, float %y) nounwind {
+ %a = fcmp ult float %x, %y ; <i1> [#uses=1]
+ %b = fcmp uge float %x, %y ; <i1> [#uses=1]
+ %c = or i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
+
+define zeroext i8 @t4(float %x, float %y) nounwind {
+ %a = fcmp ult float %x, %y ; <i1> [#uses=1]
+ %b = fcmp ugt float %x, %y ; <i1> [#uses=1]
+ %c = or i1 %a, %b
+ %retval = zext i1 %c to i8
+ ret i8 %retval
+}
diff --git a/test/Transforms/InstCombine/or-to-xor.ll b/test/Transforms/InstCombine/or-to-xor.ll
new file mode 100644
index 000000000000..e40417b17d35
--- /dev/null
+++ b/test/Transforms/InstCombine/or-to-xor.ll
@@ -0,0 +1,42 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {xor i32 %a, %b} | count 4
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and}
+
+define i32 @func1(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %b_not = xor i32 %b, -1
+ %0 = and i32 %a, %b_not
+ %a_not = xor i32 %a, -1
+ %1 = and i32 %a_not, %b
+ %2 = or i32 %0, %1
+ ret i32 %2
+}
+
+define i32 @func2(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %b_not = xor i32 %b, -1
+ %0 = and i32 %b_not, %a
+ %a_not = xor i32 %a, -1
+ %1 = and i32 %a_not, %b
+ %2 = or i32 %0, %1
+ ret i32 %2
+}
+
+define i32 @func3(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %b_not = xor i32 %b, -1
+ %0 = and i32 %a, %b_not
+ %a_not = xor i32 %a, -1
+ %1 = and i32 %b, %a_not
+ %2 = or i32 %0, %1
+ ret i32 %2
+}
+
+define i32 @func4(i32 %a, i32 %b) nounwind readnone {
+entry:
+ %b_not = xor i32 %b, -1
+ %0 = and i32 %b_not, %a
+ %a_not = xor i32 %a, -1
+ %1 = and i32 %b, %a_not
+ %2 = or i32 %0, %1
+ ret i32 %2
+}
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
new file mode 100644
index 000000000000..e70fb1c4e0c0
--- /dev/null
+++ b/test/Transforms/InstCombine/or.ll
@@ -0,0 +1,171 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v xor | not grep {or }
+; END.
+
+define i32 @test1(i32 %A) {
+ %B = or i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) {
+ %B = or i32 %A, -1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i8 @test2a(i8 %A) {
+ %B = or i8 %A, -1 ; <i8> [#uses=1]
+ ret i8 %B
+}
+
+define i1 @test3(i1 %A) {
+ %B = or i1 %A, false ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test4(i1 %A) {
+ %B = or i1 %A, true ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test5(i1 %A) {
+ %B = or i1 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i32 @test6(i32 %A) {
+ %B = or i32 %A, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+; A | ~A == -1
+define i32 @test7(i32 %A) {
+ %NotA = xor i32 -1, %A ; <i32> [#uses=1]
+ %B = or i32 %A, %NotA ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i8 @test8(i8 %A) {
+ %B = or i8 %A, -2 ; <i8> [#uses=1]
+ %C = or i8 %B, 1 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+; Test that (A|c1)|(B|c2) == (A|B)|(c1|c2)
+define i8 @test9(i8 %A, i8 %B) {
+ %C = or i8 %A, 1 ; <i8> [#uses=1]
+ %D = or i8 %B, -2 ; <i8> [#uses=1]
+ %E = or i8 %C, %D ; <i8> [#uses=1]
+ ret i8 %E
+}
+
+define i8 @test10(i8 %A) {
+ %B = or i8 %A, 1 ; <i8> [#uses=1]
+ %C = and i8 %B, -2 ; <i8> [#uses=1]
+ ; (X & C1) | C2 --> (X | C2) & (C1|C2)
+ %D = or i8 %C, -2 ; <i8> [#uses=1]
+ ret i8 %D
+}
+
+define i8 @test11(i8 %A) {
+ %B = or i8 %A, -2 ; <i8> [#uses=1]
+ %C = xor i8 %B, 13 ; <i8> [#uses=1]
+ ; (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)
+ %D = or i8 %C, 1 ; <i8> [#uses=1]
+ %E = xor i8 %D, 12 ; <i8> [#uses=1]
+ ret i8 %E
+}
+
+define i32 @test12(i32 %A) {
+ ; Should be eliminated
+ %B = or i32 %A, 4 ; <i32> [#uses=1]
+ %C = and i32 %B, 8 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test13(i32 %A) {
+ %B = or i32 %A, 12 ; <i32> [#uses=1]
+ ; Always equal to 8
+ %C = and i32 %B, 8 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i1 @test14(i32 %A, i32 %B) {
+ %C1 = icmp ult i32 %A, %B ; <i1> [#uses=1]
+ %C2 = icmp ugt i32 %A, %B ; <i1> [#uses=1]
+ ; (A < B) | (A > B) === A != B
+ %D = or i1 %C1, %C2 ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test15(i32 %A, i32 %B) {
+ %C1 = icmp ult i32 %A, %B ; <i1> [#uses=1]
+ %C2 = icmp eq i32 %A, %B ; <i1> [#uses=1]
+ ; (A < B) | (A == B) === A <= B
+ %D = or i1 %C1, %C2 ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i32 @test16(i32 %A) {
+ %B = and i32 %A, 1 ; <i32> [#uses=1]
+ ; -2 = ~1
+ %C = and i32 %A, -2 ; <i32> [#uses=1]
+ ; %D = and int %B, -1 == %B
+ %D = or i32 %B, %C ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test17(i32 %A) {
+ %B = and i32 %A, 1 ; <i32> [#uses=1]
+ %C = and i32 %A, 4 ; <i32> [#uses=1]
+ ; %D = and int %B, 5
+ %D = or i32 %B, %C ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i1 @test18(i32 %A) {
+ %B = icmp sge i32 %A, 100 ; <i1> [#uses=1]
+ %C = icmp slt i32 %A, 50 ; <i1> [#uses=1]
+ ;; (A-50) >u 50
+ %D = or i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test19(i32 %A) {
+ %B = icmp eq i32 %A, 50 ; <i1> [#uses=1]
+ %C = icmp eq i32 %A, 51 ; <i1> [#uses=1]
+ ;; (A-50) < 2
+ %D = or i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i32 @test20(i32 %x) {
+ %y = and i32 %x, 123 ; <i32> [#uses=1]
+ %z = or i32 %y, %x ; <i32> [#uses=1]
+ ret i32 %z
+}
+
+define i32 @test21(i32 %tmp.1) {
+ %tmp.1.mask1 = add i32 %tmp.1, 2 ; <i32> [#uses=1]
+ %tmp.3 = and i32 %tmp.1.mask1, -2 ; <i32> [#uses=1]
+ %tmp.5 = and i32 %tmp.1, 1 ; <i32> [#uses=1]
+ ;; add tmp.1, 2
+ %tmp.6 = or i32 %tmp.5, %tmp.3 ; <i32> [#uses=1]
+ ret i32 %tmp.6
+}
+
+define i32 @test22(i32 %B) {
+ %ELIM41 = and i32 %B, 1 ; <i32> [#uses=1]
+ %ELIM7 = and i32 %B, -2 ; <i32> [#uses=1]
+ %ELIM5 = or i32 %ELIM41, %ELIM7 ; <i32> [#uses=1]
+ ret i32 %ELIM5
+}
+
+define i16 @test23(i16 %A) {
+ %B = lshr i16 %A, 1 ; <i16> [#uses=1]
+ ;; fold or into xor
+ %C = or i16 %B, -32768 ; <i16> [#uses=1]
+ %D = xor i16 %C, 8193 ; <i16> [#uses=1]
+ ret i16 %D
+}
diff --git a/test/Transforms/InstCombine/or2.ll b/test/Transforms/InstCombine/or2.ll
new file mode 100644
index 000000000000..f14a27439163
--- /dev/null
+++ b/test/Transforms/InstCombine/or2.ll
@@ -0,0 +1,12 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v xor | not grep {or }
+
+; PR1738
+define i1 @test1(double %X, double %Y) {
+ %tmp9 = fcmp uno double %X, 0.000000e+00 ; <i1> [#uses=1]
+ %tmp13 = fcmp uno double %Y, 0.000000e+00 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp13, %tmp9 ; <i1> [#uses=1]
+ ret i1 %bothcond
+}
+
diff --git a/test/Transforms/InstCombine/phi-merge.ll b/test/Transforms/InstCombine/phi-merge.ll
new file mode 100644
index 000000000000..daac41274cde
--- /dev/null
+++ b/test/Transforms/InstCombine/phi-merge.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {phi i32}
+; PR1777
+
+declare i1 @rrr()
+
+define i1 @zxcv() {
+entry:
+%a = alloca i32
+%i = ptrtoint i32* %a to i32
+%b = call i1 @rrr()
+br i1 %b, label %one, label %two
+
+one:
+%x = phi i32 [%i, %entry], [%y, %two]
+%c = call i1 @rrr()
+br i1 %c, label %two, label %end
+
+two:
+%y = phi i32 [%i, %entry], [%x, %one]
+%d = call i1 @rrr()
+br i1 %d, label %one, label %end
+
+end:
+%f = phi i32 [ %x, %one], [%y, %two]
+; Change the %f to %i, and the optimizer suddenly becomes a lot smarter
+; even though %f must equal %i at this point
+%g = inttoptr i32 %f to i32*
+store i32 10, i32* %g
+%z = call i1 @rrr()
+ret i1 %z
+}
diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll
new file mode 100644
index 000000000000..4efbb79d9d4e
--- /dev/null
+++ b/test/Transforms/InstCombine/phi.ll
@@ -0,0 +1,115 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep phi
+
+define i32 @test1(i32 %A, i1 %b) {
+BB0:
+ br i1 %b, label %BB1, label %BB2
+
+BB1: ; preds = %BB0
+ ; Combine away one argument PHI nodes
+ %B = phi i32 [ %A, %BB0 ] ; <i32> [#uses=1]
+ ret i32 %B
+
+BB2: ; preds = %BB0
+ ret i32 %A
+}
+
+define i32 @test2(i32 %A, i1 %b) {
+BB0:
+ br i1 %b, label %BB1, label %BB2
+
+BB1: ; preds = %BB0
+ br label %BB2
+
+BB2: ; preds = %BB1, %BB0
+ ; Combine away PHI nodes with same values
+ %B = phi i32 [ %A, %BB0 ], [ %A, %BB1 ] ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test3(i32 %A, i1 %b) {
+BB0:
+ br label %Loop
+
+Loop: ; preds = %Loop, %BB0
+ ; PHI has same value always.
+ %B = phi i32 [ %A, %BB0 ], [ %B, %Loop ] ; <i32> [#uses=2]
+ br i1 %b, label %Loop, label %Exit
+
+Exit: ; preds = %Loop
+ ret i32 %B
+}
+
+define i32 @test4(i1 %b) {
+BB0:
+ ; Loop is unreachable
+ ret i32 7
+
+Loop: ; preds = %L2, %Loop
+ ; PHI has same value always.
+ %B = phi i32 [ %B, %L2 ], [ %B, %Loop ] ; <i32> [#uses=2]
+ br i1 %b, label %L2, label %Loop
+
+L2: ; preds = %Loop
+ br label %Loop
+}
+
+define i32 @test5(i32 %A, i1 %b) {
+BB0:
+ br label %Loop
+
+Loop: ; preds = %Loop, %BB0
+ ; PHI has same value always.
+ %B = phi i32 [ %A, %BB0 ], [ undef, %Loop ] ; <i32> [#uses=1]
+ br i1 %b, label %Loop, label %Exit
+
+Exit: ; preds = %Loop
+ ret i32 %B
+}
+
+define i32 @test6(i32 %A, i1 %b) {
+BB0:
+ %X = bitcast i32 %A to i32 ; <i32> [#uses=1]
+ br i1 %b, label %BB1, label %BB2
+
+BB1: ; preds = %BB0
+ %Y = bitcast i32 %A to i32 ; <i32> [#uses=1]
+ br label %BB2
+
+BB2: ; preds = %BB1, %BB0
+ ;; Suck casts into phi
+ %B = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ] ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test7(i32 %A, i1 %b) {
+BB0:
+ br label %Loop
+
+Loop: ; preds = %Loop, %BB0
+ ; PHI is dead.
+ %B = phi i32 [ %A, %BB0 ], [ %C, %Loop ] ; <i32> [#uses=1]
+ %C = add i32 %B, 123 ; <i32> [#uses=1]
+ br i1 %b, label %Loop, label %Exit
+
+Exit: ; preds = %Loop
+ ret i32 0
+}
+
+define i32* @test8({ i32, i32 } *%A, i1 %b) {
+BB0:
+ %X = getelementptr { i32, i32 } *%A, i32 0, i32 1
+ br i1 %b, label %BB1, label %BB2
+
+BB1:
+ %Y = getelementptr { i32, i32 } *%A, i32 0, i32 1
+ br label %BB2
+
+BB2:
+ ;; Suck GEPs into phi
+ %B = phi i32* [ %X, %BB0 ], [ %Y, %BB1 ]
+ ret i32* %B
+}
+
+
diff --git a/test/Transforms/InstCombine/pr2645-0.ll b/test/Transforms/InstCombine/pr2645-0.ll
new file mode 100644
index 000000000000..04cc1852cb2a
--- /dev/null
+++ b/test/Transforms/InstCombine/pr2645-0.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {insertelement <4 x float> undef}
+
+; Instcombine should be able to prove that none of the
+; insertelement's first operand's elements are needed.
+
+define internal void @""(i8*) {
+; <label>:1
+ bitcast i8* %0 to i32* ; <i32*>:2 [#uses=1]
+ load i32* %2, align 1 ; <i32>:3 [#uses=1]
+ getelementptr i8* %0, i32 4 ; <i8*>:4 [#uses=1]
+ bitcast i8* %4 to i32* ; <i32*>:5 [#uses=1]
+ load i32* %5, align 1 ; <i32>:6 [#uses=1]
+ br label %7
+
+; <label>:7 ; preds = %9, %1
+ %.01 = phi <4 x float> [ undef, %1 ], [ %12, %9 ] ; <<4 x float>> [#uses=1]
+ %.0 = phi i32 [ %3, %1 ], [ %15, %9 ] ; <i32> [#uses=3]
+ icmp slt i32 %.0, %6 ; <i1>:8 [#uses=1]
+ br i1 %8, label %9, label %16
+
+; <label>:9 ; preds = %7
+ sitofp i32 %.0 to float ; <float>:10 [#uses=1]
+ insertelement <4 x float> %.01, float %10, i32 0 ; <<4 x float>>:11 [#uses=1]
+ shufflevector <4 x float> %11, <4 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>>:12 [#uses=2]
+ getelementptr i8* %0, i32 48 ; <i8*>:13 [#uses=1]
+ bitcast i8* %13 to <4 x float>* ; <<4 x float>*>:14 [#uses=1]
+ store <4 x float> %12, <4 x float>* %14, align 16
+ add i32 %.0, 2 ; <i32>:15 [#uses=1]
+ br label %7
+
+; <label>:16 ; preds = %7
+ ret void
+}
diff --git a/test/Transforms/InstCombine/pr2645-1.ll b/test/Transforms/InstCombine/pr2645-1.ll
new file mode 100644
index 000000000000..194d2cd18f70
--- /dev/null
+++ b/test/Transforms/InstCombine/pr2645-1.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shufflevector
+; PR2645
+
+; instcombine shouldn't delete the shufflevector.
+
+define internal void @""(i8*, i32, i8*) {
+; <label>:3
+ br label %4
+
+; <label>:4 ; preds = %6, %3
+ %.0 = phi i32 [ 0, %3 ], [ %19, %6 ] ; <i32> [#uses=4]
+ %5 = icmp slt i32 %.0, %1 ; <i1> [#uses=1]
+ br i1 %5, label %6, label %20
+
+; <label>:6 ; preds = %4
+ %7 = getelementptr i8* %2, i32 %.0 ; <i8*> [#uses=1]
+ %8 = bitcast i8* %7 to <4 x i16>* ; <<4 x i16>*> [#uses=1]
+ %9 = load <4 x i16>* %8, align 1 ; <<4 x i16>> [#uses=1]
+ %10 = bitcast <4 x i16> %9 to <1 x i64> ; <<1 x i64>> [#uses=1]
+ %11 = call <2 x i64> @foo(<1 x i64> %10)
+; <<2 x i64>> [#uses=1]
+ %12 = bitcast <2 x i64> %11 to <4 x i32> ; <<4 x i32>> [#uses=1]
+ %13 = bitcast <4 x i32> %12 to <8 x i16> ; <<8 x i16>> [#uses=2]
+ %14 = shufflevector <8 x i16> %13, <8 x i16> %13, <8 x i32> < i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3 > ; <<8 x i16>> [#uses=1]
+ %15 = bitcast <8 x i16> %14 to <4 x i32> ; <<4 x i32>> [#uses=1]
+ %16 = sitofp <4 x i32> %15 to <4 x float> ; <<4 x float>> [#uses=1]
+ %17 = getelementptr i8* %0, i32 %.0 ; <i8*> [#uses=1]
+ %18 = bitcast i8* %17 to <4 x float>* ; <<4 x float>*> [#uses=1]
+ store <4 x float> %16, <4 x float>* %18, align 1
+ %19 = add i32 %.0, 1 ; <i32> [#uses=1]
+ br label %4
+
+; <label>:20 ; preds = %4
+ call void @llvm.x86.mmx.emms( )
+ ret void
+}
+
+declare <2 x i64> @foo(<1 x i64>)
+declare void @llvm.x86.mmx.emms( )
diff --git a/test/Transforms/InstCombine/pr2996.ll b/test/Transforms/InstCombine/pr2996.ll
new file mode 100644
index 000000000000..3e7dfa2ba6df
--- /dev/null
+++ b/test/Transforms/InstCombine/pr2996.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine
+; PR2996
+
+define void @func_53(i16 signext %p_56) nounwind {
+entry:
+ %0 = icmp sgt i16 %p_56, -1 ; <i1> [#uses=1]
+ %iftmp.0.0 = select i1 %0, i32 -1, i32 0 ; <i32> [#uses=1]
+ %1 = call i32 (...)* @func_4(i32 %iftmp.0.0) nounwind ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @func_4(...)
diff --git a/test/Transforms/InstCombine/preserve-sminmax.ll b/test/Transforms/InstCombine/preserve-sminmax.ll
new file mode 100644
index 000000000000..24fb7dabe3d5
--- /dev/null
+++ b/test/Transforms/InstCombine/preserve-sminmax.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep { i32 \[%\]sd, \[\[:alnum:\]\]* \\?1\\>} | count 4
+
+; Instcombine normally would fold the sdiv into the comparison,
+; making "icmp slt i32 %h, 2", but in this case the sdiv has
+; another use, so it wouldn't a big win, and it would also
+; obfuscate an otherise obvious smax pattern to the point where
+; other analyses wouldn't recognize it.
+
+define i32 @foo(i32 %h) {
+ %sd = sdiv i32 %h, 2
+ %t = icmp slt i32 %sd, 1
+ %r = select i1 %t, i32 %sd, i32 1
+ ret i32 %r
+}
+
+define i32 @bar(i32 %h) {
+ %sd = sdiv i32 %h, 2
+ %t = icmp sgt i32 %sd, 1
+ %r = select i1 %t, i32 %sd, i32 1
+ ret i32 %r
+}
+
diff --git a/test/Transforms/InstCombine/ptr-int-cast.ll b/test/Transforms/InstCombine/ptr-int-cast.ll
new file mode 100644
index 000000000000..5c154397775e
--- /dev/null
+++ b/test/Transforms/InstCombine/ptr-int-cast.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+
+define i1 @test1(i32 *%x) nounwind {
+entry:
+; RUN: grep {ptrtoint i32\\* %x to i64} %t
+ %tmp = ptrtoint i32* %x to i1
+ ret i1 %tmp
+}
+
+define i32* @test2(i128 %x) nounwind {
+entry:
+; RUN: grep {inttoptr i64 %.mp1 to i32\\*} %t
+ %tmp = inttoptr i128 %x to i32*
+ ret i32* %tmp
+}
+
diff --git a/test/Transforms/InstCombine/rem.ll b/test/Transforms/InstCombine/rem.ll
new file mode 100644
index 000000000000..8b2263d9b23f
--- /dev/null
+++ b/test/Transforms/InstCombine/rem.ll
@@ -0,0 +1,83 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem
+; END.
+
+define i32 @test1(i32 %A) {
+ %B = srem i32 %A, 1 ; ISA constant 0
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) { ; 0 % X = 0, we don't need to preserve traps
+ %B = srem i32 0, %A
+ ret i32 %B
+}
+
+define i32 @test3(i32 %A) {
+ %B = urem i32 %A, 8
+ ret i32 %B
+}
+
+define i1 @test3a(i32 %A) {
+ %B = srem i32 %A, -8
+ %C = icmp ne i32 %B, 0
+ ret i1 %C
+}
+
+define i32 @test4(i32 %X, i1 %C) {
+ %V = select i1 %C, i32 1, i32 8
+ %R = urem i32 %X, %V
+ ret i32 %R
+}
+
+define i32 @test5(i32 %X, i8 %B) {
+ %shift.upgrd.1 = zext i8 %B to i32
+ %Amt = shl i32 32, %shift.upgrd.1
+ %V = urem i32 %X, %Amt
+ ret i32 %V
+}
+
+define i32 @test6(i32 %A) {
+ %B = srem i32 %A, 0 ;; undef
+ ret i32 %B
+}
+
+define i32 @test7(i32 %A) {
+ %B = mul i32 %A, 8
+ %C = srem i32 %B, 4
+ ret i32 %C
+}
+
+define i32 @test8(i32 %A) {
+ %B = shl i32 %A, 4
+ %C = srem i32 %B, 8
+ ret i32 %C
+}
+
+define i32 @test9(i32 %A) {
+ %B = mul i32 %A, 64
+ %C = urem i32 %B, 32
+ ret i32 %C
+}
+
+define i32 @test10(i8 %c) {
+ %tmp.1 = zext i8 %c to i32
+ %tmp.2 = mul i32 %tmp.1, 4
+ %tmp.3 = sext i32 %tmp.2 to i64
+ %tmp.5 = urem i64 %tmp.3, 4
+ %tmp.6 = trunc i64 %tmp.5 to i32
+ ret i32 %tmp.6
+}
+
+define i32 @test11(i32 %i) {
+ %tmp.1 = and i32 %i, -2
+ %tmp.3 = mul i32 %tmp.1, 2
+ %tmp.5 = urem i32 %tmp.3, 4
+ ret i32 %tmp.5
+}
+
+define i32 @test12(i32 %i) {
+ %tmp.1 = and i32 %i, -4
+ %tmp.5 = srem i32 %tmp.1, 2
+ ret i32 %tmp.5
+}
diff --git a/test/Transforms/InstCombine/sdiv-1.ll b/test/Transforms/InstCombine/sdiv-1.ll
new file mode 100644
index 000000000000..305b6d7df927
--- /dev/null
+++ b/test/Transforms/InstCombine/sdiv-1.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -instcombine -inline | llvm-dis | not grep '-715827882'
+; PR3142
+
+define i32 @a(i32 %X) nounwind readnone {
+entry:
+ %0 = sub i32 0, %X
+ %1 = sdiv i32 %0, -3
+ ret i32 %1
+}
+
+define i32 @b(i32 %X) nounwind readnone {
+entry:
+ %0 = call i32 @a(i32 -2147483648)
+ ret i32 %0
+}
+
+define i32 @c(i32 %X) nounwind readnone {
+entry:
+ %0 = sub i32 0, -2147483648
+ %1 = sdiv i32 %0, -3
+ ret i32 %1
+}
diff --git a/test/Transforms/InstCombine/sdiv-2.ll b/test/Transforms/InstCombine/sdiv-2.ll
new file mode 100644
index 000000000000..db0c7fbccf8e
--- /dev/null
+++ b/test/Transforms/InstCombine/sdiv-2.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -instcombine -disable-output
+; PR3144
+
+define fastcc i32 @func(i32 %length) nounwind {
+entry:
+ %0 = icmp ne i32 %length, -1 ; <i1> [#uses=1]
+ %iftmp.13.0 = select i1 %0, i128 0, i128 200000000 ; <i128> [#uses=2]
+ %1 = sdiv i128 %iftmp.13.0, 10 ; <i128> [#uses=1]
+ br label %bb5
+
+bb5: ; preds = %bb8, %entry
+ %v.0 = phi i128 [ 0, %entry ], [ %6, %bb8 ] ; <i128> [#uses=2]
+ %2 = icmp sgt i128 %v.0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %overflow, label %bb7
+
+bb7: ; preds = %bb5
+ %3 = mul i128 %v.0, 10 ; <i128> [#uses=2]
+ %4 = sub i128 %iftmp.13.0, 0 ; <i128> [#uses=1]
+ %5 = icmp slt i128 %4, %3 ; <i1> [#uses=1]
+ br i1 %5, label %overflow, label %bb8
+
+bb8: ; preds = %bb7
+ %6 = add i128 0, %3 ; <i128> [#uses=1]
+ br label %bb5
+
+overflow: ; preds = %bb7, %bb5
+ ret i32 1
+}
diff --git a/test/Transforms/InstCombine/select-2.ll b/test/Transforms/InstCombine/select-2.ll
new file mode 100644
index 000000000000..4621f6e152ad
--- /dev/null
+++ b/test/Transforms/InstCombine/select-2.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select | count 2
+
+; Make sure instcombine don't fold select into operands. We don't want to emit
+; select of two integers unless it's selecting 0 / 1.
+
+define i32 @t1(i32 %c, i32 %x) nounwind {
+ %t1 = icmp eq i32 %c, 0
+ %t2 = lshr i32 %x, 18
+ %t3 = select i1 %t1, i32 %t2, i32 %x
+ ret i32 %t3
+}
+
+define i32 @t2(i32 %c, i32 %x) nounwind {
+ %t1 = icmp eq i32 %c, 0
+ %t2 = and i32 %x, 18
+ %t3 = select i1 %t1, i32 %t2, i32 %x
+ ret i32 %t3
+}
diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll
new file mode 100644
index 000000000000..15083f2facd2
--- /dev/null
+++ b/test/Transforms/InstCombine/select.ll
@@ -0,0 +1,204 @@
+; This test makes sure that these instructions are properly eliminated.
+; PR1822
+
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select
+
+define i32 @test1(i32 %A, i32 %B) {
+ %C = select i1 false, i32 %A, i32 %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test2(i32 %A, i32 %B) {
+ %C = select i1 true, i32 %A, i32 %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+
+define i32 @test3(i1 %C, i32 %I) {
+ ; V = I
+ %V = select i1 %C, i32 %I, i32 %I ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i1 @test4(i1 %C) {
+ ; V = C
+ %V = select i1 %C, i1 true, i1 false ; <i1> [#uses=1]
+ ret i1 %V
+}
+
+define i1 @test5(i1 %C) {
+ ; V = !C
+ %V = select i1 %C, i1 false, i1 true ; <i1> [#uses=1]
+ ret i1 %V
+}
+
+define i32 @test6(i1 %C) {
+ ; V = cast C to int
+ %V = select i1 %C, i32 1, i32 0 ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i1 @test7(i1 %C, i1 %X) {
+ ; R = or C, X
+ %R = select i1 %C, i1 true, i1 %X ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i1 @test8(i1 %C, i1 %X) {
+ ; R = and C, X
+ %R = select i1 %C, i1 %X, i1 false ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i1 @test9(i1 %C, i1 %X) {
+ ; R = and !C, X
+ %R = select i1 %C, i1 false, i1 %X ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i1 @test10(i1 %C, i1 %X) {
+ ; R = or !C, X
+ %R = select i1 %C, i1 %X, i1 true ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i32 @test11(i32 %a) {
+ %C = icmp eq i32 %a, 0 ; <i1> [#uses=1]
+ %R = select i1 %C, i32 0, i32 1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
+define i32 @test12(i1 %cond, i32 %a) {
+ %b = or i32 %a, 1 ; <i32> [#uses=1]
+ %c = select i1 %cond, i32 %b, i32 %a ; <i32> [#uses=1]
+ ret i32 %c
+}
+
+define i32 @test12a(i1 %cond, i32 %a) {
+ %b = ashr i32 %a, 1 ; <i32> [#uses=1]
+ %c = select i1 %cond, i32 %b, i32 %a ; <i32> [#uses=1]
+ ret i32 %c
+}
+
+define i32 @test12b(i1 %cond, i32 %a) {
+ %b = ashr i32 %a, 1 ; <i32> [#uses=1]
+ %c = select i1 %cond, i32 %a, i32 %b ; <i32> [#uses=1]
+ ret i32 %c
+}
+
+define i32 @test13(i32 %a, i32 %b) {
+ %C = icmp eq i32 %a, %b ; <i1> [#uses=1]
+ %V = select i1 %C, i32 %a, i32 %b ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @test13a(i32 %a, i32 %b) {
+ %C = icmp ne i32 %a, %b ; <i1> [#uses=1]
+ %V = select i1 %C, i32 %a, i32 %b ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @test13b(i32 %a, i32 %b) {
+ %C = icmp eq i32 %a, %b ; <i1> [#uses=1]
+ %V = select i1 %C, i32 %b, i32 %a ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i1 @test14a(i1 %C, i32 %X) {
+ %V = select i1 %C, i32 %X, i32 0 ; <i32> [#uses=1]
+ ; (X < 1) | !C
+ %R = icmp slt i32 %V, 1 ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i1 @test14b(i1 %C, i32 %X) {
+ %V = select i1 %C, i32 0, i32 %X ; <i32> [#uses=1]
+ ; (X < 1) | C
+ %R = icmp slt i32 %V, 1 ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+;; Code sequence for (X & 16) ? 16 : 0
+define i32 @test15a(i32 %X) {
+ %t1 = and i32 %X, 16 ; <i32> [#uses=1]
+ %t2 = icmp eq i32 %t1, 0 ; <i1> [#uses=1]
+ %t3 = select i1 %t2, i32 0, i32 16 ; <i32> [#uses=1]
+ ret i32 %t3
+}
+
+;; Code sequence for (X & 32) ? 0 : 24
+define i32 @test15b(i32 %X) {
+ %t1 = and i32 %X, 32 ; <i32> [#uses=1]
+ %t2 = icmp eq i32 %t1, 0 ; <i1> [#uses=1]
+ %t3 = select i1 %t2, i32 32, i32 0 ; <i32> [#uses=1]
+ ret i32 %t3
+}
+
+;; Alternate code sequence for (X & 16) ? 16 : 0
+define i32 @test15c(i32 %X) {
+ %t1 = and i32 %X, 16 ; <i32> [#uses=1]
+ %t2 = icmp eq i32 %t1, 16 ; <i1> [#uses=1]
+ %t3 = select i1 %t2, i32 16, i32 0 ; <i32> [#uses=1]
+ ret i32 %t3
+}
+
+;; Alternate code sequence for (X & 16) ? 16 : 0
+define i32 @test15d(i32 %X) {
+ %t1 = and i32 %X, 16 ; <i32> [#uses=1]
+ %t2 = icmp ne i32 %t1, 0 ; <i1> [#uses=1]
+ %t3 = select i1 %t2, i32 16, i32 0 ; <i32> [#uses=1]
+ ret i32 %t3
+}
+
+define i32 @test16(i1 %C, i32* %P) {
+ %P2 = select i1 %C, i32* %P, i32* null ; <i32*> [#uses=1]
+ %V = load i32* %P2 ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i1 @test17(i32* %X, i1 %C) {
+ %R = select i1 %C, i32* %X, i32* null ; <i32*> [#uses=1]
+ %RV = icmp eq i32* %R, null ; <i1> [#uses=1]
+ ret i1 %RV
+}
+
+define i32 @test18(i32 %X, i32 %Y, i1 %C) {
+ %R = select i1 %C, i32 %X, i32 0 ; <i32> [#uses=1]
+ %V = sdiv i32 %Y, %R ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @test19(i32 %x) {
+ %tmp = icmp ugt i32 %x, 2147483647 ; <i1> [#uses=1]
+ %retval = select i1 %tmp, i32 -1, i32 0 ; <i32> [#uses=1]
+ ret i32 %retval
+}
+
+define i32 @test20(i32 %x) {
+ %tmp = icmp slt i32 %x, 0 ; <i1> [#uses=1]
+ %retval = select i1 %tmp, i32 -1, i32 0 ; <i32> [#uses=1]
+ ret i32 %retval
+}
+
+define i64 @test21(i32 %x) {
+ %tmp = icmp slt i32 %x, 0 ; <i1> [#uses=1]
+ %retval = select i1 %tmp, i64 -1, i64 0 ; <i64> [#uses=1]
+ ret i64 %retval
+}
+
+define i16 @test22(i32 %x) {
+ %tmp = icmp slt i32 %x, 0 ; <i1> [#uses=1]
+ %retval = select i1 %tmp, i16 -1, i16 0 ; <i16> [#uses=1]
+ ret i16 %retval
+}
+
+define i1 @test23(i1 %a, i1 %b) {
+ %c = select i1 %a, i1 %b, i1 %a ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i1 @test24(i1 %a, i1 %b) {
+ %c = select i1 %a, i1 %a, i1 %b ; <i1> [#uses=1]
+ ret i1 %c
+}
+
diff --git a/test/Transforms/InstCombine/set.ll b/test/Transforms/InstCombine/set.ll
new file mode 100644
index 000000000000..5e3ca0b51b89
--- /dev/null
+++ b/test/Transforms/InstCombine/set.ll
@@ -0,0 +1,171 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep icmp
+; END.
+
+@X = external global i32 ; <i32*> [#uses=2]
+
+define i1 @test1(i32 %A) {
+ %B = icmp eq i32 %A, %A ; <i1> [#uses=1]
+ ; Never true
+ %C = icmp eq i32* @X, null ; <i1> [#uses=1]
+ %D = and i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test2(i32 %A) {
+ %B = icmp ne i32 %A, %A ; <i1> [#uses=1]
+ ; Never false
+ %C = icmp ne i32* @X, null ; <i1> [#uses=1]
+ %D = or i1 %B, %C ; <i1> [#uses=1]
+ ret i1 %D
+}
+
+define i1 @test3(i32 %A) {
+ %B = icmp slt i32 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+
+define i1 @test4(i32 %A) {
+ %B = icmp sgt i32 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test5(i32 %A) {
+ %B = icmp sle i32 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test6(i32 %A) {
+ %B = icmp sge i32 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test7(i32 %A) {
+ ; true
+ %B = icmp uge i32 %A, 0 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test8(i32 %A) {
+ ; false
+ %B = icmp ult i32 %A, 0 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+;; test operations on boolean values these should all be eliminated$a
+define i1 @test9(i1 %A) {
+ ; false
+ %B = icmp ult i1 %A, false ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test10(i1 %A) {
+ ; false
+ %B = icmp ugt i1 %A, true ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test11(i1 %A) {
+ ; true
+ %B = icmp ule i1 %A, true ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test12(i1 %A) {
+ ; true
+ %B = icmp uge i1 %A, false ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test13(i1 %A, i1 %B) {
+ ; A | ~B
+ %C = icmp uge i1 %A, %B ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test14(i1 %A, i1 %B) {
+ ; ~(A ^ B)
+ %C = icmp eq i1 %A, %B ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test16(i32 %A) {
+ %B = and i32 %A, 5 ; <i32> [#uses=1]
+ ; Is never true
+ %C = icmp eq i32 %B, 8 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test17(i8 %A) {
+ %B = or i8 %A, 1 ; <i8> [#uses=1]
+ ; Always false
+ %C = icmp eq i8 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test18(i1 %C, i32 %a) {
+entry:
+ br i1 %C, label %endif, label %else
+
+else: ; preds = %entry
+ br label %endif
+
+endif: ; preds = %else, %entry
+ %b.0 = phi i32 [ 0, %entry ], [ 1, %else ] ; <i32> [#uses=1]
+ %tmp.4 = icmp slt i32 %b.0, 123 ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+define i1 @test19(i1 %A, i1 %B) {
+ %a = zext i1 %A to i32 ; <i32> [#uses=1]
+ %b = zext i1 %B to i32 ; <i32> [#uses=1]
+ %C = icmp eq i32 %a, %b ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i32 @test20(i32 %A) {
+ %B = and i32 %A, 1 ; <i32> [#uses=1]
+ %C = icmp ne i32 %B, 0 ; <i1> [#uses=1]
+ %D = zext i1 %C to i32 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test21(i32 %a) {
+ %tmp.6 = and i32 %a, 4 ; <i32> [#uses=1]
+ %not.tmp.7 = icmp ne i32 %tmp.6, 0 ; <i1> [#uses=1]
+ %retval = zext i1 %not.tmp.7 to i32 ; <i32> [#uses=1]
+ ret i32 %retval
+}
+
+define i1 @test22(i32 %A, i32 %X) {
+ %B = and i32 %A, 100663295 ; <i32> [#uses=1]
+ %C = icmp ult i32 %B, 268435456 ; <i1> [#uses=1]
+ %Y = and i32 %X, 7 ; <i32> [#uses=1]
+ %Z = icmp sgt i32 %Y, -1 ; <i1> [#uses=1]
+ %R = or i1 %C, %Z ; <i1> [#uses=1]
+ ret i1 %R
+}
+
+define i32 @test23(i32 %a) {
+ %tmp.1 = and i32 %a, 1 ; <i32> [#uses=1]
+ %tmp.2 = icmp eq i32 %tmp.1, 0 ; <i1> [#uses=1]
+ %tmp.3 = zext i1 %tmp.2 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
+define i32 @test24(i32 %a) {
+ %tmp1 = and i32 %a, 4 ; <i32> [#uses=1]
+ %tmp.1 = lshr i32 %tmp1, 2 ; <i32> [#uses=1]
+ %tmp.2 = icmp eq i32 %tmp.1, 0 ; <i1> [#uses=1]
+ %tmp.3 = zext i1 %tmp.2 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
+define i1 @test25(i32 %A) {
+ %B = and i32 %A, 2 ; <i32> [#uses=1]
+ %C = icmp ugt i32 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
diff --git a/test/Transforms/InstCombine/setcc-cast-cast.ll b/test/Transforms/InstCombine/setcc-cast-cast.ll
new file mode 100644
index 000000000000..ed2e2bee551e
--- /dev/null
+++ b/test/Transforms/InstCombine/setcc-cast-cast.ll
@@ -0,0 +1,46 @@
+; This test case was reduced from MultiSource/Applications/hbd. It makes sure
+; that folding doesn't happen in case a zext is applied where a sext should have
+; been when a setcc is used with two casts.
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {br i1 false}
+; END.
+
+define i32 @bug(i8 %inbuff) {
+entry:
+ %tmp = bitcast i8 %inbuff to i8 ; <i8> [#uses=1]
+ %tmp.upgrd.1 = sext i8 %tmp to i32 ; <i32> [#uses=3]
+ %tmp.upgrd.2 = icmp eq i32 %tmp.upgrd.1, 1 ; <i1> [#uses=1]
+ br i1 %tmp.upgrd.2, label %cond_true, label %cond_next
+
+cond_true: ; preds = %entry
+ br label %bb
+
+cond_next: ; preds = %entry
+ %tmp3 = icmp eq i32 %tmp.upgrd.1, -1 ; <i1> [#uses=1]
+ br i1 %tmp3, label %cond_true4, label %cond_next5
+
+cond_true4: ; preds = %cond_next
+ br label %bb
+
+cond_next5: ; preds = %cond_next
+ %tmp7 = icmp sgt i32 %tmp.upgrd.1, 1 ; <i1> [#uses=1]
+ br i1 %tmp7, label %cond_true8, label %cond_false
+
+cond_true8: ; preds = %cond_next5
+ br label %cond_next9
+
+cond_false: ; preds = %cond_next5
+ br label %cond_next9
+
+cond_next9: ; preds = %cond_false, %cond_true8
+ %iftmp.1.0 = phi i32 [ 42, %cond_true8 ], [ 23, %cond_false ] ; <i32> [#uses=1]
+ br label %return
+
+bb: ; preds = %cond_true4, %cond_true
+ br label %return
+
+return: ; preds = %bb, %cond_next9
+ %retval.0 = phi i32 [ 17, %bb ], [ %iftmp.1.0, %cond_next9 ] ; <i32> [#uses=1]
+ ret i32 %retval.0
+}
+
diff --git a/test/Transforms/InstCombine/setcc-strength-reduce.ll b/test/Transforms/InstCombine/setcc-strength-reduce.ll
new file mode 100644
index 000000000000..9931ccb2fd25
--- /dev/null
+++ b/test/Transforms/InstCombine/setcc-strength-reduce.ll
@@ -0,0 +1,37 @@
+; This test ensures that "strength reduction" of conditional expressions are
+; working. Basically this boils down to converting setlt,gt,le,ge instructions
+; into equivalent setne,eq instructions.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v {icmp eq} | grep -v {icmp ne} | not grep icmp
+; END.
+
+define i1 @test1(i32 %A) {
+ ; setne %A, 0
+ %B = icmp uge i32 %A, 1 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test2(i32 %A) {
+ ; setne %A, 0
+ %B = icmp ugt i32 %A, 0 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test3(i8 %A) {
+ ; setne %A, -128
+ %B = icmp sge i8 %A, -127 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test4(i8 %A) {
+ ; setne %A, 127
+ %B = icmp sle i8 %A, 126 ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i1 @test5(i8 %A) {
+ ; setne %A, 127
+ %B = icmp slt i8 %A, 127 ; <i1> [#uses=1]
+ ret i1 %B
+}
diff --git a/test/Transforms/InstCombine/sext-misc.ll b/test/Transforms/InstCombine/sext-misc.ll
new file mode 100644
index 000000000000..58749666ea1b
--- /dev/null
+++ b/test/Transforms/InstCombine/sext-misc.ll
@@ -0,0 +1,75 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext
+
+declare i32 @llvm.ctpop.i32(i32)
+declare i32 @llvm.ctlz.i32(i32)
+declare i32 @llvm.cttz.i32(i32)
+
+define i64 @foo(i32 %x) {
+ %t = call i32 @llvm.ctpop.i32(i32 %x)
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @boo(i32 %x) {
+ %t = call i32 @llvm.ctlz.i32(i32 %x)
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @zoo(i32 %x) {
+ %t = call i32 @llvm.cttz.i32(i32 %x)
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @coo(i32 %x) {
+ %t = udiv i32 %x, 3
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @moo(i32 %x) {
+ %t = urem i32 %x, 30000
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @yoo(i32 %x) {
+ %u = lshr i32 %x, 3
+ %t = mul i32 %u, 3
+ %s = sext i32 %t to i64
+ ret i64 %s
+}
+define i64 @voo(i32 %x) {
+ %t = and i32 %x, 511
+ %u = sub i32 20000, %t
+ %s = sext i32 %u to i64
+ ret i64 %s
+}
+define i32 @woo(i8 %a, i32 %f, i1 %p, i32* %z) {
+ %d = lshr i32 %f, 24
+ %e = select i1 %p, i32 %d, i32 0
+ %s = trunc i32 %e to i16
+ %n = sext i16 %s to i32
+ ret i32 %n
+}
+
+; rdar://6013816
+define i16 @test(i16 %t, i1 %cond) nounwind {
+entry:
+ br i1 %cond, label %T, label %F
+T:
+ %t2 = sext i16 %t to i32
+ br label %F
+
+F:
+ %V = phi i32 [%t2, %T], [42, %entry]
+ %W = trunc i32 %V to i16
+ ret i16 %W
+}
+
+; PR2638
+define i32 @test2(i32 %i) nounwind {
+entry:
+ %tmp12 = trunc i32 %i to i8 ; <i8> [#uses=1]
+ %tmp16 = shl i8 %tmp12, 6 ; <i8> [#uses=1]
+ %a = ashr i8 %tmp16, 6 ; <i8> [#uses=1]
+ %b = sext i8 %a to i32 ; <i32> [#uses=1]
+ ret i32 %b
+}
+
diff --git a/test/Transforms/InstCombine/shift-simplify.ll b/test/Transforms/InstCombine/shift-simplify.ll
new file mode 100644
index 000000000000..ecf3f5f92fef
--- /dev/null
+++ b/test/Transforms/InstCombine/shift-simplify.ll
@@ -0,0 +1,42 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: egrep {shl|lshr|ashr} | count 3
+
+define i32 @test0(i32 %A, i32 %B, i32 %C) {
+ %X = shl i32 %A, %C
+ %Y = shl i32 %B, %C
+ %Z = and i32 %X, %Y
+ ret i32 %Z
+}
+
+define i32 @test1(i32 %A, i32 %B, i32 %C) {
+ %X = lshr i32 %A, %C
+ %Y = lshr i32 %B, %C
+ %Z = or i32 %X, %Y
+ ret i32 %Z
+}
+
+define i32 @test2(i32 %A, i32 %B, i32 %C) {
+ %X = ashr i32 %A, %C
+ %Y = ashr i32 %B, %C
+ %Z = xor i32 %X, %Y
+ ret i32 %Z
+}
+
+define i1 @test3(i32 %X) {
+ %tmp1 = shl i32 %X, 7
+ %tmp2 = icmp slt i32 %tmp1, 0
+ ret i1 %tmp2
+}
+
+define i1 @test4(i32 %X) {
+ %tmp1 = lshr i32 %X, 7
+ %tmp2 = icmp slt i32 %tmp1, 0
+ ret i1 %tmp2
+}
+
+define i1 @test5(i32 %X) {
+ %tmp1 = ashr i32 %X, 7
+ %tmp2 = icmp slt i32 %tmp1, 0
+ ret i1 %tmp2
+}
+
diff --git a/test/Transforms/InstCombine/shift-sra.ll b/test/Transforms/InstCombine/shift-sra.ll
new file mode 100644
index 000000000000..6058bd6dc724
--- /dev/null
+++ b/test/Transforms/InstCombine/shift-sra.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {lshr i32} | count 2
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr
+
+
+define i32 @test1(i32 %X, i8 %A) {
+ %shift.upgrd.1 = zext i8 %A to i32 ; <i32> [#uses=1]
+ ; can be logical shift.
+ %Y = ashr i32 %X, %shift.upgrd.1 ; <i32> [#uses=1]
+ %Z = and i32 %Y, 1 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+define i32 @test2(i8 %tmp) {
+ %tmp3 = zext i8 %tmp to i32 ; <i32> [#uses=1]
+ %tmp4 = add i32 %tmp3, 7 ; <i32> [#uses=1]
+ %tmp5 = ashr i32 %tmp4, 3 ; <i32> [#uses=1]
+ ret i32 %tmp5
+}
diff --git a/test/Transforms/InstCombine/shift-trunc-shift.ll b/test/Transforms/InstCombine/shift-trunc-shift.ll
new file mode 100644
index 000000000000..bf9f4070fb98
--- /dev/null
+++ b/test/Transforms/InstCombine/shift-trunc-shift.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep lshr.*63
+
+define i32 @t1(i64 %d18) {
+entry:
+ %tmp916 = lshr i64 %d18, 32 ; <i64> [#uses=1]
+ %tmp917 = trunc i64 %tmp916 to i32 ; <i32> [#uses=1]
+ %tmp10 = lshr i32 %tmp917, 31 ; <i32> [#uses=1]
+ ret i32 %tmp10
+}
+
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
new file mode 100644
index 000000000000..9dc7755c1b8b
--- /dev/null
+++ b/test/Transforms/InstCombine/shift.ll
@@ -0,0 +1,216 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sh
+; END.
+
+define i32 @test1(i32 %A) {
+ %B = shl i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i8 %A) {
+ %shift.upgrd.1 = zext i8 %A to i32 ; <i32> [#uses=1]
+ %B = shl i32 0, %shift.upgrd.1 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test3(i32 %A) {
+ %B = ashr i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test4(i8 %A) {
+ %shift.upgrd.2 = zext i8 %A to i32 ; <i32> [#uses=1]
+ %B = ashr i32 0, %shift.upgrd.2 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+
+define i32 @test5(i32 %A) {
+ %B = lshr i32 %A, 32 ;; shift all bits out
+ ret i32 %B
+}
+
+define i32 @test5a(i32 %A) {
+ %B = shl i32 %A, 32 ;; shift all bits out
+ ret i32 %B
+}
+
+define i32 @test6(i32 %A) {
+ %B = shl i32 %A, 1 ;; convert to an mul instruction
+ %C = mul i32 %B, 3
+ ret i32 %C
+}
+
+define i32 @test7(i8 %A) {
+ %shift.upgrd.3 = zext i8 %A to i32
+ %B = ashr i32 -1, %shift.upgrd.3 ;; Always equal to -1
+ ret i32 %B
+}
+
+;; (A << 5) << 3 === A << 8 == 0
+define i8 @test8(i8 %A) {
+ %B = shl i8 %A, 5 ; <i8> [#uses=1]
+ %C = shl i8 %B, 3 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+;; (A << 7) >> 7 === A & 1
+define i8 @test9(i8 %A) {
+ %B = shl i8 %A, 7 ; <i8> [#uses=1]
+ %C = lshr i8 %B, 7 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+;; (A >> 7) << 7 === A & 128
+define i8 @test10(i8 %A) {
+ %B = lshr i8 %A, 7 ; <i8> [#uses=1]
+ %C = shl i8 %B, 7 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+;; (A >> 3) << 4 === (A & 0x1F) << 1
+define i8 @test11(i8 %A) {
+ %a = mul i8 %A, 3 ; <i8> [#uses=1]
+ %B = lshr i8 %a, 3 ; <i8> [#uses=1]
+ %C = shl i8 %B, 4 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+;; (A >> 8) << 8 === A & -256
+define i32 @test12(i32 %A) {
+ %B = ashr i32 %A, 8 ; <i32> [#uses=1]
+ %C = shl i32 %B, 8 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+;; (A >> 3) << 4 === (A & -8) * 2
+define i8 @test13(i8 %A) {
+ %a = mul i8 %A, 3 ; <i8> [#uses=1]
+ %B = ashr i8 %a, 3 ; <i8> [#uses=1]
+ %C = shl i8 %B, 4 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
+define i32 @test14(i32 %A) {
+ %B = lshr i32 %A, 4 ; <i32> [#uses=1]
+ %C = or i32 %B, 1234 ; <i32> [#uses=1]
+ %D = shl i32 %C, 4 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
+define i32 @test14a(i32 %A) {
+ %B = shl i32 %A, 4 ; <i32> [#uses=1]
+ %C = and i32 %B, 1234 ; <i32> [#uses=1]
+ %D = lshr i32 %C, 4 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test15(i1 %C) {
+ %A = select i1 %C, i32 3, i32 1 ; <i32> [#uses=1]
+ %V = shl i32 %A, 2 ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i32 @test15a(i1 %C) {
+ %A = select i1 %C, i8 3, i8 1 ; <i8> [#uses=1]
+ %shift.upgrd.4 = zext i8 %A to i32 ; <i32> [#uses=1]
+ %V = shl i32 64, %shift.upgrd.4 ; <i32> [#uses=1]
+ ret i32 %V
+}
+
+define i1 @test16(i32 %X) {
+ %tmp.3 = ashr i32 %X, 4 ; <i32> [#uses=1]
+ %tmp.6 = and i32 %tmp.3, 1 ; <i32> [#uses=1]
+ %tmp.7 = icmp ne i32 %tmp.6, 0 ; <i1> [#uses=1]
+ ret i1 %tmp.7
+}
+
+define i1 @test17(i32 %A) {
+ %B = lshr i32 %A, 3 ; <i32> [#uses=1]
+ %C = icmp eq i32 %B, 1234 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+
+define i1 @test18(i8 %A) {
+ %B = lshr i8 %A, 7 ; <i8> [#uses=1]
+ ;; false
+ %C = icmp eq i8 %B, 123 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test19(i32 %A) {
+ %B = ashr i32 %A, 2 ; <i32> [#uses=1]
+ ;; (X & -4) == 0
+ %C = icmp eq i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+
+define i1 @test19a(i32 %A) {
+ %B = ashr i32 %A, 2 ; <i32> [#uses=1]
+ ;; (X & -4) == -4
+ %C = icmp eq i32 %B, -1 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test20(i8 %A) {
+ %B = ashr i8 %A, 7 ; <i8> [#uses=1]
+ ;; false
+ %C = icmp eq i8 %B, 123 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test21(i8 %A) {
+ %B = shl i8 %A, 4 ; <i8> [#uses=1]
+ %C = icmp eq i8 %B, -128 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i1 @test22(i8 %A) {
+ %B = shl i8 %A, 4 ; <i8> [#uses=1]
+ %C = icmp eq i8 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i8 @test23(i32 %A) {
+ ;; casts not needed
+ %B = shl i32 %A, 24 ; <i32> [#uses=1]
+ %C = ashr i32 %B, 24 ; <i32> [#uses=1]
+ %D = trunc i32 %C to i8 ; <i8> [#uses=1]
+ ret i8 %D
+}
+
+define i8 @test24(i8 %X) {
+ %Y = and i8 %X, -5 ; <i8> [#uses=1]
+ %Z = shl i8 %Y, 5 ; <i8> [#uses=1]
+ %Q = ashr i8 %Z, 5 ; <i8> [#uses=1]
+ ret i8 %Q
+}
+
+define i32 @test25(i32 %tmp.2, i32 %AA) {
+ %x = lshr i32 %AA, 17 ; <i32> [#uses=1]
+ %tmp.3 = lshr i32 %tmp.2, 17 ; <i32> [#uses=1]
+ %tmp.5 = add i32 %tmp.3, %x ; <i32> [#uses=1]
+ %tmp.6 = shl i32 %tmp.5, 17 ; <i32> [#uses=1]
+ ret i32 %tmp.6
+}
+
+;; handle casts between shifts.
+define i32 @test26(i32 %A) {
+ %B = lshr i32 %A, 1 ; <i32> [#uses=1]
+ %C = bitcast i32 %B to i32 ; <i32> [#uses=1]
+ %D = shl i32 %C, 1 ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+
+define i1 @test27(i32 %x) nounwind {
+ %y = lshr i32 %x, 3
+ %z = trunc i32 %y to i1
+ ret i1 %z
+}
+
diff --git a/test/Transforms/InstCombine/shl-icmp.ll b/test/Transforms/InstCombine/shl-icmp.ll
new file mode 100644
index 000000000000..234c40bf6881
--- /dev/null
+++ b/test/Transforms/InstCombine/shl-icmp.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -instcombine -stats -disable-output |& \
+; RUN: grep {Number of insts combined} | grep 5
+
+define i8 @t1(i8 zeroext %x, i8 zeroext %y) zeroext nounwind {
+entry:
+ %tmp1 = lshr i8 %x, 7
+ %cond1 = icmp ne i8 %tmp1, 0
+ br i1 %cond1, label %bb1, label %bb2
+
+bb1:
+ ret i8 %tmp1
+
+bb2:
+ %tmp2 = add i8 %tmp1, %y
+ ret i8 %tmp2
+}
+
+define i8 @t2(i8 zeroext %x) zeroext nounwind {
+entry:
+ %tmp1 = lshr i8 %x, 7
+ %cond1 = icmp ne i8 %tmp1, 0
+ br i1 %cond1, label %bb1, label %bb2
+
+bb1:
+ ret i8 0
+
+bb2:
+ ret i8 1
+}
diff --git a/test/Transforms/InstCombine/shl-trunc.ll b/test/Transforms/InstCombine/shl-trunc.ll
new file mode 100644
index 000000000000..ffef2984f5c9
--- /dev/null
+++ b/test/Transforms/InstCombine/shl-trunc.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shl
+
+define i1 @test(i32 %X, i8 %A) {
+ %shift.upgrd.1 = zext i8 %A to i32 ; <i32> [#uses=1]
+ %B = lshr i32 %X, %shift.upgrd.1 ; <i32> [#uses=1]
+ %D = trunc i32 %B to i1 ; <i1> [#uses=1]
+ ret i1 %D
+}
+
diff --git a/test/Transforms/InstCombine/shufflemask-undef.ll b/test/Transforms/InstCombine/shufflemask-undef.ll
new file mode 100644
index 000000000000..24384178efff
--- /dev/null
+++ b/test/Transforms/InstCombine/shufflemask-undef.ll
@@ -0,0 +1,109 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {shufflevector.\*i32 8}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %struct.ActiveTextureTargets = type { i64, i64, i64, i64, i64, i64 }
+ %struct.AlphaTest = type { float, i16, i8, i8 }
+ %struct.ArrayRange = type { i8, i8, i8, i8 }
+ %struct.BlendMode = type { i16, i16, i16, i16, %struct.IColor4, i16, i16, i8, i8, i8, i8 }
+ %struct.ClearColor = type { double, %struct.IColor4, %struct.IColor4, float, i32 }
+ %struct.ClipPlane = type { i32, [6 x %struct.IColor4] }
+ %struct.ColorBuffer = type { i16, i8, i8, [8 x i16], [0 x i32] }
+ %struct.ColorMatrix = type { [16 x float]*, %struct.ImagingColorScale }
+ %struct.Convolution = type { %struct.IColor4, %struct.ImagingColorScale, i16, i16, [0 x i32], float*, i32, i32 }
+ %struct.DepthTest = type { i16, i16, i8, i8, i8, i8, double, double }
+ %struct.FixedFunction = type { %struct.PPStreamToken* }
+ %struct.FogMode = type { %struct.IColor4, float, float, float, float, float, i16, i16, i16, i8, i8 }
+ %struct.HintMode = type { i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 }
+ %struct.Histogram = type { %struct.ProgramLimits*, i32, i16, i8, i8 }
+ %struct.ImagingColorScale = type { %struct.TCoord2, %struct.TCoord2, %struct.TCoord2, %struct.TCoord2 }
+ %struct.ImagingSubset = type { %struct.Convolution, %struct.Convolution, %struct.Convolution, %struct.ColorMatrix, %struct.Minmax, %struct.Histogram, %struct.ImagingColorScale, %struct.ImagingColorScale, %struct.ImagingColorScale, %struct.ImagingColorScale, i32, [0 x i32] }
+ %struct.Light = type { %struct.IColor4, %struct.IColor4, %struct.IColor4, %struct.IColor4, %struct.PointLineLimits, float, float, float, float, float, %struct.PointLineLimits, float, %struct.PointLineLimits, float, %struct.PointLineLimits, float, float, float, float, float }
+ %struct.LightModel = type { %struct.IColor4, [8 x %struct.Light], [2 x %struct.Material], i32, i16, i16, i16, i8, i8, i8, i8, i8, i8 }
+ %struct.LightProduct = type { %struct.IColor4, %struct.IColor4, %struct.IColor4 }
+ %struct.LineMode = type { float, i32, i16, i16, i8, i8, i8, i8 }
+ %struct.LogicOp = type { i16, i8, i8 }
+ %struct.MaskMode = type { i32, [3 x i32], i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.Material = type { %struct.IColor4, %struct.IColor4, %struct.IColor4, %struct.IColor4, float, float, float, float, [8 x %struct.LightProduct], %struct.IColor4, [8 x i32] }
+ %struct.Minmax = type { %struct.MinmaxTable*, i16, i8, i8, [0 x i32] }
+ %struct.MinmaxTable = type { %struct.IColor4, %struct.IColor4 }
+ %struct.Mipmaplevel = type { [4 x i32], [4 x i32], [4 x float], [4 x i32], i32, i32, float*, i8*, i16, i16, i16, i16, [2 x float] }
+ %struct.Multisample = type { float, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.PipelineProgramState = type { i8, i8, i8, i8, [0 x i32], %struct.IColor4* }
+ %struct.PixelMap = type { i32*, float*, float*, float*, float*, float*, float*, float*, float*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.PixelMode = type { float, float, %struct.PixelStore, %struct.PixelTransfer, %struct.PixelMap, %struct.ImagingSubset, i32, i32 }
+ %struct.PixelPack = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 }
+ %struct.PixelStore = type { %struct.PixelPack, %struct.PixelPack }
+ %struct.PixelTransfer = type { float, float, float, float, float, float, float, float, float, float, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float }
+ %struct.PluginBufferData = type { i32 }
+ %struct.PointLineLimits = type { float, float, float }
+ %struct.PointMode = type { float, float, float, float, %struct.PointLineLimits, float, i8, i8, i8, i8, i16, i16, i32, i16, i16 }
+ %struct.PolygonMode = type { [128 x i8], float, float, i16, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.ProgramLimits = type { i32, i32, i32, i32 }
+ %struct.RegisterCombiners = type { i8, i8, i8, i8, i32, [2 x %struct.IColor4], [8 x %struct.RegisterCombinersPerStageState], %struct.RegisterCombinersFinalStageState }
+ %struct.RegisterCombinersFinalStageState = type { i8, i8, i8, i8, [7 x %struct.RegisterCombinersPerVariableState] }
+ %struct.RegisterCombinersPerPortionState = type { [4 x %struct.RegisterCombinersPerVariableState], i8, i8, i8, i8, i16, i16, i16, i16, i16, i16 }
+ %struct.RegisterCombinersPerStageState = type { [2 x %struct.RegisterCombinersPerPortionState], [2 x %struct.IColor4] }
+ %struct.RegisterCombinersPerVariableState = type { i16, i16, i16, i16 }
+ %struct.SWRSurfaceRec = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, [4 x i8*], i32 }
+ %struct.ScissorTest = type { %struct.ProgramLimits, i8, i8, i8, i8 }
+ %struct.State = type <{ i16, i16, i16, i16, i32, i32, [256 x %struct.IColor4], [128 x %struct.IColor4], %struct.Viewport, %struct.Transform, %struct.LightModel, %struct.ActiveTextureTargets, %struct.AlphaTest, %struct.BlendMode, %struct.ClearColor, %struct.ColorBuffer, %struct.DepthTest, %struct.ArrayRange, %struct.FogMode, %struct.HintMode, %struct.LineMode, %struct.LogicOp, %struct.MaskMode, %struct.PixelMode, %struct.PointMode, %struct.PolygonMode, %struct.ScissorTest, i32, %struct.StencilTest, [8 x %struct.TextureMode], [16 x %struct.TextureImageMode], %struct.ArrayRange, [8 x %struct.TextureCoordGen], %struct.ClipPlane, %struct.Multisample, %struct.RegisterCombiners, %struct.ArrayRange, %struct.ArrayRange, [3 x %struct.PipelineProgramState], %struct.ArrayRange, %struct.TransformFeedback, i32*, %struct.FixedFunction, [3 x i32], [3 x i32] }>
+ %struct.StencilTest = type { [3 x { i32, i32, i16, i16, i16, i16 }], i32, [4 x i8] }
+ %struct.TextureCoordGen = type { { i16, i16, %struct.IColor4, %struct.IColor4 }, { i16, i16, %struct.IColor4, %struct.IColor4 }, { i16, i16, %struct.IColor4, %struct.IColor4 }, { i16, i16, %struct.IColor4, %struct.IColor4 }, i8, i8, i8, i8 }
+ %struct.TextureGeomState = type { i16, i16, i16, i16, i16, i8, i8, i8, i8, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [6 x i16], [6 x i16] }
+ %struct.TextureImageMode = type { float }
+ %struct.TextureLevel = type { i32, i32, i16, i16, i16, i8, i8, i16, i16, i16, i16, i8* }
+ %struct.TextureMode = type { %struct.IColor4, i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, float, float, i16, i16, i16, i16, i16, i16, [4 x i16], i8, i8, i8, i8, [3 x float], [4 x float], float, float }
+ %struct.TextureParamState = type { i16, i16, i16, i16, i16, i16, %struct.IColor4, float, float, float, float, i16, i16, i16, i16, float, i16, i8, i8, i32, i8* }
+ %struct.TextureRec = type { [4 x float], %struct.TextureState*, %struct.Mipmaplevel*, %struct.Mipmaplevel*, float, float, float, float, i8, i8, i8, i8, i16, i16, i16, i16, i32, float, [2 x %struct.PPStreamToken] }
+ %struct.TextureState = type { i16, i8, i8, i16, i16, float, i32, %struct.SWRSurfaceRec*, %struct.TextureParamState, %struct.TextureGeomState, [0 x i32], i8*, i32, %struct.TextureLevel, [1 x [15 x %struct.TextureLevel]] }
+ %struct.Transform = type <{ [24 x [16 x float]], [24 x [16 x float]], [16 x float], float, float, float, float, float, i8, i8, i8, i8, i32, i32, i32, i16, i16, i8, i8, i8, i8, i32 }>
+ %struct.TransformFeedback = type { i8, i8, i8, i8, [0 x i32], [16 x i32], [16 x i32] }
+ %struct.Viewport = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, double, double, i32, i32, i32, i32, float, float, float, float }
+ %struct.IColor4 = type { float, float, float, float }
+ %struct.TCoord2 = type { float, float }
+ %struct.VMGPStack = type { [6 x <4 x float>*], <4 x float>*, i32, i32, <4 x float>*, <4 x float>**, i32, i32, i32, i32, i32, i32 }
+ %struct.VMTextures = type { [16 x %struct.TextureRec*] }
+ %struct.PPStreamToken = type { { i16, i16, i32 } }
+ %struct._VMConstants = type { <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, float, float, float, float, float, float, float, float, float, float, float, float, [256 x float], [528 x i8], { void (i8*, i8*, i32, i8*)*, float (float)*, float (float)*, float (float)*, i32 (float)* } }
+
+define i32 @foo(%struct.State* %dst, <4 x float>* %prgrm, <4 x float>** %buffs, %struct._VMConstants* %cnstn, %struct.PPStreamToken* %pstrm, %struct.PluginBufferData* %gpctx, %struct.VMTextures* %txtrs, %struct.VMGPStack* %gpstk) nounwind {
+bb266.i:
+ getelementptr <4 x float>* null, i32 11 ; <<4 x float>*>:0 [#uses=1]
+ load <4 x float>* %0, align 16 ; <<4 x float>>:1 [#uses=1]
+ shufflevector <4 x float> %1, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 1, i32 1 > ; <<4 x float>>:2 [#uses=1]
+ shufflevector <4 x float> %2, <4 x float> undef, <4 x i32> < i32 0, i32 4, i32 1, i32 5 > ; <<4 x float>>:3 [#uses=1]
+ shufflevector <4 x float> undef, <4 x float> undef, <4 x i32> < i32 0, i32 4, i32 1, i32 5 > ; <<4 x float>>:4 [#uses=1]
+ shufflevector <4 x float> %4, <4 x float> %3, <4 x i32> < i32 6, i32 7, i32 2, i32 3 > ; <<4 x float>>:5 [#uses=1]
+ mul <4 x float> %5, zeroinitializer ; <<4 x float>>:6 [#uses=2]
+ mul <4 x float> %6, %6 ; <<4 x float>>:7 [#uses=1]
+ add <4 x float> zeroinitializer, %7 ; <<4 x float>>:8 [#uses=1]
+ call <4 x float> @llvm.x86.sse.max.ps( <4 x float> zeroinitializer, <4 x float> %8 ) nounwind readnone ; <<4 x float>>:9 [#uses=1]
+ %phitmp40 = bitcast <4 x float> %9 to <4 x i32> ; <<4 x i32>> [#uses=1]
+ %tmp4109.i = and <4 x i32> %phitmp40, < i32 8388607, i32 8388607, i32 8388607, i32 8388607 > ; <<4 x i32>> [#uses=1]
+ %tmp4116.i = or <4 x i32> %tmp4109.i, < i32 1065353216, i32 1065353216, i32 1065353216, i32 1065353216 > ; <<4 x i32>> [#uses=1]
+ %tmp4117.i = bitcast <4 x i32> %tmp4116.i to <4 x float> ; <<4 x float>> [#uses=1]
+ add <4 x float> %tmp4117.i, zeroinitializer ; <<4 x float>>:10 [#uses=1]
+ mul <4 x float> %10, < float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01 > ; <<4 x float>>:11 [#uses=1]
+ call <4 x float> @llvm.x86.sse.max.ps( <4 x float> %11, <4 x float> zeroinitializer ) nounwind readnone ; <<4 x float>>:12 [#uses=1]
+ call <4 x float> @llvm.x86.sse.min.ps( <4 x float> %12, <4 x float> zeroinitializer ) nounwind readnone ; <<4 x float>>:13 [#uses=1]
+ %tmp4170.i = call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %13, <4 x float> zeroinitializer, i8 2 ) nounwind ; <<4 x float>> [#uses=1]
+ bitcast <4 x float> %tmp4170.i to <16 x i8> ; <<16 x i8>>:14 [#uses=1]
+ call i32 @llvm.x86.sse2.pmovmskb.128( <16 x i8> %14 ) nounwind readnone ; <i32>:15 [#uses=1]
+ icmp eq i32 %15, 0 ; <i1>:16 [#uses=1]
+ br i1 %16, label %bb5574.i, label %bb4521.i
+
+bb4521.i: ; preds = %bb266.i
+ unreachable
+
+bb5574.i: ; preds = %bb266.i
+ unreachable
+}
+
+declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) nounwind readnone
+
+declare i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8>) nounwind readnone
+
+declare <4 x float> @llvm.x86.sse.max.ps(<4 x float>, <4 x float>) nounwind readnone
+
+declare <4 x float> @llvm.x86.sse.min.ps(<4 x float>, <4 x float>) nounwind readnone
diff --git a/test/Transforms/InstCombine/shufflevec-constant.ll b/test/Transforms/InstCombine/shufflevec-constant.ll
new file mode 100644
index 000000000000..f153a484fa01
--- /dev/null
+++ b/test/Transforms/InstCombine/shufflevec-constant.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep "2 x float"
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+
+define <4 x float> @__inff4() nounwind readnone {
+entry:
+ %tmp14 = extractelement <1 x double> bitcast (<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000> to <1 x double>), i32 0 ; <double> [#uses=1]
+ %tmp4 = bitcast double %tmp14 to i64 ; <i64> [#uses=1]
+ %tmp3 = bitcast i64 %tmp4 to <2 x float> ; <<2 x float>> [#uses=1]
+ %tmp8 = shufflevector <2 x float> %tmp3, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> ; <<4 x float>> [#uses=1]
+ %tmp9 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp8, <4 x i32> <i32 0, i32 1, i32 4, i32 5> ; <<4 x float>> [#uses=0]
+ ret <4 x float> %tmp9
+}
diff --git a/test/Transforms/InstCombine/signed-comparison.ll b/test/Transforms/InstCombine/signed-comparison.ll
new file mode 100644
index 000000000000..fdf150f9c61d
--- /dev/null
+++ b/test/Transforms/InstCombine/signed-comparison.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t
+; RUN: not grep zext %t
+; RUN: not grep slt %t
+; RUN: grep {icmp ult} %t
+
+; Instcombine should convert the zext+slt into a simple ult.
+
+define void @foo(double* %p) nounwind {
+entry:
+ br label %bb
+
+bb:
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %bb ]
+ %t0 = and i64 %indvar, 65535
+ %t1 = getelementptr double* %p, i64 %t0
+ %t2 = load double* %t1, align 8
+ %t3 = mul double %t2, 2.2
+ store double %t3, double* %t1, align 8
+ %i.04 = trunc i64 %indvar to i16
+ %t4 = add i16 %i.04, 1
+ %t5 = zext i16 %t4 to i32
+ %t6 = icmp slt i32 %t5, 500
+ %indvar.next = add i64 %indvar, 1
+ br i1 %t6, label %bb, label %return
+
+return:
+ ret void
+}
diff --git a/test/Transforms/InstCombine/signext.ll b/test/Transforms/InstCombine/signext.ll
new file mode 100644
index 000000000000..716662682da3
--- /dev/null
+++ b/test/Transforms/InstCombine/signext.ll
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {(and\|xor\|add\|shl\|shr)}
+; END.
+
+define i32 @test1(i32 %x) {
+ %tmp.1 = and i32 %x, 65535 ; <i32> [#uses=1]
+ %tmp.2 = xor i32 %tmp.1, -32768 ; <i32> [#uses=1]
+ %tmp.3 = add i32 %tmp.2, 32768 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
+define i32 @test2(i32 %x) {
+ %tmp.1 = and i32 %x, 65535 ; <i32> [#uses=1]
+ %tmp.2 = xor i32 %tmp.1, 32768 ; <i32> [#uses=1]
+ %tmp.3 = add i32 %tmp.2, -32768 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
+define i32 @test3(i16 %P) {
+ %tmp.1 = zext i16 %P to i32 ; <i32> [#uses=1]
+ %tmp.4 = xor i32 %tmp.1, 32768 ; <i32> [#uses=1]
+ %tmp.5 = add i32 %tmp.4, -32768 ; <i32> [#uses=1]
+ ret i32 %tmp.5
+}
+
+define i32 @test4(i16 %P) {
+ %tmp.1 = zext i16 %P to i32 ; <i32> [#uses=1]
+ %tmp.4 = xor i32 %tmp.1, 32768 ; <i32> [#uses=1]
+ %tmp.5 = add i32 %tmp.4, -32768 ; <i32> [#uses=1]
+ ret i32 %tmp.5
+}
+
+define i32 @test5(i32 %x) {
+ %tmp.1 = and i32 %x, 254 ; <i32> [#uses=1]
+ %tmp.2 = xor i32 %tmp.1, 128 ; <i32> [#uses=1]
+ %tmp.3 = add i32 %tmp.2, -128 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
+define i32 @test6(i32 %x) {
+ %tmp.2 = shl i32 %x, 16 ; <i32> [#uses=1]
+ %tmp.4 = ashr i32 %tmp.2, 16 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+}
+
diff --git a/test/Transforms/InstCombine/sink_instruction.ll b/test/Transforms/InstCombine/sink_instruction.ll
new file mode 100644
index 000000000000..cb8a090e5a07
--- /dev/null
+++ b/test/Transforms/InstCombine/sink_instruction.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: %prcontext div 1 | grep ret
+
+;; This tests that the instructions in the entry blocks are sunk into each
+;; arm of the 'if'.
+
+define i32 @foo(i1 %C, i32 %A, i32 %B) {
+entry:
+ %tmp.2 = sdiv i32 %A, %B ; <i32> [#uses=1]
+ %tmp.9 = add i32 %B, %A ; <i32> [#uses=1]
+ br i1 %C, label %then, label %endif
+
+then: ; preds = %entry
+ ret i32 %tmp.9
+
+endif: ; preds = %entry
+ ret i32 %tmp.2
+}
+
diff --git a/test/Transforms/InstCombine/sitofp.ll b/test/Transforms/InstCombine/sitofp.ll
new file mode 100644
index 000000000000..c26c351a741e
--- /dev/null
+++ b/test/Transforms/InstCombine/sitofp.ll
@@ -0,0 +1,55 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep itofp
+
+define i1 @test1(i8 %A) {
+ %B = sitofp i8 %A to double
+ %C = fcmp ult double %B, 128.0
+ ret i1 %C ; True!
+}
+define i1 @test2(i8 %A) {
+ %B = sitofp i8 %A to double
+ %C = fcmp ugt double %B, -128.1
+ ret i1 %C ; True!
+}
+
+define i1 @test3(i8 %A) {
+ %B = sitofp i8 %A to double
+ %C = fcmp ule double %B, 127.0
+ ret i1 %C ; true!
+}
+
+define i1 @test4(i8 %A) {
+ %B = sitofp i8 %A to double
+ %C = fcmp ult double %B, 127.0
+ ret i1 %C ; A != 127
+}
+
+define i32 @test5(i32 %A) {
+ %B = sitofp i32 %A to double
+ %C = fptosi double %B to i32
+ %D = uitofp i32 %C to double
+ %E = fptoui double %D to i32
+ ret i32 %E
+}
+
+define i32 @test6(i32 %A) {
+ %B = and i32 %A, 7 ; <i32> [#uses=1]
+ %C = and i32 %A, 32 ; <i32> [#uses=1]
+ %D = sitofp i32 %B to double ; <double> [#uses=1]
+ %E = sitofp i32 %C to double ; <double> [#uses=1]
+ %F = add double %D, %E ; <double> [#uses=1]
+ %G = fptosi double %F to i32 ; <i32> [#uses=1]
+ ret i32 %G
+}
+
+define i32 @test7(i32 %a) nounwind {
+ %b = sitofp i32 %a to double ; <double> [#uses=1]
+ %c = fptoui double %b to i32 ; <i32> [#uses=1]
+ ret i32 %c
+}
+
+define i32 @test8(i32 %a) nounwind {
+ %b = uitofp i32 %a to double ; <double> [#uses=1]
+ %c = fptosi double %b to i32 ; <i32> [#uses=1]
+ ret i32 %c
+}
+
diff --git a/test/Transforms/InstCombine/srem-simplify-bug.ll b/test/Transforms/InstCombine/srem-simplify-bug.ll
new file mode 100644
index 000000000000..cdf520256837
--- /dev/null
+++ b/test/Transforms/InstCombine/srem-simplify-bug.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
+; PR2276
+
+define i1 @f(i32 %x) {
+ %A = or i32 %x, 1
+ %B = srem i32 %A, 1
+ %C = icmp ne i32 %B, 0
+ ret i1 %C
+}
diff --git a/test/Transforms/InstCombine/srem.ll b/test/Transforms/InstCombine/srem.ll
new file mode 100644
index 000000000000..864775ae08a1
--- /dev/null
+++ b/test/Transforms/InstCombine/srem.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem
+
+define i64 @foo(i64 %x1, i64 %y2) {
+ %r = sdiv i64 %x1, %y2
+ %r7 = mul i64 %r, %y2
+ %r8 = sub i64 %x1, %r7
+ ret i64 %r8
+}
diff --git a/test/Transforms/InstCombine/srem1.ll b/test/Transforms/InstCombine/srem1.ll
new file mode 100644
index 000000000000..ee59d3ed99f8
--- /dev/null
+++ b/test/Transforms/InstCombine/srem1.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine
+; PR2670
+
+@g_127 = external global i32 ; <i32*> [#uses=1]
+
+define i32 @func_56(i32 %p_58, i32 %p_59, i32 %p_61, i16 signext %p_62) nounwind {
+entry:
+ %call = call i32 (...)* @rshift_s_s( i32 %p_61, i32 1 ) ; <i32> [#uses=1]
+ %conv = sext i32 %call to i64 ; <i64> [#uses=1]
+ %or = or i64 -1734012817166602727, %conv ; <i64> [#uses=1]
+ %rem = srem i64 %or, 1 ; <i64> [#uses=1]
+ %cmp = icmp eq i64 %rem, 1 ; <i1> [#uses=1]
+ %cmp.ext = zext i1 %cmp to i32 ; <i32> [#uses=1]
+ store i32 %cmp.ext, i32* @g_127
+ ret i32 undef
+}
+
+declare i32 @rshift_s_s(...)
diff --git a/test/Transforms/InstCombine/stack-overalign.ll b/test/Transforms/InstCombine/stack-overalign.ll
new file mode 100644
index 000000000000..45bdc2e0cbe8
--- /dev/null
+++ b/test/Transforms/InstCombine/stack-overalign.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 32} | count 1
+
+; It's tempting to have an instcombine in which the src pointer of a
+; memcpy is aligned up to the alignment of the destination, however
+; there are pitfalls. If the src is an alloca, aligning it beyond what
+; the target's stack pointer is aligned at will require dynamic
+; stack realignment, which can require functions that don't otherwise
+; need a frame pointer to need one.
+;
+; Abstaining from this transform is not the only way to approach this
+; issue. Some late phase could be smart enough to reduce alloca
+; alignments when they are greater than they need to be. Or, codegen
+; could do dynamic alignment for just the one alloca, and leave the
+; main stack pointer at its standard alignment.
+
+@dst = global [1024 x i8] zeroinitializer, align 32
+
+define void @foo() nounwind {
+entry:
+ %src = alloca [1024 x i8], align 1
+ %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0
+ call void @llvm.memcpy.i32(i8* getelementptr ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1)
+ call void @frob(i8* %src1) nounwind
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind
+
+declare void @frob(i8*)
diff --git a/test/Transforms/InstCombine/stacksaverestore.ll b/test/Transforms/InstCombine/stacksaverestore.ll
new file mode 100644
index 000000000000..c82a425b2fd0
--- /dev/null
+++ b/test/Transforms/InstCombine/stacksaverestore.ll
@@ -0,0 +1,56 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*stackrestore} | count 1
+
+declare i8* @llvm.stacksave()
+declare void @llvm.stackrestore(i8*)
+
+;; Test that llvm.stackrestore is removed when possible.
+define i32* @test1(i32 %P) {
+ %tmp = call i8* @llvm.stacksave( )
+ call void @llvm.stackrestore( i8* %tmp ) ;; not restoring anything
+ %A = alloca i32, i32 %P
+ ret i32* %A
+}
+
+define void @test2(i8* %X) {
+ call void @llvm.stackrestore( i8* %X ) ;; no allocas before return.
+ ret void
+}
+
+define void @foo(i32 %size) nounwind {
+entry:
+ %tmp118124 = icmp sgt i32 %size, 0 ; <i1> [#uses=1]
+ br i1 %tmp118124, label %bb.preheader, label %return
+
+bb.preheader: ; preds = %entry
+ %tmp25 = add i32 %size, -1 ; <i32> [#uses=1]
+ %tmp125 = icmp slt i32 %size, 1 ; <i1> [#uses=1]
+ %smax = select i1 %tmp125, i32 1, i32 %size ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.preheader
+ %i.0.reg2mem.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb ] ; <i32> [#uses=2]
+ %tmp = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp23 = alloca i8, i32 %size ; <i8*> [#uses=2]
+ %tmp27 = getelementptr i8* %tmp23, i32 %tmp25 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp27, align 1
+ %tmp28 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp52 = alloca i8, i32 %size ; <i8*> [#uses=1]
+ %tmp53 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp77 = alloca i8, i32 %size ; <i8*> [#uses=1]
+ %tmp78 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp102 = alloca i8, i32 %size ; <i8*> [#uses=1]
+ call void @bar( i32 %i.0.reg2mem.0, i8* %tmp23, i8* %tmp52, i8* %tmp77, i8* %tmp102, i32 %size ) nounwind
+ call void @llvm.stackrestore( i8* %tmp78 )
+ call void @llvm.stackrestore( i8* %tmp53 )
+ call void @llvm.stackrestore( i8* %tmp28 )
+ call void @llvm.stackrestore( i8* %tmp )
+ %indvar.next = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %smax ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %bb
+
+return: ; preds = %bb, %entry
+ ret void
+}
+
+declare void @bar(i32, i8*, i8*, i8*, i8*, i32)
+
diff --git a/test/Transforms/InstCombine/store-merge.ll b/test/Transforms/InstCombine/store-merge.ll
new file mode 100644
index 000000000000..7b117ca7f5f9
--- /dev/null
+++ b/test/Transforms/InstCombine/store-merge.ll
@@ -0,0 +1,37 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {ret i32 %.toremerge} | count 2
+;; Simple sinking tests
+
+; "if then else"
+define i32 @test1(i1 %C) {
+ %A = alloca i32
+ br i1 %C, label %Cond, label %Cond2
+
+Cond:
+ store i32 -987654321, i32* %A
+ br label %Cont
+
+Cond2:
+ store i32 47, i32* %A
+ br label %Cont
+
+Cont:
+ %V = load i32* %A
+ ret i32 %V
+}
+
+; "if then"
+define i32 @test2(i1 %C) {
+ %A = alloca i32
+ store i32 47, i32* %A
+ br i1 %C, label %Cond, label %Cont
+
+Cond:
+ store i32 -987654321, i32* %A
+ br label %Cont
+
+Cont:
+ %V = load i32* %A
+ ret i32 %V
+}
+
diff --git a/test/Transforms/InstCombine/store.ll b/test/Transforms/InstCombine/store.ll
new file mode 100644
index 000000000000..337b2cce08aa
--- /dev/null
+++ b/test/Transforms/InstCombine/store.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v {store.*,.*null} | not grep store
+
+define void @test1(i32* %P) {
+ store i32 undef, i32* %P
+ store i32 123, i32* undef
+ store i32 124, i32* null
+ ret void
+}
+
+define void @test2(i32* %P) {
+ %X = load i32* %P ; <i32> [#uses=1]
+ %Y = add i32 %X, 0 ; <i32> [#uses=1]
+ store i32 %Y, i32* %P
+ ret void
+}
+
diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll
new file mode 100644
index 000000000000..1ab4eaf1b49d
--- /dev/null
+++ b/test/Transforms/InstCombine/sub.ll
@@ -0,0 +1,148 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep -v {sub i32 %Cok, %Bok} | grep -v {sub i32 0, %Aok} | not grep sub
+
+define i32 @test1(i32 %A) {
+ %B = sub i32 %A, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test2(i32 %A) {
+ %B = sub i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test3(i32 %A) {
+ %B = sub i32 0, %A ; <i32> [#uses=1]
+ %C = sub i32 0, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test4(i32 %A, i32 %x) {
+ %B = sub i32 0, %A ; <i32> [#uses=1]
+ %C = sub i32 %x, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test5(i32 %A, i32 %Bok, i32 %Cok) {
+ %D = sub i32 %Bok, %Cok ; <i32> [#uses=1]
+ %E = sub i32 %A, %D ; <i32> [#uses=1]
+ ret i32 %E
+}
+
+define i32 @test6(i32 %A, i32 %B) {
+ %C = and i32 %A, %B ; <i32> [#uses=1]
+ %D = sub i32 %A, %C ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test7(i32 %A) {
+ %B = sub i32 -1, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test8(i32 %A) {
+ %B = mul i32 9, %A ; <i32> [#uses=1]
+ %C = sub i32 %B, %A ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test9(i32 %A) {
+ %B = mul i32 3, %A ; <i32> [#uses=1]
+ %C = sub i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test10(i32 %A, i32 %B) {
+ %C = sub i32 0, %A ; <i32> [#uses=1]
+ %D = sub i32 0, %B ; <i32> [#uses=1]
+ %E = mul i32 %C, %D ; <i32> [#uses=1]
+ ret i32 %E
+}
+
+define i32 @test10.upgrd.1(i32 %A) {
+ %C = sub i32 0, %A ; <i32> [#uses=1]
+ %E = mul i32 %C, 7 ; <i32> [#uses=1]
+ ret i32 %E
+}
+
+define i1 @test11(i8 %A, i8 %B) {
+ %C = sub i8 %A, %B ; <i8> [#uses=1]
+ %cD = icmp ne i8 %C, 0 ; <i1> [#uses=1]
+ ret i1 %cD
+}
+
+define i32 @test12(i32 %A) {
+ %B = ashr i32 %A, 31 ; <i32> [#uses=1]
+ %C = sub i32 0, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test13(i32 %A) {
+ %B = lshr i32 %A, 31 ; <i32> [#uses=1]
+ %C = sub i32 0, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test14(i32 %A) {
+ %B = lshr i32 %A, 31 ; <i32> [#uses=1]
+ %C = bitcast i32 %B to i32 ; <i32> [#uses=1]
+ %D = sub i32 0, %C ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test15(i32 %A, i32 %B) {
+ %C = sub i32 0, %A ; <i32> [#uses=1]
+ %D = srem i32 %B, %C ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test16(i32 %A) {
+ %X = sdiv i32 %A, 1123 ; <i32> [#uses=1]
+ %Y = sub i32 0, %X ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
+; Can't fold subtract here because negation it might oveflow.
+; PR3142
+define i32 @test17(i32 %Aok) {
+ %B = sub i32 0, %Aok ; <i32> [#uses=1]
+ %C = sdiv i32 %B, 1234 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i64 @test18(i64 %Y) {
+ %tmp.4 = shl i64 %Y, 2 ; <i64> [#uses=1]
+ %tmp.12 = shl i64 %Y, 2 ; <i64> [#uses=1]
+ %tmp.8 = sub i64 %tmp.4, %tmp.12 ; <i64> [#uses=1]
+ ret i64 %tmp.8
+}
+
+define i32 @test19(i32 %X, i32 %Y) {
+ %Z = sub i32 %X, %Y ; <i32> [#uses=1]
+ %Q = add i32 %Z, %Y ; <i32> [#uses=1]
+ ret i32 %Q
+}
+
+define i1 @test20(i32 %g, i32 %h) {
+ %tmp.2 = sub i32 %g, %h ; <i32> [#uses=1]
+ %tmp.4 = icmp ne i32 %tmp.2, %g ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+define i1 @test21(i32 %g, i32 %h) {
+ %tmp.2 = sub i32 %g, %h ; <i32> [#uses=1]
+ %tmp.4 = icmp ne i32 %tmp.2, %g ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+; PR2298
+define i8 @test22(i32 %a, i32 %b) zeroext nounwind {
+ %tmp2 = sub i32 0, %a ; <i32> [#uses=1]
+ %tmp4 = sub i32 0, %b ; <i32> [#uses=1]
+ %tmp5 = icmp eq i32 %tmp2, %tmp4 ; <i1> [#uses=1]
+ %retval89 = zext i1 %tmp5 to i8 ; <i8> [#uses=1]
+ ret i8 %retval89
+}
+
diff --git a/test/Transforms/InstCombine/udiv-simplify-bug-0.ll b/test/Transforms/InstCombine/udiv-simplify-bug-0.ll
new file mode 100644
index 000000000000..5bcaa66366c7
--- /dev/null
+++ b/test/Transforms/InstCombine/udiv-simplify-bug-0.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i64 0} | count 2
+
+define i64 @foo(i32 %x) nounwind {
+ %y = lshr i32 %x, 1
+ %r = udiv i32 %y, -1
+ %z = sext i32 %r to i64
+ ret i64 %z
+}
+define i64 @bar(i32 %x) nounwind {
+ %y = lshr i32 %x, 31
+ %r = udiv i32 %y, 3
+ %z = sext i32 %r to i64
+ ret i64 %z
+}
diff --git a/test/Transforms/InstCombine/udiv-simplify-bug-1.ll b/test/Transforms/InstCombine/udiv-simplify-bug-1.ll
new file mode 100644
index 000000000000..0036760ba50e
--- /dev/null
+++ b/test/Transforms/InstCombine/udiv-simplify-bug-1.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t1.ll
+; RUN: grep udiv %t1.ll | count 2
+; RUN: grep zext %t1.ll | count 2
+; PR2274
+
+; The udiv instructions shouldn't be optimized away, and the
+; sext instructions should be optimized to zext.
+
+define i64 @bar(i32 %x) nounwind {
+ %y = lshr i32 %x, 30
+ %r = udiv i32 %y, 3
+ %z = sext i32 %r to i64
+ ret i64 %z
+}
+define i64 @qux(i32 %x, i32 %v) nounwind {
+ %y = lshr i32 %x, 31
+ %r = udiv i32 %y, %v
+ %z = sext i32 %r to i64
+ ret i64 %z
+}
diff --git a/test/Transforms/InstCombine/udiv_select_to_select_shift.ll b/test/Transforms/InstCombine/udiv_select_to_select_shift.ll
new file mode 100644
index 000000000000..614ae3dc975c
--- /dev/null
+++ b/test/Transforms/InstCombine/udiv_select_to_select_shift.ll
@@ -0,0 +1,17 @@
+; Test that this transform works:
+; udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2)
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis -f -o %t
+; RUN: not grep select %t
+; RUN: grep lshr %t | count 2
+; RUN: not grep udiv %t
+
+define i64 @test(i64 %X, i1 %Cond ) {
+entry:
+ %divisor1 = select i1 %Cond, i64 16, i64 8
+ %quotient1 = udiv i64 %X, %divisor1
+ %divisor2 = select i1 %Cond, i64 8, i64 0
+ %quotient2 = udiv i64 %X, %divisor2
+ %sum = add i64 %quotient1, %quotient2
+ ret i64 %sum
+}
diff --git a/test/Transforms/InstCombine/urem-simplify-bug.ll b/test/Transforms/InstCombine/urem-simplify-bug.ll
new file mode 100644
index 000000000000..15956f26b69a
--- /dev/null
+++ b/test/Transforms/InstCombine/urem-simplify-bug.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {= or i32 %x, -5 }
+
+@.str = internal constant [5 x i8] c"foo\0A\00" ; <[5 x i8]*> [#uses=1]
+@.str1 = internal constant [5 x i8] c"bar\0A\00" ; <[5 x i8]*> [#uses=1]
+
+define i32 @main() nounwind {
+entry:
+ %x = call i32 @func_11( ) nounwind ; <i32> [#uses=1]
+ %tmp3 = or i32 %x, -5 ; <i32> [#uses=1]
+ %tmp5 = urem i32 251, %tmp3 ; <i32> [#uses=1]
+ %tmp6 = icmp ne i32 %tmp5, 0 ; <i1> [#uses=1]
+ %tmp67 = zext i1 %tmp6 to i32 ; <i32> [#uses=1]
+ %tmp9 = urem i32 %tmp67, 95 ; <i32> [#uses=1]
+ %tmp10 = and i32 %tmp9, 1 ; <i32> [#uses=1]
+ %tmp12 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
+ br i1 %tmp12, label %bb14, label %bb
+
+bb: ; preds = %entry
+ br label %bb15
+
+bb14: ; preds = %entry
+ br label %bb15
+
+bb15: ; preds = %bb14, %bb
+ %iftmp.0.0 = phi i8* [ getelementptr ([5 x i8]* @.str1, i32 0, i32 0), %bb14 ], [ getelementptr ([5 x i8]* @.str, i32 0, i32 0), %bb ] ; <i8*> [#uses=1]
+ %tmp17 = call i32 (i8*, ...)* @printf( i8* %iftmp.0.0 ) nounwind ; <i32> [#uses=0]
+ ret i32 0
+}
+
+declare i32 @func_11()
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/InstCombine/urem.ll b/test/Transforms/InstCombine/urem.ll
new file mode 100644
index 000000000000..24e7463cbaf8
--- /dev/null
+++ b/test/Transforms/InstCombine/urem.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep urem
+
+define i64 @rem_unsigned(i64 %x1, i64 %y2) {
+ %r = udiv i64 %x1, %y2
+ %r7 = mul i64 %r, %y2
+ %r8 = sub i64 %x1, %r7
+ ret i64 %r8
+}
diff --git a/test/Transforms/InstCombine/vec_demanded_elts-2.ll b/test/Transforms/InstCombine/vec_demanded_elts-2.ll
new file mode 100644
index 000000000000..dac03152fea1
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_demanded_elts-2.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractelement
+
+define void @get_image() nounwind {
+entry:
+ %0 = call i32 @fgetc(i8* null) nounwind ; <i32> [#uses=1]
+ %1 = trunc i32 %0 to i8 ; <i8> [#uses=1]
+ %tmp2 = insertelement <100 x i8> zeroinitializer, i8 %1, i32 1 ; <<100 x i8>> [#uses=1]
+ %tmp1 = extractelement <100 x i8> %tmp2, i32 0 ; <i8> [#uses=1]
+ %2 = icmp eq i8 %tmp1, 80 ; <i1> [#uses=1]
+ br i1 %2, label %bb2, label %bb3
+
+bb2: ; preds = %entry
+ br label %bb3
+
+bb3: ; preds = %bb2, %entry
+ unreachable
+}
+
+declare i32 @fgetc(i8*)
diff --git a/test/Transforms/InstCombine/vec_demanded_elts.ll b/test/Transforms/InstCombine/vec_demanded_elts.ll
new file mode 100644
index 000000000000..03e070f89412
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_demanded_elts.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {sub float}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {mul float}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {insertelement.*0.00}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {call.*llvm.x86.sse.mul}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {call.*llvm.x86.sse.sub}
+; END.
+
+define i16 @test1(float %f) {
+entry:
+ %tmp = insertelement <4 x float> undef, float %f, i32 0 ; <<4 x float>> [#uses=1]
+ %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 1 ; <<4 x float>> [#uses=1]
+ %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2 ; <<4 x float>> [#uses=1]
+ %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3 ; <<4 x float>> [#uses=1]
+ %tmp28 = tail call <4 x float> @llvm.x86.sse.sub.ss( <4 x float> %tmp12, <4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1]
+ %tmp37 = tail call <4 x float> @llvm.x86.sse.mul.ss( <4 x float> %tmp28, <4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1]
+ %tmp48 = tail call <4 x float> @llvm.x86.sse.min.ss( <4 x float> %tmp37, <4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1]
+ %tmp59 = tail call <4 x float> @llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1]
+ %tmp.upgrd.1 = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <i32> [#uses=1]
+ %tmp69 = trunc i32 %tmp.upgrd.1 to i16 ; <i16> [#uses=1]
+ ret i16 %tmp69
+}
+
+define i32 @test2(float %f) {
+ %tmp5 = mul float %f, %f
+ %tmp9 = insertelement <4 x float> undef, float %tmp5, i32 0
+ %tmp10 = insertelement <4 x float> %tmp9, float 0.000000e+00, i32 1
+ %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2
+ %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3
+ %tmp19 = bitcast <4 x float> %tmp12 to <4 x i32>
+ %tmp21 = extractelement <4 x i32> %tmp19, i32 0
+ ret i32 %tmp21
+}
+
+declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>)
+
+declare <4 x float> @llvm.x86.sse.mul.ss(<4 x float>, <4 x float>)
+
+declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>)
+
+declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>)
+
+declare i32 @llvm.x86.sse.cvttss2si(<4 x float>)
diff --git a/test/Transforms/InstCombine/vec_extract_elt.ll b/test/Transforms/InstCombine/vec_extract_elt.ll
new file mode 100644
index 000000000000..30b2f1d042b4
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_extract_elt.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractelement
+
+define i32 @test(float %f) {
+ %tmp7 = insertelement <4 x float> undef, float %f, i32 0 ; <<4 x float>> [#uses=1]
+ %tmp17 = bitcast <4 x float> %tmp7 to <4 x i32> ; <<4 x i32>> [#uses=1]
+ %tmp19 = extractelement <4 x i32> %tmp17, i32 0 ; <i32> [#uses=1]
+ ret i32 %tmp19
+}
+
diff --git a/test/Transforms/InstCombine/vec_insert_to_shuffle.ll b/test/Transforms/InstCombine/vec_insert_to_shuffle.ll
new file mode 100644
index 000000000000..df9cecd09c66
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_insert_to_shuffle.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep shufflevec | count 1
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep insertelement
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep extractelement
+; END.
+
+define <4 x float> @test(<4 x float> %tmp, <4 x float> %tmp1) {
+ %tmp4 = extractelement <4 x float> %tmp, i32 1 ; <float> [#uses=1]
+ %tmp2 = extractelement <4 x float> %tmp, i32 3 ; <float> [#uses=1]
+ %tmp1.upgrd.1 = extractelement <4 x float> %tmp1, i32 0 ; <float> [#uses=1]
+ %tmp128 = insertelement <4 x float> undef, float %tmp4, i32 0 ; <<4 x float>> [#uses=1]
+ %tmp130 = insertelement <4 x float> %tmp128, float undef, i32 1 ; <<4 x float>> [#uses=1]
+ %tmp132 = insertelement <4 x float> %tmp130, float %tmp2, i32 2 ; <<4 x float>> [#uses=1]
+ %tmp134 = insertelement <4 x float> %tmp132, float %tmp1.upgrd.1, i32 3 ; <<4 x float>> [#uses=1]
+ ret <4 x float> %tmp134
+}
+
diff --git a/test/Transforms/InstCombine/vec_insertelt.ll b/test/Transforms/InstCombine/vec_insertelt.ll
new file mode 100644
index 000000000000..9be154b98715
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_insertelt.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret <4 x i32> %A}
+
+; PR1286
+define <4 x i32> @test1(<4 x i32> %A) {
+ %B = insertelement <4 x i32> %A, i32 undef, i32 1
+ ret <4 x i32> %B
+}
diff --git a/test/Transforms/InstCombine/vec_narrow.ll b/test/Transforms/InstCombine/vec_narrow.ll
new file mode 100644
index 000000000000..9063148424c5
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_narrow.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {add float}
+
+ %V = type <4 x float>
+
+define float @test(%V %A, %V %B, float %f) {
+ %C = insertelement %V %A, float %f, i32 0 ; <%V> [#uses=1]
+ %D = add %V %C, %B ; <%V> [#uses=1]
+ %E = extractelement %V %D, i32 0 ; <float> [#uses=1]
+ ret float %E
+}
+
diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll
new file mode 100644
index 000000000000..aaaee3f84315
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_shuffle.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep vector_shuffle
+; END.
+
+%T = type <4 x float>
+
+
+define %T @test1(%T %v1) {
+ %v2 = shufflevector %T %v1, %T undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ ret %T %v2
+}
+
+define %T @test2(%T %v1) {
+ %v2 = shufflevector %T %v1, %T %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
+ ret %T %v2
+}
+
+define float @test3(%T %A, %T %B, float %f) {
+ %C = insertelement %T %A, float %f, i32 0
+ %D = shufflevector %T %C, %T %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7>
+ %E = extractelement %T %D, i32 1
+ ret float %E
+}
+
+define i32 @test4(<4 x i32> %X) {
+ %tmp152.i53899.i = shufflevector <4 x i32> %X, <4 x i32> undef, <4 x i32> zeroinitializer
+ %tmp34 = extractelement <4 x i32> %tmp152.i53899.i, i32 0
+ ret i32 %tmp34
+}
+
+define i32 @test5(<4 x i32> %X) {
+ %tmp152.i53899.i = shufflevector <4 x i32> %X, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 undef, i32 undef>
+ %tmp34 = extractelement <4 x i32> %tmp152.i53899.i, i32 0
+ ret i32 %tmp34
+}
+
+define float @test6(<4 x float> %X) {
+ %X1 = bitcast <4 x float> %X to <4 x i32>
+ %tmp152.i53899.i = shufflevector <4 x i32> %X1, <4 x i32> undef, <4 x i32> zeroinitializer
+ %tmp152.i53900.i = bitcast <4 x i32> %tmp152.i53899.i to <4 x float>
+ %tmp34 = extractelement <4 x float> %tmp152.i53900.i, i32 0
+ ret float %tmp34
+}
+
+define <4 x float> @test7(<4 x float> %tmp45.i) {
+ %tmp1642.i = shufflevector <4 x float> %tmp45.i, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 6, i32 7 >
+ ret <4 x float> %tmp1642.i
+}
diff --git a/test/Transforms/InstCombine/vec_shuffle2.ll b/test/Transforms/InstCombine/vec_shuffle2.ll
new file mode 100644
index 000000000000..3bd8924903f8
--- /dev/null
+++ b/test/Transforms/InstCombine/vec_shuffle2.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep undef | count 1
+; END.
+
+; Test fold of two shuffles where the first shuffle vectors inputs are a
+; different length then the second.
+
+define void @test_cl(<4 x i8> addrspace(1)* %dest, <16 x i8> addrspace(1)* %old) nounwind {
+entry:
+ %arrayidx = getelementptr <4 x i8> addrspace(1)* %dest, i32 0 ; <<4 x i8> addrspace(1)*> [#uses=1]
+ %arrayidx5 = getelementptr <16 x i8> addrspace(1)* %old, i32 0 ; <<16 x i8> addrspace(1)*> [#uses=1]
+ %tmp6 = load <16 x i8> addrspace(1)* %arrayidx5 ; <<16 x i8>> [#uses=1]
+ %tmp7 = shufflevector <16 x i8> %tmp6, <16 x i8> undef, <4 x i32> < i32 13, i32 9, i32 4, i32 13 > ; <<4 x i8>> [#uses=1]
+ %tmp9 = shufflevector <4 x i8> %tmp7, <4 x i8> undef, <4 x i32> < i32 3, i32 1, i32 2, i32 0 > ; <<4 x i8>> [#uses=1]
+ store <4 x i8> %tmp9, <4 x i8> addrspace(1)* %arrayidx
+ ret void
+
+return: ; preds = %entry
+ ret void
+} \ No newline at end of file
diff --git a/test/Transforms/InstCombine/vector-srem.ll b/test/Transforms/InstCombine/vector-srem.ll
new file mode 100644
index 000000000000..e8766ebc1e07
--- /dev/null
+++ b/test/Transforms/InstCombine/vector-srem.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {srem <4 x i32>}
+
+define <4 x i32> @foo(<4 x i32> %t, <4 x i32> %u)
+{
+ %k = sdiv <4 x i32> %t, %u
+ %l = mul <4 x i32> %k, %u
+ %m = sub <4 x i32> %t, %l
+ ret <4 x i32> %m
+}
diff --git a/test/Transforms/InstCombine/volatile_store.ll b/test/Transforms/InstCombine/volatile_store.ll
new file mode 100644
index 000000000000..09651ba302d5
--- /dev/null
+++ b/test/Transforms/InstCombine/volatile_store.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load}
+
+@x = weak global i32 0 ; <i32*> [#uses=2]
+
+define void @self_assign_1() {
+entry:
+ %tmp = volatile load i32* @x ; <i32> [#uses=1]
+ volatile store i32 %tmp, i32* @x
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/InstCombine/xor-demorgans.ll b/test/Transforms/InstCombine/xor-demorgans.ll
new file mode 100644
index 000000000000..c8de6dbdf21b
--- /dev/null
+++ b/test/Transforms/InstCombine/xor-demorgans.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {= or}
+; PR3266
+; XFAIL: *
+
+define i1 @foo(i32 %x, i32 %y) nounwind {
+.summary:
+ %0 = icmp sgt i32 %x, 4 ; <i1> [#uses=1]
+ %1 = icmp sgt i32 %y, 0 ; <i1> [#uses=1]
+ %.demorgan = or i1 %1, %0 ; <i1> [#uses=1]
+ %2 = xor i1 %.demorgan, true ; <i1> [#uses=1]
+ ret i1 %2
+}
diff --git a/test/Transforms/InstCombine/xor-undef.ll b/test/Transforms/InstCombine/xor-undef.ll
new file mode 100644
index 000000000000..c090223b5371
--- /dev/null
+++ b/test/Transforms/InstCombine/xor-undef.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zeroinitializer
+
+define <2 x i64> @f() {
+ %tmp = xor <2 x i64> undef, undef
+ ret <2 x i64> %tmp
+}
diff --git a/test/Transforms/InstCombine/xor.ll b/test/Transforms/InstCombine/xor.ll
new file mode 100644
index 000000000000..d8b84a6122dd
--- /dev/null
+++ b/test/Transforms/InstCombine/xor.ll
@@ -0,0 +1,193 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: not grep {xor }
+; END.
+@G1 = global i32 0 ; <i32*> [#uses=1]
+@G2 = global i32 0 ; <i32*> [#uses=1]
+
+define i1 @test0(i1 %A) {
+ %B = xor i1 %A, false ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i32 @test1(i32 %A) {
+ %B = xor i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i1 @test2(i1 %A) {
+ %B = xor i1 %A, %A ; <i1> [#uses=1]
+ ret i1 %B
+}
+
+define i32 @test3(i32 %A) {
+ %B = xor i32 %A, %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test4(i32 %A) {
+ %NotA = xor i32 -1, %A ; <i32> [#uses=1]
+ %B = xor i32 %A, %NotA ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define i32 @test5(i32 %A) {
+ %t1 = or i32 %A, 123 ; <i32> [#uses=1]
+ %r = xor i32 %t1, 123 ; <i32> [#uses=1]
+ ret i32 %r
+}
+
+define i8 @test6(i8 %A) {
+ %B = xor i8 %A, 17 ; <i8> [#uses=1]
+ %C = xor i8 %B, 17 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i32 @test7(i32 %A, i32 %B) {
+ %A1 = and i32 %A, 7 ; <i32> [#uses=1]
+ %B1 = and i32 %B, 128 ; <i32> [#uses=1]
+ %C1 = xor i32 %A1, %B1 ; <i32> [#uses=1]
+ ret i32 %C1
+}
+
+define i8 @test8(i1 %c) {
+ %d = xor i1 %c, true ; <i1> [#uses=1]
+ br i1 %d, label %True, label %False
+
+True: ; preds = %0
+ ret i8 1
+
+False: ; preds = %0
+ ret i8 3
+}
+
+define i1 @test9(i8 %A) {
+ %B = xor i8 %A, 123 ; <i8> [#uses=1]
+ %C = icmp eq i8 %B, 34 ; <i1> [#uses=1]
+ ret i1 %C
+}
+
+define i8 @test10(i8 %A) {
+ %B = and i8 %A, 3 ; <i8> [#uses=1]
+ %C = xor i8 %B, 4 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i8 @test11(i8 %A) {
+ %B = or i8 %A, 12 ; <i8> [#uses=1]
+ %C = xor i8 %B, 4 ; <i8> [#uses=1]
+ ret i8 %C
+}
+
+define i1 @test12(i8 %A) {
+ %B = xor i8 %A, 4 ; <i8> [#uses=1]
+ %c = icmp ne i8 %B, 0 ; <i1> [#uses=1]
+ ret i1 %c
+}
+
+define i1 @test13(i8 %A, i8 %B) {
+ %C = icmp ult i8 %A, %B ; <i1> [#uses=1]
+ %D = icmp ugt i8 %A, %B ; <i1> [#uses=1]
+ %E = xor i1 %C, %D ; <i1> [#uses=1]
+ ret i1 %E
+}
+
+define i1 @test14(i8 %A, i8 %B) {
+ %C = icmp eq i8 %A, %B ; <i1> [#uses=1]
+ %D = icmp ne i8 %B, %A ; <i1> [#uses=1]
+ %E = xor i1 %C, %D ; <i1> [#uses=1]
+ ret i1 %E
+}
+
+define i32 @test15(i32 %A) {
+ %B = add i32 %A, -1 ; <i32> [#uses=1]
+ %C = xor i32 %B, -1 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test16(i32 %A) {
+ %B = add i32 %A, 123 ; <i32> [#uses=1]
+ %C = xor i32 %B, -1 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test17(i32 %A) {
+ %B = sub i32 123, %A ; <i32> [#uses=1]
+ %C = xor i32 %B, -1 ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test18(i32 %A) {
+ %B = xor i32 %A, -1 ; <i32> [#uses=1]
+ %C = sub i32 123, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
+define i32 @test19(i32 %A, i32 %B) {
+ %C = xor i32 %A, %B ; <i32> [#uses=1]
+ %D = xor i32 %C, %A ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define void @test20(i32 %A, i32 %B) {
+ %tmp.2 = xor i32 %B, %A ; <i32> [#uses=2]
+ %tmp.5 = xor i32 %tmp.2, %B ; <i32> [#uses=2]
+ %tmp.8 = xor i32 %tmp.5, %tmp.2 ; <i32> [#uses=1]
+ store i32 %tmp.8, i32* @G1
+ store i32 %tmp.5, i32* @G2
+ ret void
+}
+
+define i32 @test21(i1 %C, i32 %A, i32 %B) {
+ %C2 = xor i1 %C, true ; <i1> [#uses=1]
+ %D = select i1 %C2, i32 %A, i32 %B ; <i32> [#uses=1]
+ ret i32 %D
+}
+
+define i32 @test22(i1 %X) {
+ %Y = xor i1 %X, true ; <i1> [#uses=1]
+ %Z = zext i1 %Y to i32 ; <i32> [#uses=1]
+ %Q = xor i32 %Z, 1 ; <i32> [#uses=1]
+ ret i32 %Q
+}
+
+define i1 @test23(i32 %a, i32 %b) {
+ %tmp.2 = xor i32 %b, %a ; <i32> [#uses=1]
+ %tmp.4 = icmp eq i32 %tmp.2, %a ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+define i1 @test24(i32 %c, i32 %d) {
+ %tmp.2 = xor i32 %d, %c ; <i32> [#uses=1]
+ %tmp.4 = icmp ne i32 %tmp.2, %c ; <i1> [#uses=1]
+ ret i1 %tmp.4
+}
+
+define i32 @test25(i32 %g, i32 %h) {
+ %h2 = xor i32 %h, -1 ; <i32> [#uses=1]
+ %tmp2 = and i32 %h2, %g ; <i32> [#uses=1]
+ %tmp4 = xor i32 %tmp2, %g ; <i32> [#uses=1]
+ ret i32 %tmp4
+}
+
+define i32 @test26(i32 %a, i32 %b) {
+ %b2 = xor i32 %b, -1 ; <i32> [#uses=1]
+ %tmp2 = xor i32 %a, %b2 ; <i32> [#uses=1]
+ %tmp4 = and i32 %tmp2, %a ; <i32> [#uses=1]
+ ret i32 %tmp4
+}
+
+define i32 @test27(i32 %b, i32 %c, i32 %d) {
+ %tmp2 = xor i32 %d, %b ; <i32> [#uses=1]
+ %tmp5 = xor i32 %d, %c ; <i32> [#uses=1]
+ %tmp = icmp eq i32 %tmp2, %tmp5 ; <i1> [#uses=1]
+ %tmp6 = zext i1 %tmp to i32 ; <i32> [#uses=1]
+ ret i32 %tmp6
+}
+
+define i32 @test28(i32 %indvar) {
+ %tmp7 = add i32 %indvar, -2147483647 ; <i32> [#uses=1]
+ %tmp214 = xor i32 %tmp7, -2147483648 ; <i32> [#uses=1]
+ ret i32 %tmp214
+}
diff --git a/test/Transforms/InstCombine/xor2.ll b/test/Transforms/InstCombine/xor2.ll
new file mode 100644
index 000000000000..efb3146c68bf
--- /dev/null
+++ b/test/Transforms/InstCombine/xor2.ll
@@ -0,0 +1,17 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor }
+
+; PR1253
+define i1 @test0(i32 %A) {
+ %B = xor i32 %A, -2147483648
+ %C = icmp sgt i32 %B, -1
+ ret i1 %C
+}
+
+define i1 @test1(i32 %A) {
+ %B = xor i32 %A, 12345
+ %C = icmp slt i32 %B, 0
+ ret i1 %C
+}
+
diff --git a/test/Transforms/InstCombine/zero-point-zero-add.ll b/test/Transforms/InstCombine/zero-point-zero-add.ll
new file mode 100644
index 000000000000..bae60d970356
--- /dev/null
+++ b/test/Transforms/InstCombine/zero-point-zero-add.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 0.0 | count 1
+
+declare double @abs(double)
+
+define double @test(double %X) {
+ %Y = add double %X, 0.0 ;; Should be a single add x, 0.0
+ %Z = add double %Y, 0.0
+ ret double %Z
+}
+
+define double @test1(double %X) {
+ %Y = call double @abs(double %X)
+ %Z = add double %Y, 0.0
+ ret double %Z
+}
diff --git a/test/Transforms/InstCombine/zeroext-and-reduce.ll b/test/Transforms/InstCombine/zeroext-and-reduce.ll
new file mode 100644
index 000000000000..2b4950aec978
--- /dev/null
+++ b/test/Transforms/InstCombine/zeroext-and-reduce.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: grep {and i32 %Y, 8}
+
+define i32 @test1(i8 %X) {
+ %Y = zext i8 %X to i32 ; <i32> [#uses=1]
+ %Z = and i32 %Y, 65544 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+
diff --git a/test/Transforms/InstCombine/zext-fold.ll b/test/Transforms/InstCombine/zext-fold.ll
new file mode 100644
index 000000000000..27ea46061b07
--- /dev/null
+++ b/test/Transforms/InstCombine/zext-fold.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {zext } | count 1
+; PR1570
+
+define i32 @test2(float %X, float %Y) {
+entry:
+ %tmp3 = fcmp uno float %X, %Y ; <i1> [#uses=1]
+ %tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
+ %tmp = xor i8 %tmp34, 1 ; <i8> [#uses=1]
+ %toBoolnot5 = zext i8 %tmp to i32 ; <i32> [#uses=1]
+ ret i32 %toBoolnot5
+}
+
diff --git a/test/Transforms/InstCombine/zext-or-icmp.ll b/test/Transforms/InstCombine/zext-or-icmp.ll
new file mode 100644
index 000000000000..35c7c0a6be6e
--- /dev/null
+++ b/test/Transforms/InstCombine/zext-or-icmp.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp | count 1
+
+ %struct.FooBar = type <{ i8, i8, [2 x i8], i8, i8, i8, i8, i16, i16, [4 x i8], [8 x %struct.Rock] }>
+ %struct.Rock = type { i16, i16 }
+@some_idx = internal constant [4 x i8] c"\0A\0B\0E\0F" ; <[4 x i8]*> [#uses=1]
+
+define i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) zeroext nounwind {
+entry:
+ %tmp2 = lshr i32 %blk_i, 1 ; <i32> [#uses=1]
+ %tmp3 = and i32 %tmp2, 2 ; <i32> [#uses=1]
+ %tmp5 = and i32 %blk_i, 1 ; <i32> [#uses=1]
+ %tmp6 = or i32 %tmp3, %tmp5 ; <i32> [#uses=1]
+ %tmp8 = getelementptr %struct.FooBar* %up, i32 0, i32 7 ; <i16*> [#uses=1]
+ %tmp9 = load i16* %tmp8, align 1 ; <i16> [#uses=1]
+ %tmp910 = zext i16 %tmp9 to i32 ; <i32> [#uses=1]
+ %tmp12 = getelementptr [4 x i8]* @some_idx, i32 0, i32 %tmp6 ; <i8*> [#uses=1]
+ %tmp13 = load i8* %tmp12, align 1 ; <i8> [#uses=1]
+ %tmp1314 = zext i8 %tmp13 to i32 ; <i32> [#uses=1]
+ %tmp151 = lshr i32 %tmp910, %tmp1314 ; <i32> [#uses=1]
+ %tmp1516 = trunc i32 %tmp151 to i8 ; <i8> [#uses=1]
+ %tmp18 = getelementptr %struct.FooBar* %up, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp19 = load i8* %tmp18, align 1 ; <i8> [#uses=1]
+ %tmp22 = and i8 %tmp1516, %tmp19 ; <i8> [#uses=1]
+ %tmp24 = getelementptr %struct.FooBar* %up, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp25 = load i8* %tmp24, align 1 ; <i8> [#uses=1]
+ %tmp26.mask = and i8 %tmp25, 1 ; <i8> [#uses=1]
+ %toBool = icmp eq i8 %tmp26.mask, 0 ; <i1> [#uses=1]
+ %toBool.not = xor i1 %toBool, true ; <i1> [#uses=1]
+ %toBool33 = icmp eq i8 %intra_flag, 0 ; <i1> [#uses=1]
+ %bothcond = or i1 %toBool.not, %toBool33 ; <i1> [#uses=1]
+ %iftmp.1.0 = select i1 %bothcond, i8 0, i8 1 ; <i8> [#uses=1]
+ %tmp40 = or i8 %tmp22, %iftmp.1.0 ; <i8> [#uses=1]
+ %tmp432 = and i8 %tmp40, 1 ; <i8> [#uses=1]
+ ret i8 %tmp432
+}
diff --git a/test/Transforms/InstCombine/zext.ll b/test/Transforms/InstCombine/zext.ll
new file mode 100644
index 000000000000..c0fa3771cc15
--- /dev/null
+++ b/test/Transforms/InstCombine/zext.ll
@@ -0,0 +1,33 @@
+; Tests to make sure elimination of casts is working correctly
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
+; RUN: notcast {} {%c1.*}
+
+define i64 @test_sext_zext(i16 %A) {
+ %c1 = zext i16 %A to i32 ; <i32> [#uses=1]
+ %c2 = sext i32 %c1 to i64 ; <i64> [#uses=1]
+ ret i64 %c2
+}
+
+; PR3599
+define i32 @test2(i64 %tmp) nounwind readnone {
+entry:
+ %tmp5 = trunc i64 %tmp to i8 ; <i8> [#uses=1]
+ %tmp7 = lshr i64 %tmp, 8 ; <i64> [#uses=1]
+ %tmp8 = trunc i64 %tmp7 to i8 ; <i8> [#uses=1]
+ %tmp10 = lshr i64 %tmp, 16 ; <i64> [#uses=1]
+ %tmp11 = trunc i64 %tmp10 to i8 ; <i8> [#uses=1]
+ %tmp13 = lshr i64 %tmp, 24 ; <i64> [#uses=1]
+ %tmp14 = trunc i64 %tmp13 to i8 ; <i8> [#uses=1]
+ %tmp1 = zext i8 %tmp5 to i32 ; <i32> [#uses=1]
+ %tmp2 = zext i8 %tmp8 to i32 ; <i32> [#uses=1]
+ %tmp3 = shl i32 %tmp2, 8 ; <i32> [#uses=1]
+ %tmp4 = zext i8 %tmp11 to i32 ; <i32> [#uses=1]
+ %tmp6 = shl i32 %tmp4, 16 ; <i32> [#uses=1]
+ %tmp9 = zext i8 %tmp14 to i32 ; <i32> [#uses=1]
+ %tmp12 = shl i32 %tmp9, 24 ; <i32> [#uses=1]
+ %tmp15 = or i32 %tmp12, %tmp1 ; <i32> [#uses=1]
+ %tmp16 = or i32 %tmp15, %tmp6 ; <i32> [#uses=1]
+ %tmp17 = or i32 %tmp16, %tmp3 ; <i32> [#uses=1]
+ ret i32 %tmp17
+}
+
diff --git a/test/Transforms/Internalize/2008-05-09-AllButMain.ll b/test/Transforms/Internalize/2008-05-09-AllButMain.ll
new file mode 100644
index 000000000000..6ba5cb985ab9
--- /dev/null
+++ b/test/Transforms/Internalize/2008-05-09-AllButMain.ll
@@ -0,0 +1,27 @@
+; No arguments means internalize all but main
+; RUN: llvm-as < %s | opt -internalize | llvm-dis | grep internal | count 4
+; Internalize all but foo and j
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-list foo -internalize-public-api-list j | llvm-dis | grep internal | count 3
+; Non existent files should be treated as if they were empty (so internalize all but main)
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-file /nonexistent/file 2> /dev/null | llvm-dis | grep internal | count 4
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-list bar -internalize-public-api-list foo -internalize-public-api-file /nonexistent/file 2> /dev/null | llvm-dis | grep internal | count 3
+; -file and -list options should be merged, the .apifile contains foo and j
+; RUN: llvm-as < %s | opt -internalize -internalize-public-api-list bar -internalize-public-api-file %s.apifile | llvm-dis | grep internal | count 2
+
+@i = weak global i32 0 ; <i32*> [#uses=0]
+@j = weak global i32 0 ; <i32*> [#uses=0]
+
+define void @main(...) {
+entry:
+ ret void
+}
+
+define void @foo(...) {
+entry:
+ ret void
+}
+
+define void @bar(...) {
+entry:
+ ret void
+}
diff --git a/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile b/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile
new file mode 100644
index 000000000000..f6c58b80c1cd
--- /dev/null
+++ b/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile
@@ -0,0 +1,2 @@
+foo
+j
diff --git a/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll b/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll
new file mode 100644
index 000000000000..c0041ac2d7df
--- /dev/null
+++ b/test/Transforms/Internalize/2009-01-05-InternalizeAliases.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -internalize | llvm-dis | grep internal | count 3
+
+@A = global i32 0
+@B = alias i32* @A
+@C = alias i32* @B
+
+define i32 @main() {
+ %tmp = load i32* @C
+ ret i32 %tmp
+}
diff --git a/test/Transforms/Internalize/dg.exp b/test/Transforms/Internalize/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/Internalize/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll b/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll
new file mode 100644
index 000000000000..3eb2aa1be5b0
--- /dev/null
+++ b/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll
@@ -0,0 +1,142 @@
+; RUN: llvm-as < %s | opt -jump-threading -disable-output
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+@Link = global [1 x i32] [ i32 -1 ] ; <[1 x i32]*> [#uses=2]
+@W = global [1 x i32] [ i32 2 ] ; <[1 x i32]*> [#uses=1]
+
+define i32 @f(i32 %k, i32 %p) nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb56, %bb76.loopexit.us, %entry
+ %j.2 = phi i32 [ 0, %entry ], [ 1, %bb56 ], [ 1, %bb76.loopexit.us ] ; <i32> [#uses=5]
+ %pdest.2 = phi i32 [ 0, %entry ], [ %pdest.8, %bb56 ], [ %pdest.7.us, %bb76.loopexit.us ] ; <i32> [#uses=3]
+ %p_addr.0 = phi i32 [ %p, %entry ], [ 0, %bb56 ], [ %p_addr.1.us, %bb76.loopexit.us ] ; <i32> [#uses=3]
+ %k_addr.0 = phi i32 [ %k, %entry ], [ %tmp59, %bb56 ], [ %tmp59.us, %bb76.loopexit.us ] ; <i32> [#uses=4]
+ %tmp2 = icmp sgt i32 %pdest.2, 2 ; <i1> [#uses=1]
+ br i1 %tmp2, label %bb4.preheader, label %bb13
+
+bb4.preheader: ; preds = %bb
+ %tmp109 = sub i32 1, %j.2 ; <i32> [#uses=2]
+ %tmp110 = icmp slt i32 %tmp109, -2 ; <i1> [#uses=1]
+ %smax111 = select i1 %tmp110, i32 -2, i32 %tmp109 ; <i32> [#uses=2]
+ %tmp112 = add i32 %j.2, %smax111 ; <i32> [#uses=2]
+ br label %bb4
+
+bb4: ; preds = %bb4, %bb4.preheader
+ %indvar = phi i32 [ 0, %bb4.preheader ], [ %indvar.next, %bb4 ] ; <i32> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %tmp112 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb13.loopexit, label %bb4
+
+bb13.loopexit: ; preds = %bb4
+ %tmp = add i32 %j.2, %pdest.2 ; <i32> [#uses=1]
+ %tmp102 = add i32 %tmp, %smax111 ; <i32> [#uses=1]
+ %tmp104 = add i32 %tmp112, -1 ; <i32> [#uses=1]
+ %tmp106 = sub i32 %j.2, %tmp104 ; <i32> [#uses=1]
+ %tmp107 = add i32 %tmp106, -1 ; <i32> [#uses=1]
+ br label %bb13
+
+bb13: ; preds = %bb13.loopexit, %bb
+ %j.1 = phi i32 [ %tmp107, %bb13.loopexit ], [ %j.2, %bb ] ; <i32> [#uses=4]
+ %pdest.1 = phi i32 [ %tmp102, %bb13.loopexit ], [ %pdest.2, %bb ] ; <i32> [#uses=2]
+ %tmp15 = icmp eq i32 %j.1, 1 ; <i1> [#uses=1]
+ br i1 %tmp15, label %bb82, label %bb27.preheader
+
+bb27.preheader: ; preds = %bb13
+ %tmp21 = icmp eq i32 %j.1, %p_addr.0 ; <i1> [#uses=0]
+ br label %bb27.outer
+
+bb27.outer: ; preds = %bb27.outer.bb24.split_crit_edge, %bb27.preheader
+ %indvar118 = phi i32 [ 0, %bb27.preheader ], [ %indvar.next119, %bb27.outer.bb24.split_crit_edge ] ; <i32> [#uses=2]
+ %pdest.3.ph = add i32 %indvar118, %pdest.1 ; <i32> [#uses=2]
+ %tmp30 = icmp sgt i32 %pdest.3.ph, %p_addr.0 ; <i1> [#uses=1]
+ br i1 %tmp30, label %bb27.outer.bb24.split_crit_edge, label %bb27.outer.split
+
+bb27.outer.bb24.split_crit_edge: ; preds = %bb27.outer
+ %indvar.next119 = add i32 %indvar118, 1 ; <i32> [#uses=1]
+ br label %bb27.outer
+
+bb27.outer.split: ; preds = %bb27.outer
+ %tmp35 = getelementptr [1 x i32]* @W, i32 0, i32 %k_addr.0 ; <i32*> [#uses=3]
+ %tmp48 = icmp slt i32 %p_addr.0, 1 ; <i1> [#uses=1]
+ %tmp53 = icmp sgt i32 %k_addr.0, 0 ; <i1> [#uses=1]
+ br label %bb33
+
+bb33: ; preds = %bb51.split, %bb27.outer.split
+ %pdest.5 = phi i32 [ %pdest.3.ph, %bb27.outer.split ], [ %pdest.4, %bb51.split ] ; <i32> [#uses=1]
+ %tmp36 = load i32* %tmp35, align 4 ; <i32> [#uses=2]
+ br i1 %tmp48, label %bb37.us, label %bb37
+
+bb37.us: ; preds = %bb42.us, %bb37.us, %bb33
+ %D1361.1.us = phi i32 [ %tmp36, %bb33 ], [ 0, %bb42.us ], [ %D1361.1.us, %bb37.us ] ; <i32> [#uses=2]
+ %tmp39.us = icmp eq i32 %D1361.1.us, 0 ; <i1> [#uses=1]
+ br i1 %tmp39.us, label %bb37.us, label %bb42.us
+
+bb42.us: ; preds = %bb37.us
+ store i32 0, i32* %tmp35, align 4
+ br label %bb37.us
+
+bb37: ; preds = %bb33
+ %tmp39 = icmp eq i32 %tmp36, 0 ; <i1> [#uses=1]
+ br i1 %tmp39, label %bb51.split, label %bb42
+
+bb42: ; preds = %bb37
+ store i32 0, i32* %tmp35, align 4
+ br label %bb51.split
+
+bb51.split: ; preds = %bb42, %bb37
+ %pdest.4 = phi i32 [ 1, %bb42 ], [ %pdest.5, %bb37 ] ; <i32> [#uses=3]
+ br i1 %tmp53, label %bb33, label %bb56.preheader
+
+bb56.preheader: ; preds = %bb51.split
+ %tmp7394 = icmp sgt i32 %j.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp7394, label %bb56.us, label %bb56
+
+bb56.us: ; preds = %bb76.loopexit.us, %bb56.preheader
+ %pdest.8.us = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.7.us, %bb76.loopexit.us ] ; <i32> [#uses=1]
+ %k_addr.1.us = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59.us, %bb76.loopexit.us ] ; <i32> [#uses=1]
+ %tmp58.us = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1.us ; <i32*> [#uses=1]
+ %tmp59.us = load i32* %tmp58.us, align 4 ; <i32> [#uses=3]
+ %tmp6295.us = icmp ne i32 %tmp59.us, -1 ; <i1> [#uses=2]
+ br label %bb60.us
+
+bb60.us: ; preds = %bb60.us, %bb56.us
+ %pdest.7.reg2mem.0.us = phi i32 [ %pdest.8.us, %bb56.us ], [ %pdest.7.us, %bb60.us ] ; <i32> [#uses=1]
+ %p_addr.1.reg2mem.0.us = phi i32 [ 0, %bb56.us ], [ %p_addr.1.us, %bb60.us ] ; <i32> [#uses=1]
+ %tmp67.us = zext i1 %tmp6295.us to i32 ; <i32> [#uses=2]
+ %pdest.7.us = add i32 %pdest.7.reg2mem.0.us, %tmp67.us ; <i32> [#uses=3]
+ %p_addr.1.us = add i32 %p_addr.1.reg2mem.0.us, %tmp67.us ; <i32> [#uses=3]
+ %tmp73.us = icmp slt i32 %p_addr.1.us, %j.1 ; <i1> [#uses=1]
+ br i1 %tmp73.us, label %bb60.us, label %bb76.loopexit.us
+
+bb76.loopexit.us: ; preds = %bb60.us
+ br i1 %tmp6295.us, label %bb56.us, label %bb
+
+bb56: ; preds = %bb56, %bb56.preheader
+ %pdest.8 = phi i32 [ %pdest.4, %bb56.preheader ], [ %pdest.8, %bb56 ] ; <i32> [#uses=2]
+ %k_addr.1 = phi i32 [ %k_addr.0, %bb56.preheader ], [ %tmp59, %bb56 ] ; <i32> [#uses=1]
+ %tmp58 = getelementptr [1 x i32]* @Link, i32 0, i32 %k_addr.1 ; <i32*> [#uses=1]
+ %tmp59 = load i32* %tmp58, align 4 ; <i32> [#uses=3]
+ %tmp6295 = icmp ne i32 %tmp59, -1 ; <i1> [#uses=1]
+ br i1 %tmp6295, label %bb56, label %bb
+
+bb82: ; preds = %bb13
+ ret i32 %pdest.1
+}
+
+define i32 @main() nounwind {
+entry:
+ %tmp1 = tail call i32 @f( i32 0, i32 2 ) nounwind ; <i32> [#uses=1]
+ %tmp2 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
+ br i1 %tmp2, label %bb, label %bb4
+
+bb: ; preds = %entry
+ tail call void @abort( ) noreturn nounwind
+ unreachable
+
+bb4: ; preds = %entry
+ ret i32 0
+}
+
+declare void @abort() noreturn nounwind
diff --git a/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll b/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll
new file mode 100644
index 000000000000..f109109fc3f5
--- /dev/null
+++ b/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -jump-threading -disable-output
+; PR2285
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.system__secondary_stack__mark_id = type { i64, i64 }
+
+define void @_ada_c35507b() {
+entry:
+ br label %bb
+
+bb: ; preds = %bb13, %entry
+ %ch.0 = phi i8 [ 0, %entry ], [ 0, %bb13 ] ; <i8> [#uses=1]
+ %tmp11 = icmp ugt i8 %ch.0, 31 ; <i1> [#uses=1]
+ %tmp120 = call %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark( ) ; <%struct.system__secondary_stack__mark_id> [#uses=1]
+ br i1 %tmp11, label %bb110, label %bb13
+
+bb13: ; preds = %bb
+ br label %bb
+
+bb110: ; preds = %bb
+ %mrv_gr124 = getresult %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0]
+ unreachable
+}
+
+declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark()
diff --git a/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll b/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll
new file mode 100644
index 000000000000..216dacb8d268
--- /dev/null
+++ b/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg | llvm-dis | grep {ret i32 0}
+; PR3138
+
+define i32 @jt() {
+entry:
+ br i1 true, label %bb3, label %bb
+
+bb: ; preds = %entry
+ unreachable
+
+bb3: ; preds = %entry
+ ret i32 0
+}
diff --git a/test/Transforms/JumpThreading/2008-11-28-InfLoop.ll b/test/Transforms/JumpThreading/2008-11-28-InfLoop.ll
new file mode 100644
index 000000000000..974b9ef77478
--- /dev/null
+++ b/test/Transforms/JumpThreading/2008-11-28-InfLoop.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -jump-threading | llvm-dis
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.5"
+ %struct.decContext = type { i32 }
+ %struct.decNumber = type { i32, i32 }
+
+define i32 @decNumberPower(%struct.decNumber* %res, %struct.decNumber* %lhs, %struct.decNumber* %rhs, %struct.decContext* %set) nounwind {
+entry:
+ br i1 true, label %decDivideOp.exit, label %bb7.i
+
+bb7.i: ; preds = %bb7.i, %entry
+ br label %bb7.i
+
+decDivideOp.exit: ; preds = %entry
+ ret i32 undef
+}
diff --git a/test/Transforms/JumpThreading/2009-01-08-DeadLoopRepl.ll b/test/Transforms/JumpThreading/2009-01-08-DeadLoopRepl.ll
new file mode 100644
index 000000000000..6de67ebbcecc
--- /dev/null
+++ b/test/Transforms/JumpThreading/2009-01-08-DeadLoopRepl.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -jump-threading | llvm-dis
+; PR3298
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+
+define i32 @func(i32 %p_79, i32 %p_80) nounwind {
+entry:
+ br label %bb7
+
+bb1: ; preds = %bb2
+ br label %bb2
+
+bb2: ; preds = %bb7, %bb1
+ %l_82.0 = phi i8 [ 0, %bb1 ], [ %l_82.1, %bb7 ] ; <i8> [#uses=3]
+ br i1 true, label %bb3, label %bb1
+
+bb3: ; preds = %bb2
+ %0 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb7, label %bb6
+
+bb5: ; preds = %bb6
+ %1 = icmp eq i8 %l_82.0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb1.i, label %bb.i
+
+bb.i: ; preds = %bb5
+ br label %safe_div_func_char_s_s.exit
+
+bb1.i: ; preds = %bb5
+ br label %safe_div_func_char_s_s.exit
+
+safe_div_func_char_s_s.exit: ; preds = %bb1.i, %bb.i
+ br label %bb6
+
+bb6: ; preds = %safe_div_func_char_s_s.exit, %bb3
+ %p_80_addr.0 = phi i32 [ %p_80_addr.1, %bb3 ], [ 1, %safe_div_func_char_s_s.exit ] ; <i32> [#uses=2]
+ %2 = icmp eq i32 %p_80_addr.0, 0 ; <i1> [#uses=1]
+ br i1 %2, label %bb7, label %bb5
+
+bb7: ; preds = %bb6, %bb3, %entry
+ %l_82.1 = phi i8 [ 1, %entry ], [ %l_82.0, %bb3 ], [ %l_82.0, %bb6 ] ; <i8> [#uses=2]
+ %p_80_addr.1 = phi i32 [ 0, %entry ], [ %p_80_addr.1, %bb3 ], [ %p_80_addr.0, %bb6 ] ; <i32> [#uses=4]
+ %3 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
+ br i1 %3, label %bb8, label %bb2
+
+bb8: ; preds = %bb7
+ %4 = sext i8 %l_82.1 to i32 ; <i32> [#uses=0]
+ ret i32 0
+}
diff --git a/test/Transforms/JumpThreading/2009-01-19-InfSwitchLoop.ll b/test/Transforms/JumpThreading/2009-01-19-InfSwitchLoop.ll
new file mode 100644
index 000000000000..ab8b087f8a4a
--- /dev/null
+++ b/test/Transforms/JumpThreading/2009-01-19-InfSwitchLoop.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -jump-threading | llvm-dis
+; PR3353
+
+define i32 @test(i8 %X) {
+entry:
+ %Y = add i8 %X, 1
+ %Z = add i8 %Y, 1
+ br label %bb33.i
+
+bb33.i: ; preds = %bb33.i, %bb32.i
+ switch i8 %Y, label %bb32.i [
+ i8 39, label %bb35.split.i
+ i8 13, label %bb33.i
+ ]
+
+bb35.split.i:
+ ret i32 5
+bb32.i:
+ ret i32 1
+}
+
diff --git a/test/Transforms/JumpThreading/and-and-cond.ll b/test/Transforms/JumpThreading/and-and-cond.ll
new file mode 100644
index 000000000000..de4435c50794
--- /dev/null
+++ b/test/Transforms/JumpThreading/and-and-cond.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond, i1 %cond2, i1 %cond3) {
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+F1:
+ %v2 = call i32 @f2()
+ br label %Merge
+
+Merge:
+ %A = phi i1 [true, %T1], [false, %F1]
+ %B = phi i32 [%v1, %T1], [%v2, %F1]
+ %C = and i1 %A, %cond2
+ %D = and i1 %C, %cond3
+ br i1 %D, label %T2, label %F2
+
+T2:
+ call void @f3()
+ ret i32 %B
+
+F2:
+ ret i32 %B
+}
diff --git a/test/Transforms/JumpThreading/and-cond.ll b/test/Transforms/JumpThreading/and-cond.ll
new file mode 100644
index 000000000000..b01c4baffc0e
--- /dev/null
+++ b/test/Transforms/JumpThreading/and-cond.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -instcombine -simplifycfg | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond, i1 %cond2) {
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+F1:
+ %v2 = call i32 @f2()
+ br label %Merge
+
+Merge:
+ %A = phi i1 [true, %T1], [false, %F1]
+ %B = phi i32 [%v1, %T1], [%v2, %F1]
+ %C = and i1 %A, %cond2
+ br i1 %C, label %T2, label %F2
+
+T2:
+ call void @f3()
+ ret i32 %B
+
+F2:
+ ret i32 %B
+}
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll
new file mode 100644
index 000000000000..bf746e7f139c
--- /dev/null
+++ b/test/Transforms/JumpThreading/basic.ll
@@ -0,0 +1,53 @@
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | grep {ret i32 %v1}
+; There should be no uncond branches left.
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {br label}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond) {
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+F1:
+ %v2 = call i32 @f2()
+ br label %Merge
+
+Merge:
+ %A = phi i1 [true, %T1], [false, %F1]
+ %B = phi i32 [%v1, %T1], [%v2, %F1]
+ br i1 %A, label %T2, label %F2
+
+T2:
+ call void @f3()
+ ret i32 %B
+
+F2:
+ ret i32 %B
+}
+
+
+;; cond is known false on Entry -> F1 edge!
+define i32 @test2(i1 %cond) {
+Entry:
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+F1:
+ br i1 %cond, label %Merge, label %F2
+
+Merge:
+ %B = phi i32 [47, %T1], [192, %F1]
+ ret i32 %B
+
+F2:
+ call void @f3()
+ ret i32 12
+}
diff --git a/test/Transforms/JumpThreading/compare.ll b/test/Transforms/JumpThreading/compare.ll
new file mode 100644
index 000000000000..cbada569aac9
--- /dev/null
+++ b/test/Transforms/JumpThreading/compare.ll
@@ -0,0 +1,30 @@
+; There should be no phi nodes left.
+; RUN: llvm-as < %s | opt -jump-threading -simplifycfg -mem2reg | llvm-dis | not grep {phi i32}
+
+declare i32 @f1()
+declare i32 @f2()
+declare void @f3()
+
+define i32 @test(i1 %cond) {
+ br i1 %cond, label %T1, label %F1
+
+T1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+F1:
+ %v2 = call i32 @f2()
+ br label %Merge
+
+Merge:
+ %B = phi i32 [%v1, %T1], [12, %F1]
+ %A = icmp ne i32 %B, 42
+ br i1 %A, label %T2, label %F2
+
+T2:
+ call void @f3()
+ ret i32 1
+
+F2:
+ ret i32 0
+}
diff --git a/test/Transforms/JumpThreading/dg.exp b/test/Transforms/JumpThreading/dg.exp
new file mode 100644
index 000000000000..de42dad163fd
--- /dev/null
+++ b/test/Transforms/JumpThreading/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]]
diff --git a/test/Transforms/JumpThreading/no-irreducible-loops.ll b/test/Transforms/JumpThreading/no-irreducible-loops.ll
new file mode 100644
index 000000000000..0c729d1a9b4d
--- /dev/null
+++ b/test/Transforms/JumpThreading/no-irreducible-loops.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -jump-threading -loop-rotate -instcombine -indvars -loop-unroll -simplifycfg | llvm-dis > %t
+; RUN: grep {volatile store} %t | count 3
+; RUN: not grep {br label} %t
+
+; Jump threading should not prevent this loop from being unrolled.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+@v1 = external global i32 ; <i32*> [#uses=2]
+
+define i32 @unroll() nounwind {
+entry:
+ br label %bb4
+
+bb: ; preds = %bb4
+ %0 = icmp eq i32 %i.0, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb1, label %bb2
+
+bb1: ; preds = %bb
+ volatile store i32 1000, i32* @v1, align 4
+ br label %bb3
+
+bb2: ; preds = %bb
+ volatile store i32 1001, i32* @v1, align 4
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb1
+ %1 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb4
+
+bb4: ; preds = %bb3, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %1, %bb3 ] ; <i32> [#uses=3]
+ %2 = icmp sgt i32 %i.0, 2 ; <i1> [#uses=1]
+ br i1 %2, label %bb5, label %bb
+
+bb5: ; preds = %bb4
+ ret i32 0
+}
diff --git a/test/Transforms/JumpThreading/thread-loads.ll b/test/Transforms/JumpThreading/thread-loads.ll
new file mode 100644
index 000000000000..5c0b256224a9
--- /dev/null
+++ b/test/Transforms/JumpThreading/thread-loads.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -jump-threading -mem2reg -simplifycfg | llvm-dis | grep {ret i32 1}
+; rdar://6402033
+
+; Test that we can thread through the block with the partially redundant load (%2).
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin7"
+
+define i32 @foo(i32* %P) nounwind {
+entry:
+ %0 = tail call i32 (...)* @f1() nounwind ; <i32> [#uses=1]
+ %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb1, label %bb
+
+bb: ; preds = %entry
+ store i32 42, i32* %P, align 4
+ br label %bb1
+
+bb1: ; preds = %entry, %bb
+ %res.0 = phi i32 [ 1, %bb ], [ 0, %entry ] ; <i32> [#uses=2]
+ %2 = load i32* %P, align 4 ; <i32> [#uses=1]
+ %3 = icmp sgt i32 %2, 36 ; <i1> [#uses=1]
+ br i1 %3, label %bb3, label %bb2
+
+bb2: ; preds = %bb1
+ %4 = tail call i32 (...)* @f2() nounwind ; <i32> [#uses=0]
+ ret i32 %res.0
+
+bb3: ; preds = %bb1
+ ret i32 %res.0
+}
+
+declare i32 @f1(...)
+
+declare i32 @f2(...)
diff --git a/test/Transforms/JumpThreading/undef.ll b/test/Transforms/JumpThreading/undef.ll
new file mode 100644
index 000000000000..497a87a65641
--- /dev/null
+++ b/test/Transforms/JumpThreading/undef.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -jump-threading | llvm-dis | not grep {br }
+; RUN: llvm-as < %s | opt -jump-threading | llvm-dis | grep {ret i32} | count 1
+
+define i32 @test(i1 %cond) {
+ br i1 undef, label %T1, label %F1
+
+T1:
+ ret i32 42
+
+F1:
+ ret i32 17
+}
diff --git a/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll b/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll
new file mode 100644
index 000000000000..aa24014f3b99
--- /dev/null
+++ b/test/Transforms/LCSSA/2006-06-03-IncorrectIDFPhis.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
+; RUN: grep {%SJE.0.0.lcssa = phi .struct.SetJmpMapEntry}
+; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
+; RUN: grep {%SJE.0.0.lcssa1 = phi .struct.SetJmpMapEntry}
+
+ %struct.SetJmpMapEntry = type { i8*, i32, %struct.SetJmpMapEntry* }
+
+define void @__llvm_sjljeh_try_catching_longjmp_exception() {
+entry:
+ br i1 false, label %UnifiedReturnBlock, label %no_exit
+no_exit: ; preds = %endif, %entry
+ %SJE.0.0 = phi %struct.SetJmpMapEntry* [ %tmp.24, %endif ], [ null, %entry ] ; <%struct.SetJmpMapEntry*> [#uses=1]
+ br i1 false, label %then, label %endif
+then: ; preds = %no_exit
+ %tmp.20 = getelementptr %struct.SetJmpMapEntry* %SJE.0.0, i32 0, i32 1 ; <i32*> [#uses=0]
+ ret void
+endif: ; preds = %no_exit
+ %tmp.24 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1]
+ br i1 false, label %UnifiedReturnBlock, label %no_exit
+UnifiedReturnBlock: ; preds = %endif, %entry
+ ret void
+}
+
diff --git a/test/Transforms/LCSSA/2006-06-12-MultipleExitsSameBlock.ll b/test/Transforms/LCSSA/2006-06-12-MultipleExitsSameBlock.ll
new file mode 100644
index 000000000000..eaccbadbf1d7
--- /dev/null
+++ b/test/Transforms/LCSSA/2006-06-12-MultipleExitsSameBlock.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
+; RUN: grep {%X.1.lcssa}
+; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
+; RUN: not grep {%X.1.lcssa1}
+
+declare i1 @c1()
+
+declare i1 @c2()
+
+define i32 @foo() {
+entry:
+ br label %loop_begin
+loop_begin: ; preds = %loop_body.2, %entry
+ br i1 true, label %loop_body.1, label %loop_exit2
+loop_body.1: ; preds = %loop_begin
+ %X.1 = add i32 0, 1 ; <i32> [#uses=1]
+ %rel.1 = call i1 @c1( ) ; <i1> [#uses=1]
+ br i1 %rel.1, label %loop_exit, label %loop_body.2
+loop_body.2: ; preds = %loop_body.1
+ %rel.2 = call i1 @c2( ) ; <i1> [#uses=1]
+ br i1 %rel.2, label %loop_exit, label %loop_begin
+loop_exit: ; preds = %loop_body.2, %loop_body.1
+ ret i32 %X.1
+loop_exit2: ; preds = %loop_begin
+ ret i32 1
+}
+
diff --git a/test/Transforms/LCSSA/2006-07-09-NoDominator.ll b/test/Transforms/LCSSA/2006-07-09-NoDominator.ll
new file mode 100644
index 000000000000..c8af10058c08
--- /dev/null
+++ b/test/Transforms/LCSSA/2006-07-09-NoDominator.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -lcssa
+
+ %struct.SetJmpMapEntry = type { i8*, i32, %struct.SetJmpMapEntry* }
+
+define void @__llvm_sjljeh_try_catching_longjmp_exception() {
+entry:
+ br label %loopentry
+loopentry: ; preds = %endif, %entry
+ %SJE.0 = phi %struct.SetJmpMapEntry* [ null, %entry ], [ %tmp.25, %endif ] ; <%struct.SetJmpMapEntry*> [#uses=1]
+ br i1 false, label %no_exit, label %loopexit
+no_exit: ; preds = %loopentry
+ br i1 false, label %then, label %endif
+then: ; preds = %no_exit
+ %tmp.21 = getelementptr %struct.SetJmpMapEntry* %SJE.0, i32 0, i32 1 ; <i32*> [#uses=0]
+ br label %return
+endif: ; preds = %no_exit
+ %tmp.25 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1]
+ br label %loopentry
+loopexit: ; preds = %loopentry
+ br label %return
+return: ; preds = %loopexit, %then
+ ret void
+}
+
diff --git a/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll b/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll
new file mode 100644
index 000000000000..bececb187641
--- /dev/null
+++ b/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll
@@ -0,0 +1,145 @@
+; RUN: llvm-as < %s | opt -lcssa -disable-output -verify-dom-info
+; PR977
+; END.
+declare i32 @opost_block()
+
+define void @write_chan() {
+entry:
+ br i1 false, label %shortcirc_next.0, label %shortcirc_done.0
+shortcirc_next.0: ; preds = %entry
+ br label %shortcirc_done.0
+shortcirc_done.0: ; preds = %shortcirc_next.0, %entry
+ br i1 false, label %shortcirc_next.1, label %shortcirc_done.1
+shortcirc_next.1: ; preds = %shortcirc_done.0
+ br label %shortcirc_done.1
+shortcirc_done.1: ; preds = %shortcirc_next.1, %shortcirc_done.0
+ br i1 false, label %then.0, label %endif.0
+then.0: ; preds = %shortcirc_done.1
+ br i1 false, label %then.1, label %endif.1
+then.1: ; preds = %then.0
+ br label %return
+after_ret.0: ; No predecessors!
+ br label %endif.1
+endif.1: ; preds = %after_ret.0, %then.0
+ br label %endif.0
+endif.0: ; preds = %endif.1, %shortcirc_done.1
+ br label %loopentry.0
+loopentry.0: ; preds = %endif.12, %endif.0
+ br i1 false, label %then.2, label %endif.2
+then.2: ; preds = %loopentry.0
+ br label %loopexit.0
+dead_block_after_break.0: ; No predecessors!
+ br label %endif.2
+endif.2: ; preds = %dead_block_after_break.0, %loopentry.0
+ br i1 false, label %shortcirc_done.2, label %shortcirc_next.2
+shortcirc_next.2: ; preds = %endif.2
+ br i1 false, label %shortcirc_next.3, label %shortcirc_done.3
+shortcirc_next.3: ; preds = %shortcirc_next.2
+ br label %shortcirc_done.3
+shortcirc_done.3: ; preds = %shortcirc_next.3, %shortcirc_next.2
+ br label %shortcirc_done.2
+shortcirc_done.2: ; preds = %shortcirc_done.3, %endif.2
+ br i1 false, label %then.3, label %endif.3
+then.3: ; preds = %shortcirc_done.2
+ br label %loopexit.0
+dead_block_after_break.1: ; No predecessors!
+ br label %endif.3
+endif.3: ; preds = %dead_block_after_break.1, %shortcirc_done.2
+ br i1 false, label %shortcirc_next.4, label %shortcirc_done.4
+shortcirc_next.4: ; preds = %endif.3
+ br label %shortcirc_done.4
+shortcirc_done.4: ; preds = %shortcirc_next.4, %endif.3
+ br i1 false, label %then.4, label %else
+then.4: ; preds = %shortcirc_done.4
+ br label %loopentry.1
+loopentry.1: ; preds = %endif.8, %then.4
+ br i1 false, label %no_exit, label %loopexit.1
+no_exit: ; preds = %loopentry.1
+ %tmp.94 = call i32 @opost_block( ) ; <i32> [#uses=1]
+ br i1 false, label %then.5, label %endif.5
+then.5: ; preds = %no_exit
+ br i1 false, label %then.6, label %endif.6
+then.6: ; preds = %then.5
+ br label %loopexit.1
+dead_block_after_break.2: ; No predecessors!
+ br label %endif.6
+endif.6: ; preds = %dead_block_after_break.2, %then.5
+ br label %break_out
+dead_block_after_goto.0: ; No predecessors!
+ br label %endif.5
+endif.5: ; preds = %dead_block_after_goto.0, %no_exit
+ br i1 false, label %then.7, label %endif.7
+then.7: ; preds = %endif.5
+ br label %loopexit.1
+dead_block_after_break.3: ; No predecessors!
+ br label %endif.7
+endif.7: ; preds = %dead_block_after_break.3, %endif.5
+ switch i32 1, label %switchexit [
+ i32 4, label %label.2
+ i32 2, label %label.1
+ i32 1, label %label.0
+ ]
+label.0: ; preds = %endif.7
+ br label %switchexit
+dead_block_after_break.4: ; No predecessors!
+ br label %label.1
+label.1: ; preds = %dead_block_after_break.4, %endif.7
+ br label %switchexit
+dead_block_after_break.5: ; No predecessors!
+ br label %label.2
+label.2: ; preds = %dead_block_after_break.5, %endif.7
+ br label %switchexit
+dead_block_after_break.6: ; No predecessors!
+ br label %switchexit
+switchexit: ; preds = %dead_block_after_break.6, %label.2, %label.1, %label.0, %endif.7
+ br i1 false, label %then.8, label %endif.8
+then.8: ; preds = %switchexit
+ br label %loopexit.1
+dead_block_after_break.7: ; No predecessors!
+ br label %endif.8
+endif.8: ; preds = %dead_block_after_break.7, %switchexit
+ br label %loopentry.1
+loopexit.1: ; preds = %then.8, %then.7, %then.6, %loopentry.1
+ br i1 false, label %then.9, label %endif.9
+then.9: ; preds = %loopexit.1
+ br label %endif.9
+endif.9: ; preds = %then.9, %loopexit.1
+ br label %endif.4
+else: ; preds = %shortcirc_done.4
+ br i1 false, label %then.10, label %endif.10
+then.10: ; preds = %else
+ br label %break_out
+dead_block_after_goto.1: ; No predecessors!
+ br label %endif.10
+endif.10: ; preds = %dead_block_after_goto.1, %else
+ br label %endif.4
+endif.4: ; preds = %endif.10, %endif.9
+ br i1 false, label %then.11, label %endif.11
+then.11: ; preds = %endif.4
+ br label %loopexit.0
+dead_block_after_break.8: ; No predecessors!
+ br label %endif.11
+endif.11: ; preds = %dead_block_after_break.8, %endif.4
+ br i1 false, label %then.12, label %endif.12
+then.12: ; preds = %endif.11
+ br label %loopexit.0
+dead_block_after_break.9: ; No predecessors!
+ br label %endif.12
+endif.12: ; preds = %dead_block_after_break.9, %endif.11
+ br label %loopentry.0
+loopexit.0: ; preds = %then.12, %then.11, %then.3, %then.2
+ br label %break_out
+break_out: ; preds = %loopexit.0, %then.10, %endif.6
+ %retval.3 = phi i32 [ 0, %loopexit.0 ], [ %tmp.94, %endif.6 ], [ 0, %then.10 ] ; <i32> [#uses=0]
+ br i1 false, label %cond_true, label %cond_false
+cond_true: ; preds = %break_out
+ br label %cond_continue
+cond_false: ; preds = %break_out
+ br label %cond_continue
+cond_continue: ; preds = %cond_false, %cond_true
+ br label %return
+after_ret.1: ; No predecessors!
+ br label %return
+return: ; preds = %after_ret.1, %cond_continue, %then.1
+ ret void
+}
diff --git a/test/Transforms/LCSSA/2006-10-31-UnreachableBlock.ll b/test/Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
new file mode 100644
index 000000000000..b02feb4103d2
--- /dev/null
+++ b/test/Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
@@ -0,0 +1,184 @@
+; RUN: llvm-as < %s | opt -lcssa -disable-output
+; PR977
+; END.
+
+define void @process_backlog() {
+entry:
+ br label %loopentry.preheader
+loopentry.preheader: ; preds = %dead_block_after_break, %entry
+ %work.0.ph = phi i32 [ %inc, %dead_block_after_break ], [ 0, %entry ] ; <i32> [#uses=0]
+ br label %loopentry
+loopentry: ; preds = %endif.1, %loopentry.preheader
+ br i1 false, label %then.i, label %loopentry.__skb_dequeue67.exit_crit_edge
+loopentry.__skb_dequeue67.exit_crit_edge: ; preds = %loopentry
+ br label %__skb_dequeue67.exit
+then.i: ; preds = %loopentry
+ br label %__skb_dequeue67.exit
+__skb_dequeue67.exit: ; preds = %then.i, %loopentry.__skb_dequeue67.exit_crit_edge
+ br i1 false, label %then.0, label %__skb_dequeue67.exit.endif.0_crit_edge
+__skb_dequeue67.exit.endif.0_crit_edge: ; preds = %__skb_dequeue67.exit
+ br label %endif.0
+then.0: ; preds = %__skb_dequeue67.exit
+ br label %job_done
+dead_block_after_goto: ; No predecessors!
+ unreachable
+endif.0: ; preds = %__skb_dequeue67.exit.endif.0_crit_edge
+ br i1 false, label %then.0.i, label %endif.0.endif.0.i_crit_edge
+endif.0.endif.0.i_crit_edge: ; preds = %endif.0
+ br label %endif.0.i
+then.0.i: ; preds = %endif.0
+ br label %endif.0.i
+endif.0.i: ; preds = %then.0.i, %endif.0.endif.0.i_crit_edge
+ br i1 false, label %then.i.i, label %endif.0.i.skb_bond.exit.i_crit_edge
+endif.0.i.skb_bond.exit.i_crit_edge: ; preds = %endif.0.i
+ br label %skb_bond.exit.i
+then.i.i: ; preds = %endif.0.i
+ br label %skb_bond.exit.i
+skb_bond.exit.i: ; preds = %then.i.i, %endif.0.i.skb_bond.exit.i_crit_edge
+ br label %loopentry.0.i
+loopentry.0.i: ; preds = %loopentry.0.i.backedge, %skb_bond.exit.i
+ br i1 false, label %loopentry.0.i.no_exit.0.i_crit_edge, label %loopentry.0.i.loopexit.0.i_crit_edge
+loopentry.0.i.loopexit.0.i_crit_edge: ; preds = %loopentry.0.i
+ br label %loopexit.0.i
+loopentry.0.i.no_exit.0.i_crit_edge: ; preds = %loopentry.0.i
+ br label %no_exit.0.i
+no_exit.0.i: ; preds = %then.3.i.no_exit.0.i_crit_edge, %loopentry.0.i.no_exit.0.i_crit_edge
+ br i1 false, label %no_exit.0.i.shortcirc_done.0.i_crit_edge, label %shortcirc_next.0.i
+no_exit.0.i.shortcirc_done.0.i_crit_edge: ; preds = %no_exit.0.i
+ br label %shortcirc_done.0.i
+shortcirc_next.0.i: ; preds = %no_exit.0.i
+ br label %shortcirc_done.0.i
+shortcirc_done.0.i: ; preds = %shortcirc_next.0.i, %no_exit.0.i.shortcirc_done.0.i_crit_edge
+ br i1 false, label %then.1.i, label %endif.1.i
+then.1.i: ; preds = %shortcirc_done.0.i
+ br i1 false, label %then.2.i, label %then.1.i.endif.2.i_crit_edge
+then.1.i.endif.2.i_crit_edge: ; preds = %then.1.i
+ br label %endif.2.i
+then.2.i: ; preds = %then.1.i
+ br i1 false, label %then.3.i, label %else.0.i
+then.3.i: ; preds = %then.2.i
+ br i1 false, label %then.3.i.no_exit.0.i_crit_edge, label %then.3.i.loopexit.0.i_crit_edge
+then.3.i.loopexit.0.i_crit_edge: ; preds = %then.3.i
+ br label %loopexit.0.i
+then.3.i.no_exit.0.i_crit_edge: ; preds = %then.3.i
+ br label %no_exit.0.i
+else.0.i: ; preds = %then.2.i
+ br label %endif.2.i
+endif.3.i: ; No predecessors!
+ unreachable
+endif.2.i: ; preds = %else.0.i, %then.1.i.endif.2.i_crit_edge
+ br label %loopentry.0.i.backedge
+endif.1.i: ; preds = %shortcirc_done.0.i
+ br label %loopentry.0.i.backedge
+loopentry.0.i.backedge: ; preds = %endif.1.i, %endif.2.i
+ br label %loopentry.0.i
+loopexit.0.i: ; preds = %then.3.i.loopexit.0.i_crit_edge, %loopentry.0.i.loopexit.0.i_crit_edge
+ br label %loopentry.1.i
+loopentry.1.i: ; preds = %loopentry.1.i.backedge, %loopexit.0.i
+ br i1 false, label %loopentry.1.i.no_exit.1.i_crit_edge, label %loopentry.1.i.loopexit.1.i_crit_edge
+loopentry.1.i.loopexit.1.i_crit_edge: ; preds = %loopentry.1.i
+ br label %loopexit.1.i
+loopentry.1.i.no_exit.1.i_crit_edge: ; preds = %loopentry.1.i
+ br label %no_exit.1.i
+no_exit.1.i: ; preds = %then.6.i.no_exit.1.i_crit_edge, %loopentry.1.i.no_exit.1.i_crit_edge
+ br i1 false, label %shortcirc_next.1.i, label %no_exit.1.i.shortcirc_done.1.i_crit_edge
+no_exit.1.i.shortcirc_done.1.i_crit_edge: ; preds = %no_exit.1.i
+ br label %shortcirc_done.1.i
+shortcirc_next.1.i: ; preds = %no_exit.1.i
+ br i1 false, label %shortcirc_next.1.i.shortcirc_done.2.i_crit_edge, label %shortcirc_next.2.i
+shortcirc_next.1.i.shortcirc_done.2.i_crit_edge: ; preds = %shortcirc_next.1.i
+ br label %shortcirc_done.2.i
+shortcirc_next.2.i: ; preds = %shortcirc_next.1.i
+ br label %shortcirc_done.2.i
+shortcirc_done.2.i: ; preds = %shortcirc_next.2.i, %shortcirc_next.1.i.shortcirc_done.2.i_crit_edge
+ br label %shortcirc_done.1.i
+shortcirc_done.1.i: ; preds = %shortcirc_done.2.i, %no_exit.1.i.shortcirc_done.1.i_crit_edge
+ br i1 false, label %then.4.i, label %endif.4.i
+then.4.i: ; preds = %shortcirc_done.1.i
+ br i1 false, label %then.5.i, label %then.4.i.endif.5.i_crit_edge
+then.4.i.endif.5.i_crit_edge: ; preds = %then.4.i
+ br label %endif.5.i
+then.5.i: ; preds = %then.4.i
+ br i1 false, label %then.6.i, label %else.1.i
+then.6.i: ; preds = %then.5.i
+ br i1 false, label %then.6.i.no_exit.1.i_crit_edge, label %then.6.i.loopexit.1.i_crit_edge
+then.6.i.loopexit.1.i_crit_edge: ; preds = %then.6.i
+ br label %loopexit.1.i
+then.6.i.no_exit.1.i_crit_edge: ; preds = %then.6.i
+ br label %no_exit.1.i
+else.1.i: ; preds = %then.5.i
+ br label %endif.5.i
+endif.6.i: ; No predecessors!
+ unreachable
+endif.5.i: ; preds = %else.1.i, %then.4.i.endif.5.i_crit_edge
+ br label %loopentry.1.i.backedge
+endif.4.i: ; preds = %shortcirc_done.1.i
+ br label %loopentry.1.i.backedge
+loopentry.1.i.backedge: ; preds = %endif.4.i, %endif.5.i
+ br label %loopentry.1.i
+loopexit.1.i: ; preds = %then.6.i.loopexit.1.i_crit_edge, %loopentry.1.i.loopexit.1.i_crit_edge
+ br i1 false, label %then.7.i, label %else.2.i
+then.7.i: ; preds = %loopexit.1.i
+ br i1 false, label %then.8.i, label %else.3.i
+then.8.i: ; preds = %then.7.i
+ br label %netif_receive_skb.exit
+else.3.i: ; preds = %then.7.i
+ br label %netif_receive_skb.exit
+endif.8.i: ; No predecessors!
+ unreachable
+else.2.i: ; preds = %loopexit.1.i
+ br i1 false, label %else.2.i.shortcirc_done.i.i_crit_edge, label %shortcirc_next.i.i
+else.2.i.shortcirc_done.i.i_crit_edge: ; preds = %else.2.i
+ br label %shortcirc_done.i.i
+shortcirc_next.i.i: ; preds = %else.2.i
+ br label %shortcirc_done.i.i
+shortcirc_done.i.i: ; preds = %shortcirc_next.i.i, %else.2.i.shortcirc_done.i.i_crit_edge
+ br i1 false, label %then.i1.i, label %shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge
+shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge: ; preds = %shortcirc_done.i.i
+ br label %kfree_skb65.exit.i
+then.i1.i: ; preds = %shortcirc_done.i.i
+ br label %kfree_skb65.exit.i
+kfree_skb65.exit.i: ; preds = %then.i1.i, %shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge
+ br label %netif_receive_skb.exit
+netif_receive_skb.exit: ; preds = %kfree_skb65.exit.i, %else.3.i, %then.8.i
+ br i1 false, label %then.i1, label %netif_receive_skb.exit.dev_put69.exit_crit_edge
+netif_receive_skb.exit.dev_put69.exit_crit_edge: ; preds = %netif_receive_skb.exit
+ br label %dev_put69.exit
+then.i1: ; preds = %netif_receive_skb.exit
+ br label %dev_put69.exit
+dev_put69.exit: ; preds = %then.i1, %netif_receive_skb.exit.dev_put69.exit_crit_edge
+ %inc = add i32 0, 1 ; <i32> [#uses=1]
+ br i1 false, label %dev_put69.exit.shortcirc_done_crit_edge, label %shortcirc_next
+dev_put69.exit.shortcirc_done_crit_edge: ; preds = %dev_put69.exit
+ br label %shortcirc_done
+shortcirc_next: ; preds = %dev_put69.exit
+ br label %shortcirc_done
+shortcirc_done: ; preds = %shortcirc_next, %dev_put69.exit.shortcirc_done_crit_edge
+ br i1 false, label %then.1, label %endif.1
+then.1: ; preds = %shortcirc_done
+ ret void
+dead_block_after_break: ; No predecessors!
+ br label %loopentry.preheader
+endif.1: ; preds = %shortcirc_done
+ br label %loopentry
+loopexit: ; No predecessors!
+ unreachable
+after_ret.0: ; No predecessors!
+ br label %job_done
+job_done: ; preds = %after_ret.0, %then.0
+ br label %loopentry.i
+loopentry.i: ; preds = %no_exit.i, %job_done
+ br i1 false, label %no_exit.i, label %clear_bit62.exit
+no_exit.i: ; preds = %loopentry.i
+ br label %loopentry.i
+clear_bit62.exit: ; preds = %loopentry.i
+ br i1 false, label %then.2, label %endif.2
+then.2: ; preds = %clear_bit62.exit
+ ret void
+endif.2: ; preds = %clear_bit62.exit
+ ret void
+after_ret.1: ; No predecessors!
+ ret void
+return: ; No predecessors!
+ unreachable
+}
diff --git a/test/Transforms/LCSSA/2007-07-12-LICM-2.ll b/test/Transforms/LCSSA/2007-07-12-LICM-2.ll
new file mode 100644
index 000000000000..58bb19dc69c3
--- /dev/null
+++ b/test/Transforms/LCSSA/2007-07-12-LICM-2.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -loop-rotate -licm -loop-unswitch -disable-output
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ br label %bb7
+
+bb7: ; preds = %bb7, %entry
+ %tmp39 = load <4 x float>* null ; <<4 x float>> [#uses=1]
+ %tmp40 = add <4 x float> %tmp39, < float 2.000000e+00, float 3.000000e+00, float 1.000000e+00, float 0.000000e+00 > ; <<4 x float>> [#uses=1]
+ %tmp43 = add <4 x float> %tmp40, < float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 2.000000e+00 > ; <<4 x float>> [#uses=1]
+ %tmp46 = add <4 x float> %tmp43, < float 3.000000e+00, float 0.000000e+00, float 2.000000e+00, float 4.000000e+00 > ; <<4 x float>> [#uses=1]
+ %tmp49 = add <4 x float> %tmp46, < float 0.000000e+00, float 4.000000e+00, float 6.000000e+00, float 1.000000e+00 > ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp49, <4 x float>* null
+ br i1 false, label %bb7, label %bb56
+
+bb56: ; preds = %bb7
+ ret i32 0
+}
diff --git a/test/Transforms/LCSSA/2007-07-12-LICM-3.ll b/test/Transforms/LCSSA/2007-07-12-LICM-3.ll
new file mode 100644
index 000000000000..79370ee4340b
--- /dev/null
+++ b/test/Transforms/LCSSA/2007-07-12-LICM-3.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -loop-rotate -licm -loop-unswitch -disable-output
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ br label %bb
+
+bb: ; preds = %bb56, %entry
+ br label %bb7
+
+bb7: ; preds = %bb7, %bb
+ %tmp39 = load <4 x float>* null ; <<4 x float>> [#uses=1]
+ %tmp40 = add <4 x float> %tmp39, < float 2.000000e+00, float 3.000000e+00, float 1.000000e+00, float 0.000000e+00 > ; <<4 x float>> [#uses=1]
+ %tmp43 = add <4 x float> %tmp40, < float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 2.000000e+00 > ; <<4 x float>> [#uses=1]
+ %tmp46 = add <4 x float> %tmp43, < float 3.000000e+00, float 0.000000e+00, float 2.000000e+00, float 4.000000e+00 > ; <<4 x float>> [#uses=1]
+ %tmp49 = add <4 x float> %tmp46, < float 0.000000e+00, float 4.000000e+00, float 6.000000e+00, float 1.000000e+00 > ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp49, <4 x float>* null
+ br i1 false, label %bb7, label %bb56
+
+bb56: ; preds = %bb7
+ br i1 false, label %bb, label %bb64
+
+bb64: ; preds = %bb56
+ ret i32 0
+}
diff --git a/test/Transforms/LCSSA/2007-07-12-LICM.ll b/test/Transforms/LCSSA/2007-07-12-LICM.ll
new file mode 100644
index 000000000000..1c9830e03d9c
--- /dev/null
+++ b/test/Transforms/LCSSA/2007-07-12-LICM.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -loop-rotate -licm -loop-unswitch -disable-output
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ br label %bb7
+
+bb7: ; preds = %bb7, %entry
+ %tmp39 = load <4 x float>* null ; <<4 x float>> [#uses=1]
+ %tmp40 = add <4 x float> %tmp39, < float 2.000000e+00, float 3.000000e+00, float 1.000000e+00, float 0.000000e+00 > ; <<4 x float>> [#uses=0]
+ store <4 x float> zeroinitializer, <4 x float>* null
+ br i1 false, label %bb7, label %bb56
+
+bb56: ; preds = %bb7
+ ret i32 0
+}
diff --git a/test/Transforms/LCSSA/basictest.ll b/test/Transforms/LCSSA/basictest.ll
new file mode 100644
index 000000000000..090bde95d971
--- /dev/null
+++ b/test/Transforms/LCSSA/basictest.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
+; RUN: grep {X3.lcssa = phi i32}
+; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
+; RUN: grep {X4 = add i32 3, %X3.lcssa}
+
+define void @lcssa(i1 %S2) {
+entry:
+ br label %loop.interior
+loop.interior: ; preds = %post.if, %entry
+ br i1 %S2, label %if.true, label %if.false
+if.true: ; preds = %loop.interior
+ %X1 = add i32 0, 0 ; <i32> [#uses=1]
+ br label %post.if
+if.false: ; preds = %loop.interior
+ %X2 = add i32 0, 1 ; <i32> [#uses=1]
+ br label %post.if
+post.if: ; preds = %if.false, %if.true
+ %X3 = phi i32 [ %X1, %if.true ], [ %X2, %if.false ] ; <i32> [#uses=1]
+ br i1 %S2, label %loop.exit, label %loop.interior
+loop.exit: ; preds = %post.if
+ %X4 = add i32 3, %X3 ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LCSSA/dg.exp b/test/Transforms/LCSSA/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LCSSA/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LICM/2003-02-26-LoopExitNotDominated.ll b/test/Transforms/LICM/2003-02-26-LoopExitNotDominated.ll
new file mode 100644
index 000000000000..cf0520617938
--- /dev/null
+++ b/test/Transforms/LICM/2003-02-26-LoopExitNotDominated.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -basicaa -licm -disable-output
+
+;%MoveArray = external global [64 x ulong]
+
+define void @InitMoveArray() {
+bb3:
+ %X = alloca [2 x i64] ; <[2 x i64]*> [#uses=1]
+ br i1 false, label %bb13, label %bb4
+bb4: ; preds = %bb3
+ %reg3011 = getelementptr [2 x i64]* %X, i64 0, i64 0 ; <i64*> [#uses=1]
+ br label %bb8
+bb8: ; preds = %bb8, %bb4
+ store i64 0, i64* %reg3011
+ br i1 false, label %bb8, label %bb13
+bb13: ; preds = %bb8, %bb3
+ ret void
+}
+
diff --git a/test/Transforms/LICM/2003-02-27-NestedLoopExitBlocks.ll b/test/Transforms/LICM/2003-02-27-NestedLoopExitBlocks.ll
new file mode 100644
index 000000000000..bf209eaa479f
--- /dev/null
+++ b/test/Transforms/LICM/2003-02-27-NestedLoopExitBlocks.ll
@@ -0,0 +1,17 @@
+; Exit blocks need to be updated for all nested loops...
+
+; RUN: llvm-as < %s | opt -loopsimplify
+
+define i32 @yyparse() {
+bb0:
+ br i1 false, label %UnifiedExitNode, label %bb19
+bb19: ; preds = %bb28, %bb0
+ br i1 false, label %bb28, label %UnifiedExitNode
+bb28: ; preds = %bb32, %bb19
+ br i1 false, label %bb32, label %bb19
+bb32: ; preds = %bb28
+ br i1 false, label %UnifiedExitNode, label %bb28
+UnifiedExitNode: ; preds = %bb32, %bb19, %bb0
+ ret i32 0
+}
+
diff --git a/test/Transforms/LICM/2003-02-27-PreheaderExitNodeUpdate.ll b/test/Transforms/LICM/2003-02-27-PreheaderExitNodeUpdate.ll
new file mode 100644
index 000000000000..4b51a3be4b06
--- /dev/null
+++ b/test/Transforms/LICM/2003-02-27-PreheaderExitNodeUpdate.ll
@@ -0,0 +1,16 @@
+; This testcase fails because preheader insertion is not updating exit node
+; information for loops.
+
+; RUN: llvm-as < %s | opt -licm
+
+define i32 @main(i32 %argc, i8** %argv) {
+bb0:
+ br i1 false, label %bb7, label %bb5
+bb5: ; preds = %bb5, %bb0
+ br i1 false, label %bb5, label %bb7
+bb7: ; preds = %bb7, %bb5, %bb0
+ br i1 false, label %bb7, label %bb10
+bb10: ; preds = %bb7
+ ret i32 0
+}
+
diff --git a/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll b/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll
new file mode 100644
index 000000000000..18b86064ed04
--- /dev/null
+++ b/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll
@@ -0,0 +1,24 @@
+; Here we have a case where there are two loops and LICM is hoisting an
+; instruction from one loop into the other loop! This is obviously bad and
+; happens because preheader insertion doesn't insert a preheader for this
+; case... bad.
+
+; RUN: llvm-as < %s | opt -licm -loop-deletion -simplifycfg | llvm-dis | \
+; RUN: not grep {br }
+
+define i32 @main(i32 %argc) {
+; <label>:0
+ br label %bb5
+bb5: ; preds = %bb5, %0
+ %I = phi i32 [ 0, %0 ], [ %I2, %bb5 ] ; <i32> [#uses=1]
+ %I2 = add i32 %I, 1 ; <i32> [#uses=2]
+ %c = icmp eq i32 %I2, 10 ; <i1> [#uses=1]
+ br i1 %c, label %bb5, label %bb8
+bb8: ; preds = %bb8, %bb5
+ %cann-indvar = phi i32 [ 0, %bb8 ], [ 0, %bb5 ] ; <i32> [#uses=0]
+ %X = add i32 %argc, %argc ; <i32> [#uses=1]
+ br i1 false, label %bb8, label %bb10
+bb10: ; preds = %bb8
+ ret i32 %X
+}
+
diff --git a/test/Transforms/LICM/2003-02-27-StoreSinkPHIs.ll b/test/Transforms/LICM/2003-02-27-StoreSinkPHIs.ll
new file mode 100644
index 000000000000..7ce164ec237f
--- /dev/null
+++ b/test/Transforms/LICM/2003-02-27-StoreSinkPHIs.ll
@@ -0,0 +1,15 @@
+; LICM is adding stores before phi nodes. bad.
+
+; RUN: llvm-as < %s | opt -licm
+
+define i1 @test(i1 %c) {
+; <label>:0
+ br i1 %c, label %Loop, label %Out
+Loop: ; preds = %Loop, %0
+ store i32 0, i32* null
+ br i1 %c, label %Loop, label %Out
+Out: ; preds = %Loop, %0
+ %X = phi i1 [ %c, %0 ], [ true, %Loop ] ; <i1> [#uses=1]
+ ret i1 %X
+}
+
diff --git a/test/Transforms/LICM/2003-02-28-PromoteDifferentType.ll b/test/Transforms/LICM/2003-02-28-PromoteDifferentType.ll
new file mode 100644
index 000000000000..849ecd7cb1bb
--- /dev/null
+++ b/test/Transforms/LICM/2003-02-28-PromoteDifferentType.ll
@@ -0,0 +1,15 @@
+; Test that hoisting is disabled for pointers of different types...
+;
+; RUN: llvm-as < %s | opt -licm
+
+define void @test(i32* %P) {
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ store i32 5, i32* %P
+ %P2 = bitcast i32* %P to i8* ; <i8*> [#uses=1]
+ store i8 4, i8* %P2
+ br i1 true, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LICM/2003-05-02-LoadHoist.ll b/test/Transforms/LICM/2003-05-02-LoadHoist.ll
new file mode 100644
index 000000000000..7b58535972e5
--- /dev/null
+++ b/test/Transforms/LICM/2003-05-02-LoadHoist.ll
@@ -0,0 +1,23 @@
+; This testcase tests for a problem where LICM hoists loads out of a loop
+; despite the fact that calls to unknown functions may modify what is being
+; loaded from. Basically if the load gets hoisted, the subtract gets turned
+; into a constant zero.
+;
+; RUN: llvm-as < %s | opt -licm -gvn -instcombine | llvm-dis | grep load
+
+@X = global i32 7 ; <i32*> [#uses=2]
+
+declare void @foo()
+
+define i32 @test(i1 %c) {
+ %A = load i32* @X ; <i32> [#uses=1]
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ call void @foo( )
+ ;; Should not hoist this load!
+ %B = load i32* @X ; <i32> [#uses=1]
+ br i1 %c, label %Loop, label %Out
+Out: ; preds = %Loop
+ %C = sub i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
diff --git a/test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll b/test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll
new file mode 100644
index 000000000000..a00eb8c7a63c
--- /dev/null
+++ b/test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll
@@ -0,0 +1,26 @@
+; This testcase tests for a problem where LICM hoists
+; potentially trapping instructions when they are not guaranteed to execute.
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "IfUnEqual" 2 | grep div
+
+@X = global i32 0 ; <i32*> [#uses=1]
+
+declare void @foo()
+
+define i32 @test(i1 %c) {
+ %A = load i32* @X ; <i32> [#uses=2]
+ br label %Loop
+Loop: ; preds = %LoopTail, %0
+ call void @foo( )
+ br i1 %c, label %LoopTail, label %IfUnEqual
+IfUnEqual: ; preds = %Loop
+ %B1 = sdiv i32 4, %A ; <i32> [#uses=1]
+ br label %LoopTail
+LoopTail: ; preds = %IfUnEqual, %Loop
+ %B = phi i32 [ 0, %Loop ], [ %B1, %IfUnEqual ] ; <i32> [#uses=1]
+ br i1 %c, label %Loop, label %Out
+Out: ; preds = %LoopTail
+ %C = sub i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
+
diff --git a/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll b/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll
new file mode 100644
index 000000000000..59cc0d662071
--- /dev/null
+++ b/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll
@@ -0,0 +1,21 @@
+; This testcase tests to make sure a trapping instruction is hoisted when
+; it is guaranteed to execute.
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "test" 2 | grep div
+
+@X = global i32 0 ; <i32*> [#uses=1]
+
+declare void @foo(i32)
+
+define i32 @test(i1 %c) {
+ %A = load i32* @X ; <i32> [#uses=2]
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ ;; Should have hoisted this div!
+ %B = sdiv i32 4, %A ; <i32> [#uses=2]
+ call void @foo( i32 %B )
+ br i1 %c, label %Loop, label %Out
+Out: ; preds = %Loop
+ %C = sub i32 %A, %B ; <i32> [#uses=1]
+ ret i32 %C
+}
diff --git a/test/Transforms/LICM/2003-12-11-SinkingToPHI.ll b/test/Transforms/LICM/2003-12-11-SinkingToPHI.ll
new file mode 100644
index 000000000000..e491c9aee479
--- /dev/null
+++ b/test/Transforms/LICM/2003-12-11-SinkingToPHI.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -licm | lli
+
+define i32 @main() {
+entry:
+ br label %Loop
+Loop: ; preds = %LoopCont, %entry
+ br i1 true, label %LoopCont, label %Out
+LoopCont: ; preds = %Loop
+ %X = add i32 1, 0 ; <i32> [#uses=1]
+ br i1 true, label %Out, label %Loop
+Out: ; preds = %LoopCont, %Loop
+ %V = phi i32 [ 2, %Loop ], [ %X, %LoopCont ] ; <i32> [#uses=1]
+ %V2 = sub i32 %V, 1 ; <i32> [#uses=1]
+ ret i32 %V2
+}
+
diff --git a/test/Transforms/LICM/2003-12-13-VolatilePromote.ll b/test/Transforms/LICM/2003-12-13-VolatilePromote.ll
new file mode 100644
index 000000000000..85c93c62bf5c
--- /dev/null
+++ b/test/Transforms/LICM/2003-12-13-VolatilePromote.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext volatile 1 | grep Loop
+
+@X = global i32 7 ; <i32*> [#uses=2]
+
+define void @testfunc(i32 %i) {
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ ; Should not promote this to a register
+ %x = volatile load i32* @X ; <i32> [#uses=1]
+ %x2 = add i32 %x, 1 ; <i32> [#uses=1]
+ store i32 %x2, i32* @X
+ br i1 true, label %Out, label %Loop
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.ll b/test/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.ll
new file mode 100644
index 000000000000..b9c9eb373999
--- /dev/null
+++ b/test/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -globalsmodref-aa -licm -disable-output
+
+@PL_regcomp_parse = internal global i8* null ; <i8**> [#uses=2]
+
+define void @test() {
+ br label %Outer
+Outer: ; preds = %Next, %0
+ br label %Inner
+Inner: ; preds = %Inner, %Outer
+ %tmp.114.i.i.i = load i8** @PL_regcomp_parse ; <i8*> [#uses=1]
+ %tmp.115.i.i.i = load i8* %tmp.114.i.i.i ; <i8> [#uses=0]
+ store i8* null, i8** @PL_regcomp_parse
+ br i1 false, label %Inner, label %Next
+Next: ; preds = %Inner
+ br i1 false, label %Outer, label %Exit
+Exit: ; preds = %Next
+ ret void
+}
+
diff --git a/test/Transforms/LICM/2004-11-17-UndefIndexCrash.ll b/test/Transforms/LICM/2004-11-17-UndefIndexCrash.ll
new file mode 100644
index 000000000000..9a53d95996a7
--- /dev/null
+++ b/test/Transforms/LICM/2004-11-17-UndefIndexCrash.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -licm -disable-output
+ %struct.roadlet = type { i8*, %struct.vehicle*, [8 x %struct.roadlet*], [8 x %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)*] }
+ %struct.vehicle = type { %struct.roadlet*, i8*, i32, i32, %union.._631., i32 }
+ %union.._631. = type { i32 }
+
+declare %struct.roadlet* @_Z11return_nullP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, i32)
+
+declare %struct.roadlet* @_Z14lane_switch_okP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, i32)
+
+define void @main() {
+__main.entry:
+ br label %invoke_cont.3
+invoke_cont.3: ; preds = %invoke_cont.3, %__main.entry
+ %tmp.34.i.i502.7 = getelementptr %struct.roadlet* null, i32 0, i32 3, i32 7 ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)**> [#uses=1]
+ store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** %tmp.34.i.i502.7
+ store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z14lane_switch_okP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** null
+ %tmp.4.i.i339 = getelementptr %struct.roadlet* null, i32 0, i32 3, i32 undef ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)**> [#uses=1]
+ store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** %tmp.4.i.i339
+ br label %invoke_cont.3
+}
diff --git a/test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll b/test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll
new file mode 100644
index 000000000000..b001cd0d5cd2
--- /dev/null
+++ b/test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -licm -disable-output
+
+define void @test({ i32 }* %P) {
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ free { i32 }* %P
+ br label %Loop
+}
+
diff --git a/test/Transforms/LICM/2006-09-12-DeadUserOfSunkInstr.ll b/test/Transforms/LICM/2006-09-12-DeadUserOfSunkInstr.ll
new file mode 100644
index 000000000000..c2c4bcb4ab0b
--- /dev/null
+++ b/test/Transforms/LICM/2006-09-12-DeadUserOfSunkInstr.ll
@@ -0,0 +1,148 @@
+; RUN: llvm-as < %s | opt -licm -disable-output
+; PR908
+; END.
+
+ %struct.alloc_chain = type { i8*, %struct.alloc_chain* }
+ %struct.oggpack_buffer = type { i32, i32, i8*, i8*, i32 }
+ %struct.vorbis_block = type { float**, %struct.oggpack_buffer, i32, i32, i32, i32, i32, i32, i64, i64, %struct.vorbis_dsp_state*, i8*, i32, i32, i32, %struct.alloc_chain*, i32, i32, i32, i32, i8* }
+ %struct.vorbis_dsp_state = type { i32, %struct.vorbis_info*, float**, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
+ %struct.vorbis_info = type { i32, i32, i32, i32, i32, i32, i32, i8* }
+
+define fastcc void @_01forward() {
+entry:
+ br i1 false, label %bb222.preheader, label %bb241
+cond_true67: ; preds = %cond_true87
+ br label %cond_next80
+cond_next80: ; preds = %cond_true87, %cond_true67
+ br label %bb83
+bb83.preheader: ; preds = %cond_true226
+ br i1 false, label %bb83.us.preheader, label %bb83.preheader1
+bb83.us.preheader: ; preds = %bb83.preheader
+ br label %bb83.us
+bb83.us: ; preds = %cond_next80.us, %bb83.us.preheader
+ br i1 false, label %cond_true87.us, label %cond_next92.loopexit2
+cond_next80.us: ; preds = %bb59.loopexit.us, %cond_true67.us
+ br label %bb83.us
+cond_true67.us: ; preds = %bb59.loopexit.us
+ br label %cond_next80.us
+cond_next.us: ; preds = %cond_true56.us, %cond_true38.us
+ br i1 false, label %cond_true56.us, label %bb59.loopexit.us
+cond_true38.us: ; preds = %cond_true56.us
+ br label %cond_next.us
+cond_true56.us: ; preds = %cond_true87.us, %cond_next.us
+ br i1 false, label %cond_true38.us, label %cond_next.us
+cond_true87.us: ; preds = %bb83.us
+ br label %cond_true56.us
+bb59.loopexit.us: ; preds = %cond_next.us
+ br i1 false, label %cond_true67.us, label %cond_next80.us
+bb83.preheader1: ; preds = %bb83.preheader
+ br label %bb83
+bb83: ; preds = %bb83.preheader1, %cond_next80
+ br i1 false, label %cond_next92.loopexit, label %cond_true87
+cond_true87: ; preds = %bb83
+ br i1 false, label %cond_true67, label %cond_next80
+cond_next92.loopexit: ; preds = %bb83
+ br label %cond_next92
+cond_next92.loopexit2: ; preds = %bb83.us
+ br label %cond_next92
+cond_next92: ; preds = %cond_true226, %cond_next92.loopexit2, %cond_next92.loopexit
+ br i1 false, label %cond_true218.loopexit, label %bb222
+cond_true139: ; preds = %cond_true202
+ br i1 false, label %cond_next195, label %cond_true155
+cond_true155: ; preds = %cond_true139
+ br i1 false, label %cond_true249.i.preheader, label %_encodepart.exit
+cond_true.i: ; preds = %cond_true115.i
+ br i1 false, label %bb60.i.preheader, label %cond_next97.i
+bb60.i.preheader: ; preds = %cond_true.i
+ br label %bb60.i
+bb60.i: ; preds = %cond_true63.i, %bb60.i.preheader
+ br i1 false, label %cond_true63.i, label %cond_next97.i.loopexit
+cond_true63.i: ; preds = %bb60.i
+ br i1 false, label %bb60.i, label %cond_next97.i.loopexit
+bb86.i.preheader: ; preds = %cond_true115.i
+ br label %bb86.i
+bb86.i: ; preds = %cond_true93.i, %bb86.i.preheader
+ br i1 false, label %cond_true93.i, label %cond_next97.i.loopexit3
+cond_true93.i: ; preds = %bb86.i
+ br i1 false, label %cond_next97.i.loopexit3, label %bb86.i
+cond_next97.i.loopexit: ; preds = %cond_true63.i, %bb60.i
+ br label %cond_next97.i
+cond_next97.i.loopexit3: ; preds = %cond_true93.i, %bb86.i
+ br label %cond_next97.i
+cond_next97.i: ; preds = %cond_next97.i.loopexit3, %cond_next97.i.loopexit, %cond_true.i
+ br i1 false, label %bb118.i.loopexit, label %cond_true115.i
+cond_true115.i.preheader: ; preds = %cond_true249.i
+ br label %cond_true115.i
+cond_true115.i: ; preds = %cond_true115.i.preheader, %cond_next97.i
+ br i1 false, label %cond_true.i, label %bb86.i.preheader
+bb118.i.loopexit: ; preds = %cond_next97.i
+ br label %bb118.i
+bb118.i: ; preds = %cond_true249.i, %bb118.i.loopexit
+ br i1 false, label %cond_next204.i, label %cond_true128.i
+cond_true128.i: ; preds = %bb118.i
+ br i1 false, label %cond_true199.i.preheader, label %cond_next204.i
+cond_true199.i.preheader: ; preds = %cond_true128.i
+ br label %cond_true199.i
+cond_true199.i.us: ; No predecessors!
+ br i1 false, label %cond_true167.i.us, label %cond_next187.i.us
+cond_next187.i.us: ; preds = %bb170.i.loopexit.us, %bb170.i.us.cond_next187.i.us_crit_edge, %cond_true199.i.us
+ unreachable
+bb170.i.us.cond_next187.i.us_crit_edge: ; preds = %bb170.i.loopexit.us
+ br label %cond_next187.i.us
+cond_true167.i.us: ; preds = %cond_true167.i.us, %cond_true199.i.us
+ br i1 false, label %cond_true167.i.us, label %bb170.i.loopexit.us
+bb170.i.loopexit.us: ; preds = %cond_true167.i.us
+ br i1 false, label %cond_next187.i.us, label %bb170.i.us.cond_next187.i.us_crit_edge
+cond_true199.i: ; preds = %cond_true199.i, %cond_true199.i.preheader
+ br i1 false, label %cond_next204.i.loopexit, label %cond_true199.i
+cond_next204.i.loopexit: ; preds = %cond_true199.i
+ br label %cond_next204.i
+cond_next204.i: ; preds = %cond_next204.i.loopexit, %cond_true128.i, %bb118.i
+ br label %bb233.i
+cond_true230.i: ; No predecessors!
+ %exitcond155 = icmp eq i32 0, %tmp16.i ; <i1> [#uses=0]
+ unreachable
+bb233.i: ; preds = %cond_next204.i
+ br i1 false, label %_encodepart.exit.loopexit, label %cond_true249.i
+cond_true249.i.preheader: ; preds = %cond_true155
+ br label %cond_true249.i
+cond_true249.i: ; preds = %cond_true249.i.preheader, %bb233.i
+ %tmp16.i = bitcast i32 0 to i32 ; <i32> [#uses=1]
+ br i1 false, label %cond_true115.i.preheader, label %bb118.i
+_encodepart.exit.loopexit: ; preds = %bb233.i
+ br label %_encodepart.exit
+_encodepart.exit: ; preds = %_encodepart.exit.loopexit, %cond_true155
+ br label %cond_next195
+cond_next195: ; preds = %cond_true202, %_encodepart.exit, %cond_true139
+ br i1 false, label %bb205.loopexit, label %cond_true202
+cond_true202.preheader: ; preds = %cond_true218
+ br label %cond_true202
+cond_true202: ; preds = %cond_true202.preheader, %cond_next195
+ br i1 false, label %cond_next195, label %cond_true139
+bb205.loopexit: ; preds = %cond_next195
+ br label %bb205
+bb205: ; preds = %cond_true218, %bb205.loopexit
+ br i1 false, label %cond_true218, label %bb222.outer105.loopexit
+cond_true218.loopexit: ; preds = %cond_next92
+ br label %cond_true218
+cond_true218: ; preds = %cond_true218.loopexit, %bb205
+ br i1 false, label %cond_true202.preheader, label %bb205
+bb222.preheader: ; preds = %entry
+ br label %bb222.outer
+bb222.outer: ; preds = %bb229, %bb222.preheader
+ br label %bb222.outer105
+bb222.outer105.loopexit: ; preds = %bb205
+ br label %bb222.outer105
+bb222.outer105: ; preds = %bb222.outer105.loopexit, %bb222.outer
+ br label %bb222
+bb222: ; preds = %bb222.outer105, %cond_next92
+ br i1 false, label %cond_true226, label %bb229
+cond_true226: ; preds = %bb222
+ br i1 false, label %bb83.preheader, label %cond_next92
+bb229: ; preds = %bb222
+ br i1 false, label %bb222.outer, label %bb241.loopexit
+bb241.loopexit: ; preds = %bb229
+ br label %bb241
+bb241: ; preds = %bb241.loopexit, %entry
+ ret void
+}
diff --git a/test/Transforms/LICM/2007-05-22-VolatileSink.ll b/test/Transforms/LICM/2007-05-22-VolatileSink.ll
new file mode 100644
index 000000000000..bf5d7bc09297
--- /dev/null
+++ b/test/Transforms/LICM/2007-05-22-VolatileSink.ll
@@ -0,0 +1,56 @@
+; RUN: llvm-as < %s | opt -licm | llvm-dis | grep {volatile store}
+; PR1435
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+
+define void @Transpose(i32* %DataIn, i32* %DataOut) {
+entry:
+ %buffer = alloca [64 x i32], align 16 ; <[64 x i32]*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ br label %bb6
+
+bb: ; preds = %bb6
+ %tmp2 = volatile load i32* %DataIn ; <i32> [#uses=1]
+ %tmp3 = getelementptr [64 x i32]* %buffer, i32 0, i32 %i.0 ; <i32*> [#uses=1]
+ store i32 %tmp2, i32* %tmp3
+ %tmp5 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb6
+
+bb6: ; preds = %bb, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %tmp5, %bb ] ; <i32> [#uses=3]
+ %tmp8 = icmp sle i32 %i.0, 63 ; <i1> [#uses=1]
+ %tmp89 = zext i1 %tmp8 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp89, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb, label %bb30
+
+bb12: ; preds = %bb22
+ %tmp14 = mul i32 %j.1, 8 ; <i32> [#uses=1]
+ %tmp16 = add i32 %tmp14, %i.1 ; <i32> [#uses=1]
+ %tmp17 = getelementptr [64 x i32]* %buffer, i32 0, i32 %tmp16 ; <i32*> [#uses=1]
+ %tmp18 = load i32* %tmp17 ; <i32> [#uses=1]
+ volatile store i32 %tmp18, i32* %DataOut
+ %tmp21 = add i32 %j.1, 1 ; <i32> [#uses=1]
+ br label %bb22
+
+bb22: ; preds = %bb30, %bb12
+ %j.1 = phi i32 [ %tmp21, %bb12 ], [ 0, %bb30 ] ; <i32> [#uses=4]
+ %tmp24 = icmp sle i32 %j.1, 7 ; <i1> [#uses=1]
+ %tmp2425 = zext i1 %tmp24 to i8 ; <i8> [#uses=1]
+ %toBool26 = icmp ne i8 %tmp2425, 0 ; <i1> [#uses=1]
+ br i1 %toBool26, label %bb12, label %bb27
+
+bb27: ; preds = %bb22
+ %tmp29 = add i32 %i.1, 1 ; <i32> [#uses=1]
+ br label %bb30
+
+bb30: ; preds = %bb27, %bb6
+ %j.0 = phi i32 [ %j.1, %bb27 ], [ undef, %bb6 ] ; <i32> [#uses=0]
+ %i.1 = phi i32 [ %tmp29, %bb27 ], [ 0, %bb6 ] ; <i32> [#uses=3]
+ %tmp32 = icmp sle i32 %i.1, 7 ; <i1> [#uses=1]
+ %tmp3233 = zext i1 %tmp32 to i8 ; <i8> [#uses=1]
+ %toBool34 = icmp ne i8 %tmp3233, 0 ; <i1> [#uses=1]
+ br i1 %toBool34, label %bb22, label %return
+
+return: ; preds = %bb30
+ ret void
+}
diff --git a/test/Transforms/LICM/2007-07-30-AliasSet.ll b/test/Transforms/LICM/2007-07-30-AliasSet.ll
new file mode 100644
index 000000000000..110d88449464
--- /dev/null
+++ b/test/Transforms/LICM/2007-07-30-AliasSet.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -licm -loop-unswitch -disable-output
+ %struct.III_scalefac_t = type { [22 x i32], [13 x [3 x i32]] }
+ %struct.gr_info = type { i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, [4 x i32] }
+
+define i32 @scale_bitcount_lsf(%struct.III_scalefac_t* %scalefac, %struct.gr_info* %cod_info) {
+entry:
+ br i1 false, label %bb28, label %bb133.preheader
+
+bb133.preheader: ; preds = %entry
+ ret i32 0
+
+bb28: ; preds = %entry
+ br i1 false, label %bb63.outer, label %bb79
+
+bb63.outer: ; preds = %bb73, %bb28
+ br i1 false, label %bb35, label %bb73
+
+bb35: ; preds = %cond_next60, %bb63.outer
+ %window.34 = phi i32 [ %tmp62, %cond_next60 ], [ 0, %bb63.outer ] ; <i32> [#uses=1]
+ %tmp44 = getelementptr [4 x i32]* null, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp46 = load i32* %tmp44, align 4 ; <i32> [#uses=0]
+ br i1 false, label %cond_true50, label %cond_next60
+
+cond_true50: ; preds = %bb35
+ %tmp59 = getelementptr [4 x i32]* null, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp59, align 4
+ br label %cond_next60
+
+cond_next60: ; preds = %cond_true50, %bb35
+ %tmp62 = add i32 %window.34, 1 ; <i32> [#uses=1]
+ br i1 false, label %bb35, label %bb73
+
+bb73: ; preds = %cond_next60, %bb63.outer
+ %tmp76 = icmp slt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp76, label %bb63.outer, label %bb79
+
+bb79: ; preds = %bb73, %bb28
+ ret i32 0
+}
diff --git a/test/Transforms/LICM/2007-09-17-PromoteValue.ll b/test/Transforms/LICM/2007-09-17-PromoteValue.ll
new file mode 100644
index 000000000000..e9ba9e16318f
--- /dev/null
+++ b/test/Transforms/LICM/2007-09-17-PromoteValue.ll
@@ -0,0 +1,61 @@
+; ModuleID = 'PR1657.bc'
+; Do not promote getelementptr because it may exposes load from a null pointer
+; and store from a null pointer which are covered by
+; icmp eq %struct.decision* null, null condition.
+; RUN: llvm-as < %s | opt -licm | llvm-dis | not grep promoted
+ %struct.decision = type { i8, %struct.decision* }
+
+define i32 @main() {
+entry:
+ br label %blah.i
+
+blah.i: ; preds = %cond_true.i, %entry
+ %tmp3.i = icmp eq %struct.decision* null, null ; <i1> [#uses=1]
+ br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i
+
+cond_true.i: ; preds = %blah.i
+ %tmp1.i = getelementptr %struct.decision* null, i32 0, i32 0 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp1.i
+ br label %blah.i
+
+clear_modes.exit: ; preds = %blah.i
+ call void @exit( i32 0 )
+ unreachable
+}
+
+define i32 @f(i8* %ptr) {
+entry:
+ br label %loop.head
+
+loop.head: ; preds = %cond.true, %entry
+ %x = phi i8* [ %ptr, %entry ], [ %ptr.i, %cond.true ] ; <i8*> [#uses=1]
+ %tmp3.i = icmp ne i8* %ptr, %x ; <i1> [#uses=1]
+ br i1 %tmp3.i, label %cond.true, label %exit
+
+cond.true: ; preds = %loop.head
+ %ptr.i = getelementptr i8* %ptr, i32 0 ; <i8*> [#uses=2]
+ store i8 0, i8* %ptr.i
+ br label %loop.head
+
+exit: ; preds = %loop.head
+ ret i32 0
+}
+
+define i32 @f2(i8* %p, i8* %q) {
+entry:
+ br label %loop.head
+
+loop.head: ; preds = %cond.true, %entry
+ %tmp3.i = icmp eq i8* null, %q ; <i1> [#uses=1]
+ br i1 %tmp3.i, label %exit, label %cond.true
+
+cond.true: ; preds = %loop.head
+ %ptr.i = getelementptr i8* %p, i32 0 ; <i8*> [#uses=2]
+ store i8 0, i8* %ptr.i
+ br label %loop.head
+
+exit: ; preds = %loop.head
+ ret i32 0
+}
+
+declare void @exit(i32)
diff --git a/test/Transforms/LICM/2007-09-24-PromoteNullValue.ll b/test/Transforms/LICM/2007-09-24-PromoteNullValue.ll
new file mode 100644
index 000000000000..f9f45f389b8a
--- /dev/null
+++ b/test/Transforms/LICM/2007-09-24-PromoteNullValue.ll
@@ -0,0 +1,46 @@
+; Do not promote null value because it may be unsafe to do so.
+; RUN: llvm-as < %s | opt -licm | llvm-dis | not grep promoted
+
+define i32 @f(i32 %foo, i32 %bar, i32 %com) {
+entry:
+ %tmp2 = icmp eq i32 %foo, 0 ; <i1> [#uses=1]
+ br i1 %tmp2, label %cond_next, label %cond_true
+
+cond_true: ; preds = %entry
+ br label %return
+
+cond_next: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb15, %cond_next
+ switch i32 %bar, label %bb15 [
+ i32 1, label %bb6
+ ]
+
+bb6: ; preds = %bb
+ %tmp8 = icmp eq i32 %com, 0 ; <i1> [#uses=1]
+ br i1 %tmp8, label %cond_next14, label %cond_true11
+
+cond_true11: ; preds = %bb6
+ br label %return
+
+cond_next14: ; preds = %bb6
+ store i8 0, i8* null
+ br label %bb15
+
+bb15: ; preds = %cond_next14, %bb
+ br label %bb
+
+return: ; preds = %cond_true11, %cond_true
+ %storemerge = phi i32 [ 0, %cond_true ], [ undef, %cond_true11 ] ; <i32> [#uses=1]
+ ret i32 %storemerge
+}
+
+define i32 @kdMain() {
+entry:
+ %tmp1 = call i32 @f( i32 0, i32 1, i32 1 ) ; <i32> [#uses=0]
+ call void @exit( i32 0 )
+ unreachable
+}
+
+declare void @exit(i32)
diff --git a/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll b/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll
new file mode 100644
index 000000000000..7359cc0695ad
--- /dev/null
+++ b/test/Transforms/LICM/2007-10-01-PromoteSafeValue.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -licm | llvm-dis | grep promoted
+; Promote value if at least one use is safe
+
+
+define i32 @f2(i32* %p, i8* %q) {
+entry:
+ br label %loop.head
+
+loop.head: ; preds = %cond.true, %entry
+ store i32 20, i32* %p
+ %tmp3.i = icmp eq i8* null, %q ; <i1> [#uses=1]
+ br i1 %tmp3.i, label %exit, label %cond.true
+
+cond.true: ; preds = %loop.head
+ store i32 40, i32* %p
+ br label %loop.head
+
+exit: ; preds = %loop.head
+ ret i32 0
+}
+
diff --git a/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll b/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll
new file mode 100644
index 000000000000..dcb20e7bbd0c
--- /dev/null
+++ b/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -licm -disable-output
+; PR2346
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-pc-linux-gnu"
+ %struct._zval_struct = type { %union._double, i32, i8, i8, i8, i8 }
+ %union._double = type { double }
+
+define i8* @zend_fetch_resource(%struct._zval_struct** %passed_id, i32 %default_id, i8* %resource_type_name, i32* %found_resource_type, i32 %num_resource_types, ...) {
+entry:
+ br label %whilebody.i.i
+
+whilebody.i.i: ; preds = %whilebody.i.i, %entry
+ br i1 false, label %ifthen.i.i, label %whilebody.i.i
+
+ifthen.i.i: ; preds = %whilebody.i.i
+ br label %forcond
+
+forcond: ; preds = %forbody, %ifthen.i.i
+ br i1 false, label %forbody, label %afterfor
+
+forbody: ; preds = %forcond
+ va_arg i8** null, i32 ; <i32>:0 [#uses=0]
+ br i1 false, label %ifthen59, label %forcond
+
+ifthen59: ; preds = %forbody
+ unreachable
+
+afterfor: ; preds = %forcond
+ ret i8* null
+}
diff --git a/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll b/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll
new file mode 100644
index 000000000000..3824d5359772
--- /dev/null
+++ b/test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -licm -enable-licm-constant-variables | llvm-dis | grep -A 1 entry | grep load.*@a
+@a = external constant float*
+
+define void @test(i32 %count) {
+entry:
+ br label %forcond
+
+forcond:
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ]
+ %cmp = icmp ult i32 %i.0, %count
+ br i1 %cmp, label %forbody, label %afterfor
+
+forbody:
+ %tmp3 = load float** @a
+ %arrayidx = getelementptr float* %tmp3, i32 %i.0
+ %tmp7 = uitofp i32 %i.0 to float
+ store float %tmp7, float* %arrayidx
+ %inc = add i32 %i.0, 1
+ br label %forcond
+
+afterfor:
+ ret void
+}
diff --git a/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll b/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll
new file mode 100644
index 000000000000..c3c9a810c52c
--- /dev/null
+++ b/test/Transforms/LICM/2009-03-25-AliasSetTracker.ll
@@ -0,0 +1,39 @@
+
+; RUN: llvm-as < %s | opt -licm -loop-index-split -instcombine -disable-output
+
+ %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
+@"\01LC81" = external constant [4 x i8] ; <[4 x i8]*> [#uses=1]
+
+define fastcc void @hex_dump_internal(i8* %avcl, %struct.FILE* %f, i32 %level, i8* nocapture %buf, i32 %size) nounwind {
+entry:
+ br i1 false, label %bb4, label %return
+
+bb4: ; preds = %bb30, %entry
+ br label %bb6
+
+bb6: ; preds = %bb15, %bb4
+ %j.0.reg2mem.0 = phi i32 [ %2, %bb15 ], [ 0, %bb4 ] ; <i32> [#uses=2]
+ %0 = icmp slt i32 %j.0.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb7, label %bb13
+
+bb7: ; preds = %bb6
+ br label %bb15
+
+bb13: ; preds = %bb6
+ %1 = tail call i32 @fwrite(i8* getelementptr ([4 x i8]* @"\01LC81", i32 0, i32 0), i32 1, i32 3, i8* null) nounwind ; <i32> [#uses=0]
+ br label %bb15
+
+bb15: ; preds = %bb13, %bb7
+ %2 = add i32 %j.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %3 = icmp sgt i32 %2, 15 ; <i1> [#uses=1]
+ br i1 %3, label %bb30, label %bb6
+
+bb30: ; preds = %bb15
+ br i1 false, label %bb4, label %return
+
+return: ; preds = %bb30, %entry
+ ret void
+}
+
+declare i32 @fwrite(i8* nocapture, i32, i32, i8* nocapture) nounwind
diff --git a/test/Transforms/LICM/Preserve-LCSSA.ll b/test/Transforms/LICM/Preserve-LCSSA.ll
new file mode 100644
index 000000000000..850d071810ef
--- /dev/null
+++ b/test/Transforms/LICM/Preserve-LCSSA.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -loop-rotate -licm -loop-unswitch -disable-output
+
+define i32 @stringSearch_Clib(i32 %count) {
+entry:
+ br i1 false, label %bb36, label %bb44
+
+bb4: ; preds = %bb36
+ br i1 false, label %cond_next, label %cond_true
+
+cond_true: ; preds = %bb4
+ ret i32 0
+
+cond_next: ; preds = %bb4
+ ret i32 0
+
+bb36: ; preds = %bb41, %entry
+ br i1 false, label %bb4, label %bb41
+
+bb41: ; preds = %bb36
+ %ttmp2 = icmp slt i32 0, %count ; <i1> [#uses=1]
+ br i1 %ttmp2, label %bb36, label %bb44
+
+bb44: ; preds = %bb41, %entry
+ ret i32 0
+}
diff --git a/test/Transforms/LICM/basictest.ll b/test/Transforms/LICM/basictest.ll
new file mode 100644
index 000000000000..0a57ce4539fe
--- /dev/null
+++ b/test/Transforms/LICM/basictest.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -licm | llvm-dis
+
+define void @testfunc(i32 %i) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %j = phi i32 [ 0, %0 ], [ %Next, %Loop ] ; <i32> [#uses=1]
+ %i2 = mul i32 %i, 17 ; <i32> [#uses=1]
+ %Next = add i32 %j, %i2 ; <i32> [#uses=2]
+ %cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
+ br i1 %cond, label %Out, label %Loop
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LICM/call_sink_const_function.ll b/test/Transforms/LICM/call_sink_const_function.ll
new file mode 100644
index 000000000000..f187e27335ba
--- /dev/null
+++ b/test/Transforms/LICM/call_sink_const_function.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext sin 1 | grep Out:
+
+declare double @sin(double) readnone
+
+declare void @foo()
+
+define double @test(double %X) {
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ call void @foo( )
+ %A = call double @sin( double %X ) readnone ; <double> [#uses=1]
+ br i1 true, label %Loop, label %Out
+
+Out: ; preds = %Loop
+ ret double %A
+}
diff --git a/test/Transforms/LICM/call_sink_pure_function.ll b/test/Transforms/LICM/call_sink_pure_function.ll
new file mode 100644
index 000000000000..c0457a17fc4e
--- /dev/null
+++ b/test/Transforms/LICM/call_sink_pure_function.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext strlen 1 | grep Out:
+
+declare i32 @strlen(i8*) readonly
+
+declare void @foo()
+
+define i32 @test(i8* %P) {
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %A = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1]
+ br i1 false, label %Loop, label %Out
+
+Out: ; preds = %Loop
+ ret i32 %A
+}
diff --git a/test/Transforms/LICM/dg.exp b/test/Transforms/LICM/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LICM/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LICM/no-preheader-test.ll b/test/Transforms/LICM/no-preheader-test.ll
new file mode 100644
index 000000000000..6ea08612ea86
--- /dev/null
+++ b/test/Transforms/LICM/no-preheader-test.ll
@@ -0,0 +1,20 @@
+; Test that LICM works when there is not a loop-preheader
+; RUN: llvm-as < %s | opt -licm | llvm-dis
+
+define void @testfunc(i32 %i.s, i1 %ifcond) {
+ br i1 %ifcond, label %Then, label %Else
+Then: ; preds = %0
+ br label %Loop
+Else: ; preds = %0
+ br label %Loop
+Loop: ; preds = %Loop, %Else, %Then
+ %j = phi i32 [ 0, %Then ], [ 12, %Else ], [ %Next, %Loop ] ; <i32> [#uses=1]
+ %i = bitcast i32 %i.s to i32 ; <i32> [#uses=1]
+ %i2 = mul i32 %i, 17 ; <i32> [#uses=1]
+ %Next = add i32 %j, %i2 ; <i32> [#uses=2]
+ %cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
+ br i1 %cond, label %Out, label %Loop
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LICM/scalar_promote.ll b/test/Transforms/LICM/scalar_promote.ll
new file mode 100644
index 000000000000..f6c0f0821a30
--- /dev/null
+++ b/test/Transforms/LICM/scalar_promote.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -licm -disable-output -stats |& \
+; RUN: grep {memory locations promoted to register}
+@X = global i32 7 ; <i32*> [#uses=4]
+
+define void @testfunc(i32 %i) {
+; <label>:0
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %j = phi i32 [ 0, %0 ], [ %Next, %Loop ] ; <i32> [#uses=1]
+ %x = load i32* @X ; <i32> [#uses=1]
+ %x2 = add i32 %x, 1 ; <i32> [#uses=1]
+ store i32 %x2, i32* @X
+ %Next = add i32 %j, 1 ; <i32> [#uses=2]
+ %cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
+ br i1 %cond, label %Out, label %Loop
+
+Out: ; preds = %Loop
+ ret void
+}
+
+define void @testhard(i32 %i) {
+ br label %Loop
+
+Loop: ; preds = %Loop, %0
+ %X1 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1]
+ %A = load i32* %X1 ; <i32> [#uses=1]
+ %V = add i32 %A, 1 ; <i32> [#uses=1]
+ %X2 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1]
+ store i32 %V, i32* %X2
+ br i1 false, label %Loop, label %Exit
+
+Exit: ; preds = %Loop
+ ret void
+}
diff --git a/test/Transforms/LICM/sink_critical_edge.ll b/test/Transforms/LICM/sink_critical_edge.ll
new file mode 100644
index 000000000000..6998ab1580c3
--- /dev/null
+++ b/test/Transforms/LICM/sink_critical_edge.ll
@@ -0,0 +1,16 @@
+; This testcase checks to make sure the sinker does not cause problems with
+; critical edges.
+
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext add 1 | grep Exit
+
+define void @test() {
+Entry:
+ br i1 false, label %Loop, label %Exit
+Loop: ; preds = %Loop, %Entry
+ %X = add i32 0, 1 ; <i32> [#uses=1]
+ br i1 false, label %Loop, label %Exit
+Exit: ; preds = %Loop, %Entry
+ %Y = phi i32 [ 0, %Entry ], [ %X, %Loop ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LICM/sink_inst.ll b/test/Transforms/LICM/sink_inst.ll
new file mode 100644
index 000000000000..e634c753f361
--- /dev/null
+++ b/test/Transforms/LICM/sink_inst.ll
@@ -0,0 +1,20 @@
+; If the result of an instruction is only used outside of the loop, sink
+; the instruction to the exit blocks instead of executing it on every
+; iteration of the loop.
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext mul 1 | grep Out:
+
+define i32 @test(i32 %N) {
+Entry:
+ br label %Loop
+Loop: ; preds = %Loop, %Entry
+ %N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ] ; <i32> [#uses=3]
+ %tmp.6 = mul i32 %N, %N_addr.0.pn ; <i32> [#uses=1]
+ %tmp.7 = sub i32 %tmp.6, %N ; <i32> [#uses=1]
+ %dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
+ %tmp.1 = icmp ne i32 %N_addr.0.pn, 1 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret i32 %tmp.7
+}
+
diff --git a/test/Transforms/LICM/sink_load.ll b/test/Transforms/LICM/sink_load.ll
new file mode 100644
index 000000000000..87334840e054
--- /dev/null
+++ b/test/Transforms/LICM/sink_load.ll
@@ -0,0 +1,21 @@
+; To reduce register pressure, if a load is hoistable out of the loop, and the
+; result of the load is only used outside of the loop, sink the load instead of
+; hoisting it!
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext load 1 | grep Out:
+
+@X = global i32 5 ; <i32*> [#uses=1]
+
+define i32 @test(i32 %N) {
+Entry:
+ br label %Loop
+Loop: ; preds = %Loop, %Entry
+ %N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ] ; <i32> [#uses=2]
+ %tmp.6 = load i32* @X ; <i32> [#uses=1]
+ %dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
+ %tmp.1 = icmp ne i32 %N_addr.0.pn, 1 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret i32 %tmp.6
+}
+
diff --git a/test/Transforms/LICM/sink_multiple.ll b/test/Transforms/LICM/sink_multiple.ll
new file mode 100644
index 000000000000..c9341704738f
--- /dev/null
+++ b/test/Transforms/LICM/sink_multiple.ll
@@ -0,0 +1,21 @@
+; The loop sinker was running from the bottom of the loop to the top, causing
+; it to miss opportunities to sink instructions that depended on sinking other
+; instructions from the loop. Instead they got hoisted, which is better than
+; leaving them in the loop, but increases register pressure pointlessly.
+
+; RUN: llvm-as < %s | opt -licm | llvm-dis | \
+; RUN: %prcontext getelementptr 1 | grep Out:
+
+ %Ty = type { i32, i32 }
+@X = external global %Ty ; <%Ty*> [#uses=1]
+
+define i32 @test() {
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %dead = getelementptr %Ty* @X, i64 0, i32 0 ; <i32*> [#uses=1]
+ %sunk2 = load i32* %dead ; <i32> [#uses=1]
+ br i1 false, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret i32 %sunk2
+}
+
diff --git a/test/Transforms/LICM/sink_multiple_exits.ll b/test/Transforms/LICM/sink_multiple_exits.ll
new file mode 100644
index 000000000000..2882fa4b0af7
--- /dev/null
+++ b/test/Transforms/LICM/sink_multiple_exits.ll
@@ -0,0 +1,24 @@
+; This testcase ensures that we can sink instructions from loops with
+; multiple exits.
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | \
+; RUN: %prcontext mul 1 | grep {Out\[12\]:}
+
+define i32 @test(i32 %N, i1 %C) {
+Entry:
+ br label %Loop
+Loop: ; preds = %ContLoop, %Entry
+ %N_addr.0.pn = phi i32 [ %dec, %ContLoop ], [ %N, %Entry ] ; <i32> [#uses=3]
+ %tmp.6 = mul i32 %N, %N_addr.0.pn ; <i32> [#uses=1]
+ %tmp.7 = sub i32 %tmp.6, %N ; <i32> [#uses=2]
+ %dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
+ br i1 %C, label %ContLoop, label %Out1
+ContLoop: ; preds = %Loop
+ %tmp.1 = icmp ne i32 %N_addr.0.pn, 1 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %Loop, label %Out2
+Out1: ; preds = %Loop
+ ret i32 %tmp.7
+Out2: ; preds = %ContLoop
+ ret i32 %tmp.7
+}
+
diff --git a/test/Transforms/LICM/sink_only_some_exits.ll b/test/Transforms/LICM/sink_only_some_exits.ll
new file mode 100644
index 000000000000..42cfece56c91
--- /dev/null
+++ b/test/Transforms/LICM/sink_only_some_exits.ll
@@ -0,0 +1,23 @@
+; This testcase checks to make sure we can sink values which are only live on
+; some exits out of the loop, and that we can do so without breaking dominator
+; info.
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | \
+; RUN: %prcontext add 1 | grep exit2:
+
+define i32 @test(i1 %C1, i1 %C2, i32* %P, i32* %Q) {
+Entry:
+ br label %Loop
+Loop: ; preds = %Cont, %Entry
+ br i1 %C1, label %Cont, label %exit1
+Cont: ; preds = %Loop
+ %X = load i32* %P ; <i32> [#uses=2]
+ store i32 %X, i32* %Q
+ %V = add i32 %X, 1 ; <i32> [#uses=1]
+ br i1 %C2, label %Loop, label %exit2
+exit1: ; preds = %Loop
+ ret i32 0
+exit2: ; preds = %Cont
+ ret i32 %V
+}
+
diff --git a/test/Transforms/LICM/sink_phi_node_use.ll b/test/Transforms/LICM/sink_phi_node_use.ll
new file mode 100644
index 000000000000..6e558bb1e497
--- /dev/null
+++ b/test/Transforms/LICM/sink_phi_node_use.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext add 1 | grep preheader.loopexit:
+
+define void @test() {
+loopentry.2.i:
+ br i1 false, label %no_exit.1.i.preheader, label %loopentry.3.i.preheader
+no_exit.1.i.preheader: ; preds = %loopentry.2.i
+ br label %no_exit.1.i
+no_exit.1.i: ; preds = %endif.8.i, %no_exit.1.i.preheader
+ br i1 false, label %return.i, label %endif.8.i
+endif.8.i: ; preds = %no_exit.1.i
+ %inc.1.i = add i32 0, 1 ; <i32> [#uses=1]
+ br i1 false, label %no_exit.1.i, label %loopentry.3.i.preheader.loopexit
+loopentry.3.i.preheader.loopexit: ; preds = %endif.8.i
+ br label %loopentry.3.i.preheader
+loopentry.3.i.preheader: ; preds = %loopentry.3.i.preheader.loopexit, %loopentry.2.i
+ %arg_num.0.i.ph13000 = phi i32 [ 0, %loopentry.2.i ], [ %inc.1.i, %loopentry.3.i.preheader.loopexit ] ; <i32> [#uses=0]
+ ret void
+return.i: ; preds = %no_exit.1.i
+ ret void
+}
+
diff --git a/test/Transforms/LICM/sink_trapping_inst.ll b/test/Transforms/LICM/sink_trapping_inst.ll
new file mode 100644
index 000000000000..8e79039efe4b
--- /dev/null
+++ b/test/Transforms/LICM/sink_trapping_inst.ll
@@ -0,0 +1,18 @@
+; Potentially trapping instructions may be sunk as long as they are guaranteed
+; to be executed.
+;
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext div 1 | grep Out:
+
+define i32 @test(i32 %N) {
+Entry:
+ br label %Loop
+Loop: ; preds = %Loop, %Entry
+ %N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ] ; <i32> [#uses=3]
+ %tmp.6 = sdiv i32 %N, %N_addr.0.pn ; <i32> [#uses=1]
+ %dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
+ %tmp.1 = icmp ne i32 %N_addr.0.pn, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret i32 %tmp.6
+}
+
diff --git a/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll b/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll
new file mode 100644
index 000000000000..ecba2f47b187
--- /dev/null
+++ b/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -loop-deletion | llvm-dis | grep switch
+; PR 1564
+
+define fastcc void @out() {
+ start:
+ br label %loop
+ unreachable:
+ unreachable
+ loop:
+ switch i32 0, label %unreachable [
+ i32 0, label %loop
+ ]
+}
diff --git a/test/Transforms/LoopDeletion/2008-05-06-Phi.ll b/test/Transforms/LoopDeletion/2008-05-06-Phi.ll
new file mode 100644
index 000000000000..bfb747a72da8
--- /dev/null
+++ b/test/Transforms/LoopDeletion/2008-05-06-Phi.ll
@@ -0,0 +1,109 @@
+; RUN: llvm-as < %s | opt -inline -tailduplicate -instcombine -jump-threading -licm -loop-unswitch -instcombine -indvars -loop-deletion -gvn -simplifycfg -verify -disable-output
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %struct.BF_BitstreamElement = type { i32, i16 }
+ %struct.BF_BitstreamPart = type { i32, %struct.BF_BitstreamElement* }
+ %struct.BF_PartHolder = type { i32, %struct.BF_BitstreamPart* }
+ %struct.Bit_stream_struc = type { i8*, i32, %struct.FILE*, i8*, i32, i32, i32, i32 }
+ %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.III_scalefac_t = type { [22 x i32], [13 x [3 x i32]] }
+ %struct.III_side_info_t = type { i32, i32, i32, [2 x [4 x i32]], [2 x %struct.anon] }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+ %struct.anon = type { [2 x %struct.gr_info_ss] }
+ %struct.gr_info = type { i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, [4 x i32] }
+ %struct.gr_info_ss = type { %struct.gr_info }
+ %struct.lame_global_flags = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32 }
+@scaleFactorsPH = external global [2 x [2 x %struct.BF_PartHolder*]] ; <[2 x [2 x %struct.BF_PartHolder*]]*> [#uses=1]
+@slen1_tab = external constant [16 x i32] ; <[16 x i32]*> [#uses=1]
+
+declare %struct.BF_PartHolder* @BF_addElement(%struct.BF_PartHolder*, %struct.BF_BitstreamElement*) nounwind
+
+define %struct.BF_PartHolder* @BF_addEntry(%struct.BF_PartHolder* %thePH, i32 %value, i32 %length) nounwind {
+entry:
+ %myElement = alloca %struct.BF_BitstreamElement ; <%struct.BF_BitstreamElement*> [#uses=2]
+ %tmp1 = getelementptr %struct.BF_BitstreamElement* %myElement, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 %value, i32* %tmp1, align 8
+ %tmp7 = icmp eq i32 %length, 0 ; <i1> [#uses=1]
+ br i1 %tmp7, label %bb13, label %bb
+
+bb: ; preds = %entry
+ %tmp10 = call %struct.BF_PartHolder* @BF_addElement( %struct.BF_PartHolder* %thePH, %struct.BF_BitstreamElement* %myElement ) nounwind ; <%struct.BF_PartHolder*> [#uses=1]
+ ret %struct.BF_PartHolder* %tmp10
+
+bb13: ; preds = %entry
+ ret %struct.BF_PartHolder* %thePH
+}
+
+define void @III_format_bitstream(%struct.lame_global_flags* %gfp, i32 %bitsPerFrame, [2 x [576 x i32]]* %l3_enc, %struct.III_side_info_t* %l3_side, [2 x %struct.III_scalefac_t]* %scalefac, %struct.Bit_stream_struc* %in_bs) nounwind {
+entry:
+ call fastcc void @encodeMainData( %struct.lame_global_flags* %gfp, [2 x [576 x i32]]* %l3_enc, %struct.III_side_info_t* %l3_side, [2 x %struct.III_scalefac_t]* %scalefac ) nounwind
+ unreachable
+}
+
+define internal fastcc void @encodeMainData(%struct.lame_global_flags* %gfp, [2 x [576 x i32]]* %l3_enc, %struct.III_side_info_t* %si, [2 x %struct.III_scalefac_t]* %scalefac) nounwind {
+entry:
+ %tmp69 = getelementptr %struct.lame_global_flags* %gfp, i32 0, i32 43 ; <i32*> [#uses=1]
+ %tmp70 = load i32* %tmp69, align 4 ; <i32> [#uses=1]
+ %tmp71 = icmp eq i32 %tmp70, 1 ; <i1> [#uses=1]
+ br i1 %tmp71, label %bb352, label %bb498
+
+bb113: ; preds = %bb132
+ %tmp123 = getelementptr [2 x %struct.III_scalefac_t]* %scalefac, i32 0, i32 0, i32 1, i32 %sfb.0, i32 %window.0 ; <i32*> [#uses=1]
+ %tmp124 = load i32* %tmp123, align 4 ; <i32> [#uses=1]
+ %tmp126 = load %struct.BF_PartHolder** %tmp80, align 4 ; <%struct.BF_PartHolder*> [#uses=1]
+ %tmp128 = call %struct.BF_PartHolder* @BF_addEntry( %struct.BF_PartHolder* %tmp126, i32 %tmp124, i32 %tmp93 ) nounwind ; <%struct.BF_PartHolder*> [#uses=1]
+ store %struct.BF_PartHolder* %tmp128, %struct.BF_PartHolder** %tmp80, align 4
+ %tmp131 = add i32 %window.0, 1 ; <i32> [#uses=1]
+ br label %bb132
+
+bb132: ; preds = %bb140, %bb113
+ %window.0 = phi i32 [ %tmp131, %bb113 ], [ 0, %bb140 ] ; <i32> [#uses=3]
+ %tmp134 = icmp slt i32 %window.0, 3 ; <i1> [#uses=1]
+ br i1 %tmp134, label %bb113, label %bb137
+
+bb137: ; preds = %bb132
+ %tmp139 = add i32 %sfb.0, 1 ; <i32> [#uses=1]
+ br label %bb140
+
+bb140: ; preds = %bb341, %bb137
+ %sfb.0 = phi i32 [ %tmp139, %bb137 ], [ 0, %bb341 ] ; <i32> [#uses=3]
+ %tmp142 = icmp slt i32 %sfb.0, 6 ; <i1> [#uses=1]
+ br i1 %tmp142, label %bb132, label %bb174
+
+bb166: ; preds = %bb174
+ %tmp160 = load %struct.BF_PartHolder** %tmp80, align 4 ; <%struct.BF_PartHolder*> [#uses=1]
+ %tmp162 = call %struct.BF_PartHolder* @BF_addEntry( %struct.BF_PartHolder* %tmp160, i32 0, i32 0 ) nounwind ; <%struct.BF_PartHolder*> [#uses=0]
+ unreachable
+
+bb174: ; preds = %bb140
+ %tmp176 = icmp slt i32 6, 12 ; <i1> [#uses=1]
+ br i1 %tmp176, label %bb166, label %bb341
+
+bb341: ; preds = %bb352, %bb174
+ %tmp80 = getelementptr [2 x [2 x %struct.BF_PartHolder*]]* @scaleFactorsPH, i32 0, i32 0, i32 0 ; <%struct.BF_PartHolder**> [#uses=3]
+ %tmp92 = getelementptr [16 x i32]* @slen1_tab, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp93 = load i32* %tmp92, align 4 ; <i32> [#uses=1]
+ br label %bb140
+
+bb352: ; preds = %entry
+ %tmp354 = icmp slt i32 0, 2 ; <i1> [#uses=1]
+ br i1 %tmp354, label %bb341, label %return
+
+bb498: ; preds = %entry
+ ret void
+
+return: ; preds = %bb352
+ ret void
+}
+
+define void @getframebits(%struct.lame_global_flags* %gfp, i32* %bitsPerFrame, i32* %mean_bits) nounwind {
+entry:
+ unreachable
+}
+
+define i32 @lame_encode_buffer(%struct.lame_global_flags* %gfp, i16* %buffer_l, i16* %buffer_r, i32 %nsamples, i8* %mp3buf, i32 %mp3buf_size) nounwind {
+entry:
+ unreachable
+}
diff --git a/test/Transforms/LoopDeletion/dcetest.ll b/test/Transforms/LoopDeletion/dcetest.ll
new file mode 100644
index 000000000000..c112cae53700
--- /dev/null
+++ b/test/Transforms/LoopDeletion/dcetest.ll
@@ -0,0 +1,36 @@
+; This is the test case taken from Appel's book that illustrates a hard case
+; that SCCP gets right, and when followed by ADCE, is completely eliminated
+;
+; RUN: llvm-as < %s | opt -sccp -simplifycfg -indvars -loop-deletion -dce -simplifycfg | llvm-dis | not grep br
+
+define i32 @"test function"(i32 %i0, i32 %j0) {
+BB1:
+ br label %BB2
+
+BB2: ; preds = %BB7, %BB1
+ %j2 = phi i32 [ %j4, %BB7 ], [ 1, %BB1 ] ; <i32> [#uses=2]
+ %k2 = phi i32 [ %k4, %BB7 ], [ 0, %BB1 ] ; <i32> [#uses=4]
+ %kcond = icmp slt i32 %k2, 100 ; <i1> [#uses=1]
+ br i1 %kcond, label %BB3, label %BB4
+
+BB3: ; preds = %BB2
+ %jcond = icmp slt i32 %j2, 20 ; <i1> [#uses=1]
+ br i1 %jcond, label %BB5, label %BB6
+
+BB4: ; preds = %BB2
+ ret i32 %j2
+
+BB5: ; preds = %BB3
+ %k3 = add i32 %k2, 1 ; <i32> [#uses=1]
+ br label %BB7
+
+BB6: ; preds = %BB3
+ %k5 = add i32 %k2, 1 ; <i32> [#uses=1]
+ br label %BB7
+
+BB7: ; preds = %BB6, %BB5
+ %j4 = phi i32 [ 1, %BB5 ], [ %k2, %BB6 ] ; <i32> [#uses=1]
+ %k4 = phi i32 [ %k3, %BB5 ], [ %k5, %BB6 ] ; <i32> [#uses=1]
+ br label %BB2
+}
+
diff --git a/test/Transforms/LoopDeletion/dg.exp b/test/Transforms/LoopDeletion/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopDeletion/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll b/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll
new file mode 100644
index 000000000000..fa1ab2dd6ba1
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll
@@ -0,0 +1,63 @@
+; PR1692
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+ %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 }
+ %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* }
+ %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* }
+ %struct.anon = type { %struct.LIST_NODE* }
+ %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 }
+ %struct.subst = type { %struct.subst*, i32, %struct.term* }
+ %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 }
+
+define %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) {
+entry:
+ br i1 false, label %cond_next44, label %bb37
+
+bb37: ; preds = %entry
+ ret %struct.LIST_NODE* null
+
+cond_next44: ; preds = %entry
+ br i1 false, label %bb29.i, label %bb.i31
+
+bb.i31: ; preds = %cond_next44
+ ret %struct.LIST_NODE* null
+
+bb29.i: ; preds = %cond_next44
+ br i1 false, label %cond_next89.i, label %bb34.i
+
+bb34.i: ; preds = %bb29.i
+ ret %struct.LIST_NODE* null
+
+cond_next89.i: ; preds = %bb29.i
+ br i1 false, label %clause_LiteralGetIndex.exit70.i, label %bb.i59.i
+
+bb.i59.i: ; preds = %cond_next89.i
+ ret %struct.LIST_NODE* null
+
+clause_LiteralGetIndex.exit70.i: ; preds = %cond_next89.i
+ br label %bb3.i.i
+
+bb3.i.i: ; preds = %bb3.i.i, %clause_LiteralGetIndex.exit70.i
+ br i1 false, label %bb40.i.i, label %bb3.i.i
+
+subst_Apply.exit.i.i: ; preds = %bb40.i.i
+ %tmp21.i.i = icmp sgt i32 %j.0.i.i, 0 ; <i1> [#uses=1]
+ br i1 %tmp21.i.i, label %cond_false.i47.i, label %cond_true24.i.i
+
+cond_true24.i.i: ; preds = %subst_Apply.exit.i.i
+ br label %cond_next37.i.i
+
+cond_false.i47.i: ; preds = %subst_Apply.exit.i.i
+ br label %cond_next37.i.i
+
+cond_next37.i.i: ; preds = %cond_false.i47.i, %cond_true24.i.i
+ %tmp39.i.i = add i32 %j.0.i.i, 1 ; <i32> [#uses=1]
+ br label %bb40.i.i
+
+bb40.i.i: ; preds = %cond_next37.i.i, %bb3.i.i
+ %j.0.i.i = phi i32 [ %tmp39.i.i, %cond_next37.i.i ], [ 0, %bb3.i.i ] ; <i32> [#uses=3]
+ %tmp43.i.i = icmp sgt i32 %j.0.i.i, 0 ; <i1> [#uses=1]
+ br i1 %tmp43.i.i, label %inf_CopyHyperElectron.exit.i, label %subst_Apply.exit.i.i
+
+inf_CopyHyperElectron.exit.i: ; preds = %bb40.i.i
+ ret %struct.LIST_NODE* null
+}
diff --git a/test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll b/test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll
new file mode 100644
index 000000000000..ec29847e7a82
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2007-09-24-UpdateIterationSpace.ll
@@ -0,0 +1,57 @@
+
+; Update loop iteraton space to eliminate condition inside loop.
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep bothcond
+define void @test(float* %x, i32 %ndat, float** %y, float %xcen, i32 %xmin, i32 %xmax, float %sigmal, float %contribution) {
+entry:
+ %tmp519 = icmp sgt i32 %xmin, %xmax ; <i1> [#uses=1]
+ br i1 %tmp519, label %return, label %bb.preheader
+
+bb.preheader: ; preds = %entry
+ %tmp3031 = fpext float %contribution to double ; <double> [#uses=1]
+ %tmp32 = mul double %tmp3031, 5.000000e-01 ; <double> [#uses=1]
+ %tmp3839 = fpext float %sigmal to double ; <double> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb.preheader, %cond_next45
+ %i.01.0 = phi i32 [ %tmp47, %cond_next45 ], [ 0, %bb.preheader ] ; <i32> [#uses=6]
+ %tmp2 = icmp sgt i32 %i.01.0, -1 ; <i1> [#uses=1]
+ %tmp6 = icmp slt i32 %i.01.0, %ndat ; <i1> [#uses=1]
+ %bothcond = and i1 %tmp2, %tmp6 ; <i1> [#uses=1]
+ br i1 %bothcond, label %cond_true9, label %cond_next45
+
+cond_true9: ; preds = %bb
+ %tmp12 = getelementptr float* %x, i32 %i.01.0 ; <float*> [#uses=1]
+ %tmp13 = load float* %tmp12, align 4 ; <float> [#uses=1]
+ %tmp15 = sub float %xcen, %tmp13 ; <float> [#uses=1]
+ %tmp16 = tail call float @fabsf( float %tmp15 ) ; <float> [#uses=1]
+ %tmp18 = fdiv float %tmp16, %sigmal ; <float> [#uses=1]
+ %tmp21 = load float** %y, align 4 ; <float*> [#uses=2]
+ %tmp27 = getelementptr float* %tmp21, i32 %i.01.0 ; <float*> [#uses=1]
+ %tmp28 = load float* %tmp27, align 4 ; <float> [#uses=1]
+ %tmp2829 = fpext float %tmp28 to double ; <double> [#uses=1]
+ %tmp34 = sub float -0.000000e+00, %tmp18 ; <float> [#uses=1]
+ %tmp3435 = fpext float %tmp34 to double ; <double> [#uses=1]
+ %tmp36 = tail call double @exp( double %tmp3435 ) ; <double> [#uses=1]
+ %tmp37 = mul double %tmp32, %tmp36 ; <double> [#uses=1]
+ %tmp40 = fdiv double %tmp37, %tmp3839 ; <double> [#uses=1]
+ %tmp41 = add double %tmp2829, %tmp40 ; <double> [#uses=1]
+ %tmp4142 = fptrunc double %tmp41 to float ; <float> [#uses=1]
+ %tmp44 = getelementptr float* %tmp21, i32 %i.01.0 ; <float*> [#uses=1]
+ store float %tmp4142, float* %tmp44, align 4
+ br label %cond_next45
+
+cond_next45: ; preds = %bb, %cond_true9
+ %tmp47 = add i32 %i.01.0, 1 ; <i32> [#uses=2]
+ %tmp51 = icmp sgt i32 %tmp47, %xmax ; <i1> [#uses=1]
+ br i1 %tmp51, label %return.loopexit, label %bb
+
+return.loopexit: ; preds = %cond_next45
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
+
+declare float @fabsf(float)
+
+declare double @exp(double)
diff --git a/test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll b/test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll
new file mode 100644
index 000000000000..7d9378512aa4
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2007-09-25-UpdateIterationSpace-2.ll
@@ -0,0 +1,60 @@
+; PR714
+; Update loop iteraton space to eliminate condition inside loop.
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep bothcond
+
+define void @test(float* %x, i32 %ndat, float** %y, float %xcen, i32 %xmin, i32 %xmax, float %sigmal, float %contribution) {
+entry:
+ %tmp5310 = icmp sgt i32 %xmin, %xmax ; <i1> [#uses=1]
+ br i1 %tmp5310, label %return, label %bb.preheader
+
+bb.preheader: ; preds = %entry
+ %tmp3031 = fpext float %contribution to double ; <double> [#uses=1]
+ %tmp32 = mul double %tmp3031, 5.000000e-01 ; <double> [#uses=1]
+ %tmp3839 = fpext float %sigmal to double ; <double> [#uses=1]
+ br label %bb
+
+bb: ; preds = %cond_next45, %bb.preheader
+ %k.06.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %cond_next45 ] ; <i32> [#uses=4]
+ %i.01.0 = add i32 %k.06.0, %xmin ; <i32> [#uses=4]
+ %tmp2 = icmp sgt i32 %i.01.0, -1 ; <i1> [#uses=1]
+ %tmp6 = icmp slt i32 %i.01.0, %ndat ; <i1> [#uses=1]
+ %bothcond = and i1 %tmp2, %tmp6 ; <i1> [#uses=1]
+ br i1 %bothcond, label %cond_true9, label %cond_next45
+
+cond_true9: ; preds = %bb
+ %tmp12 = getelementptr float* %x, i32 %i.01.0 ; <float*> [#uses=1]
+ %tmp13 = load float* %tmp12, align 4 ; <float> [#uses=1]
+ %tmp15 = sub float %xcen, %tmp13 ; <float> [#uses=1]
+ %tmp16 = tail call float @fabsf(float %tmp15) ; <float> [#uses=1]
+ %tmp18 = fdiv float %tmp16, %sigmal ; <float> [#uses=1]
+ %tmp21 = load float** %y, align 4 ; <float*> [#uses=2]
+ %tmp27 = getelementptr float* %tmp21, i32 %k.06.0 ; <float*> [#uses=1]
+ %tmp28 = load float* %tmp27, align 4 ; <float> [#uses=1]
+ %tmp2829 = fpext float %tmp28 to double ; <double> [#uses=1]
+ %tmp34 = sub float -0.000000e+00, %tmp18 ; <float> [#uses=1]
+ %tmp3435 = fpext float %tmp34 to double ; <double> [#uses=1]
+ %tmp36 = tail call double @exp(double %tmp3435) ; <double> [#uses=1]
+ %tmp37 = mul double %tmp32, %tmp36 ; <double> [#uses=1]
+ %tmp40 = fdiv double %tmp37, %tmp3839 ; <double> [#uses=1]
+ %tmp41 = add double %tmp2829, %tmp40 ; <double> [#uses=1]
+ %tmp4142 = fptrunc double %tmp41 to float ; <float> [#uses=1]
+ %tmp44 = getelementptr float* %tmp21, i32 %k.06.0 ; <float*> [#uses=1]
+ store float %tmp4142, float* %tmp44, align 4
+ br label %cond_next45
+
+cond_next45: ; preds = %cond_true9, %bb
+ %tmp47 = add i32 %i.01.0, 1 ; <i32> [#uses=1]
+ %tmp53 = icmp sgt i32 %tmp47, %xmax ; <i1> [#uses=1]
+ %indvar.next = add i32 %k.06.0, 1 ; <i32> [#uses=1]
+ br i1 %tmp53, label %return.loopexit, label %bb
+
+return.loopexit: ; preds = %cond_next45
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
+
+declare float @fabsf(float)
+
+declare double @exp(double)
diff --git a/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll b/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll
new file mode 100644
index 000000000000..a4966a9de4a2
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-01-28-IndDecrement.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: not grep "loop-index-split"
+
+; Induction variable decrement is not yet handled.
+; pr1912.bc
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin9"
+ %struct.cset = type { i8*, i8, i8, i32, i8* }
+ %struct.parse = type { i8*, i8*, i32, i32*, i32, i32, i32, %struct.re_guts*, [10 x i32], [10 x i32] }
+ %struct.re_guts = type { i32, i32*, i32, i32, %struct.cset*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, i32, i32, [1 x i8] }
+
+define fastcc void @p_bracket(%struct.parse* %p) {
+entry:
+ br i1 false, label %bb160, label %bb195
+
+bb160: ; preds = %entry
+ br i1 false, label %bb.i169, label %bb9.i
+
+bb195: ; preds = %entry
+ ret void
+
+bb.i169: ; preds = %bb160
+ br i1 false, label %bb372, label %bb565
+
+bb9.i: ; preds = %bb160
+ ret void
+
+bb372: ; preds = %bb418, %bb.i169
+ %i1.0.reg2mem.0 = phi i32 [ %i1.0, %bb418 ], [ 0, %bb.i169 ] ; <i32> [#uses=2]
+ %tmp3.i.i.i170 = icmp ult i32 %i1.0.reg2mem.0, 128 ; <i1> [#uses=1]
+ br i1 %tmp3.i.i.i170, label %bb.i.i173, label %bb13.i.i
+
+bb.i.i173: ; preds = %bb372
+ br label %bb418
+
+bb13.i.i: ; preds = %bb372
+ br label %bb418
+
+bb418: ; preds = %bb13.i.i, %bb.i.i173
+ %i1.0 = add i32 %i1.0.reg2mem.0, -1 ; <i32> [#uses=2]
+ %tmp420 = icmp sgt i32 %i1.0, -1 ; <i1> [#uses=1]
+ br i1 %tmp420, label %bb372, label %bb565
+
+bb565: ; preds = %bb418, %bb.i169
+ ret void
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll b/test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll
new file mode 100644
index 000000000000..4ad906719f8b
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-02-08-Crash.ll
@@ -0,0 +1,48 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; PR 1995
+
+define void @add_blkdev_randomness(i32 %major) nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb39, %entry
+ %A.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %TEMP.0, %bb39 ] ; <i32> [#uses=1]
+ %D.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %C.0.reg2mem.0, %bb39 ] ; <i32> [#uses=3]
+ %C.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %tmp34, %bb39 ] ; <i32> [#uses=4]
+ %TEMP.1.reg2mem.0 = phi i32 [ undef, %entry ], [ %TEMP.0, %bb39 ] ; <i32> [#uses=1]
+ %i.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %tmp38, %bb39 ] ; <i32> [#uses=3]
+ %B.0.reg2mem.0 = phi i32 [ undef, %entry ], [ %A.0.reg2mem.0, %bb39 ] ; <i32> [#uses=5]
+ %tmp1 = icmp slt i32 %i.0.reg2mem.0, 40 ; <i1> [#uses=1]
+ br i1 %tmp1, label %bb3, label %bb12
+
+bb3: ; preds = %bb
+ %tmp6 = xor i32 %C.0.reg2mem.0, %D.0.reg2mem.0 ; <i32> [#uses=1]
+ %tmp8 = and i32 %B.0.reg2mem.0, %tmp6 ; <i32> [#uses=1]
+ %tmp10 = xor i32 %tmp8, %D.0.reg2mem.0 ; <i32> [#uses=1]
+ %tmp11 = add i32 %tmp10, 1518500249 ; <i32> [#uses=1]
+ br label %bb39
+
+bb12: ; preds = %bb
+ %tmp14 = icmp slt i32 %i.0.reg2mem.0, 60 ; <i1> [#uses=1]
+ br i1 %tmp14, label %bb17, label %bb39
+
+bb17: ; preds = %bb12
+ %tmp20 = and i32 %B.0.reg2mem.0, %C.0.reg2mem.0 ; <i32> [#uses=1]
+ %tmp23 = xor i32 %B.0.reg2mem.0, %C.0.reg2mem.0 ; <i32> [#uses=1]
+ %tmp25 = and i32 %tmp23, %D.0.reg2mem.0 ; <i32> [#uses=1]
+ %tmp26 = add i32 %tmp20, -1894007588 ; <i32> [#uses=1]
+ %tmp27 = add i32 %tmp26, %tmp25 ; <i32> [#uses=1]
+ br label %bb39
+
+bb39: ; preds = %bb12, %bb3, %bb17
+ %TEMP.0 = phi i32 [ %tmp27, %bb17 ], [ %tmp11, %bb3 ], [ %TEMP.1.reg2mem.0, %bb12 ] ; <i32> [#uses=2]
+ %tmp31 = lshr i32 %B.0.reg2mem.0, 2 ; <i32> [#uses=1]
+ %tmp33 = shl i32 %B.0.reg2mem.0, 30 ; <i32> [#uses=1]
+ %tmp34 = or i32 %tmp31, %tmp33 ; <i32> [#uses=1]
+ %tmp38 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp41 = icmp slt i32 %tmp38, 80 ; <i1> [#uses=1]
+ br i1 %tmp41, label %bb, label %return
+
+return: ; preds = %bb39
+ ret void
+} \ No newline at end of file
diff --git a/test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll b/test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll
new file mode 100644
index 000000000000..9fa83e4f57ff
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-02-13-ExitValueNum.ll
@@ -0,0 +1,67 @@
+; RUN: llvm-as < %s | opt -disable-output -loop-index-split
+; PR 2011
+ %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 }
+ %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* }
+ %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* }
+ %struct.anon = type { %struct.LIST_NODE* }
+ %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 }
+ %struct.subst = type { %struct.subst*, i32, %struct.term* }
+ %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 }
+
+define fastcc %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) nounwind {
+entry:
+ br i1 false, label %bb960, label %bb885
+
+bb885: ; preds = %entry
+ ret %struct.LIST_NODE* null
+
+bb960: ; preds = %entry
+ br i1 false, label %bb1097, label %bb1005.preheader
+
+bb1005.preheader: ; preds = %bb960
+ ret %struct.LIST_NODE* null
+
+bb1097: ; preds = %bb960
+ br i1 false, label %bb1269.preheader, label %bb1141.preheader
+
+bb1141.preheader: ; preds = %bb1097
+ ret %struct.LIST_NODE* null
+
+bb1269.preheader: ; preds = %bb1097
+ br i1 false, label %bb1318, label %bb1281
+
+bb1281: ; preds = %bb1269.preheader
+ ret %struct.LIST_NODE* null
+
+bb1318: ; preds = %bb1269.preheader
+ br i1 false, label %bb1459, label %bb.nph52
+
+bb.nph52: ; preds = %bb1318
+ ret %struct.LIST_NODE* null
+
+bb1459: ; preds = %bb1318
+ br i1 false, label %bb1553, label %bb.nph62
+
+bb.nph62: ; preds = %bb1459
+ ret %struct.LIST_NODE* null
+
+bb1553: ; preds = %bb1669, %bb1459
+ %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %bb1459 ] ; <i32> [#uses=2]
+ %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp1629, label %bb1649, label %bb1632
+
+bb1632: ; preds = %bb1553
+ br label %bb1669
+
+bb1649: ; preds = %bb1553
+ br label %bb1669
+
+bb1669: ; preds = %bb1649, %bb1632
+ %storemerge110 = add i32 %j295.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp1672 = icmp sgt i32 %storemerge110, 0 ; <i1> [#uses=1]
+ br i1 %tmp1672, label %bb1678, label %bb1553
+
+bb1678: ; preds = %bb1669
+ ret %struct.LIST_NODE* null
+}
+
diff --git a/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll b/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll
new file mode 100644
index 000000000000..0c67ea2c3070
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatch.ll
@@ -0,0 +1,72 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; PR 2011
+ %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 }
+ %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* }
+ %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* }
+ %struct.anon = type { %struct.LIST_NODE* }
+ %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 }
+ %struct.subst = type { %struct.subst*, i32, %struct.term* }
+ %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 }
+
+define fastcc %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) nounwind {
+entry:
+ br i1 false, label %bb960, label %bb885
+
+bb885: ; preds = %entry
+ ret %struct.LIST_NODE* null
+
+bb960: ; preds = %entry
+ br i1 false, label %bb1097, label %bb1005.preheader
+
+bb1005.preheader: ; preds = %bb960
+ ret %struct.LIST_NODE* null
+
+bb1097: ; preds = %bb960
+ br i1 false, label %bb1269.preheader, label %bb1141.preheader
+
+bb1141.preheader: ; preds = %bb1097
+ ret %struct.LIST_NODE* null
+
+bb1269.preheader: ; preds = %bb1097
+ br i1 false, label %bb1318, label %bb1281
+
+bb1281: ; preds = %bb1269.preheader
+ ret %struct.LIST_NODE* null
+
+bb1318: ; preds = %bb1269.preheader
+ br i1 false, label %bb1459, label %bb.nph52
+
+bb.nph52: ; preds = %bb1318
+ ret %struct.LIST_NODE* null
+
+bb1459: ; preds = %bb1318
+ br i1 false, label %bb1553, label %bb.nph62
+
+bb.nph62: ; preds = %bb1459
+ ret %struct.LIST_NODE* null
+
+bb1553: ; preds = %bb1669, %bb1459
+ %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %bb1459 ] ; <i32> [#uses=2]
+ br i1 false, label %bb1588, label %bb1616
+
+bb1588: ; preds = %bb1553
+ br label %bb1616
+
+bb1616: ; preds = %bb1588, %bb1553
+ %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp1629, label %bb1649, label %bb1632
+
+bb1632: ; preds = %bb1616
+ br label %bb1669
+
+bb1649: ; preds = %bb1616
+ br label %bb1669
+
+bb1669: ; preds = %bb1649, %bb1632
+ %storemerge110 = add i32 %j295.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp1672 = icmp sgt i32 %storemerge110, 0 ; <i1> [#uses=1]
+ br i1 %tmp1672, label %bb1678, label %bb1553
+
+bb1678: ; preds = %bb1669
+ ret %struct.LIST_NODE* null
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll b/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll
new file mode 100644
index 000000000000..393299f3e094
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-02-13-LoopLatchPHI.ll
@@ -0,0 +1,74 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; PR 2011
+ %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 }
+ %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* }
+ %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* }
+ %struct.anon = type { %struct.LIST_NODE* }
+ %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 }
+ %struct.subst = type { %struct.subst*, i32, %struct.term* }
+ %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 }
+
+define fastcc %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) nounwind {
+entry:
+ br i1 false, label %bb960, label %bb885
+
+bb885: ; preds = %entry
+ ret %struct.LIST_NODE* null
+
+bb960: ; preds = %entry
+ br i1 false, label %bb1097, label %bb1005.preheader
+
+bb1005.preheader: ; preds = %bb960
+ ret %struct.LIST_NODE* null
+
+bb1097: ; preds = %bb960
+ br i1 false, label %bb1269.preheader, label %bb1141.preheader
+
+bb1141.preheader: ; preds = %bb1097
+ ret %struct.LIST_NODE* null
+
+bb1269.preheader: ; preds = %bb1097
+ br i1 false, label %bb1318, label %bb1281
+
+bb1281: ; preds = %bb1269.preheader
+ ret %struct.LIST_NODE* null
+
+bb1318: ; preds = %bb1269.preheader
+ br i1 false, label %bb1459, label %bb.nph52
+
+bb.nph52: ; preds = %bb1318
+ ret %struct.LIST_NODE* null
+
+bb1459: ; preds = %bb1318
+ br i1 false, label %bb1553, label %bb.nph62
+
+bb.nph62: ; preds = %bb1459
+ ret %struct.LIST_NODE* null
+
+bb1553: ; preds = %bb1669, %bb1459
+ %j295.0.reg2mem.0 = phi i32 [ %storemerge110, %bb1669 ], [ 0, %bb1459 ] ; <i32> [#uses=2]
+ %Constraint403.2.reg2mem.0 = phi %struct.LIST_NODE* [ %Constraint403.1.reg2mem.0, %bb1669 ], [ null, %bb1459 ] ; <%struct.LIST_NODE*> [#uses=1]
+ br i1 false, label %bb1588, label %bb1616
+
+bb1588: ; preds = %bb1553
+ br label %bb1616
+
+bb1616: ; preds = %bb1588, %bb1553
+ %tmp1629 = icmp sgt i32 %j295.0.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp1629, label %bb1649, label %bb1632
+
+bb1632: ; preds = %bb1616
+ br label %bb1669
+
+bb1649: ; preds = %bb1616
+ br label %bb1669
+
+bb1669: ; preds = %bb1649, %bb1632
+ %Constraint403.1.reg2mem.0 = phi %struct.LIST_NODE* [ null, %bb1632 ], [ %Constraint403.2.reg2mem.0, %bb1649 ] ; <%struct.LIST_NODE*> [#uses=1]
+ %storemerge110 = add i32 %j295.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp1672 = icmp sgt i32 %storemerge110, 0 ; <i1> [#uses=1]
+ br i1 %tmp1672, label %bb1678, label %bb1553
+
+bb1678: ; preds = %bb1669
+ ret %struct.LIST_NODE* null
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll b/test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll
new file mode 100644
index 000000000000..2ee51e14948c
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-02-14-Crash.ll
@@ -0,0 +1,464 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; PR 2030
+ %struct.FULL = type { i32, i32, [1000 x float*] }
+
+define i32 @matgen(%struct.FULL* %a, float** %x, float** %b, float** %bt, i32** %ipvt, i32 %test_case, i32 %scale) {
+entry:
+ br i1 false, label %bb, label %entry.bb30_crit_edge
+
+entry.bb30_crit_edge: ; preds = %entry
+ br label %bb30
+
+bb: ; preds = %entry
+ br label %bb14
+
+bb6: ; preds = %bb14
+ br label %bb14
+
+bb14: ; preds = %bb6, %bb
+ br i1 false, label %bb6, label %bb22
+
+bb22: ; preds = %bb14
+ br label %bb30
+
+bb30: ; preds = %bb22, %entry.bb30_crit_edge
+ switch i32 %test_case, label %bb648 [
+ i32 1, label %bb30.bb32_crit_edge
+ i32 2, label %bb30.bb32_crit_edge1
+ i32 3, label %bb30.bb32_crit_edge2
+ i32 4, label %bb30.bb108_crit_edge
+ i32 5, label %bb30.bb108_crit_edge3
+ i32 6, label %bb30.bb142_crit_edge
+ i32 7, label %bb30.bb142_crit_edge4
+ i32 8, label %bb30.bb142_crit_edge5
+ i32 9, label %bb234
+ i32 10, label %bb292
+ i32 11, label %bb353
+ i32 12, label %bb419
+ i32 13, label %bb485
+ i32 14, label %bb567
+ ]
+
+bb30.bb142_crit_edge5: ; preds = %bb30
+ br label %bb142
+
+bb30.bb142_crit_edge4: ; preds = %bb30
+ br label %bb142
+
+bb30.bb142_crit_edge: ; preds = %bb30
+ br label %bb142
+
+bb30.bb108_crit_edge3: ; preds = %bb30
+ br label %bb108
+
+bb30.bb108_crit_edge: ; preds = %bb30
+ br label %bb108
+
+bb30.bb32_crit_edge2: ; preds = %bb30
+ br label %bb32
+
+bb30.bb32_crit_edge1: ; preds = %bb30
+ br label %bb32
+
+bb30.bb32_crit_edge: ; preds = %bb30
+ br label %bb32
+
+bb32: ; preds = %bb30.bb32_crit_edge, %bb30.bb32_crit_edge1, %bb30.bb32_crit_edge2
+ br i1 false, label %bb53, label %bb52
+
+bb52: ; preds = %bb32
+ br label %bb739
+
+bb53: ; preds = %bb32
+ br label %bb101
+
+bb58: ; preds = %bb101
+ br label %bb92
+
+bb64: ; preds = %bb92
+ br i1 false, label %bb64.bb87_crit_edge, label %bb72
+
+bb64.bb87_crit_edge: ; preds = %bb64
+ br label %bb87
+
+bb72: ; preds = %bb64
+ br i1 false, label %bb72.bb87_crit_edge, label %bb79
+
+bb72.bb87_crit_edge: ; preds = %bb72
+ br label %bb87
+
+bb79: ; preds = %bb72
+ br label %bb87
+
+bb87: ; preds = %bb79, %bb72.bb87_crit_edge, %bb64.bb87_crit_edge
+ br label %bb92
+
+bb92: ; preds = %bb87, %bb58
+ br i1 false, label %bb64, label %bb98
+
+bb98: ; preds = %bb92
+ br label %bb101
+
+bb101: ; preds = %bb98, %bb53
+ br i1 false, label %bb58, label %bb107
+
+bb107: ; preds = %bb101
+ br label %bb651
+
+bb108: ; preds = %bb30.bb108_crit_edge, %bb30.bb108_crit_edge3
+ br i1 false, label %bb125, label %bb124
+
+bb124: ; preds = %bb108
+ br label %bb739
+
+bb125: ; preds = %bb108
+ br i1 false, label %bb138, label %bb139
+
+bb138: ; preds = %bb125
+ br label %bb140
+
+bb139: ; preds = %bb125
+ br label %bb140
+
+bb140: ; preds = %bb139, %bb138
+ br label %bb651
+
+bb142: ; preds = %bb30.bb142_crit_edge, %bb30.bb142_crit_edge4, %bb30.bb142_crit_edge5
+ br i1 false, label %bb161, label %bb160
+
+bb160: ; preds = %bb142
+ br label %bb739
+
+bb161: ; preds = %bb142
+ br i1 false, label %bb170, label %bb161.bb171_crit_edge
+
+bb161.bb171_crit_edge: ; preds = %bb161
+ br label %bb171
+
+bb170: ; preds = %bb161
+ br label %bb171
+
+bb171: ; preds = %bb170, %bb161.bb171_crit_edge
+ br i1 false, label %bb176, label %bb171.bb177_crit_edge
+
+bb171.bb177_crit_edge: ; preds = %bb171
+ br label %bb177
+
+bb176: ; preds = %bb171
+ br label %bb177
+
+bb177: ; preds = %bb176, %bb171.bb177_crit_edge
+ br label %bb227
+
+bb178: ; preds = %bb227
+ br label %bb218
+
+bb184: ; preds = %bb218
+ br i1 false, label %bb191, label %bb193
+
+bb191: ; preds = %bb184
+ br label %bb213
+
+bb193: ; preds = %bb184
+ br i1 false, label %bb200, label %bb203
+
+bb200: ; preds = %bb193
+ br label %bb213
+
+bb203: ; preds = %bb193
+ br i1 false, label %bb210, label %bb203.bb213_crit_edge
+
+bb203.bb213_crit_edge: ; preds = %bb203
+ br label %bb213
+
+bb210: ; preds = %bb203
+ br label %bb213
+
+bb213: ; preds = %bb210, %bb203.bb213_crit_edge, %bb200, %bb191
+ br label %bb218
+
+bb218: ; preds = %bb213, %bb178
+ br i1 false, label %bb184, label %bb224
+
+bb224: ; preds = %bb218
+ br label %bb227
+
+bb227: ; preds = %bb224, %bb177
+ br i1 false, label %bb178, label %bb233
+
+bb233: ; preds = %bb227
+ br label %bb651
+
+bb234: ; preds = %bb30
+ br i1 false, label %bb253, label %bb252
+
+bb252: ; preds = %bb234
+ br label %bb739
+
+bb253: ; preds = %bb234
+ br label %bb285
+
+bb258: ; preds = %bb285
+ br label %bb276
+
+bb264: ; preds = %bb276
+ br label %bb276
+
+bb276: ; preds = %bb264, %bb258
+ br i1 false, label %bb264, label %bb282
+
+bb282: ; preds = %bb276
+ br label %bb285
+
+bb285: ; preds = %bb282, %bb253
+ br i1 false, label %bb258, label %bb291
+
+bb291: ; preds = %bb285
+ br label %bb651
+
+bb292: ; preds = %bb30
+ br i1 false, label %bb311, label %bb310
+
+bb310: ; preds = %bb292
+ br label %bb739
+
+bb311: ; preds = %bb292
+ br label %bb346
+
+bb316: ; preds = %bb346
+ br label %bb337
+
+bb322: ; preds = %bb337
+ br label %bb337
+
+bb337: ; preds = %bb322, %bb316
+ br i1 false, label %bb322, label %bb343
+
+bb343: ; preds = %bb337
+ br label %bb346
+
+bb346: ; preds = %bb343, %bb311
+ br i1 false, label %bb316, label %bb352
+
+bb352: ; preds = %bb346
+ br label %bb651
+
+bb353: ; preds = %bb30
+ br i1 false, label %bb372, label %bb371
+
+bb371: ; preds = %bb353
+ br label %bb739
+
+bb372: ; preds = %bb353
+ br label %bb412
+
+bb377: ; preds = %bb412
+ br label %bb403
+
+bb383: ; preds = %bb403
+ br i1 false, label %bb395, label %bb389
+
+bb389: ; preds = %bb383
+ br label %bb396
+
+bb395: ; preds = %bb383
+ br label %bb396
+
+bb396: ; preds = %bb395, %bb389
+ br label %bb403
+
+bb403: ; preds = %bb396, %bb377
+ br i1 false, label %bb383, label %bb409
+
+bb409: ; preds = %bb403
+ br label %bb412
+
+bb412: ; preds = %bb409, %bb372
+ br i1 false, label %bb377, label %bb418
+
+bb418: ; preds = %bb412
+ br label %bb651
+
+bb419: ; preds = %bb30
+ br i1 false, label %bb438, label %bb437
+
+bb437: ; preds = %bb419
+ br label %bb739
+
+bb438: ; preds = %bb419
+ br label %bb478
+
+bb443: ; preds = %bb478
+ br label %bb469
+
+bb449: ; preds = %bb469
+ br i1 false, label %bb461, label %bb455
+
+bb455: ; preds = %bb449
+ br label %bb462
+
+bb461: ; preds = %bb449
+ br label %bb462
+
+bb462: ; preds = %bb461, %bb455
+ br label %bb469
+
+bb469: ; preds = %bb462, %bb443
+ br i1 false, label %bb449, label %bb475
+
+bb475: ; preds = %bb469
+ br label %bb478
+
+bb478: ; preds = %bb475, %bb438
+ br i1 false, label %bb443, label %bb484
+
+bb484: ; preds = %bb478
+ br label %bb651
+
+bb485: ; preds = %bb30
+ br i1 false, label %bb504, label %bb503
+
+bb503: ; preds = %bb485
+ br label %bb739
+
+bb504: ; preds = %bb485
+ br label %bb560
+
+bb513: ; preds = %bb560
+ br label %bb551
+
+bb519: ; preds = %bb551
+ br i1 false, label %bb528, label %bb532
+
+bb528: ; preds = %bb519
+ br label %bb536
+
+bb532: ; preds = %bb519
+ br label %bb536
+
+bb536: ; preds = %bb532, %bb528
+ br label %bb551
+
+bb551: ; preds = %bb536, %bb513
+ br i1 false, label %bb519, label %bb557
+
+bb557: ; preds = %bb551
+ br label %bb560
+
+bb560: ; preds = %bb557, %bb504
+ br i1 false, label %bb513, label %bb566
+
+bb566: ; preds = %bb560
+ br label %bb651
+
+bb567: ; preds = %bb30
+ br i1 false, label %bb586, label %bb585
+
+bb585: ; preds = %bb567
+ br label %bb739
+
+bb586: ; preds = %bb567
+ br label %bb641
+
+bb595: ; preds = %bb641
+ br label %bb632
+
+bb601: ; preds = %bb632
+ %tmp604 = icmp sgt i32 %i.7, 0 ; <i1> [#uses=1]
+ br i1 %tmp604, label %bb607, label %bb611
+
+bb607: ; preds = %bb601
+ br label %bb615
+
+bb611: ; preds = %bb601
+ br label %bb615
+
+bb615: ; preds = %bb611, %bb607
+ %tmp629 = add i32 %i.7, 1 ; <i32> [#uses=1]
+ %tmp631 = getelementptr float* %col.7, i32 1 ; <float*> [#uses=1]
+ br label %bb632
+
+bb632: ; preds = %bb615, %bb595
+ %col.7 = phi float* [ null, %bb595 ], [ %tmp631, %bb615 ] ; <float*> [#uses=1]
+ %i.7 = phi i32 [ 0, %bb595 ], [ %tmp629, %bb615 ] ; <i32> [#uses=3]
+ %tmp635 = icmp slt i32 %i.7, 0 ; <i1> [#uses=1]
+ br i1 %tmp635, label %bb601, label %bb638
+
+bb638: ; preds = %bb632
+ br label %bb641
+
+bb641: ; preds = %bb638, %bb586
+ br i1 false, label %bb595, label %bb647
+
+bb647: ; preds = %bb641
+ br label %bb651
+
+bb648: ; preds = %bb30
+ br label %bb739
+
+bb651: ; preds = %bb647, %bb566, %bb484, %bb418, %bb352, %bb291, %bb233, %bb140, %bb107
+ br i1 false, label %bb658, label %bb651.bb661_crit_edge
+
+bb651.bb661_crit_edge: ; preds = %bb651
+ br label %bb661
+
+bb658: ; preds = %bb651
+ br label %bb661
+
+bb661: ; preds = %bb658, %bb651.bb661_crit_edge
+ br i1 false, label %bb666, label %bb661.bb686_crit_edge
+
+bb661.bb686_crit_edge: ; preds = %bb661
+ br label %bb686
+
+bb666: ; preds = %bb661
+ br label %bb680
+
+bb670: ; preds = %bb680
+ br label %bb680
+
+bb680: ; preds = %bb670, %bb666
+ br i1 false, label %bb670, label %bb680.bb686_crit_edge
+
+bb680.bb686_crit_edge: ; preds = %bb680
+ br label %bb686
+
+bb686: ; preds = %bb680.bb686_crit_edge, %bb661.bb686_crit_edge
+ br i1 false, label %bb699, label %bb696
+
+bb696: ; preds = %bb686
+ br label %bb739
+
+bb699: ; preds = %bb686
+ br i1 false, label %bb712, label %bb709
+
+bb709: ; preds = %bb699
+ br label %bb739
+
+bb712: ; preds = %bb699
+ br i1 false, label %bb717, label %bb712.bb720_crit_edge
+
+bb712.bb720_crit_edge: ; preds = %bb712
+ br label %bb720
+
+bb717: ; preds = %bb712
+ br label %bb720
+
+bb720: ; preds = %bb717, %bb712.bb720_crit_edge
+ br i1 false, label %bb725, label %bb720.bb738_crit_edge
+
+bb720.bb738_crit_edge: ; preds = %bb720
+ br label %bb738
+
+bb725: ; preds = %bb720
+ br label %bb738
+
+bb738: ; preds = %bb725, %bb720.bb738_crit_edge
+ br label %bb739
+
+bb739: ; preds = %bb738, %bb709, %bb696, %bb648, %bb585, %bb503, %bb437, %bb371, %bb310, %bb252, %bb160, %bb124, %bb52
+ br label %return
+
+return: ; preds = %bb739
+ ret i32 0
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll b/test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll
new file mode 100644
index 000000000000..24f22cab4ea1
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-03-24-ExitPhi.ll
@@ -0,0 +1,69 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; Handle Exit block phis that do not have any use inside the loop.
+
+ %struct.ATOM = type { double, double, double, double, double, double, i32, double, double, double, double, i8*, i8, [9 x i8], double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, [200 x i8*], [32 x i8*], [32 x i8], i32 }
+ %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+
+define i32 @math([80 x i8]* %tokens, double* %fvalue, i32* %ivalue, %struct.FILE* %ip, %struct.FILE* %op, i32 %echo) nounwind {
+entry:
+ br i1 false, label %bb.i, label %bb35.i
+bb.i: ; preds = %entry
+ br i1 false, label %bb6.i, label %bb9.i
+bb9.i: ; preds = %bb.i
+ ret i32 0
+bb35.i: ; preds = %entry
+ ret i32 0
+bb6.i: ; preds = %bb.i
+ br i1 false, label %a_l2_f.exit, label %bb16.i
+bb16.i: ; preds = %bb6.i
+ ret i32 0
+a_l2_f.exit: ; preds = %bb6.i
+ br i1 false, label %bb7.i97, label %bb6.i71
+bb6.i71: ; preds = %a_l2_f.exit
+ ret i32 0
+bb7.i97: ; preds = %a_l2_f.exit
+ br i1 false, label %bb, label %bb18.i102
+bb18.i102: ; preds = %bb7.i97
+ ret i32 0
+bb: ; preds = %bb7.i97
+ br i1 false, label %bb38, label %AFOUND
+bb38: ; preds = %bb
+ br i1 false, label %bb111, label %bb7.i120
+AFOUND: ; preds = %bb
+ ret i32 0
+bb7.i120: ; preds = %bb38
+ ret i32 0
+bb111: ; preds = %bb38
+ switch i32 0, label %bb574 [
+ i32 1, label %bb158
+ i32 0, label %bb166
+ ]
+bb158: ; preds = %bb111
+ ret i32 0
+bb166: ; preds = %bb111
+ ret i32 0
+bb574: ; preds = %bb111
+ br i1 false, label %bb11.i249, label %bb600
+bb11.i249: ; preds = %bb574
+ br i1 false, label %bb11.i265, label %bb596
+bb11.i265: ; preds = %bb590, %bb11.i249
+ %i.1.reg2mem.0 = phi i32 [ %tmp589.reg2mem.0, %bb590 ], [ 0, %bb11.i249 ] ; <i32> [#uses=2]
+ %tmp13.i264 = icmp slt i32 %i.1.reg2mem.0, 1 ; <i1> [#uses=1]
+ br i1 %tmp13.i264, label %bb16.i267, label %bb30.i279
+bb16.i267: ; preds = %bb11.i265
+ br label %bb590
+bb30.i279: ; preds = %bb11.i265
+ br label %bb590
+bb590: ; preds = %bb30.i279, %bb16.i267
+ %tmp5876282.reg2mem.0 = phi %struct.ATOM* [ null, %bb30.i279 ], [ null, %bb16.i267 ] ; <%struct.ATOM*> [#uses=1]
+ %tmp589.reg2mem.0 = add i32 %i.1.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp593 = icmp slt i32 %tmp589.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp593, label %bb11.i265, label %bb596
+bb596: ; preds = %bb590, %bb11.i249
+ %ap.0.reg2mem.0 = phi %struct.ATOM* [ null, %bb11.i249 ], [ %tmp5876282.reg2mem.0, %bb590 ] ; <%struct.ATOM*> [#uses=0]
+ ret i32 0
+bb600: ; preds = %bb574
+ ret i32 0
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll b/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll
new file mode 100644
index 000000000000..5809918acffe
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll
@@ -0,0 +1,40 @@
+; RUN: llvm-as < %s | opt -loop-index-split -stats -disable-output | not grep "loop-index-split"
+;PR2294
+@g_2 = external global i16 ; <i16*> [#uses=4]
+@g_5 = external global i32 ; <i32*> [#uses=1]
+@.str = external constant [4 x i8] ; <[4 x i8]*> [#uses=1]
+
+declare void @func_1() nounwind
+
+define i32 @main() nounwind {
+entry:
+ %tmp101.i = load i16* @g_2, align 2 ; <i16> [#uses=1]
+ %tmp112.i = icmp sgt i16 %tmp101.i, 0 ; <i1> [#uses=1]
+ br i1 %tmp112.i, label %bb.preheader.i, label %func_1.exit
+bb.preheader.i: ; preds = %entry
+ %g_2.promoted.i = load i16* @g_2 ; <i16> [#uses=1]
+ br label %bb.i
+bb.i: ; preds = %bb6.i, %bb.preheader.i
+ %g_2.tmp.0.i = phi i16 [ %g_2.promoted.i, %bb.preheader.i ], [ %tmp8.i, %bb6.i ] ; <i16> [#uses=2]
+ %tmp2.i = icmp eq i16 %g_2.tmp.0.i, 0 ; <i1> [#uses=1]
+ br i1 %tmp2.i, label %bb4.i, label %bb6.i
+bb4.i: ; preds = %bb.i
+ %tmp5.i = volatile load i32* @g_5, align 4 ; <i32> [#uses=0]
+ br label %bb6.i
+bb6.i: ; preds = %bb4.i, %bb.i
+ %tmp8.i = add i16 %g_2.tmp.0.i, 1 ; <i16> [#uses=3]
+ %tmp11.i = icmp sgt i16 %tmp8.i, 42 ; <i1> [#uses=1]
+ br i1 %tmp11.i, label %bb.i, label %return.loopexit.i
+return.loopexit.i: ; preds = %bb6.i
+ %tmp8.i.lcssa = phi i16 [ %tmp8.i, %bb6.i ] ; <i16> [#uses=1]
+ store i16 %tmp8.i.lcssa, i16* @g_2
+ br label %func_1.exit
+func_1.exit: ; preds = %return.loopexit.i, %entry
+ %tmp1 = load i16* @g_2, align 2 ; <i16> [#uses=1]
+ %tmp12 = sext i16 %tmp1 to i32 ; <i32> [#uses=1]
+ %tmp3 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %tmp12 ) nounwind ; <i32> [#uses=0]
+ ret i32 0
+}
+
+declare i32 @printf(i8*, ...) nounwind
+
diff --git a/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll b/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll
new file mode 100644
index 000000000000..1f6876c8d29d
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -loop-rotate -loop-unswitch -loop-index-split -instcombine -disable-output
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9"
+ %struct.__CFData = type opaque
+ %struct.__CFString = type opaque
+
+define %struct.__CFData* @WirelessCreatePSK(%struct.__CFString* %inPassphrase, %struct.__CFData* %inSSID) nounwind {
+entry:
+ br label %bb52
+
+bb52: ; preds = %bb142, %bb52, %entry
+ br i1 false, label %bb142, label %bb52
+
+bb63: ; preds = %bb142, %bb131
+ %t.0.reg2mem.0 = phi i32 [ %tmp133, %bb131 ], [ 0, %bb142 ] ; <i32> [#uses=2]
+ %tmp65 = icmp ult i32 %t.0.reg2mem.0, 16 ; <i1> [#uses=1]
+ br i1 %tmp65, label %bb68, label %bb89
+
+bb68: ; preds = %bb63
+ br label %bb131
+
+bb89: ; preds = %bb63
+ br label %bb131
+
+bb131: ; preds = %bb89, %bb68
+ %tmp133 = add i32 %t.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %tmp136 = icmp ult i32 %tmp133, 80 ; <i1> [#uses=1]
+ br i1 %tmp136, label %bb63, label %bb142
+
+bb142: ; preds = %bb131, %bb52
+ br i1 undef, label %bb63, label %bb52
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll b/test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll
new file mode 100644
index 000000000000..7592511a290d
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-07-08-MisCompilation.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -loop-index-split -stats -disable-output | not grep "1 loop-index-split"
+; PR 2487
+@g_6 = external global i32 ; <i32*> [#uses=1]
+
+define void @func_1() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb4, %entry
+ %l_3.0 = phi i8 [ 0, %entry ], [ %tmp6, %bb4 ] ; <i8> [#uses=2]
+ %tmp1 = icmp eq i8 %l_3.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp1, label %bb3, label %bb4
+
+bb3: ; preds = %bb
+ store i32 1, i32* @g_6, align 4
+ br label %bb4
+
+bb4: ; preds = %bb3, %bb
+ %tmp6 = add i8 %l_3.0, 1 ; <i8> [#uses=2]
+ %tmp9 = icmp sgt i8 %tmp6, -1 ; <i1> [#uses=1]
+ br i1 %tmp9, label %bb, label %return
+
+return: ; preds = %bb4
+ ret void
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll b/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll
new file mode 100644
index 000000000000..a7a7cc23fefd
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll
@@ -0,0 +1,78 @@
+; RUN: llvm-as < %s | opt -loop-index-split -stats -disable-output | not grep "loop-index-split"
+; PR 2791
+@g_40 = common global i32 0 ; <i32*> [#uses=1]
+@g_192 = common global i32 0 ; <i32*> [#uses=2]
+@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define void @func_29() nounwind {
+entry:
+ %0 = load i32* @g_40, align 4 ; <i32> [#uses=1]
+ %1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
+ %g_192.promoted = load i32* @g_192 ; <i32> [#uses=0]
+ br i1 %1, label %entry.split.us, label %entry.split
+
+entry.split.us: ; preds = %entry
+ br label %bb.us
+
+bb.us: ; preds = %bb5.us, %entry.split.us
+ %i.0.reg2mem.0.us = phi i32 [ 0, %entry.split.us ], [ %3, %bb5.us ] ; <i32> [#uses=2]
+ %2 = icmp eq i32 %i.0.reg2mem.0.us, 0 ; <i1> [#uses=1]
+ br i1 %2, label %bb1.us, label %bb5.us
+
+bb5.us: ; preds = %bb1.us, %bb4.us, %bb.us
+ %iftmp.0.0.us = phi i32 [ 0, %bb4.us ], [ 1, %bb.us ], [ 1, %bb1.us ] ; <i32> [#uses=1]
+ %3 = add i32 %i.0.reg2mem.0.us, 1 ; <i32> [#uses=3]
+ %4 = icmp ult i32 %3, 10 ; <i1> [#uses=1]
+ br i1 %4, label %bb.us, label %bb8.us
+
+bb4.us: ; preds = %bb1.us
+ br label %bb5.us
+
+bb1.us: ; preds = %bb.us
+ br i1 true, label %bb4.us, label %bb5.us
+
+bb8.us: ; preds = %bb5.us
+ %iftmp.0.0.lcssa.us = phi i32 [ %iftmp.0.0.us, %bb5.us ] ; <i32> [#uses=1]
+ %.lcssa.us = phi i32 [ %3, %bb5.us ] ; <i32> [#uses=1]
+ br label %bb8.split
+
+entry.split: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb5, %entry.split
+ %i.0.reg2mem.0 = phi i32 [ 0, %entry.split ], [ %6, %bb5 ] ; <i32> [#uses=2]
+ %5 = icmp eq i32 %i.0.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %5, label %bb1, label %bb5
+
+bb1: ; preds = %bb
+ br i1 false, label %bb4, label %bb5
+
+bb4: ; preds = %bb1
+ br label %bb5
+
+bb5: ; preds = %bb1, %bb, %bb4
+ %iftmp.0.0 = phi i32 [ 0, %bb4 ], [ 1, %bb ], [ 1, %bb1 ] ; <i32> [#uses=1]
+ %6 = add i32 %i.0.reg2mem.0, 1 ; <i32> [#uses=3]
+ %7 = icmp ult i32 %6, 10 ; <i1> [#uses=1]
+ br i1 %7, label %bb, label %bb8
+
+bb8: ; preds = %bb5
+ %iftmp.0.0.lcssa = phi i32 [ %iftmp.0.0, %bb5 ] ; <i32> [#uses=1]
+ %.lcssa = phi i32 [ %6, %bb5 ] ; <i32> [#uses=1]
+ br label %bb8.split
+
+bb8.split: ; preds = %bb8.us, %bb8
+ %iftmp.0.0.lcssa.us-lcssa = phi i32 [ %iftmp.0.0.lcssa, %bb8 ], [ %iftmp.0.0.lcssa.us, %bb8.us ] ; <i32> [#uses=1]
+ %.lcssa.us-lcssa = phi i32 [ %.lcssa, %bb8 ], [ %.lcssa.us, %bb8.us ] ; <i32> [#uses=1]
+ store i32 %iftmp.0.0.lcssa.us-lcssa, i32* @g_192
+ %8 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %.lcssa.us-lcssa ) nounwind ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @printf(i8*, ...) nounwind
+
+define i32 @main() nounwind {
+entry:
+ call void @func_29( ) nounwind
+ ret i32 0
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll b/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll
new file mode 100644
index 000000000000..f66edcd062e2
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; PR 2805
+@g_330 = common global i32 0 ; <i32*> [#uses=1]
+
+define i32 @func_45(i32 %p_47) nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb3, %entry
+ %p_47_addr.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %2, %bb3 ] ; <i32> [#uses=2]
+ %0 = icmp eq i32 %p_47_addr.0.reg2mem.0, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb2, label %bb1
+
+bb1: ; preds = %bb
+ %1 = tail call i32 (...)* @func_70( i32 1 ) nounwind ; <i32> [#uses=0]
+ br label %bb3
+
+bb2: ; preds = %bb
+ store i32 1, i32* @g_330, align 4
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb1
+ %2 = add i32 %p_47_addr.0.reg2mem.0, 1 ; <i32> [#uses=3]
+ %3 = icmp ult i32 %2, 22 ; <i1> [#uses=1]
+ br i1 %3, label %bb, label %bb6
+
+bb6: ; preds = %bb3
+ %.lcssa = phi i32 [ %2, %bb3 ] ; <i32> [#uses=1]
+ %4 = tail call i32 (...)* @func_95( i32 %.lcssa ) nounwind ; <i32> [#uses=1]
+ %5 = tail call i32 (...)* @func_56( i32 %4 ) nounwind ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @func_70(...)
+
+declare i32 @func_95(...)
+
+declare i32 @func_56(...)
diff --git a/test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll b/test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll
new file mode 100644
index 000000000000..b477b73cc37a
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-10-06-Crash.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+ %struct.RExC_state_t = type { i32, i8*, %struct.regexp*, i8*, i8*, i8*, i32, %struct.regnode*, %struct.regnode*, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.SV = type { i8*, i32, i32 }
+ %struct.reg_data = type { i32, i8*, [1 x i8*] }
+ %struct.reg_substr_data = type { [3 x %struct.reg_substr_datum] }
+ %struct.reg_substr_datum = type { i32, i32, %struct.SV*, %struct.SV* }
+ %struct.regexp = type { i32*, i32*, %struct.regnode*, %struct.reg_substr_data*, i8*, %struct.reg_data*, i8*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, [1 x %struct.regnode] }
+ %struct.regnode = type { i8, i8, i16 }
+
+define fastcc %struct.regnode* @S_regclass(%struct.RExC_state_t* %pRExC_state) nounwind {
+entry:
+ br label %bb439
+
+bb439: ; preds = %bb444, %entry
+ %value23.16.reg2mem.0 = phi i32 [ %3, %bb444 ], [ 0, %entry ] ; <i32> [#uses=3]
+ %0 = icmp ugt i32 %value23.16.reg2mem.0, 31 ; <i1> [#uses=1]
+ %1 = icmp ne i32 %value23.16.reg2mem.0, 127 ; <i1> [#uses=1]
+ %2 = and i1 %0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %bb443, label %bb444
+
+bb443: ; preds = %bb439
+ br label %bb444
+
+bb444: ; preds = %bb443, %bb439
+ %3 = add i32 %value23.16.reg2mem.0, 1 ; <i32> [#uses=2]
+ %4 = icmp ugt i32 %3, 255 ; <i1> [#uses=1]
+ br i1 %4, label %bb675, label %bb439
+
+bb675: ; preds = %bb444
+ unreachable
+}
diff --git a/test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll b/test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll
new file mode 100644
index 000000000000..417f0917eda1
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-10-10-OneIteration.ll
@@ -0,0 +1,66 @@
+; RUN: llvm-as < %s | opt -loop-index-split -stats -disable-output |& grep "1 loop-index-split"
+; PR 2869
+
+@w = external global [2 x [2 x i32]] ; <[2 x [2 x i32]]*> [#uses=5]
+
+declare i32 @f() nounwind
+
+define i32 @main() noreturn nounwind {
+entry:
+ br label %bb1.i.outer
+
+bb1.i.outer: ; preds = %bb5.i, %entry
+ %i.0.reg2mem.0.ph.i.ph = phi i32 [ 0, %entry ], [ %indvar.next1, %bb5.i ] ; <i32> [#uses=3]
+ br label %bb1.i
+
+bb1.i: ; preds = %bb3.i, %bb1.i.outer
+ %j.0.reg2mem.0.i = phi i32 [ 0, %bb1.i.outer ], [ %indvar.next, %bb3.i ] ; <i32> [#uses=3]
+ %0 = icmp eq i32 %i.0.reg2mem.0.ph.i.ph, %j.0.reg2mem.0.i ; <i1> [#uses=1]
+ br i1 %0, label %bb2.i, label %bb3.i
+
+bb2.i: ; preds = %bb1.i
+ %1 = getelementptr [2 x [2 x i32]]* @w, i32 0, i32 %i.0.reg2mem.0.ph.i.ph, i32 %j.0.reg2mem.0.i ; <i32*> [#uses=1]
+ store i32 1, i32* %1, align 4
+ br label %bb3.i
+
+bb3.i: ; preds = %bb2.i, %bb1.i
+ %indvar.next = add i32 %j.0.reg2mem.0.i, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, 2 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb5.i, label %bb1.i
+
+bb5.i: ; preds = %bb3.i
+ %indvar.next1 = add i32 %i.0.reg2mem.0.ph.i.ph, 1 ; <i32> [#uses=2]
+ %exitcond2 = icmp eq i32 %indvar.next1, 2 ; <i1> [#uses=1]
+ br i1 %exitcond2, label %f.exit, label %bb1.i.outer
+
+f.exit: ; preds = %bb5.i
+ %2 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 0, i32 0), align 4 ; <i32> [#uses=1]
+ %3 = icmp eq i32 %2, 1 ; <i1> [#uses=1]
+ br i1 %3, label %bb, label %bb3
+
+bb: ; preds = %f.exit
+ %4 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 1, i32 1), align 4 ; <i32> [#uses=1]
+ %5 = icmp eq i32 %4, 1 ; <i1> [#uses=1]
+ br i1 %5, label %bb1, label %bb3
+
+bb1: ; preds = %bb
+ %6 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 1, i32 0), align 4 ; <i32> [#uses=1]
+ %7 = icmp eq i32 %6, 0 ; <i1> [#uses=1]
+ br i1 %7, label %bb2, label %bb3
+
+bb2: ; preds = %bb1
+ %8 = load i32* getelementptr ([2 x [2 x i32]]* @w, i32 0, i32 0, i32 1), align 4 ; <i32> [#uses=1]
+ %9 = icmp eq i32 %8, 0 ; <i1> [#uses=1]
+ br i1 %9, label %bb4, label %bb3
+
+bb3: ; preds = %bb2, %bb1, %bb, %f.exit
+ tail call void @abort() noreturn nounwind
+ unreachable
+
+bb4: ; preds = %bb2
+ ret i32 0
+}
+
+declare void @abort() noreturn nounwind
+
+declare void @exit(i32) noreturn nounwind
diff --git a/test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll b/test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll
new file mode 100644
index 000000000000..11ee0f5c4527
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2008-11-10-Sign.ll
@@ -0,0 +1,69 @@
+; RUN: llvm-as < %s | opt -loop-index-split -stats | not grep "loop-index-split"
+; PR3029
+
+@g_138 = common global i32 0 ; <i32*> [#uses=3]
+@g_188 = common global i32 0 ; <i32*> [#uses=4]
+@g_207 = common global i32 0 ; <i32*> [#uses=3]
+@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+@g_102 = common global i32 0 ; <i32*> [#uses=0]
+
+define i32 @func_119() nounwind {
+entry:
+ %0 = volatile load i32* @g_138, align 4 ; <i32> [#uses=1]
+ ret i32 %0
+}
+
+define void @func_110(i32 %p_111) nounwind {
+entry:
+ %0 = load i32* @g_188, align 4 ; <i32> [#uses=1]
+ %1 = icmp ugt i32 %0, -1572397472 ; <i1> [#uses=1]
+ br i1 %1, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %2 = volatile load i32* @g_138, align 4 ; <i32> [#uses=0]
+ ret void
+
+bb1: ; preds = %entry
+ store i32 1, i32* @g_207, align 4
+ ret void
+}
+
+define void @func_34() nounwind {
+entry:
+ store i32 0, i32* @g_188
+ %g_188.promoted = load i32* @g_188 ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %func_110.exit, %entry
+ %g_188.tmp.0 = phi i32 [ %g_188.promoted, %entry ], [ %2, %func_110.exit ] ; <i32> [#uses=2]
+ %0 = icmp ugt i32 %g_188.tmp.0, -1572397472 ; <i1> [#uses=1]
+ br i1 %0, label %bb.i, label %bb1.i
+
+bb.i: ; preds = %bb
+ %1 = volatile load i32* @g_138, align 4 ; <i32> [#uses=0]
+ br label %func_110.exit
+
+bb1.i: ; preds = %bb
+ store i32 1, i32* @g_207, align 4
+ br label %func_110.exit
+
+func_110.exit: ; preds = %bb.i, %bb1.i
+ %2 = add i32 %g_188.tmp.0, 1 ; <i32> [#uses=3]
+ %3 = icmp sgt i32 %2, 1 ; <i1> [#uses=1]
+ br i1 %3, label %return, label %bb
+
+return: ; preds = %func_110.exit
+ %.lcssa = phi i32 [ %2, %func_110.exit ] ; <i32> [#uses=1]
+ store i32 %.lcssa, i32* @g_188
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ call void @func_34() nounwind
+ %0 = load i32* @g_207, align 4 ; <i32> [#uses=1]
+ %1 = call i32 (i8*, ...)* @printf(i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %0) nounwind ; <i32> [#uses=0]
+ ret i32 0
+}
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll b/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll
new file mode 100644
index 000000000000..73113e7b46f7
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll
@@ -0,0 +1,64 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+ %struct.CGPoint = type { double, double }
+ %struct.IBCFMutableDictionary = type { %struct.NSMutableArray, %struct.__CFDictionary*, %struct.NSSortDescriptor*, %struct.NSSortDescriptor* }
+ %struct.IBInspectorMode = type opaque
+ %struct.IBInspectorModeView = type { %struct.NSView, %struct.NSArray*, %struct.IBCFMutableDictionary*, %struct.IBInspectorMode*, %struct.IBInspectorMode*, %struct.IBInspectorMode*, %struct.objc_selector*, %struct.NSObject* }
+ %struct.NSArray = type { %struct.NSObject }
+ %struct.NSImage = type { %struct.NSObject, %struct.NSArray*, %struct.CGPoint, %struct.__imageFlags, %struct.NSObject*, %struct._NSImageAuxiliary* }
+ %struct.NSMutableArray = type { %struct.NSArray }
+ %struct.NSObject = type { %struct.objc_class* }
+ %struct.NSRect = type { %struct.CGPoint, %struct.CGPoint }
+ %struct.NSResponder = type { %struct.NSObject, %struct.NSObject* }
+ %struct.NSSortDescriptor = type { %struct.NSObject, i64, %struct.NSArray*, %struct.objc_selector*, %struct.NSObject* }
+ %struct.NSURL = type { %struct.NSObject, %struct.NSArray*, %struct.NSURL*, i8*, i8* }
+ %struct.NSView = type { %struct.NSResponder, %struct.NSRect, %struct.NSRect, %struct.NSObject*, %struct.NSObject*, %struct.NSWindow*, %struct.NSObject*, %struct.NSObject*, %struct.NSObject*, %struct.NSObject*, %struct._NSViewAuxiliary*, %struct._VFlags, %struct.__VFlags2 }
+ %struct.NSWindow = type { %struct.NSResponder, %struct.NSRect, %struct.NSObject*, %struct.NSObject*, %struct.NSResponder*, %struct.NSView*, %struct.NSView*, %struct.NSObject*, %struct.NSObject*, i32, i64, i32, %struct.NSArray*, %struct.NSObject*, i8, i8, i8, i8, i8*, i8*, %struct.NSImage*, i32, %struct.NSMutableArray*, %struct.NSURL*, %struct.CGPoint*, %struct.NSArray*, %struct.NSArray*, %struct.__wFlags, %struct.NSObject*, %struct.NSView*, %struct.NSWindowAuxiliary* }
+ %struct.NSWindowAuxiliary = type opaque
+ %struct._NSImageAuxiliary = type opaque
+ %struct._NSViewAuxiliary = type opaque
+ %struct._VFlags = type <{ i8, i8, i8, i8 }>
+ %struct.__CFDictionary = type opaque
+ %struct.__VFlags2 = type <{ i32 }>
+ %struct.__imageFlags = type <{ i8, [3 x i8] }>
+ %struct.__wFlags = type <{ i8, i8, i8, i8, i8, i8, i8, i8 }>
+ %struct.objc_class = type opaque
+ %struct.objc_selector = type opaque
+
+define %struct.NSArray* @"\01-[IBInspectorModeView calculateModeRects]"(%struct.IBInspectorModeView* %self, %struct.objc_selector* %_cmd) optsize ssp {
+entry:
+ br i1 false, label %bb7, label %bb
+
+bb: ; preds = %entry
+ br i1 false, label %bb.nph, label %bb7.loopexit
+
+bb.nph: ; preds = %bb
+ br label %bb1
+
+bb1: ; preds = %bb6, %bb.nph
+ %midx.01 = phi i64 [ %3, %bb6 ], [ 0, %bb.nph ] ; <i64> [#uses=3]
+ %0 = icmp sge i64 %midx.01, 0 ; <i1> [#uses=1]
+ %1 = icmp sle i64 %midx.01, 0 ; <i1> [#uses=1]
+ %2 = and i1 %0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %bb4, label %bb5
+
+bb4: ; preds = %bb1
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb1
+ %modeWidth.0 = phi double [ 0.000000e+00, %bb1 ], [ 0.000000e+00, %bb4 ] ; <double> [#uses=0]
+ %3 = add i64 %midx.01, 1 ; <i64> [#uses=1]
+ br label %bb6
+
+bb6: ; preds = %bb5
+ %4 = icmp slt i64 0, 0 ; <i1> [#uses=1]
+ br i1 %4, label %bb1, label %bb6.bb7.loopexit_crit_edge
+
+bb6.bb7.loopexit_crit_edge: ; preds = %bb6
+ br label %bb7.loopexit
+
+bb7.loopexit: ; preds = %bb6.bb7.loopexit_crit_edge, %bb
+ br label %bb7
+
+bb7: ; preds = %bb7.loopexit, %entry
+ ret %struct.NSArray* null
+}
diff --git a/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll b/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll
new file mode 100644
index 000000000000..b34cb51c332e
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep undef
+define i32 @main() {
+entry:
+ br label %header
+
+header:
+ %r = phi i32 [ 0, %entry ], [ %r3, %skip ]
+ %i = phi i32 [ 0, %entry ], [ %i1, %skip ]
+ %i99 = add i32 %i, 99
+ %cond = icmp eq i32 %i99, 3
+ br i1 %cond, label %body, label %skip
+
+body:
+ br label %skip
+
+skip:
+ %r3 = phi i32 [ %r, %header ], [ 3, %body ]
+ %i1 = add i32 %i, 1
+ %exitcond = icmp eq i32 %i1, 10
+ br i1 %exitcond, label %exit, label %header
+
+exit:
+ ret i32 %r3
+}
diff --git a/test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll b/test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll
new file mode 100644
index 000000000000..d77f55a60aea
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/Crash-2007-08-17.ll
@@ -0,0 +1,52 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+
+ %struct._edit_script = type { %struct._edit_script*, i32, i8 }
+
+define void @align_path(i8* %seq1, i8* %seq2, i32 %i1, i32 %j1, i32 %i2, i32 %j2, i32 %dist, %struct._edit_script** %head, %struct._edit_script** %tail, i32 %M, i32 %N) {
+entry:
+ br label %bb354
+
+bb354: ; preds = %bb511, %entry
+ br i1 false, label %bb495, label %bb368
+
+bb368: ; preds = %bb354
+ ret void
+
+bb495: ; preds = %bb495, %bb354
+ br i1 false, label %bb511, label %bb495
+
+bb511: ; preds = %bb495
+ br i1 false, label %xmalloc.exit69, label %bb354
+
+xmalloc.exit69: ; preds = %bb511
+ br i1 false, label %bb556, label %bb542.preheader
+
+bb542.preheader: ; preds = %xmalloc.exit69
+ ret void
+
+bb556: ; preds = %xmalloc.exit69
+ br label %bb583
+
+bb583: ; preds = %cond_next693, %bb556
+ %k.4342.0 = phi i32 [ %tmp707, %cond_next693 ], [ 0, %bb556 ] ; <i32> [#uses=2]
+ %tmp586 = icmp eq i32 %k.4342.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp586, label %cond_true589, label %cond_false608
+
+cond_true589: ; preds = %bb583
+ br label %cond_next693
+
+cond_false608: ; preds = %bb583
+ br i1 false, label %cond_next661, label %cond_next693
+
+cond_next661: ; preds = %cond_false608
+ br label %cond_next693
+
+cond_next693: ; preds = %cond_next661, %cond_false608, %cond_true589
+ %tmp705 = getelementptr i32* null, i32 0 ; <i32*> [#uses=0]
+ %tmp707 = add i32 %k.4342.0, 1 ; <i32> [#uses=2]
+ %tmp711 = icmp sgt i32 %tmp707, 0 ; <i1> [#uses=1]
+ br i1 %tmp711, label %bb726.preheader, label %bb583
+
+bb726.preheader: ; preds = %cond_next693
+ ret void
+}
diff --git a/test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll b/test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll
new file mode 100644
index 000000000000..4b2cffd79860
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/Crash-2007-12-03.ll
@@ -0,0 +1,44 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+; PR1828.bc
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+ %RPyOpaque_RuntimeTypeInfo = type opaque*
+ %arraytype_Char_1 = type { i32, [0 x i8] }
+ %arraytype_Signed = type { i32, [0 x i32] }
+ %functiontype_11 = type %structtype_object* ()
+ %functiontype_360 = type %structtype_rpy_string* (%structtype_pypy.rlib.rbigint.rbigint*, %structtype_rpy_string*, %structtype_rpy_string*, %structtype_rpy_string*)
+ %structtype_list_18 = type { i32, %arraytype_Signed* }
+ %structtype_object = type { %structtype_object_vtable* }
+ %structtype_object_vtable = type { i32, i32, %RPyOpaque_RuntimeTypeInfo*, %arraytype_Char_1*, %functiontype_11* }
+ %structtype_pypy.rlib.rbigint.rbigint = type { %structtype_object, %structtype_list_18*, i32 }
+ %structtype_rpy_string = type { i32, %arraytype_Char_1 }
+
+define fastcc %structtype_rpy_string* @pypy__format(%structtype_pypy.rlib.rbigint.rbigint* %a_1, %structtype_rpy_string* %digits_0, %structtype_rpy_string* %prefix_3, %structtype_rpy_string* %suffix_0) {
+block0:
+ br i1 false, label %block67, label %block13
+
+block13: ; preds = %block0
+ ret %structtype_rpy_string* null
+
+block31: ; preds = %block67, %block44
+ ret %structtype_rpy_string* null
+
+block42: ; preds = %block67, %block44
+ %j_167.reg2mem.0 = phi i32 [ %v63822, %block44 ], [ 0, %block67 ] ; <i32> [#uses=1]
+ %v63822 = add i32 %j_167.reg2mem.0, -1 ; <i32> [#uses=3]
+ %v63823 = icmp slt i32 %v63822, 0 ; <i1> [#uses=1]
+ br i1 %v63823, label %block46, label %block43
+
+block43: ; preds = %block42
+ br label %block44
+
+block44: ; preds = %block46, %block43
+ %v6377959 = icmp sgt i32 %v63822, 0 ; <i1> [#uses=1]
+ br i1 %v6377959, label %block42, label %block31
+
+block46: ; preds = %block42
+ br label %block44
+
+block67: ; preds = %block0
+ br i1 false, label %block42, label %block31
+}
diff --git a/test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll b/test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll
new file mode 100644
index 000000000000..241b7dc188d6
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/Crash2-2007-08-17.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+
+ %struct._edit_script = type { %struct._edit_script*, i32, i8 }
+
+define void @align_path(i8* %seq1, i8* %seq2, i32 %i1, i32 %j1, i32 %i2, i32 %j2, i32 %dist, %struct._edit_script** %head, %struct._edit_script** %tail, i32 %M, i32 %N) {
+entry:
+ br label %bb354
+
+bb354: ; preds = %bb511, %entry
+ br i1 false, label %bb495, label %bb368
+
+bb368: ; preds = %bb354
+ ret void
+
+bb495: ; preds = %bb495, %bb354
+ br i1 false, label %bb511, label %bb495
+
+bb511: ; preds = %bb495
+ br i1 false, label %xmalloc.exit69, label %bb354
+
+xmalloc.exit69: ; preds = %bb511
+ br i1 false, label %bb556, label %bb542.preheader
+
+bb542.preheader: ; preds = %xmalloc.exit69
+ ret void
+
+bb556: ; preds = %xmalloc.exit69
+ br label %bb583
+
+bb583: ; preds = %cond_next693, %bb556
+ %k.4342.0 = phi i32 [ %tmp707, %cond_next693 ], [ 0, %bb556 ] ; <i32> [#uses=2]
+ %tmp586 = icmp eq i32 %k.4342.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp586, label %cond_true589, label %cond_false608
+
+cond_true589: ; preds = %bb583
+ br label %cond_next693
+
+cond_false608: ; preds = %bb583
+ br i1 false, label %bb645, label %cond_next693
+
+bb645: ; preds = %cond_false608
+ br i1 false, label %bb684, label %cond_next661
+
+cond_next661: ; preds = %bb645
+ br i1 false, label %bb684, label %cond_next693
+
+bb684: ; preds = %cond_next661, %bb645
+ br label %cond_next693
+
+cond_next693: ; preds = %bb684, %cond_next661, %cond_false608, %cond_true589
+ %tmp705 = getelementptr i32* null, i32 0 ; <i32*> [#uses=0]
+ %tmp707 = add i32 %k.4342.0, 1 ; <i32> [#uses=2]
+ %tmp711 = icmp sgt i32 %tmp707, 0 ; <i1> [#uses=1]
+ br i1 %tmp711, label %bb726.preheader, label %bb583
+
+bb726.preheader: ; preds = %cond_next693
+ ret void
+}
diff --git a/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll b/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll
new file mode 100644
index 000000000000..9e79f483d9f3
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll
@@ -0,0 +1,50 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+
+@k = external global i32 ; <i32*> [#uses=2]
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+ br label %bb
+
+bb: ; preds = %cond_next16, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5]
+ %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3]
+ %tmp1 = icmp slt i32 %i.01.0, 50 ; <i1> [#uses=1]
+ br i1 %tmp1, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+ %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2]
+ %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1]
+ br i1 %tmp1015, label %cond_next16, label %cond_true13
+
+cond_false: ; preds = %bb
+ %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1]
+ br i1 %tmp10, label %cond_next16, label %cond_true13
+
+cond_true13: ; preds = %cond_false, %cond_true
+ %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1]
+ %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ br label %cond_next16
+
+cond_next16: ; preds = %cond_false, %cond_true, %cond_true13
+ %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2]
+ %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
+ %tmp21 = icmp eq i32 %tmp18, 100 ; <i1> [#uses=1]
+ br i1 %tmp21, label %bb, label %bb24
+
+bb24: ; preds = %cond_next16
+ %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1]
+ %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1]
+ %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @foo(i32)
+
+declare i32 @bar(i32)
+
+declare i32 @t(i32, i32)
diff --git a/test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll b/test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll
new file mode 100644
index 000000000000..e98f699d7f6f
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/OneIterLoop-2007-08-17.ll
@@ -0,0 +1,67 @@
+; Loop is elimianted
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: grep "loop-index-split" | count 1
+ %struct.anon = type { i32 }
+@S1 = external global i32 ; <i32*> [#uses=1]
+@W1 = external global i32 ; <i32*> [#uses=1]
+@Y = weak global [100 x %struct.anon] zeroinitializer, align 32 ; <[100 x %struct.anon]*> [#uses=1]
+@ti = external global i32 ; <i32*> [#uses=1]
+@T2 = external global [100 x [100 x i32]] ; <[100 x [100 x i32]]*> [#uses=1]
+@d = external global i32 ; <i32*> [#uses=1]
+@T1 = external global i32 ; <i32*> [#uses=2]
+@N2 = external global i32 ; <i32*> [#uses=2]
+
+define void @foo() {
+entry:
+ %tmp = load i32* @S1, align 4 ; <i32> [#uses=4]
+ %tmp266 = load i32* @N2, align 4 ; <i32> [#uses=1]
+ %tmp288 = icmp ult i32 %tmp, %tmp266 ; <i1> [#uses=1]
+ br i1 %tmp288, label %bb.preheader, label %return
+
+bb.preheader: ; preds = %entry
+ %tmp1 = load i32* @W1, align 4 ; <i32> [#uses=1]
+ %tmp13 = load i32* @ti, align 4 ; <i32> [#uses=1]
+ %tmp18 = load i32* @d, align 4 ; <i32> [#uses=1]
+ %tmp26 = load i32* @N2, align 4 ; <i32> [#uses=2]
+ %T1.promoted = load i32* @T1 ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmp, 1 ; <i32> [#uses=2]
+ %tmp4 = icmp ugt i32 %tmp2, %tmp26 ; <i1> [#uses=1]
+ %umax = select i1 %tmp4, i32 %tmp2, i32 %tmp26 ; <i32> [#uses=1]
+ %tmp5 = sub i32 0, %tmp ; <i32> [#uses=1]
+ %tmp6 = add i32 %umax, %tmp5 ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb25, %bb.preheader
+ %indvar = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb25 ] ; <i32> [#uses=2]
+ %T1.tmp.1 = phi i32 [ %T1.promoted, %bb.preheader ], [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=3]
+ %tj.01.0 = add i32 %indvar, %tmp ; <i32> [#uses=3]
+ %tmp3 = icmp eq i32 %tj.01.0, %tmp1 ; <i1> [#uses=1]
+ br i1 %tmp3, label %cond_true, label %bb25
+
+cond_true: ; preds = %bb
+ %tmp7 = getelementptr [100 x %struct.anon]* @Y, i32 0, i32 %tj.01.0, i32 0 ; <i32*> [#uses=1]
+ %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1]
+ %tmp9 = icmp sgt i32 %tmp8, 0 ; <i1> [#uses=1]
+ br i1 %tmp9, label %cond_true12, label %bb25
+
+cond_true12: ; preds = %cond_true
+ %tmp16 = getelementptr [100 x [100 x i32]]* @T2, i32 0, i32 %tmp13, i32 %tj.01.0 ; <i32*> [#uses=1]
+ %tmp17 = load i32* %tmp16, align 4 ; <i32> [#uses=1]
+ %tmp19 = mul i32 %tmp18, %tmp17 ; <i32> [#uses=1]
+ %tmp21 = add i32 %tmp19, %T1.tmp.1 ; <i32> [#uses=1]
+ br label %bb25
+
+bb25: ; preds = %cond_true12, %cond_true, %bb
+ %T1.tmp.0 = phi i32 [ %T1.tmp.1, %bb ], [ %T1.tmp.1, %cond_true ], [ %tmp21, %cond_true12 ] ; <i32> [#uses=2]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
+ %exitcond = icmp ne i32 %indvar.next, %tmp6 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb, label %return.loopexit
+
+return.loopexit: ; preds = %bb25
+ %T1.tmp.0.lcssa = phi i32 [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=1]
+ store i32 %T1.tmp.0.lcssa, i32* @T1
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
diff --git a/test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll b/test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll
new file mode 100644
index 000000000000..31332bd984a5
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/OneIterLoop2-2007-08-17.ll
@@ -0,0 +1,69 @@
+; Loop is elimianted. Save last value assignment.
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: grep "loop-index-split" | count 1
+
+ %struct.anon = type { i32 }
+@S1 = external global i32 ; <i32*> [#uses=1]
+@W1 = external global i32 ; <i32*> [#uses=1]
+@Y = weak global [100 x %struct.anon] zeroinitializer, align 32 ; <[100 x %struct.anon]*> [#uses=1]
+@ti = external global i32 ; <i32*> [#uses=1]
+@T2 = external global [100 x [100 x i32]] ; <[100 x [100 x i32]]*> [#uses=1]
+@d = external global i32 ; <i32*> [#uses=1]
+@T1 = external global i32 ; <i32*> [#uses=2]
+@N1 = external global i32 ; <i32*> [#uses=2]
+
+define void @foo() {
+entry:
+ %tmp = load i32* @S1, align 4 ; <i32> [#uses=4]
+ %tmp266 = load i32* @N1, align 4 ; <i32> [#uses=1]
+ %tmp288 = icmp ult i32 %tmp, %tmp266 ; <i1> [#uses=1]
+ br i1 %tmp288, label %bb.preheader, label %return
+
+bb.preheader: ; preds = %entry
+ %tmp1 = load i32* @W1, align 4 ; <i32> [#uses=1]
+ %tmp13 = load i32* @ti, align 4 ; <i32> [#uses=1]
+ %tmp18 = load i32* @d, align 4 ; <i32> [#uses=1]
+ %tmp26 = load i32* @N1, align 4 ; <i32> [#uses=2]
+ %T1.promoted = load i32* @T1 ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmp, 1 ; <i32> [#uses=2]
+ %tmp4 = icmp ugt i32 %tmp2, %tmp26 ; <i1> [#uses=1]
+ %umax = select i1 %tmp4, i32 %tmp2, i32 %tmp26 ; <i32> [#uses=1]
+ %tmp5 = sub i32 0, %tmp ; <i32> [#uses=1]
+ %tmp6 = add i32 %umax, %tmp5 ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb25, %bb.preheader
+ %indvar = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb25 ] ; <i32> [#uses=2]
+ %T1.tmp.1 = phi i32 [ %T1.promoted, %bb.preheader ], [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=3]
+ %tj.01.0 = add i32 %indvar, %tmp ; <i32> [#uses=3]
+ %tmp24 = add i32 %tj.01.0, 1 ; <i32> [#uses=1]
+ %tmp3 = icmp eq i32 %tmp24, %tmp1 ; <i1> [#uses=1]
+ br i1 %tmp3, label %cond_true, label %bb25
+
+cond_true: ; preds = %bb
+ %tmp7 = getelementptr [100 x %struct.anon]* @Y, i32 0, i32 %tj.01.0, i32 0 ; <i32*> [#uses=1]
+ %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1]
+ %tmp9 = icmp sgt i32 %tmp8, 0 ; <i1> [#uses=1]
+ br i1 %tmp9, label %cond_true12, label %bb25
+
+cond_true12: ; preds = %cond_true
+ %tmp16 = getelementptr [100 x [100 x i32]]* @T2, i32 0, i32 %tmp13, i32 %tj.01.0 ; <i32*> [#uses=1]
+ %tmp17 = load i32* %tmp16, align 4 ; <i32> [#uses=1]
+ %tmp19 = mul i32 %tmp18, %tmp17 ; <i32> [#uses=1]
+ %tmp21 = add i32 %tmp19, %T1.tmp.1 ; <i32> [#uses=1]
+ br label %bb25
+
+bb25: ; preds = %cond_true12, %cond_true, %bb
+ %T1.tmp.0 = phi i32 [ %T1.tmp.1, %bb ], [ %T1.tmp.1, %cond_true ], [ %tmp21, %cond_true12 ] ; <i32> [#uses=2]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
+ %exitcond = icmp ne i32 %indvar.next, %tmp6 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb, label %return.loopexit
+
+return.loopexit: ; preds = %bb25
+ %T1.tmp.0.lcssa = phi i32 [ %T1.tmp.0, %bb25 ] ; <i32> [#uses=1]
+ store i32 %T1.tmp.0.lcssa, i32* @T1
+ br label %return
+
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
diff --git a/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll b/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll
new file mode 100644
index 000000000000..bf568e57f24c
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll
@@ -0,0 +1,34 @@
+; Loop is elimianted. Save last value assignments, including induction variable.
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats | not grep "loop-index-split"
+
+declare i32 @foo(i32)
+declare i32 @bar(i32, i32)
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+ br label %bb
+
+bb: ; preds = %cond_next, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp8, %cond_next ] ; <i32> [#uses=3]
+ %tsum.16.0 = phi i32 [ 42, %entry ], [ %tsum.0, %cond_next ] ; <i32> [#uses=2]
+ %tmp1 = icmp eq i32 %i.01.0, 50 ; <i1> [#uses=1]
+ br i1 %tmp1, label %cond_true, label %cond_next
+
+cond_true: ; preds = %bb
+ %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp4, %tsum.16.0 ; <i32> [#uses=1]
+ br label %cond_next
+
+cond_next: ; preds = %bb, %cond_true
+ %tsum.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.16.0, %bb ] ; <i32> [#uses=2]
+ %tmp8 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
+ %tmp11 = icmp slt i32 %tmp8, 100 ; <i1> [#uses=1]
+ br i1 %tmp11, label %bb, label %bb14
+
+bb14: ; preds = %cond_next
+ %tmp8.lcssa = phi i32 [ %tmp8, %cond_next ] ; <i32> [#uses=1]
+ %tsum.0.lcssa = phi i32 [ %tsum.0, %cond_next ] ; <i32> [#uses=1]
+ %tmp17 = tail call i32 @bar( i32 %tmp8.lcssa, i32 %tsum.0.lcssa ) ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll b/test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll
new file mode 100644
index 000000000000..e19f22a6211c
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/SaveLastValue-2007-08-17.ll
@@ -0,0 +1,52 @@
+; Split loop. Save last value.
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: grep "loop-index-split" | count 1
+
+@k = external global i32 ; <i32*> [#uses=2]
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+ br label %bb
+
+bb: ; preds = %cond_next16, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5]
+ %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3]
+ %tmp1 = icmp slt i32 %i.01.0, 50 ; <i1> [#uses=1]
+ br i1 %tmp1, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+ %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2]
+ %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1]
+ br i1 %tmp1015, label %cond_next16, label %cond_true13
+
+cond_false: ; preds = %bb
+ %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1]
+ br i1 %tmp10, label %cond_next16, label %cond_true13
+
+cond_true13: ; preds = %cond_false, %cond_true
+ %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1]
+ %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ br label %cond_next16
+
+cond_next16: ; preds = %cond_false, %cond_true, %cond_true13
+ %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2]
+ %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
+ %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1]
+ br i1 %tmp21, label %bb, label %bb24
+
+bb24: ; preds = %cond_next16
+ %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1]
+ %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1]
+ %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @foo(i32)
+
+declare i32 @bar(i32)
+
+declare i32 @t(i32, i32)
diff --git a/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24-dbg.ll b/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24-dbg.ll
new file mode 100644
index 000000000000..3b237bb1f143
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24-dbg.ll
@@ -0,0 +1,71 @@
+; Split loop. Save last value. Split value is off by one in this example.
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: grep "loop-index-split" | count 1
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+
+@k = external global i32 ; <i32*> [#uses=2]
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+ br label %bb
+
+bb: ; preds = %cond_next16, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5]
+ %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3]
+ %tmp1 = icmp sgt i32 %i.01.0, 50 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp1, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+ %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2]
+ %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp1015, label %cond_next16, label %cond_true13
+
+cond_false: ; preds = %bb
+ %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp10, label %cond_next16, label %cond_true13
+
+cond_true13: ; preds = %cond_false, %cond_true
+ %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1]
+ %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %cond_next16
+
+cond_next16: ; preds = %cond_false, %cond_true, %cond_true13
+ %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2]
+ %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
+ %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp21, label %bb, label %bb24
+
+bb24: ; preds = %cond_next16
+ %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1]
+ %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1]
+ %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+}
+
+declare i32 @foo(i32)
+
+declare i32 @bar(i32)
+
+declare i32 @t(i32, i32)
diff --git a/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll b/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll
new file mode 100644
index 000000000000..27327a059cf9
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/SplitValue-2007-08-24.ll
@@ -0,0 +1,52 @@
+; Split loop. Save last value. Split value is off by one in this example.
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
+; RUN: grep "loop-index-split" | count 1
+
+@k = external global i32 ; <i32*> [#uses=2]
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+ br label %bb
+
+bb: ; preds = %cond_next16, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5]
+ %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3]
+ %tmp1 = icmp sgt i32 %i.01.0, 50 ; <i1> [#uses=1]
+ br i1 %tmp1, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+ %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2]
+ %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1]
+ br i1 %tmp1015, label %cond_next16, label %cond_true13
+
+cond_false: ; preds = %bb
+ %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1]
+ br i1 %tmp10, label %cond_next16, label %cond_true13
+
+cond_true13: ; preds = %cond_false, %cond_true
+ %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1]
+ %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ br label %cond_next16
+
+cond_next16: ; preds = %cond_false, %cond_true, %cond_true13
+ %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2]
+ %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
+ %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1]
+ br i1 %tmp21, label %bb, label %bb24
+
+bb24: ; preds = %cond_next16
+ %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1]
+ %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1]
+ %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @foo(i32)
+
+declare i32 @bar(i32)
+
+declare i32 @t(i32, i32)
diff --git a/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll b/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll
new file mode 100644
index 000000000000..c5064517dd1d
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/UpperBound-2007-08-24.ll
@@ -0,0 +1,52 @@
+; Split loop. Split value is a constant and greater then exit value.
+; Check whether optimizer inserts proper checkfor split value or not.
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | grep select
+
+@k = external global i32 ; <i32*> [#uses=2]
+
+define void @foobar(i32 %a, i32 %b) {
+entry:
+ br label %bb
+
+bb: ; preds = %cond_next16, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5]
+ %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3]
+ %tmp1 = icmp slt i32 %i.01.0, 500 ; <i1> [#uses=1]
+ br i1 %tmp1, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+ %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
+ %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2]
+ %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1]
+ br i1 %tmp1015, label %cond_next16, label %cond_true13
+
+cond_false: ; preds = %bb
+ %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1]
+ %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1]
+ br i1 %tmp10, label %cond_next16, label %cond_true13
+
+cond_true13: ; preds = %cond_false, %cond_true
+ %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1]
+ %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
+ br label %cond_next16
+
+cond_next16: ; preds = %cond_false, %cond_true, %cond_true13
+ %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2]
+ %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
+ %tmp21 = icmp slt i32 %tmp18, 100 ; <i1> [#uses=1]
+ br i1 %tmp21, label %bb, label %bb24
+
+bb24: ; preds = %cond_next16
+ %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1]
+ %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1]
+ %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @foo(i32)
+
+declare i32 @bar(i32)
+
+declare i32 @t(i32, i32)
diff --git a/test/Transforms/LoopIndexSplit/dg.exp b/test/Transforms/LoopIndexSplit/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopIndexSplit/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll b/test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll
new file mode 100644
index 000000000000..7cc3951b3cd1
--- /dev/null
+++ b/test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -loop-rotate | llvm-dis
+; PR3408
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }
+ %struct.Lit = type { i8 }
+
+define void @picosat_main_bb13.i.i71.outer_bb132.i.i.i.outer(%struct.Cls**, %struct.Cls**, i32 %collect.i.i.i.1.lcssa, i32 %lcollect.i.i.i.2.lcssa, %struct.Cls*** %rhead.tmp.0236.out, i32* %collect.i.i.i.2.out, i32* %lcollect.i.i.i.3.ph.ph.ph.out) nounwind {
+newFuncRoot:
+ br label %codeRepl
+
+bb133.i.i.i.exitStub: ; preds = %codeRepl
+ ret void
+
+bb130.i.i.i: ; preds = %codeRepl
+ %rhead.tmp.0236.lcssa82 = phi %struct.Cls** [ null, %codeRepl ] ; <%struct.Cls**> [#uses=0]
+ br label %codeRepl
+
+codeRepl: ; preds = %bb130.i.i.i, %newFuncRoot
+ br i1 false, label %bb130.i.i.i, label %bb133.i.i.i.exitStub
+}
diff --git a/test/Transforms/LoopRotate/LRCrash-1.ll b/test/Transforms/LoopRotate/LRCrash-1.ll
new file mode 100644
index 000000000000..e6c7667d5975
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-1.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+
+ %struct.relation = type { [4 x i16], i32, [4 x i16], i32, i32 }
+
+define void @findAllPairs() {
+entry:
+ br i1 false, label %bb139, label %bb10.i44
+bb10.i44: ; preds = %entry
+ ret void
+bb127: ; preds = %bb139
+ br label %bb139
+bb139: ; preds = %bb127, %entry
+ br i1 false, label %bb127, label %bb142
+bb142: ; preds = %bb139
+ %r91.0.lcssa = phi %struct.relation* [ null, %bb139 ] ; <%struct.relation*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-2.ll b/test/Transforms/LoopRotate/LRCrash-2.ll
new file mode 100644
index 000000000000..6dbe76df9eb3
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-2.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+
+define void @findAllPairs() {
+entry:
+ br i1 false, label %bb139, label %cond_true
+cond_true: ; preds = %entry
+ ret void
+bb90: ; preds = %bb139
+ br i1 false, label %bb136, label %cond_next121
+cond_next121: ; preds = %bb90
+ br i1 false, label %bb136, label %bb127
+bb127: ; preds = %cond_next121
+ br label %bb136
+bb136: ; preds = %bb127, %cond_next121, %bb90
+ %changes.1 = phi i32 [ %changes.2, %bb90 ], [ %changes.2, %cond_next121 ], [ 1, %bb127 ] ; <i32> [#uses=1]
+ br label %bb139
+bb139: ; preds = %bb136, %entry
+ %changes.2 = phi i32 [ %changes.1, %bb136 ], [ 0, %entry ] ; <i32> [#uses=3]
+ br i1 false, label %bb90, label %bb142
+bb142: ; preds = %bb139
+ %changes.2.lcssa = phi i32 [ %changes.2, %bb139 ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-3.ll b/test/Transforms/LoopRotate/LRCrash-3.ll
new file mode 100644
index 000000000000..94991a55b824
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-3.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+
+define void @_ZN9Classfile4readEv() {
+entry:
+ br i1 false, label %cond_false485, label %bb405
+bb405: ; preds = %entry
+ ret void
+cond_false485: ; preds = %entry
+ br label %bb830
+bb511: ; preds = %bb830
+ br i1 false, label %bb816, label %bb830
+cond_next667: ; preds = %bb816
+ br i1 false, label %cond_next695, label %bb680
+bb676: ; preds = %bb680
+ br label %bb680
+bb680: ; preds = %bb676, %cond_next667
+ %iftmp.68.0 = zext i1 false to i8 ; <i8> [#uses=1]
+ br i1 false, label %bb676, label %cond_next695
+cond_next695: ; preds = %bb680, %cond_next667
+ %iftmp.68.2 = phi i8 [ %iftmp.68.0, %bb680 ], [ undef, %cond_next667 ] ; <i8> [#uses=0]
+ ret void
+bb816: ; preds = %bb816, %bb511
+ br i1 false, label %cond_next667, label %bb816
+bb830: ; preds = %bb511, %cond_false485
+ br i1 false, label %bb511, label %bb835
+bb835: ; preds = %bb830
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-4.ll b/test/Transforms/LoopRotate/LRCrash-4.ll
new file mode 100644
index 000000000000..ab43fc88922c
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-4.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+
+define void @InterpretSEIMessage(i8* %msg) {
+entry:
+ br label %bb15
+bb6: ; preds = %bb15
+ %gep.upgrd.1 = zext i32 %offset.1 to i64 ; <i64> [#uses=1]
+ %tmp11 = getelementptr i8* %msg, i64 %gep.upgrd.1 ; <i8*> [#uses=0]
+ br label %bb15
+bb15: ; preds = %bb6, %entry
+ %offset.1 = add i32 0, 1 ; <i32> [#uses=2]
+ br i1 false, label %bb6, label %bb17
+bb17: ; preds = %bb15
+ %offset.1.lcssa = phi i32 [ %offset.1, %bb15 ] ; <i32> [#uses=0]
+ %payload_type.1.lcssa = phi i32 [ 0, %bb15 ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-5.ll b/test/Transforms/LoopRotate/LRCrash-5.ll
new file mode 100644
index 000000000000..d61e749d7ee4
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-5.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin9"
+ %struct.NSArray = type { %struct.NSObject }
+ %struct.NSObject = type { %struct.objc_class* }
+ %struct.NSRange = type { i64, i64 }
+ %struct._message_ref_t = type { %struct.NSObject* (%struct.NSObject*, %struct._message_ref_t*, ...)*, %struct.objc_selector* }
+ %struct.objc_class = type opaque
+ %struct.objc_selector = type opaque
+@"\01L_OBJC_MESSAGE_REF_26" = external global %struct._message_ref_t ; <%struct._message_ref_t*> [#uses=1]
+
+define %struct.NSArray* @"-[NSString(DocSetPrivateAddition) _dsa_stringAsPathComponent]"(%struct.NSArray* %self, %struct._message_ref_t* %_cmd) {
+entry:
+ br label %bb116
+
+bb116: ; preds = %bb131, %entry
+ %tmp123 = call %struct.NSRange null( %struct.NSObject* null, %struct._message_ref_t* @"\01L_OBJC_MESSAGE_REF_26", %struct.NSArray* null ) ; <%struct.NSRange> [#uses=1]
+ br i1 false, label %bb141, label %bb131
+
+bb131: ; preds = %bb116
+ %mrv_gr125 = getresult %struct.NSRange %tmp123, 1 ; <i64> [#uses=0]
+ br label %bb116
+
+bb141: ; preds = %bb116
+ ret %struct.NSArray* null
+}
diff --git a/test/Transforms/LoopRotate/PhiRename-1.ll b/test/Transforms/LoopRotate/PhiRename-1.ll
new file mode 100644
index 000000000000..573e3960bd86
--- /dev/null
+++ b/test/Transforms/LoopRotate/PhiRename-1.ll
@@ -0,0 +1,95 @@
+; RUN: llvm-as < %s | opt -loop-rotate | llvm-dis | not grep {\\\[ .tmp224}
+; END.
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+
+ %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.Index_Map = type { i32, %struct.item_set** }
+ %struct.Item = type { [4 x i16], %struct.rule* }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+ %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
+ %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
+ %struct.list = type { i8*, %struct.list* }
+ %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
+ %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
+ %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
+ %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
+ %struct.plank = type { i8*, %struct.list*, i32 }
+ %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
+ %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
+ %struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
+ %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
+@outfile = external global %struct.FILE* ; <%struct.FILE**> [#uses=1]
+@str1 = external constant [11 x i8] ; <[11 x i8]*> [#uses=1]
+@operators = weak global %struct.list* null ; <%struct.list**> [#uses=1]
+
+
+
+define i32 @opsOfArity(i32 %arity) {
+entry:
+ %arity_addr = alloca i32 ; <i32*> [#uses=2]
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=2]
+ %c = alloca i32, align 4 ; <i32*> [#uses=4]
+ %l = alloca %struct.list*, align 4 ; <%struct.list**> [#uses=5]
+ %op = alloca %struct.operator*, align 4 ; <%struct.operator**> [#uses=3]
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %arity, i32* %arity_addr
+ store i32 0, i32* %c
+ %tmp1 = load %struct.list** @operators ; <%struct.list*> [#uses=1]
+ store %struct.list* %tmp1, %struct.list** %l
+ br label %bb21
+
+bb: ; preds = %bb21
+ %tmp3 = getelementptr %struct.list* %tmp22, i32 0, i32 0 ; <i8**> [#uses=1]
+ %tmp4 = load i8** %tmp3 ; <i8*> [#uses=1]
+ %tmp45 = bitcast i8* %tmp4 to %struct.operator* ; <%struct.operator*> [#uses=1]
+ store %struct.operator* %tmp45, %struct.operator** %op
+ %tmp6 = load %struct.operator** %op ; <%struct.operator*> [#uses=1]
+ %tmp7 = getelementptr %struct.operator* %tmp6, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp8 = load i32* %tmp7 ; <i32> [#uses=1]
+ %tmp9 = load i32* %arity_addr ; <i32> [#uses=1]
+ icmp eq i32 %tmp8, %tmp9 ; <i1>:0 [#uses=1]
+ zext i1 %0 to i8 ; <i8>:1 [#uses=1]
+ icmp ne i8 %1, 0 ; <i1>:2 [#uses=1]
+ br i1 %2, label %cond_true, label %cond_next
+
+cond_true: ; preds = %bb
+ %tmp10 = load %struct.operator** %op ; <%struct.operator*> [#uses=1]
+ %tmp11 = getelementptr %struct.operator* %tmp10, i32 0, i32 2 ; <i32*> [#uses=1]
+ %tmp12 = load i32* %tmp11 ; <i32> [#uses=1]
+ %tmp13 = load %struct.FILE** @outfile ; <%struct.FILE*> [#uses=1]
+ %tmp14 = getelementptr [11 x i8]* @str1, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp15 = call i32 (%struct.FILE*, i8*, ...)* @fprintf( %struct.FILE* %tmp13, i8* %tmp14, i32 %tmp12 ) ; <i32> [#uses=0]
+ %tmp16 = load i32* %c ; <i32> [#uses=1]
+ %tmp17 = add i32 %tmp16, 1 ; <i32> [#uses=1]
+ store i32 %tmp17, i32* %c
+ br label %cond_next
+
+cond_next: ; preds = %cond_true, %bb
+ %tmp19 = getelementptr %struct.list* %tmp22, i32 0, i32 1 ; <%struct.list**> [#uses=1]
+ %tmp20 = load %struct.list** %tmp19 ; <%struct.list*> [#uses=1]
+ store %struct.list* %tmp20, %struct.list** %l
+ br label %bb21
+
+bb21: ; preds = %cond_next, %entry
+ %l.in = phi %struct.list** [ @operators, %entry ], [ %tmp19, %cond_next ] ;
+ %tmp22 = load %struct.list** %l.in ; <%struct.list*> [#uses=1]
+ icmp ne %struct.list* %tmp22, null ; <i1>:3 [#uses=1]
+ zext i1 %3 to i8 ; <i8>:4 [#uses=1]
+ icmp ne i8 %4, 0 ; <i1>:5 [#uses=1]
+ br i1 %5, label %bb, label %bb23
+
+bb23: ; preds = %bb21
+ %tmp24 = load i32* %c ; <i32> [#uses=1]
+ store i32 %tmp24, i32* %tmp
+ %tmp25 = load i32* %tmp ; <i32> [#uses=1]
+ store i32 %tmp25, i32* %retval
+ br label %return
+
+return: ; preds = %bb23
+ %retval26 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval26
+}
+
+declare i32 @fprintf(%struct.FILE*, i8*, ...)
diff --git a/test/Transforms/LoopRotate/PhiSelfRefernce-1.ll b/test/Transforms/LoopRotate/PhiSelfRefernce-1.ll
new file mode 100644
index 000000000000..a55704b1fdb6
--- /dev/null
+++ b/test/Transforms/LoopRotate/PhiSelfRefernce-1.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+; ModuleID = 'PhiSelfRefernce-1.bc'
+
+define void @snrm2(i32 %incx) {
+entry:
+ br i1 false, label %START, label %return
+
+START: ; preds = %entry
+ br i1 false, label %bb85, label %cond_false93
+
+bb52: ; preds = %bb85
+ br i1 false, label %bb307, label %cond_next71
+
+cond_next71: ; preds = %bb52
+ ret void
+
+bb85: ; preds = %START
+ br i1 false, label %bb52, label %bb88
+
+bb88: ; preds = %bb85
+ ret void
+
+cond_false93: ; preds = %START
+ ret void
+
+bb243: ; preds = %bb307
+ br label %bb307
+
+bb307: ; preds = %bb243, %bb52
+ %sx_addr.2.pn = phi float* [ %sx_addr.5, %bb243 ], [ null, %bb52 ] ; <float*> [#uses=1]
+ %sx_addr.5 = getelementptr float* %sx_addr.2.pn, i32 %incx ; <float*> [#uses=1]
+ br i1 false, label %bb243, label %bb310
+
+bb310: ; preds = %bb307
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/LoopRotate/dg.exp b/test/Transforms/LoopRotate/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopRotate/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopRotate/pr2639.ll b/test/Transforms/LoopRotate/pr2639.ll
new file mode 100644
index 000000000000..67477ade9968
--- /dev/null
+++ b/test/Transforms/LoopRotate/pr2639.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -loop-deletion -loop-rotate -disable-output
+; PR 2639
+
+ %struct.HexxagonMove = type { i8, i8, i32 }
+
+define void @_ZN16HexxagonMoveList7addMoveER12HexxagonMove() {
+entry:
+ br i1 false, label %bb9.preheader, label %bb11
+
+bb9.preheader: ; preds = %entry
+ br label %bb9
+
+bb1: ; preds = %bb9
+ br i1 false, label %bb3, label %bb8
+
+bb3: ; preds = %bb1
+ br label %bb5
+
+bb4: ; preds = %bb5
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb3
+ %exitcond = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb7, label %bb4
+
+bb7: ; preds = %bb5
+ store %struct.HexxagonMove* null, %struct.HexxagonMove** null, align 4
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb1
+ br label %bb9
+
+bb9: ; preds = %bb8, %bb9.preheader
+ br i1 false, label %bb11, label %bb1
+
+bb11: ; preds = %bb9, %entry
+ ret void
+}
diff --git a/test/Transforms/LoopSimplify/2003-04-25-AssertFail.ll b/test/Transforms/LoopSimplify/2003-04-25-AssertFail.ll
new file mode 100644
index 000000000000..70445fb8f8c1
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2003-04-25-AssertFail.ll
@@ -0,0 +1,20 @@
+; This testcase exposed a problem with the loop identification pass (LoopInfo).
+; Basically, it was incorrectly calculating the loop nesting information.
+;
+; RUN: llvm-as < %s | opt -loopsimplify
+
+define i32 @yylex() {
+ br label %loopentry.0
+loopentry.0: ; preds = %else.4, %0
+ br label %loopexit.2
+loopexit.2: ; preds = %else.4, %loopexit.2, %loopentry.0
+ br i1 false, label %loopexit.2, label %else.4
+yy_find_action: ; preds = %else.4
+ br label %else.4
+else.4: ; preds = %yy_find_action, %loopexit.2
+ switch i32 0, label %loopexit.2 [
+ i32 2, label %yy_find_action
+ i32 0, label %loopentry.0
+ ]
+}
+
diff --git a/test/Transforms/LoopSimplify/2003-05-12-PreheaderExitOfChild.ll b/test/Transforms/LoopSimplify/2003-05-12-PreheaderExitOfChild.ll
new file mode 100644
index 000000000000..ba2eef7095b1
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2003-05-12-PreheaderExitOfChild.ll
@@ -0,0 +1,42 @@
+; This (complex) testcase causes an assertion failure because a preheader is
+; inserted for the "fail" loop, but the exit block of a loop is not updated
+; to be the preheader instead of the exit loop itself.
+
+; RUN: llvm-as < %s | opt -loopsimplify
+define i32 @re_match_2() {
+ br label %loopentry.1
+loopentry.1: ; preds = %endif.82, %0
+ br label %shortcirc_done.36
+shortcirc_done.36: ; preds = %loopentry.1
+ br i1 false, label %fail, label %endif.40
+endif.40: ; preds = %shortcirc_done.36
+ br label %loopexit.20
+loopentry.20: ; preds = %endif.46
+ br label %loopexit.20
+loopexit.20: ; preds = %loopentry.20, %endif.40
+ br label %loopentry.21
+loopentry.21: ; preds = %no_exit.19, %loopexit.20
+ br i1 false, label %no_exit.19, label %loopexit.21
+no_exit.19: ; preds = %loopentry.21
+ br i1 false, label %fail, label %loopentry.21
+loopexit.21: ; preds = %loopentry.21
+ br label %endif.45
+endif.45: ; preds = %loopexit.21
+ br label %cond_true.15
+cond_true.15: ; preds = %endif.45
+ br i1 false, label %fail, label %endif.46
+endif.46: ; preds = %cond_true.15
+ br label %loopentry.20
+fail: ; preds = %loopexit.37, %cond_true.15, %no_exit.19, %shortcirc_done.36
+ br label %then.80
+then.80: ; preds = %fail
+ br label %endif.81
+endif.81: ; preds = %then.80
+ br label %loopexit.37
+loopexit.37: ; preds = %endif.81
+ br i1 false, label %fail, label %endif.82
+endif.82: ; preds = %loopexit.37
+ br label %loopentry.1
+}
+
+
diff --git a/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll b/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll
new file mode 100644
index 000000000000..53fc59edfc99
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2003-08-15-PreheadersFail.ll
@@ -0,0 +1,52 @@
+; RUN: llvm-as < %s | opt -tailduplicate -instcombine -simplifycfg -licm -disable-output
+target datalayout = "e-p:32:32"
+@yy_base = external global [787 x i16] ; <[787 x i16]*> [#uses=1]
+@yy_state_ptr = external global i32* ; <i32**> [#uses=3]
+@yy_state_buf = external global [16386 x i32] ; <[16386 x i32]*> [#uses=1]
+@yy_lp = external global i32 ; <i32*> [#uses=1]
+
+define i32 @_yylex() {
+ br label %loopentry.0
+loopentry.0: ; preds = %else.26, %0
+ store i32* getelementptr ([16386 x i32]* @yy_state_buf, i64 0, i64 0), i32** @yy_state_ptr
+ %tmp.35 = load i32** @yy_state_ptr ; <i32*> [#uses=2]
+ %inc.0 = getelementptr i32* %tmp.35, i64 1 ; <i32*> [#uses=1]
+ store i32* %inc.0, i32** @yy_state_ptr
+ %tmp.36 = load i32* null ; <i32> [#uses=1]
+ store i32 %tmp.36, i32* %tmp.35
+ br label %loopexit.2
+loopexit.2: ; preds = %else.26, %loopexit.2, %loopentry.0
+ store i8* null, i8** null
+ %tmp.91 = load i32* null ; <i32> [#uses=1]
+ %tmp.92 = sext i32 %tmp.91 to i64 ; <i64> [#uses=1]
+ %tmp.93 = getelementptr [787 x i16]* @yy_base, i64 0, i64 %tmp.92 ; <i16*> [#uses=1]
+ %tmp.94 = load i16* %tmp.93 ; <i16> [#uses=1]
+ %tmp.95 = icmp ne i16 %tmp.94, 4394 ; <i1> [#uses=1]
+ br i1 %tmp.95, label %loopexit.2, label %yy_find_action
+yy_find_action: ; preds = %else.26, %loopexit.2
+ br label %loopentry.3
+loopentry.3: ; preds = %then.9, %shortcirc_done.0, %yy_find_action
+ %tmp.105 = load i32* @yy_lp ; <i32> [#uses=1]
+ %tmp.106 = icmp ne i32 %tmp.105, 0 ; <i1> [#uses=1]
+ br i1 %tmp.106, label %shortcirc_next.0, label %shortcirc_done.0
+shortcirc_next.0: ; preds = %loopentry.3
+ %tmp.114 = load i16* null ; <i16> [#uses=1]
+ %tmp.115 = sext i16 %tmp.114 to i32 ; <i32> [#uses=1]
+ %tmp.116 = icmp slt i32 0, %tmp.115 ; <i1> [#uses=1]
+ br label %shortcirc_done.0
+shortcirc_done.0: ; preds = %shortcirc_next.0, %loopentry.3
+ %shortcirc_val.0 = phi i1 [ false, %loopentry.3 ], [ %tmp.116, %shortcirc_next.0 ] ; <i1> [#uses=1]
+ br i1 %shortcirc_val.0, label %else.0, label %loopentry.3
+else.0: ; preds = %shortcirc_done.0
+ %tmp.144 = load i32* null ; <i32> [#uses=1]
+ %tmp.145 = and i32 %tmp.144, 8192 ; <i32> [#uses=1]
+ %tmp.146 = icmp ne i32 %tmp.145, 0 ; <i1> [#uses=1]
+ br i1 %tmp.146, label %then.9, label %else.26
+then.9: ; preds = %else.0
+ br label %loopentry.3
+else.26: ; preds = %else.0
+ switch i32 0, label %loopentry.0 [
+ i32 2, label %yy_find_action
+ i32 0, label %loopexit.2
+ ]
+}
diff --git a/test/Transforms/LoopSimplify/2003-12-10-ExitBlocksProblem.ll b/test/Transforms/LoopSimplify/2003-12-10-ExitBlocksProblem.ll
new file mode 100644
index 000000000000..bd39330cb49d
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2003-12-10-ExitBlocksProblem.ll
@@ -0,0 +1,36 @@
+; LoopSimplify is breaking LICM on this testcase because the exit blocks from
+; the loop are reachable from more than just the exit nodes: the exit blocks
+; have predecessors from outside of the loop!
+;
+; This is distilled from a monsterous crafty example.
+
+; RUN: llvm-as < %s | opt -licm -disable-output
+
+
+@G = weak global i32 0 ; <i32*> [#uses=7]
+
+define i32 @main() {
+entry:
+ store i32 123, i32* @G
+ br label %loopentry.i
+loopentry.i: ; preds = %endif.1.i, %entry
+ %tmp.0.i = load i32* @G ; <i32> [#uses=1]
+ %tmp.1.i = icmp eq i32 %tmp.0.i, 123 ; <i1> [#uses=1]
+ br i1 %tmp.1.i, label %Out.i, label %endif.0.i
+endif.0.i: ; preds = %loopentry.i
+ %tmp.3.i = load i32* @G ; <i32> [#uses=1]
+ %tmp.4.i = icmp eq i32 %tmp.3.i, 126 ; <i1> [#uses=1]
+ br i1 %tmp.4.i, label %ExitBlock.i, label %endif.1.i
+endif.1.i: ; preds = %endif.0.i
+ %tmp.6.i = load i32* @G ; <i32> [#uses=1]
+ %inc.i = add i32 %tmp.6.i, 1 ; <i32> [#uses=1]
+ store i32 %inc.i, i32* @G
+ br label %loopentry.i
+Out.i: ; preds = %loopentry.i
+ store i32 0, i32* @G
+ br label %ExitBlock.i
+ExitBlock.i: ; preds = %Out.i, %endif.0.i
+ %tmp.7.i = load i32* @G ; <i32> [#uses=1]
+ ret i32 %tmp.7.i
+}
+
diff --git a/test/Transforms/LoopSimplify/2004-02-05-DominatorInfoCorruption.ll b/test/Transforms/LoopSimplify/2004-02-05-DominatorInfoCorruption.ll
new file mode 100644
index 000000000000..b8ced96f23fe
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2004-02-05-DominatorInfoCorruption.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -loopsimplify -verify -licm -disable-output
+
+define void @.subst_48() {
+entry:
+ br label %loopentry.0
+loopentry.0: ; preds = %loopentry.0, %entry
+ br i1 false, label %loopentry.0, label %loopentry.2
+loopentry.2: ; preds = %loopentry.2, %loopentry.0
+ %tmp.968 = icmp sle i32 0, 3 ; <i1> [#uses=1]
+ br i1 %tmp.968, label %loopentry.2, label %UnifiedReturnBlock
+UnifiedReturnBlock: ; preds = %loopentry.2
+ ret void
+}
+
diff --git a/test/Transforms/LoopSimplify/2004-03-15-IncorrectDomUpdate.ll b/test/Transforms/LoopSimplify/2004-03-15-IncorrectDomUpdate.ll
new file mode 100644
index 000000000000..439ea7e2228a
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2004-03-15-IncorrectDomUpdate.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -loopsimplify -licm -disable-output
+define void @main() {
+entry:
+ br i1 false, label %Out, label %loop
+loop: ; preds = %loop, %entry
+ %LI = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %LI, label %loop, label %Out
+Out: ; preds = %loop, %entry
+ ret void
+}
+
diff --git a/test/Transforms/LoopSimplify/2004-04-01-IncorrectDomUpdate.ll b/test/Transforms/LoopSimplify/2004-04-01-IncorrectDomUpdate.ll
new file mode 100644
index 000000000000..e75b214cb25f
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2004-04-01-IncorrectDomUpdate.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -loopsimplify -licm -disable-output
+
+; This is PR306
+
+define void @NormalizeCoeffsVecFFE() {
+entry:
+ br label %loopentry.0
+loopentry.0: ; preds = %no_exit.0, %entry
+ br i1 false, label %loopentry.1, label %no_exit.0
+no_exit.0: ; preds = %loopentry.0
+ br i1 false, label %loopentry.0, label %loopentry.1
+loopentry.1: ; preds = %no_exit.1, %no_exit.0, %loopentry.0
+ br i1 false, label %no_exit.1, label %loopexit.1
+no_exit.1: ; preds = %loopentry.1
+ %tmp.43 = icmp eq i16 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.43, label %loopentry.1, label %loopexit.1
+loopexit.1: ; preds = %no_exit.1, %loopentry.1
+ ret void
+}
+
diff --git a/test/Transforms/LoopSimplify/2004-04-12-LoopSimplify-SwitchBackedges.ll b/test/Transforms/LoopSimplify/2004-04-12-LoopSimplify-SwitchBackedges.ll
new file mode 100644
index 000000000000..ae11d80d34b8
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2004-04-12-LoopSimplify-SwitchBackedges.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -loopsimplify -disable-output
+
+define void @test() {
+loopentry.0:
+ br label %loopentry.1
+loopentry.1: ; preds = %then.6, %then.6, %loopentry.1, %loopentry.0
+ %pixel.4 = phi i32 [ 0, %loopentry.0 ], [ %pixel.4, %loopentry.1 ], [ %tmp.370, %then.6 ], [ %tmp.370, %then.6 ] ; <i32> [#uses=1]
+ br i1 false, label %then.6, label %loopentry.1
+then.6: ; preds = %loopentry.1
+ %tmp.370 = add i32 0, 0 ; <i32> [#uses=2]
+ switch i32 0, label %label.7 [
+ i32 6408, label %loopentry.1
+ i32 32841, label %loopentry.1
+ ]
+label.7: ; preds = %then.6
+ ret void
+}
+
diff --git a/test/Transforms/LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll b/test/Transforms/LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll
new file mode 100644
index 000000000000..bd0515c476e9
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -scalarrepl -loopsimplify -licm -disable-output -verify-dom-info
+
+define void @inflate() {
+entry:
+ br label %loopentry.0.outer1111
+loopentry.0.outer1111: ; preds = %then.41, %label.11, %loopentry.0.outer1111, %entry
+ %left.0.ph1107 = phi i32 [ %tmp.1172, %then.41 ], [ 0, %entry ], [ %tmp.1172, %label.11 ], [ %left.0.ph1107, %loopentry.0.outer1111 ] ; <i32> [#uses=2]
+ %tmp.1172 = sub i32 %left.0.ph1107, 0 ; <i32> [#uses=2]
+ switch i32 0, label %label.11 [
+ i32 23, label %loopentry.0.outer1111
+ i32 13, label %then.41
+ ]
+label.11: ; preds = %loopentry.0.outer1111
+ br label %loopentry.0.outer1111
+then.41: ; preds = %loopentry.0.outer1111
+ br label %loopentry.0.outer1111
+}
+
diff --git a/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll b/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll
new file mode 100644
index 000000000000..914fcd1661b8
--- /dev/null
+++ b/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll
@@ -0,0 +1,892 @@
+; RUN: llvm-as < %s | opt -loopsimplify -disable-output
+; PR1752
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-s0:0:64-f80:32:32"
+target triple = "i686-pc-mingw32"
+ %struct.BigInt = type { %"struct.std::vector<ulong,std::allocator<ulong> >" }
+ %struct.Fibonacci = type { %"struct.std::vector<BigInt,std::allocator<BigInt> >" }
+ %struct.__false_type = type <{ i8 }>
+ %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >" = type { %struct.BigInt* }
+ %"struct.std::_Vector_base<BigInt,std::allocator<BigInt> >" = type { %"struct.std::_Vector_base<BigInt,std::allocator<BigInt> >::_Vector_impl" }
+ %"struct.std::_Vector_base<BigInt,std::allocator<BigInt> >::_Vector_impl" = type { %struct.BigInt*, %struct.BigInt*, %struct.BigInt* }
+ %"struct.std::_Vector_base<ulong,std::allocator<ulong> >" = type { %"struct.std::_Vector_base<ulong,std::allocator<ulong> >::_Vector_impl" }
+ %"struct.std::_Vector_base<ulong,std::allocator<ulong> >::_Vector_impl" = type { i32*, i32*, i32* }
+ %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i8, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"* }
+ %"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" = type { i8* }
+ %"struct.std::basic_stringbuf<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", i32, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" }
+ %"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 }
+ %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
+ %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
+ %"struct.std::ios_base::_Words" = type { i8*, i32 }
+ %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
+ %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+ %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
+ %"struct.std::ostringstream" = type { [4 x i8], %"struct.std::basic_stringbuf<char,std::char_traits<char>,std::allocator<char> >", %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::vector<BigInt,std::allocator<BigInt> >" = type { %"struct.std::_Vector_base<BigInt,std::allocator<BigInt> >" }
+ %"struct.std::vector<ulong,std::allocator<ulong> >" = type { %"struct.std::_Vector_base<ulong,std::allocator<ulong> >" }
+@.str13 = external constant [6 x i8] ; <[6 x i8]*> [#uses=1]
+@.str14 = external constant [5 x i8] ; <[5 x i8]*> [#uses=1]
+@.str15 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1]
+@_ZSt4cout = external global %"struct.std::basic_ostream<char,std::char_traits<char> >" ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
+
+declare void @_ZN9Fibonacci10get_numberEj(%struct.BigInt* sret , %struct.Fibonacci*, i32)
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(%"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8*)
+
+declare void @_ZNSsD1Ev(%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"*)
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEm(%"struct.std::basic_ostream<char,std::char_traits<char> >"*, i32)
+
+declare void @_ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv(%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* sret , %"struct.std::ostringstream"*)
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_T1_E(%"struct.std::basic_ostream<char,std::char_traits<char> >"*, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"*)
+
+declare void @_ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev(%"struct.std::ostringstream"*)
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @___ZlsRSoRK6BigInt___ZN9__gnu_cxx13new_allocatorI6BigIntE10deallocateEPS1_j(i32, %"struct.std::basic_ostream<char,std::char_traits<char> >"*, %struct.BigInt*, %struct.__false_type*, i32)
+
+declare void @___ZNSt12_Vector_baseI6BigIntSaIS0_EE13_M_deallocateEPS0_j___ZNSt12_Vector_baseI6BigIntSaIS0_EED2Ev___ZNSt6vectorI6BigIntSaIS0_EEC1ERKS1_(%"struct.std::_Vector_base<BigInt,std::allocator<BigInt> >"*, i32, %struct.BigInt*, i32, %"struct.std::vector<BigInt,std::allocator<BigInt> >"*, %struct.__false_type*)
+
+declare i32 @___ZN9__gnu_cxxmiIPK6BigIntS3_St6vectorIS1_SaIS1_EEEENS_17__normal_iteratorIT_T1_E15difference_typeERKSA_RKNS7_IT0_S9_EE___ZNKSt6vectorI6BigIntSaIS0_EE4sizeEv___ZNK9Fibonacci16show_all_numbersEv___ZNKSt6vectorI6BigIntSaIS0_EE8capacityEv(%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*, %"struct.std::vector<BigInt,std::allocator<BigInt> >"*, i32, %struct.Fibonacci*)
+
+declare %struct.BigInt* @___ZNSt6vectorI6BigIntSaIS0_EEixEj___ZNSt6vectorI6BigIntSaIS0_EE3endEv(%"struct.std::vector<BigInt,std::allocator<BigInt> >"*, i32, i32)
+
+declare %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_(i32, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*, %"struct.std::vector<ulong,std::allocator<ulong> >"*, %struct.BigInt*, %struct.__false_type*, %struct.BigInt*, %struct.__false_type* noalias )
+
+declare void @___ZNSt6vectorI6BigIntSaIS0_EED1Ev___ZN9FibonacciD1Ev___ZNSt6vectorImSaImEEC1ERKS0_(i32, %"struct.std::vector<BigInt,std::allocator<BigInt> >"*, %struct.Fibonacci*, %"struct.std::vector<ulong,std::allocator<ulong> >"*, %struct.__false_type*)
+
+define void @___ZN9FibonacciC1Ej___ZN9Fibonacci11show_numberEm(%struct.Fibonacci* %this_this, i32 %functionID, i32 %n_i_n_i) {
+bb_init:
+ br label %bb_main
+
+bb_main: ; preds = %meshBB349, %meshBB348, %meshBB347, %meshBB346, %meshBB345.unwinddest, %meshBB345, %meshBB344, %meshBB343, %meshBB342, %meshBB341, %meshBB340.normaldest, %meshBB340, %meshBB339, %invcont17.normaldest.normaldest, %invcont17.normaldest, %meshBB338.unwinddest, %meshBB338, %meshBB337.unwinddest, %meshBB337, %meshBB336.unwinddest, %meshBB336, %meshBB335, %meshBB334, %meshBB333, %meshBB332, %meshBB331, %meshBB330.normaldest, %meshBB330, %meshBB329.normaldest, %meshBB329, %meshBB328, %meshBB327, %meshBB326, %meshBB325.unwinddest, %meshBB325, %meshBB324, %meshBB323.normaldest, %meshBB323, %meshBB322.unwinddest, %meshBB322, %meshBB321, %meshBB320.unwinddest, %meshBB320, %meshBB319.unwinddest, %meshBB319, %meshBB318.unwinddest, %meshBB318, %meshBB317, %meshBB37.fragment, %meshBB37.unwinddest, %meshBB37, %meshBB36.fragment, %meshBB36, %meshBB35.fragment, %meshBB35, %meshBB34.fragment, %meshBB34, %meshBB33.fragment, %meshBB33, %meshBB32.fragment, %meshBB32, %meshBB31.fragment, %meshBB31, %meshBB30.fragment, %meshBB30.normaldest, %meshBB30, %meshBB29.fragment, %meshBB29.unwinddest, %meshBB29, %meshBB28.fragment, %meshBB28.unwinddest, %meshBB28, %meshBB27.fragment, %meshBB27, %meshBB26.fragment, %meshBB26.normaldest, %meshBB26, %meshBB25.fragment, %meshBB25, %meshBB24.fragment, %meshBB24.unwinddest, %meshBB24, %meshBB23.fragment, %meshBB23.normaldest, %meshBB23, %entry1.fragment.normaldest.normaldest, %entry1.fragment.normaldest, %meshBB22.fragment, %meshBB22.unwinddest, %meshBB22, %meshBB.fragment, %meshBB.unwinddest, %meshBB, %Unwind20, %unwind78.Unwind_crit_edge, %unwind78.fragment.fragment, %unwind78.fragment, %unwind78.fragment316, %unwind78, %invcont70, %unwind66.Unwind_crit_edge, %unwind66.fragment.fragment, %unwind66.fragment, %unwind66.fragment315, %unwind66, %unwind53.nofilter_crit_edge, %unwind53.fragment.fragment, %unwind53.fragment, %unwind53.fragment314, %unwind53, %nofilter.Unwind_crit_edge.normaldest, %nofilter.Unwind_crit_edge, %nofilter, %unwind43.nofilter_crit_edge, %unwind43.fragment.fragment, %unwind43.fragment, %unwind43.fragment313, %unwind43, %invcont41.normaldest, %invcont41, %unwind37.nofilter_crit_edge, %unwind37, %invcont36, %invcont33.unwind_crit_edge.unwinddest, %invcont33.unwind_crit_edge, %invcont30.unwind_crit_edge.unwinddest, %invcont30.unwind_crit_edge, %invcont30.normaldest, %invcont30, %invcont28.unwind_crit_edge, %invcont28.normaldest, %invcont28, %invcont25.unwind_crit_edge.unwinddest, %invcont25.unwind_crit_edge, %invcont25, %invcont22.unwind_crit_edge, %invcont22, %invcont17.unwind_crit_edge, %invcont17, %cond_next.unwind_crit_edge, %cond_next, %invcont12.cond_next_crit_edge, %invcont12.unwind_crit_edge, %invcont12, %cond_true.unwind_crit_edge.unwinddest, %cond_true.unwind_crit_edge, %invcont.cond_next_crit_edge, %invcont16.fragment, %invcont16, %unwind11.fragment, %unwind11, %entry.unwind_crit_edge, %entry1.fragment, %entry1.fragment312, %entry1, %Unwind, %unwind20.Unwind_crit_edge, %unwind20.fragment.fragment, %unwind20.fragment, %unwind20.fragment311, %unwind20, %invcont15, %invcont14.unwind10_crit_edge, %invcont14, %unwind10.Unwind_crit_edge, %unwind10.fragment, %unwind10.fragment310, %unwind10, %invcont.unwind10_crit_edge, %invcont, %unwind.fragment, %unwind, %entry.fragment, %entry.fragment309, %entry, %NewDefault, %LeafBlock, %LeafBlock914, %NodeBlock, %comb_entry.fragment, %old_entry, %bb_init
+ switch i32 0, label %old_entry [
+ i32 2739, label %invcont28.fragment
+ i32 2688, label %meshBB28.fragment
+ i32 1318, label %meshBB32.fragment
+ i32 2964, label %unwind53.fragment.fragment
+ i32 824, label %unwind78.fragment.fragment
+ i32 1983, label %meshBB33.fragment
+ i32 2582, label %invcont30.fragment
+ i32 2235, label %meshBB36.fragment
+ i32 1275, label %meshBB343
+ i32 2719, label %invcont.fragment
+ i32 1500, label %entry1.fragment.fragment
+ i32 815, label %unwind11.fragment
+ i32 1051, label %entry
+ i32 2342, label %unwind
+ i32 1814, label %invcont
+ i32 315, label %invcont.unwind10_crit_edge
+ i32 2422, label %unwind10
+ i32 2663, label %unwind10.Unwind_crit_edge
+ i32 266, label %invcont14
+ i32 367, label %invcont14.unwind10_crit_edge
+ i32 2242, label %invcont15
+ i32 452, label %unwind20
+ i32 419, label %invcont.cond_next_crit_edge
+ i32 181, label %cond_true
+ i32 2089, label %unwind20.Unwind_crit_edge
+ i32 633, label %filter
+ i32 455, label %Unwind
+ i32 2016, label %entry1
+ i32 263, label %invcont33.unwind_crit_edge
+ i32 2498, label %invcont36
+ i32 2992, label %unwind37
+ i32 616, label %entry.unwind_crit_edge
+ i32 622, label %unwind11
+ i32 875, label %invcont16
+ i32 766, label %unwind53.nofilter_crit_edge
+ i32 668, label %filter62
+ i32 2138, label %unwind66
+ i32 713, label %unwind66.Unwind_crit_edge
+ i32 1422, label %invcont70
+ i32 1976, label %cond_true.unwind_crit_edge
+ i32 1263, label %invcont12
+ i32 2453, label %invcont12.unwind_crit_edge
+ i32 2876, label %invcont12.cond_next_crit_edge
+ i32 2271, label %cond_next
+ i32 2938, label %cond_next.unwind_crit_edge
+ i32 1082, label %invcont17
+ i32 531, label %invcont17.unwind_crit_edge
+ i32 111, label %invcont22
+ i32 1935, label %invcont22.unwind_crit_edge
+ i32 2004, label %invcont25
+ i32 1725, label %invcont25.unwind_crit_edge
+ i32 1701, label %invcont28
+ i32 957, label %invcont28.unwind_crit_edge
+ i32 165, label %invcont30
+ i32 899, label %invcont30.unwind_crit_edge
+ i32 1092, label %invcont33
+ i32 2869, label %unwind37.nofilter_crit_edge
+ i32 203, label %invcont41
+ i32 693, label %unwind43
+ i32 2895, label %unwind43.nofilter_crit_edge
+ i32 1174, label %invcont47
+ i32 1153, label %filter19
+ i32 2304, label %nofilter
+ i32 848, label %nofilter.Unwind_crit_edge
+ i32 1207, label %unwind53
+ i32 2848, label %filter75
+ i32 59, label %unwind78
+ i32 1213, label %unwind78.Unwind_crit_edge
+ i32 2199, label %filter87
+ i32 1268, label %Unwind20
+ i32 743, label %old_entry
+ i32 1276, label %meshBB319
+ i32 1619, label %meshBB320
+ i32 2047, label %meshBB331
+ i32 2828, label %meshBB23.fragment
+ i32 2530, label %meshBB332
+ i32 1389, label %meshBB318
+ i32 1450, label %meshBB317
+ i32 1416, label %meshBB31.fragment
+ i32 82, label %meshBB322
+ i32 853, label %unwind78.fragment316
+ i32 107, label %meshBB24.fragment
+ i32 1200, label %meshBB37.fragment
+ i32 605, label %unwind53.fragment314
+ i32 209, label %meshBB29.fragment
+ i32 1513, label %meshBB27.fragment
+ i32 1542, label %meshBB35.fragment
+ i32 1873, label %meshBB348
+ i32 472, label %meshBB325
+ i32 2615, label %meshBB22.fragment
+ i32 359, label %meshBB.fragment
+ i32 2467, label %Unwind20.fragment
+ i32 1671, label %unwind66.fragment.fragment
+ i32 1006, label %meshBB25.fragment
+ i32 1243, label %meshBB333
+ i32 2795, label %unwind43.fragment313
+ i32 1591, label %meshBB335
+ i32 773, label %meshBB341
+ i32 2440, label %cond_next.fragment
+ i32 487, label %meshBB326
+ i32 394, label %meshBB324
+ i32 14, label %invcont16.fragment
+ i32 574, label %entry1.fragment312
+ i32 1453, label %meshBB35
+ i32 345, label %entry1.fragment
+ i32 2951, label %unwind20.fragment
+ i32 1960, label %meshBB31
+ i32 2163, label %meshBB32
+ i32 1978, label %Unwind.fragment
+ i32 1559, label %unwind20.fragment.fragment
+ i32 950, label %unwind10.fragment
+ i32 1724, label %unwind53.fragment
+ i32 514, label %meshBB36
+ i32 1928, label %unwind10.fragment.fragment
+ i32 1266, label %meshBB26
+ i32 3148, label %unwind20.fragment311
+ i32 1581, label %unwind43.fragment
+ i32 1829, label %meshBB34
+ i32 1472, label %meshBB28
+ i32 2657, label %unwind66.fragment
+ i32 2169, label %meshBB22
+ i32 2619, label %meshBB
+ i32 1397, label %entry.fragment
+ i32 231, label %invcont41.fragment
+ i32 2557, label %meshBB338
+ i32 2387, label %meshBB30.fragment
+ i32 2927, label %meshBB340
+ i32 2331, label %meshBB321
+ i32 47, label %meshBB328
+ i32 1753, label %meshBB342
+ i32 2074, label %meshBB323
+ i32 2128, label %meshBB334
+ i32 2396, label %meshBB337
+ i32 1811, label %meshBB29
+ i32 1113, label %meshBB27
+ i32 2232, label %unwind10.fragment310
+ i32 804, label %meshBB24
+ i32 3099, label %meshBB30
+ i32 564, label %meshBB33
+ i32 1359, label %unwind.fragment
+ i32 1906, label %entry.fragment309
+ i32 2644, label %entry.fragment.fragment
+ i32 134, label %entry1.fragment.normaldest
+ i32 2767, label %comb_entry.fragment
+ i32 2577, label %meshBB25
+ i32 3128, label %meshBB37
+ i32 2360, label %meshBB23
+ i32 286, label %unwind78.fragment
+ i32 976, label %meshBB346
+ i32 2412, label %meshBB339
+ i32 876, label %meshBB345
+ i32 3078, label %meshBB329
+ i32 1297, label %meshBB347
+ i32 3051, label %meshBB336
+ i32 1342, label %meshBB344
+ i32 728, label %meshBB330
+ i32 1778, label %meshBB349
+ i32 2784, label %meshBB327
+ i32 1854, label %meshBB26.fragment
+ i32 1025, label %meshBB34.fragment
+ i32 2139, label %unwind43.fragment.fragment
+ i32 2217, label %nofilter.fragment
+ i32 665, label %invcont12.fragment
+ i32 316, label %invcont22.fragment
+ i32 1467, label %unwind66.fragment315
+ i32 3018, label %unwind37.fragment
+ i32 1123, label %invcont17.normaldest
+ i32 2104, label %NewDefault
+ i32 1639, label %LeafBlock
+ i32 925, label %LeafBlock914
+ i32 2880, label %NodeBlock
+ ]
+
+old_entry: ; preds = %bb_main, %bb_main
+ br label %bb_main
+
+comb_entry.fragment: ; preds = %bb_main
+ br label %bb_main
+
+NodeBlock: ; preds = %bb_main
+ br label %bb_main
+
+LeafBlock914: ; preds = %bb_main
+ br label %bb_main
+
+LeafBlock: ; preds = %bb_main
+ br label %bb_main
+
+NewDefault: ; preds = %bb_main
+ br label %bb_main
+
+entry: ; preds = %bb_main
+ br label %bb_main
+
+entry.fragment309: ; preds = %bb_main
+ br label %bb_main
+
+entry.fragment: ; preds = %bb_main
+ br label %bb_main
+
+entry.fragment.fragment: ; preds = %bb_main
+ invoke void @___ZNSt12_Vector_baseI6BigIntSaIS0_EE13_M_deallocateEPS0_j___ZNSt12_Vector_baseI6BigIntSaIS0_EED2Ev___ZNSt6vectorI6BigIntSaIS0_EEC1ERKS1_( %"struct.std::_Vector_base<BigInt,std::allocator<BigInt> >"* null, i32 28, %struct.BigInt* null, i32 0, %"struct.std::vector<BigInt,std::allocator<BigInt> >"* null, %struct.__false_type* null )
+ to label %meshBB340 unwind label %meshBB325
+
+unwind: ; preds = %bb_main
+ br label %bb_main
+
+unwind.fragment: ; preds = %bb_main
+ br label %bb_main
+
+invcont: ; preds = %bb_main
+ br label %bb_main
+
+invcont.fragment: ; preds = %bb_main
+ invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* null sret , %struct.Fibonacci* %this_this, i32 %n_i_n_i )
+ to label %invcont14 unwind label %meshBB37
+
+invcont.unwind10_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+unwind10: ; preds = %bb_main
+ br label %bb_main
+
+unwind10.fragment310: ; preds = %bb_main
+ br label %bb_main
+
+unwind10.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind10.fragment.fragment: ; preds = %bb_main
+ invoke void @___ZNSt6vectorI6BigIntSaIS0_EED1Ev___ZN9FibonacciD1Ev___ZNSt6vectorImSaImEEC1ERKS0_( i32 57, %"struct.std::vector<BigInt,std::allocator<BigInt> >"* null, %struct.Fibonacci* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.__false_type* null )
+ to label %meshBB329 unwind label %meshBB24
+
+unwind10.Unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont14: ; preds = %invcont.fragment, %bb_main
+ br label %bb_main
+
+invcont14.normaldest: ; No predecessors!
+ invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* null noalias )
+ to label %invcont15 unwind label %meshBB345 ; <%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*>:0 [#uses=0]
+
+invcont14.unwind10_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont15: ; preds = %invcont14.normaldest, %bb_main
+ br label %bb_main
+
+invcont15.normaldest: ; No predecessors!
+ br label %UnifiedReturnBlock
+
+unwind20: ; preds = %bb_main
+ br label %bb_main
+
+unwind20.fragment311: ; preds = %bb_main
+ br label %bb_main
+
+unwind20.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind20.fragment.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind20.Unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+filter: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+Unwind: ; preds = %bb_main
+ br label %bb_main
+
+Unwind.fragment: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+entry1: ; preds = %bb_main
+ br label %bb_main
+
+entry1.fragment312: ; preds = %bb_main
+ br label %bb_main
+
+entry1.fragment: ; preds = %bb_main
+ br label %bb_main
+
+entry1.fragment.fragment: ; preds = %bb_main
+ %tmp52 = invoke i32 @___ZN9__gnu_cxxmiIPK6BigIntS3_St6vectorIS1_SaIS1_EEEENS_17__normal_iteratorIT_T1_E15difference_typeERKSA_RKNS7_IT0_S9_EE___ZNKSt6vectorI6BigIntSaIS0_EE4sizeEv___ZNK9Fibonacci16show_all_numbersEv___ZNKSt6vectorI6BigIntSaIS0_EE8capacityEv( %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<BigInt,std::allocator<BigInt> >"* null, i32 16, %struct.Fibonacci* null )
+ to label %entry1.fragment.normaldest unwind label %meshBB320 ; <i32> [#uses=0]
+
+entry.unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+unwind11: ; preds = %bb_main
+ br label %bb_main
+
+unwind11.fragment: ; preds = %bb_main
+ br label %bb_main
+
+invcont16: ; preds = %bb_main
+ br label %bb_main
+
+invcont16.fragment: ; preds = %bb_main
+ br label %bb_main
+
+invcont.cond_next_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+cond_true: ; preds = %bb_main
+ invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* null sret , %struct.Fibonacci* %this_this, i32 %n_i_n_i )
+ to label %meshBB323 unwind label %cond_true.unwind_crit_edge
+
+cond_true.unwind_crit_edge: ; preds = %cond_true, %bb_main
+ br label %bb_main
+
+cond_true.unwind_crit_edge.unwinddest: ; No predecessors!
+ br label %bb_main
+
+invcont12: ; preds = %bb_main
+ br label %bb_main
+
+invcont12.fragment: ; preds = %bb_main
+ invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* null noalias )
+ to label %meshBB30 unwind label %meshBB337 ; <%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*>:1 [#uses=0]
+
+invcont12.unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont12.cond_next_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+cond_next: ; preds = %bb_main
+ br label %bb_main
+
+cond_next.fragment: ; preds = %bb_main
+ %tmp183 = invoke %struct.BigInt* @___ZNSt6vectorI6BigIntSaIS0_EEixEj___ZNSt6vectorI6BigIntSaIS0_EE3endEv( %"struct.std::vector<BigInt,std::allocator<BigInt> >"* null, i32 %n_i_n_i, i32 29 )
+ to label %invcont17 unwind label %meshBB336 ; <%struct.BigInt*> [#uses=0]
+
+cond_next.unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont17: ; preds = %cond_next.fragment, %bb_main
+ br label %bb_main
+
+invcont17.normaldest917: ; No predecessors!
+ %tmp23 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( %"struct.std::basic_ostream<char,std::char_traits<char> >"* null, i8* getelementptr ([6 x i8]* @.str13, i32 0, i32 0) )
+ to label %invcont17.normaldest unwind label %meshBB318 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
+
+invcont17.unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont22: ; preds = %bb_main
+ br label %bb_main
+
+invcont22.fragment: ; preds = %bb_main
+ %tmp26 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEm( %"struct.std::basic_ostream<char,std::char_traits<char> >"* undef, i32 %n_i_n_i )
+ to label %invcont25 unwind label %meshBB319 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
+
+invcont22.unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont25: ; preds = %invcont22.fragment, %bb_main
+ br label %bb_main
+
+invcont25.normaldest: ; No predecessors!
+ %tmp2918 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( %"struct.std::basic_ostream<char,std::char_traits<char> >"* %tmp26, i8* getelementptr ([5 x i8]* @.str14, i32 0, i32 0) )
+ to label %invcont28 unwind label %invcont25.unwind_crit_edge ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+invcont25.unwind_crit_edge: ; preds = %invcont25.normaldest, %bb_main
+ br label %bb_main
+
+invcont25.unwind_crit_edge.unwinddest: ; No predecessors!
+ br label %bb_main
+
+invcont28: ; preds = %invcont25.normaldest, %bb_main
+ br label %bb_main
+
+invcont28.normaldest: ; No predecessors!
+ br label %bb_main
+
+invcont28.fragment: ; preds = %bb_main
+ %tmp311 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @___ZlsRSoRK6BigInt___ZN9__gnu_cxx13new_allocatorI6BigIntE10deallocateEPS1_j( i32 32, %"struct.std::basic_ostream<char,std::char_traits<char> >"* undef, %struct.BigInt* undef, %struct.__false_type* null, i32 0 )
+ to label %invcont30 unwind label %meshBB322 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+invcont28.unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont30: ; preds = %invcont28.fragment, %bb_main
+ br label %bb_main
+
+invcont30.normaldest: ; No predecessors!
+ br label %bb_main
+
+invcont30.fragment: ; preds = %bb_main
+ %tmp34 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc( %"struct.std::basic_ostream<char,std::char_traits<char> >"* undef, i8* getelementptr ([2 x i8]* @.str15, i32 0, i32 0) )
+ to label %meshBB26 unwind label %invcont30.unwind_crit_edge ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+invcont30.unwind_crit_edge: ; preds = %invcont30.fragment, %bb_main
+ br label %bb_main
+
+invcont30.unwind_crit_edge.unwinddest: ; No predecessors!
+ br label %bb_main
+
+invcont33: ; preds = %bb_main
+ invoke void @_ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* null sret , %"struct.std::ostringstream"* null )
+ to label %invcont36 unwind label %invcont33.unwind_crit_edge
+
+invcont33.unwind_crit_edge: ; preds = %invcont33, %bb_main
+ br label %bb_main
+
+invcont33.unwind_crit_edge.unwinddest: ; No predecessors!
+ br label %bb_main
+
+invcont36: ; preds = %invcont33, %bb_main
+ br label %bb_main
+
+invcont36.normaldest: ; No predecessors!
+ %tmp42 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKSbIS4_S5_T1_E( %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4cout, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* null )
+ to label %invcont41 unwind label %meshBB338 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+unwind37: ; preds = %bb_main
+ br label %bb_main
+
+unwind37.fragment: ; preds = %bb_main
+ invoke void @_ZNSsD1Ev( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* null )
+ to label %meshBB330 unwind label %meshBB22
+
+unwind37.nofilter_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont41: ; preds = %invcont36.normaldest, %bb_main
+ br label %bb_main
+
+invcont41.normaldest: ; No predecessors!
+ br label %bb_main
+
+invcont41.fragment: ; preds = %bb_main
+ invoke void @_ZNSsD1Ev( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* null )
+ to label %meshBB23 unwind label %meshBB29
+
+unwind43: ; preds = %bb_main
+ br label %bb_main
+
+unwind43.fragment313: ; preds = %bb_main
+ br label %bb_main
+
+unwind43.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind43.fragment.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind43.nofilter_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont47: ; preds = %bb_main
+ invoke void @_ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev( %"struct.std::ostringstream"* null )
+ to label %invcont70 unwind label %meshBB28
+
+filter19: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+nofilter: ; preds = %bb_main
+ br label %bb_main
+
+nofilter.fragment: ; preds = %bb_main
+ invoke void @_ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEED1Ev( %"struct.std::ostringstream"* null )
+ to label %nofilter.Unwind_crit_edge unwind label %meshBB
+
+nofilter.Unwind_crit_edge: ; preds = %nofilter.fragment, %bb_main
+ br label %bb_main
+
+nofilter.Unwind_crit_edge.normaldest: ; No predecessors!
+ br label %bb_main
+
+unwind53: ; preds = %bb_main
+ br label %bb_main
+
+unwind53.fragment314: ; preds = %bb_main
+ br label %bb_main
+
+unwind53.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind53.fragment.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind53.nofilter_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+filter62: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+unwind66: ; preds = %bb_main
+ br label %bb_main
+
+unwind66.fragment315: ; preds = %bb_main
+ br label %bb_main
+
+unwind66.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind66.fragment.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind66.Unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+invcont70: ; preds = %invcont47, %bb_main
+ br label %bb_main
+
+invcont70.normaldest: ; No predecessors!
+ br label %UnifiedReturnBlock
+
+filter75: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+unwind78: ; preds = %bb_main
+ br label %bb_main
+
+unwind78.fragment316: ; preds = %bb_main
+ br label %bb_main
+
+unwind78.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind78.fragment.fragment: ; preds = %bb_main
+ br label %bb_main
+
+unwind78.Unwind_crit_edge: ; preds = %bb_main
+ br label %bb_main
+
+filter87: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+Unwind20: ; preds = %bb_main
+ br label %bb_main
+
+Unwind20.fragment: ; preds = %bb_main
+ br label %UnifiedUnreachableBlock
+
+meshBB: ; preds = %nofilter.fragment, %bb_main
+ br label %bb_main
+
+meshBB.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB22: ; preds = %unwind37.fragment, %bb_main
+ br label %bb_main
+
+meshBB22.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB22.fragment: ; preds = %bb_main
+ br label %bb_main
+
+entry1.fragment.normaldest: ; preds = %entry1.fragment.fragment, %bb_main
+ br label %bb_main
+
+entry1.fragment.normaldest.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB23: ; preds = %invcont41.fragment, %bb_main
+ br label %bb_main
+
+meshBB23.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB23.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB24: ; preds = %unwind10.fragment.fragment, %bb_main
+ br label %bb_main
+
+meshBB24.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB24.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB25: ; preds = %bb_main
+ br label %bb_main
+
+meshBB25.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB26: ; preds = %invcont30.fragment, %bb_main
+ br label %bb_main
+
+meshBB26.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB26.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB27: ; preds = %bb_main
+ br label %bb_main
+
+meshBB27.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB28: ; preds = %invcont47, %bb_main
+ br label %bb_main
+
+meshBB28.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB28.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB29: ; preds = %invcont41.fragment, %bb_main
+ br label %bb_main
+
+meshBB29.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB29.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB30: ; preds = %invcont12.fragment, %bb_main
+ br label %bb_main
+
+meshBB30.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB30.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB31: ; preds = %bb_main
+ br label %bb_main
+
+meshBB31.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB32: ; preds = %bb_main
+ br label %bb_main
+
+meshBB32.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB33: ; preds = %bb_main
+ br label %bb_main
+
+meshBB33.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB34: ; preds = %bb_main
+ br label %bb_main
+
+meshBB34.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB35: ; preds = %bb_main
+ br label %bb_main
+
+meshBB35.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB36: ; preds = %bb_main
+ br label %bb_main
+
+meshBB36.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB37: ; preds = %invcont.fragment, %bb_main
+ br label %bb_main
+
+meshBB37.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB37.fragment: ; preds = %bb_main
+ br label %bb_main
+
+meshBB317: ; preds = %bb_main
+ br label %bb_main
+
+meshBB318: ; preds = %invcont17.normaldest917, %bb_main
+ br label %bb_main
+
+meshBB318.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB319: ; preds = %invcont22.fragment, %bb_main
+ br label %bb_main
+
+meshBB319.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB320: ; preds = %entry1.fragment.fragment, %bb_main
+ br label %bb_main
+
+meshBB320.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB321: ; preds = %bb_main
+ br label %bb_main
+
+meshBB322: ; preds = %invcont28.fragment, %bb_main
+ br label %bb_main
+
+meshBB322.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB323: ; preds = %cond_true, %bb_main
+ br label %bb_main
+
+meshBB323.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB324: ; preds = %bb_main
+ br label %bb_main
+
+meshBB325: ; preds = %entry.fragment.fragment, %bb_main
+ br label %bb_main
+
+meshBB325.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB326: ; preds = %bb_main
+ br label %bb_main
+
+meshBB327: ; preds = %bb_main
+ br label %bb_main
+
+meshBB328: ; preds = %bb_main
+ br label %bb_main
+
+meshBB329: ; preds = %unwind10.fragment.fragment, %bb_main
+ br label %bb_main
+
+meshBB329.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB330: ; preds = %unwind37.fragment, %bb_main
+ br label %bb_main
+
+meshBB330.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB331: ; preds = %bb_main
+ br label %bb_main
+
+meshBB332: ; preds = %bb_main
+ br label %bb_main
+
+meshBB333: ; preds = %bb_main
+ br label %bb_main
+
+meshBB334: ; preds = %bb_main
+ br label %bb_main
+
+meshBB335: ; preds = %bb_main
+ br label %bb_main
+
+meshBB336: ; preds = %cond_next.fragment, %bb_main
+ br label %bb_main
+
+meshBB336.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB337: ; preds = %invcont12.fragment, %bb_main
+ br label %bb_main
+
+meshBB337.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB338: ; preds = %invcont36.normaldest, %bb_main
+ br label %bb_main
+
+meshBB338.unwinddest: ; No predecessors!
+ br label %bb_main
+
+invcont17.normaldest: ; preds = %invcont17.normaldest917, %bb_main
+ br label %bb_main
+
+invcont17.normaldest.normaldest: ; No predecessors!
+ store %"struct.std::basic_ostream<char,std::char_traits<char> >"* %tmp23, %"struct.std::basic_ostream<char,std::char_traits<char> >"** undef
+ br label %bb_main
+
+meshBB339: ; preds = %bb_main
+ br label %bb_main
+
+meshBB340: ; preds = %entry.fragment.fragment, %bb_main
+ br label %bb_main
+
+meshBB340.normaldest: ; No predecessors!
+ br label %bb_main
+
+meshBB341: ; preds = %bb_main
+ br label %bb_main
+
+meshBB342: ; preds = %bb_main
+ br label %bb_main
+
+meshBB343: ; preds = %bb_main
+ br label %bb_main
+
+meshBB344: ; preds = %bb_main
+ br label %bb_main
+
+meshBB345: ; preds = %invcont14.normaldest, %bb_main
+ br label %bb_main
+
+meshBB345.unwinddest: ; No predecessors!
+ br label %bb_main
+
+meshBB346: ; preds = %bb_main
+ br label %bb_main
+
+meshBB347: ; preds = %bb_main
+ br label %bb_main
+
+meshBB348: ; preds = %bb_main
+ br label %bb_main
+
+meshBB349: ; preds = %bb_main
+ br label %bb_main
+
+UnifiedUnreachableBlock: ; preds = %Unwind20.fragment, %filter87, %filter75, %filter62, %filter19, %Unwind.fragment, %filter
+ unreachable
+
+UnifiedReturnBlock: ; preds = %invcont70.normaldest, %invcont15.normaldest
+ ret void
+}
diff --git a/test/Transforms/LoopSimplify/basictest.ll b/test/Transforms/LoopSimplify/basictest.ll
new file mode 100644
index 000000000000..0388b0e9eac5
--- /dev/null
+++ b/test/Transforms/LoopSimplify/basictest.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -loopsimplify
+
+; This function should get a preheader inserted before BB3, that is jumped
+; to by BB1 & BB2
+;
+
+define void @test() {
+ br i1 true, label %BB1, label %BB2
+BB1: ; preds = %0
+ br label %BB3
+BB2: ; preds = %0
+ br label %BB3
+BB3: ; preds = %BB3, %BB2, %BB1
+ br label %BB3
+}
+
diff --git a/test/Transforms/LoopSimplify/dg.exp b/test/Transforms/LoopSimplify/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopSimplify/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopSimplify/hardertest.ll b/test/Transforms/LoopSimplify/hardertest.ll
new file mode 100644
index 000000000000..6ee0567dbc81
--- /dev/null
+++ b/test/Transforms/LoopSimplify/hardertest.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -loopsimplify
+
+define void @foo(i1 %C) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ br label %Loop
+F: ; preds = %0
+ br label %Loop
+Loop: ; preds = %L2, %Loop, %F, %T
+ %Val = phi i32 [ 0, %T ], [ 1, %F ], [ 2, %Loop ], [ 3, %L2 ] ; <i32> [#uses=0]
+ br i1 %C, label %Loop, label %L2
+L2: ; preds = %Loop
+ br label %Loop
+}
+
diff --git a/test/Transforms/LoopSimplify/phi-node-simplify.ll b/test/Transforms/LoopSimplify/phi-node-simplify.ll
new file mode 100644
index 000000000000..a22fadb48a4d
--- /dev/null
+++ b/test/Transforms/LoopSimplify/phi-node-simplify.ll
@@ -0,0 +1,55 @@
+; Loop Simplify should turn phi nodes like X = phi [X, Y] into just Y, eliminating them.
+; RUN: llvm-as < %s | opt -loopsimplify | llvm-dis | grep phi | count 6
+
+@A = weak global [3000000 x i32] zeroinitializer ; <[3000000 x i32]*> [#uses=1]
+@B = weak global [20000 x i32] zeroinitializer ; <[20000 x i32]*> [#uses=1]
+@C = weak global [100 x i32] zeroinitializer ; <[100 x i32]*> [#uses=1]
+@Z = weak global i32 0 ; <i32*> [#uses=2]
+
+define i32 @main() {
+entry:
+ tail call void @__main( )
+ br label %loopentry.1
+loopentry.1: ; preds = %loopexit.1, %entry
+ %indvar20 = phi i32 [ 0, %entry ], [ %indvar.next21, %loopexit.1 ] ; <i32> [#uses=1]
+ %a.1 = phi i32* [ getelementptr ([3000000 x i32]* @A, i32 0, i32 0), %entry ], [ %inc.0, %loopexit.1 ] ; <i32*> [#uses=1]
+ br label %no_exit.2
+no_exit.2: ; preds = %loopexit.2, %no_exit.2, %loopentry.1
+ %a.0.4.ph = phi i32* [ %a.1, %loopentry.1 ], [ %inc.0, %loopexit.2 ], [ %a.0.4.ph, %no_exit.2 ] ; <i32*> [#uses=3]
+ %b.1.4.ph = phi i32* [ getelementptr ([20000 x i32]* @B, i32 0, i32 0), %loopentry.1 ], [ %inc.1, %loopexit.2 ], [ %b.1.4.ph, %no_exit.2 ] ; <i32*> [#uses=3]
+ %indvar17 = phi i32 [ 0, %loopentry.1 ], [ %indvar.next18, %loopexit.2 ], [ %indvar17, %no_exit.2 ] ; <i32> [#uses=2]
+ %indvar = phi i32 [ %indvar.next, %no_exit.2 ], [ 0, %loopexit.2 ], [ 0, %loopentry.1 ] ; <i32> [#uses=5]
+ %b.1.4.rec = bitcast i32 %indvar to i32 ; <i32> [#uses=1]
+ %gep.upgrd.1 = zext i32 %indvar to i64 ; <i64> [#uses=1]
+ %c.2.4 = getelementptr [100 x i32]* @C, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
+ %gep.upgrd.2 = zext i32 %indvar to i64 ; <i64> [#uses=1]
+ %a.0.4 = getelementptr i32* %a.0.4.ph, i64 %gep.upgrd.2 ; <i32*> [#uses=1]
+ %gep.upgrd.3 = zext i32 %indvar to i64 ; <i64> [#uses=1]
+ %b.1.4 = getelementptr i32* %b.1.4.ph, i64 %gep.upgrd.3 ; <i32*> [#uses=1]
+ %inc.0.rec = add i32 %b.1.4.rec, 1 ; <i32> [#uses=2]
+ %inc.0 = getelementptr i32* %a.0.4.ph, i32 %inc.0.rec ; <i32*> [#uses=2]
+ %tmp.13 = load i32* %a.0.4 ; <i32> [#uses=1]
+ %inc.1 = getelementptr i32* %b.1.4.ph, i32 %inc.0.rec ; <i32*> [#uses=1]
+ %tmp.15 = load i32* %b.1.4 ; <i32> [#uses=1]
+ %tmp.18 = load i32* %c.2.4 ; <i32> [#uses=1]
+ %tmp.16 = mul i32 %tmp.15, %tmp.13 ; <i32> [#uses=1]
+ %tmp.19 = mul i32 %tmp.16, %tmp.18 ; <i32> [#uses=1]
+ %tmp.20 = load i32* @Z ; <i32> [#uses=1]
+ %tmp.21 = add i32 %tmp.19, %tmp.20 ; <i32> [#uses=1]
+ store i32 %tmp.21, i32* @Z
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, 100 ; <i1> [#uses=1]
+ br i1 %exitcond, label %loopexit.2, label %no_exit.2
+loopexit.2: ; preds = %no_exit.2
+ %indvar.next18 = add i32 %indvar17, 1 ; <i32> [#uses=2]
+ %exitcond19 = icmp eq i32 %indvar.next18, 200 ; <i1> [#uses=1]
+ br i1 %exitcond19, label %loopexit.1, label %no_exit.2
+loopexit.1: ; preds = %loopexit.2
+ %indvar.next21 = add i32 %indvar20, 1 ; <i32> [#uses=2]
+ %exitcond22 = icmp eq i32 %indvar.next21, 300 ; <i1> [#uses=1]
+ br i1 %exitcond22, label %return, label %loopentry.1
+return: ; preds = %loopexit.1
+ ret i32 undef
+}
+
+declare void @__main()
diff --git a/test/Transforms/LoopSimplify/single-backedge.ll b/test/Transforms/LoopSimplify/single-backedge.ll
new file mode 100644
index 000000000000..8391048eed22
--- /dev/null
+++ b/test/Transforms/LoopSimplify/single-backedge.ll
@@ -0,0 +1,20 @@
+; The loop canonicalization pass should guarantee that there is one backedge
+; for all loops. This allows the -indvars pass to recognize the %IV
+; induction variable in this testcase.
+
+; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+
+define i32 @test(i1 %C) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %BE2, %BE1, %0
+ %IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=2]
+ store i32 %IV, i32* null
+ %IV2 = add i32 %IV, 2 ; <i32> [#uses=2]
+ br i1 %C, label %BE1, label %BE2
+BE1: ; preds = %Loop
+ br label %Loop
+BE2: ; preds = %Loop
+ br label %Loop
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll b/test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll
new file mode 100644
index 000000000000..75574c07c0e8
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll
@@ -0,0 +1,57 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+
+define void @try_swap() {
+entry:
+ br i1 false, label %cond_continue.0.i, label %cond_false.0.i
+cond_false.0.i: ; preds = %entry
+ ret void
+cond_continue.0.i: ; preds = %entry
+ br i1 false, label %cond_continue.1.i, label %cond_false.1.i
+cond_false.1.i: ; preds = %cond_continue.0.i
+ ret void
+cond_continue.1.i: ; preds = %cond_continue.0.i
+ br i1 false, label %endif.3.i, label %else.0.i
+endif.3.i: ; preds = %cond_continue.1.i
+ br i1 false, label %my_irand.exit82, label %endif.0.i62
+else.0.i: ; preds = %cond_continue.1.i
+ ret void
+endif.0.i62: ; preds = %endif.3.i
+ ret void
+my_irand.exit82: ; preds = %endif.3.i
+ br i1 false, label %else.2, label %then.4
+then.4: ; preds = %my_irand.exit82
+ ret void
+else.2: ; preds = %my_irand.exit82
+ br i1 false, label %find_affected_nets.exit, label %loopentry.1.i107.outer.preheader
+loopentry.1.i107.outer.preheader: ; preds = %else.2
+ ret void
+find_affected_nets.exit: ; preds = %else.2
+ br i1 false, label %save_region_occ.exit, label %loopentry.1
+save_region_occ.exit: ; preds = %find_affected_nets.exit
+ br i1 false, label %no_exit.1.preheader, label %loopexit.1
+loopentry.1: ; preds = %find_affected_nets.exit
+ ret void
+no_exit.1.preheader: ; preds = %save_region_occ.exit
+ ret void
+loopexit.1: ; preds = %save_region_occ.exit
+ br i1 false, label %then.10, label %loopentry.3
+then.10: ; preds = %loopexit.1
+ ret void
+loopentry.3: ; preds = %endif.16, %loopexit.1
+ %indvar342 = phi i32 [ %indvar.next343, %endif.16 ], [ 0, %loopexit.1 ] ; <i32> [#uses=2]
+ br i1 false, label %loopexit.3, label %endif.16
+endif.16: ; preds = %loopentry.3
+ %indvar.next343 = add i32 %indvar342, 1 ; <i32> [#uses=1]
+ br label %loopentry.3
+loopexit.3: ; preds = %loopentry.3
+ br label %loopentry.4
+loopentry.4: ; preds = %loopentry.4, %loopexit.3
+ %indvar340 = phi i32 [ 0, %loopexit.3 ], [ %indvar.next341, %loopentry.4 ] ; <i32> [#uses=2]
+ %tmp. = add i32 %indvar340, %indvar342 ; <i32> [#uses=1]
+ %tmp.526 = load i32** null ; <i32*> [#uses=1]
+ %gep.upgrd.1 = zext i32 %tmp. to i64 ; <i64> [#uses=1]
+ %tmp.528 = getelementptr i32* %tmp.526, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp.528
+ %indvar.next341 = add i32 %indvar340, 1 ; <i32> [#uses=1]
+ br label %loopentry.4
+}
diff --git a/test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll b/test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll
new file mode 100644
index 000000000000..83d46967e5f3
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2005-08-17-OutOfLoopVariant.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+
+define i32 @image_to_texture(i32 %indvar454) {
+loopentry.1.outer:
+ %j.2.1.ph = bitcast i32 %indvar454 to i32 ; <i32> [#uses=1]
+ br label %loopentry.1
+loopentry.1: ; preds = %loopentry.1, %loopentry.1.outer
+ %i.3 = phi i32 [ 0, %loopentry.1.outer ], [ %i.3.be, %loopentry.1 ] ; <i32> [#uses=2]
+ %tmp.390 = load i32* null ; <i32> [#uses=1]
+ %tmp.392 = mul i32 %tmp.390, %j.2.1.ph ; <i32> [#uses=1]
+ %tmp.394 = add i32 %tmp.392, %i.3 ; <i32> [#uses=1]
+ %i.3.be = add i32 %i.3, 1 ; <i32> [#uses=1]
+ br i1 false, label %loopentry.1, label %label.6
+label.6: ; preds = %loopentry.1
+ ret i32 %tmp.394
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll b/test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll
new file mode 100644
index 000000000000..145551bded22
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2005-09-12-UsesOutOutsideOfLoop.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+
+define void @main() {
+entry:
+ br label %loopentry.0
+loopentry.0: ; preds = %then.5, %entry
+ %arg_index.1.ph = phi i32 [ 1, %entry ], [ %arg_index.1.ph.be, %then.5 ] ; <i32> [#uses=1]
+ br i1 false, label %no_exit.0, label %loopexit.0
+no_exit.0: ; preds = %loopentry.0
+ %arg_index.1.1 = add i32 0, %arg_index.1.ph ; <i32> [#uses=2]
+ br i1 false, label %then.i55, label %endif.i61
+then.i55: ; preds = %no_exit.0
+ br i1 false, label %then.4, label %else.1
+endif.i61: ; preds = %no_exit.0
+ ret void
+then.4: ; preds = %then.i55
+ %tmp.19993 = add i32 %arg_index.1.1, 2 ; <i32> [#uses=0]
+ ret void
+else.1: ; preds = %then.i55
+ br i1 false, label %then.i86, label %loopexit.i97
+then.i86: ; preds = %else.1
+ ret void
+loopexit.i97: ; preds = %else.1
+ br i1 false, label %then.5, label %else.2
+then.5: ; preds = %loopexit.i97
+ %arg_index.1.ph.be = add i32 %arg_index.1.1, 2 ; <i32> [#uses=1]
+ br label %loopentry.0
+else.2: ; preds = %loopexit.i97
+ ret void
+loopexit.0: ; preds = %loopentry.0
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll b/test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll
new file mode 100644
index 000000000000..2d2dade0bdc2
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2007-04-23-UseIterator.ll
@@ -0,0 +1,71 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+
+target triple = "i686-apple-darwin9"
+
+define i8* @foo( i8* %ABC) {
+entry:
+ switch i8 0, label %bb129 [
+ i8 0, label %UnifiedReturnBlock
+ i8 9, label %UnifiedReturnBlock
+ i8 32, label %UnifiedReturnBlock
+ i8 35, label %UnifiedReturnBlock
+ i8 37, label %bb16.preheader
+ ]
+
+bb16.preheader: ; preds = %entry
+ br label %bb16
+
+bb16: ; preds = %cond_next102, %bb16.preheader
+ %indvar = phi i32 [ %indvar.next, %cond_next102 ], [ 0, %bb16.preheader ] ; <i32> [#uses=2]
+ %ABC.2146.0.rec = mul i32 %indvar, 3 ; <i32> [#uses=1]
+ br i1 false, label %UnifiedReturnBlock.loopexit, label %cond_next102
+
+cond_next102: ; preds = %bb16
+ %tmp138145.rec = add i32 %ABC.2146.0.rec, 3 ; <i32> [#uses=1]
+ %tmp138145 = getelementptr i8* %ABC, i32 %tmp138145.rec ; <i8*> [#uses=4]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ switch i8 0, label %bb129.loopexit [
+ i8 0, label %UnifiedReturnBlock.loopexit
+ i8 9, label %UnifiedReturnBlock.loopexit
+ i8 32, label %UnifiedReturnBlock.loopexit
+ i8 35, label %UnifiedReturnBlock.loopexit
+ i8 37, label %bb16
+ ]
+
+bb129.loopexit: ; preds = %cond_next102
+ br label %bb129
+
+bb129: ; preds = %bb129.loopexit, %entry
+ ret i8* null
+
+UnifiedReturnBlock.loopexit: ; preds = %cond_next102, %cond_next102, %cond_next102, %cond_next102, %bb16
+ %UnifiedRetVal.ph = phi i8* [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ null, %bb16 ] ; <i8*> [#uses=0]
+ br label %UnifiedReturnBlock
+
+UnifiedReturnBlock: ; preds = %UnifiedReturnBlock.loopexit, %entry, %entry, %entry, %entry
+ ret i8* null
+}
+
+define i8* @bar() {
+entry:
+ switch i8 0, label %bb158 [
+ i8 37, label %bb74
+ i8 58, label %cond_true
+ i8 64, label %bb11
+ ]
+
+bb11: ; preds = %entry
+ ret i8* null
+
+cond_true: ; preds = %entry
+ ret i8* null
+
+bb74: ; preds = %entry
+ ret i8* null
+
+bb158: ; preds = %entry
+ ret i8* null
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll b/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll
new file mode 100644
index 000000000000..be95d4dce664
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2008-08-06-CmpStride.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep ugt
+; PR2535
+
+@.str = internal constant [4 x i8] c"%d\0A\00"
+
+declare i32 @printf(i8* noalias , ...) nounwind
+
+define i32 @main() nounwind {
+entry:
+ br label %forbody
+
+forbody:
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ] ; <i32>[#uses=3]
+ %sub14 = sub i32 1027, %i.0 ; <i32> [#uses=1]
+ %mul15 = mul i32 %sub14, 10 ; <i32> [#uses=1]
+ %add166 = or i32 %mul15, 1 ; <i32> [#uses=1] *
+ call i32 (i8*, ...)* @printf( i8* noalias getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %add166 ) nounwind
+ %inc = add i32 %i.0, 1 ; <i32> [#uses=3]
+ %cmp = icmp ult i32 %inc, 1027 ; <i1> [#uses=1]
+ br i1 %cmp, label %forbody, label %afterfor
+
+afterfor: ; preds = %forcond
+ ret i32 0
+}
diff --git a/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll b/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll
new file mode 100644
index 000000000000..fbd3c1e8a617
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep add | count 2
+; PR 2662
+@g_3 = common global i16 0 ; <i16*> [#uses=2]
+@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define void @func_1() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %l_2.0.reg2mem.0 = phi i16 [ 0, %entry ], [ %t1, %bb ] ; <i16> [#uses=2]
+ %t0 = shl i16 %l_2.0.reg2mem.0, 1 ; <i16>:0 [#uses=1]
+ volatile store i16 %t0, i16* @g_3, align 2
+ %t1 = add i16 %l_2.0.reg2mem.0, -3 ; <i16>:1 [#uses=2]
+ %t2 = icmp slt i16 %t1, 1 ; <i1>:2 [#uses=1]
+ br i1 %t2, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ tail call void @func_1( ) nounwind
+ volatile load i16* @g_3, align 2 ; <i16>:0 [#uses=1]
+ zext i16 %0 to i32 ; <i32>:1 [#uses=1]
+ tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %1 ) nounwind ; <i32>:2 [#uses=0]
+ ret i32 0
+}
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll b/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll
new file mode 100644
index 000000000000..2377589b0ebf
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2008-08-14-ShadowIV.ll
@@ -0,0 +1,99 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep "phi double" | count 1
+
+define void @foobar(i32 %n) nounwind {
+entry:
+ icmp eq i32 %n, 0 ; <i1>:0 [#uses=2]
+ br i1 %0, label %return, label %bb.nph
+
+bb.nph: ; preds = %entry
+ %umax = select i1 %0, i32 1, i32 %n ; <i32> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %i.03 = phi i32 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i32> [#uses=3]
+ tail call void @bar( i32 %i.03 ) nounwind
+ uitofp i32 %i.03 to double ; <double>:1 [#uses=1]
+ tail call void @foo( double %1 ) nounwind
+ %indvar.next = add i32 %i.03, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %umax ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %bb
+
+return: ; preds = %bb, %entry
+ ret void
+}
+
+; Unable to eliminate cast because the mantissa bits for double are not enough
+; to hold all of i64 IV bits.
+define void @foobar2(i64 %n) nounwind {
+entry:
+ icmp eq i64 %n, 0 ; <i1>:0 [#uses=2]
+ br i1 %0, label %return, label %bb.nph
+
+bb.nph: ; preds = %entry
+ %umax = select i1 %0, i64 1, i64 %n ; <i64> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %i.03 = phi i64 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i64> [#uses=3]
+ trunc i64 %i.03 to i32 ; <i32>:1 [#uses=1]
+ tail call void @bar( i32 %1 ) nounwind
+ uitofp i64 %i.03 to double ; <double>:2 [#uses=1]
+ tail call void @foo( double %2 ) nounwind
+ %indvar.next = add i64 %i.03, 1 ; <i64> [#uses=2]
+ %exitcond = icmp eq i64 %indvar.next, %umax ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %bb
+
+return: ; preds = %bb, %entry
+ ret void
+}
+
+; Unable to eliminate cast due to potentional overflow.
+define void @foobar3() nounwind {
+entry:
+ tail call i32 (...)* @nn( ) nounwind ; <i32>:0 [#uses=1]
+ icmp eq i32 %0, 0 ; <i1>:1 [#uses=1]
+ br i1 %1, label %return, label %bb
+
+bb: ; preds = %bb, %entry
+ %i.03 = phi i32 [ 0, %entry ], [ %3, %bb ] ; <i32> [#uses=3]
+ tail call void @bar( i32 %i.03 ) nounwind
+ uitofp i32 %i.03 to double ; <double>:2 [#uses=1]
+ tail call void @foo( double %2 ) nounwind
+ add i32 %i.03, 1 ; <i32>:3 [#uses=2]
+ tail call i32 (...)* @nn( ) nounwind ; <i32>:4 [#uses=1]
+ icmp ugt i32 %4, %3 ; <i1>:5 [#uses=1]
+ br i1 %5, label %bb, label %return
+
+return: ; preds = %bb, %entry
+ ret void
+}
+
+; Unable to eliminate cast due to overflow.
+define void @foobar4() nounwind {
+entry:
+ br label %bb.nph
+
+bb.nph: ; preds = %entry
+ br label %bb
+
+bb: ; preds = %bb, %bb.nph
+ %i.03 = phi i8 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i32> [#uses=3]
+ %tmp2 = sext i8 %i.03 to i32 ; <i32>:0 [#uses=1]
+ tail call void @bar( i32 %tmp2 ) nounwind
+ %tmp3 = uitofp i8 %i.03 to double ; <double>:1 [#uses=1]
+ tail call void @foo( double %tmp3 ) nounwind
+ %indvar.next = add i8 %i.03, 1 ; <i32> [#uses=2]
+ %tmp = sext i8 %indvar.next to i32
+ %exitcond = icmp eq i32 %tmp, 32767 ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %bb
+
+return: ; preds = %bb, %entry
+ ret void
+}
+
+declare void @bar(i32)
+
+declare void @foo(double)
+
+declare i32 @nn(...)
+
diff --git a/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll b/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll
new file mode 100644
index 000000000000..703aebef7ca1
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll
@@ -0,0 +1,48 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 2
+; PR 2779
+@g_19 = common global i32 0 ; <i32*> [#uses=3]
+@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define i32 @func_8(i8 zeroext %p_9) nounwind {
+entry:
+ ret i32 1
+}
+
+define i32 @func_3(i8 signext %p_5) nounwind {
+entry:
+ ret i32 1
+}
+
+define void @func_1() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %indvar = phi i16 [ 0, %entry ], [ %indvar.next, %bb ] ; <i16> [#uses=2]
+ %tmp = sub i16 0, %indvar ; <i16> [#uses=1]
+ %tmp27 = trunc i16 %tmp to i8 ; <i8> [#uses=1]
+ load i32* @g_19, align 4 ; <i32>:0 [#uses=2]
+ add i32 %0, 1 ; <i32>:1 [#uses=1]
+ store i32 %1, i32* @g_19, align 4
+ trunc i32 %0 to i8 ; <i8>:2 [#uses=1]
+ tail call i32 @func_8( i8 zeroext %2 ) nounwind ; <i32>:3 [#uses=0]
+ shl i8 %tmp27, 2 ; <i8>:4 [#uses=1]
+ add i8 %4, -112 ; <i8>:5 [#uses=1]
+ tail call i32 @func_3( i8 signext %5 ) nounwind ; <i32>:6 [#uses=0]
+ %indvar.next = add i16 %indvar, 1 ; <i16> [#uses=2]
+ %exitcond = icmp eq i16 %indvar.next, -28 ; <i1> [#uses=1]
+ br i1 %exitcond, label %return, label %bb
+
+return: ; preds = %bb
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ tail call void @func_1( ) nounwind
+ load i32* @g_19, align 4 ; <i32>:0 [#uses=1]
+ tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %0 ) nounwind ; <i32>:1 [#uses=0]
+ ret i32 0
+}
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll b/test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll
new file mode 100644
index 000000000000..a7072858c8ac
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2009-01-13-nonconstant-stride-outside-loop.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 1
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep mul | count 1
+; ModuleID = '<stdin>'
+; Make sure examining a fuller expression outside the loop doesn't cause us to create a second
+; IV of stride %3.
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.5"
+ %struct.anon = type { %struct.obj*, %struct.obj* }
+ %struct.obj = type { i16, i16, { %struct.anon } }
+@heap_size = external global i32 ; <i32*> [#uses=1]
+@"\01LC85" = external constant [39 x i8] ; <[39 x i8]*> [#uses=1]
+
+declare i32 @sprintf(i8*, i8*, ...) nounwind
+
+define %struct.obj* @gc_status(%struct.obj* %args) nounwind {
+entry:
+ br label %bb1.i
+
+bb.i2: ; preds = %bb2.i3
+ %indvar.next24 = add i32 %m.0.i, 1 ; <i32> [#uses=1]
+ br label %bb1.i
+
+bb1.i: ; preds = %bb.i2, %entry
+ %m.0.i = phi i32 [ 0, %entry ], [ %indvar.next24, %bb.i2 ] ; <i32> [#uses=4]
+ %0 = icmp slt i32 %m.0.i, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb2.i3, label %nactive_heaps.exit
+
+bb2.i3: ; preds = %bb1.i
+ %1 = load %struct.obj** null, align 4 ; <%struct.obj*> [#uses=1]
+ %2 = icmp eq %struct.obj* %1, null ; <i1> [#uses=1]
+ br i1 %2, label %nactive_heaps.exit, label %bb.i2
+
+nactive_heaps.exit: ; preds = %bb2.i3, %bb1.i
+ %3 = load i32* @heap_size, align 4 ; <i32> [#uses=1]
+ %4 = mul i32 %3, %m.0.i ; <i32> [#uses=1]
+ %5 = sub i32 %4, 0 ; <i32> [#uses=1]
+ %6 = tail call i32 (i8*, i8*, ...)* @sprintf(i8* null, i8* getelementptr ([39 x i8]* @"\01LC85", i32 0, i32 0), i32 %m.0.i, i32 0, i32 %5, i32 0) nounwind ; <i32> [#uses=0]
+ ret %struct.obj* null
+}
diff --git a/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll b/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
new file mode 100644
index 000000000000..0235fa8ff7ae
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | llc
+; This used to crash.
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout ="e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @parse_number(i8* nocapture %p) nounwind {
+entry:
+ %shift.0 = select i1 false, i32 4, i32 2 ; <i32> [#uses=1]
+ br label %bb47
+
+bb47: ; preds = %bb47, %entry
+ br i1 false, label %bb54, label %bb47
+
+bb54: ; preds = %bb47
+ br i1 false, label %bb56, label %bb66
+
+bb56: ; preds = %bb62, %bb54
+ %p_addr.0.pn.rec = phi i64 [ %p_addr.6.rec, %bb62 ], [ 0, %bb54 ] ; <i64> [#uses=2]
+ %ch.6.in.in = phi i8* [ %p_addr.6, %bb62 ], [ null, %bb54 ] ; <i8*> [#uses=0]
+ %indvar202 = trunc i64 %p_addr.0.pn.rec to i32 ; <i32>[#uses=1]
+ %frac_bits.0 = mul i32 %indvar202, %shift.0 ; <i32>[#uses=1]
+ %p_addr.6.rec = add i64 %p_addr.0.pn.rec, 1 ; <i64>[#uses=2]
+ %p_addr.6 = getelementptr i8* null, i64 %p_addr.6.rec ; <i8*>[#uses=1]
+ br i1 false, label %bb66, label %bb62
+
+bb62: ; preds = %bb56
+ br label %bb56
+
+bb66: ; preds = %bb56, %bb54
+ %frac_bits.1 = phi i32 [ 0, %bb54 ], [ %frac_bits.0, %bb56 ] ; <i32> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll b/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll
new file mode 100644
index 000000000000..e1c9642ce818
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/2009-04-28-no-reduce-mul.ll
@@ -0,0 +1,44 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis \
+; RUN: | grep {getelementptr.*%lsr.iv.*%lsr.iv.*<i32\\*>}
+; The multiply in bb2 must not be reduced to an add, as the sext causes the
+; %1 argument to become negative after a while.
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+@table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2]
+
+define i32 @main() nounwind {
+bb4.thread:
+ br label %bb2
+
+bb2: ; preds = %bb4, %bb2, %bb4.thread
+ %i.0.reg2mem.0.ph = phi i32 [ 0, %bb4.thread ], [ %i.0.reg2mem.0.ph, %bb2 ], [ %indvar.next9, %bb4 ] ; <i32> [#uses=4]
+ %j.0.reg2mem.0 = phi i32 [ 0, %bb4.thread ], [ %indvar.next, %bb2 ], [ 0, %bb4 ] ; <i32> [#uses=3]
+ %0 = trunc i32 %j.0.reg2mem.0 to i8 ; <i8> [#uses=1]
+ %1 = sext i8 %0 to i32 ; <i32> [#uses=1]
+ %2 = mul i32 %1, %i.0.reg2mem.0.ph ; <i32> [#uses=1]
+ %3 = getelementptr [32 x [256 x i32]]* @table, i32 0, i32 %i.0.reg2mem.0.ph, i32 %j.0.reg2mem.0 ; <i32*> [#uses=1]
+ store i32 %2, i32* %3, align 4
+ %indvar.next = add i32 %j.0.reg2mem.0, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, 256 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb4, label %bb2
+
+bb4: ; preds = %bb2
+ %indvar.next9 = add i32 %i.0.reg2mem.0.ph, 1 ; <i32> [#uses=2]
+ %exitcond10 = icmp eq i32 %indvar.next9, 32 ; <i1> [#uses=1]
+ br i1 %exitcond10, label %bb5, label %bb2
+
+bb5: ; preds = %bb4
+ %4 = load i32* getelementptr ([32 x [256 x i32]]* @table, i32 0, i32 9, i32 132), align 16 ; <i32> [#uses=1]
+ %5 = icmp eq i32 %4, -1116 ; <i1> [#uses=1]
+ br i1 %5, label %bb7, label %bb6
+
+bb6: ; preds = %bb5
+ tail call void @abort() noreturn nounwind
+ unreachable
+
+bb7: ; preds = %bb5
+ ret i32 0
+}
+
+declare void @abort() noreturn nounwind
diff --git a/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll b/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll
new file mode 100644
index 000000000000..33b052215117
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | llc --x86-asm-syntax=att | grep {cmpl \$4}
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin9"
+
+; This is like change-compare-stride-trickiness-1.ll except the comparison
+; happens before the relevant use, so the comparison stride can't be
+; easily changed.
+
+define void @foo() {
+entry:
+ br label %loop
+
+loop:
+ %indvar = phi i32 [ 0, %entry ], [ %i.2.0.us1534, %loop ] ; <i32> [#uses=1]
+ %i.2.0.us1534 = add i32 %indvar, 1 ; <i32> [#uses=3]
+ %tmp611.us1535 = icmp eq i32 %i.2.0.us1534, 4 ; <i1> [#uses=2]
+ %tmp623.us1538 = select i1 %tmp611.us1535, i32 6, i32 0 ; <i32> [#uses=0]
+ %tmp628.us1540 = shl i32 %i.2.0.us1534, 1 ; <i32> [#uses=1]
+ %tmp645646647.us1547 = sext i32 %tmp628.us1540 to i64 ; <i64> [#uses=0]
+ br i1 %tmp611.us1535, label %exit, label %loop
+
+exit:
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll b/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll
new file mode 100644
index 000000000000..cb2f3aa5166d
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | llc --x86-asm-syntax=att | grep {cmpq \$8}
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin9"
+
+; This is like change-compare-stride-trickiness-0.ll except the comparison
+; happens after the relevant use, so the comparison stride can be
+; easily changed.
+
+define void @foo() nounwind {
+entry:
+ br label %loop
+
+loop:
+ %indvar = phi i32 [ 0, %entry ], [ %i.2.0.us1534, %loop ] ; <i32> [#uses=1]
+ %i.2.0.us1534 = add i32 %indvar, 1 ; <i32> [#uses=3]
+ %tmp628.us1540 = shl i32 %i.2.0.us1534, 1 ; <i32> [#uses=1]
+ %tmp645646647.us1547 = sext i32 %tmp628.us1540 to i64 ; <i64> [#uses=1]
+ store i64 %tmp645646647.us1547, i64* null
+ %tmp611.us1535 = icmp eq i32 %i.2.0.us1534, 4 ; <i1> [#uses=2]
+ %tmp623.us1538 = select i1 %tmp611.us1535, i32 6, i32 0 ; <i32> [#uses=1]
+ store i32 %tmp623.us1538, i32* null
+ br i1 %tmp611.us1535, label %exit, label %loop
+
+exit:
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll b/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll
new file mode 100644
index 000000000000..f77aea393701
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-2.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | llc
+; PR4222
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "x86_64-pc-linux-gnu"
+module asm ".ident\09\22$FreeBSD: head/sys/amd64/amd64/minidump_machdep.c 184499 2008-10-31 10:11:35Z kib $\22"
+ %struct.dumperinfo = type <{ i32 (i8*, i8*, i64, i64, i64)*, i8*, i32, i32, i64, i64 }>
+
+define void @minidumpsys(%struct.dumperinfo* %di) nounwind {
+entry:
+ br label %if.end
+
+if.end: ; preds = %if.end52, %entry
+ br label %for.cond.i.preheader
+
+for.cond.i.preheader: ; preds = %if.end52, %if.end
+ %indvar688 = phi i64 [ 0, %if.end ], [ %indvar.next689, %if.end52 ] ; <i64> [#uses=3]
+ %tmp690 = shl i64 %indvar688, 12 ; <i64> [#uses=1]
+ %pa.0642 = add i64 %tmp690, 0 ; <i64> [#uses=1]
+ %indvar688703 = trunc i64 %indvar688 to i32 ; <i32> [#uses=1]
+ %tmp692693 = add i32 %indvar688703, 1 ; <i32> [#uses=1]
+ %phitmp = sext i32 %tmp692693 to i64 ; <i64> [#uses=1]
+ br i1 false, label %if.end52, label %land.lhs.true.i
+
+land.lhs.true.i: ; preds = %for.cond.i.preheader
+ %shr2.i = lshr i64 %pa.0642, 18 ; <i64> [#uses=0]
+ unreachable
+
+if.end52: ; preds = %for.cond.i.preheader
+ %phitmp654 = icmp ult i64 %phitmp, 512 ; <i1> [#uses=1]
+ %indvar.next689 = add i64 %indvar688, 1 ; <i64> [#uses=1]
+ br i1 %phitmp654, label %for.cond.i.preheader, label %if.end
+}
+
+define void @promote(%struct.dumperinfo* %di) nounwind {
+entry:
+ br label %if.end
+
+if.end: ; preds = %if.end52, %entry
+ br label %for.cond.i.preheader
+
+for.cond.i.preheader: ; preds = %if.end52, %if.end
+ %indvar688 = phi i32 [ 0, %if.end ], [ %indvar.next689, %if.end52 ] ; <i64> [#uses=3]
+ %tmp690 = shl i32 %indvar688, 12 ; <i64> [#uses=1]
+ %pa.0642 = add i32 %tmp690, 0 ; <i64> [#uses=1]
+ %tmp692693 = add i32 %indvar688, 1 ; <i32> [#uses=1]
+ %phitmp = sext i32 %tmp692693 to i64 ; <i64> [#uses=1]
+ br i1 false, label %if.end52, label %land.lhs.true.i
+
+land.lhs.true.i: ; preds = %for.cond.i.preheader
+ %shr2.i = lshr i32 %pa.0642, 18 ; <i64> [#uses=0]
+ unreachable
+
+if.end52: ; preds = %for.cond.i.preheader
+ %phitmp654 = icmp ult i64 %phitmp, 512 ; <i1> [#uses=1]
+ %indvar.next689 = add i32 %indvar688, 1 ; <i64> [#uses=1]
+ br i1 %phitmp654, label %for.cond.i.preheader, label %if.end
+}
diff --git a/test/Transforms/LoopStrengthReduce/dead-phi.ll b/test/Transforms/LoopStrengthReduce/dead-phi.ll
new file mode 100644
index 000000000000..a6aafa911dab
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dead-phi.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 1
+
+define void @foo(i32 %n) {
+entry:
+ br label %loop
+
+loop:
+ %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
+
+ ; These three instructions form an isolated cycle and can be deleted.
+ %j = phi i32 [ 0, %entry ], [ %j.y, %loop ]
+ %j.x = add i32 %j, 1
+ %j.y = mul i32 %j.x, 2
+
+ %i.next = add i32 %i, 1
+ %c = icmp ne i32 %i.next, %n
+ br i1 %c, label %loop, label %exit
+
+exit:
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/dg.exp b/test/Transforms/LoopStrengthReduce/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopStrengthReduce/different-type-ivs.ll b/test/Transforms/LoopStrengthReduce/different-type-ivs.ll
new file mode 100644
index 000000000000..e5225da56ded
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/different-type-ivs.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+; Test to make sure that loop-reduce never crashes on IV's
+; with different types but identical strides.
+
+define void @foo() {
+entry:
+ br label %no_exit
+no_exit: ; preds = %no_exit, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=3]
+ %indvar.upgrd.1 = trunc i32 %indvar to i16 ; <i16> [#uses=1]
+ %X.0.0 = mul i16 %indvar.upgrd.1, 1234 ; <i16> [#uses=1]
+ %tmp. = mul i32 %indvar, 1234 ; <i32> [#uses=1]
+ %tmp.5 = sext i16 %X.0.0 to i32 ; <i32> [#uses=1]
+ %tmp.3 = call i32 (...)* @bar( i32 %tmp.5, i32 %tmp. ) ; <i32> [#uses=0]
+ %tmp.0 = call i1 @pred( ) ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp.0, label %return, label %no_exit
+return: ; preds = %no_exit
+ ret void
+}
+
+declare i1 @pred()
+
+declare i32 @bar(...)
+
diff --git a/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll b/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll
new file mode 100644
index 000000000000..52095070ae0a
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: not grep {bitcast i32 1 to i32}
+; END.
+; The setlt wants to use a value that is incremented one more than the dominant
+; IV. Don't insert the 1 outside the loop, preventing folding it into the add.
+
+define void @test([700 x i32]* %nbeaux_.0__558, i32* %i_.16574) {
+then.0:
+ br label %no_exit.2
+no_exit.2: ; preds = %no_exit.2, %then.0
+ %indvar630 = phi i32 [ 0, %then.0 ], [ %indvar.next631, %no_exit.2 ] ; <i32> [#uses=4]
+ %gep.upgrd.1 = zext i32 %indvar630 to i64 ; <i64> [#uses=1]
+ %tmp.38 = getelementptr [700 x i32]* %nbeaux_.0__558, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp.38
+ %inc.2 = add i32 %indvar630, 2 ; <i32> [#uses=2]
+ %tmp.34 = icmp slt i32 %inc.2, 701 ; <i1> [#uses=1]
+ %indvar.next631 = add i32 %indvar630, 1 ; <i32> [#uses=1]
+ br i1 %tmp.34, label %no_exit.2, label %loopexit.2.loopexit
+loopexit.2.loopexit: ; preds = %no_exit.2
+ store i32 %inc.2, i32* %i_.16574
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll b/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll
new file mode 100644
index 000000000000..68eb107f1091
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll
@@ -0,0 +1,36 @@
+; Check that this test makes INDVAR and related stuff dead.
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 2
+
+declare i1 @pred()
+
+define void @test1({ i32, i32 }* %P) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=3]
+ %gep1 = getelementptr { i32, i32 }* %P, i32 %INDVAR, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %gep1
+ %gep2 = getelementptr { i32, i32 }* %P, i32 %INDVAR, i32 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %gep2
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ %cond = call i1 @pred( ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
+define void @test2([2 x i32]* %P) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=3]
+ %gep1 = getelementptr [2 x i32]* %P, i32 %INDVAR, i64 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %gep1
+ %gep2 = getelementptr [2 x i32]* %P, i32 %INDVAR, i64 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %gep2
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ %cond = call i1 @pred( ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll b/test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll
new file mode 100644
index 000000000000..bfbbecfdb267
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dont_reduce_bytes.ll
@@ -0,0 +1,22 @@
+; Don't reduce the byte access to P[i], at least not on targets that
+; support an efficient 'mem[r1+r2]' addressing mode.
+
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+
+
+declare i1 @pred(i32)
+
+define void @test(i8* %PTR) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
+ %STRRED = getelementptr i8* %PTR, i32 %INDVAR ; <i8*> [#uses=1]
+ store i8 0, i8* %STRRED
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=2]
+ ;; cannot eliminate indvar
+ %cond = call i1 @pred( i32 %INDVAR2 ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/dont_reverse.ll b/test/Transforms/LoopStrengthReduce/dont_reverse.ll
new file mode 100644
index 000000000000..39eca6c96308
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/dont_reverse.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis \
+; RUN: | grep {icmp eq i2 %lsr.iv.next, %xmp4344}
+
+; Don't reverse the iteration if the rhs of the compare is defined
+; inside the loop.
+
+define void @Fill_Buffer() nounwind {
+entry:
+ br label %bb8
+
+bb8:
+ %indvar34 = phi i32 [ 0, %entry ], [ %indvar.next35, %bb8 ]
+ %indvar3451 = trunc i32 %indvar34 to i2
+ %xmp4344 = xor i2 0, -1
+ %xmp104 = icmp eq i2 %indvar3451, %xmp4344
+ %indvar.next35 = add i32 %indvar34, 1
+ br i1 %xmp104, label %bb10, label %bb8
+
+bb10:
+ unreachable
+}
diff --git a/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll b/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll
new file mode 100644
index 000000000000..d21498b0a457
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/exit_compare_live_range.ll
@@ -0,0 +1,20 @@
+; Make sure that the compare instruction occurs after the increment to avoid
+; having overlapping live ranges that result in copies. We want the setcc
+; instruction immediately before the conditional branch.
+;
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: %prcontext {br i1} 1 | grep icmp
+
+define void @foo(float* %D, i32 %E) {
+entry:
+ br label %no_exit
+no_exit: ; preds = %no_exit, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=1]
+ volatile store float 0.000000e+00, float* %D
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %E ; <i1> [#uses=1]
+ br i1 %exitcond, label %loopexit, label %no_exit
+loopexit: ; preds = %no_exit
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/invariant_value_first.ll b/test/Transforms/LoopStrengthReduce/invariant_value_first.ll
new file mode 100644
index 000000000000..86a1c257655b
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/invariant_value_first.ll
@@ -0,0 +1,23 @@
+; Check that the index of 'P[outer]' is pulled out of the loop.
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: not grep {getelementptr.*%outer.*%INDVAR}
+
+declare i1 @pred()
+
+declare i32 @foo()
+
+define void @test([10000 x i32]* %P) {
+; <label>:0
+ %outer = call i32 @foo( ) ; <i32> [#uses=1]
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
+ %STRRED = getelementptr [10000 x i32]* %P, i32 %outer, i32 %INDVAR ; <i32*> [#uses=1]
+ store i32 0, i32* %STRRED
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ %cond = call i1 @pred( ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll b/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll
new file mode 100644
index 000000000000..8e9cbc4a81ef
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/invariant_value_first_arg.ll
@@ -0,0 +1,20 @@
+; Check that the index of 'P[outer]' is pulled out of the loop.
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: not grep {getelementptr.*%outer.*%INDVAR}
+
+declare i1 @pred()
+
+define void @test([10000 x i32]* %P, i32 %outer) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
+ %STRRED = getelementptr [10000 x i32]* %P, i32 %outer, i32 %INDVAR ; <i32*> [#uses=1]
+ store i32 0, i32* %STRRED
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ %cond = call i1 @pred( ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/nested-reduce.ll b/test/Transforms/LoopStrengthReduce/nested-reduce.ll
new file mode 100644
index 000000000000..c19e844ea2bb
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/nested-reduce.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | not grep mul
+
+; Make sure we don't get a multiply by 6 in this loop.
+
+define i32 @foo(i32 %A, i32 %B, i32 %C, i32 %D) {
+entry:
+ %tmp.5 = icmp sgt i32 %C, 0 ; <i1> [#uses=1]
+ %tmp.25 = and i32 %A, 1 ; <i32> [#uses=1]
+ br label %loopentry.1
+loopentry.1: ; preds = %loopexit.1, %entry
+ %indvar20 = phi i32 [ 0, %entry ], [ %indvar.next21, %loopexit.1 ] ; <i32> [#uses=2]
+ %k.1 = phi i32 [ 0, %entry ], [ %k.1.3, %loopexit.1 ] ; <i32> [#uses=2]
+ br i1 %tmp.5, label %no_exit.1.preheader, label %loopexit.1
+no_exit.1.preheader: ; preds = %loopentry.1
+ %i.0.0 = bitcast i32 %indvar20 to i32 ; <i32> [#uses=1]
+ %tmp.9 = mul i32 %i.0.0, 6 ; <i32> [#uses=1]
+ br label %no_exit.1.outer
+no_exit.1.outer: ; preds = %cond_true, %no_exit.1.preheader
+ %k.1.2.ph = phi i32 [ %k.1, %no_exit.1.preheader ], [ %k.09, %cond_true ] ; <i32> [#uses=2]
+ %j.1.2.ph = phi i32 [ 0, %no_exit.1.preheader ], [ %inc.1, %cond_true ] ; <i32> [#uses=1]
+ br label %no_exit.1
+no_exit.1: ; preds = %cond_continue, %no_exit.1.outer
+ %indvar.ui = phi i32 [ 0, %no_exit.1.outer ], [ %indvar.next, %cond_continue ] ; <i32> [#uses=2]
+ %indvar = bitcast i32 %indvar.ui to i32 ; <i32> [#uses=1]
+ %j.1.2 = add i32 %indvar, %j.1.2.ph ; <i32> [#uses=2]
+ %tmp.11 = add i32 %j.1.2, %tmp.9 ; <i32> [#uses=1]
+ %tmp.12 = trunc i32 %tmp.11 to i8 ; <i8> [#uses=1]
+ %shift.upgrd.1 = zext i8 %tmp.12 to i32 ; <i32> [#uses=1]
+ %tmp.13 = shl i32 %D, %shift.upgrd.1 ; <i32> [#uses=2]
+ %tmp.15 = icmp eq i32 %tmp.13, %B ; <i1> [#uses=1]
+ %inc.1 = add i32 %j.1.2, 1 ; <i32> [#uses=3]
+ br i1 %tmp.15, label %cond_true, label %cond_continue
+cond_true: ; preds = %no_exit.1
+ %tmp.26 = and i32 %tmp.25, %tmp.13 ; <i32> [#uses=1]
+ %k.09 = add i32 %tmp.26, %k.1.2.ph ; <i32> [#uses=2]
+ %tmp.517 = icmp slt i32 %inc.1, %C ; <i1> [#uses=1]
+ br i1 %tmp.517, label %no_exit.1.outer, label %loopexit.1
+cond_continue: ; preds = %no_exit.1
+ %tmp.519 = icmp slt i32 %inc.1, %C ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar.ui, 1 ; <i32> [#uses=1]
+ br i1 %tmp.519, label %no_exit.1, label %loopexit.1
+loopexit.1: ; preds = %cond_continue, %cond_true, %loopentry.1
+ %k.1.3 = phi i32 [ %k.1, %loopentry.1 ], [ %k.09, %cond_true ], [ %k.1.2.ph, %cond_continue ] ; <i32> [#uses=2]
+ %indvar.next21 = add i32 %indvar20, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next21, 4 ; <i1> [#uses=1]
+ br i1 %exitcond, label %loopexit.0, label %loopentry.1
+loopexit.0: ; preds = %loopexit.1
+ ret i32 %k.1.3
+}
diff --git a/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll b/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll
new file mode 100644
index 000000000000..5880dc15f0d2
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/ops_after_indvar.ll
@@ -0,0 +1,24 @@
+; Check that this test makes INDVAR and related stuff dead, because P[indvar]
+; gets reduced, making INDVAR dead.
+
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | not grep INDVAR
+
+declare i1 @pred()
+
+declare i32 @getidx()
+
+define void @test([10000 x i32]* %P) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
+ %idx = call i32 @getidx( ) ; <i32> [#uses=1]
+ %STRRED = getelementptr [10000 x i32]* %P, i32 %INDVAR, i32 %idx ; <i32*> [#uses=1]
+ store i32 0, i32* %STRRED
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ %cond = call i1 @pred( ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll b/test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll
new file mode 100644
index 000000000000..64d387a4a936
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+; LSR should not crash on this.
+
+define fastcc void @loadloop() {
+entry:
+ switch i8 0, label %shortcirc_next [
+ i8 32, label %loopexit.2
+ i8 59, label %loopexit.2
+ ]
+shortcirc_next: ; preds = %no_exit.2, %entry
+ %indvar37 = phi i32 [ 0, %entry ], [ %indvar.next38, %no_exit.2 ] ; <i32> [#uses=3]
+ %gep.upgrd.1 = zext i32 %indvar37 to i64 ; <i64> [#uses=1]
+ %wp.2.4 = getelementptr i8* null, i64 %gep.upgrd.1 ; <i8*> [#uses=1]
+ br i1 false, label %loopexit.2, label %no_exit.2
+no_exit.2: ; preds = %shortcirc_next
+ %wp.2.4.rec = bitcast i32 %indvar37 to i32 ; <i32> [#uses=1]
+ %inc.1.rec = add i32 %wp.2.4.rec, 1 ; <i32> [#uses=1]
+ %inc.1 = getelementptr i8* null, i32 %inc.1.rec ; <i8*> [#uses=2]
+ %indvar.next38 = add i32 %indvar37, 1 ; <i32> [#uses=1]
+ switch i8 0, label %shortcirc_next [
+ i8 32, label %loopexit.2
+ i8 59, label %loopexit.2
+ ]
+loopexit.2: ; preds = %no_exit.2, %no_exit.2, %shortcirc_next, %entry, %entry
+ %wp.2.7 = phi i8* [ null, %entry ], [ null, %entry ], [ %wp.2.4, %shortcirc_next ], [ %inc.1, %no_exit.2 ], [ %inc.1, %no_exit.2 ] ; <i8*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/pr2537.ll b/test/Transforms/LoopStrengthReduce/pr2537.ll
new file mode 100644
index 000000000000..e9be384e6f7a
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/pr2537.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+; PR 2537
+
+define void @a() {
+entry:
+ br label %dobody
+
+dobody: ; preds = %dobody, %entry
+ %y.0 = phi i128 [ 0, %entry ], [ %add, %dobody ]
+ %x.0 = phi i128 [ 0, %entry ], [ %add2, %dobody ]
+ %add = add i128 %y.0, shl (i128 1, i128 64)
+ %add2 = add i128 %x.0, shl (i128 1, i128 48)
+ call void @b( i128 %add )
+ %cmp = icmp ult i128 %add2, shl (i128 1, i128 64)
+ br i1 %cmp, label %dobody, label %afterdo
+
+afterdo: ; preds = %dobody
+ ret void
+}
+
+declare void @b(i128 %add) \ No newline at end of file
diff --git a/test/Transforms/LoopStrengthReduce/pr2570.ll b/test/Transforms/LoopStrengthReduce/pr2570.ll
new file mode 100644
index 000000000000..ce0c3bf5c988
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/pr2570.ll
@@ -0,0 +1,287 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep {phi\\>} | count 10
+; PR2570
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+@g_14 = internal global i32 1 ; <i32*> [#uses=1]
+@g_39 = internal global i16 -5 ; <i16*> [#uses=2]
+@g_43 = internal global i32 -6 ; <i32*> [#uses=3]
+@g_33 = internal global i32 -1269044541 ; <i32*> [#uses=1]
+@g_137 = internal global i32 8 ; <i32*> [#uses=1]
+@g_82 = internal global i32 -5 ; <i32*> [#uses=3]
+@g_91 = internal global i32 1 ; <i32*> [#uses=1]
+@g_197 = internal global i32 1 ; <i32*> [#uses=4]
+@g_207 = internal global i32 1 ; <i32*> [#uses=2]
+@g_222 = internal global i16 4165 ; <i16*> [#uses=1]
+@g_247 = internal global i8 -21 ; <i8*> [#uses=2]
+@g_260 = internal global i32 1 ; <i32*> [#uses=2]
+@g_221 = internal global i16 -17503 ; <i16*> [#uses=3]
+@g_267 = internal global i16 1 ; <i16*> [#uses=1]
+@llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32, i16, i32, i8, i32)* @func_44 to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
+
+define i32 @func_44(i32 %p_45, i32 %p_46, i16 zeroext %p_48, i32 %p_49, i8 zeroext %p_50, i32 %p_52) nounwind {
+entry:
+ tail call i32 @func_116( i8 zeroext 2 ) nounwind ; <i32>:0 [#uses=0]
+ tail call i32 @func_63( i16 signext 2 ) nounwind ; <i32>:1 [#uses=1]
+ load i16* @g_39, align 2 ; <i16>:2 [#uses=1]
+ tail call i32 @func_63( i16 signext %2 ) nounwind ; <i32>:3 [#uses=1]
+ trunc i32 %3 to i16 ; <i16>:4 [#uses=1]
+ and i16 %4, 1 ; <i16>:5 [#uses=1]
+ trunc i32 %p_52 to i8 ; <i8>:6 [#uses=1]
+ trunc i32 %1 to i16 ; <i16>:7 [#uses=1]
+ tail call i32 @func_74( i16 zeroext %5, i8 zeroext %6, i16 zeroext %7, i16 zeroext 0 ) nounwind ; <i32>:8 [#uses=0]
+ tail call i32 @func_124( i32 544824386 ) nounwind ; <i32>:9 [#uses=0]
+ zext i8 %p_50 to i32 ; <i32>:10 [#uses=1]
+ load i32* @g_43, align 4 ; <i32>:11 [#uses=1]
+ icmp sle i32 %10, %11 ; <i1>:12 [#uses=1]
+ zext i1 %12 to i32 ; <i32>:13 [#uses=2]
+ load i8* @g_247, align 1 ; <i8>:14 [#uses=1]
+ trunc i32 %p_45 to i16 ; <i16>:15 [#uses=1]
+ zext i8 %14 to i16 ; <i16>:16 [#uses=1]
+ tail call i32 @func_74( i16 zeroext %15, i8 zeroext 0, i16 zeroext %16, i16 zeroext 23618 ) nounwind ; <i32>:17 [#uses=4]
+ icmp slt i32 %17, 0 ; <i1>:18 [#uses=1]
+ br i1 %18, label %bb162, label %bb152
+
+bb152: ; preds = %entry
+ lshr i32 2147483647, %13 ; <i32>:19 [#uses=1]
+ icmp slt i32 %19, %17 ; <i1>:20 [#uses=1]
+ select i1 %20, i32 0, i32 %13 ; <i32>:21 [#uses=1]
+ %.348 = shl i32 %17, %21 ; <i32> [#uses=1]
+ br label %bb162
+
+bb162: ; preds = %bb152, %entry
+ %.0346 = phi i32 [ %.348, %bb152 ], [ %17, %entry ] ; <i32> [#uses=1]
+ tail call i32 @func_124( i32 1 ) nounwind ; <i32>:22 [#uses=1]
+ mul i32 %22, %.0346 ; <i32>:23 [#uses=1]
+ icmp slt i32 %p_45, 0 ; <i1>:24 [#uses=1]
+ icmp ugt i32 %p_45, 31 ; <i1>:25 [#uses=1]
+ %or.cond = or i1 %24, %25 ; <i1> [#uses=1]
+ br i1 %or.cond, label %bb172, label %bb168
+
+bb168: ; preds = %bb162
+ lshr i32 2147483647, %p_45 ; <i32>:26 [#uses=1]
+ shl i32 1392859848, %p_45 ; <i32>:27 [#uses=1]
+ icmp slt i32 %26, 1392859848 ; <i1>:28 [#uses=1]
+ %.op355 = add i32 %27, 38978 ; <i32> [#uses=1]
+ %phitmp = select i1 %28, i32 1392898826, i32 %.op355 ; <i32> [#uses=1]
+ br label %bb172
+
+bb172: ; preds = %bb168, %bb162
+ %.0343 = phi i32 [ %phitmp, %bb168 ], [ 1392898826, %bb162 ] ; <i32> [#uses=2]
+ tail call i32 @func_84( i32 1, i16 zeroext 0, i16 zeroext 8 ) nounwind ; <i32>:29 [#uses=0]
+ icmp eq i32 %.0343, 0 ; <i1>:30 [#uses=1]
+ %.0341 = select i1 %30, i32 1, i32 %.0343 ; <i32> [#uses=1]
+ urem i32 %23, %.0341 ; <i32>:31 [#uses=1]
+ load i32* @g_137, align 4 ; <i32>:32 [#uses=4]
+ icmp slt i32 %32, 0 ; <i1>:33 [#uses=1]
+ br i1 %33, label %bb202, label %bb198
+
+bb198: ; preds = %bb172
+ %not. = icmp slt i32 %32, 1073741824 ; <i1> [#uses=1]
+ zext i1 %not. to i32 ; <i32>:34 [#uses=1]
+ %.351 = shl i32 %32, %34 ; <i32> [#uses=1]
+ br label %bb202
+
+bb202: ; preds = %bb198, %bb172
+ %.0335 = phi i32 [ %.351, %bb198 ], [ %32, %bb172 ] ; <i32> [#uses=1]
+ icmp ne i32 %31, %.0335 ; <i1>:35 [#uses=1]
+ zext i1 %35 to i32 ; <i32>:36 [#uses=1]
+ tail call i32 @func_128( i32 %36 ) nounwind ; <i32>:37 [#uses=0]
+ icmp eq i32 %p_45, 293685862 ; <i1>:38 [#uses=1]
+ br i1 %38, label %bb205, label %bb311
+
+bb205: ; preds = %bb202
+ icmp sgt i32 %p_46, 214 ; <i1>:39 [#uses=1]
+ zext i1 %39 to i32 ; <i32>:40 [#uses=2]
+ tail call i32 @func_128( i32 %40 ) nounwind ; <i32>:41 [#uses=0]
+ icmp sgt i32 %p_46, 65532 ; <i1>:42 [#uses=1]
+ zext i1 %42 to i16 ; <i16>:43 [#uses=1]
+ tail call i32 @func_74( i16 zeroext 23618, i8 zeroext -29, i16 zeroext %43, i16 zeroext 1 ) nounwind ; <i32>:44 [#uses=2]
+ tail call i32 @func_103( i16 zeroext -869 ) nounwind ; <i32>:45 [#uses=0]
+ udiv i32 %44, 34162 ; <i32>:46 [#uses=1]
+ icmp ult i32 %44, 34162 ; <i1>:47 [#uses=1]
+ %.0331 = select i1 %47, i32 1, i32 %46 ; <i32> [#uses=1]
+ urem i32 293685862, %.0331 ; <i32>:48 [#uses=1]
+ tail call i32 @func_112( i32 %p_52, i16 zeroext 1 ) nounwind ; <i32>:49 [#uses=0]
+ icmp eq i32 %p_52, 0 ; <i1>:50 [#uses=2]
+ br i1 %50, label %bb222, label %bb215
+
+bb215: ; preds = %bb205
+ zext i16 %p_48 to i32 ; <i32>:51 [#uses=1]
+ icmp eq i16 %p_48, 0 ; <i1>:52 [#uses=1]
+ %.0329 = select i1 %52, i32 1, i32 %51 ; <i32> [#uses=1]
+ udiv i32 -1, %.0329 ; <i32>:53 [#uses=1]
+ icmp eq i32 %53, 0 ; <i1>:54 [#uses=1]
+ br i1 %54, label %bb222, label %bb223
+
+bb222: ; preds = %bb215, %bb205
+ br label %bb223
+
+bb223: ; preds = %bb222, %bb215
+ %iftmp.437.0 = phi i32 [ 0, %bb222 ], [ 1, %bb215 ] ; <i32> [#uses=1]
+ load i32* @g_91, align 4 ; <i32>:55 [#uses=3]
+ tail call i32 @func_103( i16 zeroext 4 ) nounwind ; <i32>:56 [#uses=0]
+ tail call i32 @func_112( i32 0, i16 zeroext -31374 ) nounwind ; <i32>:57 [#uses=0]
+ load i32* @g_197, align 4 ; <i32>:58 [#uses=1]
+ tail call i32 @func_124( i32 28156 ) nounwind ; <i32>:59 [#uses=1]
+ load i32* @g_260, align 4 ; <i32>:60 [#uses=1]
+ load i32* @g_43, align 4 ; <i32>:61 [#uses=1]
+ xor i32 %61, %60 ; <i32>:62 [#uses=1]
+ mul i32 %62, %59 ; <i32>:63 [#uses=1]
+ trunc i32 %63 to i8 ; <i8>:64 [#uses=1]
+ trunc i32 %58 to i16 ; <i16>:65 [#uses=1]
+ tail call i32 @func_74( i16 zeroext 0, i8 zeroext %64, i16 zeroext %65, i16 zeroext 0 ) nounwind ; <i32>:66 [#uses=2]
+ icmp slt i32 %66, 0 ; <i1>:67 [#uses=1]
+ icmp slt i32 %55, 0 ; <i1>:68 [#uses=1]
+ icmp ugt i32 %55, 31 ; <i1>:69 [#uses=1]
+ or i1 %68, %69 ; <i1>:70 [#uses=1]
+ %or.cond352 = or i1 %70, %67 ; <i1> [#uses=1]
+ select i1 %or.cond352, i32 0, i32 %55 ; <i32>:71 [#uses=1]
+ %.353 = ashr i32 %66, %71 ; <i32> [#uses=2]
+ load i16* @g_221, align 2 ; <i16>:72 [#uses=1]
+ zext i16 %72 to i32 ; <i32>:73 [#uses=1]
+ icmp ugt i32 %.353, 31 ; <i1>:74 [#uses=1]
+ select i1 %74, i32 0, i32 %.353 ; <i32>:75 [#uses=1]
+ %.0323 = lshr i32 %73, %75 ; <i32> [#uses=1]
+ add i32 %.0323, %iftmp.437.0 ; <i32>:76 [#uses=1]
+ and i32 %48, 255 ; <i32>:77 [#uses=2]
+ add i32 %77, 2042556439 ; <i32>:78 [#uses=1]
+ load i32* @g_207, align 4 ; <i32>:79 [#uses=2]
+ icmp ugt i32 %79, 31 ; <i1>:80 [#uses=1]
+ select i1 %80, i32 0, i32 %79 ; <i32>:81 [#uses=1]
+ %.0320 = lshr i32 %77, %81 ; <i32> [#uses=1]
+ icmp ne i32 %78, %.0320 ; <i1>:82 [#uses=1]
+ zext i1 %82 to i8 ; <i8>:83 [#uses=1]
+ tail call i32 @func_25( i8 zeroext %83 ) nounwind ; <i32>:84 [#uses=1]
+ xor i32 %84, 1 ; <i32>:85 [#uses=1]
+ load i32* @g_197, align 4 ; <i32>:86 [#uses=1]
+ add i32 %86, 1 ; <i32>:87 [#uses=1]
+ add i32 %87, %85 ; <i32>:88 [#uses=1]
+ icmp ugt i32 %76, %88 ; <i1>:89 [#uses=1]
+ br i1 %89, label %bb241, label %bb311
+
+bb241: ; preds = %bb223
+ store i16 -9, i16* @g_221, align 2
+ udiv i32 %p_52, 1538244727 ; <i32>:90 [#uses=1]
+ load i32* @g_207, align 4 ; <i32>:91 [#uses=1]
+ sub i32 %91, %90 ; <i32>:92 [#uses=1]
+ load i32* @g_14, align 4 ; <i32>:93 [#uses=1]
+ trunc i32 %93 to i16 ; <i16>:94 [#uses=1]
+ trunc i32 %p_46 to i16 ; <i16>:95 [#uses=2]
+ sub i16 %94, %95 ; <i16>:96 [#uses=1]
+ load i32* @g_197, align 4 ; <i32>:97 [#uses=1]
+ trunc i32 %97 to i16 ; <i16>:98 [#uses=1]
+ tail call i32 @func_55( i32 -346178830, i16 zeroext %98, i16 zeroext %95 ) nounwind ; <i32>:99 [#uses=0]
+ zext i16 %p_48 to i32 ; <i32>:100 [#uses=1]
+ load i8* @g_247, align 1 ; <i8>:101 [#uses=1]
+ zext i8 %101 to i32 ; <i32>:102 [#uses=1]
+ sub i32 %100, %102 ; <i32>:103 [#uses=1]
+ tail call i32 @func_55( i32 %103, i16 zeroext -2972, i16 zeroext %96 ) nounwind ; <i32>:104 [#uses=0]
+ xor i32 %92, 2968 ; <i32>:105 [#uses=1]
+ load i32* @g_197, align 4 ; <i32>:106 [#uses=1]
+ icmp ugt i32 %105, %106 ; <i1>:107 [#uses=1]
+ zext i1 %107 to i32 ; <i32>:108 [#uses=1]
+ store i32 %108, i32* @g_33, align 4
+ br label %bb248
+
+bb248: ; preds = %bb284, %bb241
+ %p_49_addr.1.reg2mem.0 = phi i32 [ 0, %bb241 ], [ %134, %bb284 ] ; <i32> [#uses=2]
+ %p_48_addr.2.reg2mem.0 = phi i16 [ %p_48, %bb241 ], [ %p_48_addr.1, %bb284 ] ; <i16> [#uses=1]
+ %p_46_addr.1.reg2mem.0 = phi i32 [ %p_46, %bb241 ], [ %133, %bb284 ] ; <i32> [#uses=1]
+ %p_45_addr.1.reg2mem.0 = phi i32 [ %p_45, %bb241 ], [ %p_45_addr.0, %bb284 ] ; <i32> [#uses=2]
+ tail call i32 @func_63( i16 signext 1 ) nounwind ; <i32>:109 [#uses=1]
+ icmp eq i32 %109, 0 ; <i1>:110 [#uses=1]
+ br i1 %110, label %bb272.thread, label %bb255.thread
+
+bb272.thread: ; preds = %bb248
+ store i32 1, i32* @g_82
+ load i16* @g_267, align 2 ; <i16>:111 [#uses=1]
+ icmp eq i16 %111, 0 ; <i1>:112 [#uses=1]
+ br i1 %112, label %bb311.loopexit.split, label %bb268
+
+bb255.thread: ; preds = %bb248
+ load i32* @g_260, align 4 ; <i32>:113 [#uses=1]
+ sub i32 %113, %p_52 ; <i32>:114 [#uses=1]
+ and i32 %114, -20753 ; <i32>:115 [#uses=1]
+ icmp ne i32 %115, 0 ; <i1>:116 [#uses=1]
+ zext i1 %116 to i16 ; <i16>:117 [#uses=1]
+ store i16 %117, i16* @g_221, align 2
+ br label %bb284
+
+bb268: ; preds = %bb268, %bb272.thread
+ %indvar = phi i32 [ 0, %bb272.thread ], [ %g_82.tmp.0, %bb268 ] ; <i32> [#uses=2]
+ %p_46_addr.0.reg2mem.0 = phi i32 [ %p_46_addr.1.reg2mem.0, %bb272.thread ], [ %119, %bb268 ] ; <i32> [#uses=1]
+ %g_82.tmp.0 = add i32 %indvar, 1 ; <i32> [#uses=2]
+ trunc i32 %p_46_addr.0.reg2mem.0 to i16 ; <i16>:118 [#uses=1]
+ and i32 %g_82.tmp.0, 28156 ; <i32>:119 [#uses=1]
+ add i32 %indvar, 2 ; <i32>:120 [#uses=4]
+ icmp sgt i32 %120, -1 ; <i1>:121 [#uses=1]
+ br i1 %121, label %bb268, label %bb274.split
+
+bb274.split: ; preds = %bb268
+ store i32 %120, i32* @g_82
+ br i1 %50, label %bb279, label %bb276
+
+bb276: ; preds = %bb274.split
+ store i16 0, i16* @g_222, align 2
+ br label %bb284
+
+bb279: ; preds = %bb274.split
+ icmp eq i32 %120, 0 ; <i1>:122 [#uses=1]
+ %.0317 = select i1 %122, i32 1, i32 %120 ; <i32> [#uses=1]
+ udiv i32 -8, %.0317 ; <i32>:123 [#uses=1]
+ trunc i32 %123 to i16 ; <i16>:124 [#uses=1]
+ br label %bb284
+
+bb284: ; preds = %bb279, %bb276, %bb255.thread
+ %p_49_addr.0 = phi i32 [ %p_49_addr.1.reg2mem.0, %bb279 ], [ %p_49_addr.1.reg2mem.0, %bb276 ], [ 0, %bb255.thread ] ; <i32> [#uses=1]
+ %p_48_addr.1 = phi i16 [ %124, %bb279 ], [ %118, %bb276 ], [ %p_48_addr.2.reg2mem.0, %bb255.thread ] ; <i16> [#uses=1]
+ %p_45_addr.0 = phi i32 [ %p_45_addr.1.reg2mem.0, %bb279 ], [ %p_45_addr.1.reg2mem.0, %bb276 ], [ 8, %bb255.thread ] ; <i32> [#uses=3]
+ load i32* @g_43, align 4 ; <i32>:125 [#uses=1]
+ trunc i32 %125 to i8 ; <i8>:126 [#uses=1]
+ tail call i32 @func_116( i8 zeroext %126 ) nounwind ; <i32>:127 [#uses=0]
+ lshr i32 65255, %p_45_addr.0 ; <i32>:128 [#uses=1]
+ icmp ugt i32 %p_45_addr.0, 31 ; <i1>:129 [#uses=1]
+ %.op = lshr i32 %128, 31 ; <i32> [#uses=1]
+ %.op.op = xor i32 %.op, 1 ; <i32> [#uses=1]
+ %.354..lobit.not = select i1 %129, i32 1, i32 %.op.op ; <i32> [#uses=1]
+ load i16* @g_39, align 2 ; <i16>:130 [#uses=1]
+ zext i16 %130 to i32 ; <i32>:131 [#uses=1]
+ icmp slt i32 %.354..lobit.not, %131 ; <i1>:132 [#uses=1]
+ zext i1 %132 to i32 ; <i32>:133 [#uses=1]
+ add i32 %p_49_addr.0, 1 ; <i32>:134 [#uses=2]
+ icmp sgt i32 %134, -1 ; <i1>:135 [#uses=1]
+ br i1 %135, label %bb248, label %bb307
+
+bb307: ; preds = %bb284
+ tail call i32 @func_103( i16 zeroext 0 ) nounwind ; <i32>:136 [#uses=0]
+ ret i32 %40
+
+bb311.loopexit.split: ; preds = %bb272.thread
+ store i32 1, i32* @g_82
+ ret i32 1
+
+bb311: ; preds = %bb223, %bb202
+ %.0 = phi i32 [ 1, %bb202 ], [ 0, %bb223 ] ; <i32> [#uses=1]
+ ret i32 %.0
+}
+
+declare i32 @func_25(i8 zeroext ) nounwind
+
+declare i32 @func_55(i32, i16 zeroext , i16 zeroext ) nounwind
+
+declare i32 @func_63(i16 signext ) nounwind
+
+declare i32 @func_74(i16 zeroext , i8 zeroext , i16 zeroext , i16 zeroext ) nounwind
+
+declare i32 @func_84(i32, i16 zeroext , i16 zeroext ) nounwind
+
+declare i32 @func_103(i16 zeroext ) nounwind
+
+declare i32 @func_124(i32) nounwind
+
+declare i32 @func_128(i32) nounwind
+
+declare i32 @func_116(i8 zeroext ) nounwind
+
+declare i32 @func_112(i32, i16 zeroext ) nounwind
diff --git a/test/Transforms/LoopStrengthReduce/pr3086.ll b/test/Transforms/LoopStrengthReduce/pr3086.ll
new file mode 100644
index 000000000000..f92bfe2b68c8
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/pr3086.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -loop-reduce -disable-output
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output
+; PR 3086
+
+ %struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }
+ %struct.Lit = type { i8 }
+
+define fastcc i64 @collect_clauses() nounwind {
+entry:
+ br label %bb11
+
+bb5: ; preds = %bb9
+ %0 = load %struct.Lit** %storemerge, align 8 ; <%struct.Lit*> [#uses=0]
+ %indvar.next8 = add i64 %storemerge.rec, 1 ; <i64> [#uses=1]
+ br label %bb9
+
+bb9: ; preds = %bb22, %bb5
+ %storemerge.rec = phi i64 [ %indvar.next8, %bb5 ], [ 0, %bb22 ] ; <i64> [#uses=2]
+ %storemerge = getelementptr %struct.Lit** null, i64 %storemerge.rec ; <%struct.Lit**> [#uses=2]
+ %1 = icmp ugt %struct.Lit** null, %storemerge ; <i1> [#uses=1]
+ br i1 %1, label %bb5, label %bb22
+
+bb11: ; preds = %bb22, %entry
+ %2 = load %struct.Cls** null, align 8 ; <%struct.Cls*> [#uses=0]
+ br label %bb22
+
+bb22: ; preds = %bb11, %bb9
+ br i1 false, label %bb11, label %bb9
+}
diff --git a/test/Transforms/LoopStrengthReduce/pr3399.ll b/test/Transforms/LoopStrengthReduce/pr3399.ll
new file mode 100644
index 000000000000..9d2f5eda1b3f
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/pr3399.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis
+; PR3399
+
+@g_53 = external global i32 ; <i32*> [#uses=1]
+
+define i32 @foo() nounwind {
+bb5.thread:
+ br label %bb
+
+bb: ; preds = %bb5, %bb5.thread
+ %indvar = phi i32 [ 0, %bb5.thread ], [ %indvar.next, %bb5 ] ; <i32> [#uses=2]
+ br i1 false, label %bb5, label %bb1
+
+bb1: ; preds = %bb
+ %l_2.0.reg2mem.0 = sub i32 0, %indvar ; <i32> [#uses=1]
+ %0 = volatile load i32* @g_53, align 4 ; <i32> [#uses=1]
+ %1 = trunc i32 %l_2.0.reg2mem.0 to i16 ; <i16> [#uses=1]
+ %2 = trunc i32 %0 to i16 ; <i16> [#uses=1]
+ %3 = mul i16 %2, %1 ; <i16> [#uses=1]
+ %4 = icmp eq i16 %3, 0 ; <i1> [#uses=1]
+ br i1 %4, label %bb7, label %bb2
+
+bb2: ; preds = %bb2, %bb1
+ br label %bb2
+
+bb5: ; preds = %bb
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br label %bb
+
+bb7: ; preds = %bb1
+ ret i32 1
+}
diff --git a/test/Transforms/LoopStrengthReduce/pr3571.ll b/test/Transforms/LoopStrengthReduce/pr3571.ll
new file mode 100644
index 000000000000..79fcdb17338a
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/pr3571.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis
+; PR3571
+
+target triple = "i386-mingw32"
+define void @_ZNK18qdesigner_internal10TreeWidget12drawBranchesEP8QPainterRK5QRectRK11QModelIndex() nounwind {
+entry:
+ br label %_ZNK11QModelIndex7isValidEv.exit.i
+
+bb.i: ; preds = %_ZNK11QModelIndex7isValidEv.exit.i
+ %indvar.next = add i32 %result.0.i, 1 ; <i32> [#uses=1]
+ br label %_ZNK11QModelIndex7isValidEv.exit.i
+
+_ZNK11QModelIndex7isValidEv.exit.i: ; preds = %bb.i, %entry
+ %result.0.i = phi i32 [ 0, %entry ], [ %indvar.next, %bb.i ] ; <i32> [#uses=2]
+ %0 = load i32** null, align 4 ; <%struct.QAbstractItemDelegate*> [#uses=0]
+ br i1 false, label %_ZN18qdesigner_internalL5levelEP18QAbstractItemModelRK11QModelIndex.exit, label %bb.i
+
+_ZN18qdesigner_internalL5levelEP18QAbstractItemModelRK11QModelIndex.exit: ; preds = %_ZNK11QModelIndex7isValidEv.exit.i
+ %1 = call i32 @_ZNK9QTreeView11indentationEv(i32* null) nounwind ; <i32> [#uses=1]
+ %2 = mul i32 %1, %result.0.i ; <i32> [#uses=1]
+ %3 = add i32 %2, -2 ; <i32> [#uses=1]
+ %4 = add i32 %3, 0 ; <i32> [#uses=1]
+ store i32 %4, i32* null, align 8
+ unreachable
+}
+
+declare i32 @_ZNK9QTreeView11indentationEv(i32*)
diff --git a/test/Transforms/LoopStrengthReduce/related_indvars.ll b/test/Transforms/LoopStrengthReduce/related_indvars.ll
new file mode 100644
index 000000000000..434da99068c3
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/related_indvars.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 1
+
+; This should only result in one PHI node!
+
+; void foo(double *D, double *E, double F) {
+; while (D != E)
+; *D++ = F;
+; }
+
+define void @foo(double* %D, double* %E, double %F) {
+entry:
+ %tmp.24 = icmp eq double* %D, %E ; <i1> [#uses=1]
+ br i1 %tmp.24, label %return, label %no_exit
+no_exit: ; preds = %no_exit, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=2]
+ %D_addr.0.0.rec = bitcast i32 %indvar to i32 ; <i32> [#uses=2]
+ %D_addr.0.0 = getelementptr double* %D, i32 %D_addr.0.0.rec ; <double*> [#uses=1]
+ %inc.rec = add i32 %D_addr.0.0.rec, 1 ; <i32> [#uses=1]
+ %inc = getelementptr double* %D, i32 %inc.rec ; <double*> [#uses=1]
+ store double %F, double* %D_addr.0.0
+ %tmp.2 = icmp eq double* %inc, %E ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp.2, label %return, label %no_exit
+return: ; preds = %no_exit, %entry
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/remove_indvar.ll b/test/Transforms/LoopStrengthReduce/remove_indvar.ll
new file mode 100644
index 000000000000..623c0b5338ef
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/remove_indvar.ll
@@ -0,0 +1,19 @@
+; Check that this test makes INDVAR and related stuff dead.
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | not grep INDVAR
+
+declare i1 @pred()
+
+define void @test(i32* %P) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
+ %STRRED = getelementptr i32* %P, i32 %INDVAR ; <i32*> [#uses=1]
+ store i32 0, i32* %STRRED
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ %cond = call i1 @pred( ) ; <i1> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll b/test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll
new file mode 100644
index 000000000000..a78fa5f349fa
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/share_code_in_preheader.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep mul | count 1
+; LSR should not make two copies of the Q*L expression in the preheader!
+
+define i8 @test(i8* %A, i8* %B, i32 %L, i32 %Q, i32 %N.s) {
+entry:
+ %tmp.6 = mul i32 %Q, %L ; <i32> [#uses=1]
+ %N = bitcast i32 %N.s to i32 ; <i32> [#uses=1]
+ br label %no_exit
+no_exit: ; preds = %no_exit, %entry
+ %indvar.ui = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=2]
+ %Sum.0.0 = phi i8 [ 0, %entry ], [ %tmp.21, %no_exit ] ; <i8> [#uses=1]
+ %indvar = bitcast i32 %indvar.ui to i32 ; <i32> [#uses=1]
+ %N_addr.0.0 = sub i32 %N.s, %indvar ; <i32> [#uses=1]
+ %tmp.8 = add i32 %N_addr.0.0, %tmp.6 ; <i32> [#uses=2]
+ %tmp.9 = getelementptr i8* %A, i32 %tmp.8 ; <i8*> [#uses=1]
+ %tmp.10 = load i8* %tmp.9 ; <i8> [#uses=1]
+ %tmp.17 = getelementptr i8* %B, i32 %tmp.8 ; <i8*> [#uses=1]
+ %tmp.18 = load i8* %tmp.17 ; <i8> [#uses=1]
+ %tmp.19 = sub i8 %tmp.10, %tmp.18 ; <i8> [#uses=1]
+ %tmp.21 = add i8 %tmp.19, %Sum.0.0 ; <i8> [#uses=2]
+ %indvar.next = add i32 %indvar.ui, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next, %N ; <i1> [#uses=1]
+ br i1 %exitcond, label %loopexit, label %no_exit
+loopexit: ; preds = %no_exit
+ ret i8 %tmp.21
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/share_ivs.ll b/test/Transforms/LoopStrengthReduce/share_ivs.ll
new file mode 100644
index 000000000000..b52d571f4276
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/share_ivs.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | count 1
+
+; This testcase should have ONE stride 18 indvar, the other use should have a
+; loop invariant value (B) added to it inside of the loop, instead of having
+; a whole indvar based on B for it.
+
+declare i1 @cond(i32)
+
+define void @test(i32 %B) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %IV = phi i32 [ 0, %0 ], [ %IVn, %Loop ] ; <i32> [#uses=3]
+ %C = mul i32 %IV, 18 ; <i32> [#uses=1]
+ %D = mul i32 %IV, 18 ; <i32> [#uses=1]
+ %E = add i32 %D, %B ; <i32> [#uses=1]
+ %cnd = call i1 @cond( i32 %E ) ; <i1> [#uses=1]
+ call i1 @cond( i32 %C ) ; <i1>:1 [#uses=0]
+ %IVn = add i32 %IV, 1 ; <i32> [#uses=1]
+ br i1 %cnd, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll b/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll
new file mode 100644
index 000000000000..2c9c70de8366
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/use_postinc_value_outside_loop.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: grep {add i32 %lsr.iv.next, 1}
+;
+; Make sure that the use of the IV outside of the loop (the store) uses the
+; post incremented value of the IV, not the preincremented value. This
+; prevents the loop from having to keep the post and pre-incremented value
+; around for the duration of the loop, adding a copy and an extra register
+; to the loop.
+
+declare i1 @pred(i32)
+
+define void @test([700 x i32]* %nbeaux_.0__558, i32* %i_.16574) {
+then.0:
+ br label %no_exit.2
+no_exit.2: ; preds = %no_exit.2, %then.0
+ %indvar630.ui = phi i32 [ 0, %then.0 ], [ %indvar.next631, %no_exit.2 ] ; <i32> [#uses=3]
+ %indvar630 = bitcast i32 %indvar630.ui to i32 ; <i32> [#uses=2]
+ %gep.upgrd.1 = zext i32 %indvar630.ui to i64 ; <i64> [#uses=1]
+ %tmp.38 = getelementptr [700 x i32]* %nbeaux_.0__558, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp.38
+ %inc.2 = add i32 %indvar630, 2 ; <i32> [#uses=1]
+ %tmp.34 = call i1 @pred( i32 %indvar630 ) ; <i1> [#uses=1]
+ %indvar.next631 = add i32 %indvar630.ui, 1 ; <i32> [#uses=1]
+ br i1 %tmp.34, label %no_exit.2, label %loopexit.2.loopexit
+loopexit.2.loopexit: ; preds = %no_exit.2
+ store i32 %inc.2, i32* %i_.16574
+ ret void
+}
+
diff --git a/test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll b/test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll
new file mode 100644
index 000000000000..53eedd673260
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/var_stride_used_by_compare.ll
@@ -0,0 +1,41 @@
+; Base should not be i*3, it should be i*2.
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: not grep {mul.*%i, 3}
+
+; Indvar should not start at zero:
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | \
+; RUN: not grep {phi i32 .* 0}
+; END.
+
+; mul uint %i, 3
+
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8"
+@flags2 = external global [8193 x i8], align 32 ; <[8193 x i8]*> [#uses=1]
+
+define void @foo(i32 %k, i32 %i.s) {
+entry:
+ %i = bitcast i32 %i.s to i32 ; <i32> [#uses=2]
+ %k_addr.012 = shl i32 %i.s, 1 ; <i32> [#uses=1]
+ %tmp14 = icmp sgt i32 %k_addr.012, 8192 ; <i1> [#uses=1]
+ br i1 %tmp14, label %return, label %bb.preheader
+bb.preheader: ; preds = %entry
+ %tmp. = shl i32 %i, 1 ; <i32> [#uses=1]
+ br label %bb
+bb: ; preds = %bb, %bb.preheader
+ %indvar = phi i32 [ %indvar.next, %bb ], [ 0, %bb.preheader ] ; <i32> [#uses=2]
+ %tmp.15 = mul i32 %indvar, %i ; <i32> [#uses=1]
+ %tmp.16 = add i32 %tmp.15, %tmp. ; <i32> [#uses=2]
+ %k_addr.0.0 = bitcast i32 %tmp.16 to i32 ; <i32> [#uses=1]
+ %gep.upgrd.1 = zext i32 %tmp.16 to i64 ; <i64> [#uses=1]
+ %tmp = getelementptr [8193 x i8]* @flags2, i32 0, i64 %gep.upgrd.1 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp
+ %k_addr.0 = add i32 %k_addr.0.0, %i.s ; <i32> [#uses=1]
+ %tmp.upgrd.2 = icmp sgt i32 %k_addr.0, 8192 ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br i1 %tmp.upgrd.2, label %return.loopexit, label %bb
+return.loopexit: ; preds = %bb
+ br label %return
+return: ; preds = %return.loopexit, %entry
+ ret void
+}
diff --git a/test/Transforms/LoopStrengthReduce/variable_stride.ll b/test/Transforms/LoopStrengthReduce/variable_stride.ll
new file mode 100644
index 000000000000..90d3947101ff
--- /dev/null
+++ b/test/Transforms/LoopStrengthReduce/variable_stride.ll
@@ -0,0 +1,18 @@
+; Check that variable strides are reduced to adds instead of multiplies.
+; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | not grep mul
+
+declare i1 @pred(i32)
+
+define void @test([10000 x i32]* %P, i32 %STRIDE) {
+; <label>:0
+ br label %Loop
+Loop: ; preds = %Loop, %0
+ %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
+ %Idx = mul i32 %INDVAR, %STRIDE ; <i32> [#uses=1]
+ %cond = call i1 @pred( i32 %Idx ) ; <i1> [#uses=1]
+ %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
+ br i1 %cond, label %Loop, label %Out
+Out: ; preds = %Loop
+ ret void
+}
+
diff --git a/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll b/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll
new file mode 100644
index 000000000000..13a26a253325
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -loop-unroll -disable-output
+
+define i32 @main() {
+entry:
+ br label %no_exit
+no_exit: ; preds = %no_exit, %entry
+ %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %no_exit ] ; <i32> [#uses=1]
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
+ %exitcond = icmp ne i32 %indvar.next, -2147483648 ; <i1> [#uses=1]
+ br i1 %exitcond, label %no_exit, label %loopexit
+loopexit: ; preds = %no_exit
+ ret i32 0
+}
+
diff --git a/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll b/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll
new file mode 100644
index 000000000000..db107fdd4bc0
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -loop-unroll -loopsimplify -disable-output
+
+define void @print_board() {
+entry:
+ br label %no_exit.1
+no_exit.1: ; preds = %cond_false.2, %entry
+ br label %no_exit.2
+no_exit.2: ; preds = %no_exit.2, %no_exit.1
+ %indvar1 = phi i32 [ 0, %no_exit.1 ], [ %indvar.next2, %no_exit.2 ] ; <i32> [#uses=1]
+ %indvar.next2 = add i32 %indvar1, 1 ; <i32> [#uses=2]
+ %exitcond3 = icmp ne i32 %indvar.next2, 7 ; <i1> [#uses=1]
+ br i1 %exitcond3, label %no_exit.2, label %loopexit.2
+loopexit.2: ; preds = %no_exit.2
+ br i1 false, label %cond_true.2, label %cond_false.2
+cond_true.2: ; preds = %loopexit.2
+ ret void
+cond_false.2: ; preds = %loopexit.2
+ br i1 false, label %no_exit.1, label %loopexit.1
+loopexit.1: ; preds = %cond_false.2
+ ret void
+}
+
diff --git a/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll b/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll
new file mode 100644
index 000000000000..16419cab1abf
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2006-08-24-MultiBlockLoop.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -loop-unroll | llvm-dis | grep bb72.2
+
+define void @vorbis_encode_noisebias_setup() {
+entry:
+ br label %cond_true.outer
+cond_true.outer: ; preds = %bb72, %entry
+ %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ] ; <i32> [#uses=1]
+ br label %bb72
+bb72: ; preds = %cond_true.outer
+ %indvar.next2 = add i32 %indvar1.ph, 1 ; <i32> [#uses=2]
+ %exitcond3 = icmp eq i32 %indvar.next2, 3 ; <i1> [#uses=1]
+ br i1 %exitcond3, label %cond_true138, label %cond_true.outer
+cond_true138: ; preds = %bb72
+ ret void
+}
+
diff --git a/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll b/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll
new file mode 100644
index 000000000000..26fa60a8216c
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2007-04-16-PhiUpdate.ll
@@ -0,0 +1,17 @@
+; PR 1334
+; RUN: llvm-as < %s | opt -loop-unroll -disable-output
+
+define void @sal__math_float_manipulator_7__math__joint_array_dcv_ops__Omultiply__3([6 x float]* %agg.result) {
+entry:
+ %tmp282911 = zext i8 0 to i32 ; <i32> [#uses=1]
+ br label %cond_next
+cond_next: ; preds = %cond_next, %entry
+ %indvar = phi i8 [ 0, %entry ], [ %indvar.next, %cond_next ] ; <i8> [#uses=1]
+ %indvar.next = add i8 %indvar, 1 ; <i8> [#uses=2]
+ %exitcond = icmp eq i8 %indvar.next, 7 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb27, label %cond_next
+bb27: ; preds = %cond_next
+ %tmp282911.lcssa = phi i32 [ %tmp282911, %cond_next ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll b/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll
new file mode 100644
index 000000000000..44890a6e616e
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2007-05-05-UnrollMiscomp.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -loop-unroll | llvm-dis | not grep undef
+; PR1385
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+ %struct.__mpz_struct = type { i32, i32, i32* }
+
+
+define void @Foo(%struct.__mpz_struct* %base) {
+entry:
+ %want = alloca [1 x %struct.__mpz_struct], align 16 ; <[1 x %struct.__mpz_struct]*> [#uses=4]
+ %want1 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=1]
+ call void @__gmpz_init( %struct.__mpz_struct* %want1 )
+ %want27 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=1]
+ %want3 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=1]
+ %want2 = getelementptr [1 x %struct.__mpz_struct]* %want, i32 0, i32 0 ; <%struct.__mpz_struct*> [#uses=2]
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %i.01.0 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=1]
+ %want23.0 = phi %struct.__mpz_struct* [ %want27, %entry ], [ %want2, %bb ] ; <%struct.__mpz_struct*> [#uses=1]
+ call void @__gmpz_mul( %struct.__mpz_struct* %want23.0, %struct.__mpz_struct* %want3, %struct.__mpz_struct* %base )
+ %indvar.next = add i32 %i.01.0, 1 ; <i32> [#uses=2]
+ %exitcond = icmp ne i32 %indvar.next, 2 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb, label %bb10
+
+bb10: ; preds = %bb
+ %want2.lcssa = phi %struct.__mpz_struct* [ %want2, %bb ] ; <%struct.__mpz_struct*> [#uses=1]
+ call void @__gmpz_clear( %struct.__mpz_struct* %want2.lcssa )
+ ret void
+}
+
+declare void @__gmpz_init(%struct.__mpz_struct*)
+declare void @__gmpz_mul(%struct.__mpz_struct*, %struct.__mpz_struct*, %struct.__mpz_struct*)
+declare void @__gmpz_clear(%struct.__mpz_struct*)
+
diff --git a/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll b/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
new file mode 100644
index 000000000000..2086e9678cdc
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2007-05-09-UnknownTripCount.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -loop-unroll -unroll-count=3 | llvm-dis | grep bb72.2
+
+define void @foo(i32 %trips) {
+entry:
+ br label %cond_true.outer
+
+cond_true.outer:
+ %indvar1.ph = phi i32 [ 0, %entry ], [ %indvar.next2, %bb72 ]
+ br label %bb72
+
+bb72:
+ %indvar.next2 = add i32 %indvar1.ph, 1
+ %exitcond3 = icmp eq i32 %indvar.next2, %trips
+ br i1 %exitcond3, label %cond_true138, label %cond_true.outer
+
+cond_true138:
+ ret void
+}
diff --git a/test/Transforms/LoopUnroll/2007-11-05-Crash.ll b/test/Transforms/LoopUnroll/2007-11-05-Crash.ll
new file mode 100644
index 000000000000..a46c09e3bde8
--- /dev/null
+++ b/test/Transforms/LoopUnroll/2007-11-05-Crash.ll
@@ -0,0 +1,295 @@
+; RUN: llvm-as < %s | opt -disable-output -loop-unroll
+; PR1770
+; PR1947
+
+ %struct.cl_engine = type { i32, i16, i32, i8**, i8**, i8*, i8*, i8*, i8*, i8*, i8*, i8* }
+ %struct.cl_limits = type { i32, i32, i32, i32, i16, i64 }
+ %struct.cli_ac_alt = type { i8, i8*, i16, i16, %struct.cli_ac_alt* }
+ %struct.cli_ac_node = type { i8, i8, %struct.cli_ac_patt*, %struct.cli_ac_node**, %struct.cli_ac_node* }
+ %struct.cli_ac_patt = type { i16*, i16*, i16, i16, i8, i32, i32, i8*, i8*, i32, i16, i16, i16, i16, %struct.cli_ac_alt**, i8, i16, %struct.cli_ac_patt*, %struct.cli_ac_patt* }
+ %struct.cli_bm_patt = type { i8*, i32, i8*, i8*, i8, %struct.cli_bm_patt* }
+ %struct.cli_ctx = type { i8**, i64*, %struct.cli_matcher*, %struct.cl_engine*, %struct.cl_limits*, i32, i32, i32, i32, %struct.cli_dconf* }
+ %struct.cli_dconf = type { i32, i32, i32, i32, i32, i32, i32 }
+ %struct.cli_matcher = type { i16, i8, i32*, %struct.cli_bm_patt**, i32*, i32, i8, i8, %struct.cli_ac_node*, %struct.cli_ac_node**, %struct.cli_ac_patt**, i32, i32, i32 }
+
+declare i8* @calloc(i64, i64)
+
+define fastcc i32 @cli_scanpe(i32 %desc, %struct.cli_ctx* %ctx) {
+entry:
+ br i1 false, label %cond_next17, label %cond_true14
+
+cond_true14: ; preds = %entry
+ ret i32 0
+
+cond_next17: ; preds = %entry
+ br i1 false, label %LeafBlock, label %LeafBlock1250
+
+LeafBlock1250: ; preds = %cond_next17
+ ret i32 0
+
+LeafBlock: ; preds = %cond_next17
+ br i1 false, label %cond_next33, label %cond_true30
+
+cond_true30: ; preds = %LeafBlock
+ ret i32 0
+
+cond_next33: ; preds = %LeafBlock
+ br i1 false, label %cond_next90, label %cond_true42
+
+cond_true42: ; preds = %cond_next33
+ ret i32 0
+
+cond_next90: ; preds = %cond_next33
+ br i1 false, label %cond_next100, label %cond_true97
+
+cond_true97: ; preds = %cond_next90
+ ret i32 0
+
+cond_next100: ; preds = %cond_next90
+ br i1 false, label %cond_next109, label %cond_true106
+
+cond_true106: ; preds = %cond_next100
+ ret i32 0
+
+cond_next109: ; preds = %cond_next100
+ br i1 false, label %cond_false, label %cond_true118
+
+cond_true118: ; preds = %cond_next109
+ ret i32 0
+
+cond_false: ; preds = %cond_next109
+ br i1 false, label %NodeBlock1482, label %cond_true126
+
+cond_true126: ; preds = %cond_false
+ ret i32 0
+
+NodeBlock1482: ; preds = %cond_false
+ br i1 false, label %cond_next285, label %NodeBlock1480
+
+NodeBlock1480: ; preds = %NodeBlock1482
+ ret i32 0
+
+cond_next285: ; preds = %NodeBlock1482
+ br i1 false, label %cond_next320, label %cond_true294
+
+cond_true294: ; preds = %cond_next285
+ ret i32 0
+
+cond_next320: ; preds = %cond_next285
+ br i1 false, label %LeafBlock1491, label %LeafBlock1493
+
+LeafBlock1493: ; preds = %cond_next320
+ ret i32 0
+
+LeafBlock1491: ; preds = %cond_next320
+ br i1 false, label %cond_true400, label %cond_true378
+
+cond_true378: ; preds = %LeafBlock1491
+ ret i32 1
+
+cond_true400: ; preds = %LeafBlock1491
+ br i1 false, label %cond_next413, label %cond_true406
+
+cond_true406: ; preds = %cond_true400
+ ret i32 0
+
+cond_next413: ; preds = %cond_true400
+ br i1 false, label %cond_next429, label %cond_true424
+
+cond_true424: ; preds = %cond_next413
+ ret i32 0
+
+cond_next429: ; preds = %cond_next413
+ br i1 false, label %NodeBlock1557, label %NodeBlock1579
+
+NodeBlock1579: ; preds = %cond_next429
+ ret i32 0
+
+NodeBlock1557: ; preds = %cond_next429
+ br i1 false, label %LeafBlock1543, label %NodeBlock1555
+
+NodeBlock1555: ; preds = %NodeBlock1557
+ ret i32 0
+
+LeafBlock1543: ; preds = %NodeBlock1557
+ br i1 false, label %cond_next870, label %cond_next663
+
+cond_next663: ; preds = %LeafBlock1543
+ ret i32 0
+
+cond_next870: ; preds = %LeafBlock1543
+ br i1 false, label %cond_true1012, label %cond_true916
+
+cond_true916: ; preds = %cond_next870
+ ret i32 0
+
+cond_true1012: ; preds = %cond_next870
+ br i1 false, label %cond_next3849, label %cond_true2105
+
+cond_true2105: ; preds = %cond_true1012
+ ret i32 0
+
+cond_next3849: ; preds = %cond_true1012
+ br i1 false, label %cond_next4378, label %bb6559
+
+bb3862: ; preds = %cond_next4385
+ br i1 false, label %cond_false3904, label %cond_true3876
+
+cond_true3876: ; preds = %bb3862
+ ret i32 0
+
+cond_false3904: ; preds = %bb3862
+ br i1 false, label %cond_next4003, label %cond_true3935
+
+cond_true3935: ; preds = %cond_false3904
+ ret i32 0
+
+cond_next4003: ; preds = %cond_false3904
+ br i1 false, label %cond_next5160, label %cond_next4015
+
+cond_next4015: ; preds = %cond_next4003
+ ret i32 0
+
+cond_next4378: ; preds = %cond_next3849
+ br i1 false, label %cond_next4385, label %bb4393
+
+cond_next4385: ; preds = %cond_next4378
+ br i1 false, label %bb3862, label %bb4393
+
+bb4393: ; preds = %cond_next4385, %cond_next4378
+ ret i32 0
+
+cond_next5160: ; preds = %cond_next4003
+ br i1 false, label %bb5188, label %bb6559
+
+bb5188: ; preds = %cond_next5160
+ br i1 false, label %cond_next5285, label %cond_true5210
+
+cond_true5210: ; preds = %bb5188
+ ret i32 0
+
+cond_next5285: ; preds = %bb5188
+ br i1 false, label %cond_true5302, label %cond_true5330
+
+cond_true5302: ; preds = %cond_next5285
+ br i1 false, label %bb7405, label %bb7367
+
+cond_true5330: ; preds = %cond_next5285
+ ret i32 0
+
+bb6559: ; preds = %cond_next5160, %cond_next3849
+ ret i32 0
+
+bb7367: ; preds = %cond_true5302
+ ret i32 0
+
+bb7405: ; preds = %cond_true5302
+ br i1 false, label %cond_next8154, label %cond_true7410
+
+cond_true7410: ; preds = %bb7405
+ ret i32 0
+
+cond_next8154: ; preds = %bb7405
+ br i1 false, label %cond_true8235, label %bb9065
+
+cond_true8235: ; preds = %cond_next8154
+ br i1 false, label %bb8274, label %bb8245
+
+bb8245: ; preds = %cond_true8235
+ ret i32 0
+
+bb8274: ; preds = %cond_true8235
+ br i1 false, label %cond_next8358, label %cond_true8295
+
+cond_true8295: ; preds = %bb8274
+ ret i32 0
+
+cond_next8358: ; preds = %bb8274
+ br i1 false, label %cond_next.i509, label %cond_true8371
+
+cond_true8371: ; preds = %cond_next8358
+ ret i32 -123
+
+cond_next.i509: ; preds = %cond_next8358
+ br i1 false, label %bb36.i, label %bb33.i
+
+bb33.i: ; preds = %cond_next.i509
+ ret i32 0
+
+bb36.i: ; preds = %cond_next.i509
+ br i1 false, label %cond_next54.i, label %cond_true51.i
+
+cond_true51.i: ; preds = %bb36.i
+ ret i32 0
+
+cond_next54.i: ; preds = %bb36.i
+ %tmp10.i.i527 = call i8* @calloc( i64 0, i64 1 ) ; <i8*> [#uses=1]
+ br i1 false, label %cond_next11.i.i, label %bb132.i
+
+bb132.i: ; preds = %cond_next54.i
+ ret i32 0
+
+cond_next11.i.i: ; preds = %cond_next54.i
+ br i1 false, label %bb32.i.i545, label %cond_true1008.critedge.i
+
+bb32.i.i545: ; preds = %cond_next11.i.i
+ br i1 false, label %cond_next349.i, label %cond_true184.i
+
+cond_true184.i: ; preds = %bb32.i.i545
+ ret i32 0
+
+cond_next349.i: ; preds = %bb32.i.i545
+ br i1 false, label %cond_next535.i, label %cond_true1008.critedge1171.i
+
+cond_next535.i: ; preds = %cond_next349.i
+ br i1 false, label %cond_next569.i, label %cond_false574.i
+
+cond_next569.i: ; preds = %cond_next535.i
+ br i1 false, label %cond_next670.i, label %cond_true1008.critedge1185.i
+
+cond_false574.i: ; preds = %cond_next535.i
+ ret i32 0
+
+cond_next670.i: ; preds = %cond_next569.i
+ br i1 false, label %cond_true692.i, label %cond_next862.i
+
+cond_true692.i: ; preds = %cond_next670.i
+ br i1 false, label %cond_false742.i, label %cond_true718.i
+
+cond_true718.i: ; preds = %cond_true692.i
+ ret i32 0
+
+cond_false742.i: ; preds = %cond_true692.i
+ br i1 false, label %cond_true784.i, label %cond_next9079
+
+cond_true784.i: ; preds = %cond_next811.i, %cond_false742.i
+ %indvar1411.i.reg2mem.0 = phi i8 [ %indvar.next1412.i, %cond_next811.i ], [ 0, %cond_false742.i ] ; <i8> [#uses=1]
+ br i1 false, label %cond_true1008.critedge1190.i, label %cond_next811.i
+
+cond_next811.i: ; preds = %cond_true784.i
+ %indvar.next1412.i = add i8 %indvar1411.i.reg2mem.0, 1 ; <i8> [#uses=2]
+ %tmp781.i = icmp eq i8 %indvar.next1412.i, 3 ; <i1> [#uses=1]
+ br i1 %tmp781.i, label %cond_next9079, label %cond_true784.i
+
+cond_next862.i: ; preds = %cond_next670.i
+ ret i32 0
+
+cond_true1008.critedge.i: ; preds = %cond_next11.i.i
+ ret i32 0
+
+cond_true1008.critedge1171.i: ; preds = %cond_next349.i
+ ret i32 0
+
+cond_true1008.critedge1185.i: ; preds = %cond_next569.i
+ ret i32 0
+
+cond_true1008.critedge1190.i: ; preds = %cond_true784.i
+ %tmp621.i532.lcssa610 = phi i8* [ %tmp10.i.i527, %cond_true784.i ] ; <i8*> [#uses=0]
+ ret i32 0
+
+bb9065: ; preds = %cond_next8154
+ ret i32 0
+
+cond_next9079: ; preds = %cond_next811.i, %cond_false742.i
+ ret i32 0
+}
diff --git a/test/Transforms/LoopUnroll/dg.exp b/test/Transforms/LoopUnroll/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopUnroll/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll b/test/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll
new file mode 100644
index 000000000000..b80220af5003
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll
@@ -0,0 +1,1697 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+; END.
+
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8.2.0"
+deplibs = [ "c", "crtend" ]
+ %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+ %struct.fd_set = type { [32 x i32] }
+ %struct.timeval = type { i32, i32 }
+ %struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8* }
+ %typedef.CHESS_PATH = type { [65 x i32], i8, i8, i8 }
+ %typedef.CHESS_POSITION = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i32, i32, i8, i8, [64 x i8], i8, i8, i8, i8, i8 }
+ %typedef.HASH_ENTRY = type { i64, i64 }
+ %typedef.NEXT_MOVE = type { i32, i32, i32* }
+ %typedef.PAWN_HASH_ENTRY = type { i32, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %typedef.SEARCH_POSITION = type { i8, i8, i8, i8 }
+ %union.doub0. = type { i64 }
+@search = external global %typedef.CHESS_POSITION ; <%typedef.CHESS_POSITION*> [#uses=1]
+@w_pawn_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_pawn_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@knight_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@bishop_attacks_rl45 = external global [64 x [256 x i64]] ; <[64 x [256 x i64]]*> [#uses=0]
+@bishop_shift_rl45 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@bishop_attacks_rr45 = external global [64 x [256 x i64]] ; <[64 x [256 x i64]]*> [#uses=0]
+@bishop_shift_rr45 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@rook_attacks_r0 = external global [64 x [256 x i64]] ; <[64 x [256 x i64]]*> [#uses=0]
+@rook_attacks_rl90 = external global [64 x [256 x i64]] ; <[64 x [256 x i64]]*> [#uses=0]
+@king_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@set_mask = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@first_ones = external global [65536 x i8] ; <[65536 x i8]*> [#uses=0]
+@last_ones = external global [65536 x i8] ; <[65536 x i8]*> [#uses=0]
+@draw_score_is_zero = external global i32 ; <i32*> [#uses=0]
+@default_draw_score = external global i32 ; <i32*> [#uses=0]
+@opening = external global i32 ; <i32*> [#uses=0]
+@middle_game = external global i32 ; <i32*> [#uses=0]
+@tc_increment = external global i32 ; <i32*> [#uses=0]
+@tc_time_remaining_opponent = external global i32 ; <i32*> [#uses=0]
+@.ctor_1 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@input_stream = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@__sF = external global [0 x %struct.__sFILE] ; <[0 x %struct.__sFILE]*> [#uses=1]
+@xboard = external global i32 ; <i32*> [#uses=0]
+@.str_1 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_2 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@buffer = external global [512 x i8] ; <[512 x i8]*> [#uses=0]
+@nargs = external global i32 ; <i32*> [#uses=0]
+@args = external global [32 x i8*] ; <[32 x i8*]*> [#uses=0]
+@.str_3 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_4 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_5 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_6 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_7 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_8 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_9 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_10 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_11 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_12 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_14 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@position = external global [67 x %typedef.SEARCH_POSITION] ; <[67 x %typedef.SEARCH_POSITION]*> [#uses=0]
+@log_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@move_number = external global i32 ; <i32*> [#uses=0]
+@rephead_b = external global i64* ; <i64**> [#uses=0]
+@replist_b = external global [82 x i64] ; <[82 x i64]*> [#uses=0]
+@rephead_w = external global i64* ; <i64**> [#uses=0]
+@replist_w = external global [82 x i64] ; <[82 x i64]*> [#uses=0]
+@moves_out_of_book = external global i32 ; <i32*> [#uses=0]
+@largest_positional_score = external global i32 ; <i32*> [#uses=0]
+@end_game = external global i32 ; <i32*> [#uses=0]
+@p_values = external global [15 x i32] ; <[15 x i32]*> [#uses=0]
+@clear_mask = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@directions = external global [64 x [64 x i8]] ; <[64 x [64 x i8]]*> [#uses=0]
+@root_wtm = external global i32 ; <i32*> [#uses=0]
+@all_pawns = external global i64 ; <i64*> [#uses=0]
+@pawn_score = external global %typedef.PAWN_HASH_ENTRY ; <%typedef.PAWN_HASH_ENTRY*> [#uses=0]
+@pawn_probes = external global i32 ; <i32*> [#uses=0]
+@pawn_hits = external global i32 ; <i32*> [#uses=0]
+@outside_passed = external global [128 x i32] ; <[128 x i32]*> [#uses=0]
+@root_total_black_pieces = external global i32 ; <i32*> [#uses=0]
+@root_total_white_pawns = external global i32 ; <i32*> [#uses=0]
+@root_total_white_pieces = external global i32 ; <i32*> [#uses=0]
+@root_total_black_pawns = external global i32 ; <i32*> [#uses=0]
+@mask_A7H7 = external global i64 ; <i64*> [#uses=0]
+@mask_B6B7 = external global i64 ; <i64*> [#uses=0]
+@mask_G6G7 = external global i64 ; <i64*> [#uses=0]
+@mask_A2H2 = external global i64 ; <i64*> [#uses=0]
+@mask_B2B3 = external global i64 ; <i64*> [#uses=0]
+@mask_G2G3 = external global i64 ; <i64*> [#uses=0]
+@king_defects_w = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@good_bishop_kw = external global i64 ; <i64*> [#uses=0]
+@mask_F3H3 = external global i64 ; <i64*> [#uses=0]
+@file_mask = external global [8 x i64] ; <[8 x i64]*> [#uses=0]
+@good_bishop_qw = external global i64 ; <i64*> [#uses=0]
+@mask_A3C3 = external global i64 ; <i64*> [#uses=0]
+@king_defects_b = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@good_bishop_kb = external global i64 ; <i64*> [#uses=0]
+@mask_F6H6 = external global i64 ; <i64*> [#uses=0]
+@good_bishop_qb = external global i64 ; <i64*> [#uses=0]
+@mask_A6C6 = external global i64 ; <i64*> [#uses=0]
+@square_color = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@evaluations = external global i32 ; <i32*> [#uses=0]
+@king_value_w = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@rank_mask = external global [8 x i64] ; <[8 x i64]*> [#uses=0]
+@mask_kr_trapped_w = external global [3 x i64] ; <[3 x i64]*> [#uses=0]
+@mask_qr_trapped_w = external global [3 x i64] ; <[3 x i64]*> [#uses=0]
+@king_value_b = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@mask_kr_trapped_b = external global [3 x i64] ; <[3 x i64]*> [#uses=0]
+@mask_qr_trapped_b = external global [3 x i64] ; <[3 x i64]*> [#uses=0]
+@white_outpost = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@mask_no_pawn_attacks_b = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@knight_value_w = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@black_outpost = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@mask_no_pawn_attacks_w = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@knight_value_b = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@bishop_value_w = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@bishop_mobility_rl45 = external global [64 x [256 x i32]] ; <[64 x [256 x i32]]*> [#uses=0]
+@bishop_mobility_rr45 = external global [64 x [256 x i32]] ; <[64 x [256 x i32]]*> [#uses=0]
+@bishop_value_b = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@rook_value_w = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@plus8dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@mask_abs7_w = external global i64 ; <i64*> [#uses=0]
+@rook_value_b = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@minus8dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@mask_abs7_b = external global i64 ; <i64*> [#uses=0]
+@queen_value_w = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@queen_value_b = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@white_minor_pieces = external global i64 ; <i64*> [#uses=0]
+@black_minor_pieces = external global i64 ; <i64*> [#uses=0]
+@not_rook_pawns = external global i64 ; <i64*> [#uses=0]
+@dark_squares = external global i64 ; <i64*> [#uses=0]
+@b_n_mate_dark_squares = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@b_n_mate_light_squares = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@mate = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@first_ones_8bit = external global [256 x i8] ; <[256 x i8]*> [#uses=0]
+@reduced_material_passer = external global [20 x i32] ; <[20 x i32]*> [#uses=0]
+@supported_passer = external global [8 x i32] ; <[8 x i32]*> [#uses=0]
+@passed_pawn_value = external global [8 x i32] ; <[8 x i32]*> [#uses=0]
+@connected_passed = external global [256 x i8] ; <[256 x i8]*> [#uses=0]
+@black_pawn_race_btm = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@white_pawn_race_wtm = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@black_pawn_race_wtm = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@white_pawn_race_btm = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@obstructed = external global [64 x [64 x i64]] ; <[64 x [64 x i64]]*> [#uses=0]
+@pawn_hash_table = external global %typedef.PAWN_HASH_ENTRY* ; <%typedef.PAWN_HASH_ENTRY**> [#uses=0]
+@pawn_hash_mask = external global i32 ; <i32*> [#uses=0]
+@pawn_value_w = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@mask_pawn_isolated = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@mask_pawn_passed_w = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@mask_pawn_protected_w = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@pawn_value_b = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@mask_pawn_passed_b = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@mask_pawn_protected_b = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@unblocked_pawns = external global [9 x i32] ; <[9 x i32]*> [#uses=0]
+@mask_wk_4th = external global i64 ; <i64*> [#uses=0]
+@mask_wk_5th = external global i64 ; <i64*> [#uses=0]
+@mask_wq_4th = external global i64 ; <i64*> [#uses=0]
+@mask_wq_5th = external global i64 ; <i64*> [#uses=0]
+@stonewall_white = external global i64 ; <i64*> [#uses=0]
+@mask_bk_4th = external global i64 ; <i64*> [#uses=0]
+@mask_bk_5th = external global i64 ; <i64*> [#uses=0]
+@mask_bq_5th = external global i64 ; <i64*> [#uses=0]
+@mask_bq_4th = external global i64 ; <i64*> [#uses=0]
+@stonewall_black = external global i64 ; <i64*> [#uses=0]
+@last_ones_8bit = external global [256 x i8] ; <[256 x i8]*> [#uses=0]
+@right_side_mask = external global [8 x i64] ; <[8 x i64]*> [#uses=0]
+@left_side_empty_mask = external global [8 x i64] ; <[8 x i64]*> [#uses=0]
+@left_side_mask = external global [8 x i64] ; <[8 x i64]*> [#uses=0]
+@right_side_empty_mask = external global [8 x i64] ; <[8 x i64]*> [#uses=0]
+@pv = external global [65 x %typedef.CHESS_PATH] ; <[65 x %typedef.CHESS_PATH]*> [#uses=0]
+@history_w = external global [4096 x i32] ; <[4096 x i32]*> [#uses=0]
+@history_b = external global [4096 x i32] ; <[4096 x i32]*> [#uses=0]
+@killer_move1 = external global [65 x i32] ; <[65 x i32]*> [#uses=0]
+@killer_count1 = external global [65 x i32] ; <[65 x i32]*> [#uses=0]
+@killer_move2 = external global [65 x i32] ; <[65 x i32]*> [#uses=0]
+@killer_count2 = external global [65 x i32] ; <[65 x i32]*> [#uses=0]
+@current_move = external global [65 x i32] ; <[65 x i32]*> [#uses=0]
+@init_r90 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@init_l90 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@init_l45 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@init_ul45 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@init_r45 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@init_ur45 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@diagonal_length = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@last = external global [65 x i32*] ; <[65 x i32*]*> [#uses=0]
+@move_list = external global [5120 x i32] ; <[5120 x i32]*> [#uses=0]
+@history_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@.str_1.upgrd.1 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_2.upgrd.2 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_3.upgrd.3 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_5.upgrd.4 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_6.upgrd.5 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@trans_ref_wa = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0]
+@hash_table_size = external global i32 ; <i32*> [#uses=0]
+@trans_ref_wb = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0]
+@trans_ref_ba = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0]
+@trans_ref_bb = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0]
+@pawn_hash_table_size = external global i32 ; <i32*> [#uses=0]
+@.str_9.upgrd.6 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@log_hash = external global i32 ; <i32*> [#uses=0]
+@log_pawn_hash = external global i32 ; <i32*> [#uses=0]
+@hash_maska = external global i32 ; <i32*> [#uses=0]
+@hash_maskb = external global i32 ; <i32*> [#uses=0]
+@mask_1 = external global i64 ; <i64*> [#uses=0]
+@bishop_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@queen_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@plus7dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@plus9dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@minus7dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@minus9dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@plus1dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@minus1dir = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@rook_attacks = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@king_attacks_1 = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@king_attacks_2 = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@.ctor_1.upgrd.7 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@.ctor_2 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@rook_mobility_r0 = external global [64 x [256 x i32]] ; <[64 x [256 x i32]]*> [#uses=0]
+@rook_mobility_rl90 = external global [64 x [256 x i32]] ; <[64 x [256 x i32]]*> [#uses=0]
+@initial_position = external global [80 x i8] ; <[80 x i8]*> [#uses=5]
+@"\01a1.0__" = external global [80 x i8] ; <[80 x i8]*> [#uses=0]
+@"\01a2.1__" = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@"\01a3.2__" = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@"\01a4.3__" = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@"\01a5.4__" = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@"\01args.5__" = external global [16 x i8*] ; <[16 x i8*]*> [#uses=0]
+@.str_10.upgrd.8 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@w_pawn_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@w_pawn_random32 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@b_pawn_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_pawn_random32 = external global [64 x i32] ; <[64 x i32]*> [#uses=0]
+@w_knight_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_knight_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@w_bishop_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_bishop_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@w_rook_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_rook_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@w_queen_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_queen_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@w_king_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@b_king_random = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@enpassant_random = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@castle_random_w = external global [2 x i64] ; <[2 x i64]*> [#uses=0]
+@castle_random_b = external global [2 x i64] ; <[2 x i64]*> [#uses=0]
+@set_mask_rl90 = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@set_mask_rl45 = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@set_mask_rr45 = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@transposition_id = external global i8 ; <i8*> [#uses=0]
+@mask_2 = external global i64 ; <i64*> [#uses=0]
+@mask_3 = external global i64 ; <i64*> [#uses=0]
+@mask_4 = external global i64 ; <i64*> [#uses=0]
+@mask_8 = external global i64 ; <i64*> [#uses=0]
+@mask_16 = external global i64 ; <i64*> [#uses=0]
+@mask_32 = external global i64 ; <i64*> [#uses=0]
+@mask_72 = external global i64 ; <i64*> [#uses=0]
+@mask_80 = external global i64 ; <i64*> [#uses=0]
+@mask_85 = external global i64 ; <i64*> [#uses=0]
+@mask_96 = external global i64 ; <i64*> [#uses=0]
+@mask_107 = external global i64 ; <i64*> [#uses=0]
+@mask_108 = external global i64 ; <i64*> [#uses=0]
+@mask_112 = external global i64 ; <i64*> [#uses=0]
+@mask_118 = external global i64 ; <i64*> [#uses=0]
+@mask_120 = external global i64 ; <i64*> [#uses=0]
+@mask_121 = external global i64 ; <i64*> [#uses=0]
+@mask_127 = external global i64 ; <i64*> [#uses=0]
+@mask_clear_entry = external global i64 ; <i64*> [#uses=0]
+@clear_mask_rl45 = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@clear_mask_rr45 = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@clear_mask_rl90 = external global [65 x i64] ; <[65 x i64]*> [#uses=0]
+@right_half_mask = external global i64 ; <i64*> [#uses=0]
+@left_half_mask = external global i64 ; <i64*> [#uses=0]
+@mask_not_rank8 = external global i64 ; <i64*> [#uses=0]
+@mask_not_rank1 = external global i64 ; <i64*> [#uses=0]
+@center = external global i64 ; <i64*> [#uses=0]
+@mask_pawn_connected = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@mask_eptest = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@mask_kingside_attack_w1 = external global i64 ; <i64*> [#uses=0]
+@mask_kingside_attack_w2 = external global i64 ; <i64*> [#uses=0]
+@mask_queenside_attack_w1 = external global i64 ; <i64*> [#uses=0]
+@mask_queenside_attack_w2 = external global i64 ; <i64*> [#uses=0]
+@mask_kingside_attack_b1 = external global i64 ; <i64*> [#uses=0]
+@mask_kingside_attack_b2 = external global i64 ; <i64*> [#uses=0]
+@mask_queenside_attack_b1 = external global i64 ; <i64*> [#uses=0]
+@mask_queenside_attack_b2 = external global i64 ; <i64*> [#uses=0]
+@pawns_cramp_black = external global i64 ; <i64*> [#uses=0]
+@pawns_cramp_white = external global i64 ; <i64*> [#uses=0]
+@light_squares = external global i64 ; <i64*> [#uses=0]
+@mask_left_edge = external global i64 ; <i64*> [#uses=0]
+@mask_right_edge = external global i64 ; <i64*> [#uses=0]
+@mask_advance_2_w = external global i64 ; <i64*> [#uses=0]
+@mask_advance_2_b = external global i64 ; <i64*> [#uses=0]
+@mask_corner_squares = external global i64 ; <i64*> [#uses=0]
+@mask_promotion_threat_w = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@mask_promotion_threat_b = external global [64 x i64] ; <[64 x i64]*> [#uses=0]
+@promote_mask_w = external global i64 ; <i64*> [#uses=0]
+@promote_mask_b = external global i64 ; <i64*> [#uses=0]
+@mask_a1_corner = external global i64 ; <i64*> [#uses=0]
+@mask_h1_corner = external global i64 ; <i64*> [#uses=0]
+@mask_a8_corner = external global i64 ; <i64*> [#uses=0]
+@mask_h8_corner = external global i64 ; <i64*> [#uses=0]
+@white_center_pawns = external global i64 ; <i64*> [#uses=0]
+@black_center_pawns = external global i64 ; <i64*> [#uses=0]
+@wtm_random = external global [2 x i64] ; <[2 x i64]*> [#uses=0]
+@endgame_random_w = external global i64 ; <i64*> [#uses=0]
+@endgame_random_b = external global i64 ; <i64*> [#uses=0]
+@w_rooks_random = external global i64 ; <i64*> [#uses=0]
+@b_rooks_random = external global i64 ; <i64*> [#uses=0]
+@.ctor_11 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.ctor_2.upgrd.9 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_1.upgrd.10 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_2.upgrd.11 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_32 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_4.upgrd.12 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_5.upgrd.13 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_6.upgrd.14 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_7.upgrd.15 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_8.upgrd.16 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_9.upgrd.17 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_10.upgrd.18 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_11.upgrd.19 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_12.upgrd.20 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_13 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@num_ponder_moves = external global i32 ; <i32*> [#uses=0]
+@ponder_moves = external global [220 x i32] ; <[220 x i32]*> [#uses=0]
+@.str_14.upgrd.21 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_15 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_16 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@auto232 = external global i32 ; <i32*> [#uses=0]
+@puzzling = external global i8 ; <i8*> [#uses=0]
+@abort_search = external global i8 ; <i8*> [#uses=0]
+@.str_24 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@wtm = external global i32 ; <i32*> [#uses=0]
+@.str_3.upgrd.22 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_4.upgrd.23 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@end_time = external global i32 ; <i32*> [#uses=0]
+@time_type = external global i32 ; <i32*> [#uses=0]
+@start_time = external global i32 ; <i32*> [#uses=0]
+@.str_6.upgrd.24 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_7.upgrd.25 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@nodes_searched = external global i32 ; <i32*> [#uses=0]
+@iteration_depth = external global i32 ; <i32*> [#uses=0]
+@searched_this_root_move = external global [256 x i8] ; <[256 x i8]*> [#uses=0]
+@.str_9.upgrd.26 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_10.upgrd.27 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_11.upgrd.28 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_12.upgrd.29 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_14.upgrd.30 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_16.upgrd.31 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@thinking = external global i8 ; <i8*> [#uses=0]
+@time_abort = external global i32 ; <i32*> [#uses=0]
+@.str_17 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@analyze_move_read = external global i32 ; <i32*> [#uses=0]
+@analyze_mode = external global i32 ; <i32*> [#uses=0]
+@pondering = external global i8 ; <i8*> [#uses=0]
+@auto232_delay = external global i32 ; <i32*> [#uses=0]
+@auto_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@.str_19 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_20 = external global [11 x i8] ; <[11 x i8]*> [#uses=0]
+@.str_21 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@ponder_move = external global i32 ; <i32*> [#uses=0]
+@predicted = external global i32 ; <i32*> [#uses=0]
+@made_predicted_move = external global i32 ; <i32*> [#uses=0]
+@opponent_end_time = external global i32 ; <i32*> [#uses=0]
+@program_start_time = external global i32 ; <i32*> [#uses=0]
+@.str_23 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_24.upgrd.32 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_25 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_26 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_28 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@book_move = external global i32 ; <i32*> [#uses=0]
+@elapsed_start = external global i32 ; <i32*> [#uses=0]
+@burp = external global i32 ; <i32*> [#uses=0]
+@cpu_percent = external global i32 ; <i32*> [#uses=0]
+@next_time_check = external global i32 ; <i32*> [#uses=0]
+@nodes_between_time_checks = external global i32 ; <i32*> [#uses=0]
+@transposition_hits = external global i32 ; <i32*> [#uses=0]
+@transposition_probes = external global i32 ; <i32*> [#uses=0]
+@tb_probes = external global i32 ; <i32*> [#uses=0]
+@tb_probes_successful = external global i32 ; <i32*> [#uses=0]
+@check_extensions_done = external global i32 ; <i32*> [#uses=0]
+@recapture_extensions_done = external global i32 ; <i32*> [#uses=0]
+@passed_pawn_extensions_done = external global i32 ; <i32*> [#uses=0]
+@one_reply_extensions_done = external global i32 ; <i32*> [#uses=0]
+@program_end_time = external global i32 ; <i32*> [#uses=0]
+@root_value = external global i32 ; <i32*> [#uses=0]
+@last_search_value = external global i32 ; <i32*> [#uses=0]
+@.str_1.upgrd.33 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_2.upgrd.34 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@booking = external global i8 ; <i8*> [#uses=0]
+@annotate_mode = external global i32 ; <i32*> [#uses=0]
+@.str_4.upgrd.35 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_5.upgrd.36 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@last_pv = external global %typedef.CHESS_PATH ; <%typedef.CHESS_PATH*> [#uses=0]
+@.str_8.upgrd.37 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@root_alpha = external global i32 ; <i32*> [#uses=0]
+@last_value = external global i32 ; <i32*> [#uses=0]
+@root_beta = external global i32 ; <i32*> [#uses=0]
+@root_nodes = external global [256 x i32] ; <[256 x i32]*> [#uses=0]
+@trace_level = external global i32 ; <i32*> [#uses=0]
+@.str_9.upgrd.38 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_10.upgrd.39 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@search_failed_high = external global i32 ; <i32*> [#uses=0]
+@search_failed_low = external global i32 ; <i32*> [#uses=0]
+@nodes_per_second = external global i32 ; <i32*> [#uses=0]
+@time_limit = external global i32 ; <i32*> [#uses=0]
+@easy_move = external global i32 ; <i32*> [#uses=0]
+@noise_level = external global i32 ; <i32*> [#uses=0]
+@.str_12.upgrd.40 = external global [34 x i8] ; <[34 x i8]*> [#uses=0]
+@.str_136 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@solution_type = external global i32 ; <i32*> [#uses=0]
+@number_of_solutions = external global i32 ; <i32*> [#uses=0]
+@solutions = external global [10 x i32] ; <[10 x i32]*> [#uses=0]
+@early_exit = external global i32 ; <i32*> [#uses=0]
+@.str_14.upgrd.41 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_15.upgrd.42 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_16.upgrd.43 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@whisper_value = external global i32 ; <i32*> [#uses=0]
+@.str_17.upgrd.44 = external global [29 x i8] ; <[29 x i8]*> [#uses=0]
+@.str_19.upgrd.45 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@last_mate_score = external global i32 ; <i32*> [#uses=0]
+@search_depth = external global i32 ; <i32*> [#uses=0]
+@elapsed_end = external global i32 ; <i32*> [#uses=0]
+@.str_20.upgrd.46 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_21.upgrd.47 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_22 = external global [13 x i8] ; <[13 x i8]*> [#uses=0]
+@.str_23.upgrd.48 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_24.upgrd.49 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_25.upgrd.50 = external global [67 x i8] ; <[67 x i8]*> [#uses=0]
+@.str_26.upgrd.51 = external global [69 x i8] ; <[69 x i8]*> [#uses=0]
+@hash_move = external global [65 x i32] ; <[65 x i32]*> [#uses=0]
+@version = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@mode = external global i32 ; <i32*> [#uses=0]
+@batch_mode = external global i32 ; <i32*> [#uses=0]
+@crafty_rating = external global i32 ; <i32*> [#uses=0]
+@opponent_rating = external global i32 ; <i32*> [#uses=0]
+@pgn_event = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@pgn_site = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@pgn_date = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@pgn_round = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@pgn_white = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@pgn_white_elo = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@pgn_black = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@pgn_black_elo = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@pgn_result = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@number_auto_kibitzers = external global i32 ; <i32*> [#uses=0]
+@auto_kibitz_list = external global [100 x [20 x i8]] ; <[100 x [20 x i8]]*> [#uses=0]
+@number_of_computers = external global i32 ; <i32*> [#uses=0]
+@computer_list = external global [100 x [20 x i8]] ; <[100 x [20 x i8]]*> [#uses=0]
+@number_of_GMs = external global i32 ; <i32*> [#uses=0]
+@GM_list = external global [100 x [20 x i8]] ; <[100 x [20 x i8]]*> [#uses=0]
+@number_of_IMs = external global i32 ; <i32*> [#uses=0]
+@IM_list = external global [100 x [20 x i8]] ; <[100 x [20 x i8]]*> [#uses=0]
+@ics = external global i32 ; <i32*> [#uses=0]
+@output_format = external global i32 ; <i32*> [#uses=0]
+@EGTBlimit = external global i32 ; <i32*> [#uses=0]
+@whisper = external global i32 ; <i32*> [#uses=0]
+@channel = external global i32 ; <i32*> [#uses=0]
+@new_game = external global i32 ; <i32*> [#uses=0]
+@channel_title = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@initialized = external global i32 ; <i32*> [#uses=0]
+@kibitz = external global i32 ; <i32*> [#uses=0]
+@post = external global i32 ; <i32*> [#uses=0]
+@log_id = external global i32 ; <i32*> [#uses=0]
+@crafty_is_white = external global i32 ; <i32*> [#uses=0]
+@last_opponent_move = external global i32 ; <i32*> [#uses=0]
+@search_move = external global i32 ; <i32*> [#uses=0]
+@time_used = external global i32 ; <i32*> [#uses=0]
+@time_used_opponent = external global i32 ; <i32*> [#uses=0]
+@auto_kibitzing = external global i32 ; <i32*> [#uses=0]
+@test_mode = external global i32 ; <i32*> [#uses=0]
+@resign = external global i8 ; <i8*> [#uses=0]
+@resign_counter = external global i8 ; <i8*> [#uses=0]
+@resign_count = external global i8 ; <i8*> [#uses=0]
+@draw_counter = external global i8 ; <i8*> [#uses=0]
+@draw_count = external global i8 ; <i8*> [#uses=0]
+@tc_moves = external global i32 ; <i32*> [#uses=0]
+@tc_time = external global i32 ; <i32*> [#uses=0]
+@tc_time_remaining = external global i32 ; <i32*> [#uses=0]
+@tc_moves_remaining = external global i32 ; <i32*> [#uses=0]
+@tc_secondary_moves = external global i32 ; <i32*> [#uses=0]
+@tc_secondary_time = external global i32 ; <i32*> [#uses=0]
+@tc_sudden_death = external global i32 ; <i32*> [#uses=0]
+@tc_operator_time = external global i32 ; <i32*> [#uses=0]
+@tc_safety_margin = external global i32 ; <i32*> [#uses=0]
+@force = external global i32 ; <i32*> [#uses=0]
+@over = external global i32 ; <i32*> [#uses=0]
+@usage_level = external global i32 ; <i32*> [#uses=0]
+@audible_alarm = external global i8 ; <i8*> [#uses=0]
+@ansi = external global i32 ; <i32*> [#uses=0]
+@book_accept_mask = external global i32 ; <i32*> [#uses=0]
+@book_reject_mask = external global i32 ; <i32*> [#uses=0]
+@book_random = external global i32 ; <i32*> [#uses=0]
+@book_search_trigger = external global i32 ; <i32*> [#uses=0]
+@learning = external global i32 ; <i32*> [#uses=0]
+@show_book = external global i32 ; <i32*> [#uses=0]
+@book_selection_width = external global i32 ; <i32*> [#uses=0]
+@ponder = external global i32 ; <i32*> [#uses=0]
+@verbosity_level = external global i32 ; <i32*> [#uses=0]
+@push_extensions = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_28.upgrd.52 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_3.upgrd.53 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@display = external global %typedef.CHESS_POSITION ; <%typedef.CHESS_POSITION*> [#uses=0]
+@.str_4.upgrd.54 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@opponent_start_time = external global i32 ; <i32*> [#uses=0]
+@.str_8.upgrd.55 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_9.upgrd.56 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_18 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_19.upgrd.57 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_2013 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_21.upgrd.58 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str_22.upgrd.59 = external global [29 x i8] ; <[29 x i8]*> [#uses=0]
+@.str_23.upgrd.60 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@whisper_text = external global [500 x i8] ; <[500 x i8]*> [#uses=0]
+@.str_24.upgrd.61 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_25.upgrd.62 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_26.upgrd.63 = external global [11 x i8] ; <[11 x i8]*> [#uses=0]
+@.str_28.upgrd.64 = external global [13 x i8] ; <[13 x i8]*> [#uses=0]
+@.str_29 = external global [13 x i8] ; <[13 x i8]*> [#uses=0]
+@.str_30 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_31 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_32.upgrd.65 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_36 = external global [3 x i8] ; <[3 x i8]*> [#uses=1]
+@.str_37 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_44 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_45 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_49 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_52 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@previous_search_value = external global i32 ; <i32*> [#uses=0]
+@.str_64 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@whisper_depth = external global i32 ; <i32*> [#uses=0]
+@.str_65 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_66 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@total_moves = external global i32 ; <i32*> [#uses=0]
+@book_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@books_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@book_lrn_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@position_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@position_lrn_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0]
+@log_filename = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@history_filename = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@book_path = external global [128 x i8] ; <[128 x i8]*> [#uses=0]
+@log_path = external global [128 x i8] ; <[128 x i8]*> [#uses=0]
+@tb_path = external global [128 x i8] ; <[128 x i8]*> [#uses=0]
+@cmd_buffer = external global [512 x i8] ; <[512 x i8]*> [#uses=0]
+@root_move = external global i32 ; <i32*> [#uses=0]
+@hint = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@absolute_time_limit = external global i32 ; <i32*> [#uses=0]
+@search_time_limit = external global i32 ; <i32*> [#uses=0]
+@in_check = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@extended_reason = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@current_phase = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@sort_value = external global [256 x i32] ; <[256 x i32]*> [#uses=0]
+@next_status = external global [65 x %typedef.NEXT_MOVE] ; <[65 x %typedef.NEXT_MOVE]*> [#uses=0]
+@save_hash_key = external global [67 x i64] ; <[67 x i64]*> [#uses=0]
+@save_pawn_hash_key = external global [67 x i32] ; <[67 x i32]*> [#uses=0]
+@pawn_advance = external global [8 x i32] ; <[8 x i32]*> [#uses=0]
+@bit_move = external global i64 ; <i64*> [#uses=0]
+@.str_1.upgrd.66 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_2.upgrd.67 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_3.upgrd.68 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_1.upgrd.69 = external global [34 x i8] ; <[34 x i8]*> [#uses=0]
+@.str_2.upgrd.70 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_2.upgrd.71 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_1.upgrd.72 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_2.upgrd.73 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_3.upgrd.74 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_4.upgrd.75 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_5.upgrd.76 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_615 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_7.upgrd.77 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_10.upgrd.78 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_11.upgrd.79 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_12.upgrd.80 = external global [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str_1318 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_1419 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_15.upgrd.81 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_16.upgrd.82 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_19.upgrd.83 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_20.upgrd.84 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_2222 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_2323 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_25.upgrd.85 = external global [29 x i8] ; <[29 x i8]*> [#uses=0]
+@.str_27 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_28.upgrd.86 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_29.upgrd.87 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_30.upgrd.88 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_31.upgrd.89 = external global [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str_32.upgrd.90 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_33 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_34 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_35 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_36.upgrd.91 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_37.upgrd.92 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_38 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_41 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_42 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_43 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_44.upgrd.93 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_4525 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_46 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_47 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_48 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_49.upgrd.94 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_50 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_51 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_52.upgrd.95 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_53 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_54 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_55 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_56 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_57 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_58 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_59 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_60 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_61 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_62 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_63 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_64.upgrd.96 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_66.upgrd.97 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_67 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_68 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_69 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_71 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_72 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_73 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_74 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_75 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_81 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_83 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_84 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_86 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_87 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_89 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_90 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_91 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_92 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_94 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_95 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_96 = external global [34 x i8] ; <[34 x i8]*> [#uses=0]
+@.str_97 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_98 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_100 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_101 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_102 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_103 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_104 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_105 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_106 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_107 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_108 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_109 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_110 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_111 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_112 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_113 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_114 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_115 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_116 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_117 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_118 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_119 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_120 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_121 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_122 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_123 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_124 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_125 = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@.str_126 = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@.str_127 = external global [69 x i8] ; <[69 x i8]*> [#uses=0]
+@.str_128 = external global [66 x i8] ; <[66 x i8]*> [#uses=0]
+@.str_129 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_130 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_131 = external global [67 x i8] ; <[67 x i8]*> [#uses=0]
+@.str_132 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_133 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_134 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_135 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_136.upgrd.98 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_137 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_138 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_139 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_140 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_141 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_142 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_143 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_144 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_145 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_146 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_147 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_148 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_149 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_150 = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@.str_151 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_152 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_153 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_154 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_156 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_157 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str_158 = external global [71 x i8] ; <[71 x i8]*> [#uses=0]
+@.str_159 = external global [72 x i8] ; <[72 x i8]*> [#uses=0]
+@.str_160 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_161 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_162 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_163 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_164 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_165 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_166 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_167 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_168 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_169 = external global [65 x i8] ; <[65 x i8]*> [#uses=0]
+@.str_170 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_171 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_172 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_173 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_174 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_175 = external global [70 x i8] ; <[70 x i8]*> [#uses=0]
+@.str_176 = external global [67 x i8] ; <[67 x i8]*> [#uses=0]
+@.str_177 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_178 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_180 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_181 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_182 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_183 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_184 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_185 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_186 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_187 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_188 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_189 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_190 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_191 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_192 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_193 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_194 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_195 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_196 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_197 = external global [11 x i8] ; <[11 x i8]*> [#uses=0]
+@.str_198 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_201 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_202 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_203 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_204 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_206 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_207 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_208 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_209 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_210 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_211 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_213 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_214 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_215 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_216 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_218 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_219 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_220 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_221 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_222 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_223 = external global [66 x i8] ; <[66 x i8]*> [#uses=0]
+@.str_224 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_225 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_226 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_227 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_228 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_229 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_230 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_231 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_232 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_233 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_234 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_235 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_236 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_237 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_238 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_239 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_240 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_241 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_242 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_243 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_245 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_246 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_247 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_248 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_249 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_250 = external global [45 x i8] ; <[45 x i8]*> [#uses=0]
+@.str_253 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_254 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_256 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_258 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_259 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_261 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_262 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_263 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_266 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_267 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_268 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_270 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_271 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_272 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_273 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_274 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_275 = external global [44 x i8] ; <[44 x i8]*> [#uses=0]
+@.str_276 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_277 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_278 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_279 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_280 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_281 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_282 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_283 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_284 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_285 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_286 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_287 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_288 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_289 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_290 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_291 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_292 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_293 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_294 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_295 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_296 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_297 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_298 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_299 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_300 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_301 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_302 = external global [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str_304 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_305 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_306 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_308 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_310 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_311 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_312 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_313 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_314 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_315 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_316 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_317 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_319 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_320 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_321 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_322 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_323 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_325 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_327 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_328 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_329 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_330 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_331 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_332 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_333 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_334 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_335 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_336 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_337 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_338 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_339 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_340 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_341 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_342 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_343 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_344 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_345 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_346 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_347 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_348 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_349 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_350 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_351 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_352 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_353 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_354 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_355 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_356 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_357 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_358 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_359 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_360 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_362 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_363 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_364 = external global [56 x i8] ; <[56 x i8]*> [#uses=0]
+@.str_365 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_366 = external global [64 x i8] ; <[64 x i8]*> [#uses=0]
+@.str_367 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_368 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_369 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_370 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_371 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_372 = external global [58 x i8] ; <[58 x i8]*> [#uses=0]
+@.str_373 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_374 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_375 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_376 = external global [63 x i8] ; <[63 x i8]*> [#uses=0]
+@.str_377 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_378 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_379 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_380 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_381 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_382 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_383 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_384 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_385 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_387 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_388 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_389 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_390 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_391 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_392 = external global [71 x i8] ; <[71 x i8]*> [#uses=0]
+@.str_393 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_394 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_395 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_396 = external global [60 x i8] ; <[60 x i8]*> [#uses=0]
+@.str_397 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_398 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_399 = external global [67 x i8] ; <[67 x i8]*> [#uses=0]
+@.str_400 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_401 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_402 = external global [62 x i8] ; <[62 x i8]*> [#uses=0]
+@.str_403 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_404 = external global [59 x i8] ; <[59 x i8]*> [#uses=0]
+@.str_405 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_406 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_407 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_408 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_409 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_410 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_411 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_412 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_413 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_414 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_421 = external global [53 x i8] ; <[53 x i8]*> [#uses=0]
+@.str_422 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_423 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_424 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_426 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_427 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_429 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_430 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_431 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_432 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_433 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_434 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_435 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_436 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_437 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_438 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_440 = external global [44 x i8] ; <[44 x i8]*> [#uses=0]
+@.str_445 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_446 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_447 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_448 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_449 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_450 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_451 = external global [44 x i8] ; <[44 x i8]*> [#uses=0]
+@.str_452 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_453 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_454 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_455 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_456 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_459 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_460 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_461 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_462 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_463 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_466 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_467 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_468 = external global [45 x i8] ; <[45 x i8]*> [#uses=0]
+@.str_469 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_470 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str_474 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_477 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_480 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_483 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_485 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_487 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_490 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_494 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_495 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_497 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_498 = external global [13 x i8] ; <[13 x i8]*> [#uses=0]
+@.str_507 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_508 = external global [11 x i8] ; <[11 x i8]*> [#uses=0]
+@.str_509 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_510 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_511 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_512 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_513 = external global [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str_514 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_515 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_516 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_517 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_519 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_520 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_521 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_522 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_523 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_524 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_525 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_526 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_527 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_528 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_529 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_530 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_531 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_532 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_533 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@.str_534 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_535 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_536 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_537 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_539 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_540 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_541 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_542 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_543 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_544 = external global [49 x i8] ; <[49 x i8]*> [#uses=0]
+@.str_546 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_550 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_551 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_552 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str_553 = external global [52 x i8] ; <[52 x i8]*> [#uses=0]
+@.str_554 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_555 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_556 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_557 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_559 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_560 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_562 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_564 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_565 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_567 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_568 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_570 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_571 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_572 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_574 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_576 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_577 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_578 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_579 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_580 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_581 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_582 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_583 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_584 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_586 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_587 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_589 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_590 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_591 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_592 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_596 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_597 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_598 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_599 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_605 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_610 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_613 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_616 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_621 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_622 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_623 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_624 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_625 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_626 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_628 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_629 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_630 = external global [13 x i8] ; <[13 x i8]*> [#uses=0]
+@.str_631 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_632 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_633 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_634 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_635 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_636 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.str_637 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_639 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_643 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_644 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_645 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_646 = external global [1 x i8] ; <[1 x i8]*> [#uses=0]
+@.str_649 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_654 = external global [2 x i8] ; <[2 x i8]*> [#uses=1]
+@.str_656 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_658 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_660 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_662 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_664 = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
+@.str_666 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_667 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_669 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_670 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_671 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_672 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_674 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_675 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_676 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_680 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_682 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_683 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_684 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_685 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_686 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_687 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_688 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_689 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_690 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_691 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_692 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_694 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_695 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_697 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_698 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_700 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_701 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_702 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_703 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_704 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_707 = external global [4 x i8] ; <[4 x i8]*> [#uses=0]
+@.str_708 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_709 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_710 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_711 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_722 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_723 = external global [34 x i8] ; <[34 x i8]*> [#uses=0]
+@.str_726 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_727 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_728 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_729 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_730 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_732 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_734 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_735 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_736 = external global [61 x i8] ; <[61 x i8]*> [#uses=0]
+@.str_738 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_739 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_740 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_741 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_742 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_743 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_744 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str_745 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_747 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_748 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_750 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@"\01text_move.0__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@"\01new_text.1__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_1.upgrd.99 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@"\01text_move.2__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_1.upgrd.100 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_2.upgrd.101 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_3.upgrd.102 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_130.upgrd.103 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_231.upgrd.104 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_3.upgrd.105 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_4.upgrd.106 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_7.upgrd.107 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@"\01hashing_pawns.0__" = external global i32 ; <i32*> [#uses=0]
+@"\01hashing_opening.1__" = external global i32 ; <i32*> [#uses=0]
+@"\01hashing_middle_game.2__" = external global i32 ; <i32*> [#uses=0]
+@"\01hashing_end_game.3__" = external global i32 ; <i32*> [#uses=0]
+@"\01last_wtm.4__" = external global i32 ; <i32*> [#uses=0]
+@.str_1.upgrd.108 = external global [37 x i8] ; <[37 x i8]*> [#uses=0]
+@.str_1.upgrd.109 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_1.upgrd.110 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_2.upgrd.111 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_3.upgrd.112 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_4.upgrd.113 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_5.upgrd.114 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_6.upgrd.115 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_7.upgrd.116 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_934 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_1.upgrd.117 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_3.upgrd.118 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_1.upgrd.119 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_2.upgrd.120 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_4.upgrd.121 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_5.upgrd.122 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_1.upgrd.123 = external global [11 x i8] ; <[11 x i8]*> [#uses=0]
+@.str_2.upgrd.124 = external global [27 x i8] ; <[27 x i8]*> [#uses=0]
+@.str_7.upgrd.125 = external global [29 x i8] ; <[29 x i8]*> [#uses=0]
+@.str_10.upgrd.126 = external global [34 x i8] ; <[34 x i8]*> [#uses=0]
+@.str_1141 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_12.upgrd.127 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_14.upgrd.128 = external global [20 x i8] ; <[20 x i8]*> [#uses=0]
+@.str_1542 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
+@.ctor_1.upgrd.129 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_1.upgrd.130 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_3.upgrd.131 = external global [21 x i8] ; <[21 x i8]*> [#uses=0]
+@.str_4.upgrd.132 = external global [25 x i8] ; <[25 x i8]*> [#uses=0]
+@.str_5.upgrd.133 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_6.upgrd.134 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@.str_143.upgrd.135 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_2.upgrd.136 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_1.upgrd.137 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_2.upgrd.138 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@bit_move44 = external global i64 ; <i64*> [#uses=0]
+@.str_1.upgrd.139 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_248.upgrd.140 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_349.upgrd.141 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.ctor_1.upgrd.142 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_5.upgrd.143 = external global [43 x i8] ; <[43 x i8]*> [#uses=0]
+@.str_6.upgrd.144 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_751 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_852 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@.str_9.upgrd.145 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
+@.str_10.upgrd.146 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@"\01out.0__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_1153 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_12.upgrd.147 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_13.upgrd.148 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_14.upgrd.149 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_15.upgrd.150 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_16.upgrd.151 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_17.upgrd.152 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@"\01out.1__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_18.upgrd.153 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_19.upgrd.154 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_20.upgrd.155 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_21.upgrd.156 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_2254 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_2355 = external global [8 x i8] ; <[8 x i8]*> [#uses=0]
+@.str_24.upgrd.157 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+@.str_25.upgrd.158 = external global [45 x i8] ; <[45 x i8]*> [#uses=0]
+@.str_26.upgrd.159 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@"\01out.2__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_31.upgrd.160 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@"\01out.3__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@"\01out.4__" = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_3457 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_35.upgrd.161 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_36.upgrd.162 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_37.upgrd.163 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_41.upgrd.164 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_45.upgrd.165 = external global [55 x i8] ; <[55 x i8]*> [#uses=0]
+@"\01save_book_selection_width.5__" = external global i32 ; <i32*> [#uses=0]
+@"\01save_book_random.6__" = external global i32 ; <i32*> [#uses=0]
+@"\01save_whisper.7__" = external global i32 ; <i32*> [#uses=0]
+@"\01save_kibitz.8__" = external global i32 ; <i32*> [#uses=0]
+@"\01save_channel.9__" = external global i32 ; <i32*> [#uses=0]
+@"\01save_resign.10" = external global i32 ; <i32*> [#uses=0]
+@"\01save_resign_count.11" = external global i32 ; <i32*> [#uses=0]
+@"\01save_draw_count.12" = external global i32 ; <i32*> [#uses=0]
+@"\01save_learning.13" = external global i32 ; <i32*> [#uses=0]
+@.str_49.upgrd.166 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_51.upgrd.167 = external global [44 x i8] ; <[44 x i8]*> [#uses=0]
+@"\01x.14" = external global [55 x i32] ; <[55 x i32]*> [#uses=0]
+@"\01init.15.b" = external global i1 ; <i1*> [#uses=0]
+@"\01y.16" = external global [55 x i32] ; <[55 x i32]*> [#uses=0]
+@"\01j.17" = external global i32 ; <i32*> [#uses=0]
+@"\01k.18" = external global i32 ; <i32*> [#uses=0]
+@.str_52.upgrd.168 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@"\01text.19" = external global [128 x i8] ; <[128 x i8]*> [#uses=0]
+@.str_5659 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@.str_62.upgrd.169 = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@.str_6662 = external global [5 x i8] ; <[5 x i8]*> [#uses=0]
+@.str_68.upgrd.170 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_69.upgrd.171 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_70 = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+@.str_72.upgrd.172 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_74.upgrd.173 = external global [23 x i8] ; <[23 x i8]*> [#uses=0]
+@.str_76 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_78 = external global [57 x i8] ; <[57 x i8]*> [#uses=0]
+@.str_80 = external global [45 x i8] ; <[45 x i8]*> [#uses=0]
+@.str_82 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_84.upgrd.174 = external global [10 x i8] ; <[10 x i8]*> [#uses=0]
+@.str_86.upgrd.175 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_88 = external global [7 x i8] ; <[7 x i8]*> [#uses=0]
+@.str_90.upgrd.176 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str_92.upgrd.177 = external global [19 x i8] ; <[19 x i8]*> [#uses=0]
+@.str_94.upgrd.178 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_95.upgrd.179 = external global [48 x i8] ; <[48 x i8]*> [#uses=0]
+@.str_97.upgrd.180 = external global [18 x i8] ; <[18 x i8]*> [#uses=0]
+@.str_98.upgrd.181 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_100.upgrd.182 = external global [22 x i8] ; <[22 x i8]*> [#uses=0]
+@.str_163.upgrd.183 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_2.upgrd.184 = external global [38 x i8] ; <[38 x i8]*> [#uses=0]
+@.str_3.upgrd.185 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_4.upgrd.186 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_5.upgrd.187 = external global [51 x i8] ; <[51 x i8]*> [#uses=0]
+@.str_6.upgrd.188 = external global [30 x i8] ; <[30 x i8]*> [#uses=0]
+@.str_7.upgrd.189 = external global [28 x i8] ; <[28 x i8]*> [#uses=0]
+@.str_8.upgrd.190 = external global [33 x i8] ; <[33 x i8]*> [#uses=0]
+@.str_9.upgrd.191 = external global [54 x i8] ; <[54 x i8]*> [#uses=0]
+@.str_10.upgrd.192 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_11.upgrd.193 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_12.upgrd.194 = external global [47 x i8] ; <[47 x i8]*> [#uses=0]
+@.str_13.upgrd.195 = external global [46 x i8] ; <[46 x i8]*> [#uses=0]
+@.str_14.upgrd.196 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_15.upgrd.197 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_16.upgrd.198 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_17.upgrd.199 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_18.upgrd.200 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_19.upgrd.201 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str_20.upgrd.202 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_22.upgrd.203 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_23.upgrd.204 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_24.upgrd.205 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_26.upgrd.206 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_27.upgrd.207 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_28.upgrd.208 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_30.upgrd.209 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_31.upgrd.210 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_32.upgrd.211 = external global [36 x i8] ; <[36 x i8]*> [#uses=0]
+@.str_33.upgrd.212 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_34.upgrd.213 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_3565 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_36.upgrd.214 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_37.upgrd.215 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str_38.upgrd.216 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str_39 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_40 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_41.upgrd.217 = external global [40 x i8] ; <[40 x i8]*> [#uses=0]
+@.str_42.upgrd.218 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_43.upgrd.219 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str_44.upgrd.220 = external global [41 x i8] ; <[41 x i8]*> [#uses=0]
+@.str_45.upgrd.221 = external global [39 x i8] ; <[39 x i8]*> [#uses=0]
+@.str_46.upgrd.222 = external global [35 x i8] ; <[35 x i8]*> [#uses=0]
+@.str_47.upgrd.223 = external global [50 x i8] ; <[50 x i8]*> [#uses=0]
+@.str_48.upgrd.224 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+@.str_49.upgrd.225 = external global [31 x i8] ; <[31 x i8]*> [#uses=0]
+@.str_50.upgrd.226 = external global [15 x i8] ; <[15 x i8]*> [#uses=0]
+@.str_51.upgrd.227 = external global [6 x i8] ; <[6 x i8]*> [#uses=0]
+@.str_52.upgrd.228 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
+@.str_53.upgrd.229 = external global [9 x i8] ; <[9 x i8]*> [#uses=0]
+
+declare i64 @AttacksFrom(i32, i32)
+
+declare i64 @AttacksTo(i32)
+
+declare i32 @Attacked(i32, i32)
+
+declare i64 @Mask(i32)
+
+declare i32 @PopCnt(i64)
+
+declare i32 @FirstOne(i64)
+
+declare i32 @LastOne(i64)
+
+declare i32 @DrawScore()
+
+declare i32 @Drawn(i32)
+
+declare i8* @strchr(i8*, i32)
+
+declare i32 @strcmp(i8*, i8*)
+
+declare i32 @strlen(i8*)
+
+declare i32 @printf(i8*, ...)
+
+declare void @Edit()
+
+declare void @llvm.memcpy(i8*, i8*, i32, i32)
+
+declare i32 @fflush(%struct.__sFILE*)
+
+declare i32 @Read(i32, i8*)
+
+declare i32 @ReadParse(i8*, i8**, i8*)
+
+declare void @DisplayChessBoard(%struct.__sFILE*, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8)
+
+declare void @SetChessBitBoards(%typedef.SEARCH_POSITION*)
+
+declare i32 @EnPrise(i32, i32)
+
+declare i64 @SwapXray(i64, i32, i32)
+
+declare i32 @Evaluate(i32, i32, i32, i32)
+
+declare i32 @EvaluateMate()
+
+declare i32 @EvaluatePawns()
+
+declare i32 @EvaluatePassedPawns()
+
+declare i32 @EvaluatePassedPawnRaces(i32)
+
+declare i32 @Swap(i32, i32, i32)
+
+declare i32 @EvaluateDevelopment(i32)
+
+declare i32 @EvaluateDraws()
+
+declare i32 @HasOpposition(i32, i32, i32)
+
+declare void @HistoryBest(i32, i32, i32)
+
+declare void @HistoryRefutation(i32, i32, i32)
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+declare void @Initialize(i32)
+
+declare void @InitializeZeroMasks()
+
+declare void @InitializeMasks()
+
+declare void @InitializeRandomHash()
+
+declare void @InitializeAttackBoards()
+
+declare void @InitializePawnMasks()
+
+declare void @InitializePieceMasks()
+
+declare void @InitializeChessBoard(%typedef.SEARCH_POSITION*)
+
+declare %struct.__sFILE* @fopen(i8*, i8*)
+
+define i32 @Option() {
+no_exit.53.outer:
+ %tmp.4747 = shl i32 7, 3 ; <i32> [#uses=1]
+ %tmp.4779 = icmp eq %struct.__sFILE* getelementptr ([0 x %struct.__sFILE]* @__sF, i32 0, i32 1), null ; <i1> [#uses=2]
+ br label %no_exit.53
+no_exit.53: ; preds = %else.166, %else.168, %then.360, %no_exit.53.outer
+ %file.2.3.3.ph = phi i32 [ 0, %no_exit.53.outer ], [ %inc.551688, %then.360 ], [ %inc.551701, %else.168 ], [ %file.2.3.3.ph, %else.166 ] ; <i32> [#uses=2]
+ %nempty.5.3.ph = phi i32 [ 0, %no_exit.53.outer ], [ %nempty.5.3, %then.360 ], [ %nempty.5.3, %else.168 ], [ %nempty.5.3.ph, %else.166 ] ; <i32> [#uses=2]
+ %indvar2053.ui = phi i32 [ 0, %no_exit.53.outer ], [ 0, %then.360 ], [ 0, %else.168 ], [ %indvar.next2054, %else.166 ] ; <i32> [#uses=2]
+ %indvar2053 = bitcast i32 %indvar2053.ui to i32 ; <i32> [#uses=2]
+ %file.2.3.3 = add i32 %indvar2053, %file.2.3.3.ph ; <i32> [#uses=4]
+ %nempty.5.3 = add i32 %indvar2053, %nempty.5.3.ph ; <i32> [#uses=3]
+ %tmp.4749 = add i32 %file.2.3.3, %tmp.4747 ; <i32> [#uses=1]
+ %tmp.4750 = getelementptr %typedef.CHESS_POSITION* @search, i32 0, i32 22, i32 %tmp.4749 ; <i8*> [#uses=3]
+ %tmp.4751 = load i8* %tmp.4750 ; <i8> [#uses=1]
+ %tmp.4752 = icmp eq i8 %tmp.4751, 0 ; <i1> [#uses=1]
+ br i1 %tmp.4752, label %else.166, label %then.357
+then.357: ; preds = %no_exit.53
+ %tmp.4755 = icmp eq i32 %nempty.5.3, 0 ; <i1> [#uses=1]
+ br i1 %tmp.4755, label %endif.358, label %then.358
+then.358: ; preds = %then.357
+ ret i32 0
+endif.358: ; preds = %then.357
+ br i1 %tmp.4779, label %else.168, label %then.360
+then.360: ; preds = %endif.358
+ %tmp.4791 = load i8* %tmp.4750 ; <i8> [#uses=1]
+ %tmp.4792 = sext i8 %tmp.4791 to i32 ; <i32> [#uses=1]
+ %tmp.4793 = add i32 %tmp.4792, 7 ; <i32> [#uses=1]
+ %tmp.4794 = getelementptr [15 x i8]* null, i32 0, i32 %tmp.4793 ; <i8*> [#uses=1]
+ %tmp.4795 = load i8* %tmp.4794 ; <i8> [#uses=1]
+ %tmp.4796 = sext i8 %tmp.4795 to i32 ; <i32> [#uses=1]
+ %tmp.4781 = call i32 (%struct.__sFILE*, i8*, ...)* @fprintf( %struct.__sFILE* getelementptr ([0 x %struct.__sFILE]* @__sF, i32 0, i32 1), i8* getelementptr ([3 x i8]* @.str_36, i32 0, i32 0), i32 %tmp.4796 ) ; <i32> [#uses=0]
+ %inc.551688 = add i32 %file.2.3.3, 1 ; <i32> [#uses=2]
+ %tmp.47421699 = icmp slt i32 %inc.551688, 8 ; <i1> [#uses=1]
+ br i1 %tmp.47421699, label %no_exit.53, label %loopexit.56
+else.168: ; preds = %endif.358
+ %tmp.4799 = call i32 @strlen( i8* getelementptr ([80 x i8]* @initial_position, i32 0, i32 0) ) ; <i32> [#uses=2]
+ %gep.upgrd.230 = zext i32 %tmp.4799 to i64 ; <i64> [#uses=1]
+ %tmp.4802 = getelementptr [80 x i8]* @initial_position, i32 0, i64 %gep.upgrd.230 ; <i8*> [#uses=1]
+ %tmp.4811 = load i8* %tmp.4750 ; <i8> [#uses=1]
+ %tmp.4812 = sext i8 %tmp.4811 to i32 ; <i32> [#uses=1]
+ %tmp.4813 = add i32 %tmp.4812, 7 ; <i32> [#uses=1]
+ %tmp.4814 = getelementptr [15 x i8]* null, i32 0, i32 %tmp.4813 ; <i8*> [#uses=1]
+ %tmp.4815 = load i8* %tmp.4814 ; <i8> [#uses=1]
+ store i8 %tmp.4815, i8* %tmp.4802
+ %tmp.4802.sum = add i32 %tmp.4799, 1 ; <i32> [#uses=1]
+ %gep.upgrd.231 = zext i32 %tmp.4802.sum to i64 ; <i64> [#uses=1]
+ %tmp.4802.end = getelementptr [80 x i8]* @initial_position, i32 0, i64 %gep.upgrd.231 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp.4802.end
+ %inc.551701 = add i32 %file.2.3.3, 1 ; <i32> [#uses=2]
+ %tmp.47421703 = icmp slt i32 %inc.551701, 8 ; <i1> [#uses=1]
+ br i1 %tmp.47421703, label %no_exit.53, label %loopexit.56
+else.166: ; preds = %no_exit.53
+ %inc.55 = add i32 %file.2.3.3, 1 ; <i32> [#uses=1]
+ %tmp.47421705 = icmp slt i32 %inc.55, 8 ; <i1> [#uses=1]
+ %indvar.next2054 = add i32 %indvar2053.ui, 1 ; <i32> [#uses=1]
+ br i1 %tmp.47421705, label %no_exit.53, label %loopexit.56
+loopexit.56: ; preds = %else.166, %else.168, %then.360
+ br i1 %tmp.4779, label %else.169, label %then.361
+then.361: ; preds = %loopexit.56
+ %tmp.4822 = call i32 @fwrite( i8* getelementptr ([2 x i8]* @.str_654, i32 0, i32 0), i32 1, i32 1, %struct.__sFILE* getelementptr ([0 x %struct.__sFILE]* @__sF, i32 0, i32 1) ) ; <i32> [#uses=0]
+ %dec.101707 = add i32 7, -1 ; <i32> [#uses=1]
+ %tmp.47391709 = icmp sgt i32 %dec.101707, -1 ; <i1> [#uses=0]
+ ret i32 0
+else.169: ; preds = %loopexit.56
+ %tmp.4827 = call i32 @strlen( i8* getelementptr ([80 x i8]* @initial_position, i32 0, i32 0) ) ; <i32> [#uses=2]
+ %gep.upgrd.232 = zext i32 %tmp.4827 to i64 ; <i64> [#uses=1]
+ %tmp.4830 = getelementptr [80 x i8]* @initial_position, i32 0, i64 %gep.upgrd.232 ; <i8*> [#uses=1]
+ store i8 47, i8* %tmp.4830
+ %tmp.4830.sum = add i32 %tmp.4827, 1 ; <i32> [#uses=1]
+ %gep.upgrd.233 = zext i32 %tmp.4830.sum to i64 ; <i64> [#uses=1]
+ %tmp.4830.end = getelementptr [80 x i8]* @initial_position, i32 0, i64 %gep.upgrd.233 ; <i8*> [#uses=1]
+ store i8 0, i8* %tmp.4830.end
+ %dec.10 = add i32 7, -1 ; <i32> [#uses=1]
+ %tmp.47391711 = icmp sgt i32 %dec.10, -1 ; <i1> [#uses=0]
+ ret i32 0
+}
+
+declare void @InitializeHashTables()
+
+declare i32 @InitializeFindAttacks(i32, i32, i32)
+
+declare void @SetBoard(i32, i8**, i32)
+
+declare i32 @KingPawnSquare(i32, i32, i32, i32)
+
+declare i64 @Random64()
+
+declare i32 @Random32()
+
+declare i8* @strcpy(i8*, i8*)
+
+declare i32 @InputMove(i8*, i32, i32, i32, i32)
+
+declare i32 @InputMoveICS(i8*, i32, i32, i32, i32)
+
+declare i32* @GenerateCaptures(i32, i32, i32*)
+
+declare i32* @GenerateNonCaptures(i32, i32, i32*)
+
+declare void @MakeMove(i32, i32, i32)
+
+declare void @UnMakeMove(i32, i32, i32)
+
+declare void @Interrupt(i32)
+
+declare i32 @GetTime(i32)
+
+declare i8* @DisplayTime(i32)
+
+declare i8* @OutputMoveICS(i32*)
+
+declare void @Delay(i32)
+
+declare i32 @fprintf(%struct.__sFILE*, i8*, ...)
+
+declare void @SignalInterrupt(i32)
+
+declare void (i32)* @signal(i32, void (i32)*)
+
+declare i32 @Iterate(i32, i32, i32)
+
+declare void @PreEvaluate(i32)
+
+declare void @RootMoveList(i32)
+
+declare i8* @OutputMove(i32*, i32, i32)
+
+declare void @TimeSet(i32)
+
+declare void @StorePV(i32, i32)
+
+declare i32 @SearchRoot(i32, i32, i32, i32)
+
+declare void @Whisper(i32, i32, i32, i32, i32, i32, i8*)
+
+declare i8* @DisplayEvaluation(i32)
+
+declare i32 @LookUp(i32, i32, i32, i32*, i32*)
+
+declare i8* @strstr(i8*, i8*)
+
+declare i32 @main(i32, i8**)
+
+declare void @__main()
+
+declare i32 @atoi(i8*)
+
+declare void @NewGame(i32)
+
+declare i32 @Ponder(i32)
+
+declare i32 @fseek(%struct.__sFILE*, i32, i32)
+
+declare void @MakeMoveRoot(i32, i32)
+
+declare i32 @RepetitionDraw(i32)
+
+declare i8* @Reverse()
+
+declare i8* @Normal()
+
+declare void @TimeAdjust(i32, i32)
+
+declare void @ValidatePosition(i32, i32, i8*)
+
+declare i32 @ValidMove(i32, i32, i32)
+
+declare i32* @GenerateCheckEvasions(i32, i32, i32*)
+
+declare i64 @InterposeSquares(i32, i32, i32)
+
+declare i32 @PinnedOnKing(i32, i32)
+
+declare i32 @NextMove(i32, i32)
+
+declare i32 @NextEvasion(i32, i32)
+
+declare i32 @NextRootMove(i32)
+
+declare i32 @TimeCheck(i32)
+
+declare i32 @strncmp(i8*, i8*, i32)
+
+declare void @exit(i32)
+
+declare i32 @OptionMatch(i8*, i8*)
+
+declare i32 @fclose(%struct.__sFILE*)
+
+declare i32 @ParseTime(i8*)
+
+declare i8* @DisplayHHMM(i32)
+
+declare void @DisplayPieceBoards(i32*, i32*)
+
+declare i32 @fscanf(%struct.__sFILE*, i8*, ...)
+
+declare i32 @feof(%struct.__sFILE*)
+
+declare i8* @fgets(i8*, i32, %struct.__sFILE*)
+
+declare i32 @remove(i8*)
+
+declare i32 @__tolower(i32)
+
+declare i32 @clock()
+
+declare void @OptionPerft(i32, i32, i32)
+
+declare void @Phase()
+
+declare i32 @ReadNextMove(i8*, i32, i32)
+
+declare i32 @time(i32*)
+
+declare %struct.tm* @localtime(i32*)
+
+declare i8* @gets(i8*)
+
+declare i32 @OutputGood(i8*, i32, i32)
+
+declare i32 @CheckInput()
+
+declare void @ClearHashTables()
+
+declare i32 @Quiesce(i32, i32, i32, i32)
+
+declare void @SearchTrace(i32, i32, i32, i32, i32, i8*, i32)
+
+declare i32 @RepetitionCheck(i32, i32)
+
+declare void @ResignOrDraw(i32, i32)
+
+declare i32 @Search(i32, i32, i32, i32, i32, i32)
+
+declare void @StoreRefutation(i32, i32, i32, i32)
+
+declare void @StoreBest(i32, i32, i32, i32, i32)
+
+declare void @SearchOutput(i32, i32)
+
+declare i32 @strspn(i8*, i8*)
+
+declare i32 @isatty(i32)
+
+declare i32 @fileno(%struct.__sFILE*)
+
+declare void @llvm.memset(i8*, i8, i32, i32)
+
+declare i32 @select(i32, %struct.fd_set*, %struct.fd_set*, %struct.fd_set*, %struct.timeval*)
+
+declare void @DisplayBitBoard(i64)
+
+declare i8* @DisplayEvaluationWhisper(i32)
+
+declare i8* @DisplayTimeWhisper(i32)
+
+declare void @Display64bitWord(i64)
+
+declare void @Display2BitBoards(i64, i64)
+
+declare void @DisplayChessMove(i8*, i32)
+
+declare void @llvm.memmove(i8*, i8*, i32, i32)
+
+declare void @ReadClear()
+
+declare i8* @strtok(i8*, i8*)
+
+declare i32 @SpecReadRaw()
+
+declare i32 @read(i32, i8*, i32)
+
+declare i32* @__error()
+
+declare i32 @ReadChessMove(%struct.__sFILE*, i32, i32)
+
+declare i64 @ValidateComputeBishopAttacks(i32)
+
+declare i64 @ValidateComputeRookAttacks(i32)
+
+declare i8* @memchr(i8*, i32, i32)
+
+declare i32 @fwrite(i8*, i32, i32, %struct.__sFILE*)
diff --git a/test/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll b/test/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll
new file mode 100644
index 000000000000..916cba20b529
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+define void @sort_Eq(i32* %S2) {
+entry:
+ br i1 false, label %list_Length.exit, label %cond_true.i
+cond_true.i: ; preds = %entry
+ ret void
+list_Length.exit: ; preds = %entry
+ br i1 false, label %list_Length.exit9, label %cond_true.i5
+cond_true.i5: ; preds = %list_Length.exit
+ ret void
+list_Length.exit9: ; preds = %list_Length.exit
+ br i1 false, label %bb78, label %return
+bb44: ; preds = %bb78, %cond_next68
+ br i1 %tmp49.not, label %bb62, label %bb62.loopexit
+bb62.loopexit: ; preds = %bb44
+ br label %bb62
+bb62: ; preds = %bb62.loopexit, %bb44
+ br i1 false, label %return.loopexit, label %cond_next68
+cond_next68: ; preds = %bb62
+ br i1 false, label %return.loopexit, label %bb44
+bb78: ; preds = %list_Length.exit9
+ %tmp49.not = icmp eq i32* %S2, null ; <i1> [#uses=1]
+ br label %bb44
+return.loopexit: ; preds = %cond_next68, %bb62
+ %retval.0.ph = phi i32 [ 1, %cond_next68 ], [ 0, %bb62 ] ; <i32> [#uses=1]
+ br label %return
+return: ; preds = %return.loopexit, %list_Length.exit9
+ %retval.0 = phi i32 [ 0, %list_Length.exit9 ], [ %retval.0.ph, %return.loopexit ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll b/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll
new file mode 100644
index 000000000000..60e464f3acb6
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+ %struct.BLEND_MAP = type { i16, i16, i16, i32, %struct.BLEND_MAP_ENTRY* }
+ %struct.BLEND_MAP_ENTRY = type { float, i8, { [5 x float], [4 x i8] } }
+ %struct.TPATTERN = type { i16, i16, i16, i32, float, float, float, %struct.WARP*, %struct.TPATTERN*, %struct.BLEND_MAP*, { %struct.anon, [4 x i8] } }
+ %struct.TURB = type { i16, %struct.WARP*, [3 x double], i32, float, float }
+ %struct.WARP = type { i16, %struct.WARP* }
+ %struct.anon = type { float, [3 x double] }
+
+define void @Parse_Pattern() {
+entry:
+ br label %bb1096.outer20
+bb671: ; preds = %cond_true1099
+ br label %bb1096.outer23
+bb1096.outer20.loopexit: ; preds = %cond_true1099
+ %Local_Turb.0.ph24.lcssa = phi %struct.TURB* [ %Local_Turb.0.ph24, %cond_true1099 ] ; <%struct.TURB*> [#uses=1]
+ br label %bb1096.outer20
+bb1096.outer20: ; preds = %bb1096.outer20.loopexit, %entry
+ %Local_Turb.0.ph22 = phi %struct.TURB* [ undef, %entry ], [ %Local_Turb.0.ph24.lcssa, %bb1096.outer20.loopexit ] ; <%struct.TURB*> [#uses=1]
+ %tmp1098 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br label %bb1096.outer23
+bb1096.outer23: ; preds = %bb1096.outer20, %bb671
+ %Local_Turb.0.ph24 = phi %struct.TURB* [ %Local_Turb.0.ph22, %bb1096.outer20 ], [ null, %bb671 ] ; <%struct.TURB*> [#uses=2]
+ br label %bb1096
+bb1096: ; preds = %cond_true1099, %bb1096.outer23
+ br i1 %tmp1098, label %cond_true1099, label %bb1102
+cond_true1099: ; preds = %bb1096
+ switch i32 0, label %bb1096.outer20.loopexit [
+ i32 161, label %bb671
+ i32 359, label %bb1096
+ ]
+bb1102: ; preds = %bb1096
+ %Local_Turb.0.ph24.lcssa1 = phi %struct.TURB* [ %Local_Turb.0.ph24, %bb1096 ] ; <%struct.TURB*> [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll b/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll
new file mode 100644
index 000000000000..67da9ffad3e2
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+define void @init_caller_save() {
+entry:
+ br label %cond_true78
+cond_next20: ; preds = %cond_true64
+ br label %bb31
+bb31: ; preds = %cond_true64, %cond_true64, %cond_next20
+ %iftmp.29.1 = phi i32 [ 0, %cond_next20 ], [ 0, %cond_true64 ], [ 0, %cond_true64 ] ; <i32> [#uses=0]
+ br label %bb54
+bb54: ; preds = %cond_true78, %bb31
+ br i1 false, label %bb75, label %cond_true64
+cond_true64: ; preds = %bb54
+ switch i32 %i.0.0, label %cond_next20 [
+ i32 17, label %bb31
+ i32 18, label %bb31
+ ]
+bb75: ; preds = %bb54
+ %tmp74.0 = add i32 %i.0.0, 1 ; <i32> [#uses=1]
+ br label %cond_true78
+cond_true78: ; preds = %bb75, %entry
+ %i.0.0 = phi i32 [ 0, %entry ], [ %tmp74.0, %bb75 ] ; <i32> [#uses=2]
+ br label %bb54
+}
+
diff --git a/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll b/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll
new file mode 100644
index 000000000000..08cb9b66bc10
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll
@@ -0,0 +1,28 @@
+; PR1333
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+ %struct.ada__streams__root_stream_type = type { %struct.ada__tags__dispatch_table* }
+ %struct.ada__tags__dispatch_table = type { [1 x i8*] }
+ %struct.quotes__T173s = type { i8, %struct.quotes__T173s__T174s, [2 x [1 x double]], [2 x i16], i64, i8 }
+ %struct.quotes__T173s__T174s = type { i8, i8, i8, i16, i16, [2 x [1 x double]] }
+
+define void @quotes__write_quote() {
+entry:
+ %tmp606.i = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br label %bb
+bb: ; preds = %cond_next73, %bb, %entry
+ br i1 false, label %bb51, label %bb
+bb51: ; preds = %cond_next73, %bb
+ br i1 %tmp606.i, label %quotes__bid_ask_depth_offset_matrices__get_price.exit, label %cond_true.i
+cond_true.i: ; preds = %bb51
+ unreachable
+quotes__bid_ask_depth_offset_matrices__get_price.exit: ; preds = %bb51
+ br i1 false, label %cond_next73, label %cond_true72
+cond_true72: ; preds = %quotes__bid_ask_depth_offset_matrices__get_price.exit
+ unreachable
+cond_next73: ; preds = %quotes__bid_ask_depth_offset_matrices__get_price.exit
+ br i1 false, label %bb, label %bb51
+}
+
diff --git a/test/Transforms/LoopUnswitch/2007-05-09-tl.ll b/test/Transforms/LoopUnswitch/2007-05-09-tl.ll
new file mode 100644
index 000000000000..c987daec7dbc
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-05-09-tl.ll
@@ -0,0 +1,95 @@
+; PR1333
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+define void @pp_cxx_expression() {
+entry:
+ %tmp6 = lshr i32 0, 24 ; <i32> [#uses=1]
+ br label %tailrecurse
+
+tailrecurse: ; preds = %tailrecurse, %tailrecurse, %entry
+ switch i32 %tmp6, label %bb96 [
+ i32 24, label %bb10
+ i32 25, label %bb10
+ i32 28, label %bb10
+ i32 29, label %bb48
+ i32 31, label %bb48
+ i32 32, label %bb48
+ i32 33, label %bb48
+ i32 34, label %bb48
+ i32 36, label %bb15
+ i32 51, label %bb89
+ i32 52, label %bb89
+ i32 54, label %bb83
+ i32 57, label %bb59
+ i32 63, label %bb80
+ i32 64, label %bb80
+ i32 68, label %bb80
+ i32 169, label %bb75
+ i32 170, label %bb19
+ i32 171, label %bb63
+ i32 172, label %bb63
+ i32 173, label %bb67
+ i32 174, label %bb67
+ i32 175, label %bb19
+ i32 176, label %bb75
+ i32 178, label %bb59
+ i32 179, label %bb89
+ i32 180, label %bb59
+ i32 182, label %bb48
+ i32 183, label %bb48
+ i32 184, label %bb48
+ i32 185, label %bb48
+ i32 186, label %bb48
+ i32 195, label %bb48
+ i32 196, label %bb59
+ i32 197, label %bb89
+ i32 198, label %bb70
+ i32 199, label %bb59
+ i32 200, label %bb59
+ i32 201, label %bb59
+ i32 202, label %bb59
+ i32 203, label %bb75
+ i32 204, label %bb59
+ i32 205, label %tailrecurse
+ i32 210, label %tailrecurse
+ ]
+
+bb10: ; preds = %tailrecurse, %tailrecurse, %tailrecurse
+ ret void
+
+bb15: ; preds = %tailrecurse
+ ret void
+
+bb19: ; preds = %tailrecurse, %tailrecurse
+ ret void
+
+bb48: ; preds = %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse
+ ret void
+
+bb59: ; preds = %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse
+ ret void
+
+bb63: ; preds = %tailrecurse, %tailrecurse
+ ret void
+
+bb67: ; preds = %tailrecurse, %tailrecurse
+ ret void
+
+bb70: ; preds = %tailrecurse
+ ret void
+
+bb75: ; preds = %tailrecurse, %tailrecurse, %tailrecurse
+ ret void
+
+bb80: ; preds = %tailrecurse, %tailrecurse, %tailrecurse
+ ret void
+
+bb83: ; preds = %tailrecurse
+ ret void
+
+bb89: ; preds = %tailrecurse, %tailrecurse, %tailrecurse, %tailrecurse
+ ret void
+
+bb96: ; preds = %tailrecurse
+ ret void
+}
diff --git a/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll b/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll
new file mode 100644
index 000000000000..c4080c1e3b19
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll
@@ -0,0 +1,45 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -instcombine -disable-output
+
+@str3 = external constant [3 x i8] ; <[3 x i8]*> [#uses=1]
+
+define i32 @stringSearch_Clib(i32 %count) {
+entry:
+ %ttmp25 = icmp sgt i32 %count, 0 ; <i1> [#uses=1]
+ br i1 %ttmp25, label %bb36.preheader, label %bb44
+
+bb36.preheader: ; preds = %entry
+ %ttmp33 = icmp slt i32 0, 250 ; <i1> [#uses=1]
+ br label %bb36.outer
+
+bb36.outer: ; preds = %bb41, %bb36.preheader
+ br i1 %ttmp33, label %bb.nph, label %bb41
+
+bb.nph: ; preds = %bb36.outer
+ %ttmp8 = icmp eq i8* null, null ; <i1> [#uses=1]
+ %ttmp6 = icmp eq i8* null, null ; <i1> [#uses=1]
+ %tmp31 = call i32 @strcspn( i8* null, i8* getelementptr ([3 x i8]* @str3, i64 0, i64 0) ) ; <i32> [#uses=1]
+ br i1 %ttmp8, label %cond_next, label %cond_true
+
+cond_true: ; preds = %bb.nph
+ ret i32 0
+
+cond_next: ; preds = %bb.nph
+ br i1 %ttmp6, label %cond_next28, label %cond_true20
+
+cond_true20: ; preds = %cond_next
+ ret i32 0
+
+cond_next28: ; preds = %cond_next
+ %tmp33 = add i32 %tmp31, 0 ; <i32> [#uses=1]
+ br label %bb41
+
+bb41: ; preds = %cond_next28, %bb36.outer
+ %c.2.lcssa = phi i32 [ 0, %bb36.outer ], [ %tmp33, %cond_next28 ] ; <i32> [#uses=1]
+ br i1 false, label %bb36.outer, label %bb44
+
+bb44: ; preds = %bb41, %entry
+ %c.01.1 = phi i32 [ 0, %entry ], [ %c.2.lcssa, %bb41 ] ; <i32> [#uses=1]
+ ret i32 %c.01.1
+}
+
+declare i32 @strcspn(i8*, i8*)
diff --git a/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll b/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll
new file mode 100644
index 000000000000..de3f670f2b95
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %tmp1785365 = icmp ult i32 0, 100 ; <i1> [#uses=1]
+ br label %bb
+
+bb: ; preds = %cond_true, %entry
+ br i1 false, label %cond_true, label %cond_next
+
+cond_true: ; preds = %bb
+ br i1 %tmp1785365, label %bb, label %bb1788
+
+cond_next: ; preds = %bb
+ %iftmp.1.0 = select i1 false, i32 0, i32 0 ; <i32> [#uses=1]
+ br i1 false, label %cond_true47, label %cond_next74
+
+cond_true47: ; preds = %cond_next
+ %tmp53 = urem i32 %iftmp.1.0, 0 ; <i32> [#uses=0]
+ ret i32 0
+
+cond_next74: ; preds = %cond_next
+ ret i32 0
+
+bb1788: ; preds = %cond_true
+ ret i32 0
+}
diff --git a/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll b/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll
new file mode 100644
index 000000000000..edd7d1ff58e7
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll
@@ -0,0 +1,66 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+; PR1559
+
+target triple = "i686-pc-linux-gnu"
+ %struct.re_pattern_buffer = type { i8*, i32, i32, i32, i8*, i8*, i32, i8 }
+
+define fastcc i32 @byte_regex_compile(i8* %pattern, i32 %size, i32 %syntax, %struct.re_pattern_buffer* %bufp) {
+entry:
+ br i1 false, label %bb147, label %cond_next123
+
+cond_next123: ; preds = %entry
+ ret i32 0
+
+bb147: ; preds = %entry
+ switch i32 0, label %normal_char [
+ i32 91, label %bb1734
+ i32 92, label %bb5700
+ ]
+
+bb1734: ; preds = %bb147
+ br label %bb1855.outer.outer
+
+cond_true1831: ; preds = %bb1855.outer
+ br i1 %tmp1837, label %cond_next1844, label %cond_true1840
+
+cond_true1840: ; preds = %cond_true1831
+ ret i32 0
+
+cond_next1844: ; preds = %cond_true1831
+ br i1 false, label %bb1855.outer, label %cond_true1849
+
+cond_true1849: ; preds = %cond_next1844
+ br label %bb1855.outer.outer
+
+bb1855.outer.outer: ; preds = %cond_true1849, %bb1734
+ %b.10.ph.ph = phi i8* [ null, %cond_true1849 ], [ null, %bb1734 ] ; <i8*> [#uses=1]
+ br label %bb1855.outer
+
+bb1855.outer: ; preds = %bb1855.outer.outer, %cond_next1844
+ %b.10.ph = phi i8* [ null, %cond_next1844 ], [ %b.10.ph.ph, %bb1855.outer.outer ] ; <i8*> [#uses=1]
+ %tmp1837 = icmp eq i8* null, null ; <i1> [#uses=2]
+ br i1 false, label %cond_true1831, label %cond_next1915
+
+cond_next1915: ; preds = %cond_next1961, %bb1855.outer
+ store i8* null, i8** null
+ br i1 %tmp1837, label %cond_next1929, label %cond_true1923
+
+cond_true1923: ; preds = %cond_next1915
+ ret i32 0
+
+cond_next1929: ; preds = %cond_next1915
+ br i1 false, label %cond_next1961, label %cond_next2009
+
+cond_next1961: ; preds = %cond_next1929
+ %tmp1992 = getelementptr i8* %b.10.ph, i32 0 ; <i8*> [#uses=0]
+ br label %cond_next1915
+
+cond_next2009: ; preds = %cond_next1929
+ ret i32 0
+
+bb5700: ; preds = %bb147
+ ret i32 0
+
+normal_char: ; preds = %bb147
+ ret i32 0
+}
diff --git a/test/Transforms/LoopUnswitch/2007-08-01-Dom.ll b/test/Transforms/LoopUnswitch/2007-08-01-Dom.ll
new file mode 100644
index 000000000000..9673e2e96a96
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-08-01-Dom.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -licm -loop-unswitch -disable-output
+; PR 1589
+
+ %struct.QBasicAtomic = type { i32 }
+
+define void @_ZNK5QDate9addMonthsEi(%struct.QBasicAtomic* sret %agg.result, %struct.QBasicAtomic* %this, i32 %nmonths) {
+entry:
+ br label %cond_true90
+
+bb16: ; preds = %cond_true90
+ br i1 false, label %bb93, label %cond_true90
+
+bb45: ; preds = %cond_true90
+ br i1 false, label %bb53, label %bb58
+
+bb53: ; preds = %bb45
+ br i1 false, label %bb93, label %cond_true90
+
+bb58: ; preds = %bb45
+ store i32 0, i32* null, align 4
+ br i1 false, label %cond_true90, label %bb93
+
+cond_true90: ; preds = %bb58, %bb53, %bb16, %entry
+ %nmonths_addr.016.1 = phi i32 [ %nmonths, %entry ], [ 0, %bb16 ], [ 0, %bb53 ], [ %nmonths_addr.016.1, %bb58 ] ; <i32> [#uses=2]
+ %tmp14 = icmp slt i32 %nmonths_addr.016.1, -11 ; <i1> [#uses=1]
+ br i1 %tmp14, label %bb16, label %bb45
+
+bb93: ; preds = %bb58, %bb53, %bb16
+ ret void
+}
diff --git a/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll b/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll
new file mode 100644
index 000000000000..139cdbe70a05
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll
@@ -0,0 +1,55 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -instcombine -disable-output
+ %struct.ClassDef = type { %struct.QByteArray, %struct.QByteArray, %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", i8, i8, %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QMap<QByteArray,QByteArray>", %"struct.QList<ArgumentDef>", %"struct.QMap<QByteArray,QByteArray>", i32, i32 }
+ %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+ %struct.Generator = type { %struct.FILE*, %struct.ClassDef*, %"struct.QList<ArgumentDef>", %struct.QByteArray, %"struct.QList<ArgumentDef>" }
+ %struct.QBasicAtomic = type { i32 }
+ %struct.QByteArray = type { %"struct.QByteArray::Data"* }
+ %"struct.QByteArray::Data" = type { %struct.QBasicAtomic, i32, i32, i8*, [1 x i8] }
+ %"struct.QList<ArgumentDef>" = type { %"struct.QList<ArgumentDef>::._19" }
+ %"struct.QList<ArgumentDef>::._19" = type { %struct.QListData }
+ %struct.QListData = type { %"struct.QListData::Data"* }
+ %"struct.QListData::Data" = type { %struct.QBasicAtomic, i32, i32, i32, i8, [1 x i8*] }
+ %"struct.QMap<QByteArray,QByteArray>" = type { %"struct.QMap<QByteArray,QByteArray>::._56" }
+ %"struct.QMap<QByteArray,QByteArray>::._56" = type { %struct.QMapData* }
+ %struct.QMapData = type { %struct.QMapData*, [12 x %struct.QMapData*], %struct.QBasicAtomic, i32, i32, i32, i8 }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
+@.str9 = external constant [1 x i8] ; <[1 x i8]*> [#uses=1]
+
+declare i32 @strcmp(i8*, i8*)
+
+define i32 @_ZN9Generator6strregEPKc(%struct.Generator* %this, i8* %s) {
+entry:
+ %s_addr.0 = select i1 false, i8* getelementptr ([1 x i8]* @.str9, i32 0, i32 0), i8* %s ; <i8*> [#uses=2]
+ %tmp122 = icmp eq i8* %s_addr.0, null ; <i1> [#uses=1]
+ br label %bb184
+
+bb55: ; preds = %bb184
+ ret i32 0
+
+bb88: ; preds = %bb184
+ br i1 %tmp122, label %bb154, label %bb128
+
+bb128: ; preds = %bb88
+ %tmp138 = call i32 @strcmp( i8* null, i8* %s_addr.0 ) ; <i32> [#uses=1]
+ %iftmp.37.0.in4 = icmp eq i32 %tmp138, 0 ; <i1> [#uses=1]
+ br i1 %iftmp.37.0.in4, label %bb250, label %bb166
+
+bb154: ; preds = %bb88
+ br i1 false, label %bb250, label %bb166
+
+bb166: ; preds = %bb154, %bb128
+ %tmp175 = add i32 %idx.0, 1 ; <i32> [#uses=1]
+ %tmp177 = add i32 %tmp175, 0 ; <i32> [#uses=1]
+ %tmp181 = add i32 %tmp177, 0 ; <i32> [#uses=1]
+ %tmp183 = add i32 %i33.0, 1 ; <i32> [#uses=1]
+ br label %bb184
+
+bb184: ; preds = %bb166, %entry
+ %i33.0 = phi i32 [ 0, %entry ], [ %tmp183, %bb166 ] ; <i32> [#uses=2]
+ %idx.0 = phi i32 [ 0, %entry ], [ %tmp181, %bb166 ] ; <i32> [#uses=2]
+ %tmp49 = icmp slt i32 %i33.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp49, label %bb88, label %bb55
+
+bb250: ; preds = %bb154, %bb128
+ ret i32 %idx.0
+}
diff --git a/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll b/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll
new file mode 100644
index 000000000000..b236edcf56c1
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2007-10-04-DomFrontier.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -licm -loop-unroll -disable-output
+
+@resonant = external global i32 ; <i32*> [#uses=2]
+
+define void @weightadj() {
+entry:
+ br label %bb
+
+bb: ; preds = %bb158, %entry
+ store i32 0, i32* @resonant, align 4
+ br i1 false, label %g.exit, label %bb158
+
+g.exit: ; preds = %bb68, %bb
+ br i1 false, label %bb68, label %cond_true
+
+cond_true: ; preds = %g.exit
+ store i32 1, i32* @resonant, align 4
+ br label %bb68
+
+bb68: ; preds = %cond_true, %g.exit
+ %tmp71 = icmp slt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp71, label %g.exit, label %bb158
+
+bb158: ; preds = %bb68, %bb
+ br i1 false, label %bb, label %return
+
+return: ; preds = %bb158
+ ret void
+}
diff --git a/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll b/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
new file mode 100644
index 000000000000..dcf41c34a486
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -instcombine -gvn -disable-output
+; PR2372
+target triple = "i386-pc-linux-gnu"
+
+define i32 @func_3(i16 signext %p_5, i16 signext %p_6) nounwind {
+entry:
+ %tmp3 = icmp eq i16 %p_5, 0 ; <i1> [#uses=1]
+ %tmp1314 = sext i16 %p_6 to i32 ; <i32> [#uses=1]
+ %tmp28 = icmp ugt i32 %tmp1314, 3 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp28, false ; <i1> [#uses=1]
+ br label %bb
+bb: ; preds = %bb54, %entry
+ br i1 %tmp3, label %bb54, label %bb5
+bb5: ; preds = %bb
+ br i1 %bothcond, label %bb54, label %bb31
+bb31: ; preds = %bb5
+ br label %bb54
+bb54: ; preds = %bb31, %bb5, %bb
+ br i1 false, label %bb64, label %bb
+bb64: ; preds = %bb54
+ %tmp6566 = sext i16 %p_6 to i32 ; <i32> [#uses=1]
+ %tmp68 = tail call i32 (...)* @func_18( i32 1, i32 %tmp6566, i32 1 ) nounwind ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @func_18(...)
diff --git a/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll b/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll
new file mode 100644
index 000000000000..713a0bddb135
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -licm -loop-unswitch -disable-output
+@g_56 = external global i16 ; <i16*> [#uses=2]
+
+define i32 @func_67(i32 %p_68, i8 signext %p_69, i8 signext %p_71) nounwind {
+entry:
+ br label %bb
+bb: ; preds = %bb44, %entry
+ br label %bb3
+bb3: ; preds = %bb36, %bb
+ %bothcond = or i1 false, false ; <i1> [#uses=1]
+ br i1 %bothcond, label %bb29, label %bb19
+bb19: ; preds = %bb3
+ br i1 false, label %bb36, label %bb29
+bb29: ; preds = %bb19, %bb3
+ ret i32 0
+bb36: ; preds = %bb19
+ store i16 0, i16* @g_56, align 2
+ br i1 false, label %bb44, label %bb3
+bb44: ; preds = %bb44, %bb36
+ %tmp46 = load i16* @g_56, align 2 ; <i16> [#uses=0]
+ br i1 false, label %bb, label %bb44
+}
diff --git a/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
new file mode 100644
index 000000000000..383aa5b671c7
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -stats -disable-output |& grep "1 loop-unswitch - Number of branches unswitched" | count 1
+; PR 3170
+define i32 @a(i32 %x, i32 %y) nounwind {
+entry:
+ %0 = icmp ult i32 0, %y ; <i1> [#uses=1]
+ br i1 %0, label %bb.nph, label %bb4
+
+bb.nph: ; preds = %entry
+ %1 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br label %bb
+
+bb: ; preds = %bb.nph, %bb3
+ %i.01 = phi i32 [ %3, %bb3 ], [ 0, %bb.nph ] ; <i32> [#uses=1]
+ br i1 %1, label %bb2, label %bb1
+
+bb1: ; preds = %bb
+ %2 = tail call i32 (...)* @b() nounwind ; <i32> [#uses=0]
+ br label %bb2
+
+bb2: ; preds = %bb, %bb1
+ %3 = add i32 %i.01, 1 ; <i32> [#uses=2]
+ br label %bb3
+
+bb3: ; preds = %bb2
+ %i.0 = phi i32 [ %3, %bb2 ] ; <i32> [#uses=1]
+ %4 = icmp ult i32 %i.0, %y ; <i1> [#uses=1]
+ br i1 %4, label %bb, label %bb3.bb4_crit_edge
+
+bb3.bb4_crit_edge: ; preds = %bb3
+ br label %bb4
+
+bb4: ; preds = %bb3.bb4_crit_edge, %entry
+ ret i32 0
+}
+
+declare i32 @b(...)
diff --git a/test/Transforms/LoopUnswitch/basictest.ll b/test/Transforms/LoopUnswitch/basictest.ll
new file mode 100644
index 000000000000..eeaf08d7e650
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/basictest.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -loop-unswitch -disable-output
+
+define i32 @test(i32* %A, i1 %C) {
+entry:
+ br label %no_exit
+no_exit: ; preds = %no_exit.backedge, %entry
+ %i.0.0 = phi i32 [ 0, %entry ], [ %i.0.0.be, %no_exit.backedge ] ; <i32> [#uses=3]
+ %gep.upgrd.1 = zext i32 %i.0.0 to i64 ; <i64> [#uses=1]
+ %tmp.7 = getelementptr i32* %A, i64 %gep.upgrd.1 ; <i32*> [#uses=4]
+ %tmp.13 = load i32* %tmp.7 ; <i32> [#uses=2]
+ %tmp.14 = add i32 %tmp.13, 1 ; <i32> [#uses=1]
+ store i32 %tmp.14, i32* %tmp.7
+ br i1 %C, label %then, label %endif
+then: ; preds = %no_exit
+ %tmp.29 = load i32* %tmp.7 ; <i32> [#uses=1]
+ %tmp.30 = add i32 %tmp.29, 2 ; <i32> [#uses=1]
+ store i32 %tmp.30, i32* %tmp.7
+ %inc9 = add i32 %i.0.0, 1 ; <i32> [#uses=2]
+ %tmp.112 = icmp ult i32 %inc9, 100000 ; <i1> [#uses=1]
+ br i1 %tmp.112, label %no_exit.backedge, label %return
+no_exit.backedge: ; preds = %endif, %then
+ %i.0.0.be = phi i32 [ %inc9, %then ], [ %inc, %endif ] ; <i32> [#uses=1]
+ br label %no_exit
+endif: ; preds = %no_exit
+ %inc = add i32 %i.0.0, 1 ; <i32> [#uses=2]
+ %tmp.1 = icmp ult i32 %inc, 100000 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %no_exit.backedge, label %return
+return: ; preds = %endif, %then
+ ret i32 %tmp.13
+}
+
diff --git a/test/Transforms/LoopUnswitch/dg.exp b/test/Transforms/LoopUnswitch/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LoopUnswitch/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LowerInvoke/2003-12-10-Crash.ll b/test/Transforms/LowerInvoke/2003-12-10-Crash.ll
new file mode 100644
index 000000000000..1e8b880485e4
--- /dev/null
+++ b/test/Transforms/LowerInvoke/2003-12-10-Crash.ll
@@ -0,0 +1,22 @@
+; This testcase was reduced from Shootout-C++/reversefile.cpp by bugpoint
+
+; RUN: llvm-as < %s | opt -lowerinvoke -disable-output
+
+declare void @baz()
+
+declare void @bar()
+
+define void @foo() {
+then:
+ invoke void @baz( )
+ to label %invoke_cont.0 unwind label %try_catch
+invoke_cont.0: ; preds = %then
+ invoke void @bar( )
+ to label %try_exit unwind label %try_catch
+try_catch: ; preds = %invoke_cont.0, %then
+ %__tmp.0 = phi i32* [ null, %invoke_cont.0 ], [ null, %then ] ; <i32*> [#uses=0]
+ ret void
+try_exit: ; preds = %invoke_cont.0
+ ret void
+}
+
diff --git a/test/Transforms/LowerInvoke/2004-02-29-PHICrash.ll b/test/Transforms/LowerInvoke/2004-02-29-PHICrash.ll
new file mode 100644
index 000000000000..07770136964e
--- /dev/null
+++ b/test/Transforms/LowerInvoke/2004-02-29-PHICrash.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -lowerinvoke -enable-correct-eh-support -disable-output
+
+define void @_ZNKSt11__use_cacheISt16__numpunct_cacheIcEEclERKSt6locale() {
+entry:
+ br i1 false, label %then, label %UnifiedReturnBlock
+then: ; preds = %entry
+ invoke void @_Znwj( )
+ to label %UnifiedReturnBlock unwind label %UnifiedReturnBlock
+UnifiedReturnBlock: ; preds = %then, %then, %entry
+ %UnifiedRetVal = phi i32* [ null, %entry ], [ null, %then ], [ null, %then ] ; <i32*> [#uses=0]
+ ret void
+}
+
+declare void @_Znwj()
+
diff --git a/test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll b/test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll
new file mode 100644
index 000000000000..10c878537289
--- /dev/null
+++ b/test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -lowerinvoke -enable-correct-eh-support -disable-output
+
+declare void @ll_listnext__listiterPtr()
+
+define void @WorkTask.fn() {
+block0:
+ invoke void @ll_listnext__listiterPtr( )
+ to label %block9 unwind label %block8_exception_handling
+block8_exception_handling: ; preds = %block0
+ ret void
+block9: ; preds = %block0
+ %w_2690 = phi { i32, i32 }* [ null, %block0 ] ; <{ i32, i32 }*> [#uses=1]
+ %tmp.129 = getelementptr { i32, i32 }* %w_2690, i32 0, i32 1 ; <i32*> [#uses=1]
+ %v2769 = load i32* %tmp.129 ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll b/test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll
new file mode 100644
index 000000000000..0a8ccbe3e61e
--- /dev/null
+++ b/test/Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -lowerinvoke -enable-correct-eh-support -disable-output
+
+declare fastcc i32 @ll_listnext__listiterPtr()
+
+define fastcc i32 @WorkTask.fn() {
+block0:
+ %v2679 = invoke fastcc i32 @ll_listnext__listiterPtr( )
+ to label %block9 unwind label %block8_exception_handling ; <i32> [#uses=1]
+block8_exception_handling: ; preds = %block0
+ ret i32 0
+block9: ; preds = %block0
+ %i_2689 = phi i32 [ %v2679, %block0 ] ; <i32> [#uses=1]
+ ret i32 %i_2689
+}
+
diff --git a/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll b/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll
new file mode 100644
index 000000000000..fa8253986533
--- /dev/null
+++ b/test/Transforms/LowerInvoke/2008-02-14-CritEdgePhiCrash.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -lowerinvoke -enable-correct-eh-support -disable-output
+; PR2029
+define i32 @main(i32 %argc, i8** %argv) {
+bb470:
+ invoke i32 @main(i32 0, i8** null) to label %invcont474 unwind label
+%lpad902
+
+invcont474: ; preds = %bb470
+ ret i32 0
+
+lpad902: ; preds = %bb470
+ %tmp471.lcssa = phi i8* [ null, %bb470 ] ; <i8*>
+ ret i32 0
+}
diff --git a/test/Transforms/LowerInvoke/basictest.ll b/test/Transforms/LowerInvoke/basictest.ll
new file mode 100644
index 000000000000..a9c19f2790d5
--- /dev/null
+++ b/test/Transforms/LowerInvoke/basictest.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -lowerinvoke -disable-output -enable-correct-eh-support
+
+
+define i32 @foo() {
+ invoke i32 @foo( )
+ to label %Ok unwind label %Crap ; <i32>:1 [#uses=0]
+Ok: ; preds = %0
+ invoke i32 @foo( )
+ to label %Ok2 unwind label %Crap ; <i32>:2 [#uses=0]
+Ok2: ; preds = %Ok
+ ret i32 2
+Crap: ; preds = %Ok, %0
+ ret i32 1
+}
+
+define i32 @bar(i32 %blah) {
+ br label %doit
+doit: ; preds = %0
+ ;; Value live across an unwind edge.
+ %B2 = add i32 %blah, 1 ; <i32> [#uses=1]
+ invoke i32 @foo( )
+ to label %Ok unwind label %Crap ; <i32>:1 [#uses=0]
+Ok: ; preds = %doit
+ invoke i32 @foo( )
+ to label %Ok2 unwind label %Crap ; <i32>:2 [#uses=0]
+Ok2: ; preds = %Ok
+ ret i32 2
+Crap: ; preds = %Ok, %doit
+ ret i32 %B2
+}
diff --git a/test/Transforms/LowerInvoke/dg.exp b/test/Transforms/LowerInvoke/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LowerInvoke/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LowerSetJmp/2003-11-05-DominanceProperties.ll b/test/Transforms/LowerSetJmp/2003-11-05-DominanceProperties.ll
new file mode 100644
index 000000000000..3be2163aa469
--- /dev/null
+++ b/test/Transforms/LowerSetJmp/2003-11-05-DominanceProperties.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -lowersetjmp -disable-output
+
+ %struct.jmpenv = type { i32, i8 }
+
+declare void @Perl_sv_setpv()
+
+declare i32 @llvm.setjmp(i32*)
+
+define void @perl_call_sv() {
+ call void @Perl_sv_setpv( )
+ %tmp.335 = getelementptr %struct.jmpenv* null, i64 0, i32 0 ; <i32*> [#uses=1]
+ %tmp.336 = call i32 @llvm.setjmp( i32* null ) ; <i32> [#uses=1]
+ store i32 %tmp.336, i32* %tmp.335
+ ret void
+}
+
diff --git a/test/Transforms/LowerSetJmp/dg.exp b/test/Transforms/LowerSetJmp/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LowerSetJmp/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LowerSetJmp/simpletest.ll b/test/Transforms/LowerSetJmp/simpletest.ll
new file mode 100644
index 000000000000..9ff5f29c238e
--- /dev/null
+++ b/test/Transforms/LowerSetJmp/simpletest.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -lowersetjmp | llvm-dis | grep invoke
+
+ %JmpBuf = type i32
+@.str_1 = internal constant [13 x i8] c"returned %d\0A\00" ; <[13 x i8]*> [#uses=1]
+
+declare void @llvm.longjmp(i32*, i32)
+
+declare i32 @llvm.setjmp(i32*)
+
+declare void @foo()
+
+define i32 @simpletest() {
+ %B = alloca i32 ; <i32*> [#uses=2]
+ %Val = call i32 @llvm.setjmp( i32* %B ) ; <i32> [#uses=2]
+ %V = icmp ne i32 %Val, 0 ; <i1> [#uses=1]
+ br i1 %V, label %LongJumped, label %Normal
+Normal: ; preds = %0
+ call void @foo( )
+ call void @llvm.longjmp( i32* %B, i32 42 )
+ ret i32 0
+LongJumped: ; preds = %0
+ ret i32 %Val
+}
+
+declare i32 @printf(i8*, ...)
+
+define i32 @main() {
+ %V = call i32 @simpletest( ) ; <i32> [#uses=1]
+ call i32 (i8*, ...)* @printf( i8* getelementptr ([13 x i8]* @.str_1, i64 0, i64 0), i32 %V ) ; <i32>:1 [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/LowerSwitch/2003-05-01-PHIProblem.ll b/test/Transforms/LowerSwitch/2003-05-01-PHIProblem.ll
new file mode 100644
index 000000000000..cb5f090864b7
--- /dev/null
+++ b/test/Transforms/LowerSwitch/2003-05-01-PHIProblem.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -lowerswitch
+
+define void @child(i32 %ct.1) {
+entry:
+ switch i32 0, label %return [
+ i32 3, label %UnifiedExitNode
+ i32 0, label %return
+ ]
+return: ; preds = %entry, %entry
+ %result.0 = phi i32* [ null, %entry ], [ null, %entry ] ; <i32*> [#uses=0]
+ br label %UnifiedExitNode
+UnifiedExitNode: ; preds = %return, %entry
+ ret void
+}
+
diff --git a/test/Transforms/LowerSwitch/2003-08-23-EmptySwitch.ll b/test/Transforms/LowerSwitch/2003-08-23-EmptySwitch.ll
new file mode 100644
index 000000000000..71e5a4bcc4d7
--- /dev/null
+++ b/test/Transforms/LowerSwitch/2003-08-23-EmptySwitch.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -lowerswitch
+
+define void @test() {
+ switch i32 0, label %Next [
+ ]
+Next: ; preds = %0
+ ret void
+}
+
diff --git a/test/Transforms/LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll b/test/Transforms/LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll
new file mode 100644
index 000000000000..2fc1c9801914
--- /dev/null
+++ b/test/Transforms/LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -lowerswitch -disable-output
+
+define void @solve() {
+entry:
+ %targetBlock = call i16 @solve_code( ) ; <i16> [#uses=1]
+ br label %codeReplTail
+then.1: ; preds = %codeReplTail
+ ret void
+loopexit.0: ; preds = %codeReplTail
+ ret void
+codeReplTail: ; preds = %codeReplTail, %entry
+ switch i16 %targetBlock, label %codeReplTail [
+ i16 0, label %loopexit.0
+ i16 1, label %then.1
+ ]
+}
+
+declare i16 @solve_code()
+
diff --git a/test/Transforms/LowerSwitch/dg.exp b/test/Transforms/LowerSwitch/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/LowerSwitch/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LowerSwitch/feature.ll b/test/Transforms/LowerSwitch/feature.ll
new file mode 100644
index 000000000000..7523ad235b6d
--- /dev/null
+++ b/test/Transforms/LowerSwitch/feature.ll
@@ -0,0 +1,51 @@
+; RUN: llvm-as %s -o - | opt -lowerswitch | llvm-dis > %t
+; RUN: grep slt %t | count 10
+; RUN: grep ule %t | count 3
+; RUN: grep eq %t | count 9
+
+define i32 @main(i32 %tmp158) {
+entry:
+ switch i32 %tmp158, label %bb336 [
+ i32 -2, label %bb338
+ i32 -3, label %bb338
+ i32 -4, label %bb338
+ i32 -5, label %bb338
+ i32 -6, label %bb338
+ i32 0, label %bb338
+ i32 1, label %bb338
+ i32 2, label %bb338
+ i32 3, label %bb338
+ i32 4, label %bb338
+ i32 5, label %bb338
+ i32 6, label %bb338
+ i32 7, label %bb
+ i32 8, label %bb338
+ i32 9, label %bb322
+ i32 10, label %bb324
+ i32 11, label %bb326
+ i32 12, label %bb328
+ i32 13, label %bb330
+ i32 14, label %bb332
+ i32 15, label %bb334
+ ]
+bb:
+ ret i32 2
+bb322:
+ ret i32 3
+bb324:
+ ret i32 4
+bb326:
+ ret i32 5
+bb328:
+ ret i32 6
+bb330:
+ ret i32 7
+bb332:
+ ret i32 8
+bb334:
+ ret i32 9
+bb336:
+ ret i32 10
+bb338:
+ ret i32 11
+}
diff --git a/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll b/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll
new file mode 100644
index 000000000000..b0d2c7913363
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll
@@ -0,0 +1,11 @@
+; Uninitialized values are not handled correctly.
+;
+; RUN: llvm-as < %s | opt -mem2reg -disable-output
+;
+
+define i32 @test() {
+ ; To be promoted
+ %X = alloca i32 ; <i32*> [#uses=1]
+ %Y = load i32* %X ; <i32> [#uses=1]
+ ret i32 %Y
+}
diff --git a/test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll b/test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
new file mode 100644
index 000000000000..c649d6a5f443
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
@@ -0,0 +1,12 @@
+; This input caused the mem2reg pass to die because it was trying to promote
+; the %r alloca, even though it is invalid to do so in this case!
+;
+; RUN: llvm-as < %s | opt -mem2reg
+
+define void @test() {
+ %r = alloca i32 ; <i32*> [#uses=2]
+ store i32 4, i32* %r
+ store i32* %r, i32** null
+ ret void
+}
+
diff --git a/test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll b/test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll
new file mode 100644
index 000000000000..0dd27614104d
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2003-04-10-DFNotFound.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -mem2reg
+
+define void @_Z3barv() {
+ %result = alloca i32 ; <i32*> [#uses=1]
+ ret void
+ ; No predecessors!
+ store i32 0, i32* %result
+ ret void
+}
+
diff --git a/test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll b/test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll
new file mode 100644
index 000000000000..78bfcb4197b2
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2003-04-18-DeadBlockProblem.ll
@@ -0,0 +1,16 @@
+; This testcases makes sure that mem2reg can handle unreachable blocks.
+; RUN: llvm-as < %s | opt -mem2reg
+
+define i32 @test() {
+ %X = alloca i32 ; <i32*> [#uses=2]
+ store i32 6, i32* %X
+ br label %Loop
+Loop: ; preds = %EndOfLoop, %0
+ store i32 5, i32* %X
+ br label %EndOfLoop
+Unreachable: ; No predecessors!
+ br label %EndOfLoop
+EndOfLoop: ; preds = %Unreachable, %Loop
+ br label %Loop
+}
+
diff --git a/test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll b/test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll
new file mode 100644
index 000000000000..04e8db3c8de5
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2003-04-24-MultipleIdenticalSuccessors.ll
@@ -0,0 +1,16 @@
+; Mem2reg used to only add one incoming value to a PHI node, even if it had
+; multiple incoming edges from a block.
+;
+; RUN: llvm-as < %s | opt -mem2reg -disable-output
+
+define i32 @test(i1 %c1, i1 %c2) {
+ %X = alloca i32 ; <i32*> [#uses=2]
+ br i1 %c1, label %Exit, label %B2
+B2: ; preds = %0
+ store i32 2, i32* %X
+ br i1 %c2, label %Exit, label %Exit
+Exit: ; preds = %B2, %B2, %0
+ %Y = load i32* %X ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll b/test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll
new file mode 100644
index 000000000000..27d00150d685
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2003-06-26-IterativePromote.ll
@@ -0,0 +1,16 @@
+; Promoting some values allows promotion of other values.
+; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | not grep alloca
+
+define i32 @test2() {
+ %result = alloca i32 ; <i32*> [#uses=2]
+ %a = alloca i32 ; <i32*> [#uses=2]
+ %p = alloca i32* ; <i32**> [#uses=2]
+ store i32 0, i32* %a
+ store i32* %a, i32** %p
+ %tmp.0 = load i32** %p ; <i32*> [#uses=1]
+ %tmp.1 = load i32* %tmp.0 ; <i32> [#uses=1]
+ store i32 %tmp.1, i32* %result
+ %tmp.2 = load i32* %result ; <i32> [#uses=1]
+ ret i32 %tmp.2
+}
+
diff --git a/test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll b/test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll
new file mode 100644
index 000000000000..5a27b20ca509
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2003-10-05-DeadPHIInsertion.ll
@@ -0,0 +1,22 @@
+; Mem2reg should not insert dead PHI nodes! The naive algorithm inserts a PHI
+; node in L3, even though there is no load of %A in anything dominated by L3.
+
+; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | not grep phi
+
+define void @test(i32 %B, i1 %C) {
+ %A = alloca i32 ; <i32*> [#uses=4]
+ store i32 %B, i32* %A
+ br i1 %C, label %L1, label %L2
+L1: ; preds = %0
+ store i32 %B, i32* %A
+ %D = load i32* %A ; <i32> [#uses=1]
+ call void @test( i32 %D, i1 false )
+ br label %L3
+L2: ; preds = %0
+ %E = load i32* %A ; <i32> [#uses=1]
+ call void @test( i32 %E, i1 true )
+ br label %L3
+L3: ; preds = %L2, %L1
+ ret void
+}
+
diff --git a/test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll b/test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll
new file mode 100644
index 000000000000..b053aa162f5b
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -mem2reg -instcombine | llvm-dis | grep store
+; PR590
+
+
+define void @zero(i8* %p, i32 %n) {
+entry:
+ %p_addr = alloca i8* ; <i8**> [#uses=2]
+ %n_addr = alloca i32 ; <i32*> [#uses=2]
+ %i = alloca i32 ; <i32*> [#uses=6]
+ %out = alloca i32 ; <i32*> [#uses=2]
+ %undef = alloca i32 ; <i32*> [#uses=2]
+ store i8* %p, i8** %p_addr
+ store i32 %n, i32* %n_addr
+ store i32 0, i32* %i
+ br label %loopentry
+loopentry: ; preds = %endif, %entry
+ %tmp.0 = load i32* %n_addr ; <i32> [#uses=1]
+ %tmp.1 = add i32 %tmp.0, 1 ; <i32> [#uses=1]
+ %tmp.2 = load i32* %i ; <i32> [#uses=1]
+ %tmp.3 = icmp sgt i32 %tmp.1, %tmp.2 ; <i1> [#uses=2]
+ %tmp.4 = zext i1 %tmp.3 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.3, label %no_exit, label %return
+no_exit: ; preds = %loopentry
+ %tmp.5 = load i32* %undef ; <i32> [#uses=1]
+ store i32 %tmp.5, i32* %out
+ store i32 0, i32* %undef
+ %tmp.6 = load i32* %i ; <i32> [#uses=1]
+ %tmp.7 = icmp sgt i32 %tmp.6, 0 ; <i1> [#uses=2]
+ %tmp.8 = zext i1 %tmp.7 to i32 ; <i32> [#uses=0]
+ br i1 %tmp.7, label %then, label %endif
+then: ; preds = %no_exit
+ %tmp.9 = load i8** %p_addr ; <i8*> [#uses=1]
+ %tmp.10 = load i32* %i ; <i32> [#uses=1]
+ %tmp.11 = sub i32 %tmp.10, 1 ; <i32> [#uses=1]
+ %tmp.12 = getelementptr i8* %tmp.9, i32 %tmp.11 ; <i8*> [#uses=1]
+ %tmp.13 = load i32* %out ; <i32> [#uses=1]
+ %tmp.14 = trunc i32 %tmp.13 to i8 ; <i8> [#uses=1]
+ store i8 %tmp.14, i8* %tmp.12
+ br label %endif
+endif: ; preds = %then, %no_exit
+ %tmp.15 = load i32* %i ; <i32> [#uses=1]
+ %inc = add i32 %tmp.15, 1 ; <i32> [#uses=1]
+ store i32 %inc, i32* %i
+ br label %loopentry
+return: ; preds = %loopentry
+ ret void
+}
diff --git a/test/Transforms/Mem2Reg/2005-11-28-Crash.ll b/test/Transforms/Mem2Reg/2005-11-28-Crash.ll
new file mode 100644
index 000000000000..a985db3eb8c7
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2005-11-28-Crash.ll
@@ -0,0 +1,62 @@
+; RUN: llvm-as < %s | opt -mem2reg -disable-output
+; PR670
+
+define void @printk(i32, ...) {
+entry:
+ %flags = alloca i32 ; <i32*> [#uses=2]
+ br i1 false, label %then.0, label %endif.0
+then.0: ; preds = %entry
+ br label %endif.0
+endif.0: ; preds = %then.0, %entry
+ store i32 0, i32* %flags
+ br label %loopentry
+loopentry: ; preds = %endif.3, %endif.0
+ br i1 false, label %no_exit, label %loopexit
+no_exit: ; preds = %loopentry
+ br i1 false, label %then.1, label %endif.1
+then.1: ; preds = %no_exit
+ br i1 false, label %shortcirc_done.0, label %shortcirc_next.0
+shortcirc_next.0: ; preds = %then.1
+ br label %shortcirc_done.0
+shortcirc_done.0: ; preds = %shortcirc_next.0, %then.1
+ br i1 false, label %shortcirc_done.1, label %shortcirc_next.1
+shortcirc_next.1: ; preds = %shortcirc_done.0
+ br label %shortcirc_done.1
+shortcirc_done.1: ; preds = %shortcirc_next.1, %shortcirc_done.0
+ br i1 false, label %shortcirc_done.2, label %shortcirc_next.2
+shortcirc_next.2: ; preds = %shortcirc_done.1
+ br label %shortcirc_done.2
+shortcirc_done.2: ; preds = %shortcirc_next.2, %shortcirc_done.1
+ br i1 false, label %then.2, label %endif.2
+then.2: ; preds = %shortcirc_done.2
+ br label %endif.2
+endif.2: ; preds = %then.2, %shortcirc_done.2
+ br label %endif.1
+endif.1: ; preds = %endif.2, %no_exit
+ br i1 false, label %then.3, label %endif.3
+then.3: ; preds = %endif.1
+ br label %endif.3
+endif.3: ; preds = %then.3, %endif.1
+ br label %loopentry
+loopexit: ; preds = %loopentry
+ br label %endif.4
+then.4: ; No predecessors!
+ %tmp.61 = load i32* %flags ; <i32> [#uses=0]
+ br label %out
+dead_block_after_goto: ; No predecessors!
+ br label %endif.4
+endif.4: ; preds = %dead_block_after_goto, %loopexit
+ br i1 false, label %then.5, label %else
+then.5: ; preds = %endif.4
+ br label %endif.5
+else: ; preds = %endif.4
+ br label %endif.5
+endif.5: ; preds = %else, %then.5
+ br label %out
+out: ; preds = %endif.5, %then.4
+ br label %return
+after_ret: ; No predecessors!
+ br label %return
+return: ; preds = %after_ret, %out
+ ret void
+}
diff --git a/test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll b/test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll
new file mode 100644
index 000000000000..579ed41c94c1
--- /dev/null
+++ b/test/Transforms/Mem2Reg/2007-08-27-VolatileLoadsStores.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | grep volatile | count 3
+; PR1520
+; Don't promote volatile loads/stores. This is really needed to handle setjmp/lonjmp properly.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.__jmp_buf_tag = type { [6 x i32], i32, %struct.__sigset_t }
+ %struct.__sigset_t = type { [32 x i32] }
+@j = external global [1 x %struct.__jmp_buf_tag] ; <[1 x %struct.__jmp_buf_tag]*> [#uses=1]
+
+define i32 @f() {
+entry:
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %v = alloca i32, align 4 ; <i32*> [#uses=3]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ volatile store i32 0, i32* %v, align 4
+ %tmp1 = call i32 @_setjmp( %struct.__jmp_buf_tag* getelementptr ([1 x %struct.__jmp_buf_tag]* @j, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %tmp2 = icmp ne i32 %tmp1, 0 ; <i1> [#uses=1]
+ %tmp23 = zext i1 %tmp2 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp23, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb, label %bb5
+
+bb: ; preds = %entry
+ %tmp4 = volatile load i32* %v, align 4 ; <i32> [#uses=1]
+ store i32 %tmp4, i32* %tmp, align 4
+ br label %bb6
+
+bb5: ; preds = %entry
+ volatile store i32 1, i32* %v, align 4
+ call void @g( )
+ store i32 0, i32* %tmp, align 4
+ br label %bb6
+
+bb6: ; preds = %bb5, %bb
+ %tmp7 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ store i32 %tmp7, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %bb6
+ %retval8 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval8
+}
+
+declare i32 @_setjmp(%struct.__jmp_buf_tag*)
+
+declare void @g()
diff --git a/test/Transforms/Mem2Reg/PromoteMemToRegister.ll b/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
new file mode 100644
index 000000000000..fdc33fb26897
--- /dev/null
+++ b/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
@@ -0,0 +1,18 @@
+; Simple sanity check testcase. Both alloca's should be eliminated.
+; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | not grep alloca
+
+define double @testfunc(i32 %i, double %j) {
+ %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* %I ; <i32> [#uses=1]
+ %t2 = add i32 %t1, 1 ; <i32> [#uses=1]
+ store i32 %t2, i32* %I
+ %t3 = load i32* %I ; <i32> [#uses=1]
+ %t4 = sitofp i32 %t3 to double ; <double> [#uses=1]
+ %t5 = load double* %J ; <double> [#uses=1]
+ %t6 = mul double %t4, %t5 ; <double> [#uses=1]
+ ret double %t6
+}
+
diff --git a/test/Transforms/Mem2Reg/UndefValuesMerge.ll b/test/Transforms/Mem2Reg/UndefValuesMerge.ll
new file mode 100644
index 000000000000..0d20d7df3458
--- /dev/null
+++ b/test/Transforms/Mem2Reg/UndefValuesMerge.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | not grep phi
+
+define i32 @testfunc(i1 %C, i32 %i, i8 %j) {
+ %I = alloca i32 ; <i32*> [#uses=2]
+ br i1 %C, label %T, label %Cont
+T: ; preds = %0
+ store i32 %i, i32* %I
+ br label %Cont
+Cont: ; preds = %T, %0
+ %Y = load i32* %I ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/Mem2Reg/dg.exp b/test/Transforms/Mem2Reg/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/Mem2Reg/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll b/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
new file mode 100644
index 000000000000..30d0a6dbebb5
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -memcpyopt -dse | llvm-dis | grep {call.*initialize} | not grep memtmp
+; PR2077
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define internal fastcc void @initialize({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind {
+entry:
+ %agg.result.03 = getelementptr { x86_fp80, x86_fp80 }* %agg.result, i32 0, i32 0 ; <x86_fp80*> [#uses=1]
+ store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.03
+ %agg.result.15 = getelementptr { x86_fp80, x86_fp80 }* %agg.result, i32 0, i32 1 ; <x86_fp80*> [#uses=1]
+ store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.15
+ ret void
+}
+
+declare fastcc x86_fp80 @passed_uninitialized({ x86_fp80, x86_fp80 }* %x) nounwind
+
+define fastcc void @badly_optimized() nounwind {
+entry:
+ %z = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=2]
+ %tmp = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=2]
+ %memtmp = alloca { x86_fp80, x86_fp80 }, align 8 ; <{ x86_fp80, x86_fp80 }*> [#uses=2]
+ call fastcc void @initialize( { x86_fp80, x86_fp80 }* noalias sret %memtmp )
+ %tmp1 = bitcast { x86_fp80, x86_fp80 }* %tmp to i8* ; <i8*> [#uses=1]
+ %memtmp2 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp1, i8* %memtmp2, i32 24, i32 8 )
+ %z3 = bitcast { x86_fp80, x86_fp80 }* %z to i8* ; <i8*> [#uses=1]
+ %tmp4 = bitcast { x86_fp80, x86_fp80 }* %tmp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %z3, i8* %tmp4, i32 24, i32 8 )
+ %tmp5 = call fastcc x86_fp80 @passed_uninitialized( { x86_fp80, x86_fp80 }* %z ) ; <x86_fp80> [#uses=0]
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll b/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
new file mode 100644
index 000000000000..12c9a9d23e53
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep {call.*memcpy.}
+ %a = type { i32 }
+ %b = type { float }
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
+declare void @g(%a*)
+
+define float @f() {
+entry:
+ %a_var = alloca %a
+ %b_var = alloca %b
+ call void @g(%a *%a_var)
+ %a_i8 = bitcast %a* %a_var to i8*
+ %b_i8 = bitcast %b* %b_var to i8*
+ call void @llvm.memcpy.i32(i8* %b_i8, i8* %a_i8, i32 4, i32 4)
+ %tmp1 = getelementptr %b* %b_var, i32 0, i32 0
+ %tmp2 = load float* %tmp1
+ ret float %tmp2
+}
diff --git a/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll b/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll
new file mode 100644
index 000000000000..1d9a35d63f28
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memcpy.*agg.result}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+@x = external global { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+
+define void @foo({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind {
+entry:
+ %x.0 = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+ %x.01 = bitcast { x86_fp80, x86_fp80 }* %x.0 to i8* ; <i8*> [#uses=2]
+ call void @llvm.memcpy.i32( i8* %x.01, i8* bitcast ({ x86_fp80, x86_fp80 }* @x to i8*), i32 32, i32 16 )
+ %agg.result2 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %agg.result2, i8* %x.01, i32 32, i32 16 )
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll b/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll
new file mode 100644
index 000000000000..16d2df4bacb2
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll
@@ -0,0 +1,107 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memmove.*arg1.*}
+; PR2401
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.Info = type <{ i32, i32, i8*, i8*, i8*, [32 x i8*], i32, [32 x i32], i32, i32, i32, [32 x i32] }>
+ %struct.S98 = type <{ [31 x double] }>
+ %struct._IO_FILE = type <{ i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }>
+ %struct._IO_marker = type <{ %struct._IO_marker*, %struct._IO_FILE*, i32 }>
+ %struct.anon = type <{ }>
+ %union.anon = type { }
+@info = common global %struct.Info zeroinitializer, align 4 ; <%struct.Info*> [#uses=13]
+@fails = common global i32 0, align 4 ; <i32*> [#uses=37]
+@s98 = common global %struct.S98 zeroinitializer, align 4 ; <%struct.S98*> [#uses=2]
+@a98 = common global [5 x %struct.S98] zeroinitializer, align 4 ; <[5 x %struct.S98]*> [#uses=5]
+@stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1]
+
+declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind
+
+define void @test98() nounwind {
+entry:
+ %arg = alloca %struct.S98, align 8 ; <%struct.S98*> [#uses=2]
+ %tmp13 = alloca %struct.S98 ; <%struct.S98*> [#uses=2]
+ %tmp14 = alloca %struct.S98 ; <%struct.S98*> [#uses=2]
+ %tmp15 = alloca %struct.S98 ; <%struct.S98*> [#uses=2]
+ %tmp17 = alloca %struct.S98 ; <%struct.S98*> [#uses=2]
+ %tmp21 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ %tmp23 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ %tmp25 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ %tmp27 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ %tmp29 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ %tmp31 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ %tmp33 = alloca %struct.S98 ; <%struct.S98*> [#uses=0]
+ call void @llvm.memset.i32( i8* bitcast (%struct.S98* @s98 to i8*), i8 0, i32 248, i32 4 )
+ call void @llvm.memset.i32( i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8 0, i32 1240, i32 4 )
+ call void @llvm.memset.i32( i8* bitcast (%struct.Info* @info to i8*), i8 0, i32 420, i32 4 )
+ store i8* bitcast (%struct.S98* @s98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 2)
+ store i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 3)
+ store i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 4)
+ store i32 248, i32* getelementptr (%struct.Info* @info, i32 0, i32 6)
+ store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 8)
+ store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 9)
+ store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 10)
+ %tmp = load i32* getelementptr (%struct.Info* @info, i32 0, i32 8) ; <i32> [#uses=1]
+ %sub = add i32 %tmp, -1 ; <i32> [#uses=1]
+ %and = and i32 %sub, ptrtoint (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i32) ; <i32> [#uses=1]
+ %tobool = icmp eq i32 %and, 0 ; <i1> [#uses=1]
+ br i1 %tobool, label %ifend, label %ifthen
+
+ifthen: ; preds = %entry
+ %tmp3 = load i32* @fails ; <i32> [#uses=1]
+ %inc = add i32 %tmp3, 1 ; <i32> [#uses=1]
+ store i32 %inc, i32* @fails
+ br label %ifend
+
+ifend: ; preds = %ifthen, %entry
+ store i8* bitcast (double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 5, i32 0)
+ store i32 8, i32* getelementptr (%struct.Info* @info, i32 0, i32 7, i32 0)
+ store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 11, i32 0)
+ store double 0xC1075E4620000000, double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18)
+ store double 0x410CD219E0000000, double* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2, i32 0, i32 18)
+ store i32 1, i32* getelementptr (%struct.Info* @info, i32 0, i32 0)
+ store i32 0, i32* getelementptr (%struct.Info* @info, i32 0, i32 1)
+ %tmp16 = bitcast %struct.S98* %tmp15 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memmove.i32( i8* %tmp16, i8* bitcast (%struct.S98* @s98 to i8*), i32 248, i32 4 )
+ %tmp18 = bitcast %struct.S98* %tmp17 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memmove.i32( i8* %tmp18, i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2) to i8*), i32 248, i32 4 )
+ call void @check98( %struct.S98* sret %tmp14, %struct.S98* byval %tmp15, %struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 1), %struct.S98* byval %tmp17 )
+ %tmp19 = bitcast %struct.S98* %tmp13 to i8* ; <i8*> [#uses=1]
+ %tmp20 = bitcast %struct.S98* %tmp14 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memmove.i32( i8* %tmp19, i8* %tmp20, i32 248, i32 8 )
+ %tmp1 = bitcast %struct.S98* %arg to i8* ; <i8*> [#uses=1]
+ %tmp2 = bitcast %struct.S98* %tmp13 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i64( i8* %tmp1, i8* %tmp2, i64 248, i32 8 )
+ %arrayidx.i = getelementptr %struct.S98* %arg, i32 0, i32 0, i32 18 ; <double*> [#uses=1]
+ %tmp1.i = load double* %arrayidx.i, align 8 ; <double> [#uses=1]
+ %tmp2.i = load double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) ; <double> [#uses=1]
+ %cmp.i = fcmp une double %tmp1.i, %tmp2.i ; <i1> [#uses=1]
+ br i1 %cmp.i, label %ifthen.i, label %checkx98.exit
+
+ifthen.i: ; preds = %ifend
+ %tmp3.i = load i32* @fails ; <i32> [#uses=1]
+ %inc.i = add i32 %tmp3.i, 1 ; <i32> [#uses=1]
+ store i32 %inc.i, i32* @fails
+ br label %checkx98.exit
+
+checkx98.exit: ; preds = %ifthen.i, %ifend
+ ret void
+}
+
+declare void @check98(%struct.S98* sret %agg.result, %struct.S98* byval %arg0, %struct.S98* %arg1, %struct.S98* byval %arg2) nounwind
+
+declare void @llvm.va_start(i8*) nounwind
+
+declare void @llvm.va_end(i8*) nounwind
+
+declare i32 @main() noreturn
+
+declare i32 @fflush(%struct._IO_FILE*)
+
+declare void @abort() noreturn nounwind
+
+declare void @exit(i32) noreturn nounwind
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind
+
+declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind
diff --git a/test/Transforms/MemCpyOpt/dg.exp b/test/Transforms/MemCpyOpt/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/MemCpyOpt/form-memset.ll b/test/Transforms/MemCpyOpt/form-memset.ll
new file mode 100644
index 000000000000..ffacb8565c21
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/form-memset.ll
@@ -0,0 +1,55 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep store
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*llvm.memset}
+
+; All the stores in this example should be merged into a single memset.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+
+define void @foo(i8 signext %c) nounwind {
+entry:
+ %x = alloca [19 x i8] ; <[19 x i8]*> [#uses=20]
+ %tmp = getelementptr [19 x i8]* %x, i32 0, i32 0 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp, align 1
+ %tmp5 = getelementptr [19 x i8]* %x, i32 0, i32 1 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp5, align 1
+ %tmp9 = getelementptr [19 x i8]* %x, i32 0, i32 2 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp9, align 1
+ %tmp13 = getelementptr [19 x i8]* %x, i32 0, i32 3 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp13, align 1
+ %tmp17 = getelementptr [19 x i8]* %x, i32 0, i32 4 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp17, align 1
+ %tmp21 = getelementptr [19 x i8]* %x, i32 0, i32 5 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp21, align 1
+ %tmp25 = getelementptr [19 x i8]* %x, i32 0, i32 6 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp25, align 1
+ %tmp29 = getelementptr [19 x i8]* %x, i32 0, i32 7 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp29, align 1
+ %tmp33 = getelementptr [19 x i8]* %x, i32 0, i32 8 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp33, align 1
+ %tmp37 = getelementptr [19 x i8]* %x, i32 0, i32 9 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp37, align 1
+ %tmp41 = getelementptr [19 x i8]* %x, i32 0, i32 10 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp41, align 1
+ %tmp45 = getelementptr [19 x i8]* %x, i32 0, i32 11 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp45, align 1
+ %tmp49 = getelementptr [19 x i8]* %x, i32 0, i32 12 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp49, align 1
+ %tmp53 = getelementptr [19 x i8]* %x, i32 0, i32 13 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp53, align 1
+ %tmp57 = getelementptr [19 x i8]* %x, i32 0, i32 14 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp57, align 1
+ %tmp61 = getelementptr [19 x i8]* %x, i32 0, i32 15 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp61, align 1
+ %tmp65 = getelementptr [19 x i8]* %x, i32 0, i32 16 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp65, align 1
+ %tmp69 = getelementptr [19 x i8]* %x, i32 0, i32 17 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp69, align 1
+ %tmp73 = getelementptr [19 x i8]* %x, i32 0, i32 18 ; <i8*> [#uses=1]
+ store i8 %c, i8* %tmp73, align 1
+ %tmp76 = call i32 (...)* @bar( [19 x i8]* %x ) nounwind ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @bar(...)
+
diff --git a/test/Transforms/MemCpyOpt/form-memset2.ll b/test/Transforms/MemCpyOpt/form-memset2.ll
new file mode 100644
index 000000000000..719cd47b0b7b
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/form-memset2.ll
@@ -0,0 +1,99 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep store
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*llvm.memset} | count 3
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+ %struct.MV = type { i16, i16 }
+
+define i32 @t() nounwind {
+entry:
+ %ref_idx = alloca [8 x i8] ; <[8 x i8]*> [#uses=8]
+ %left_mvd = alloca [8 x %struct.MV] ; <[8 x %struct.MV]*> [#uses=17]
+ %up_mvd = alloca [8 x %struct.MV] ; <[8 x %struct.MV]*> [#uses=17]
+ %tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp20, align 1
+ %tmp23 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 6 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp23, align 1
+ %tmp26 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 5 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp26, align 1
+ %tmp29 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 4 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp29, align 1
+ %tmp32 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 3 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp32, align 1
+ %tmp35 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 2 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp35, align 1
+ %tmp38 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 1 ; <i8*> [#uses=1]
+ store i8 -1, i8* %tmp38, align 1
+ %tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0 ; <i8*> [#uses=2]
+ store i8 -1, i8* %tmp41, align 1
+ %tmp43 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 7, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp43, align 2
+ %tmp46 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 7, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp46, align 2
+ %tmp57 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 6, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp57, align 2
+ %tmp60 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 6, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp60, align 2
+ %tmp71 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 5, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp71, align 2
+ %tmp74 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 5, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp74, align 2
+ %tmp85 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 4, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp85, align 2
+ %tmp88 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 4, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp88, align 2
+ %tmp99 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 3, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp99, align 2
+ %tmp102 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 3, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp102, align 2
+ %tmp113 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 2, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp113, align 2
+ %tmp116 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 2, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp116, align 2
+ %tmp127 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 1, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp127, align 2
+ %tmp130 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 1, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp130, align 2
+ %tmp141 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 0, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp141, align 8
+ %tmp144 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 0, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp144, align 2
+ %tmp148 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 7, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp148, align 2
+ %tmp151 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 7, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp151, align 2
+ %tmp162 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 6, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp162, align 2
+ %tmp165 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 6, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp165, align 2
+ %tmp176 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 5, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp176, align 2
+ %tmp179 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 5, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp179, align 2
+ %tmp190 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 4, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp190, align 2
+ %tmp193 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 4, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp193, align 2
+ %tmp204 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 3, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp204, align 2
+ %tmp207 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 3, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp207, align 2
+ %tmp218 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 2, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp218, align 2
+ %tmp221 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 2, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp221, align 2
+ %tmp232 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 1, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp232, align 2
+ %tmp235 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 1, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp235, align 2
+ %tmp246 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 0, i32 0 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp246, align 8
+ %tmp249 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 0, i32 1 ; <i16*> [#uses=1]
+ store i16 0, i16* %tmp249, align 2
+ %up_mvd252 = getelementptr [8 x %struct.MV]* %up_mvd, i32 0, i32 0 ; <%struct.MV*> [#uses=1]
+ %left_mvd253 = getelementptr [8 x %struct.MV]* %left_mvd, i32 0, i32 0 ; <%struct.MV*> [#uses=1]
+ call void @foo( %struct.MV* %up_mvd252, %struct.MV* %left_mvd253, i8* %tmp41 ) nounwind
+ ret i32 undef
+}
+
+declare void @foo(%struct.MV*, %struct.MV*, i8*)
diff --git a/test/Transforms/MemCpyOpt/memcpy.ll b/test/Transforms/MemCpyOpt/memcpy.ll
new file mode 100644
index 000000000000..c5cdc29a5cf2
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/memcpy.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -memcpyopt -dse | llvm-dis | grep {call.*memcpy} | count 1
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin9"
+
+define void @ccosl({ x86_fp80, x86_fp80 }* sret %agg.result, x86_fp80 %z.0, x86_fp80 %z.1) nounwind {
+entry:
+ %tmp2 = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=1]
+ %memtmp = alloca { x86_fp80, x86_fp80 }, align 16 ; <{ x86_fp80, x86_fp80 }*> [#uses=2]
+ %tmp5 = sub x86_fp80 0xK80000000000000000000, %z.1 ; <x86_fp80> [#uses=1]
+ call void @ccoshl( { x86_fp80, x86_fp80 }* sret %memtmp, x86_fp80 %tmp5, x86_fp80 %z.0 ) nounwind
+ %tmp219 = bitcast { x86_fp80, x86_fp80 }* %tmp2 to i8* ; <i8*> [#uses=2]
+ %memtmp20 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp219, i8* %memtmp20, i32 32, i32 16 )
+ %agg.result21 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %agg.result21, i8* %tmp219, i32 32, i32 16 )
+ ret void
+}
+
+declare void @ccoshl({ x86_fp80, x86_fp80 }* sret , x86_fp80, x86_fp80) nounwind
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/MemCpyOpt/sret.ll b/test/Transforms/MemCpyOpt/sret.ll
new file mode 100644
index 000000000000..1ac11aa959f9
--- /dev/null
+++ b/test/Transforms/MemCpyOpt/sret.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | not grep {call.*memcpy}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin9"
+
+define void @ccosl({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* byval %z) nounwind {
+entry:
+ %iz = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=3]
+ %memtmp = alloca { x86_fp80, x86_fp80 }, align 16 ; <{ x86_fp80, x86_fp80 }*> [#uses=2]
+ %tmp1 = getelementptr { x86_fp80, x86_fp80 }* %z, i32 0, i32 1 ; <x86_fp80*> [#uses=1]
+ %tmp2 = load x86_fp80* %tmp1, align 16 ; <x86_fp80> [#uses=1]
+ %tmp3 = sub x86_fp80 0xK80000000000000000000, %tmp2 ; <x86_fp80> [#uses=1]
+ %tmp4 = getelementptr { x86_fp80, x86_fp80 }* %iz, i32 0, i32 1 ; <x86_fp80*> [#uses=1]
+ %real = getelementptr { x86_fp80, x86_fp80 }* %iz, i32 0, i32 0 ; <x86_fp80*> [#uses=1]
+ %tmp7 = getelementptr { x86_fp80, x86_fp80 }* %z, i32 0, i32 0 ; <x86_fp80*> [#uses=1]
+ %tmp8 = load x86_fp80* %tmp7, align 16 ; <x86_fp80> [#uses=1]
+ store x86_fp80 %tmp3, x86_fp80* %real, align 16
+ store x86_fp80 %tmp8, x86_fp80* %tmp4, align 16
+ call void @ccoshl( { x86_fp80, x86_fp80 }* noalias sret %memtmp, { x86_fp80, x86_fp80 }* byval %iz ) nounwind
+ %memtmp14 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; <i8*> [#uses=1]
+ %agg.result15 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %agg.result15, i8* %memtmp14, i32 32, i32 16 )
+ ret void
+}
+
+declare void @ccoshl({ x86_fp80, x86_fp80 }* noalias sret , { x86_fp80, x86_fp80 }* byval ) nounwind
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/MergeFunc/dg.exp b/test/Transforms/MergeFunc/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/MergeFunc/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/MergeFunc/fold-weak.ll b/test/Transforms/MergeFunc/fold-weak.ll
new file mode 100644
index 000000000000..d98fde0228fb
--- /dev/null
+++ b/test/Transforms/MergeFunc/fold-weak.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -mergefunc | llvm-dis | grep {alias weak} | count 2
+
+define weak i32 @sum(i32 %x, i32 %y) {
+ %sum = add i32 %x, %y
+ ret i32 %sum
+}
+
+define weak i32 @add(i32 %x, i32 %y) {
+ %sum = add i32 %x, %y
+ ret i32 %sum
+}
diff --git a/test/Transforms/MergeFunc/phi-speculation1.ll b/test/Transforms/MergeFunc/phi-speculation1.ll
new file mode 100644
index 000000000000..9ba3081a901c
--- /dev/null
+++ b/test/Transforms/MergeFunc/phi-speculation1.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -mergefunc -stats -disable-output |& not grep {functions merged}
+
+define i32 @foo1(i32 %x) {
+entry:
+ %A = add i32 %x, 1
+ %B = call i32 @foo1(i32 %A)
+ br label %loop
+loop:
+ %C = phi i32 [%B, %entry], [%D, %loop]
+ %D = add i32 %x, 2
+ %E = icmp ugt i32 %D, 10000
+ br i1 %E, label %loopexit, label %loop
+loopexit:
+ ret i32 %D
+}
+
+define i32 @foo2(i32 %x) {
+entry:
+ %0 = add i32 %x, 1
+ %1 = call i32 @foo2(i32 %0)
+ br label %loop
+loop:
+ %2 = phi i32 [%1, %entry], [%3, %loop]
+ %3 = add i32 %2, 2
+ %4 = icmp ugt i32 %3, 10000
+ br i1 %4, label %loopexit, label %loop
+loopexit:
+ ret i32 %3
+}
diff --git a/test/Transforms/MergeFunc/phi-speculation2.ll b/test/Transforms/MergeFunc/phi-speculation2.ll
new file mode 100644
index 000000000000..d8c6e30b9757
--- /dev/null
+++ b/test/Transforms/MergeFunc/phi-speculation2.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -mergefunc -stats -disable-output |& grep {functions merged}
+
+define i32 @foo1(i32 %x) {
+entry:
+ %A = add i32 %x, 1
+ %B = call i32 @foo1(i32 %A)
+ br label %loop
+loop:
+ %C = phi i32 [%B, %entry], [%D, %loop]
+ %D = add i32 %C, 2
+ %E = icmp ugt i32 %D, 10000
+ br i1 %E, label %loopexit, label %loop
+loopexit:
+ ret i32 %D
+}
+
+define i32 @foo2(i32 %x) {
+entry:
+ %0 = add i32 %x, 1
+ %1 = call i32 @foo2(i32 %0)
+ br label %loop
+loop:
+ %2 = phi i32 [%1, %entry], [%3, %loop]
+ %3 = add i32 %2, 2
+ %4 = icmp ugt i32 %3, 10000
+ br i1 %4, label %loopexit, label %loop
+loopexit:
+ ret i32 %3
+}
diff --git a/test/Transforms/PredicateSimplifier/2006-08-02-Switch.ll b/test/Transforms/PredicateSimplifier/2006-08-02-Switch.ll
new file mode 100644
index 000000000000..fadaaa2ac56a
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-08-02-Switch.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define fastcc void @_ov_splice(i32 %n1, i32 %n2, i32 %ch2) {
+entry:
+ %tmp = icmp sgt i32 %n1, %n2 ; <i1> [#uses=1]
+ %n.0 = select i1 %tmp, i32 %n2, i32 %n1 ; <i32> [#uses=1]
+ %tmp104 = icmp slt i32 0, %ch2 ; <i1> [#uses=1]
+ br i1 %tmp104, label %cond_true105, label %return
+cond_true95: ; preds = %cond_true105
+ ret void
+bb98: ; preds = %cond_true105
+ ret void
+cond_true105: ; preds = %entry
+ %tmp94 = icmp sgt i32 %n.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp94, label %cond_true95, label %bb98
+return: ; preds = %entry
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-08-07-LeaderOffByOne.ll b/test/Transforms/PredicateSimplifier/2006-08-07-LeaderOffByOne.ll
new file mode 100644
index 000000000000..c08dbb3a095c
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-08-07-LeaderOffByOne.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define void @safe_strcpy(i32 %size1) {
+entry:
+ %tmp = icmp eq i32 %size1, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %return, label %strlen.exit
+strlen.exit: ; preds = %entry
+ %tmp.upgrd.1 = trunc i64 0 to i32 ; <i32> [#uses=2]
+ %tmp6 = icmp ult i32 %tmp.upgrd.1, %size1 ; <i1> [#uses=1]
+ br i1 %tmp6, label %cond_true7, label %cond_false19
+cond_true7: ; preds = %strlen.exit
+ %tmp9 = icmp eq i32 %tmp.upgrd.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp9, label %cond_next15, label %cond_true10
+cond_true10: ; preds = %cond_true7
+ ret void
+cond_next15: ; preds = %cond_true7
+ ret void
+cond_false19: ; preds = %strlen.exit
+ ret void
+return: ; preds = %entry
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll b/test/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll
new file mode 100644
index 000000000000..f3d58e9102d0
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-09-20-ResolveCycle.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define void @gs_image_next() {
+entry:
+ %tmp = load i32* null ; <i32> [#uses=2]
+ br i1 false, label %cond_next21, label %UnifiedReturnBlock
+cond_next21: ; preds = %entry
+ br i1 false, label %cond_next42, label %UnifiedReturnBlock
+cond_next42: ; preds = %cond_next21
+ br label %cond_true158
+cond_next134: ; preds = %cond_true158
+ %tmp1571 = icmp eq i32 0, %min ; <i1> [#uses=0]
+ ret void
+cond_true158: ; preds = %cond_true158, %cond_next42
+ %tmp47 = sub i32 %tmp, 0 ; <i32> [#uses=2]
+ %tmp49 = icmp ule i32 %tmp47, 0 ; <i1> [#uses=1]
+ %min = select i1 %tmp49, i32 %tmp47, i32 0 ; <i32> [#uses=2]
+ %tmp92 = add i32 %min, 0 ; <i32> [#uses=1]
+ %tmp101 = icmp eq i32 %tmp92, %tmp ; <i1> [#uses=1]
+ br i1 %tmp101, label %cond_next134, label %cond_true158
+UnifiedReturnBlock: ; preds = %cond_next21, %entry
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll b/test/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll
new file mode 100644
index 000000000000..9df0f9d9bef9
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-09-20-SetCC.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep br | grep return.i.bb8_crit_edge | grep false
+@str = external global [4 x i8] ; <[4 x i8]*> [#uses=1]
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+define i32 @main() {
+entry:
+ br label %cond_true.outer
+cond_true.outer: ; preds = %cond_true.i, %entry
+ %i.0.0.ph = phi i32 [ 0, %entry ], [ %tmp5, %cond_true.i ] ; <i32> [#uses=1]
+ %j.0.0.ph = phi i32 [ 0, %entry ], [ %tmp312, %cond_true.i ] ; <i32> [#uses=2]
+ br label %cond_true
+cond_true: ; preds = %return.i, %cond_true.outer
+ %indvar.ui = phi i32 [ 0, %cond_true.outer ], [ %indvar.next, %return.i ] ; <i32> [#uses=2]
+ %indvar = bitcast i32 %indvar.ui to i32 ; <i32> [#uses=1]
+ %i.0.0 = add i32 %indvar, %i.0.0.ph ; <i32> [#uses=3]
+ %savedstack = call i8* @llvm.stacksave( ) ; <i8*> [#uses=2]
+ %tmp.i = icmp eq i32 %i.0.0, 0 ; <i1> [#uses=1]
+ %tmp5 = add i32 %i.0.0, 1 ; <i32> [#uses=3]
+ br i1 %tmp.i, label %return.i, label %cond_true.i
+cond_true.i: ; preds = %cond_true
+ %tmp.i.upgrd.1 = alloca [1000 x i8] ; <[1000 x i8]*> [#uses=1]
+ %tmp.sub.i = getelementptr [1000 x i8]* %tmp.i.upgrd.1, i32 0, i32 0 ; <i8*> [#uses=2]
+ %tmp4.i = call i32 (i8*, i8*, ...)* @sprintf( i8* %tmp.sub.i, i8* getelementptr ([4 x i8]* @str, i32 0, i64 0), i32 %i.0.0 ) ; <i32> [#uses=0]
+ %tmp.i.upgrd.2 = load i8* %tmp.sub.i ; <i8> [#uses=1]
+ %tmp7.i = sext i8 %tmp.i.upgrd.2 to i32 ; <i32> [#uses=1]
+ call void @llvm.stackrestore( i8* %savedstack )
+ %tmp312 = add i32 %tmp7.i, %j.0.0.ph ; <i32> [#uses=2]
+ %tmp19 = icmp sgt i32 %tmp5, 9999 ; <i1> [#uses=1]
+ br i1 %tmp19, label %bb8, label %cond_true.outer
+return.i: ; preds = %cond_true
+ call void @llvm.stackrestore( i8* %savedstack )
+ %tmp21 = icmp sgt i32 %tmp5, 9999 ; <i1> [#uses=1]
+ %indvar.next = add i32 %indvar.ui, 1 ; <i32> [#uses=1]
+ br i1 %tmp21, label %bb8, label %cond_true
+bb8: ; preds = %return.i, %cond_true.i
+ %j.0.1 = phi i32 [ %j.0.0.ph, %return.i ], [ %tmp312, %cond_true.i ] ; <i32> [#uses=1]
+ %tmp10 = call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @str, i32 0, i64 0), i32 %j.0.1 ) ; <i32> [#uses=0]
+ ret i32 undef
+}
+
+declare i32 @printf(i8*, ...)
+
+declare i8* @llvm.stacksave()
+
+declare void @llvm.stackrestore(i8*)
diff --git a/test/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll b/test/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll
new file mode 100644
index 000000000000..9146576ef616
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll
@@ -0,0 +1,48 @@
+; RUN: llvm-as < %s | \
+; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis > %t
+; RUN: grep -v declare %t | not grep fail
+; RUN: grep -v declare %t | grep pass | count 3
+
+define i32 @test1(i32 %x, i32 %y) {
+entry:
+ %tmp2 = or i32 %x, %y ; <i32> [#uses=1]
+ %tmp = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %return
+cond_true: ; preds = %entry
+ %tmp4 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %tmp4, label %cond_true5, label %cond_false
+cond_true5: ; preds = %cond_true
+ %tmp6 = call i32 @pass( ) ; <i32> [#uses=1]
+ ret i32 %tmp6
+cond_false: ; preds = %cond_true
+ %tmp8 = call i32 @fail( ) ; <i32> [#uses=1]
+ ret i32 %tmp8
+return: ; preds = %entry
+ ret i32 0
+}
+
+define i32 @test2(i32 %x, i32 %y) {
+entry:
+ %tmp2 = or i32 %x, %y ; <i32> [#uses=1]
+ %tmp = icmp ne i32 %tmp2, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %return
+cond_true: ; preds = %entry
+ %tmp4 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %tmp4, label %cond_true5, label %cond_false
+cond_true5: ; preds = %cond_true
+ %tmp6 = call i32 @pass1( ) ; <i32> [#uses=1]
+ ret i32 %tmp6
+cond_false: ; preds = %cond_true
+ %tmp8 = call i32 @pass2( ) ; <i32> [#uses=1]
+ ret i32 %tmp8
+return: ; preds = %entry
+ ret i32 0
+}
+
+declare i32 @fail()
+
+declare i32 @pass()
+
+declare i32 @pass1()
+
+declare i32 @pass2()
diff --git a/test/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll b/test/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll
new file mode 100644
index 000000000000..cbc54bee21bc
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | \
+; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis | \
+; RUN: grep -v declare | grep pass | count 2
+
+define i32 @test(i32 %x, i32 %y) {
+entry:
+ %tmp2 = icmp slt i32 %x, %y ; <i1> [#uses=1]
+ %tmp = icmp ne i1 %tmp2, true ; <i1> [#uses=1]
+ br i1 %tmp, label %cond_true, label %return
+cond_true: ; preds = %entry
+ %tmp4 = icmp eq i32 %x, %y ; <i1> [#uses=1]
+ br i1 %tmp4, label %cond_true5, label %cond_false
+cond_true5: ; preds = %cond_true
+ %tmp6 = call i32 @pass1( ) ; <i32> [#uses=1]
+ ret i32 %tmp6
+cond_false: ; preds = %cond_true
+ %tmp8 = call i32 @pass2( ) ; <i32> [#uses=1]
+ ret i32 %tmp8
+return: ; preds = %entry
+ ret i32 0
+}
+
+declare i32 @pass1()
+
+declare i32 @pass2()
+
diff --git a/test/Transforms/PredicateSimplifier/2006-11-04-ImpossibleGT.ll b/test/Transforms/PredicateSimplifier/2006-11-04-ImpossibleGT.ll
new file mode 100644
index 000000000000..b0b9859462a6
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-11-04-ImpossibleGT.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define void @readMotionInfoFromNAL() {
+entry:
+ br i1 false, label %bb2425, label %cond_next30
+cond_next30: ; preds = %entry
+ ret void
+bb2418: ; preds = %bb2425
+ ret void
+bb2425: ; preds = %entry
+ %tmp2427 = icmp sgt i32 0, 3 ; <i1> [#uses=1]
+ br i1 %tmp2427, label %cond_next2429, label %bb2418
+cond_next2429: ; preds = %bb2425
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-11-04-ReplacingZeros.ll b/test/Transforms/PredicateSimplifier/2006-11-04-ReplacingZeros.ll
new file mode 100644
index 000000000000..906d7c363bf6
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-11-04-ReplacingZeros.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define i32 @test_wp_B_slice(i32 %select_method) {
+entry:
+ br label %bb309
+cond_true114: ; preds = %bb309
+ %tmp130 = icmp slt i32 0, 128 ; <i1> [#uses=1]
+ %min = select i1 %tmp130, i32 0, i32 127 ; <i32> [#uses=2]
+ %tmp143 = load i32* null ; <i32> [#uses=0]
+ br i1 false, label %bb303, label %bb314
+cond_true166: ; preds = %bb303
+ ret i32 0
+cond_false200: ; preds = %bb303
+ %tmp205 = sdiv i32 %min, 2 ; <i32> [#uses=1]
+ %iftmp.380.0.p = select i1 false, i32 0, i32 %tmp205 ; <i32> [#uses=0]
+ ret i32 0
+bb303: ; preds = %cond_true114
+ %tmp165 = icmp eq i32 %min, 0 ; <i1> [#uses=1]
+ br i1 %tmp165, label %cond_true166, label %cond_false200
+bb309: ; preds = %entry
+ br i1 false, label %cond_true114, label %bb314
+bb314: ; preds = %bb309, %cond_true114
+ ret i32 0
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-11-05-CycleGTLT.ll b/test/Transforms/PredicateSimplifier/2006-11-05-CycleGTLT.ll
new file mode 100644
index 000000000000..87e0e16b5eea
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-11-05-CycleGTLT.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define void @diff(i32 %N) {
+entry:
+ %tmp = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
+ br i1 %tmp, label %bb519, label %bb744
+bb519: ; preds = %entry
+ %tmp720101 = icmp slt i32 %N, 0 ; <i1> [#uses=1]
+ br i1 %tmp720101, label %bb744, label %bb744
+bb744: ; preds = %bb519, %bb519, %entry
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-11-11-Squeeze.ll b/test/Transforms/PredicateSimplifier/2006-11-11-Squeeze.ll
new file mode 100644
index 000000000000..4f8af01bc399
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-11-11-Squeeze.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+ %struct.cube_struct = type { i32, i32, i32, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32**, i32**, i32*, i32*, i32, i32, i32*, i32, i32 }
+@cube = external global %struct.cube_struct ; <%struct.cube_struct*> [#uses=2]
+
+define fastcc void @cube_setup() {
+entry:
+ %tmp = load i32* getelementptr (%struct.cube_struct* @cube, i32 0, i32 2) ; <i32> [#uses=2]
+ %tmp.upgrd.1 = icmp slt i32 %tmp, 0 ; <i1> [#uses=1]
+ br i1 %tmp.upgrd.1, label %bb, label %cond_next
+cond_next: ; preds = %entry
+ %tmp2 = load i32* getelementptr (%struct.cube_struct* @cube, i32 0, i32 1) ; <i32> [#uses=2]
+ %tmp5 = icmp slt i32 %tmp2, %tmp ; <i1> [#uses=1]
+ br i1 %tmp5, label %bb, label %bb6
+bb: ; preds = %cond_next, %entry
+ unreachable
+bb6: ; preds = %cond_next
+ %tmp98124 = icmp sgt i32 %tmp2, 0 ; <i1> [#uses=1]
+ br i1 %tmp98124, label %bb42, label %bb99
+bb42: ; preds = %bb6
+ ret void
+bb99: ; preds = %bb6
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2006-11-12-MergeNodes.ll b/test/Transforms/PredicateSimplifier/2006-11-12-MergeNodes.ll
new file mode 100644
index 000000000000..47f912de5e8b
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2006-11-12-MergeNodes.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+; END.
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+deplibs = [ "c", "crtend" ]
+ %struct.VDIR_ST = type { i32, i32, i32, %struct.acl*, %struct.pfile*, %struct.vlink*, %struct.vlink*, %struct.vlink*, %struct.VDIR_ST*, %struct.VDIR_ST* }
+ %struct.acl = type { i32, i8*, i8*, i8*, %struct.restrict*, %struct.acl*, %struct.acl* }
+ %struct.avalue = type { i8* }
+ %struct.pattrib = type { i8, i8*, i8*, %struct.avalue, %struct.pattrib*, %struct.pattrib* }
+ %struct.pfile = type { i32, i32, i32, i32, i32, %struct.vlink*, %struct.vlink*, %struct.pattrib*, %struct.pfile*, %struct.pfile* }
+ %struct.restrict = type { %struct.acl*, %struct.acl* }
+ %struct.vlink = type { i32, i8*, i8, i32, i8*, %struct.vlink*, %struct.vlink*, i8*, i8*, i8*, i8*, i32, i32, %struct.acl*, i32, i32, i8*, %struct.pattrib*, %struct.pfile*, %struct.vlink*, %struct.vlink* }
+
+define void @vl_insert(%struct.vlink* %vl) {
+entry:
+ %tmp91 = call i32 @vl_comp( ) ; <i32> [#uses=2]
+ %tmp93 = icmp sgt i32 %tmp91, 0 ; <i1> [#uses=1]
+ br i1 %tmp93, label %cond_next84, label %bb94
+cond_next84: ; preds = %entry
+ ret void
+bb94: ; preds = %entry
+ %tmp96 = icmp eq i32 %tmp91, 0 ; <i1> [#uses=1]
+ br i1 %tmp96, label %cond_true97, label %cond_next203
+cond_true97: ; preds = %bb94
+ br i1 false, label %cond_next105, label %cond_true102
+cond_true102: ; preds = %cond_true97
+ ret void
+cond_next105: ; preds = %cond_true97
+ %tmp110 = getelementptr %struct.vlink* %vl, i32 0, i32 12 ; <i32*> [#uses=1]
+ %tmp111 = load i32* %tmp110 ; <i32> [#uses=1]
+ %tmp129 = icmp eq i32 %tmp111, 0 ; <i1> [#uses=1]
+ br i1 %tmp129, label %cond_true130, label %cond_next133
+cond_true130: ; preds = %cond_next105
+ ret void
+cond_next133: ; preds = %cond_next105
+ ret void
+cond_next203: ; preds = %bb94
+ ret void
+}
+
+declare i32 @vl_comp()
diff --git a/test/Transforms/PredicateSimplifier/2007-01-04-SelectSwitch.ll b/test/Transforms/PredicateSimplifier/2007-01-04-SelectSwitch.ll
new file mode 100644
index 000000000000..8e45a6602acf
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2007-01-04-SelectSwitch.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+define void @ercMarkCurrMBConcealed(i32 %comp) {
+entry:
+ %tmp5 = icmp slt i32 %comp, 0 ; <i1> [#uses=2]
+ %comp_addr.0 = select i1 %tmp5, i32 0, i32 %comp ; <i32> [#uses=1]
+ switch i32 %comp_addr.0, label %return [
+ i32 0, label %bb
+ ]
+bb: ; preds = %entry
+ br i1 %tmp5, label %bb87.bb97_crit_edge.critedge, label %return
+bb87.bb97_crit_edge.critedge: ; preds = %bb
+ ret void
+return: ; preds = %bb, %entry
+ ret void
+}
+
diff --git a/test/Transforms/PredicateSimplifier/2007-03-17-OpsToDefVRP.ll b/test/Transforms/PredicateSimplifier/2007-03-17-OpsToDefVRP.ll
new file mode 100644
index 000000000000..0a45e7ce36a2
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2007-03-17-OpsToDefVRP.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep -v %c
+define void @foo(i8* %X, i8* %Y) {
+entry:
+ %A = load i8* %X
+ %B = load i8* %Y
+ %a = icmp ult i8 %B, 10
+ br i1 %a, label %cond_true, label %URB
+cond_true:
+ %b = icmp eq i8 %A, %B
+ br i1 %b, label %cond_true2, label %URB
+cond_true2:
+ %c = icmp ult i8 %A, 11
+ call i8 @bar(i1 %c)
+ ret void
+URB:
+ ret void
+}
+
+declare i8 @bar(i1)
diff --git a/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll b/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll
new file mode 100644
index 000000000000..e12453a76c41
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll
@@ -0,0 +1,102 @@
+; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep unreachable | count 2
+; PR1683
+
+@.str = internal constant [13 x i8] c"c36174a.adb\00\00" ; <[13 x i8]*> [#uses=1]
+
+define void @_ada_c36174a() {
+entry:
+ %tmp3 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %tmp4 = invoke i32 @report__ident_int( i32 6 )
+ to label %invcont unwind label %entry.lpad_crit_edge ; <i32> [#uses=7]
+
+entry.lpad_crit_edge: ; preds = %entry
+ br label %lpad
+
+invcont: ; preds = %entry
+ %tmp6 = icmp slt i32 %tmp4, 1 ; <i1> [#uses=1]
+ br i1 %tmp6, label %bb, label %bb9
+
+bb: ; preds = %invcont
+ invoke void @__gnat_rcheck_07( i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i32 10 )
+ to label %invcont8 unwind label %bb.lpad_crit_edge
+
+bb.lpad_crit_edge: ; preds = %bb
+ br label %lpad
+
+invcont8: ; preds = %bb
+ unreachable
+
+bb9: ; preds = %invcont
+ %tmp51 = add i32 %tmp4, 6 ; <i32> [#uses=2]
+ %tmp56 = icmp sgt i32 %tmp4, %tmp51 ; <i1> [#uses=1]
+ br i1 %tmp56, label %bb9.bb76_crit_edge, label %bb9.bb61_crit_edge
+
+bb9.bb61_crit_edge: ; preds = %bb9
+ br label %bb61
+
+bb9.bb76_crit_edge: ; preds = %bb9
+ br label %bb76
+
+bb61: ; preds = %bb73, %bb9.bb61_crit_edge
+ %J4b.0 = phi i32 [ %tmp75, %bb73 ], [ %tmp4, %bb9.bb61_crit_edge ] ; <i32> [#uses=2]
+ %tmp70 = icmp eq i32 %tmp51, %J4b.0 ; <i1> [#uses=1]
+ br i1 %tmp70, label %bb61.bb76_crit_edge, label %bb73
+
+bb61.bb76_crit_edge: ; preds = %bb61
+ br label %bb76
+
+bb73: ; preds = %bb61
+ %tmp75 = add i32 %J4b.0, 1 ; <i32> [#uses=1]
+ br label %bb61
+
+bb76: ; preds = %bb61.bb76_crit_edge, %bb9.bb76_crit_edge
+ %tmp78 = icmp ne i32 %tmp4, 6 ; <i1> [#uses=1]
+ %tmp81 = add i32 %tmp4, 6 ; <i32> [#uses=1]
+ %tmp8182 = sext i32 %tmp81 to i64 ; <i64> [#uses=1]
+ %tmp8384 = sext i32 %tmp4 to i64 ; <i64> [#uses=1]
+ %tmp85 = sub i64 %tmp8182, %tmp8384 ; <i64> [#uses=1]
+ %tmp86 = icmp ne i64 %tmp85, 6 ; <i1> [#uses=1]
+ %tmp90 = or i1 %tmp78, %tmp86 ; <i1> [#uses=1]
+ br i1 %tmp90, label %bb93, label %bb76.bb99_crit_edge
+
+bb76.bb99_crit_edge: ; preds = %bb76
+ br label %bb99
+
+bb93: ; preds = %bb76
+ invoke void @abort( )
+ to label %bb93.bb99_crit_edge unwind label %bb93.lpad_crit_edge
+
+bb93.lpad_crit_edge: ; preds = %bb93
+ br label %lpad
+
+bb93.bb99_crit_edge: ; preds = %bb93
+ br label %bb99
+
+bb99: ; preds = %bb93.bb99_crit_edge, %bb76.bb99_crit_edge
+ ret void
+
+lpad: ; preds = %bb93.lpad_crit_edge, %bb.lpad_crit_edge, %entry.lpad_crit_edge
+ %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select102 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32 0 ) ; <i32> [#uses=0]
+ call void @llvm.stackrestore( i8* %tmp3 )
+ call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32>:0 [#uses=0]
+ unreachable
+}
+
+declare i8* @llvm.stacksave()
+
+declare i32 @report__ident_int(i32)
+
+declare void @__gnat_rcheck_07(i8*, i32)
+
+declare void @abort()
+
+declare i8* @llvm.eh.exception()
+
+declare i32 @llvm.eh.selector.i32(i8*, i8*, ...)
+
+declare i32 @__gnat_eh_personality(...)
+
+declare i32 @_Unwind_Resume(...)
+
+declare void @llvm.stackrestore(i8*)
diff --git a/test/Transforms/PredicateSimplifier/dg.exp b/test/Transforms/PredicateSimplifier/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/PredicateSimplifier/predsimplify.ll b/test/Transforms/PredicateSimplifier/predsimplify.ll
new file mode 100644
index 000000000000..a6848df69e3d
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/predsimplify.ll
@@ -0,0 +1,279 @@
+; RUN: llvm-as < %s | \
+; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis > %t
+; RUN: grep -v declare %t | not grep fail
+; RUN: grep -v declare %t | grep pass | count 4
+
+
+define void @test1(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %A, label %then.1, label %else.1
+then.1: ; preds = %entry
+ %B = icmp eq i32 %x, 1 ; <i1> [#uses=1]
+ br i1 %B, label %then.2, label %else.1
+then.2: ; preds = %then.1
+ call void (...)* @fail( )
+ ret void
+else.1: ; preds = %then.1, %entry
+ ret void
+}
+
+define void @test2(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ %B = icmp eq i32 %x, 1 ; <i1> [#uses=1]
+ br i1 %A, label %then.1, label %else.1
+then.1: ; preds = %entry
+ br i1 %B, label %then.2, label %else.1
+then.2: ; preds = %then.1
+ call void (...)* @fail( )
+ ret void
+else.1: ; preds = %then.1, %entry
+ ret void
+}
+
+define void @test3(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ %B = icmp eq i32 %x, 1 ; <i1> [#uses=1]
+ br i1 %A, label %then.1, label %else.1
+then.1: ; preds = %entry
+ br i1 %B, label %then.2, label %else.1
+then.2: ; preds = %then.1
+ call void (...)* @fail( )
+ ret void
+else.1: ; preds = %then.1, %entry
+ ret void
+}
+
+define void @test4(i32 %x, i32 %y) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ %B = icmp eq i32 %y, 0 ; <i1> [#uses=1]
+ %C = and i1 %A, %B ; <i1> [#uses=1]
+ br i1 %C, label %then.1, label %else.1
+then.1: ; preds = %entry
+ %D = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %D, label %then.2, label %else.2
+then.2: ; preds = %then.1
+ %E = icmp eq i32 %y, 0 ; <i1> [#uses=1]
+ br i1 %E, label %else.1, label %else.2
+else.1: ; preds = %then.2, %entry
+ ret void
+else.2: ; preds = %then.2, %then.1
+ call void (...)* @fail( )
+ ret void
+}
+
+define void @test5(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %A, label %then.1, label %else.1
+then.1: ; preds = %else.1, %entry
+ ret void
+then.2: ; preds = %else.1
+ call void (...)* @fail( )
+ ret void
+else.1: ; preds = %entry
+ %B = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %B, label %then.2, label %then.1
+}
+
+define void @test6(i32 %x, i32 %y) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ %B = icmp eq i32 %y, 0 ; <i1> [#uses=1]
+ %C = or i1 %A, %B ; <i1> [#uses=1]
+ br i1 %C, label %then.1, label %else.1
+then.1: ; preds = %else.2, %entry
+ ret void
+then.2: ; preds = %else.2, %else.1
+ call void (...)* @fail( )
+ ret void
+else.1: ; preds = %entry
+ %D = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %D, label %then.2, label %else.2
+else.2: ; preds = %else.1
+ %E = icmp ne i32 %y, 0 ; <i1> [#uses=1]
+ br i1 %E, label %then.1, label %then.2
+}
+
+define void @test7(i32 %x) {
+entry:
+ %A = icmp ne i32 %x, 0 ; <i1> [#uses=1]
+ %B = xor i1 %A, true ; <i1> [#uses=1]
+ br i1 %B, label %then.1, label %else.1
+then.1: ; preds = %entry
+ %C = icmp eq i32 %x, 1 ; <i1> [#uses=1]
+ br i1 %C, label %then.2, label %else.1
+then.2: ; preds = %then.1
+ call void (...)* @fail( )
+ ret void
+else.1: ; preds = %then.1, %entry
+ ret void
+}
+
+define void @test8(i32 %x) {
+entry:
+ %A = add i32 %x, 1 ; <i32> [#uses=1]
+ %B = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %B, label %then.1, label %then.2
+then.1: ; preds = %entry
+ %C = icmp eq i32 %A, 1 ; <i1> [#uses=1]
+ br i1 %C, label %then.2, label %else.2
+then.2: ; preds = %then.1, %entry
+ ret void
+else.2: ; preds = %then.1
+ call void (...)* @fail( )
+ ret void
+}
+
+define void @test9(i32 %y, i32 %z) {
+entry:
+ %x = add i32 %y, %z ; <i32> [#uses=1]
+ %A = icmp eq i32 %y, 3 ; <i1> [#uses=1]
+ %B = icmp eq i32 %z, 5 ; <i1> [#uses=1]
+ %C = and i1 %A, %B ; <i1> [#uses=1]
+ br i1 %C, label %cond_true, label %return
+cond_true: ; preds = %entry
+ %D = icmp eq i32 %x, 8 ; <i1> [#uses=1]
+ br i1 %D, label %then, label %oops
+then: ; preds = %cond_true
+ call void (...)* @pass( )
+ ret void
+oops: ; preds = %cond_true
+ call void (...)* @fail( )
+ ret void
+return: ; preds = %entry
+ ret void
+}
+
+define void @test10() {
+entry:
+ %A = alloca i32 ; <i32*> [#uses=1]
+ %B = icmp eq i32* %A, null ; <i1> [#uses=1]
+ br i1 %B, label %cond_true, label %cond_false
+cond_true: ; preds = %entry
+ call void (...)* @fail( )
+ ret void
+cond_false: ; preds = %entry
+ call void (...)* @pass( )
+ ret void
+}
+
+define void @switch1(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
+ br i1 %A, label %return, label %cond_false
+cond_false: ; preds = %entry
+ switch i32 %x, label %return [
+ i32 9, label %then1
+ i32 10, label %then2
+ ]
+then1: ; preds = %cond_false
+ call void (...)* @pass( )
+ ret void
+then2: ; preds = %cond_false
+ call void (...)* @fail( )
+ ret void
+return: ; preds = %cond_false, %entry
+ ret void
+}
+
+define void @switch2(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
+ br i1 %A, label %return, label %cond_false
+cond_false: ; preds = %entry
+ switch i32 %x, label %return [
+ i32 8, label %then1
+ i32 9, label %then1
+ i32 10, label %then1
+ ]
+then1: ; preds = %cond_false, %cond_false, %cond_false
+ %B = icmp ne i32 %x, 8 ; <i1> [#uses=1]
+ br i1 %B, label %then2, label %return
+then2: ; preds = %then1
+ call void (...)* @pass( )
+ ret void
+return: ; preds = %then1, %cond_false, %entry
+ ret void
+}
+
+define void @switch3(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
+ br i1 %A, label %return, label %cond_false
+cond_false: ; preds = %entry
+ switch i32 %x, label %return [
+ i32 9, label %then1
+ i32 10, label %then1
+ ]
+then1: ; preds = %cond_false, %cond_false
+ %B = icmp eq i32 %x, 9 ; <i1> [#uses=1]
+ br i1 %B, label %return, label %oops
+oops: ; preds = %then1
+ call void (...)* @fail( )
+ ret void
+return: ; preds = %then1, %cond_false, %entry
+ ret void
+}
+
+define void @switch4(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
+ br i1 %A, label %then1, label %cond_false
+cond_false: ; preds = %entry
+ switch i32 %x, label %default [
+ i32 9, label %then1
+ i32 10, label %then2
+ ]
+then1: ; preds = %default, %cond_false, %entry
+ ret void
+then2: ; preds = %cond_false
+ ret void
+default: ; preds = %cond_false
+ %B = icmp eq i32 %x, 9 ; <i1> [#uses=1]
+ br i1 %B, label %oops, label %then1
+oops: ; preds = %default
+ call void (...)* @fail( )
+ ret void
+}
+
+define void @select1(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 10 ; <i1> [#uses=3]
+ %B = select i1 %A, i32 1, i32 2 ; <i32> [#uses=1]
+ %C = icmp eq i32 %B, 1 ; <i1> [#uses=1]
+ br i1 %C, label %then, label %else
+then: ; preds = %entry
+ br i1 %A, label %return, label %oops
+else: ; preds = %entry
+ br i1 %A, label %oops, label %return
+oops: ; preds = %else, %then
+ call void (...)* @fail( )
+ ret void
+return: ; preds = %else, %then
+ ret void
+}
+
+define void @select2(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 10 ; <i1> [#uses=2]
+ %B = select i1 %A, i32 1, i32 2 ; <i32> [#uses=1]
+ %C = icmp eq i32 %B, 1 ; <i1> [#uses=2]
+ br i1 %A, label %then, label %else
+then: ; preds = %entry
+ br i1 %C, label %return, label %oops
+else: ; preds = %entry
+ br i1 %C, label %oops, label %return
+oops: ; preds = %else, %then
+ call void (...)* @fail( )
+ ret void
+return: ; preds = %else, %then
+ ret void
+}
+
+declare void @fail(...)
+
+declare void @pass(...)
diff --git a/test/Transforms/PredicateSimplifier/predsimplify.reg1.ll b/test/Transforms/PredicateSimplifier/predsimplify.reg1.ll
new file mode 100644
index 000000000000..e98362b5ddda
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/predsimplify.reg1.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -predsimplify -verify
+
+define void @dgefa() {
+entry:
+ br label %cond_true96
+cond_true: ; preds = %cond_true96
+ %tmp19 = icmp eq i32 %tmp10, %k.0 ; <i1> [#uses=1]
+ br i1 %tmp19, label %cond_next, label %cond_true20
+cond_true20: ; preds = %cond_true
+ br label %cond_next
+cond_next: ; preds = %cond_true20, %cond_true
+ %tmp84 = icmp sgt i32 %tmp3, 1999 ; <i1> [#uses=0]
+ ret void
+cond_true96: ; preds = %cond_true96, %entry
+ %k.0 = phi i32 [ 0, %entry ], [ 0, %cond_true96 ] ; <i32> [#uses=3]
+ %tmp3 = add i32 %k.0, 1 ; <i32> [#uses=1]
+ %tmp10 = add i32 0, %k.0 ; <i32> [#uses=1]
+ br i1 false, label %cond_true96, label %cond_true
+}
+
diff --git a/test/Transforms/PredicateSimplifier/predsimplify.reg2.ll b/test/Transforms/PredicateSimplifier/predsimplify.reg2.ll
new file mode 100644
index 000000000000..9c064eebe584
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/predsimplify.reg2.ll
@@ -0,0 +1,37 @@
+; RUN: llvm-as < %s | opt -predsimplify -verify
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+deplibs = [ "c", "crtend" ]
+ %struct.anon = type { %struct.set_family*, %struct.set_family*, %struct.set_family*, i8*, i32, i32*, %struct.pair_struct*, i8**, %struct.symbolic_t*, %struct.symbolic_t* }
+ %struct.pair_struct = type { i32, i32*, i32* }
+ %struct.set_family = type { i32, i32, i32, i32, i32, i32*, %struct.set_family* }
+ %struct.symbolic_label_t = type { i8*, %struct.symbolic_label_t* }
+ %struct.symbolic_list_t = type { i32, i32, %struct.symbolic_list_t* }
+ %struct.symbolic_t = type { %struct.symbolic_list_t*, i32, %struct.symbolic_label_t*, i32, %struct.symbolic_t* }
+
+define void @find_pairing_cost(i32 %strategy) {
+entry:
+ br i1 false, label %cond_true299, label %bb314
+bb94: ; preds = %cond_true299
+ switch i32 %strategy, label %bb246 [
+ i32 0, label %bb196
+ i32 1, label %bb159
+ ]
+cond_next113: ; preds = %cond_true299
+ switch i32 %strategy, label %bb246 [
+ i32 0, label %bb196
+ i32 1, label %bb159
+ ]
+bb159: ; preds = %cond_next113, %bb94
+ ret void
+bb196: ; preds = %cond_next113, %bb94
+ %Rsave.0.3 = phi %struct.set_family* [ null, %bb94 ], [ null, %cond_next113 ] ; <%struct.set_family*> [#uses=0]
+ ret void
+bb246: ; preds = %cond_next113, %bb94
+ br label %bb314
+cond_true299: ; preds = %entry
+ %tmp55 = icmp sgt i32 %strategy, 0 ; <i1> [#uses=1]
+ br i1 %tmp55, label %bb94, label %cond_next113
+bb314: ; preds = %bb246, %entry
+ ret void
+}
diff --git a/test/Transforms/PredicateSimplifier/predsimplify.reg3.ll b/test/Transforms/PredicateSimplifier/predsimplify.reg3.ll
new file mode 100644
index 000000000000..190cc900689e
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/predsimplify.reg3.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -predsimplify -simplifycfg | llvm-dis | grep pass
+
+define void @regtest(i32 %x) {
+entry:
+ %A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %A, label %middle, label %after
+middle: ; preds = %entry
+ br label %after
+after: ; preds = %middle, %entry
+ %B = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %B, label %then, label %else
+then: ; preds = %after
+ br label %end
+else: ; preds = %after
+ call void (...)* @pass( )
+ br label %end
+end: ; preds = %else, %then
+ ret void
+}
+
+declare void @pass(...)
+
diff --git a/test/Transforms/PredicateSimplifier/predsimplify.reg4.ll b/test/Transforms/PredicateSimplifier/predsimplify.reg4.ll
new file mode 100644
index 000000000000..092a49e7a38e
--- /dev/null
+++ b/test/Transforms/PredicateSimplifier/predsimplify.reg4.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -predsimplify -disable-output
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+
+define void @f(i32 %x, i32 %y) {
+entry:
+ %tmp = icmp eq i32 %x, 10 ; <i1> [#uses=1]
+ %tmp.not = xor i1 %tmp, true ; <i1> [#uses=1]
+ %tmp3 = icmp eq i32 %x, %y ; <i1> [#uses=1]
+ %bothcond = and i1 %tmp.not, %tmp3 ; <i1> [#uses=1]
+ br i1 %bothcond, label %cond_true4, label %return
+cond_true4: ; preds = %entry
+ switch i32 %y, label %return [
+ i32 9, label %bb
+ i32 10, label %bb6
+ ]
+bb: ; preds = %cond_true4
+ call void @g( i32 9 )
+ ret void
+bb6: ; preds = %cond_true4
+ call void @g( i32 10 )
+ ret void
+return: ; preds = %cond_true4, %entry
+ ret void
+}
+
+declare void @g(i32)
+
diff --git a/test/Transforms/PruneEH/2003-09-14-ExternalCall.ll b/test/Transforms/PruneEH/2003-09-14-ExternalCall.ll
new file mode 100644
index 000000000000..7fc912563e1f
--- /dev/null
+++ b/test/Transforms/PruneEH/2003-09-14-ExternalCall.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | grep invoke
+
+declare void @External()
+
+define void @foo() {
+ invoke void @External( )
+ to label %Cont unwind label %Cont
+Cont: ; preds = %0, %0
+ ret void
+}
+
diff --git a/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll b/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll
new file mode 100644
index 000000000000..8333cd8f722c
--- /dev/null
+++ b/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -prune-eh -disable-output
+
+define internal void @callee() {
+ ret void
+}
+
+define i32 @caller() {
+; <label>:0
+ invoke void @callee( )
+ to label %E unwind label %E
+E: ; preds = %0, %0
+ %X = phi i32 [ 0, %0 ], [ 0, %0 ] ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/PruneEH/2008-06-02-Weak.ll b/test/Transforms/PruneEH/2008-06-02-Weak.ll
new file mode 100644
index 000000000000..133200f28471
--- /dev/null
+++ b/test/Transforms/PruneEH/2008-06-02-Weak.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep nounwind
+
+define weak void @f() {
+entry:
+ ret void
+}
+
+define void @g() {
+entry:
+ call void @f()
+ ret void
+}
diff --git a/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll b/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll
new file mode 100644
index 000000000000..c3600ab84c7c
--- /dev/null
+++ b/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll
@@ -0,0 +1,1445 @@
+; RUN: llvm-as < %s | opt -prune-eh -inline -print-callgraph \
+; RUN: -disable-output |& \
+; RUN: grep {Calls.*ce3806g__fxio__put__put_int64__4.1339} | count 2
+ %struct.FRAME.ce3806g = type { %struct.string___XUB, %struct.string___XUB, %struct.string___XUB, %struct.string___XUB }
+ %struct.FRAME.ce3806g__fxio__put__4 = type { i32, i32, i32, %struct.system__file_control_block__pstring*, i32, i32, i8 }
+ %struct.RETURN = type { i8, i32 }
+ %struct.ada__streams__root_stream_type = type { %struct.ada__tags__dispatch_table* }
+ %struct.ada__tags__dispatch_table = type { [1 x i32] }
+ %struct.ada__tags__select_specific_data = type { i32, %struct.ada__tags__select_specific_data_element }
+ %struct.ada__tags__select_specific_data_element = type { i32, i8 }
+ %struct.ada__tags__type_specific_data = type { i32, i32, [2147483647 x i8]*, [2147483647 x i8]*, %struct.ada__tags__dispatch_table*, i8, i32, i32, i32, i32, [2 x %struct.ada__tags__dispatch_table*] }
+ %struct.ada__text_io__text_afcb = type { %struct.system__file_control_block__afcb, i32, i32, i32, i32, i32, %struct.ada__text_io__text_afcb*, i8, i8 }
+ %struct.exception = type { i8, i8, i32, i8*, i8*, i32, i8* }
+ %struct.long_long_float___PAD = type { x86_fp80, [1 x i32] }
+ %struct.string___XUB = type { i32, i32 }
+ %struct.system__file_control_block__afcb = type { %struct.ada__streams__root_stream_type, i32, %struct.system__file_control_block__pstring, %struct.system__file_control_block__pstring, i8, i8, i8, i8, i8, i8, i8, %struct.system__file_control_block__afcb*, %struct.system__file_control_block__afcb* }
+ %struct.system__file_control_block__pstring = type { i8*, %struct.string___XUB* }
+ %struct.system__finalization_implementation__limited_record_controller = type { %struct.system__finalization_root__root_controlled, %struct.system__finalization_root__root_controlled* }
+ %struct.system__finalization_implementation__record_controller = type { %struct.system__finalization_implementation__limited_record_controller, i32 }
+ %struct.system__finalization_root__empty_root_controlled = type { %struct.ada__tags__dispatch_table* }
+ %struct.system__finalization_root__root_controlled = type { %struct.ada__streams__root_stream_type, %struct.system__finalization_root__root_controlled*, %struct.system__finalization_root__root_controlled* }
+ %struct.system__secondary_stack__mark_id = type { i32, i32 }
+ %struct.system__standard_library__exception_data = type { i8, i8, i32, i32, %struct.system__standard_library__exception_data*, i32, void ()* }
+@.str = internal constant [12 x i8] c"system.ads\00\00" ; <[12 x i8]*> [#uses=1]
+@.str1 = internal constant [14 x i8] c"a-tifiio.adb\00\00" ; <[14 x i8]*> [#uses=1]
+@system__soft_links__abort_undefer = external global void ()* ; <void ()**> [#uses=6]
+@.str2 = internal constant [47 x i8] c"a-tifiio.adb:327 instantiated at ce3806g.adb:52" ; <[47 x i8]*> [#uses=1]
+@C.354.2200 = internal constant %struct.string___XUB { i32 1, i32 47 } ; <%struct.string___XUB*> [#uses=1]
+@ada__io_exceptions__data_error = external global %struct.exception ; <%struct.exception*> [#uses=1]
+@constraint_error = external global %struct.exception ; <%struct.exception*> [#uses=2]
+@__gnat_all_others_value = external constant i32 ; <i32*> [#uses=21]
+@.str3 = internal constant [10 x i8] c"0123456789" ; <[10 x i8]*> [#uses=2]
+@ada__text_io__current_out = external global %struct.ada__text_io__text_afcb* ; <%struct.ada__text_io__text_afcb**> [#uses=1]
+@.str4 = internal constant [126 x i8] c"CHECK THAT FIXED_IO PUT OPERATES ON FILES OF MODE OUT_FILE AND IF NO FILE IS SPECIFIED THE CURRENT DEFAULT OUTPUT FILE IS USED" ; <[126 x i8]*> [#uses=1]
+@C.131.1559 = internal constant %struct.string___XUB { i32 1, i32 126 } ; <%struct.string___XUB*> [#uses=1]
+@.str5 = internal constant [7 x i8] c"CE3806G" ; <[7 x i8]*> [#uses=1]
+@C.132.1562 = internal constant %struct.string___XUB { i32 1, i32 7 } ; <%struct.string___XUB*> [#uses=1]
+@incompleteF.1176.b = internal global i1 false ; <i1*> [#uses=2]
+@incomplete.1177 = internal global %struct.exception { i8 0, i8 65, i32 23, i8* getelementptr ([23 x i8]* @incompleteE.1174, i32 0, i32 0), i8* null, i32 0, i8* null } ; <%struct.exception*> [#uses=15]
+@incompleteE.1174 = internal global [23 x i8] c"CE3806G.B_1.INCOMPLETE\00" ; <[23 x i8]*> [#uses=1]
+@.str6 = internal constant [0 x i8] zeroinitializer ; <[0 x i8]*> [#uses=1]
+@C.136.1568 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@C.137.1571 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@.str7 = internal constant [50 x i8] c"USE_ERROR RAISED ON TEXT CREATE WITH OUT_FILE MODE" ; <[50 x i8]*> [#uses=1]
+@C.139.1577 = internal constant %struct.string___XUB { i32 1, i32 50 } ; <%struct.string___XUB*> [#uses=1]
+@.str8 = internal constant [14 x i8] c"ce3806g.adb:65" ; <[14 x i8]*> [#uses=1]
+@C.140.1580 = internal constant %struct.string___XUB { i32 1, i32 14 } ; <%struct.string___XUB*> [#uses=1]
+@.str9 = internal constant [51 x i8] c"NAME_ERROR RAISED ON TEXT CREATE WITH OUT_FILE MODE" ; <[51 x i8]*> [#uses=1]
+@C.143.1585 = internal constant %struct.string___XUB { i32 1, i32 51 } ; <%struct.string___XUB*> [#uses=1]
+@.str10 = internal constant [14 x i8] c"ce3806g.adb:69" ; <[14 x i8]*> [#uses=1]
+@C.144.1588 = internal constant %struct.string___XUB { i32 1, i32 14 } ; <%struct.string___XUB*> [#uses=1]
+@C.146.1592 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@C.147.1595 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@C.153.1609 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@C.154.1612 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@.str12 = internal constant [47 x i8] c"USE_ERROR RAISED ON TEXT OPEN WITH IN_FILE MODE" ; <[47 x i8]*> [#uses=1]
+@C.156.1618 = internal constant %struct.string___XUB { i32 1, i32 47 } ; <%struct.string___XUB*> [#uses=1]
+@.str13 = internal constant [14 x i8] c"ce3806g.adb:88" ; <[14 x i8]*> [#uses=1]
+@C.157.1621 = internal constant %struct.string___XUB { i32 1, i32 14 } ; <%struct.string___XUB*> [#uses=1]
+@C.159.1627 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@C.160.1630 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1]
+@.str14 = internal constant [33 x i8] c"VALUE INCORRECT - FIXED FROM FILE" ; <[33 x i8]*> [#uses=1]
+@C.162.1637 = internal constant %struct.string___XUB { i32 1, i32 33 } ; <%struct.string___XUB*> [#uses=1]
+@.str15 = internal constant [36 x i8] c"VALUE INCORRECT - FIXED FROM DEFAULT" ; <[36 x i8]*> [#uses=1]
+@C.164.1642 = internal constant %struct.string___XUB { i32 1, i32 36 } ; <%struct.string___XUB*> [#uses=1]
+@ada__io_exceptions__use_error = external global %struct.exception ; <%struct.exception*> [#uses=4]
+@ada__io_exceptions__name_error = external global %struct.exception ; <%struct.exception*> [#uses=2]
+
+define void @_ada_ce3806g() {
+entry:
+ %0 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3]
+ %1 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3]
+ %2 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3]
+ %3 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3]
+ %FRAME.356 = alloca %struct.FRAME.ce3806g ; <%struct.FRAME.ce3806g*> [#uses=20]
+ call void @report__test( i8* getelementptr ([7 x i8]* @.str5, i32 0, i32 0), %struct.string___XUB* @C.132.1562, i8* getelementptr ([126 x i8]* @.str4, i32 0, i32 0), %struct.string___XUB* @C.131.1559 )
+ %4 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3 ; <%struct.string___XUB*> [#uses=1]
+ call void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %4 )
+ %.b = load i1* @incompleteF.1176.b ; <i1> [#uses=1]
+ br i1 %.b, label %bb11, label %bb
+
+bb: ; preds = %entry
+ invoke void @system__exception_table__register_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*) )
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %bb
+ store i1 true, i1* @incompleteF.1176.b
+ br label %bb11
+
+bb11: ; preds = %entry, %invcont
+ %5 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2 ; <%struct.string___XUB*> [#uses=1]
+ invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %5 )
+ to label %invcont12 unwind label %lpad228
+
+invcont12: ; preds = %bb11
+ invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %3, i32 1, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.137.1571 )
+ to label %invcont17 unwind label %lpad232
+
+invcont17: ; preds = %invcont12
+ %elt18 = getelementptr %struct.system__file_control_block__pstring* %3, i32 0, i32 0 ; <i8**> [#uses=1]
+ %val19 = load i8** %elt18, align 8 ; <i8*> [#uses=1]
+ %elt20 = getelementptr %struct.system__file_control_block__pstring* %3, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1]
+ %val21 = load %struct.string___XUB** %elt20 ; <%struct.string___XUB*> [#uses=1]
+ %6 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__create( %struct.ada__text_io__text_afcb* null, i8 2, i8* %val19, %struct.string___XUB* %val21, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
+ to label %invcont26 unwind label %lpad232 ; <%struct.ada__text_io__text_afcb*> [#uses=2]
+
+invcont26: ; preds = %invcont17
+ %7 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 0 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 8 ; <i32> [#uses=1]
+ %9 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 1 ; <i32*> [#uses=1]
+ %10 = load i32* %9, align 4 ; <i32> [#uses=1]
+ invoke void @system__secondary_stack__ss_release( i32 %8, i32 %10 )
+ to label %bb73 unwind label %lpad228
+
+bb32: ; preds = %lpad232
+ call void @__gnat_begin_handler( i8* %eh_ptr233 ) nounwind
+ %11 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1]
+ invoke void %11( )
+ to label %invcont33 unwind label %lpad240
+
+invcont33: ; preds = %bb32
+ invoke void @report__not_applicable( i8* getelementptr ([50 x i8]* @.str7, i32 0, i32 0), %struct.string___XUB* @C.139.1577 )
+ to label %invcont38 unwind label %lpad240
+
+invcont38: ; preds = %invcont33
+ invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str8, i32 0, i32 0), %struct.string___XUB* @C.140.1580 ) noreturn
+ to label %invcont43 unwind label %lpad240
+
+invcont43: ; preds = %invcont38
+ unreachable
+
+bb47: ; preds = %ppad291
+ call void @__gnat_begin_handler( i8* %eh_ptr233 ) nounwind
+ %12 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1]
+ invoke void %12( )
+ to label %invcont49 unwind label %lpad248
+
+invcont49: ; preds = %bb47
+ invoke void @report__not_applicable( i8* getelementptr ([51 x i8]* @.str9, i32 0, i32 0), %struct.string___XUB* @C.143.1585 )
+ to label %invcont54 unwind label %lpad248
+
+invcont54: ; preds = %invcont49
+ invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str10, i32 0, i32 0), %struct.string___XUB* @C.144.1588 ) noreturn
+ to label %invcont59 unwind label %lpad248
+
+invcont59: ; preds = %invcont54
+ unreachable
+
+bb73: ; preds = %invcont26
+ invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %2, i32 2, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.147.1595 )
+ to label %invcont78 unwind label %lpad228
+
+invcont78: ; preds = %bb73
+ %elt79 = getelementptr %struct.system__file_control_block__pstring* %2, i32 0, i32 0 ; <i8**> [#uses=1]
+ %val80 = load i8** %elt79, align 8 ; <i8*> [#uses=1]
+ %elt81 = getelementptr %struct.system__file_control_block__pstring* %2, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1]
+ %val82 = load %struct.string___XUB** %elt81 ; <%struct.string___XUB*> [#uses=1]
+ %13 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__create( %struct.ada__text_io__text_afcb* null, i8 2, i8* %val80, %struct.string___XUB* %val82, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.146.1592 )
+ to label %invcont87 unwind label %lpad228 ; <%struct.ada__text_io__text_afcb*> [#uses=2]
+
+invcont87: ; preds = %invcont78
+ invoke void @ada__text_io__set_output( %struct.ada__text_io__text_afcb* %13 )
+ to label %invcont88 unwind label %lpad228
+
+invcont88: ; preds = %invcont87
+ %14 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1 ; <%struct.string___XUB*> [#uses=1]
+ invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %14 )
+ to label %invcont89 unwind label %lpad228
+
+invcont89: ; preds = %invcont88
+ invoke fastcc void @ce3806g__fxio__put.1149( %struct.ada__text_io__text_afcb* %6 )
+ to label %bb94 unwind label %lpad252
+
+bb94: ; preds = %invcont89
+ invoke fastcc void @ce3806g__fxio__put__2.1155( )
+ to label %invcont95 unwind label %lpad252
+
+invcont95: ; preds = %bb94
+ %15 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__close( %struct.ada__text_io__text_afcb* %6 )
+ to label %invcont96 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=1]
+
+invcont96: ; preds = %invcont95
+ %16 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0 ; <%struct.string___XUB*> [#uses=1]
+ invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %16 )
+ to label %invcont97 unwind label %lpad252
+
+invcont97: ; preds = %invcont96
+ invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %1, i32 1, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.154.1612 )
+ to label %invcont102 unwind label %lpad256
+
+invcont102: ; preds = %invcont97
+ %elt103 = getelementptr %struct.system__file_control_block__pstring* %1, i32 0, i32 0 ; <i8**> [#uses=1]
+ %val104 = load i8** %elt103, align 8 ; <i8*> [#uses=1]
+ %elt105 = getelementptr %struct.system__file_control_block__pstring* %1, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1]
+ %val106 = load %struct.string___XUB** %elt105 ; <%struct.string___XUB*> [#uses=1]
+ %17 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__open( %struct.ada__text_io__text_afcb* %15, i8 0, i8* %val104, %struct.string___XUB* %val106, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.153.1609 )
+ to label %invcont111 unwind label %lpad256 ; <%struct.ada__text_io__text_afcb*> [#uses=2]
+
+invcont111: ; preds = %invcont102
+ %18 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %19 = load i32* %18, align 8 ; <i32> [#uses=1]
+ %20 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %21 = load i32* %20, align 4 ; <i32> [#uses=1]
+ invoke void @system__secondary_stack__ss_release( i32 %19, i32 %21 )
+ to label %bb143 unwind label %lpad252
+
+bb117: ; preds = %lpad256
+ call void @__gnat_begin_handler( i8* %eh_ptr257 ) nounwind
+ %22 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1]
+ invoke void %22( )
+ to label %invcont119 unwind label %lpad264
+
+invcont119: ; preds = %bb117
+ invoke void @report__not_applicable( i8* getelementptr ([47 x i8]* @.str12, i32 0, i32 0), %struct.string___XUB* @C.156.1618 )
+ to label %invcont124 unwind label %lpad264
+
+invcont124: ; preds = %invcont119
+ invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str13, i32 0, i32 0), %struct.string___XUB* @C.157.1621 ) noreturn
+ to label %invcont129 unwind label %lpad264
+
+invcont129: ; preds = %invcont124
+ unreachable
+
+bb143: ; preds = %invcont111
+ %23 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__standard_output( )
+ to label %invcont144 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=1]
+
+invcont144: ; preds = %bb143
+ invoke void @ada__text_io__set_output( %struct.ada__text_io__text_afcb* %23 )
+ to label %invcont145 unwind label %lpad252
+
+invcont145: ; preds = %invcont144
+ %24 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__close( %struct.ada__text_io__text_afcb* %13 )
+ to label %invcont146 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=1]
+
+invcont146: ; preds = %invcont145
+ invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %0, i32 2, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.160.1630 )
+ to label %invcont151 unwind label %lpad252
+
+invcont151: ; preds = %invcont146
+ %elt152 = getelementptr %struct.system__file_control_block__pstring* %0, i32 0, i32 0 ; <i8**> [#uses=1]
+ %val153 = load i8** %elt152, align 8 ; <i8*> [#uses=1]
+ %elt154 = getelementptr %struct.system__file_control_block__pstring* %0, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1]
+ %val155 = load %struct.string___XUB** %elt154 ; <%struct.string___XUB*> [#uses=1]
+ %25 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__open( %struct.ada__text_io__text_afcb* %24, i8 0, i8* %val153, %struct.string___XUB* %val155, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.159.1627 )
+ to label %invcont160 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=2]
+
+invcont160: ; preds = %invcont151
+ %26 = invoke fastcc i8 @ce3806g__fxio__get.1137( %struct.ada__text_io__text_afcb* %17 ) signext
+ to label %invcont161 unwind label %lpad252 ; <i8> [#uses=1]
+
+invcont161: ; preds = %invcont160
+ %27 = icmp eq i8 %26, -3 ; <i1> [#uses=1]
+ br i1 %27, label %bb169, label %bb163
+
+bb163: ; preds = %invcont161
+ invoke void @report__failed( i8* getelementptr ([33 x i8]* @.str14, i32 0, i32 0), %struct.string___XUB* @C.162.1637 )
+ to label %bb169 unwind label %lpad252
+
+bb169: ; preds = %invcont161, %bb163
+ %28 = invoke fastcc i8 @ce3806g__fxio__get.1137( %struct.ada__text_io__text_afcb* %25 ) signext
+ to label %invcont170 unwind label %lpad252 ; <i8> [#uses=1]
+
+invcont170: ; preds = %bb169
+ %29 = icmp eq i8 %28, -1 ; <i1> [#uses=1]
+ br i1 %29, label %bb187, label %bb172
+
+bb172: ; preds = %invcont170
+ invoke void @report__failed( i8* getelementptr ([36 x i8]* @.str15, i32 0, i32 0), %struct.string___XUB* @C.164.1642 )
+ to label %bb187 unwind label %lpad252
+
+bb187: ; preds = %invcont170, %bb172
+ %30 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
+ %31 = load i32* %30, align 8 ; <i32> [#uses=1]
+ %32 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 1 ; <i32*> [#uses=1]
+ %33 = load i32* %32, align 4 ; <i32> [#uses=1]
+ invoke void @system__secondary_stack__ss_release( i32 %31, i32 %33 )
+ to label %bb193 unwind label %lpad228
+
+bb193: ; preds = %bb187
+ %34 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__delete( %struct.ada__text_io__text_afcb* %17 )
+ to label %invcont194 unwind label %lpad268 ; <%struct.ada__text_io__text_afcb*> [#uses=0]
+
+invcont194: ; preds = %bb193
+ %35 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__delete( %struct.ada__text_io__text_afcb* %25 )
+ to label %bb221 unwind label %lpad268 ; <%struct.ada__text_io__text_afcb*> [#uses=0]
+
+bb196: ; preds = %lpad268
+ call void @__gnat_begin_handler( i8* %eh_ptr269 ) nounwind
+ %36 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1]
+ invoke void %36( )
+ to label %bb203 unwind label %lpad276
+
+bb203: ; preds = %bb196
+ invoke void @__gnat_end_handler( i8* %eh_ptr269 )
+ to label %bb221 unwind label %lpad272
+
+bb205: ; preds = %ppad304
+ call void @__gnat_begin_handler( i8* %eh_exception.1 ) nounwind
+ %37 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1]
+ invoke void %37( )
+ to label %bb212 unwind label %lpad284
+
+bb212: ; preds = %bb205
+ invoke void @__gnat_end_handler( i8* %eh_exception.1 )
+ to label %bb221 unwind label %lpad280
+
+bb221: ; preds = %invcont194, %bb212, %bb203
+ %38 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 0 ; <i32*> [#uses=1]
+ %39 = load i32* %38, align 8 ; <i32> [#uses=1]
+ %40 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 1 ; <i32*> [#uses=1]
+ %41 = load i32* %40, align 4 ; <i32> [#uses=1]
+ call void @system__secondary_stack__ss_release( i32 %39, i32 %41 )
+ call void @report__result( )
+ ret void
+
+lpad: ; preds = %bb
+ %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select227 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ br label %ppad
+
+lpad228: ; preds = %bb187, %ppad294, %invcont88, %invcont87, %invcont78, %bb73, %ppad288, %invcont26, %bb11
+ %eh_ptr229 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select231 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr229, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ br label %ppad304
+
+lpad232: ; preds = %invcont17, %invcont12
+ %eh_ptr233 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=6]
+ %eh_select235 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr233, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @ada__io_exceptions__name_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=3]
+ %eh_typeid = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %42 = icmp eq i32 %eh_select235, %eh_typeid ; <i1> [#uses=1]
+ br i1 %42, label %bb32, label %ppad291
+
+lpad236: ; preds = %lpad240
+ %eh_ptr237 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select239 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr237, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ br label %ppad288
+
+lpad240: ; preds = %invcont38, %invcont33, %bb32
+ %eh_ptr241 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select243 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr241, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ invoke void @__gnat_end_handler( i8* %eh_ptr233 )
+ to label %ppad288 unwind label %lpad236
+
+lpad244: ; preds = %lpad248
+ %eh_ptr245 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select247 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr245, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ br label %ppad288
+
+lpad248: ; preds = %invcont54, %invcont49, %bb47
+ %eh_ptr249 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select251 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr249, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ invoke void @__gnat_end_handler( i8* %eh_ptr233 )
+ to label %ppad288 unwind label %lpad244
+
+lpad252: ; preds = %bb94, %invcont89, %invcont160, %bb169, %bb172, %bb163, %invcont151, %invcont146, %invcont145, %invcont144, %bb143, %ppad295, %invcont111, %invcont96, %invcont95
+ %eh_ptr253 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select255 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr253, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ br label %ppad294
+
+lpad256: ; preds = %invcont102, %invcont97
+ %eh_ptr257 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=4]
+ %eh_select259 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr257, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=2]
+ %eh_typeid297 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %43 = icmp eq i32 %eh_select259, %eh_typeid297 ; <i1> [#uses=1]
+ br i1 %43, label %bb117, label %ppad295
+
+lpad260: ; preds = %lpad264
+ %eh_ptr261 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select263 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr261, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ br label %ppad295
+
+lpad264: ; preds = %invcont124, %invcont119, %bb117
+ %eh_ptr265 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select267 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr265, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ invoke void @__gnat_end_handler( i8* %eh_ptr257 )
+ to label %ppad295 unwind label %lpad260
+
+lpad268: ; preds = %invcont194, %bb193
+ %eh_ptr269 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=5]
+ %eh_select271 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr269, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=2]
+ %eh_typeid301 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %44 = icmp eq i32 %eh_select271, %eh_typeid301 ; <i1> [#uses=1]
+ br i1 %44, label %bb196, label %ppad304
+
+lpad272: ; preds = %bb203, %lpad276
+ %eh_ptr273 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select275 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr273, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ br label %ppad304
+
+lpad276: ; preds = %bb196
+ %eh_ptr277 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select279 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr277, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ invoke void @__gnat_end_handler( i8* %eh_ptr269 )
+ to label %ppad304 unwind label %lpad272
+
+lpad280: ; preds = %bb212, %lpad284
+ %eh_ptr281 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select283 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr281, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ br label %ppad
+
+lpad284: ; preds = %bb205
+ %eh_ptr285 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select287 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr285, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ invoke void @__gnat_end_handler( i8* %eh_exception.1 )
+ to label %ppad unwind label %lpad280
+
+ppad: ; preds = %lpad284, %ppad304, %lpad280, %lpad
+ %eh_exception.2 = phi i8* [ %eh_exception.1, %ppad304 ], [ %eh_ptr281, %lpad280 ], [ %eh_ptr, %lpad ], [ %eh_ptr285, %lpad284 ] ; <i8*> [#uses=1]
+ %45 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 0 ; <i32*> [#uses=1]
+ %46 = load i32* %45, align 8 ; <i32> [#uses=1]
+ %47 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 1 ; <i32*> [#uses=1]
+ %48 = load i32* %47, align 4 ; <i32> [#uses=1]
+ call void @system__secondary_stack__ss_release( i32 %46, i32 %48 )
+ %49 = call i32 (...)* @_Unwind_Resume( i8* %eh_exception.2 ) ; <i32> [#uses=0]
+ unreachable
+
+ppad288: ; preds = %lpad248, %lpad240, %ppad291, %lpad244, %lpad236
+ %eh_exception.0 = phi i8* [ %eh_ptr233, %ppad291 ], [ %eh_ptr245, %lpad244 ], [ %eh_ptr237, %lpad236 ], [ %eh_ptr241, %lpad240 ], [ %eh_ptr249, %lpad248 ] ; <i8*> [#uses=1]
+ %eh_selector.0 = phi i32 [ %eh_select235, %ppad291 ], [ %eh_select247, %lpad244 ], [ %eh_select239, %lpad236 ], [ %eh_select243, %lpad240 ], [ %eh_select251, %lpad248 ] ; <i32> [#uses=1]
+ %50 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 0 ; <i32*> [#uses=1]
+ %51 = load i32* %50, align 8 ; <i32> [#uses=1]
+ %52 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 1 ; <i32*> [#uses=1]
+ %53 = load i32* %52, align 4 ; <i32> [#uses=1]
+ invoke void @system__secondary_stack__ss_release( i32 %51, i32 %53 )
+ to label %ppad304 unwind label %lpad228
+
+ppad291: ; preds = %lpad232
+ %eh_typeid292 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__name_error, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %54 = icmp eq i32 %eh_select235, %eh_typeid292 ; <i1> [#uses=1]
+ br i1 %54, label %bb47, label %ppad288
+
+ppad294: ; preds = %ppad295, %lpad252
+ %eh_exception.4 = phi i8* [ %eh_ptr253, %lpad252 ], [ %eh_exception.3, %ppad295 ] ; <i8*> [#uses=1]
+ %eh_selector.4 = phi i32 [ %eh_select255, %lpad252 ], [ %eh_selector.3, %ppad295 ] ; <i32> [#uses=1]
+ %55 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
+ %56 = load i32* %55, align 8 ; <i32> [#uses=1]
+ %57 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 1 ; <i32*> [#uses=1]
+ %58 = load i32* %57, align 4 ; <i32> [#uses=1]
+ invoke void @system__secondary_stack__ss_release( i32 %56, i32 %58 )
+ to label %ppad304 unwind label %lpad228
+
+ppad295: ; preds = %lpad264, %lpad256, %lpad260
+ %eh_exception.3 = phi i8* [ %eh_ptr257, %lpad256 ], [ %eh_ptr261, %lpad260 ], [ %eh_ptr265, %lpad264 ] ; <i8*> [#uses=1]
+ %eh_selector.3 = phi i32 [ %eh_select259, %lpad256 ], [ %eh_select263, %lpad260 ], [ %eh_select267, %lpad264 ] ; <i32> [#uses=1]
+ %59 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %60 = load i32* %59, align 8 ; <i32> [#uses=1]
+ %61 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %62 = load i32* %61, align 4 ; <i32> [#uses=1]
+ invoke void @system__secondary_stack__ss_release( i32 %60, i32 %62 )
+ to label %ppad294 unwind label %lpad252
+
+ppad304: ; preds = %lpad276, %ppad294, %ppad288, %lpad268, %lpad272, %lpad228
+ %eh_exception.1 = phi i8* [ %eh_ptr229, %lpad228 ], [ %eh_ptr269, %lpad268 ], [ %eh_ptr273, %lpad272 ], [ %eh_exception.0, %ppad288 ], [ %eh_exception.4, %ppad294 ], [ %eh_ptr277, %lpad276 ] ; <i8*> [#uses=4]
+ %eh_selector.1 = phi i32 [ %eh_select231, %lpad228 ], [ %eh_select271, %lpad268 ], [ %eh_select275, %lpad272 ], [ %eh_selector.0, %ppad288 ], [ %eh_selector.4, %ppad294 ], [ %eh_select279, %lpad276 ] ; <i32> [#uses=1]
+ %eh_typeid305 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @incomplete.1177, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %63 = icmp eq i32 %eh_selector.1, %eh_typeid305 ; <i1> [#uses=1]
+ br i1 %63, label %bb205, label %ppad
+}
+
+define internal fastcc i8 @ce3806g__fxio__get.1137(%struct.ada__text_io__text_afcb* %file) signext {
+entry:
+ %0 = invoke x86_fp80 @ada__text_io__float_aux__get( %struct.ada__text_io__text_afcb* %file, i32 0 )
+ to label %invcont unwind label %lpad ; <x86_fp80> [#uses=5]
+
+invcont: ; preds = %entry
+ %1 = fcmp ult x86_fp80 %0, 0xKFFFEFFFFFFFFFFFFFFFF ; <i1> [#uses=1]
+ %2 = fcmp ugt x86_fp80 %0, 0xK7FFEFFFFFFFFFFFFFFFF ; <i1> [#uses=1]
+ %or.cond = or i1 %1, %2 ; <i1> [#uses=1]
+ br i1 %or.cond, label %bb2, label %bb4
+
+bb2: ; preds = %invcont
+ invoke void @__gnat_rcheck_12( i8* getelementptr ([12 x i8]* @.str, i32 0, i32 0), i32 1 ) noreturn
+ to label %invcont3 unwind label %lpad
+
+invcont3: ; preds = %bb2
+ unreachable
+
+bb4: ; preds = %invcont
+ %3 = mul x86_fp80 %0, 0xK40008000000000000000 ; <x86_fp80> [#uses=1]
+ %4 = fcmp ult x86_fp80 %3, 0xKC0068000000000000000 ; <i1> [#uses=1]
+ br i1 %4, label %bb8, label %bb6
+
+bb6: ; preds = %bb4
+ %5 = mul x86_fp80 %0, 0xK40008000000000000000 ; <x86_fp80> [#uses=1]
+ %6 = fcmp ugt x86_fp80 %5, 0xK4005FE00000000000000 ; <i1> [#uses=1]
+ br i1 %6, label %bb8, label %bb10
+
+bb8: ; preds = %bb4, %bb6
+ invoke void @__gnat_rcheck_10( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn
+ to label %invcont9 unwind label %lpad
+
+invcont9: ; preds = %bb8
+ unreachable
+
+bb10: ; preds = %bb6
+ %7 = mul x86_fp80 %0, 0xK40008000000000000000 ; <x86_fp80> [#uses=3]
+ %8 = fcmp ult x86_fp80 %7, 0xK00000000000000000000 ; <i1> [#uses=1]
+ br i1 %8, label %bb13, label %bb12
+
+bb12: ; preds = %bb10
+ %9 = add x86_fp80 %7, 0xK3FFDFFFFFFFFFFFFFFFF ; <x86_fp80> [#uses=1]
+ br label %bb14
+
+bb13: ; preds = %bb10
+ %10 = sub x86_fp80 %7, 0xK3FFDFFFFFFFFFFFFFFFF ; <x86_fp80> [#uses=1]
+ br label %bb14
+
+bb14: ; preds = %bb13, %bb12
+ %iftmp.339.0.in = phi x86_fp80 [ %10, %bb13 ], [ %9, %bb12 ] ; <x86_fp80> [#uses=1]
+ %iftmp.339.0 = fptosi x86_fp80 %iftmp.339.0.in to i8 ; <i8> [#uses=3]
+ %11 = add i8 %iftmp.339.0, 20 ; <i8> [#uses=1]
+ %12 = icmp ugt i8 %11, 40 ; <i1> [#uses=1]
+ br i1 %12, label %bb16, label %bb18
+
+bb16: ; preds = %bb14
+ invoke void @__gnat_rcheck_12( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn
+ to label %invcont17 unwind label %lpad
+
+invcont17: ; preds = %bb16
+ unreachable
+
+bb18: ; preds = %bb14
+ %13 = add i8 %iftmp.339.0, 20 ; <i8> [#uses=1]
+ %14 = icmp ugt i8 %13, 40 ; <i1> [#uses=1]
+ br i1 %14, label %bb20, label %bb22
+
+bb20: ; preds = %bb18
+ invoke void @__gnat_rcheck_12( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn
+ to label %invcont21 unwind label %lpad
+
+invcont21: ; preds = %bb20
+ unreachable
+
+bb22: ; preds = %bb18
+ ret i8 %iftmp.339.0
+
+bb23: ; preds = %lpad
+ call void @__gnat_begin_handler( i8* %eh_ptr ) nounwind
+ %15 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1]
+ invoke void %15( )
+ to label %invcont24 unwind label %lpad33
+
+invcont24: ; preds = %bb23
+ invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @ada__io_exceptions__data_error to %struct.system__standard_library__exception_data*), i8* getelementptr ([47 x i8]* @.str2, i32 0, i32 0), %struct.string___XUB* @C.354.2200 ) noreturn
+ to label %invcont27 unwind label %lpad33
+
+invcont27: ; preds = %invcont24
+ unreachable
+
+lpad: ; preds = %bb20, %bb16, %bb8, %bb2, %entry
+ %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=4]
+ %eh_select32 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @constraint_error, i32* @__gnat_all_others_value ) ; <i32> [#uses=1]
+ %eh_typeid = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @constraint_error, i32 0, i32 0) ) ; <i32> [#uses=1]
+ %16 = icmp eq i32 %eh_select32, %eh_typeid ; <i1> [#uses=1]
+ br i1 %16, label %bb23, label %Unwind
+
+lpad33: ; preds = %invcont24, %bb23
+ %eh_ptr34 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select36 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr34, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ call void @__gnat_end_handler( i8* %eh_ptr )
+ br label %Unwind
+
+Unwind: ; preds = %lpad, %lpad33
+ %eh_exception.0 = phi i8* [ %eh_ptr, %lpad ], [ %eh_ptr34, %lpad33 ] ; <i8*> [#uses=1]
+ %17 = call i32 (...)* @_Unwind_Resume( i8* %eh_exception.0 ) ; <i32> [#uses=0]
+ unreachable
+}
+
+define internal fastcc void @ce3806g__fxio__put.1149(%struct.ada__text_io__text_afcb* %file) {
+entry:
+ %A.301 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3]
+ %A.292 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3]
+ %0 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %1 = alloca [12 x i8] ; <[12 x i8]*> [#uses=1]
+ %.sub = getelementptr [12 x i8]* %1, i32 0, i32 0 ; <i8*> [#uses=2]
+ %2 = getelementptr %struct.string___XUB* %A.292, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %2, align 8
+ %3 = getelementptr %struct.string___XUB* %A.292, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 12, i32* %3, align 4
+ %4 = invoke fastcc i32 @ce3806g__fxio__put__4.1215( i8* %.sub, %struct.string___XUB* %A.292, i8 signext -3 )
+ to label %invcont unwind label %lpad ; <i32> [#uses=1]
+
+invcont: ; preds = %entry
+ %5 = getelementptr %struct.string___XUB* %A.301, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %5, align 8
+ %6 = getelementptr %struct.string___XUB* %A.301, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %4, i32* %6, align 4
+ invoke void @ada__text_io__generic_aux__put_item( %struct.ada__text_io__text_afcb* %file, i8* %.sub, %struct.string___XUB* %A.301 )
+ to label %bb60 unwind label %lpad
+
+bb60: ; preds = %invcont
+ ret void
+
+lpad: ; preds = %entry, %invcont
+ %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select62 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ call void @llvm.stackrestore( i8* %0 )
+ %7 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32> [#uses=0]
+ unreachable
+}
+
+define internal fastcc void @ce3806g__fxio__put__2.1155() {
+entry:
+ %A.266 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3]
+ %A.257 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3]
+ %0 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %1 = alloca [12 x i8] ; <[12 x i8]*> [#uses=1]
+ %.sub = getelementptr [12 x i8]* %1, i32 0, i32 0 ; <i8*> [#uses=2]
+ %2 = getelementptr %struct.string___XUB* %A.257, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %2, align 8
+ %3 = getelementptr %struct.string___XUB* %A.257, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 12, i32* %3, align 4
+ %4 = invoke fastcc i32 @ce3806g__fxio__put__4.1215( i8* %.sub, %struct.string___XUB* %A.257, i8 signext -1 )
+ to label %invcont unwind label %lpad ; <i32> [#uses=1]
+
+invcont: ; preds = %entry
+ %5 = getelementptr %struct.string___XUB* %A.266, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %5, align 8
+ %6 = getelementptr %struct.string___XUB* %A.266, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %4, i32* %6, align 4
+ %7 = load %struct.ada__text_io__text_afcb** @ada__text_io__current_out, align 4 ; <%struct.ada__text_io__text_afcb*> [#uses=1]
+ invoke void @ada__text_io__generic_aux__put_item( %struct.ada__text_io__text_afcb* %7, i8* %.sub, %struct.string___XUB* %A.266 )
+ to label %bb60 unwind label %lpad
+
+bb60: ; preds = %invcont
+ ret void
+
+lpad: ; preds = %entry, %invcont
+ %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select62 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ call void @llvm.stackrestore( i8* %0 )
+ %8 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32> [#uses=0]
+ unreachable
+}
+
+define internal fastcc i32 @ce3806g__fxio__put__4.1215(i8* %to.0, %struct.string___XUB* %to.1, i8 signext %item) {
+entry:
+ %P0 = load i32 * @__gnat_all_others_value, align 4 ; <i32*> [#uses=1]
+ %P = alloca i32, i32 %P0 ; <i32*> [#uses=1]
+ call void @ext( i32* %P )
+ %to_addr = alloca %struct.system__file_control_block__pstring ; <%struct.system__file_control_block__pstring*> [#uses=4]
+ %FRAME.358 = alloca %struct.FRAME.ce3806g__fxio__put__4 ; <%struct.FRAME.ce3806g__fxio__put__4*> [#uses=65]
+ %0 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 0 ; <i8**> [#uses=1]
+ store i8* %to.0, i8** %0, align 8
+ %1 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1]
+ store %struct.string___XUB* %to.1, %struct.string___XUB** %1
+ %2 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ store %struct.system__file_control_block__pstring* %to_addr, %struct.system__file_control_block__pstring** %2, align 4
+ %3 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 3, i32* %3, align 8
+ %4 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1]
+ %5 = load %struct.string___XUB** %4, align 4 ; <%struct.string___XUB*> [#uses=1]
+ %6 = getelementptr %struct.string___XUB* %5, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = load i32* %6, align 4 ; <i32> [#uses=1]
+ %8 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %7, i32* %8, align 8
+ %9 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1]
+ %10 = load i32* %9, align 8 ; <i32> [#uses=1]
+ %11 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ store i32 %10, i32* %11, align 8
+ %item.lobit = lshr i8 %item, 7 ; <i8> [#uses=1]
+ %12 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6 ; <i8*> [#uses=1]
+ store i8 %item.lobit, i8* %12, align 8
+ %13 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1]
+ %14 = load i32* %13, align 8 ; <i32> [#uses=1]
+ %15 = add i32 %14, -1 ; <i32> [#uses=1]
+ %16 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %15, i32* %16, align 4
+ %17 = sext i8 %item to i64 ; <i64> [#uses=1]
+ %18 = call i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 1 ) readnone ; <i64> [#uses=1]
+ %19 = sub i64 0, %18 ; <i64> [#uses=1]
+ %20 = call i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 0 ) readnone ; <i64> [#uses=1]
+ %21 = mul i64 %20, -2 ; <i64> [#uses=1]
+ call fastcc void @ce3806g__fxio__put__put_scaled__4.1346( %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i64 %17, i64 %19, i64 %21, i32 0, i32 -1 )
+ %22 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %23 = load i32* %22, align 4 ; <i32> [#uses=1]
+ %24 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1]
+ %25 = load i32* %24, align 8 ; <i32> [#uses=1]
+ %26 = icmp slt i32 %23, %25 ; <i1> [#uses=1]
+ br i1 %26, label %bb71, label %bb72
+
+bb71: ; preds = %entry
+ %27 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %27, align 4
+ br label %bb72
+
+bb72: ; preds = %entry, %bb102, %bb71
+ %28 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ %29 = load i32* %28, align 4 ; <i32> [#uses=1]
+ %30 = icmp slt i32 %29, -1 ; <i1> [#uses=1]
+ %31 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %32 = load i32* %31, align 4 ; <i32> [#uses=2]
+ br i1 %30, label %bb103, label %bb74
+
+bb74: ; preds = %bb72
+ %33 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1]
+ %34 = load i32* %33, align 8 ; <i32> [#uses=1]
+ %35 = add i32 %34, -1 ; <i32> [#uses=1]
+ %36 = icmp eq i32 %32, %35 ; <i1> [#uses=1]
+ %37 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ %38 = load i32* %37, align 4 ; <i32> [#uses=2]
+ br i1 %36, label %bb76, label %bb98
+
+bb76: ; preds = %bb74
+ %39 = icmp slt i32 %38, 1 ; <i1> [#uses=1]
+ br i1 %39, label %bb80, label %bb102
+
+bb80: ; preds = %bb76
+ %40 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ %41 = load i32* %40, align 4 ; <i32> [#uses=2]
+ %42 = icmp sgt i32 %41, -1 ; <i1> [#uses=1]
+ %.op = add i32 %41, 2 ; <i32> [#uses=1]
+ %43 = select i1 %42, i32 %.op, i32 2 ; <i32> [#uses=1]
+ %44 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6 ; <i8*> [#uses=1]
+ %45 = load i8* %44, align 8 ; <i8> [#uses=1]
+ %46 = zext i8 %45 to i32 ; <i32> [#uses=1]
+ %47 = add i32 %43, %46 ; <i32> [#uses=2]
+ %48 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0 ; <i32*> [#uses=1]
+ %49 = load i32* %48, align 8 ; <i32> [#uses=1]
+ %50 = icmp sgt i32 %47, %49 ; <i1> [#uses=1]
+ br i1 %50, label %bb88, label %bb85
+
+bb85: ; preds = %bb80, %bb87
+ %j.0 = phi i32 [ %68, %bb87 ], [ %47, %bb80 ] ; <i32> [#uses=2]
+ %51 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %52 = load i32* %51, align 4 ; <i32> [#uses=1]
+ %53 = add i32 %52, 1 ; <i32> [#uses=1]
+ %54 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %53, i32* %54, align 4
+ %55 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %56 = load i32* %55, align 8 ; <i32> [#uses=1]
+ %57 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %58 = load %struct.system__file_control_block__pstring** %57, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %59 = getelementptr %struct.system__file_control_block__pstring* %58, i32 0, i32 0 ; <i8**> [#uses=1]
+ %60 = load i8** %59, align 4 ; <i8*> [#uses=1]
+ %61 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %62 = load i32* %61, align 4 ; <i32> [#uses=1]
+ %63 = sub i32 %62, %56 ; <i32> [#uses=1]
+ %64 = getelementptr i8* %60, i32 %63 ; <i8*> [#uses=1]
+ store i8 32, i8* %64, align 1
+ %65 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0 ; <i32*> [#uses=1]
+ %66 = load i32* %65, align 8 ; <i32> [#uses=1]
+ %67 = icmp eq i32 %66, %j.0 ; <i1> [#uses=1]
+ br i1 %67, label %bb88, label %bb87
+
+bb87: ; preds = %bb85
+ %68 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %bb85
+
+bb88: ; preds = %bb80, %bb85
+ %69 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6 ; <i8*> [#uses=1]
+ %70 = load i8* %69, align 8 ; <i8> [#uses=1]
+ %toBool89 = icmp eq i8 %70, 0 ; <i1> [#uses=1]
+ br i1 %toBool89, label %bb91, label %bb90
+
+bb90: ; preds = %bb88
+ %71 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %72 = load i32* %71, align 4 ; <i32> [#uses=1]
+ %73 = add i32 %72, 1 ; <i32> [#uses=1]
+ %74 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %73, i32* %74, align 4
+ %75 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %76 = load i32* %75, align 8 ; <i32> [#uses=1]
+ %77 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %78 = load %struct.system__file_control_block__pstring** %77, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %79 = getelementptr %struct.system__file_control_block__pstring* %78, i32 0, i32 0 ; <i8**> [#uses=1]
+ %80 = load i8** %79, align 4 ; <i8*> [#uses=1]
+ %81 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %82 = load i32* %81, align 4 ; <i32> [#uses=1]
+ %83 = sub i32 %82, %76 ; <i32> [#uses=1]
+ %84 = getelementptr i8* %80, i32 %83 ; <i8*> [#uses=1]
+ store i8 45, i8* %84, align 1
+ br label %bb91
+
+bb91: ; preds = %bb88, %bb90
+ %85 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ %86 = load i32* %85, align 4 ; <i32> [#uses=1]
+ %87 = icmp slt i32 %86, 0 ; <i1> [#uses=1]
+ br i1 %87, label %bb93, label %bb97
+
+bb93: ; preds = %bb91
+ %88 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %89 = load i32* %88, align 4 ; <i32> [#uses=1]
+ %90 = add i32 %89, 1 ; <i32> [#uses=1]
+ %91 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %90, i32* %91, align 4
+ %92 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %93 = load i32* %92, align 8 ; <i32> [#uses=1]
+ %94 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %95 = load %struct.system__file_control_block__pstring** %94, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %96 = getelementptr %struct.system__file_control_block__pstring* %95, i32 0, i32 0 ; <i8**> [#uses=1]
+ %97 = load i8** %96, align 4 ; <i8*> [#uses=1]
+ %98 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %99 = load i32* %98, align 4 ; <i32> [#uses=1]
+ %100 = sub i32 %99, %93 ; <i32> [#uses=1]
+ %101 = getelementptr i8* %97, i32 %100 ; <i8*> [#uses=1]
+ store i8 48, i8* %101, align 1
+ %102 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %103 = load i32* %102, align 4 ; <i32> [#uses=1]
+ %104 = add i32 %103, 1 ; <i32> [#uses=1]
+ %105 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %104, i32* %105, align 4
+ %106 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %107 = load i32* %106, align 8 ; <i32> [#uses=1]
+ %108 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %109 = load %struct.system__file_control_block__pstring** %108, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %110 = getelementptr %struct.system__file_control_block__pstring* %109, i32 0, i32 0 ; <i8**> [#uses=1]
+ %111 = load i8** %110, align 4 ; <i8*> [#uses=1]
+ %112 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %113 = load i32* %112, align 4 ; <i32> [#uses=1]
+ %114 = sub i32 %113, %107 ; <i32> [#uses=1]
+ %115 = getelementptr i8* %111, i32 %114 ; <i8*> [#uses=1]
+ store i8 46, i8* %115, align 1
+ %116 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ %117 = load i32* %116, align 4 ; <i32> [#uses=1]
+ br label %bb94
+
+bb94: ; preds = %bb96, %bb93
+ %j8.0 = phi i32 [ %117, %bb93 ], [ %133, %bb96 ] ; <i32> [#uses=2]
+ %118 = icmp sgt i32 %j8.0, -2 ; <i1> [#uses=1]
+ br i1 %118, label %bb97, label %bb96
+
+bb96: ; preds = %bb94
+ %119 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %120 = load i32* %119, align 4 ; <i32> [#uses=1]
+ %121 = add i32 %120, 1 ; <i32> [#uses=1]
+ %122 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %121, i32* %122, align 4
+ %123 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %124 = load i32* %123, align 8 ; <i32> [#uses=1]
+ %125 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %126 = load %struct.system__file_control_block__pstring** %125, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %127 = getelementptr %struct.system__file_control_block__pstring* %126, i32 0, i32 0 ; <i8**> [#uses=1]
+ %128 = load i8** %127, align 4 ; <i8*> [#uses=1]
+ %129 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %130 = load i32* %129, align 4 ; <i32> [#uses=1]
+ %131 = sub i32 %130, %124 ; <i32> [#uses=1]
+ %132 = getelementptr i8* %128, i32 %131 ; <i8*> [#uses=1]
+ store i8 48, i8* %132, align 1
+ %133 = add i32 %j8.0, 1 ; <i32> [#uses=1]
+ br label %bb94
+
+bb97: ; preds = %bb91, %bb94
+ %134 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %135 = load i32* %134, align 4 ; <i32> [#uses=1]
+ %136 = add i32 %135, 1 ; <i32> [#uses=1]
+ %137 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %136, i32* %137, align 4
+ %138 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %139 = load i32* %138, align 8 ; <i32> [#uses=1]
+ %140 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %141 = load %struct.system__file_control_block__pstring** %140, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %142 = getelementptr %struct.system__file_control_block__pstring* %141, i32 0, i32 0 ; <i8**> [#uses=1]
+ %143 = load i8** %142, align 4 ; <i8*> [#uses=1]
+ %144 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %145 = load i32* %144, align 4 ; <i32> [#uses=1]
+ %146 = sub i32 %145, %139 ; <i32> [#uses=1]
+ %147 = getelementptr i8* %143, i32 %146 ; <i8*> [#uses=1]
+ store i8 48, i8* %147, align 1
+ br label %bb102
+
+bb98: ; preds = %bb74
+ %148 = icmp eq i32 %38, -1 ; <i1> [#uses=1]
+ br i1 %148, label %bb100, label %bb101
+
+bb100: ; preds = %bb98
+ %149 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %150 = load i32* %149, align 4 ; <i32> [#uses=1]
+ %151 = add i32 %150, 1 ; <i32> [#uses=1]
+ %152 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %151, i32* %152, align 4
+ %153 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %154 = load i32* %153, align 8 ; <i32> [#uses=1]
+ %155 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %156 = load %struct.system__file_control_block__pstring** %155, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %157 = getelementptr %struct.system__file_control_block__pstring* %156, i32 0, i32 0 ; <i8**> [#uses=1]
+ %158 = load i8** %157, align 4 ; <i8*> [#uses=1]
+ %159 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %160 = load i32* %159, align 4 ; <i32> [#uses=1]
+ %161 = sub i32 %160, %154 ; <i32> [#uses=1]
+ %162 = getelementptr i8* %158, i32 %161 ; <i8*> [#uses=1]
+ store i8 46, i8* %162, align 1
+ br label %bb101
+
+bb101: ; preds = %bb98, %bb100
+ %163 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %164 = load i32* %163, align 4 ; <i32> [#uses=1]
+ %165 = add i32 %164, 1 ; <i32> [#uses=1]
+ %166 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %165, i32* %166, align 4
+ %167 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1]
+ %168 = load i32* %167, align 8 ; <i32> [#uses=1]
+ %169 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %170 = load %struct.system__file_control_block__pstring** %169, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %171 = getelementptr %struct.system__file_control_block__pstring* %170, i32 0, i32 0 ; <i8**> [#uses=1]
+ %172 = load i8** %171, align 4 ; <i8*> [#uses=1]
+ %173 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1]
+ %174 = load i32* %173, align 4 ; <i32> [#uses=1]
+ %175 = sub i32 %174, %168 ; <i32> [#uses=1]
+ %176 = getelementptr i8* %172, i32 %175 ; <i8*> [#uses=1]
+ store i8 48, i8* %176, align 1
+ br label %bb102
+
+bb102: ; preds = %bb76, %bb101, %bb97
+ %177 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ %178 = load i32* %177, align 4 ; <i32> [#uses=1]
+ %179 = add i32 %178, -1 ; <i32> [#uses=1]
+ %180 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %179, i32* %180, align 4
+ br label %bb72
+
+bb103: ; preds = %bb72
+ ret i32 %32
+}
+
+declare x86_fp80 @ada__text_io__float_aux__get(%struct.ada__text_io__text_afcb*, i32)
+
+declare void @__gnat_rcheck_12(i8*, i32) noreturn
+
+declare void @__gnat_rcheck_10(i8*, i32) noreturn
+
+declare i8* @llvm.eh.exception() nounwind
+
+declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
+
+declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind
+
+declare void @__gnat_begin_handler(i8*) nounwind
+
+declare void @__gnat_raise_exception(%struct.system__standard_library__exception_data*, i8*, %struct.string___XUB*) noreturn
+
+declare void @__gnat_end_handler(i8*)
+
+declare i32 @__gnat_eh_personality(...)
+
+declare i32 @_Unwind_Resume(...)
+
+define internal fastcc void @ce3806g__fxio__put__put_int64__4.1339(%struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i64 %x, i32 %scale) {
+entry:
+ %0 = icmp eq i64 %x, 0 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+bb: ; preds = %entry
+ %1 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %scale, i32* %1, align 4
+ %2 = add i64 %x, 9 ; <i64> [#uses=1]
+ %3 = icmp ugt i64 %2, 18 ; <i1> [#uses=1]
+ br i1 %3, label %bb18, label %bb19
+
+bb18: ; preds = %bb
+ %4 = add i32 %scale, 1 ; <i32> [#uses=1]
+ %5 = sdiv i64 %x, 10 ; <i64> [#uses=1]
+ call fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i64 %5, i32 %4 )
+ br label %bb19
+
+bb19: ; preds = %bb, %bb18
+ %6 = srem i64 %x, 10 ; <i64> [#uses=3]
+ %neg = sub i64 0, %6 ; <i64> [#uses=1]
+ %abscond = icmp sgt i64 %6, -1 ; <i1> [#uses=1]
+ %abs = select i1 %abscond, i64 %6, i64 %neg ; <i64> [#uses=3]
+ %7 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 4 ; <i32> [#uses=1]
+ %9 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 2 ; <i32*> [#uses=1]
+ %10 = load i32* %9, align 4 ; <i32> [#uses=1]
+ %11 = add i32 %10, -1 ; <i32> [#uses=1]
+ %12 = icmp eq i32 %8, %11 ; <i1> [#uses=1]
+ br i1 %12, label %bb23, label %bb44
+
+bb23: ; preds = %bb19
+ %13 = icmp ne i64 %abs, 0 ; <i1> [#uses=1]
+ %14 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ %15 = load i32* %14, align 4 ; <i32> [#uses=1]
+ %16 = icmp slt i32 %15, 1 ; <i1> [#uses=1]
+ %17 = or i1 %13, %16 ; <i1> [#uses=1]
+ br i1 %17, label %bb27, label %bb48
+
+bb27: ; preds = %bb23
+ %18 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ %19 = load i32* %18, align 4 ; <i32> [#uses=2]
+ %20 = icmp sgt i32 %19, -1 ; <i1> [#uses=1]
+ %.op = add i32 %19, 2 ; <i32> [#uses=1]
+ %21 = select i1 %20, i32 %.op, i32 2 ; <i32> [#uses=1]
+ %22 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 6 ; <i8*> [#uses=1]
+ %23 = load i8* %22, align 1 ; <i8> [#uses=1]
+ %24 = zext i8 %23 to i32 ; <i32> [#uses=1]
+ %25 = add i32 %21, %24 ; <i32> [#uses=2]
+ %26 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 0 ; <i32*> [#uses=1]
+ %27 = load i32* %26, align 4 ; <i32> [#uses=1]
+ %28 = icmp sgt i32 %25, %27 ; <i1> [#uses=1]
+ br i1 %28, label %bb34, label %bb31
+
+bb31: ; preds = %bb27, %bb33
+ %j.0 = phi i32 [ %46, %bb33 ], [ %25, %bb27 ] ; <i32> [#uses=2]
+ %29 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %30 = load i32* %29, align 4 ; <i32> [#uses=1]
+ %31 = add i32 %30, 1 ; <i32> [#uses=1]
+ %32 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %31, i32* %32, align 4
+ %33 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %34 = load i32* %33, align 4 ; <i32> [#uses=1]
+ %35 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %36 = load %struct.system__file_control_block__pstring** %35, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %37 = getelementptr %struct.system__file_control_block__pstring* %36, i32 0, i32 0 ; <i8**> [#uses=1]
+ %38 = load i8** %37, align 4 ; <i8*> [#uses=1]
+ %39 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %40 = load i32* %39, align 4 ; <i32> [#uses=1]
+ %41 = sub i32 %40, %34 ; <i32> [#uses=1]
+ %42 = getelementptr i8* %38, i32 %41 ; <i8*> [#uses=1]
+ store i8 32, i8* %42, align 1
+ %43 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 0 ; <i32*> [#uses=1]
+ %44 = load i32* %43, align 4 ; <i32> [#uses=1]
+ %45 = icmp eq i32 %44, %j.0 ; <i1> [#uses=1]
+ br i1 %45, label %bb34, label %bb33
+
+bb33: ; preds = %bb31
+ %46 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %bb31
+
+bb34: ; preds = %bb27, %bb31
+ %47 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 6 ; <i8*> [#uses=1]
+ %48 = load i8* %47, align 1 ; <i8> [#uses=1]
+ %toBool35 = icmp eq i8 %48, 0 ; <i1> [#uses=1]
+ br i1 %toBool35, label %bb37, label %bb36
+
+bb36: ; preds = %bb34
+ %49 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %50 = load i32* %49, align 4 ; <i32> [#uses=1]
+ %51 = add i32 %50, 1 ; <i32> [#uses=1]
+ %52 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %51, i32* %52, align 4
+ %53 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %54 = load i32* %53, align 4 ; <i32> [#uses=1]
+ %55 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %56 = load %struct.system__file_control_block__pstring** %55, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %57 = getelementptr %struct.system__file_control_block__pstring* %56, i32 0, i32 0 ; <i8**> [#uses=1]
+ %58 = load i8** %57, align 4 ; <i8*> [#uses=1]
+ %59 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %60 = load i32* %59, align 4 ; <i32> [#uses=1]
+ %61 = sub i32 %60, %54 ; <i32> [#uses=1]
+ %62 = getelementptr i8* %58, i32 %61 ; <i8*> [#uses=1]
+ store i8 45, i8* %62, align 1
+ br label %bb37
+
+bb37: ; preds = %bb34, %bb36
+ %63 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ %64 = load i32* %63, align 4 ; <i32> [#uses=1]
+ %65 = icmp slt i32 %64, 0 ; <i1> [#uses=1]
+ br i1 %65, label %bb39, label %bb43
+
+bb39: ; preds = %bb37
+ %66 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %67 = load i32* %66, align 4 ; <i32> [#uses=1]
+ %68 = add i32 %67, 1 ; <i32> [#uses=1]
+ %69 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %68, i32* %69, align 4
+ %70 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %71 = load i32* %70, align 4 ; <i32> [#uses=1]
+ %72 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %73 = load %struct.system__file_control_block__pstring** %72, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %74 = getelementptr %struct.system__file_control_block__pstring* %73, i32 0, i32 0 ; <i8**> [#uses=1]
+ %75 = load i8** %74, align 4 ; <i8*> [#uses=1]
+ %76 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %77 = load i32* %76, align 4 ; <i32> [#uses=1]
+ %78 = sub i32 %77, %71 ; <i32> [#uses=1]
+ %79 = getelementptr i8* %75, i32 %78 ; <i8*> [#uses=1]
+ store i8 48, i8* %79, align 1
+ %80 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %81 = load i32* %80, align 4 ; <i32> [#uses=1]
+ %82 = add i32 %81, 1 ; <i32> [#uses=1]
+ %83 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %82, i32* %83, align 4
+ %84 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %85 = load i32* %84, align 4 ; <i32> [#uses=1]
+ %86 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %87 = load %struct.system__file_control_block__pstring** %86, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %88 = getelementptr %struct.system__file_control_block__pstring* %87, i32 0, i32 0 ; <i8**> [#uses=1]
+ %89 = load i8** %88, align 4 ; <i8*> [#uses=1]
+ %90 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %91 = load i32* %90, align 4 ; <i32> [#uses=1]
+ %92 = sub i32 %91, %85 ; <i32> [#uses=1]
+ %93 = getelementptr i8* %89, i32 %92 ; <i8*> [#uses=1]
+ store i8 46, i8* %93, align 1
+ %94 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ %95 = load i32* %94, align 4 ; <i32> [#uses=1]
+ br label %bb40
+
+bb40: ; preds = %bb42, %bb39
+ %j15.0 = phi i32 [ %95, %bb39 ], [ %111, %bb42 ] ; <i32> [#uses=2]
+ %96 = icmp sgt i32 %j15.0, -2 ; <i1> [#uses=1]
+ br i1 %96, label %bb43, label %bb42
+
+bb42: ; preds = %bb40
+ %97 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %98 = load i32* %97, align 4 ; <i32> [#uses=1]
+ %99 = add i32 %98, 1 ; <i32> [#uses=1]
+ %100 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %99, i32* %100, align 4
+ %101 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %102 = load i32* %101, align 4 ; <i32> [#uses=1]
+ %103 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %104 = load %struct.system__file_control_block__pstring** %103, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %105 = getelementptr %struct.system__file_control_block__pstring* %104, i32 0, i32 0 ; <i8**> [#uses=1]
+ %106 = load i8** %105, align 4 ; <i8*> [#uses=1]
+ %107 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %108 = load i32* %107, align 4 ; <i32> [#uses=1]
+ %109 = sub i32 %108, %102 ; <i32> [#uses=1]
+ %110 = getelementptr i8* %106, i32 %109 ; <i8*> [#uses=1]
+ store i8 48, i8* %110, align 1
+ %111 = add i32 %j15.0, 1 ; <i32> [#uses=1]
+ br label %bb40
+
+bb43: ; preds = %bb37, %bb40
+ %112 = trunc i64 %abs to i32 ; <i32> [#uses=1]
+ %113 = getelementptr [10 x i8]* @.str3, i32 0, i32 %112 ; <i8*> [#uses=1]
+ %114 = load i8* %113, align 1 ; <i8> [#uses=1]
+ %115 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %116 = load i32* %115, align 4 ; <i32> [#uses=1]
+ %117 = add i32 %116, 1 ; <i32> [#uses=1]
+ %118 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %117, i32* %118, align 4
+ %119 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %120 = load i32* %119, align 4 ; <i32> [#uses=1]
+ %121 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %122 = load %struct.system__file_control_block__pstring** %121, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %123 = getelementptr %struct.system__file_control_block__pstring* %122, i32 0, i32 0 ; <i8**> [#uses=1]
+ %124 = load i8** %123, align 4 ; <i8*> [#uses=1]
+ %125 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %126 = load i32* %125, align 4 ; <i32> [#uses=1]
+ %127 = sub i32 %126, %120 ; <i32> [#uses=1]
+ %128 = getelementptr i8* %124, i32 %127 ; <i8*> [#uses=1]
+ store i8 %114, i8* %128, align 1
+ br label %bb48
+
+bb44: ; preds = %bb19
+ %129 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ %130 = load i32* %129, align 4 ; <i32> [#uses=1]
+ %131 = icmp eq i32 %130, -1 ; <i1> [#uses=1]
+ br i1 %131, label %bb46, label %bb47
+
+bb46: ; preds = %bb44
+ %132 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %133 = load i32* %132, align 4 ; <i32> [#uses=1]
+ %134 = add i32 %133, 1 ; <i32> [#uses=1]
+ %135 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %134, i32* %135, align 4
+ %136 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %137 = load i32* %136, align 4 ; <i32> [#uses=1]
+ %138 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %139 = load %struct.system__file_control_block__pstring** %138, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %140 = getelementptr %struct.system__file_control_block__pstring* %139, i32 0, i32 0 ; <i8**> [#uses=1]
+ %141 = load i8** %140, align 4 ; <i8*> [#uses=1]
+ %142 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %143 = load i32* %142, align 4 ; <i32> [#uses=1]
+ %144 = sub i32 %143, %137 ; <i32> [#uses=1]
+ %145 = getelementptr i8* %141, i32 %144 ; <i8*> [#uses=1]
+ store i8 46, i8* %145, align 1
+ br label %bb47
+
+bb47: ; preds = %bb44, %bb46
+ %146 = trunc i64 %abs to i32 ; <i32> [#uses=1]
+ %147 = getelementptr [10 x i8]* @.str3, i32 0, i32 %146 ; <i8*> [#uses=1]
+ %148 = load i8* %147, align 1 ; <i8> [#uses=1]
+ %149 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %150 = load i32* %149, align 4 ; <i32> [#uses=1]
+ %151 = add i32 %150, 1 ; <i32> [#uses=1]
+ %152 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ store i32 %151, i32* %152, align 4
+ %153 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1]
+ %154 = load i32* %153, align 4 ; <i32> [#uses=1]
+ %155 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1]
+ %156 = load %struct.system__file_control_block__pstring** %155, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1]
+ %157 = getelementptr %struct.system__file_control_block__pstring* %156, i32 0, i32 0 ; <i8**> [#uses=1]
+ %158 = load i8** %157, align 4 ; <i8*> [#uses=1]
+ %159 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1]
+ %160 = load i32* %159, align 4 ; <i32> [#uses=1]
+ %161 = sub i32 %160, %154 ; <i32> [#uses=1]
+ %162 = getelementptr i8* %158, i32 %161 ; <i8*> [#uses=1]
+ store i8 %148, i8* %162, align 1
+ br label %bb48
+
+bb48: ; preds = %bb23, %bb47, %bb43
+ %163 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ %164 = load i32* %163, align 4 ; <i32> [#uses=1]
+ %165 = add i32 %164, -1 ; <i32> [#uses=1]
+ %166 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %165, i32* %166, align 4
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal fastcc void @ce3806g__fxio__put__put_scaled__4.1346(%struct.FRAME.ce3806g__fxio__put__4* %CHAIN.365, i64 %x, i64 %y, i64 %z, i32 %a, i32 %e) {
+entry:
+ %0 = alloca { i64, i64 } ; <{ i64, i64 }*> [#uses=3]
+ %1 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
+ %2 = add i32 %a, 17 ; <i32> [#uses=2]
+ %3 = sdiv i32 %2, 18 ; <i32> [#uses=3]
+ %4 = add i32 %3, 1 ; <i32> [#uses=7]
+ %5 = icmp sgt i32 %4, -1 ; <i1> [#uses=1]
+ %max53 = select i1 %5, i32 %4, i32 0 ; <i32> [#uses=1]
+ %6 = alloca i64, i32 %max53 ; <i64*> [#uses=21]
+ %7 = icmp sgt i32 %4, 0 ; <i1> [#uses=1]
+ br i1 %7, label %bb55, label %bb58
+
+bb55: ; preds = %entry, %bb57
+ %J60b.0 = phi i32 [ %11, %bb57 ], [ 1, %entry ] ; <i32> [#uses=3]
+ %8 = add i32 %J60b.0, -1 ; <i32> [#uses=1]
+ %9 = getelementptr i64* %6, i32 %8 ; <i64*> [#uses=1]
+ store i64 0, i64* %9, align 8
+ %10 = icmp eq i32 %4, %J60b.0 ; <i1> [#uses=1]
+ br i1 %10, label %bb58, label %bb57
+
+bb57: ; preds = %bb55
+ %11 = add i32 %J60b.0, 1 ; <i32> [#uses=1]
+ br label %bb55
+
+bb58: ; preds = %entry, %bb55
+ %12 = icmp sgt i32 %4, 0 ; <i1> [#uses=1]
+ br i1 %12, label %bb61, label %bb91
+
+bb61: ; preds = %bb58, %bb90
+ %j2.0 = phi i32 [ %88, %bb90 ], [ 1, %bb58 ] ; <i32> [#uses=11]
+ %aa.0 = phi i32 [ %86, %bb90 ], [ %a, %bb58 ] ; <i32> [#uses=6]
+ %yy.0 = phi i64 [ %84, %bb90 ], [ %y, %bb58 ] ; <i64> [#uses=3]
+ %xx.0 = phi i64 [ %21, %bb90 ], [ %x, %bb58 ] ; <i64> [#uses=2]
+ %13 = icmp eq i64 %xx.0, 0 ; <i1> [#uses=1]
+ br i1 %13, label %bb91, label %bb63
+
+bb63: ; preds = %bb61
+ %14 = icmp eq i32 %aa.0, 0 ; <i1> [#uses=1]
+ %15 = zext i1 %14 to i8 ; <i8> [#uses=1]
+ invoke void @system__arith_64__scaled_divide( { i64, i64 }* noalias sret %0, i64 %xx.0, i64 %yy.0, i64 %z, i8 %15 )
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %bb63
+ %16 = getelementptr { i64, i64 }* %0, i32 0, i32 0 ; <i64*> [#uses=1]
+ %17 = load i64* %16, align 8 ; <i64> [#uses=1]
+ %18 = add i32 %j2.0, -1 ; <i32> [#uses=1]
+ %19 = getelementptr i64* %6, i32 %18 ; <i64*> [#uses=1]
+ store i64 %17, i64* %19, align 8
+ %20 = getelementptr { i64, i64 }* %0, i32 0, i32 1 ; <i64*> [#uses=1]
+ %21 = load i64* %20, align 8 ; <i64> [#uses=1]
+ %22 = add i32 %j2.0, -1 ; <i32> [#uses=1]
+ %23 = getelementptr i64* %6, i32 %22 ; <i64*> [#uses=1]
+ %24 = load i64* %23, align 8 ; <i64> [#uses=1]
+ %25 = icmp eq i64 %24, %yy.0 ; <i1> [#uses=1]
+ %26 = add i32 %j2.0, -1 ; <i32> [#uses=1]
+ %27 = getelementptr i64* %6, i32 %26 ; <i64*> [#uses=1]
+ %28 = load i64* %27, align 8 ; <i64> [#uses=1]
+ %29 = sub i64 0, %28 ; <i64> [#uses=1]
+ %30 = icmp eq i64 %yy.0, %29 ; <i1> [#uses=1]
+ %31 = or i1 %25, %30 ; <i1> [#uses=1]
+ %32 = icmp sgt i32 %j2.0, 1 ; <i1> [#uses=1]
+ %or.cond = and i1 %31, %32 ; <i1> [#uses=1]
+ br i1 %or.cond, label %bb69, label %bb83
+
+bb69: ; preds = %invcont
+ %33 = add i32 %j2.0, -1 ; <i32> [#uses=1]
+ %34 = getelementptr i64* %6, i32 %33 ; <i64*> [#uses=1]
+ %35 = load i64* %34, align 8 ; <i64> [#uses=1]
+ %36 = icmp slt i64 %35, 0 ; <i1> [#uses=1]
+ %37 = add i32 %j2.0, -2 ; <i32> [#uses=1]
+ %38 = getelementptr i64* %6, i32 %37 ; <i64*> [#uses=1]
+ %39 = load i64* %38, align 8 ; <i64> [#uses=2]
+ br i1 %36, label %bb71, label %bb72
+
+bb71: ; preds = %bb69
+ %40 = add i64 %39, 1 ; <i64> [#uses=1]
+ %41 = add i32 %j2.0, -2 ; <i32> [#uses=1]
+ %42 = getelementptr i64* %6, i32 %41 ; <i64*> [#uses=1]
+ store i64 %40, i64* %42, align 8
+ br label %bb73
+
+bb72: ; preds = %bb69
+ %43 = add i64 %39, -1 ; <i64> [#uses=1]
+ %44 = add i32 %j2.0, -2 ; <i32> [#uses=1]
+ %45 = getelementptr i64* %6, i32 %44 ; <i64*> [#uses=1]
+ store i64 %43, i64* %45, align 8
+ br label %bb73
+
+bb73: ; preds = %bb72, %bb71
+ %46 = add i32 %j2.0, -1 ; <i32> [#uses=1]
+ %47 = getelementptr i64* %6, i32 %46 ; <i64*> [#uses=1]
+ store i64 0, i64* %47, align 8
+ br label %bb74
+
+bb74: ; preds = %bb82, %bb73
+ %j1.0 = phi i32 [ %4, %bb73 ], [ %81, %bb82 ] ; <i32> [#uses=12]
+ %48 = icmp slt i32 %j1.0, 2 ; <i1> [#uses=1]
+ br i1 %48, label %bb83, label %bb76
+
+bb76: ; preds = %bb74
+ %49 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ %50 = getelementptr i64* %6, i32 %49 ; <i64*> [#uses=1]
+ %51 = load i64* %50, align 8 ; <i64> [#uses=1]
+ %52 = icmp sgt i64 %51, 999999999999999999 ; <i1> [#uses=1]
+ br i1 %52, label %bb78, label %bb79
+
+bb78: ; preds = %bb76
+ %53 = add i32 %j1.0, -2 ; <i32> [#uses=1]
+ %54 = getelementptr i64* %6, i32 %53 ; <i64*> [#uses=1]
+ %55 = load i64* %54, align 8 ; <i64> [#uses=1]
+ %56 = add i64 %55, 1 ; <i64> [#uses=1]
+ %57 = add i32 %j1.0, -2 ; <i32> [#uses=1]
+ %58 = getelementptr i64* %6, i32 %57 ; <i64*> [#uses=1]
+ store i64 %56, i64* %58, align 8
+ %59 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ %60 = getelementptr i64* %6, i32 %59 ; <i64*> [#uses=1]
+ %61 = load i64* %60, align 8 ; <i64> [#uses=1]
+ %62 = add i64 %61, -1000000000000000000 ; <i64> [#uses=1]
+ %63 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ %64 = getelementptr i64* %6, i32 %63 ; <i64*> [#uses=1]
+ store i64 %62, i64* %64, align 8
+ br label %bb82
+
+bb79: ; preds = %bb76
+ %65 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ %66 = getelementptr i64* %6, i32 %65 ; <i64*> [#uses=1]
+ %67 = load i64* %66, align 8 ; <i64> [#uses=1]
+ %68 = icmp slt i64 %67, -999999999999999999 ; <i1> [#uses=1]
+ br i1 %68, label %bb81, label %bb82
+
+bb81: ; preds = %bb79
+ %69 = add i32 %j1.0, -2 ; <i32> [#uses=1]
+ %70 = getelementptr i64* %6, i32 %69 ; <i64*> [#uses=1]
+ %71 = load i64* %70, align 8 ; <i64> [#uses=1]
+ %72 = add i64 %71, -1 ; <i64> [#uses=1]
+ %73 = add i32 %j1.0, -2 ; <i32> [#uses=1]
+ %74 = getelementptr i64* %6, i32 %73 ; <i64*> [#uses=1]
+ store i64 %72, i64* %74, align 8
+ %75 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ %76 = getelementptr i64* %6, i32 %75 ; <i64*> [#uses=1]
+ %77 = load i64* %76, align 8 ; <i64> [#uses=1]
+ %78 = add i64 %77, 1000000000000000000 ; <i64> [#uses=1]
+ %79 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ %80 = getelementptr i64* %6, i32 %79 ; <i64*> [#uses=1]
+ store i64 %78, i64* %80, align 8
+ br label %bb82
+
+bb82: ; preds = %bb79, %bb81, %bb78
+ %81 = add i32 %j1.0, -1 ; <i32> [#uses=1]
+ br label %bb74
+
+bb83: ; preds = %invcont, %bb74
+ %82 = icmp slt i32 %aa.0, 19 ; <i1> [#uses=1]
+ %min = select i1 %82, i32 %aa.0, i32 18 ; <i32> [#uses=1]
+ %83 = invoke i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 %min ) readnone
+ to label %invcont86 unwind label %lpad ; <i64> [#uses=1]
+
+invcont86: ; preds = %bb83
+ %84 = sub i64 0, %83 ; <i64> [#uses=1]
+ %85 = icmp slt i32 %aa.0, 19 ; <i1> [#uses=1]
+ %min87 = select i1 %85, i32 %aa.0, i32 18 ; <i32> [#uses=1]
+ %86 = sub i32 %aa.0, %min87 ; <i32> [#uses=1]
+ %87 = icmp eq i32 %4, %j2.0 ; <i1> [#uses=1]
+ br i1 %87, label %bb91, label %bb90
+
+bb90: ; preds = %invcont86
+ %88 = add i32 %j2.0, 1 ; <i32> [#uses=1]
+ br label %bb61
+
+bb91: ; preds = %bb58, %bb61, %invcont86
+ %89 = icmp slt i32 %2, 18 ; <i1> [#uses=1]
+ br i1 %89, label %bb98, label %bb94
+
+bb94: ; preds = %bb91, %bb97
+ %j.0 = phi i32 [ %97, %bb97 ], [ 1, %bb91 ] ; <i32> [#uses=4]
+ %90 = mul i32 %j.0, 18 ; <i32> [#uses=1]
+ %91 = add i32 %90, -18 ; <i32> [#uses=1]
+ %92 = sub i32 %e, %91 ; <i32> [#uses=1]
+ %93 = add i32 %j.0, -1 ; <i32> [#uses=1]
+ %94 = getelementptr i64* %6, i32 %93 ; <i64*> [#uses=1]
+ %95 = load i64* %94, align 8 ; <i64> [#uses=1]
+ invoke fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.365, i64 %95, i32 %92 )
+ to label %invcont95 unwind label %lpad
+
+invcont95: ; preds = %bb94
+ %96 = icmp eq i32 %3, %j.0 ; <i1> [#uses=1]
+ br i1 %96, label %bb98, label %bb97
+
+bb97: ; preds = %invcont95
+ %97 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %bb94
+
+bb98: ; preds = %bb91, %invcont95
+ %98 = sub i32 %e, %a ; <i32> [#uses=1]
+ %99 = getelementptr i64* %6, i32 %3 ; <i64*> [#uses=1]
+ %100 = load i64* %99, align 8 ; <i64> [#uses=1]
+ invoke fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.365, i64 %100, i32 %98 )
+ to label %bb101 unwind label %lpad
+
+bb101: ; preds = %bb98
+ ret void
+
+lpad: ; preds = %bb98, %bb94, %bb83, %bb63
+ %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
+ %eh_select103 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0]
+ call void @llvm.stackrestore( i8* %1 )
+ %101 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32> [#uses=0]
+ unreachable
+}
+
+declare i8* @llvm.stacksave() nounwind
+
+declare void @system__arith_64__scaled_divide({ i64, i64 }* noalias sret, i64, i64, i64, i8)
+
+declare i64 @system__exn_lli__exn_long_long_integer(i64, i32) readnone
+
+declare void @llvm.stackrestore(i8*) nounwind
+
+declare i32 @system__img_real__set_image_real(x86_fp80, i8*, %struct.string___XUB*, i32, i32, i32, i32)
+
+declare void @ada__text_io__generic_aux__put_item(%struct.ada__text_io__text_afcb*, i8*, %struct.string___XUB*)
+
+declare void @report__test(i8*, %struct.string___XUB*, i8*, %struct.string___XUB*)
+
+declare void @system__secondary_stack__ss_mark(%struct.string___XUB* noalias sret)
+
+declare void @system__exception_table__register_exception(%struct.system__standard_library__exception_data*)
+
+declare void @report__legal_file_name(%struct.system__file_control_block__pstring* noalias sret, i32, i8*, %struct.string___XUB*)
+
+declare %struct.ada__text_io__text_afcb* @ada__text_io__create(%struct.ada__text_io__text_afcb*, i8, i8*, %struct.string___XUB*, i8*, %struct.string___XUB*)
+
+declare void @system__secondary_stack__ss_release(i32, i32)
+
+declare void @report__not_applicable(i8*, %struct.string___XUB*)
+
+declare void @ada__text_io__set_output(%struct.ada__text_io__text_afcb*)
+
+declare %struct.ada__text_io__text_afcb* @ada__text_io__close(%struct.ada__text_io__text_afcb*)
+
+declare %struct.ada__text_io__text_afcb* @ada__text_io__open(%struct.ada__text_io__text_afcb*, i8, i8*, %struct.string___XUB*, i8*, %struct.string___XUB*)
+
+declare %struct.ada__text_io__text_afcb* @ada__text_io__standard_output()
+
+declare void @report__failed(i8*, %struct.string___XUB*)
+
+declare void @ext(i32*)
+
+declare %struct.ada__text_io__text_afcb* @ada__text_io__delete(%struct.ada__text_io__text_afcb*)
+
+declare void @report__result()
diff --git a/test/Transforms/PruneEH/dg.exp b/test/Transforms/PruneEH/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/PruneEH/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/PruneEH/recursivetest.ll b/test/Transforms/PruneEH/recursivetest.ll
new file mode 100644
index 000000000000..231c7b373819
--- /dev/null
+++ b/test/Transforms/PruneEH/recursivetest.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep invoke
+
+define internal i32 @foo() {
+ invoke i32 @foo( )
+ to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
+Normal: ; preds = %0
+ ret i32 12
+Except: ; preds = %0
+ ret i32 123
+}
+
+define i32 @caller() {
+ invoke i32 @foo( )
+ to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
+Normal: ; preds = %0
+ ret i32 0
+Except: ; preds = %0
+ ret i32 1
+}
+
diff --git a/test/Transforms/PruneEH/simplenoreturntest.ll b/test/Transforms/PruneEH/simplenoreturntest.ll
new file mode 100644
index 000000000000..d2bd50cf5da7
--- /dev/null
+++ b/test/Transforms/PruneEH/simplenoreturntest.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep {ret i32}
+
+declare void @noreturn() noreturn;
+
+define i32 @caller() {
+ call void @noreturn( )
+ ret i32 17
+}
+
+define i32 @caller2() {
+ %T = call i32 @caller( ) ; <i32> [#uses=1]
+ ret i32 %T
+}
diff --git a/test/Transforms/PruneEH/simpletest.ll b/test/Transforms/PruneEH/simpletest.ll
new file mode 100644
index 000000000000..678e8d76b680
--- /dev/null
+++ b/test/Transforms/PruneEH/simpletest.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep invoke
+
+declare void @nounwind() nounwind
+
+define internal void @foo() {
+ call void @nounwind()
+ ret void
+}
+
+define i32 @caller() {
+ invoke void @foo( )
+ to label %Normal unwind label %Except
+
+Normal: ; preds = %0
+ ret i32 0
+
+Except: ; preds = %0
+ ret i32 1
+}
diff --git a/test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll b/test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll
new file mode 100644
index 000000000000..10daa7620d22
--- /dev/null
+++ b/test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -raiseallocs -disable-output
+
+define void @main() {
+ %tmp.13 = call i32 (...)* @free( i32 32 ) ; <i32> [#uses=1]
+ %tmp.14 = inttoptr i32 %tmp.13 to i32* ; <i32*> [#uses=0]
+ ret void
+}
+
+declare i32 @free(...)
+
diff --git a/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll b/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll
new file mode 100644
index 000000000000..513cf6f339b1
--- /dev/null
+++ b/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as <%s | opt -raiseallocs -stats -disable-output |& \
+; RUN: not grep {Number of allocations raised}
+define void @foo() {
+entry:
+ %buffer = alloca i16*
+ %tmp = load i16** %buffer, align 8
+ invoke i32(...)* @free(i16* %tmp)
+ to label %invcont unwind label %unwind
+invcont:
+ br label %finally
+unwind:
+ br label %finally
+finally:
+ ret void
+}
+declare i32 @free(...)
+
diff --git a/test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll b/test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll
new file mode 100644
index 000000000000..4521581b3879
--- /dev/null
+++ b/test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll
@@ -0,0 +1,11 @@
+; This situation can occur due to the funcresolve pass.
+;
+; RUN: llvm-as < %s | opt -raiseallocs | llvm-dis | not grep call
+
+declare void @free(i8*)
+
+define void @test(i32* %P) {
+ call void bitcast (void (i8*)* @free to void (i32*)*)( i32* %P )
+ ret void
+}
+
diff --git a/test/Transforms/RaiseAllocations/dg.exp b/test/Transforms/RaiseAllocations/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/RaiseAllocations/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/Reassociate/2002-05-15-AgressiveSubMove.ll b/test/Transforms/Reassociate/2002-05-15-AgressiveSubMove.ll
new file mode 100644
index 000000000000..5465418d00de
--- /dev/null
+++ b/test/Transforms/Reassociate/2002-05-15-AgressiveSubMove.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -reassociate -instcombine -constprop -dce | llvm-dis | not grep add
+
+define i32 @test(i32 %A) {
+ %X = add i32 %A, 1 ; <i32> [#uses=1]
+ %Y = add i32 %A, 1 ; <i32> [#uses=1]
+ %r = sub i32 %X, %Y ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/test/Transforms/Reassociate/2002-05-15-MissedTree.ll b/test/Transforms/Reassociate/2002-05-15-MissedTree.ll
new file mode 100644
index 000000000000..79afb6e64c13
--- /dev/null
+++ b/test/Transforms/Reassociate/2002-05-15-MissedTree.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -reassociate -instcombine -constprop -die | llvm-dis | not grep 5
+
+define i32 @test(i32 %A, i32 %B) {
+ %W = add i32 %B, -5 ; <i32> [#uses=1]
+ %Y = add i32 %A, 5 ; <i32> [#uses=1]
+ %Z = add i32 %W, %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll b/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll
new file mode 100644
index 000000000000..de0666e95617
--- /dev/null
+++ b/test/Transforms/Reassociate/2002-05-15-SubReassociate.ll
@@ -0,0 +1,12 @@
+; With sub reassociation, constant folding can eliminate all of the constants.
+;
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -dce | llvm-dis | not grep add
+
+define i32 @test(i32 %A, i32 %B) {
+ %W = add i32 5, %B ; <i32> [#uses=1]
+ %X = add i32 -7, %A ; <i32> [#uses=1]
+ %Y = sub i32 %X, %W ; <i32> [#uses=1]
+ %Z = add i32 %Y, 12 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/Reassociate/2002-05-15-SubReassociate2.ll b/test/Transforms/Reassociate/2002-05-15-SubReassociate2.ll
new file mode 100644
index 000000000000..070080acf24f
--- /dev/null
+++ b/test/Transforms/Reassociate/2002-05-15-SubReassociate2.ll
@@ -0,0 +1,13 @@
+; With sub reassociation, constant folding can eliminate the two 12 constants.
+;
+; RUN: llvm-as < %s | opt -reassociate -constprop -dce | llvm-dis | not grep 12
+
+define i32 @test(i32 %A, i32 %B, i32 %C, i32 %D) {
+ %M = add i32 %A, 12 ; <i32> [#uses=1]
+ %N = add i32 %M, %B ; <i32> [#uses=1]
+ %O = add i32 %N, %C ; <i32> [#uses=1]
+ %P = sub i32 %D, %O ; <i32> [#uses=1]
+ %Q = add i32 %P, 12 ; <i32> [#uses=1]
+ ret i32 %Q
+}
+
diff --git a/test/Transforms/Reassociate/2002-07-09-DominanceProblem.ll b/test/Transforms/Reassociate/2002-07-09-DominanceProblem.ll
new file mode 100644
index 000000000000..c19baeaae68f
--- /dev/null
+++ b/test/Transforms/Reassociate/2002-07-09-DominanceProblem.ll
@@ -0,0 +1,10 @@
+; The reassociate pass is not preserving dominance properties correctly
+;
+; RUN: llvm-as < %s | opt -reassociate
+
+define i32 @compute_dist(i32 %i, i32 %j) {
+ %reg119 = sub i32 %j, %i ; <i32> [#uses=1]
+ ret i32 %reg119
+}
+
+
diff --git a/test/Transforms/Reassociate/2003-08-12-InfiniteLoop.ll b/test/Transforms/Reassociate/2003-08-12-InfiniteLoop.ll
new file mode 100644
index 000000000000..41cba63d8fda
--- /dev/null
+++ b/test/Transforms/Reassociate/2003-08-12-InfiniteLoop.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -reassociate -disable-output
+
+define i32 @test(i32 %A.1, i32 %B.1, i32 %C.1, i32 %D.1) {
+ %tmp.16 = and i32 %A.1, %B.1 ; <i32> [#uses=1]
+ %tmp.18 = and i32 %tmp.16, %C.1 ; <i32> [#uses=1]
+ %tmp.20 = and i32 %tmp.18, %D.1 ; <i32> [#uses=1]
+ ret i32 %tmp.20
+}
+
diff --git a/test/Transforms/Reassociate/2005-08-24-Crash.ll b/test/Transforms/Reassociate/2005-08-24-Crash.ll
new file mode 100644
index 000000000000..99c98ef5932c
--- /dev/null
+++ b/test/Transforms/Reassociate/2005-08-24-Crash.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -reassociate -disable-output
+
+define void @test(i32 %a, i32 %b, i32 %c, i32 %d) {
+ %tmp.2 = xor i32 %a, %b ; <i32> [#uses=1]
+ %tmp.5 = xor i32 %c, %d ; <i32> [#uses=1]
+ %tmp.6 = xor i32 %tmp.2, %tmp.5 ; <i32> [#uses=1]
+ %tmp.9 = xor i32 %c, %a ; <i32> [#uses=1]
+ %tmp.12 = xor i32 %b, %d ; <i32> [#uses=1]
+ %tmp.13 = xor i32 %tmp.9, %tmp.12 ; <i32> [#uses=1]
+ %tmp.16 = xor i32 %tmp.6, %tmp.13 ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/Reassociate/2005-09-01-ArrayOutOfBounds.ll b/test/Transforms/Reassociate/2005-09-01-ArrayOutOfBounds.ll
new file mode 100644
index 000000000000..d11a2ea767a9
--- /dev/null
+++ b/test/Transforms/Reassociate/2005-09-01-ArrayOutOfBounds.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis |\
+; RUN: grep {ret i32 0}
+
+define i32 @f(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4) {
+ %tmp.2 = add i32 %a4, %a3 ; <i32> [#uses=1]
+ %tmp.4 = add i32 %tmp.2, %a2 ; <i32> [#uses=1]
+ %tmp.6 = add i32 %tmp.4, %a1 ; <i32> [#uses=1]
+ %tmp.8 = add i32 %tmp.6, %a0 ; <i32> [#uses=1]
+ %tmp.11 = add i32 %a3, %a2 ; <i32> [#uses=1]
+ %tmp.13 = add i32 %tmp.11, %a1 ; <i32> [#uses=1]
+ %tmp.15 = add i32 %tmp.13, %a0 ; <i32> [#uses=1]
+ %tmp.18 = add i32 %a2, %a1 ; <i32> [#uses=1]
+ %tmp.20 = add i32 %tmp.18, %a0 ; <i32> [#uses=1]
+ %tmp.23 = add i32 %a1, %a0 ; <i32> [#uses=1]
+ %tmp.26 = sub i32 %tmp.8, %tmp.15 ; <i32> [#uses=1]
+ %tmp.28 = add i32 %tmp.26, %tmp.20 ; <i32> [#uses=1]
+ %tmp.30 = sub i32 %tmp.28, %tmp.23 ; <i32> [#uses=1]
+ %tmp.32 = sub i32 %tmp.30, %a4 ; <i32> [#uses=1]
+ %tmp.34 = sub i32 %tmp.32, %a2 ; <i32> [#uses=2]
+ %T = mul i32 %tmp.34, %tmp.34 ; <i32> [#uses=1]
+ ret i32 %T
+}
+
diff --git a/test/Transforms/Reassociate/2006-04-27-ReassociateVector.ll b/test/Transforms/Reassociate/2006-04-27-ReassociateVector.ll
new file mode 100644
index 000000000000..05d6103bbfd3
--- /dev/null
+++ b/test/Transforms/Reassociate/2006-04-27-ReassociateVector.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -reassociate -disable-output
+
+define void @foo() {
+ %tmp162 = sub <4 x float> zeroinitializer, zeroinitializer ; <<4 x float>> [#uses=1]
+ %tmp164 = mul <4 x float> zeroinitializer, %tmp162 ; <<4 x float>> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/Reassociate/basictest.ll b/test/Transforms/Reassociate/basictest.ll
new file mode 100644
index 000000000000..09db47b1907c
--- /dev/null
+++ b/test/Transforms/Reassociate/basictest.ll
@@ -0,0 +1,10 @@
+; With reassociation, constant folding can eliminate the 12 and -12 constants.
+;
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep add
+
+define i32 @test(i32 %arg) {
+ %tmp1 = sub i32 -12, %arg ; <i32> [#uses=1]
+ %tmp2 = add i32 %tmp1, 12 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
diff --git a/test/Transforms/Reassociate/basictest2.ll b/test/Transforms/Reassociate/basictest2.ll
new file mode 100644
index 000000000000..dbde3af35e1b
--- /dev/null
+++ b/test/Transforms/Reassociate/basictest2.ll
@@ -0,0 +1,11 @@
+; With reassociation, constant folding can eliminate the +/- 30 constants.
+;
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 30
+
+define i32 @test(i32 %reg109, i32 %reg1111) {
+ %reg115 = add i32 %reg109, -30 ; <i32> [#uses=1]
+ %reg116 = add i32 %reg115, %reg1111 ; <i32> [#uses=1]
+ %reg117 = add i32 %reg116, 30 ; <i32> [#uses=1]
+ ret i32 %reg117
+}
+
diff --git a/test/Transforms/Reassociate/basictest3.ll b/test/Transforms/Reassociate/basictest3.ll
new file mode 100644
index 000000000000..a88030db2f9a
--- /dev/null
+++ b/test/Transforms/Reassociate/basictest3.ll
@@ -0,0 +1,54 @@
+; RUN: llvm-as < %s | opt -reassociate -gvn | llvm-dis | grep add | count 6
+; Each of these functions should turn into two adds each.
+
+@e = external global i32 ; <i32*> [#uses=3]
+@a = external global i32 ; <i32*> [#uses=3]
+@b = external global i32 ; <i32*> [#uses=3]
+@c = external global i32 ; <i32*> [#uses=3]
+@f = external global i32 ; <i32*> [#uses=3]
+
+define void @test1() {
+ %A = load i32* @a ; <i32> [#uses=2]
+ %B = load i32* @b ; <i32> [#uses=2]
+ %C = load i32* @c ; <i32> [#uses=2]
+ %t1 = add i32 %A, %B ; <i32> [#uses=1]
+ %t2 = add i32 %t1, %C ; <i32> [#uses=1]
+ %t3 = add i32 %C, %A ; <i32> [#uses=1]
+ %t4 = add i32 %t3, %B ; <i32> [#uses=1]
+ ; e = (a+b)+c;
+ store i32 %t2, i32* @e
+ ; f = (a+c)+b
+ store i32 %t4, i32* @f
+ ret void
+}
+
+define void @test2() {
+ %A = load i32* @a ; <i32> [#uses=2]
+ %B = load i32* @b ; <i32> [#uses=2]
+ %C = load i32* @c ; <i32> [#uses=2]
+ %t1 = add i32 %A, %B ; <i32> [#uses=1]
+ %t2 = add i32 %t1, %C ; <i32> [#uses=1]
+ %t3 = add i32 %C, %A ; <i32> [#uses=1]
+ %t4 = add i32 %t3, %B ; <i32> [#uses=1]
+ ; e = c+(a+b)
+ store i32 %t2, i32* @e
+ ; f = (c+a)+b
+ store i32 %t4, i32* @f
+ ret void
+}
+
+define void @test3() {
+ %A = load i32* @a ; <i32> [#uses=2]
+ %B = load i32* @b ; <i32> [#uses=2]
+ %C = load i32* @c ; <i32> [#uses=2]
+ %t1 = add i32 %B, %A ; <i32> [#uses=1]
+ %t2 = add i32 %t1, %C ; <i32> [#uses=1]
+ %t3 = add i32 %C, %A ; <i32> [#uses=1]
+ %t4 = add i32 %t3, %B ; <i32> [#uses=1]
+ ; e = c+(b+a)
+ store i32 %t2, i32* @e
+ ; f = (c+a)+b
+ store i32 %t4, i32* @f
+ ret void
+}
+
diff --git a/test/Transforms/Reassociate/basictest4.ll b/test/Transforms/Reassociate/basictest4.ll
new file mode 100644
index 000000000000..608becd9c3a9
--- /dev/null
+++ b/test/Transforms/Reassociate/basictest4.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -reassociate -gvn -instcombine | llvm-dis | not grep add
+
+@a = weak global i32 0 ; <i32*> [#uses=1]
+@b = weak global i32 0 ; <i32*> [#uses=1]
+@c = weak global i32 0 ; <i32*> [#uses=1]
+@d = weak global i32 0 ; <i32*> [#uses=0]
+
+define i32 @foo() {
+ %tmp.0 = load i32* @a ; <i32> [#uses=2]
+ %tmp.1 = load i32* @b ; <i32> [#uses=2]
+ ; (a+b)
+ %tmp.2 = add i32 %tmp.0, %tmp.1 ; <i32> [#uses=1]
+ %tmp.4 = load i32* @c ; <i32> [#uses=2]
+ ; (a+b)+c
+ %tmp.5 = add i32 %tmp.2, %tmp.4 ; <i32> [#uses=1]
+ ; (a+c)
+ %tmp.8 = add i32 %tmp.0, %tmp.4 ; <i32> [#uses=1]
+ ; (a+c)+b
+ %tmp.11 = add i32 %tmp.8, %tmp.1 ; <i32> [#uses=1]
+ ; X ^ X = 0
+ %RV = xor i32 %tmp.5, %tmp.11 ; <i32> [#uses=1]
+ ret i32 %RV
+}
diff --git a/test/Transforms/Reassociate/dg.exp b/test/Transforms/Reassociate/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/Reassociate/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/Reassociate/inverses.ll b/test/Transforms/Reassociate/inverses.ll
new file mode 100644
index 000000000000..5b08d0eec675
--- /dev/null
+++ b/test/Transforms/Reassociate/inverses.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -reassociate -dce | llvm-dis | \
+; RUN: not grep {\\(and\\|sub\\)}
+
+define i32 @test1(i32 %a, i32 %b) {
+ %tmp.2 = and i32 %b, %a ; <i32> [#uses=1]
+ %tmp.4 = xor i32 %a, -1 ; <i32> [#uses=1]
+ ; (A&B)&~A == 0
+ %tmp.5 = and i32 %tmp.2, %tmp.4 ; <i32> [#uses=1]
+ ret i32 %tmp.5
+}
+
+define i32 @test2(i32 %a, i32 %b) {
+ %tmp.1 = and i32 %a, 1234 ; <i32> [#uses=1]
+ %tmp.2 = and i32 %b, %tmp.1 ; <i32> [#uses=1]
+ %tmp.4 = xor i32 %a, -1 ; <i32> [#uses=1]
+ ; A&~A == 0
+ %tmp.5 = and i32 %tmp.2, %tmp.4 ; <i32> [#uses=1]
+ ret i32 %tmp.5
+}
+
+define i32 @test3(i32 %b, i32 %a) {
+ %tmp.1 = add i32 %a, 1234 ; <i32> [#uses=1]
+ %tmp.2 = add i32 %b, %tmp.1 ; <i32> [#uses=1]
+ %tmp.4 = sub i32 0, %a ; <i32> [#uses=1]
+ ; (b+(a+1234))+-a -> b+1234
+ %tmp.5 = add i32 %tmp.2, %tmp.4 ; <i32> [#uses=1]
+ ret i32 %tmp.5
+}
diff --git a/test/Transforms/Reassociate/looptest.ll b/test/Transforms/Reassociate/looptest.ll
new file mode 100644
index 000000000000..3b28c2389538
--- /dev/null
+++ b/test/Transforms/Reassociate/looptest.ll
@@ -0,0 +1,50 @@
+; This testcase comes from this C fragment:
+;
+; void test(unsigned Num, int *Array) {
+; unsigned i, j, k;
+;
+; for (i = 0; i != Num; ++i)
+; for (j = 0; j != Num; ++j)
+; for (k = 0; k != Num; ++k)
+; printf("%d\n", i+k+j); /* Reassociate to (i+j)+k */
+;}
+;
+; In this case, we want to reassociate the specified expr so that i+j can be
+; hoisted out of the inner most loop.
+;
+; RUN: llvm-as < %s | opt -reassociate | llvm-dis | grep 115 | not grep 117
+; END.
+@.LC0 = internal global [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+declare i32 @printf(i8*, ...)
+
+define void @test(i32 %Num, i32* %Array) {
+bb0:
+ %cond221 = icmp eq i32 0, %Num ; <i1> [#uses=3]
+ br i1 %cond221, label %bb7, label %bb2
+bb2: ; preds = %bb6, %bb0
+ %reg115 = phi i32 [ %reg120, %bb6 ], [ 0, %bb0 ] ; <i32> [#uses=2]
+ br i1 %cond221, label %bb6, label %bb3
+bb3: ; preds = %bb5, %bb2
+ %reg116 = phi i32 [ %reg119, %bb5 ], [ 0, %bb2 ] ; <i32> [#uses=2]
+ br i1 %cond221, label %bb5, label %bb4
+bb4: ; preds = %bb4, %bb3
+ %reg117 = phi i32 [ %reg118, %bb4 ], [ 0, %bb3 ] ; <i32> [#uses=2]
+ %reg113 = add i32 %reg115, %reg117 ; <i32> [#uses=1]
+ %reg114 = add i32 %reg113, %reg116 ; <i32> [#uses=1]
+ %cast227 = getelementptr [4 x i8]* @.LC0, i64 0, i64 0 ; <i8*> [#uses=1]
+ call i32 (i8*, ...)* @printf( i8* %cast227, i32 %reg114 ) ; <i32>:0 [#uses=0]
+ %reg118 = add i32 %reg117, 1 ; <i32> [#uses=2]
+ %cond224 = icmp ne i32 %reg118, %Num ; <i1> [#uses=1]
+ br i1 %cond224, label %bb4, label %bb5
+bb5: ; preds = %bb4, %bb3
+ %reg119 = add i32 %reg116, 1 ; <i32> [#uses=2]
+ %cond225 = icmp ne i32 %reg119, %Num ; <i1> [#uses=1]
+ br i1 %cond225, label %bb3, label %bb6
+bb6: ; preds = %bb5, %bb2
+ %reg120 = add i32 %reg115, 1 ; <i32> [#uses=2]
+ %cond226 = icmp ne i32 %reg120, %Num ; <i1> [#uses=1]
+ br i1 %cond226, label %bb2, label %bb7
+bb7: ; preds = %bb6, %bb0
+ ret void
+}
diff --git a/test/Transforms/Reassociate/mul-factor3.ll b/test/Transforms/Reassociate/mul-factor3.ll
new file mode 100644
index 000000000000..e45e431df545
--- /dev/null
+++ b/test/Transforms/Reassociate/mul-factor3.ll
@@ -0,0 +1,16 @@
+; This should be one add and two multiplies.
+
+; RUN: llvm-as < %s | \
+; RUN: opt -reassociate -instcombine | llvm-dis > %t
+; RUN: grep mul %t | count 2
+; RUN: grep add %t | count 1
+
+define i32 @test(i32 %A, i32 %B, i32 %C) {
+ %aa = mul i32 %A, %A ; <i32> [#uses=1]
+ %aab = mul i32 %aa, %B ; <i32> [#uses=1]
+ %ac = mul i32 %A, %C ; <i32> [#uses=1]
+ %aac = mul i32 %ac, %A ; <i32> [#uses=1]
+ %r = add i32 %aab, %aac ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/test/Transforms/Reassociate/mul-neg-add.ll b/test/Transforms/Reassociate/mul-neg-add.ll
new file mode 100644
index 000000000000..1899be79e112
--- /dev/null
+++ b/test/Transforms/Reassociate/mul-neg-add.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis |\
+; RUN: not grep {sub i32 0}
+
+define i32 @test(i32 %X, i32 %Y, i32 %Z) {
+ %A = sub i32 0, %X ; <i32> [#uses=1]
+ %B = mul i32 %A, %Y ; <i32> [#uses=1]
+ ; (-X)*Y + Z -> Z-X*Y
+ %C = add i32 %B, %Z ; <i32> [#uses=1]
+ ret i32 %C
+}
diff --git a/test/Transforms/Reassociate/mulfactor.ll b/test/Transforms/Reassociate/mulfactor.ll
new file mode 100644
index 000000000000..f80019c95e36
--- /dev/null
+++ b/test/Transforms/Reassociate/mulfactor.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep mul | count 2
+
+; This should have exactly 2 multiplies when we're done.
+
+define i32 @f(i32 %a, i32 %b) {
+ %tmp.2 = mul i32 %a, %a ; <i32> [#uses=1]
+ %tmp.5 = shl i32 %a, 1 ; <i32> [#uses=1]
+ %tmp.6 = mul i32 %tmp.5, %b ; <i32> [#uses=1]
+ %tmp.10 = mul i32 %b, %b ; <i32> [#uses=1]
+ %tmp.7 = add i32 %tmp.6, %tmp.2 ; <i32> [#uses=1]
+ %tmp.11 = add i32 %tmp.7, %tmp.10 ; <i32> [#uses=1]
+ ret i32 %tmp.11
+}
+
diff --git a/test/Transforms/Reassociate/mulfactor2.ll b/test/Transforms/Reassociate/mulfactor2.ll
new file mode 100644
index 000000000000..62a890b90b68
--- /dev/null
+++ b/test/Transforms/Reassociate/mulfactor2.ll
@@ -0,0 +1,16 @@
+; This should turn into one multiply and one add.
+
+; RUN: llvm-as < %s | \
+; RUN: opt -instcombine -reassociate -instcombine | llvm-dis > %t
+; RUN: grep mul %t | count 1
+; RUN: grep add %t | count 1
+
+define i32 @main(i32 %t) {
+ %tmp.3 = mul i32 %t, 12 ; <i32> [#uses=1]
+ %tmp.4 = add i32 %tmp.3, 5 ; <i32> [#uses=1]
+ %tmp.6 = mul i32 %t, 6 ; <i32> [#uses=1]
+ %tmp.8 = mul i32 %tmp.4, 3 ; <i32> [#uses=1]
+ %tmp.9 = add i32 %tmp.8, %tmp.6 ; <i32> [#uses=1]
+ ret i32 %tmp.9
+}
+
diff --git a/test/Transforms/Reassociate/negation.ll b/test/Transforms/Reassociate/negation.ll
new file mode 100644
index 000000000000..6b2041898a1d
--- /dev/null
+++ b/test/Transforms/Reassociate/negation.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | not grep sub
+
+; Test that we can turn things like X*-(Y*Z) -> X*-1*Y*Z.
+
+define i32 @test1(i32 %a, i32 %b, i32 %z) {
+ %c = sub i32 0, %z ; <i32> [#uses=1]
+ %d = mul i32 %a, %b ; <i32> [#uses=1]
+ %e = mul i32 %c, %d ; <i32> [#uses=1]
+ %f = mul i32 %e, 12345 ; <i32> [#uses=1]
+ %g = sub i32 0, %f ; <i32> [#uses=1]
+ ret i32 %g
+}
+
+define i32 @test2(i32 %a, i32 %b, i32 %z) {
+ %d = mul i32 %z, 40 ; <i32> [#uses=1]
+ %c = sub i32 0, %d ; <i32> [#uses=1]
+ %e = mul i32 %a, %c ; <i32> [#uses=1]
+ %f = sub i32 0, %e ; <i32> [#uses=1]
+ ret i32 %f
+}
+
diff --git a/test/Transforms/Reassociate/otherops.ll b/test/Transforms/Reassociate/otherops.ll
new file mode 100644
index 000000000000..3c9b0744a8fc
--- /dev/null
+++ b/test/Transforms/Reassociate/otherops.ll
@@ -0,0 +1,28 @@
+; Reassociation should apply to Add, Mul, And, Or, & Xor
+;
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 12
+
+define i32 @test_mul(i32 %arg) {
+ %tmp1 = mul i32 12, %arg ; <i32> [#uses=1]
+ %tmp2 = mul i32 %tmp1, 12 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define i32 @test_and(i32 %arg) {
+ %tmp1 = and i32 14, %arg ; <i32> [#uses=1]
+ %tmp2 = and i32 %tmp1, 14 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define i32 @test_or(i32 %arg) {
+ %tmp1 = or i32 14, %arg ; <i32> [#uses=1]
+ %tmp2 = or i32 %tmp1, 14 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define i32 @test_xor(i32 %arg) {
+ %tmp1 = xor i32 12, %arg ; <i32> [#uses=1]
+ %tmp2 = xor i32 %tmp1, 12 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
diff --git a/test/Transforms/Reassociate/shift-factor.ll b/test/Transforms/Reassociate/shift-factor.ll
new file mode 100644
index 000000000000..05437fd86639
--- /dev/null
+++ b/test/Transforms/Reassociate/shift-factor.ll
@@ -0,0 +1,13 @@
+; There should be exactly one shift and one add left.
+; RUN: llvm-as < %s | \
+; RUN: opt -reassociate -instcombine | llvm-dis > %t
+; RUN: grep shl %t | count 1
+; RUN: grep add %t | count 1
+
+define i32 @test(i32 %X, i32 %Y) {
+ %tmp.2 = shl i32 %X, 1 ; <i32> [#uses=1]
+ %tmp.6 = shl i32 %Y, 1 ; <i32> [#uses=1]
+ %tmp.4 = add i32 %tmp.6, %tmp.2 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+}
+
diff --git a/test/Transforms/Reassociate/shifttest.ll b/test/Transforms/Reassociate/shifttest.ll
new file mode 100644
index 000000000000..fd49e7d3f223
--- /dev/null
+++ b/test/Transforms/Reassociate/shifttest.ll
@@ -0,0 +1,12 @@
+; With shl->mul reassociation, we can see that this is (shl A, 9) * A
+;
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis |\
+; RUN: grep {shl .*, 9}
+
+define i32 @test(i32 %A, i32 %B) {
+ %X = shl i32 %A, 5 ; <i32> [#uses=1]
+ %Y = shl i32 %A, 4 ; <i32> [#uses=1]
+ %Z = mul i32 %Y, %X ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/Reassociate/subtest.ll b/test/Transforms/Reassociate/subtest.ll
new file mode 100644
index 000000000000..513984e7722d
--- /dev/null
+++ b/test/Transforms/Reassociate/subtest.ll
@@ -0,0 +1,11 @@
+; With sub reassociation, constant folding can eliminate the 12 and -12 constants.
+;
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | not grep 12
+
+define i32 @test(i32 %A, i32 %B) {
+ %X = add i32 -12, %A ; <i32> [#uses=1]
+ %Y = sub i32 %X, %B ; <i32> [#uses=1]
+ %Z = add i32 %Y, 12 ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/Reassociate/subtest2.ll b/test/Transforms/Reassociate/subtest2.ll
new file mode 100644
index 000000000000..c81e9b38def9
--- /dev/null
+++ b/test/Transforms/Reassociate/subtest2.ll
@@ -0,0 +1,13 @@
+; With sub reassociation, constant folding can eliminate the uses of %a.
+;
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep %a | count 1
+; PR2047
+
+define i32 @test(i32 %a, i32 %b, i32 %c) nounwind {
+entry:
+ %tmp3 = sub i32 %a, %b ; <i32> [#uses=1]
+ %tmp5 = sub i32 %tmp3, %c ; <i32> [#uses=1]
+ %tmp7 = sub i32 %tmp5, %a ; <i32> [#uses=1]
+ ret i32 %tmp7
+}
+
diff --git a/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll b/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll
new file mode 100644
index 000000000000..13b45f59a94f
--- /dev/null
+++ b/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll
@@ -0,0 +1,26 @@
+; 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-as < %s | opt -sccp | llvm-dis | not grep loop
+
+define i32* @test() {
+bb1:
+ %A = malloc i32 ; <i32*> [#uses=2]
+ br label %bb2
+bb2: ; preds = %bb2, %bb1
+ ;; Always 0
+ %i = phi i32 [ %i2, %bb2 ], [ 0, %bb1 ] ; <i32> [#uses=2]
+ ;; Always 1
+ %i2 = add i32 %i, 1 ; <i32> [#uses=2]
+ store i32 %i, i32* %A
+ ;; Always false
+ %loop = icmp sle i32 %i2, 0 ; <i1> [#uses=1]
+ br i1 %loop, label %bb2, label %bb3
+bb3: ; preds = %bb2
+ ret i32* %A
+}
+
diff --git a/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll b/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll
new file mode 100644
index 000000000000..fd4083d1374c
--- /dev/null
+++ b/test/Transforms/SCCP/2002-05-02-MissSecondInst.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep sub
+
+define void @test3(i32, i32) {
+ add i32 0, 0 ; <i32>:3 [#uses=0]
+ sub i32 0, 4 ; <i32>:4 [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll b/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
new file mode 100644
index 000000000000..61bf5db44441
--- /dev/null
+++ b/test/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
@@ -0,0 +1,19 @@
+; 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-as < %s | opt -sccp | llvm-dis | grep phi
+
+define i32 @test(i32 %A, i1 %c) {
+bb1:
+ br label %BB2
+BB2: ; preds = %BB4, %bb1
+ %V = phi i32 [ 0, %bb1 ], [ %A, %BB4 ] ; <i32> [#uses=1]
+ br label %BB3
+BB3: ; preds = %BB2
+ br i1 %c, label %BB4, label %BB5
+BB4: ; preds = %BB3
+ br label %BB2
+BB5: ; preds = %BB3
+ ret i32 %V
+}
+
diff --git a/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll b/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
new file mode 100644
index 000000000000..b46d23a9dcf3
--- /dev/null
+++ b/test/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
@@ -0,0 +1,33 @@
+; 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-as < %s | opt -sccp -simplifycfg | llvm-dis | \
+; RUN: grep ret
+
+define void @old_main() {
+bb3:
+ br label %bb6
+bb6: ; preds = %bb14, %bb3
+ %reg403 = phi i32 [ %reg155, %bb14 ], [ 0, %bb3 ] ; <i32> [#uses=1]
+ %reg155 = add i32 %reg403, 1 ; <i32> [#uses=2]
+ br label %bb11
+bb11: ; preds = %bb11, %bb6
+ %reg407 = phi i32 [ %reg408, %bb11 ], [ 0, %bb6 ] ; <i32> [#uses=2]
+ %reg408 = add i32 %reg407, 1 ; <i32> [#uses=1]
+ %cond550 = icmp sle i32 %reg407, 1 ; <i1> [#uses=1]
+ br i1 %cond550, label %bb11, label %bb12
+bb12: ; preds = %bb11
+ br label %bb13
+bb13: ; preds = %bb13, %bb12
+ %reg409 = phi i32 [ %reg410, %bb13 ], [ 0, %bb12 ] ; <i32> [#uses=1]
+ %reg410 = add i32 %reg409, 1 ; <i32> [#uses=2]
+ %cond552 = icmp sle i32 %reg410, 2 ; <i1> [#uses=1]
+ br i1 %cond552, label %bb13, label %bb14
+bb14: ; preds = %bb13
+ %cond553 = icmp sle i32 %reg155, 31 ; <i1> [#uses=1]
+ br i1 %cond553, label %bb6, label %bb15
+bb15: ; preds = %bb14
+ ret void
+}
+
diff --git a/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll b/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll
new file mode 100644
index 000000000000..c5a7c790bd26
--- /dev/null
+++ b/test/Transforms/SCCP/2002-08-30-GetElementPtrTest.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep %X
+
+@G = external global [40 x i32] ; <[40 x i32]*> [#uses=1]
+
+define i32* @test() {
+ %X = getelementptr [40 x i32]* @G, i64 0, i64 0 ; <i32*> [#uses=1]
+ ret i32* %X
+}
+
diff --git a/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll b/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll
new file mode 100644
index 000000000000..03ff4dde8a10
--- /dev/null
+++ b/test/Transforms/SCCP/2003-06-24-OverdefinedPHIValue.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -sccp -simplifycfg | llvm-dis | \
+; RUN: not grep then:
+
+define void @cprop_test11(i32* %data.1) {
+entry:
+ %tmp.1 = load i32* %data.1 ; <i32> [#uses=3]
+ %tmp.41 = icmp sgt i32 %tmp.1, 1 ; <i1> [#uses=1]
+ br i1 %tmp.41, label %no_exit, label %loopexit
+no_exit: ; preds = %endif, %then, %entry
+ %j.0 = phi i32 [ %j.0, %endif ], [ %i.0, %then ], [ 1, %entry ] ; <i32> [#uses=3]
+ %i.0 = phi i32 [ %inc, %endif ], [ %inc1, %then ], [ 1, %entry ] ; <i32> [#uses=4]
+ %tmp.8.not = icmp ne i32 %j.0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.8.not, label %endif, label %then
+then: ; preds = %no_exit
+ %inc1 = add i32 %i.0, 1 ; <i32> [#uses=3]
+ %tmp.42 = icmp slt i32 %inc1, %tmp.1 ; <i1> [#uses=1]
+ br i1 %tmp.42, label %no_exit, label %loopexit
+endif: ; preds = %no_exit
+ %inc = add i32 %i.0, 1 ; <i32> [#uses=3]
+ %tmp.4 = icmp slt i32 %inc, %tmp.1 ; <i1> [#uses=1]
+ br i1 %tmp.4, label %no_exit, label %loopexit
+loopexit: ; preds = %endif, %then, %entry
+ %j.1 = phi i32 [ 1, %entry ], [ %j.0, %endif ], [ %i.0, %then ] ; <i32> [#uses=1]
+ %i.1 = phi i32 [ 1, %entry ], [ %inc, %endif ], [ %inc1, %then ] ; <i32> [#uses=1]
+ %tmp.17 = getelementptr i32* %data.1, i64 1 ; <i32*> [#uses=1]
+ store i32 %j.1, i32* %tmp.17
+ %tmp.23 = getelementptr i32* %data.1, i64 2 ; <i32*> [#uses=1]
+ store i32 %i.1, i32* %tmp.23
+ ret void
+}
diff --git a/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll b/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll
new file mode 100644
index 000000000000..020af7d16c7d
--- /dev/null
+++ b/test/Transforms/SCCP/2003-08-26-InvokeHandling.ll
@@ -0,0 +1,18 @@
+; The PHI cannot be eliminated from this testcase, SCCP is mishandling invoke's!
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep phi
+
+declare void @foo()
+
+define i32 @test(i1 %cond) {
+Entry:
+ br i1 %cond, label %Inv, label %Cont
+Inv: ; preds = %Entry
+ invoke void @foo( )
+ to label %Ok unwind label %Cont
+Ok: ; preds = %Inv
+ br label %Cont
+Cont: ; preds = %Ok, %Inv, %Entry
+ %X = phi i32 [ 0, %Entry ], [ 1, %Ok ], [ 0, %Inv ] ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll b/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll
new file mode 100644
index 000000000000..cf64677334a2
--- /dev/null
+++ b/test/Transforms/SCCP/2004-11-16-DeadInvoke.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -sccp -disable-output
+
+declare i32 @foo()
+
+define void @caller() {
+ br i1 true, label %T, label %F
+F: ; preds = %0
+ %X = invoke i32 @foo( )
+ to label %T unwind label %T ; <i32> [#uses=0]
+T: ; preds = %F, %F, %0
+ ret void
+}
+
diff --git a/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll b/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
new file mode 100644
index 000000000000..6592e8b08925
--- /dev/null
+++ b/test/Transforms/SCCP/2004-12-10-UndefBranchBug.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i32 1}
+
+; This function definitely returns 1, even if we don't know the direction
+; of the branch.
+
+define i32 @foo() {
+ br i1 undef, label %T, label %T
+T: ; preds = %0, %0
+ %X = add i32 0, 1 ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll b/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
new file mode 100644
index 000000000000..299b79f53e21
--- /dev/null
+++ b/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll
@@ -0,0 +1,103 @@
+; RUN: llvm-as < %s | opt -sccp -disable-output
+; END.
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8.7.0"
+ %struct.pat_list = type { i32, %struct.pat_list* }
+@JUMP = external global i32 ; <i32*> [#uses=1]
+@old_D_pat = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
+
+define void @asearch1(i32 %D) {
+entry:
+ %tmp80 = icmp ult i32 0, %D ; <i1> [#uses=1]
+ br i1 %tmp80, label %bb647.preheader, label %cond_true81.preheader
+cond_true81.preheader: ; preds = %entry
+ ret void
+bb647.preheader: ; preds = %entry
+ %tmp3.i = call i32 @read( ) ; <i32> [#uses=1]
+ %tmp6.i = add i32 %tmp3.i, 0 ; <i32> [#uses=1]
+ %tmp653 = icmp sgt i32 %tmp6.i, 0 ; <i1> [#uses=1]
+ br i1 %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 i1 undef, label %cond_true612, label %cond_next624
+UnifiedReturnBlock: ; preds = %bb647.preheader
+ ret void
+}
+
+define void @bitap(i32 %D) {
+entry:
+ %tmp29 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp29, label %cond_next50, label %cond_next37
+cond_next37: ; preds = %entry
+ ret void
+cond_next50: ; preds = %entry
+ %tmp52 = icmp sgt i32 %D, 0 ; <i1> [#uses=1]
+ br i1 %tmp52, label %cond_true53, label %cond_next71
+cond_true53: ; preds = %cond_next50
+ %tmp54 = load i32* @JUMP ; <i32> [#uses=1]
+ %tmp55 = icmp eq i32 %tmp54, 1 ; <i1> [#uses=1]
+ br i1 %tmp55, label %cond_true56, label %cond_next63
+cond_true56: ; preds = %cond_true53
+ %tmp57 = bitcast i32 %D to i32 ; <i32> [#uses=1]
+ call void @asearch1( i32 %tmp57 )
+ ret void
+cond_next63: ; preds = %cond_true53
+ ret void
+cond_next71: ; preds = %cond_next50
+ ret void
+}
+
+declare i32 @read()
+
+define void @initial_value() {
+entry:
+ ret void
+}
+
+define void @main() {
+entry:
+ br label %cond_next252
+cond_next208: ; preds = %cond_true260
+ %tmp229 = call i32 @atoi( ) ; <i32> [#uses=1]
+ br label %cond_next252
+bb217: ; preds = %cond_true260
+ ret void
+cond_next252: ; preds = %cond_next208, %entry
+ %D.0.0 = phi i32 [ 0, %entry ], [ %tmp229, %cond_next208 ] ; <i32> [#uses=1]
+ %tmp254 = getelementptr i8** null, i32 1 ; <i8**> [#uses=1]
+ %tmp256 = load i8** %tmp254 ; <i8*> [#uses=1]
+ %tmp258 = load i8* %tmp256 ; <i8> [#uses=1]
+ %tmp259 = icmp eq i8 %tmp258, 45 ; <i1> [#uses=1]
+ br i1 %tmp259, label %cond_true260, label %bb263
+cond_true260: ; preds = %cond_next252
+ %tmp205818 = icmp sgt i8 0, -1 ; <i1> [#uses=1]
+ br i1 %tmp205818, label %cond_next208, label %bb217
+bb263: ; preds = %cond_next252
+ %tmp265 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp265, label %cond_next276, label %cond_true266
+cond_true266: ; preds = %bb263
+ ret void
+cond_next276: ; preds = %bb263
+ %tmp278 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp278, label %cond_next298, label %cond_true279
+cond_true279: ; preds = %cond_next276
+ ret void
+cond_next298: ; preds = %cond_next276
+ call void @bitap( i32 %D.0.0 )
+ ret void
+}
+
+declare i32 @atoi()
+
+define void @subset_pset() {
+entry:
+ ret void
+}
+
+define void @strcmp() {
+entry:
+ ret void
+}
diff --git a/test/Transforms/SCCP/2006-12-04-PackedType.ll b/test/Transforms/SCCP/2006-12-04-PackedType.ll
new file mode 100644
index 000000000000..b7a7880b0faf
--- /dev/null
+++ b/test/Transforms/SCCP/2006-12-04-PackedType.ll
@@ -0,0 +1,140 @@
+; Test VectorType handling by SCCP.
+; SCCP ignores VectorTypes until PR 1034 is fixed
+;
+; RUN: llvm-as < %s | opt -sccp
+; END.
+
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8"
+ %struct.GLDAlphaTest = type { float, i16, i8, i8 }
+ %struct.GLDArrayRange = type { i8, i8, i8, i8 }
+ %struct.GLDBlendMode = type { i16, i16, i16, i16, %struct.GLTColor4, i16, i16, i8, i8, i8, i8 }
+ %struct.GLDBufferRec = type opaque
+ %struct.GLDBufferstate = type { %struct.GLTDimensions, %struct.GLTDimensions, %struct.GLTFixedColor4, %struct.GLTFixedColor4, i8, i8, i8, i8, [2 x %struct.GLSBuffer], [4 x %struct.GLSBuffer], %struct.GLSBuffer, %struct.GLSBuffer, %struct.GLSBuffer, [4 x %struct.GLSBuffer*], %struct.GLSBuffer*, %struct.GLSBuffer*, %struct.GLSBuffer*, i8, i8 }
+ %struct.GLDClearColor = type { double, %struct.GLTColor4, %struct.GLTColor4, float, i32 }
+ %struct.GLDClipPlane = type { i32, [6 x %struct.GLTColor4] }
+ %struct.GLDColorBuffer = type { i16, i16, [4 x i16] }
+ %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*, i32, i32, %struct.GLVMFragmentAttribRec*, %struct.GLVMFragmentAttribRec*, i32)*, %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*, i32, i32, i32, float, float, float, i32, %struct.GLSDrawable, %struct.GLDFramebufferAttachment, %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 i8*], i8*, i8* }, [64 x float], %struct.GLDStippleData, i16, i8, i8, i32, %struct.GLDFramebufferRec*, i8, %struct.GLDQueryRec*, %struct.GLDQueryRec* }
+ %struct.GLDConvolution = type { %struct.GLTColor4, %struct.GLDImagingColorScale, i16, i16, float*, i32, i32 }
+ %struct.GLDDepthTest = type { i16, i16, i8, i8, i8, i8, double, double }
+ %struct.GLDFogMode = type { %struct.GLTColor4, float, float, float, float, float, i16, i16, i16, i8, i8 }
+ %struct.GLDFormat = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i32 }
+ %struct.GLDFramebufferAttachment = type { i32, i32, i32, i32, i32, i32 }
+ %struct.GLDFramebufferData = type { [6 x %struct.GLDFramebufferAttachment], [4 x i16], i16, i16, i16, i16, i32 }
+ %struct.GLDFramebufferRec = type { %struct.GLDFramebufferData*, %struct.GLDPluginFramebufferData*, %struct.GLDPixelFormat }
+ %struct.GLDHintMode = type { i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 }
+ %struct.GLDHistogram = type { %struct.GLTFixedColor4*, i32, i16, i8, i8 }
+ %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, i32 }
+ %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], i32, i16, i16, i16, i8, i8, i8, i8, i8, i8 }
+ %struct.GLDLightProduct = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4 }
+ %struct.GLDLineMode = type { float, i32, i16, i16, i8, i8, i8, i8 }
+ %struct.GLDLogicOp = type { i16, i8, i8 }
+ %struct.GLDMaskMode = type { i32, [3 x i32], i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.GLDMaterial = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, float, float, float, float, [8 x %struct.GLDLightProduct], %struct.GLTColor4, [6 x i32], [2 x i32] }
+ %struct.GLDMinmax = type { %struct.GLDMinmaxTable*, i16, i8, i8 }
+ %struct.GLDMinmaxTable = type { %struct.GLTColor4, %struct.GLTColor4 }
+ %struct.GLDMipmaplevel = type { [4 x i32], [4 x float], [4 x i32], [4 x i32], [4 x float], [4 x i32], [3 x i32], i32, float*, float*, float*, i32, i32, i8*, i16, i16, i16, i16 }
+ %struct.GLDMultisample = type { float, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.GLDPipelineProgramData = type { i16, i16, i32, %struct._PPStreamToken*, i64, %struct.GLDShaderSourceData*, %struct.GLTColor4*, i32 }
+ %struct.GLDPipelineProgramRec = type { %struct.GLDPipelineProgramData*, %struct._PPStreamToken*, %struct._PPStreamToken*, %struct._GLVMFunction*, i32, i32, i32 }
+ %struct.GLDPipelineProgramState = type { i8, i8, i8, i8, %struct.GLTColor4* }
+ %struct.GLDPixelFormat = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.GLDPixelMap = type { i32*, float*, float*, float*, float*, float*, float*, float*, float*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.GLDPixelMode = type { float, float, %struct.GLDPixelStore, %struct.GLDPixelTransfer, %struct.GLDPixelMap, %struct.GLDImagingSubset, i32, i32 }
+ %struct.GLDPixelPack = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 }
+ %struct.GLDPixelStore = type { %struct.GLDPixelPack, %struct.GLDPixelPack }
+ %struct.GLDPixelTransfer = type { float, float, float, float, float, float, float, float, float, float, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float }
+ %struct.GLDPluginFramebufferData = type { [6 x %struct.GLDTextureRec*], i32, i32 }
+ %struct.GLDPluginProgramData = type { [3 x %struct.GLDPipelineProgramRec*], %struct.GLDBufferRec**, i32 }
+ %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, i8, i8, i8, i8, i16, i16, i32, i16, i16 }
+ %struct.GLDPolygonMode = type { [128 x i8], float, float, i16, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8 }
+ %struct.GLDProgramData = type { i32, [16 x i32], i32, i32, i32, i32 }
+ %struct.GLDProgramRec = type { %struct.GLDProgramData*, %struct.GLDPluginProgramData*, i32 }
+ %struct.GLDQueryRec = type { i32, i32, %struct.GLDQueryRec* }
+ %struct.GLDRect = type { i32, i32, i32, i32, i32, i32 }
+ %struct.GLDRegisterCombiners = type { i8, i8, i8, i8, i32, [2 x %struct.GLTColor4], [8 x %struct.GLDRegisterCombinersPerStageState], %struct.GLDRegisterCombinersFinalStageState }
+ %struct.GLDRegisterCombinersFinalStageState = type { i8, i8, i8, i8, [7 x %struct.GLDRegisterCombinersPerVariableState] }
+ %struct.GLDRegisterCombinersPerPortionState = type { [4 x %struct.GLDRegisterCombinersPerVariableState], i8, i8, i8, i8, i16, i16, i16, i16, i16, i16 }
+ %struct.GLDRegisterCombinersPerStageState = type { [2 x %struct.GLDRegisterCombinersPerPortionState], [2 x %struct.GLTColor4] }
+ %struct.GLDRegisterCombinersPerVariableState = type { i16, i16, i16, i16 }
+ %struct.GLDScissorTest = type { %struct.GLTFixedColor4, i8, i8, i8, i8 }
+ %struct.GLDShaderSourceData = type { i32, i32, i8*, i32*, i32, i32, i8*, i32*, i8* }
+ %struct.GLDSharedRec = type opaque
+ %struct.GLDState = type { i16, i16, i32, i32, i32, [256 x %struct.GLTColor4], [128 x %struct.GLTColor4], %struct.GLDViewport, %struct.GLDTransform, %struct.GLDLightModel, i32*, i32, i32, i32, %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, i32, %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 { i32, i32, i16, i16, i16, i16 }], i32, [4 x i8] }
+ %struct.GLDStippleData = type { i32, i16, i16, [32 x [32 x i8]] }
+ %struct.GLDTextureCoordGen = type { { i16, i16, %struct.GLTColor4, %struct.GLTColor4 }, { i16, i16, %struct.GLTColor4, %struct.GLTColor4 }, { i16, i16, %struct.GLTColor4, %struct.GLTColor4 }, { i16, i16, %struct.GLTColor4, %struct.GLTColor4 }, i8, i8, i8, i8 }
+ %struct.GLDTextureGeomState = type { i16, i16, i16, i16, i16, i8, i8, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [6 x i16], [6 x i16] }
+ %struct.GLDTextureLevel = type { i32, i32, i16, i16, i16, i8, i8, i16, i16, i16, i16, i8* }
+ %struct.GLDTextureMachine = type { [8 x %struct.GLDTextureRec*], %struct.GLDTextureRec*, i8, i8, i8, i8 }
+ %struct.GLDTextureMode = type { %struct.GLTColor4, i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, float, float, float, i16, i16, i16, i16, i16, i16, [4 x i16], i8, i8, i8, i8, [3 x float], [4 x float], float, float }
+ %struct.GLDTextureParamState = type { i16, i16, i16, i16, i16, i16, %struct.GLTColor4, float, float, float, float, i16, i16, i16, i16, float, i16, i8, i8, i32, i8* }
+ %struct.GLDTextureRec = type { %struct.GLDTextureState*, i32, [2 x float], float, i32, float, float, float, float, float, float, %struct.GLDMipmaplevel*, %struct.GLDMipmaplevel*, i32, i32, i32, i32, i32, i32, %struct.GLDTextureParamState, i32, [2 x %struct._PPStreamToken] }
+ %struct.GLDTextureState = type { i16, i16, i16, float, i32, i16, %struct.GLISWRSurface*, i8, i8, i8, i8, %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, i32, float, i16, i16, i8, i8, i8, i8 }
+ %struct.GLDTransformFeedback = type { i8, i8, i8, [16 x i32], [16 x i32] }
+ %struct.GLDVertex = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTCoord3, float, %struct.GLTColor4, float, float, float, i8, i8, i8, i8, [4 x float], [2 x %struct.GLDMaterial*], i32, i32, [8 x %struct.GLTColor4] }
+ %struct.GLDVertexArrayRec = type opaque
+ %struct.GLDViewport = type { float, float, float, float, float, float, float, float, double, double, i32, i32, i32, i32, float, float, float, float }
+ %struct.GLGColorTable = type { i32, i32, i32, i8* }
+ %struct.GLGOperation = type { i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 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 { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, [4 x i8*], i32 }
+ %struct.GLIWindow = type { i32, i32, i32 }
+ %struct.GLSBuffer = type { i8* }
+ %struct.GLSDrawable = type { %struct.GLSWindowRec* }
+ %struct.GLSWindowRec = type { %struct.GLTDimensions, %struct.GLTDimensions, i32, i32, %struct.GLSDrawable, [2 x i8*], i8*, i8*, i8*, [4 x i8*], i32, i32, i32, i32, [4 x i32], i16, i16, i16, %struct.GLIWindow, i32, i32, i8*, i8* }
+ %struct.GLTColor4 = type { float, float, float, float }
+ %struct.GLTCoord3 = type { float, float, float }
+ %struct.GLTDimensions = type { i32, i32 }
+ %struct.GLTFixedColor4 = type { i32, i32, i32, i32 }
+ %struct.GLVMFPContext = type { float, i32, i32, i32 }
+ %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 { { i16, i8, i8, i32 } }
+
+define void @gldLLVMVecPointRender(%struct.GLDContextRec* %ctx) {
+entry:
+ %tmp.uip = getelementptr %struct.GLDContextRec* %ctx, i32 0, i32 22 ; <i32*> [#uses=1]
+ %tmp = load i32* %tmp.uip ; <i32> [#uses=3]
+ %tmp91 = lshr i32 %tmp, 5 ; <i32> [#uses=1]
+ %tmp92 = trunc i32 %tmp91 to i1 ; <i1> [#uses=1]
+ br i1 %tmp92, label %cond_true93, label %cond_next116
+cond_true93: ; preds = %entry
+ %tmp.upgrd.1 = getelementptr %struct.GLDContextRec* %ctx, i32 0, i32 31, i32 14 ; <i32*> [#uses=1]
+ %tmp95 = load i32* %tmp.upgrd.1 ; <i32> [#uses=1]
+ %tmp95.upgrd.2 = sitofp i32 %tmp95 to float ; <float> [#uses=1]
+ %tmp108 = mul float undef, %tmp95.upgrd.2 ; <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 = fcmp olt float %point_size.2, 1.000000e+00 ; <i1> [#uses=1]
+ %tmp460 = lshr i32 %tmp, 6 ; <i32> [#uses=1]
+ %tmp461 = trunc i32 %tmp460 to i1 ; <i1> [#uses=1]
+ br i1 %tmp457, label %cond_true458, label %cond_next484
+cond_true458: ; preds = %cond_next116
+ br i1 %tmp461, label %cond_true462, label %cond_next487
+cond_true462: ; preds = %cond_true458
+ %tmp26 = bitcast i32 %tmp to i32 ; <i32> [#uses=1]
+ %tmp465 = and i32 %tmp26, 128 ; <i32> [#uses=1]
+ %tmp466 = icmp eq i32 %tmp465, 0 ; <i1> [#uses=1]
+ br i1 %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, i32 2 ; <<4 x float>> [#uses=1]
+ %tmp495 = insertelement <4 x float> %tmp494, float %radius.0, i32 3 ; <<4 x float>> [#uses=0]
+ ret void
+}
diff --git a/test/Transforms/SCCP/2006-12-19-UndefBug.ll b/test/Transforms/SCCP/2006-12-19-UndefBug.ll
new file mode 100644
index 000000000000..4d686690b98f
--- /dev/null
+++ b/test/Transforms/SCCP/2006-12-19-UndefBug.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | \
+; RUN: grep {ret i1 false}
+
+define i1 @foo() {
+ %X = and i1 false, undef ; <i1> [#uses=1]
+ ret i1 %X
+}
+
diff --git a/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll b/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll
new file mode 100644
index 000000000000..c099b88044c0
--- /dev/null
+++ b/test/Transforms/SCCP/2007-05-16-InvokeCrash.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -sccp -disable-output
+; PR 1431
+
+define void @_ada_bench() {
+entry:
+ br label %cond_next
+cond_next: ; preds = %cond_next, %entry
+ %indvar46 = phi i32 [ 0, %entry ], [ %indvar.next47, %cond_next ] ; <i32> [#uses=1]
+ %indvar.next47 = add i32 %indvar46, 1 ; <i32> [#uses=2]
+ %exitcond48 = icmp eq i32 %indvar.next47, 10000 ; <i1> [#uses=1]
+ br i1 %exitcond48, label %cond_next40, label %cond_next
+cond_next40: ; preds = %cond_next40, %cond_next
+ %indvar43 = phi i32 [ %indvar.next44, %cond_next40 ], [ 0, %cond_next ] ; <i32> [#uses=1]
+ %indvar.next44 = add i32 %indvar43, 1 ; <i32> [#uses=2]
+ %exitcond45 = icmp eq i32 %indvar.next44, 10000 ; <i1> [#uses=1]
+ br i1 %exitcond45, label %cond_next53, label %cond_next40
+cond_next53: ; preds = %cond_next53, %cond_next40
+ %indvar41 = phi i32 [ %indvar.next42, %cond_next53 ], [ 0, %cond_next40 ] ; <i32> [#uses=1]
+ %indvar.next42 = add i32 %indvar41, 1 ; <i32> [#uses=2]
+ %exitcond = icmp eq i32 %indvar.next42, 10000 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb67, label %cond_next53
+bb67: ; preds = %cond_next53
+ %tmp112 = invoke double @sin( double 5.000000e-01 )
+ to label %bb114 unwind label %cleanup ; <double> [#uses=0]
+bb114: ; preds = %bb67
+ %tmp147 = invoke double @log( double 5.000000e-01 )
+ to label %bb149 unwind label %cleanup ; <double> [#uses=0]
+bb149: ; preds = %bb114
+ %tmp175 = invoke double @sqrt( double 5.000000e-01 )
+ to label %bb177 unwind label %cleanup ; <double> [#uses=0]
+bb177: ; preds = %bb149
+ unreachable
+cleanup: ; preds = %bb149, %bb114, %bb67
+ unwind
+}
+
+declare double @sin(double)
+
+declare double @log(double)
+
+declare double @sqrt(double)
diff --git a/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll b/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
new file mode 100644
index 000000000000..18ab5e8cdc5b
--- /dev/null
+++ b/test/Transforms/SCCP/2008-01-27-UndefCorrelate.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep undef | count 1
+; PR1938
+
+define i32 @main() {
+entry:
+ br label %bb
+
+bb:
+ %indvar = phi i32 [ 0, %entry ], [ %k, %bb.backedge ]
+ %k = add i32 %indvar, 1
+ br i1 undef, label %cond_true, label %cond_false
+
+cond_true:
+ %tmp97 = icmp slt i32 %k, 10
+ br i1 %tmp97, label %bb.backedge, label %bb12
+
+bb.backedge:
+ br label %bb
+
+cond_false:
+ %tmp9 = icmp slt i32 %k, 10
+ br i1 %tmp9, label %bb.backedge, label %bb12
+
+bb12:
+ %tmp14 = icmp eq i32 %k, 10
+ br i1 %tmp14, label %cond_next18, label %cond_true17
+
+cond_true17:
+ tail call void @abort( )
+ unreachable
+
+cond_next18:
+ ret i32 0
+}
+
+declare void @abort()
diff --git a/test/Transforms/SCCP/2008-03-10-sret.ll b/test/Transforms/SCCP/2008-03-10-sret.ll
new file mode 100644
index 000000000000..0f1c3806ce3e
--- /dev/null
+++ b/test/Transforms/SCCP/2008-03-10-sret.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis > %t
+; RUN: grep {ret i32 36} %t
+; RUN: grep {%mrv = insertvalue %T undef, i32 18, 0} %t
+; RUN: grep {%mrv1 = insertvalue %T %mrv, i32 17, 1} %t
+; RUN: grep {ret %T %mrv1} %t
+
+%T = type {i32,i32}
+
+define internal {i32, i32} @bar(i32 %A) {
+ %X = add i32 1, %A
+ ret i32 %X, i32 %A
+}
+
+define i32 @foo() {
+ %X = call {i32, i32} @bar(i32 17)
+ %Y = getresult {i32, i32} %X, 0
+ %Z = add i32 %Y, %Y
+ ret i32 %Z
+}
diff --git a/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll b/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll
new file mode 100644
index 000000000000..99f9136ea370
--- /dev/null
+++ b/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i32 %Z}
+; rdar://5778210
+
+declare {i32, i32} @bar(i32 %A)
+
+define i32 @foo() {
+ %X = call {i32, i32} @bar(i32 17)
+ %Y = getresult {i32, i32} %X, 0
+ %Z = add i32 %Y, %Y
+ ret i32 %Z
+}
diff --git a/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll b/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll
new file mode 100644
index 000000000000..f85a36260e0a
--- /dev/null
+++ b/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep {ret i32 undef}
+; PR2358
+target datalayout =
+"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-pc-linux-gnu"
+
+define i32 @x(i32 %b) {
+entry:
+ %val = call i32 @llvm.cttz.i32(i32 undef)
+ ret i32 %val
+}
+
+declare i32 @llvm.cttz.i32(i32)
+
diff --git a/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll b/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll
new file mode 100644
index 000000000000..20f7c21b7c18
--- /dev/null
+++ b/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep {ret i32 42}
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep {ret i32 undef}
+; PR3325
+
+define i32 @main() {
+ %tmp1 = invoke i32 @f()
+ to label %UnifiedReturnBlock unwind label %lpad
+
+lpad:
+ unreachable
+
+UnifiedReturnBlock:
+ ret i32 %tmp1
+}
+
+define internal i32 @f() {
+ ret i32 42
+}
+
+declare i8* @__cxa_begin_catch(i8*) nounwind
+
+declare i8* @llvm.eh.exception() nounwind
+
+declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
+
+declare void @__cxa_end_catch()
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll b/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll
new file mode 100644
index 000000000000..480aca0d1acf
--- /dev/null
+++ b/test/Transforms/SCCP/2009-05-27-VectorOperandZero.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -sccp -disable-output
+; PR4277
+
+define i32 @main() nounwind {
+entry:
+ %0 = tail call signext i8 (...)* @sin() nounwind
+ ret i32 0
+}
+
+declare signext i8 @sin(...)
diff --git a/test/Transforms/SCCP/apint-array.ll b/test/Transforms/SCCP/apint-array.ll
new file mode 100644
index 000000000000..ead3f6ab9a66
--- /dev/null
+++ b/test/Transforms/SCCP/apint-array.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i101 12}
+
+@Y = constant [6 x i101] [ i101 12, i101 123456789000000, i101 -12,i101
+-123456789000000, i101 0,i101 9123456789000000]
+
+define i101 @array()
+{
+Head:
+ %A = getelementptr [6 x i101]* @Y, i32 0, i32 1
+
+ %B = load i101* %A
+ %C = icmp sge i101 %B, 1
+ br i1 %C, label %True, label %False
+True:
+ %D = and i101 %B, 1
+ %E = trunc i101 %D to i32
+ %F = getelementptr [6 x i101]* @Y, i32 0, i32 %E
+ %G = load i101* %F
+ br label %False
+False:
+ %H = phi i101 [%G, %True], [-1, %Head]
+ ret i101 %H
+}
diff --git a/test/Transforms/SCCP/apint-basictest.ll b/test/Transforms/SCCP/apint-basictest.ll
new file mode 100644
index 000000000000..12f8326a7375
--- /dev/null
+++ b/test/Transforms/SCCP/apint-basictest.ll
@@ -0,0 +1,16 @@
+; This is a basic sanity check for constant propogation. The add instruction
+; should be eliminated.
+
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep add
+
+define i128 @test(i1 %B) {
+ br i1 %B, label %BB1, label %BB2
+BB1:
+ %Val = add i128 0, 1
+ br label %BB3
+BB2:
+ br label %BB3
+BB3:
+ %Ret = phi i128 [%Val, %BB1], [2, %BB2]
+ ret i128 %Ret
+}
diff --git a/test/Transforms/SCCP/apint-basictest2.ll b/test/Transforms/SCCP/apint-basictest2.ll
new file mode 100644
index 000000000000..7db4e362eb4c
--- /dev/null
+++ b/test/Transforms/SCCP/apint-basictest2.ll
@@ -0,0 +1,17 @@
+; This is a basic sanity check for constant propogation. The add instruction
+; and phi instruction should be eliminated.
+
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep phi
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep add
+
+define i128 @test(i1 %B) {
+ br i1 %B, label %BB1, label %BB2
+BB1:
+ %Val = add i128 0, 1
+ br label %BB3
+BB2:
+ br label %BB3
+BB3:
+ %Ret = phi i128 [%Val, %BB1], [1, %BB2]
+ ret i128 %Ret
+}
diff --git a/test/Transforms/SCCP/apint-basictest3.ll b/test/Transforms/SCCP/apint-basictest3.ll
new file mode 100644
index 000000000000..6e86764bf2cf
--- /dev/null
+++ b/test/Transforms/SCCP/apint-basictest3.ll
@@ -0,0 +1,23 @@
+; This is a basic sanity check for constant propogation. It tests the basic
+; arithmatic operations.
+
+
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep mul
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep umod
+
+define i128 @test(i1 %B) {
+ br i1 %B, label %BB1, label %BB2
+BB1:
+ %t1 = add i128 0, 1
+ %t2 = sub i128 0, %t1
+ %t3 = mul i128 %t2, -1
+ br label %BB3
+BB2:
+ %f1 = udiv i128 -1, 1
+ %f2 = add i128 %f1, 1
+ %f3 = urem i128 %f2, 2121
+ br label %BB3
+BB3:
+ %Ret = phi i128 [%t3, %BB1], [%f3, %BB2]
+ ret i128 %Ret
+}
diff --git a/test/Transforms/SCCP/apint-basictest4.ll b/test/Transforms/SCCP/apint-basictest4.ll
new file mode 100644
index 000000000000..a90bd7d7315b
--- /dev/null
+++ b/test/Transforms/SCCP/apint-basictest4.ll
@@ -0,0 +1,25 @@
+; This is a basic sanity check for constant propogation. It tests the basic
+; logic operations.
+
+
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep and
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep trunc
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i100 -1}
+
+define i100 @test(i133 %A) {
+ %B = and i133 0, %A
+ %C = icmp sgt i133 %B, 0
+ br i1 %C, label %BB1, label %BB2
+BB1:
+ %t3 = xor i133 %B, -1
+ %t4 = trunc i133 %t3 to i100
+ br label %BB3
+BB2:
+ %f1 = or i133 -1, %A
+ %f2 = lshr i133 %f1, 33
+ %f3 = trunc i133 %f2 to i100
+ br label %BB3
+BB3:
+ %Ret = phi i100 [%t4, %BB1], [%f3, %BB2]
+ ret i100 %Ret
+}
diff --git a/test/Transforms/SCCP/apint-bigarray.ll b/test/Transforms/SCCP/apint-bigarray.ll
new file mode 100644
index 000000000000..5cd1107a7a44
--- /dev/null
+++ b/test/Transforms/SCCP/apint-bigarray.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep %X
+
+@G = global [1000000 x i10000] zeroinitializer
+
+define internal i10000* @test(i10000 %Arg) {
+ %X = getelementptr [1000000 x i10000]* @G, i32 0, i32 999
+ store i10000 %Arg, i10000* %X
+ ret i10000* %X
+}
+
+define i10000 @caller()
+{
+ %Y = call i10000* @test(i10000 -1)
+ %Z = load i10000* %Y
+ ret i10000 %Z
+}
+
+define i10000 @caller2()
+{
+ %Y = call i10000* @test(i10000 1)
+ %Z = load i10000* %Y
+ ret i10000 %Z
+}
diff --git a/test/Transforms/SCCP/apint-bigint.ll b/test/Transforms/SCCP/apint-bigint.ll
new file mode 100644
index 000000000000..ebb0d0760f2e
--- /dev/null
+++ b/test/Transforms/SCCP/apint-bigint.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep xor
+
+define i11129 @test1() {
+ %B = shl i11129 1, 11128
+ %C = sub i11129 %B, 1
+ %D = xor i11129 %B, %C
+
+ ret i11129 %D
+}
diff --git a/test/Transforms/SCCP/apint-bigint2.ll b/test/Transforms/SCCP/apint-bigint2.ll
new file mode 100644
index 000000000000..e95e9d0abb13
--- /dev/null
+++ b/test/Transforms/SCCP/apint-bigint2.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep load
+
+@Y = constant [6 x i101] [ i101 12, i101 123456789000000, i101 -12,
+ i101 -123456789000000, i101 0,i101 9123456789000000]
+
+define i101 @array()
+{
+Head:
+ %A = getelementptr [6 x i101]* @Y, i32 0, i32 1
+ %B = load i101* %A
+ %D = and i101 %B, 1
+ %DD = or i101 %D, 1
+ %E = trunc i101 %DD to i32
+ %F = getelementptr [6 x i101]* @Y, i32 0, i32 %E
+ %G = load i101* %F
+
+ ret i101 %G
+}
diff --git a/test/Transforms/SCCP/apint-ipsccp1.ll b/test/Transforms/SCCP/apint-ipsccp1.ll
new file mode 100644
index 000000000000..59cfa3f7a2f3
--- /dev/null
+++ b/test/Transforms/SCCP/apint-ipsccp1.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep -v {ret i512 undef} | \
+; RUN: grep {ret i8 2}
+
+define internal i512 @test(i1 %B) {
+ br i1 %B, label %BB1, label %BB2
+BB1:
+ %Val = add i512 0, 1
+ br label %BB3
+BB2:
+ br label %BB3
+BB3:
+ %Ret = phi i512 [%Val, %BB1], [2, %BB2]
+ ret i512 %Ret
+}
+
+define i8 @caller()
+{
+ %t1 = and i2 2, 1
+ %t11 = trunc i2 %t1 to i1
+ %t2 = call i512 @test(i1 %t11)
+ %t3 = trunc i512 %t2 to i8
+ ret i8 %t3
+}
+
diff --git a/test/Transforms/SCCP/apint-ipsccp2.ll b/test/Transforms/SCCP/apint-ipsccp2.ll
new file mode 100644
index 000000000000..65e5ee7e89ec
--- /dev/null
+++ b/test/Transforms/SCCP/apint-ipsccp2.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep -v {ret i101 0} | \
+; RUN: grep -v {ret i101 undef} | not grep ret
+
+
+define internal i101 @bar(i101 %A) {
+ %x = icmp eq i101 %A, 0
+ br i1 %x, label %T, label %F
+T:
+ %B = call i101 @bar(i101 0)
+ ret i101 0
+F: ; unreachable
+ %C = call i101 @bar(i101 1)
+ ret i101 %C
+}
+
+define i101 @foo() {
+ %X = call i101 @bar(i101 0)
+ ret i101 %X
+}
diff --git a/test/Transforms/SCCP/apint-ipsccp3.ll b/test/Transforms/SCCP/apint-ipsccp3.ll
new file mode 100644
index 000000000000..c07a54f8f6f8
--- /dev/null
+++ b/test/Transforms/SCCP/apint-ipsccp3.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep global
+
+@G = internal global i66 undef
+
+
+
+define void @foo() {
+ %X = load i66* @G
+ store i66 %X, i66* @G
+ ret void
+}
+
+define i66 @bar() {
+ %V = load i66* @G
+ %C = icmp eq i66 %V, 17
+ br i1 %C, label %T, label %F
+T:
+ store i66 17, i66* @G
+ ret i66 %V
+F:
+ store i66 123, i66* @G
+ ret i66 0
+}
diff --git a/test/Transforms/SCCP/apint-ipsccp4.ll b/test/Transforms/SCCP/apint-ipsccp4.ll
new file mode 100644
index 000000000000..de355d1d50e1
--- /dev/null
+++ b/test/Transforms/SCCP/apint-ipsccp4.ll
@@ -0,0 +1,49 @@
+; This test makes sure that these instructions are properly constant propagated.
+
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep load
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep add
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep phi
+
+
+@Y = constant [2 x { i212, float }] [ { i212, float } { i212 12, float 1.0 },
+ { i212, float } { i212 37, float 2.0 } ]
+
+define internal float @test2() {
+ %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 1, i32 1
+ %B = load float* %A
+ ret float %B
+}
+
+define internal float @test3() {
+ %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 0, i32 1
+ %B = load float* %A
+ ret float %B
+}
+
+define internal float @test()
+{
+ %A = call float @test2()
+ %B = call float @test3()
+
+ %E = fdiv float %B, %A
+ ret float %E
+}
+
+define float @All()
+{
+ %A = call float @test()
+ %B = fcmp oge float %A, 1.0
+ br i1 %B, label %T, label %F
+T:
+ %C = add float %A, 1.0
+ br label %exit
+F:
+ %D = add float %A, 2.0
+ br label %exit
+exit:
+ %E = phi float [%C, %T], [%D, %F]
+ ret float %E
+}
+
+
+
diff --git a/test/Transforms/SCCP/apint-load.ll b/test/Transforms/SCCP/apint-load.ll
new file mode 100644
index 000000000000..96509714bb07
--- /dev/null
+++ b/test/Transforms/SCCP/apint-load.ll
@@ -0,0 +1,36 @@
+; This test makes sure that these instructions are properly constant propagated.
+
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep load
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep fdiv
+
+@X = constant i212 42
+@Y = constant [2 x { i212, float }] [ { i212, float } { i212 12, float 1.0 },
+ { i212, float } { i212 37, float 0x3FF3B2FEC0000000 } ]
+define i212 @test1() {
+ %B = load i212* @X
+ ret i212 %B
+}
+
+define internal float @test2() {
+ %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 1, i32 1
+ %B = load float* %A
+ ret float %B
+}
+
+define internal i212 @test3() {
+ %A = getelementptr [2 x { i212, float}]* @Y, i32 0, i32 0, i32 0
+ %B = load i212* %A
+ ret i212 %B
+}
+
+define float @All()
+{
+ %A = call float @test2()
+ %B = call i212 @test3()
+ %C = mul i212 %B, -1234567
+ %D = sitofp i212 %C to float
+ %E = fdiv float %A, %D
+ ret float %E
+}
+
+
diff --git a/test/Transforms/SCCP/apint-phi.ll b/test/Transforms/SCCP/apint-phi.ll
new file mode 100644
index 000000000000..77f6bc869266
--- /dev/null
+++ b/test/Transforms/SCCP/apint-phi.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep phi
+
+define i999 @test(i999%A, i1 %c) {
+bb1:
+ br label %BB2
+BB2:
+ %V = phi i999 [2, %bb1], [%A, %BB4]
+ br label %BB3
+
+BB3:
+ %E = trunc i999 %V to i1
+ %F = and i1 %E, %c
+ br i1 %F, label %BB4, label %BB5
+BB4:
+ br label %BB2
+
+BB5:
+ ret i999 %V
+}
diff --git a/test/Transforms/SCCP/apint-select.ll b/test/Transforms/SCCP/apint-select.ll
new file mode 100644
index 000000000000..c856896be9f9
--- /dev/null
+++ b/test/Transforms/SCCP/apint-select.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep select
+
+@A = constant i32 10
+
+define i712 @test1() {
+ %P = getelementptr i32* @A, i32 0
+ %B = ptrtoint i32* %P to i64
+ %BB = and i64 %B, undef
+ %C = icmp sge i64 %BB, 0
+ %X = select i1 %C, i712 0, i712 1
+ ret i712 %X
+}
+
+
+
+define i712 @test2(i1 %C) {
+ %X = select i1 %C, i712 0, i712 undef
+ ret i712 %X
+}
+
+
diff --git a/test/Transforms/SCCP/basictest.ll b/test/Transforms/SCCP/basictest.ll
new file mode 100644
index 000000000000..08640a9a239a
--- /dev/null
+++ b/test/Transforms/SCCP/basictest.ll
@@ -0,0 +1,17 @@
+; This is a basic sanity check for constant propogation. The add instruction
+; should be eliminated.
+
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep add
+
+define i32 @test(i1 %B) {
+ br i1 %B, label %BB1, label %BB2
+BB1: ; preds = %0
+ %Val = add i32 0, 0 ; <i32> [#uses=1]
+ br label %BB3
+BB2: ; preds = %0
+ br label %BB3
+BB3: ; preds = %BB2, %BB1
+ %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ; <i32> [#uses=1]
+ ret i32 %Ret
+}
+
diff --git a/test/Transforms/SCCP/calltest.ll b/test/Transforms/SCCP/calltest.ll
new file mode 100644
index 000000000000..ee6eb8e4a803
--- /dev/null
+++ b/test/Transforms/SCCP/calltest.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -sccp -loop-deletion -simplifycfg | llvm-dis | \
+; RUN: 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)
+
+define double @test(i32 %param) {
+entry:
+ br label %Loop
+Loop: ; preds = %Loop, %entry
+ %I2 = phi i32 [ 0, %entry ], [ %I3, %Loop ] ; <i32> [#uses=1]
+ %V = phi double [ 1.000000e+00, %entry ], [ %V2, %Loop ] ; <double> [#uses=2]
+ %V2 = call double @sqrt( double %V ) ; <double> [#uses=1]
+ %I3 = add i32 %I2, 1 ; <i32> [#uses=2]
+ %tmp.7 = icmp ne i32 %I3, %param ; <i1> [#uses=1]
+ br i1 %tmp.7, label %Loop, label %Exit
+Exit: ; preds = %Loop
+ ret double %V
+}
+
diff --git a/test/Transforms/SCCP/dg.exp b/test/Transforms/SCCP/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/SCCP/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/SCCP/empty-struct.ll b/test/Transforms/SCCP/empty-struct.ll
new file mode 100644
index 000000000000..4e3dc69514e5
--- /dev/null
+++ b/test/Transforms/SCCP/empty-struct.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s > %t.bc
+; RUN: llvm-ld %t.bc -o %t.sh
+; PR2612
+
+@current_foo = internal global { } zeroinitializer
+
+define i32 @main(...) {
+entry:
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ store i32 0, i32* %retval
+ %local_foo = alloca { } ; <{ }*> [#uses=1]
+ load { }* @current_foo ; <{ }>:0 [#uses=1]
+ store { } %0, { }* %local_foo
+ br label %return
+
+return: ; preds = %entry
+ load i32* %retval ; <i32>:1 [#uses=1]
+ ret i32 %1
+}
+
diff --git a/test/Transforms/SCCP/ipsccp-basic.ll b/test/Transforms/SCCP/ipsccp-basic.ll
new file mode 100644
index 000000000000..1449ea70c39b
--- /dev/null
+++ b/test/Transforms/SCCP/ipsccp-basic.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | \
+; RUN: grep -v {ret i32 17} | grep -v {ret i32 undef} | not grep ret
+
+define internal i32 @bar(i32 %A) {
+ %X = add i32 1, 2 ; <i32> [#uses=0]
+ ret i32 %A
+}
+
+define i32 @foo() {
+ %X = call i32 @bar( i32 17 ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/SCCP/ipsccp-conditional.ll b/test/Transforms/SCCP/ipsccp-conditional.ll
new file mode 100644
index 000000000000..b98bbf44be68
--- /dev/null
+++ b/test/Transforms/SCCP/ipsccp-conditional.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | \
+; RUN: grep -v {ret i32 0} | grep -v {ret i32 undef} | not grep ret
+
+define internal i32 @bar(i32 %A) {
+ %C = icmp eq i32 %A, 0 ; <i1> [#uses=1]
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ %B = call i32 @bar( i32 0 ) ; <i32> [#uses=0]
+ ret i32 0
+F: ; preds = %0
+ %C.upgrd.1 = call i32 @bar( i32 1 ) ; <i32> [#uses=1]
+ ret i32 %C.upgrd.1
+}
+
+define i32 @foo() {
+ %X = call i32 @bar( i32 0 ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/SCCP/ipsccp-gvar.ll b/test/Transforms/SCCP/ipsccp-gvar.ll
new file mode 100644
index 000000000000..6f2ee1f4d8a3
--- /dev/null
+++ b/test/Transforms/SCCP/ipsccp-gvar.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep global
+
+@G = internal global i32 undef ; <i32*> [#uses=5]
+
+define void @foo() {
+ %X = load i32* @G ; <i32> [#uses=1]
+ store i32 %X, i32* @G
+ ret void
+}
+
+define i32 @bar() {
+ %V = load i32* @G ; <i32> [#uses=2]
+ %C = icmp eq i32 %V, 17 ; <i1> [#uses=1]
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ store i32 17, i32* @G
+ ret i32 %V
+F: ; preds = %0
+ store i32 123, i32* @G
+ ret i32 0
+}
+
diff --git a/test/Transforms/SCCP/loadtest.ll b/test/Transforms/SCCP/loadtest.ll
new file mode 100644
index 000000000000..0cbbdf603661
--- /dev/null
+++ b/test/Transforms/SCCP/loadtest.ll
@@ -0,0 +1,26 @@
+; This test makes sure that these instructions are properly constant propagated.
+;
+
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep load
+
+
+@X = constant i32 42 ; <i32*> [#uses=1]
+@Y = constant [2 x { i32, float }] [ { i32, float } { i32 12, float 1.000000e+00 }, { i32, float } { i32 37, float 0x3FF3B2FEC0000000 } ] ; <[2 x { i32, float }]*> [#uses=2]
+
+define i32 @test1() {
+ %B = load i32* @X ; <i32> [#uses=1]
+ ret i32 %B
+}
+
+define float @test2() {
+ %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; <float*> [#uses=1]
+ %B = load float* %A ; <float> [#uses=1]
+ ret float %B
+}
+
+define i32 @test3() {
+ %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; <i32*> [#uses=1]
+ %B = load i32* %A ; <i32> [#uses=1]
+ ret i32 %B
+}
+
diff --git a/test/Transforms/SCCP/logical-nuke.ll b/test/Transforms/SCCP/logical-nuke.ll
new file mode 100644
index 000000000000..87454e4dcea6
--- /dev/null
+++ b/test/Transforms/SCCP/logical-nuke.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i32 0}
+
+; Test that SCCP has basic knowledge of when and/or nuke overdefined values.
+
+define i32 @test(i32 %X) {
+ %Y = and i32 %X, 0 ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/SCCP/phitest.ll b/test/Transforms/SCCP/phitest.ll
new file mode 100644
index 000000000000..c75de5dde8fa
--- /dev/null
+++ b/test/Transforms/SCCP/phitest.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -sccp -dce -simplifycfg | llvm-dis | \
+; RUN: not grep br
+
+define i32 @test(i32 %param) {
+entry:
+ %tmp.1 = icmp ne i32 %param, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %endif.0, label %else
+else: ; preds = %entry
+ br label %endif.0
+endif.0: ; preds = %else, %entry
+ %a.0 = phi i32 [ 2, %else ], [ 3, %entry ] ; <i32> [#uses=1]
+ %b.0 = phi i32 [ 3, %else ], [ 2, %entry ] ; <i32> [#uses=1]
+ %tmp.5 = add i32 %a.0, %b.0 ; <i32> [#uses=1]
+ %tmp.7 = icmp ne i32 %tmp.5, 5 ; <i1> [#uses=1]
+ br i1 %tmp.7, label %UnifiedReturnBlock, label %endif.1
+endif.1: ; preds = %endif.0
+ ret i32 0
+UnifiedReturnBlock: ; preds = %endif.0
+ ret i32 2
+}
+
diff --git a/test/Transforms/SCCP/sccptest.ll b/test/Transforms/SCCP/sccptest.ll
new file mode 100644
index 000000000000..84ba2d43cde7
--- /dev/null
+++ b/test/Transforms/SCCP/sccptest.ll
@@ -0,0 +1,31 @@
+; 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-as < %s | opt -sccp -constprop -dce -simplifycfg | \
+; RUN: llvm-dis | not grep BB3
+
+define i32 @testfunction(i32 %i0, i32 %j0) {
+BB1:
+ br label %BB2
+BB2: ; preds = %BB7, %BB1
+ %j2 = phi i32 [ %j4, %BB7 ], [ 1, %BB1 ] ; <i32> [#uses=2]
+ %k2 = phi i32 [ %k4, %BB7 ], [ 0, %BB1 ] ; <i32> [#uses=4]
+ %kcond = icmp slt i32 %k2, 100 ; <i1> [#uses=1]
+ br i1 %kcond, label %BB3, label %BB4
+BB3: ; preds = %BB2
+ %jcond = icmp slt i32 %j2, 20 ; <i1> [#uses=1]
+ br i1 %jcond, label %BB5, label %BB6
+BB4: ; preds = %BB2
+ ret i32 %j2
+BB5: ; preds = %BB3
+ %k3 = add i32 %k2, 1 ; <i32> [#uses=1]
+ br label %BB7
+BB6: ; preds = %BB3
+ %k5 = add i32 %k2, 1 ; <i32> [#uses=1]
+ br label %BB7
+BB7: ; preds = %BB6, %BB5
+ %j4 = phi i32 [ 1, %BB5 ], [ %k2, %BB6 ] ; <i32> [#uses=1]
+ %k4 = phi i32 [ %k3, %BB5 ], [ %k5, %BB6 ] ; <i32> [#uses=1]
+ br label %BB2
+}
+
diff --git a/test/Transforms/SCCP/select.ll b/test/Transforms/SCCP/select.ll
new file mode 100644
index 000000000000..74b20d09c143
--- /dev/null
+++ b/test/Transforms/SCCP/select.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep select
+
+define i32 @test1(i1 %C) {
+ %X = select i1 %C, i32 0, i32 0 ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+define i32 @test2(i1 %C) {
+ %X = select i1 %C, i32 0, i32 undef ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/SRETPromotion/2008-03-11-attributes.ll b/test/Transforms/SRETPromotion/2008-03-11-attributes.ll
new file mode 100644
index 000000000000..81a1476fc964
--- /dev/null
+++ b/test/Transforms/SRETPromotion/2008-03-11-attributes.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -sretpromotion -disable-output
+ %struct.ObjPoint = type { double, double, double, double, double, double }
+
+define void @RotatePoint(%struct.ObjPoint* sret %agg.result, %struct.ObjPoint* byval %a, double %rx, double %ry, double %rz) nounwind {
+entry:
+ unreachable
+}
diff --git a/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll b/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll
new file mode 100644
index 000000000000..21701dd84be6
--- /dev/null
+++ b/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll
@@ -0,0 +1,24 @@
+; This test lures sretpromotion into promoting the sret argument of foo, even
+; when the function is used as an argument to bar. It used to not check for
+; this, assuming that all users of foo were direct calls, resulting in an
+; assertion failure later on.
+
+; We're mainly testing for opt not to crash, but we'll check to see if the sret
+; attribute is still there for good measure.
+; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis | grep sret
+
+%struct.S = type <{ i32, i32 }>
+
+define i32 @main() {
+entry:
+ %tmp = alloca %struct.S ; <%struct.S*> [#uses=1]
+ call void @bar( %struct.S* sret %tmp, void (%struct.S*, ...)* @foo )
+ ret i32 undef
+}
+
+declare void @bar(%struct.S* sret , void (%struct.S*, ...)*)
+
+define internal void @foo(%struct.S* sret %agg.result, ...) {
+entry:
+ ret void
+}
diff --git a/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll b/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll
new file mode 100644
index 000000000000..10f92efc8654
--- /dev/null
+++ b/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll
@@ -0,0 +1,20 @@
+; This test shows an sret function that is used as an operand to a bitcast.
+; StructRetPromotion used to assume that a function was only used by call or
+; invoke instructions, making this code cause an assertion failure.
+
+; We're mainly testing for opt not to crash, but we'll check to see if the sret
+; attribute is still there for good measure.
+; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis | grep sret
+
+%struct.S = type <{ i32, i32 }>
+
+define i32 @main() {
+entry:
+ %bar = bitcast void (%struct.S*)* @foo to i32 ()*
+ ret i32 undef
+}
+
+define internal void @foo(%struct.S* sret) {
+entry:
+ ret void
+}
diff --git a/test/Transforms/SRETPromotion/basictest.ll b/test/Transforms/SRETPromotion/basictest.ll
new file mode 100644
index 000000000000..4146cce46ed0
--- /dev/null
+++ b/test/Transforms/SRETPromotion/basictest.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis > %t
+; RUN: cat %t | grep sret | count 1
+
+; This function is promotable
+define internal void @promotable({i32, i32}* sret %s) {
+ %A = getelementptr {i32, i32}* %s, i32 0, i32 0
+ store i32 0, i32* %A
+ %B = getelementptr {i32, i32}* %s, i32 0, i32 0
+ store i32 1, i32* %B
+ ret void
+}
+
+; This function is not promotable (due to it's use below)
+define internal void @notpromotable({i32, i32}* sret %s) {
+ %A = getelementptr {i32, i32}* %s, i32 0, i32 0
+ store i32 0, i32* %A
+ %B = getelementptr {i32, i32}* %s, i32 0, i32 0
+ store i32 1, i32* %B
+ ret void
+}
+
+define void @caller({i32, i32}* %t) {
+ %s = alloca {i32, i32}
+ call void @promotable({i32, i32}* %s)
+ %A = getelementptr {i32, i32}* %s, i32 0, i32 0
+ %a = load i32* %A
+ %B = getelementptr {i32, i32}* %s, i32 0, i32 0
+ %b = load i32* %B
+ ; This passes in something that's not an alloca, which makes the argument not
+ ; promotable
+ call void @notpromotable({i32, i32}* %t)
+ ret void
+}
diff --git a/test/Transforms/SRETPromotion/dg.exp b/test/Transforms/SRETPromotion/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/SRETPromotion/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/ScalarRepl/2003-05-29-ArrayFail.ll b/test/Transforms/ScalarRepl/2003-05-29-ArrayFail.ll
new file mode 100644
index 000000000000..5a9f3a52c667
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2003-05-29-ArrayFail.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | not grep alloca
+
+; Test that an array is not incorrectly deconstructed.
+
+define i32 @test() nounwind {
+ %X = alloca [4 x i32] ; <[4 x i32]*> [#uses=1]
+ %Y = getelementptr [4 x i32]* %X, i64 0, i64 0 ; <i32*> [#uses=1]
+ ; Must preserve arrayness!
+ %Z = getelementptr i32* %Y, i64 1 ; <i32*> [#uses=1]
+ %A = load i32* %Z ; <i32> [#uses=1]
+ ret i32 %A
+}
diff --git a/test/Transforms/ScalarRepl/2003-05-30-InvalidIndices.ll b/test/Transforms/ScalarRepl/2003-05-30-InvalidIndices.ll
new file mode 100644
index 000000000000..83a18c1cd58a
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2003-05-30-InvalidIndices.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -scalarrepl
+
+define void @main() {
+ %E = alloca { { i32, float, double, i64 }, { i32, float, double, i64 } } ; <{ { i32, float, double, i64 }, { i32, float, double, i64 } }*> [#uses=1]
+ %tmp.151 = getelementptr { { i32, float, double, i64 }, { i32, float, double, i64 } }* %E, i64 0, i32 1, i32 3 ; <i64*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/ScalarRepl/2003-05-30-MultiLevel.ll b/test/Transforms/ScalarRepl/2003-05-30-MultiLevel.ll
new file mode 100644
index 000000000000..422064967819
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2003-05-30-MultiLevel.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -scalarrepl
+
+define i32 @test() {
+ %X = alloca { [4 x i32] } ; <{ [4 x i32] }*> [#uses=1]
+ %Y = getelementptr { [4 x i32] }* %X, i64 0, i32 0, i64 2 ; <i32*> [#uses=2]
+ store i32 4, i32* %Y
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll b/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll
new file mode 100644
index 000000000000..dbac15c3a521
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll
@@ -0,0 +1,13 @@
+; Scalar replacement was incorrectly promoting this alloca!!
+;
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: sed {s/;.*//g} | grep {\\\[}
+
+define i8* @test() {
+ %A = alloca [30 x i8] ; <[30 x i8]*> [#uses=1]
+ %B = getelementptr [30 x i8]* %A, i64 0, i64 0 ; <i8*> [#uses=2]
+ %C = getelementptr i8* %B, i64 1 ; <i8*> [#uses=1]
+ store i8 0, i8* %B
+ ret i8* %C
+}
+
diff --git a/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll b/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll
new file mode 100644
index 000000000000..c5c059b154dd
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {alloca %T}
+
+%T = type { [80 x i8], i32, i32 }
+declare i32 @.callback_1(i8*)
+
+declare void @.iter_2(i32 (i8*)*, i8*)
+
+define i32 @main() {
+ %d = alloca { [80 x i8], i32, i32 } ; <{ [80 x i8], i32, i32 }*> [#uses=2]
+ %tmp.0 = getelementptr { [80 x i8], i32, i32 }* %d, i64 0, i32 2 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp.0
+ %tmp.1 = getelementptr { [80 x i8], i32, i32 }* %d, i64 0, i32 0, i64 0 ; <i8*> [#uses=1]
+ call void @.iter_2( i32 (i8*)* @.callback_1, i8* %tmp.1 )
+ ret i32 0
+}
+
diff --git a/test/Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll b/test/Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll
new file mode 100644
index 000000000000..de6e2974a9ec
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2005-12-14-UnionPromoteCrash.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output
+
+target datalayout = "E-p:32:32"
+ %struct.rtx_def = type { [2 x i8], i32, [1 x %union.rtunion_def] }
+ %union.rtunion_def = type { i32 }
+
+define void @find_reloads() {
+entry:
+ %c_addr.i = alloca i8 ; <i8*> [#uses=1]
+ switch i32 0, label %return [
+ i32 36, label %label.7
+ i32 34, label %label.7
+ i32 41, label %label.5
+ ]
+label.5: ; preds = %entry
+ ret void
+label.7: ; preds = %entry, %entry
+ br i1 false, label %then.4, label %switchexit.0
+then.4: ; preds = %label.7
+ %tmp.0.i = bitcast i8* %c_addr.i to i32* ; <i32*> [#uses=1]
+ store i32 44, i32* %tmp.0.i
+ ret void
+switchexit.0: ; preds = %label.7
+ ret void
+return: ; preds = %entry
+ ret void
+}
+
diff --git a/test/Transforms/ScalarRepl/2006-01-24-IllegalUnionPromoteCrash.ll b/test/Transforms/ScalarRepl/2006-01-24-IllegalUnionPromoteCrash.ll
new file mode 100644
index 000000000000..bcb8457d553a
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2006-01-24-IllegalUnionPromoteCrash.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output
+
+target datalayout = "E-p:32:32"
+
+define i32 @test(i64 %L) {
+ %X = alloca i32 ; <i32*> [#uses=2]
+ %Y = bitcast i32* %X to i64* ; <i64*> [#uses=1]
+ store i64 0, i64* %Y
+ %Z = load i32* %X ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/ScalarRepl/2006-04-20-PromoteCrash.ll b/test/Transforms/ScalarRepl/2006-04-20-PromoteCrash.ll
new file mode 100644
index 000000000000..18493f594713
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2006-04-20-PromoteCrash.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output
+
+define void @output_toc() {
+entry:
+ %buf = alloca [256 x i8], align 16 ; <[256 x i8]*> [#uses=1]
+ %name = alloca i8*, align 4 ; <i8**> [#uses=1]
+ %real_name = alloca i8*, align 4 ; <i8**> [#uses=0]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %buf.upgrd.1 = bitcast [256 x i8]* %buf to i8* ; <i8*> [#uses=1]
+ store i8* %buf.upgrd.1, i8** %name
+ call void @abort( )
+ unreachable
+return: ; No predecessors!
+ ret void
+}
+
+declare void @abort()
+
diff --git a/test/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll b/test/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll
new file mode 100644
index 000000000000..0007665a8f86
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll
@@ -0,0 +1,57 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output
+; END.
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8.7.2"
+
+define void @glgProcessColor() {
+entry:
+ %source_ptr = alloca i8*, align 4 ; <i8**> [#uses=2]
+ br i1 false, label %bb1357, label %cond_next583
+cond_next583: ; preds = %entry
+ ret void
+bb1357: ; preds = %entry
+ br i1 false, label %bb1365, label %bb27055
+bb1365: ; preds = %bb1357
+ switch i32 0, label %cond_next10377 [
+ i32 0, label %bb4679
+ i32 1, label %bb4679
+ i32 2, label %bb4679
+ i32 3, label %bb4679
+ i32 4, label %bb5115
+ i32 5, label %bb6651
+ i32 6, label %bb7147
+ i32 7, label %bb8683
+ i32 8, label %bb9131
+ i32 9, label %bb9875
+ i32 10, label %bb4679
+ i32 11, label %bb4859
+ i32 12, label %bb4679
+ i32 16, label %bb10249
+ ]
+bb4679: ; preds = %bb1365, %bb1365, %bb1365, %bb1365, %bb1365, %bb1365
+ ret void
+bb4859: ; preds = %bb1365
+ ret void
+bb5115: ; preds = %bb1365
+ ret void
+bb6651: ; preds = %bb1365
+ ret void
+bb7147: ; preds = %bb1365
+ ret void
+bb8683: ; preds = %bb1365
+ ret void
+bb9131: ; preds = %bb1365
+ ret void
+bb9875: ; preds = %bb1365
+ %source_ptr9884 = bitcast i8** %source_ptr to i8** ; <i8**> [#uses=1]
+ %tmp9885 = load i8** %source_ptr9884 ; <i8*> [#uses=0]
+ ret void
+bb10249: ; preds = %bb1365
+ %source_ptr10257 = bitcast i8** %source_ptr to i16** ; <i16**> [#uses=1]
+ %tmp10258 = load i16** %source_ptr10257 ; <i16*> [#uses=0]
+ ret void
+cond_next10377: ; preds = %bb1365
+ ret void
+bb27055: ; preds = %bb1357
+ ret void
+}
diff --git a/test/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll b/test/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll
new file mode 100644
index 000000000000..f0253b7bea93
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+
+define i32 @func(<4 x float> %v0, <4 x float> %v1) nounwind {
+ %vsiidx = alloca [2 x <4 x i32>], align 16 ; <[2 x <4 x i32>]*> [#uses=3]
+ %tmp = call <4 x i32> @llvm.x86.sse2.cvttps2dq( <4 x float> %v0 ) ; <<4 x i32>> [#uses=2]
+ %tmp.upgrd.1 = bitcast <4 x i32> %tmp to <2 x i64> ; <<2 x i64>> [#uses=0]
+ %tmp.upgrd.2 = getelementptr [2 x <4 x i32>]* %vsiidx, i32 0, i32 0 ; <<4 x i32>*> [#uses=1]
+ store <4 x i32> %tmp, <4 x i32>* %tmp.upgrd.2
+ %tmp10 = call <4 x i32> @llvm.x86.sse2.cvttps2dq( <4 x float> %v1 ) ; <<4 x i32>> [#uses=2]
+ %tmp10.upgrd.3 = bitcast <4 x i32> %tmp10 to <2 x i64> ; <<2 x i64>> [#uses=0]
+ %tmp14 = getelementptr [2 x <4 x i32>]* %vsiidx, i32 0, i32 1 ; <<4 x i32>*> [#uses=1]
+ store <4 x i32> %tmp10, <4 x i32>* %tmp14
+ %tmp15 = getelementptr [2 x <4 x i32>]* %vsiidx, i32 0, i32 0, i32 4 ; <i32*> [#uses=1]
+ %tmp.upgrd.4 = load i32* %tmp15 ; <i32> [#uses=1]
+ ret i32 %tmp.upgrd.4
+}
+
+declare <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float>)
+
diff --git a/test/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll b/test/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll
new file mode 100644
index 000000000000..ae870d385580
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output
+; PR1045
+
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>" = type { %"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block"* }
+ %"struct.__gnu_cxx::bitmap_allocator<char>" = type { i8 }
+ %"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block" = type { [8 x i8] }
+
+define void @_ZN9__gnu_cxx16bitmap_allocatorIwE27_M_deallocate_single_objectEPw() {
+entry:
+ %this_addr.i = alloca %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"**> [#uses=3]
+ %tmp = alloca %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>", align 4 ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1]
+ store %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp, %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i
+ %tmp.i = load %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1]
+ %tmp.i.upgrd.1 = bitcast %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp.i to %"struct.__gnu_cxx::bitmap_allocator<char>"* ; <%"struct.__gnu_cxx::bitmap_allocator<char>"*> [#uses=0]
+ %tmp1.i = load %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1]
+ %tmp.i.upgrd.2 = getelementptr %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp1.i, i32 0, i32 0 ; <%"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block"**> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll b/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll
new file mode 100644
index 000000000000..769ec199b849
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2007-03-19-CanonicalizeMemcpy.ll
@@ -0,0 +1,44 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64"
+target triple = "arm-apple-darwin8"
+ %struct.CGPoint = type { float, float }
+ %struct.aal_big_range_t = type { i32, i32 }
+ %struct.aal_callback_t = type { i8* (i8*, i32)*, void (i8*, i8*)* }
+ %struct.aal_edge_pool_t = type { %struct.aal_edge_pool_t*, i32, i32, [0 x %struct.aal_edge_t] }
+ %struct.aal_edge_t = type { %struct.CGPoint, %struct.CGPoint, i32 }
+ %struct.aal_range_t = type { i16, i16 }
+ %struct.aal_span_pool_t = type { %struct.aal_span_pool_t*, [341 x %struct.aal_span_t] }
+ %struct.aal_span_t = type { %struct.aal_span_t*, %struct.aal_big_range_t }
+ %struct.aal_spanarray_t = type { [2 x %struct.aal_range_t] }
+ %struct.aal_spanbucket_t = type { i16, [2 x i8], %struct.anon }
+ %struct.aal_state_t = type { %struct.CGPoint, %struct.CGPoint, %struct.CGPoint, i32, float, float, float, float, %struct.CGPoint, %struct.CGPoint, float, float, float, float, i32, i32, i32, i32, float, float, i8*, i32, i32, %struct.aal_edge_pool_t*, %struct.aal_edge_pool_t*, i8*, %struct.aal_callback_t*, i32, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_pool_t*, i8, float, i8, i32 }
+ %struct.anon = type { %struct.aal_spanarray_t }
+
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+define fastcc void @aal_insert_span() {
+entry:
+ %SB = alloca %struct.aal_spanbucket_t, align 4 ; <%struct.aal_spanbucket_t*> [#uses=2]
+ br i1 false, label %cond_true, label %cond_next79
+
+cond_true: ; preds = %entry
+ br i1 false, label %cond_next, label %cond_next114.i
+
+cond_next114.i: ; preds = %cond_true
+ ret void
+
+cond_next: ; preds = %cond_true
+ %SB19 = bitcast %struct.aal_spanbucket_t* %SB to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %SB19, i8* null, i32 12, i32 0 )
+ br i1 false, label %cond_next34, label %cond_next79
+
+cond_next34: ; preds = %cond_next
+ %i.2.reload22 = load i32* null ; <i32> [#uses=1]
+ %tmp51 = getelementptr %struct.aal_spanbucket_t* %SB, i32 0, i32 2, i32 0, i32 0, i32 %i.2.reload22, i32 1 ; <i16*> [#uses=0]
+ ret void
+
+cond_next79: ; preds = %cond_next, %entry
+ ret void
+}
diff --git a/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll b/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll
new file mode 100644
index 000000000000..43b721b7013e
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {alloca.*client_t}
+; PR1446
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-pc-linux-gnu"
+
+ %struct.clientSnapshot_t = type { i32, [32 x i8], %struct.playerState_t, i32, i32, i32, i32, i32 }
+ %struct.client_t = type { i32, [1024 x i8], [64 x [1024 x i8]], i32, i32, i32, i32, i32, i32, %struct.usercmd_t, i32, i32, [1024 x i8], %struct.sharedEntity_t*, [32 x i8], [64 x i8], i32, i32, i32, i32, i32, i32, [8 x i8*], [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, [32 x %struct.clientSnapshot_t], i32, i32, i32, i32, i32, %struct.netchan_t, %struct.netchan_buffer_t*, %struct.netchan_buffer_t**, i32, [1025 x i32] }
+ %struct.entityShared_t = type { %struct.entityState_t, i32, i32, i32, i32, i32, [3 x float], [3 x float], i32, [3 x float], [3 x float], [3 x float], [3 x float], i32 }
+ %struct.entityState_t = type { i32, i32, i32, %struct.trajectory_t, %struct.trajectory_t, i32, i32, [3 x float], [3 x float], [3 x float], [3 x float], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.msg_t = type { i32, i32, i32, i8*, i32, i32, i32, i32 }
+ %struct.netadr_t = type { i32, [4 x i8], [10 x i8], i16 }
+ %struct.netchan_buffer_t = type { %struct.msg_t, [16384 x i8], %struct.netchan_buffer_t* }
+ %struct.netchan_t = type { i32, i32, %struct.netadr_t, i32, i32, i32, i32, i32, [16384 x i8], i32, i32, i32, [16384 x i8] }
+ %struct.playerState_t = type { i32, i32, i32, i32, i32, [3 x float], [3 x float], i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, [3 x float], i32, i32, [2 x i32], [2 x i32], i32, i32, i32, i32, i32, i32, [3 x float], i32, i32, i32, i32, i32, [16 x i32], [16 x i32], [16 x i32], [16 x i32], i32, i32, i32, i32, i32, i32, i32 }
+ %struct.sharedEntity_t = type { %struct.entityState_t, %struct.entityShared_t }
+ %struct.trajectory_t = type { i32, i32, i32, [3 x float], [3 x float] }
+ %struct.usercmd_t = type { i32, [3 x i32], i32, i8, i8, i8, i8 }
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+define void @SV_DirectConnect(i64 %from.0.0, i64 %from.0.1, i32 %from.1) {
+entry:
+ %temp = alloca %struct.client_t, align 16 ; <%struct.client_t*> [#uses=1]
+ %temp586 = bitcast %struct.client_t* %temp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* null, i8* %temp586, i32 121596, i32 0 )
+ unreachable
+}
diff --git a/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll b/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll
new file mode 100644
index 000000000000..dc1198ead89f
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep memcpy
+; PR1421
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+ %struct.LongestMember = type { i8, i32 }
+ %struct.MyString = type { i32 }
+ %struct.UnionType = type { %struct.LongestMember }
+
+define void @_Z4testP9UnionTypePS0_(%struct.UnionType* %p, %struct.UnionType** %pointerToUnion) {
+entry:
+ %tmp = alloca %struct.UnionType, align 8 ; <%struct.UnionType*> [#uses=2]
+ %tmp2 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp13 = getelementptr %struct.UnionType* %p, i32 0, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 8, i32 0 )
+ %tmp5 = load %struct.UnionType** %pointerToUnion ; <%struct.UnionType*> [#uses=1]
+ %tmp56 = getelementptr %struct.UnionType* %tmp5, i32 0, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp7 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %tmp56, i8* %tmp7, i32 8, i32 0 )
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
diff --git a/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll b/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll
new file mode 100644
index 000000000000..d2d2b24da763
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep shr
+
+%struct.S = type { i16 }
+
+define i1 @f(i16 signext %b) zeroext {
+entry:
+ %b_addr = alloca i16 ; <i16*> [#uses=2]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %s = alloca %struct.S ; <%struct.S*> [#uses=2]
+ %tmp = alloca i32 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i16 %b, i16* %b_addr
+ %tmp1 = getelementptr %struct.S* %s, i32 0, i32 0 ; <i16*> [#uses=1]
+ %tmp2 = load i16* %b_addr, align 2 ; <i16> [#uses=1]
+ store i16 %tmp2, i16* %tmp1, align 2
+ %tmp3 = getelementptr %struct.S* %s, i32 0, i32 0 ; <i16*> [#uses=1]
+ %tmp34 = bitcast i16* %tmp3 to [2 x i1]* ; <[2 x i1]*> [#uses=1]
+ %tmp5 = getelementptr [2 x i1]* %tmp34, i32 0, i32 1 ; <i1*> [#uses=1]
+ %tmp6 = load i1* %tmp5, align 1 ; <i1> [#uses=1]
+ %tmp67 = zext i1 %tmp6 to i32 ; <i32> [#uses=1]
+ store i32 %tmp67, i32* %tmp, align 4
+ %tmp8 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ store i32 %tmp8, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval9 = load i32* %retval ; <i32> [#uses=1]
+ %retval910 = trunc i32 %retval9 to i1 ; <i1> [#uses=1]
+ ret i1 %retval910
+}
diff --git a/test/Transforms/ScalarRepl/2008-01-29-PromoteBug.ll b/test/Transforms/ScalarRepl/2008-01-29-PromoteBug.ll
new file mode 100644
index 000000000000..0675a966b5a3
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-01-29-PromoteBug.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | grep {ret i8 17}
+; rdar://5707076
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.1.0"
+ %struct.T = type <{ i8, [3 x i8] }>
+
+define i8 @f() {
+entry:
+ %s = alloca [1 x %struct.T], align 4 ; <[1 x %struct.T]*> [#uses=2]
+ %T3 = bitcast [1 x %struct.T]* %s to i32*
+ store i32 -61184, i32* %T3
+
+ %tmp16 = getelementptr [1 x %struct.T]* %s, i32 0, i32 0 ; <%struct.T*> [#uses=1]
+ %tmp17 = getelementptr %struct.T* %tmp16, i32 0, i32 1 ; <[3 x i8]*> [#uses=1]
+ %tmp1718 = bitcast [3 x i8]* %tmp17 to i32* ; <i32*> [#uses=1]
+ %tmp19 = load i32* %tmp1718, align 4 ; <i32> [#uses=1]
+ %mask = and i32 %tmp19, 16777215 ; <i32> [#uses=2]
+ %mask2324 = trunc i32 %mask to i8 ; <i8> [#uses=1]
+ ret i8 %mask2324
+}
+
diff --git a/test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll b/test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll
new file mode 100644
index 000000000000..9ec5fa381221
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+ %struct..0anon = type { <1 x i64> }
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %c = alloca %struct..0anon ; <%struct..0anon*> [#uses=2]
+ %tmp2 = getelementptr %struct..0anon* %c, i32 0, i32 0 ; <<1 x i64>*> [#uses=1]
+ store <1 x i64> zeroinitializer, <1 x i64>* %tmp2, align 8
+ %tmp7 = getelementptr %struct..0anon* %c, i32 0, i32 0 ; <<1 x i64>*> [#uses=1]
+ %tmp78 = bitcast <1 x i64>* %tmp7 to [2 x i32]* ; <[2 x i32]*> [#uses=1]
+ %tmp9 = getelementptr [2 x i32]* %tmp78, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp10 = load i32* %tmp9, align 4 ; <i32> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll b/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll
new file mode 100644
index 000000000000..73d92be179e4
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll
@@ -0,0 +1,32 @@
+; This test shows an alloca of a struct and an array that can be reduced to
+; multiple variables easily. However, the alloca is used by a store
+; instruction, which was not possible before aggregrates were first class
+; values. This checks of scalarrepl splits up the struct and array properly.
+
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+
+define i32 @foo() {
+ %target = alloca { i32, i32 } ; <{ i32, i32 }*> [#uses=1]
+ ; Build a first class struct to store
+ %res1 = insertvalue { i32, i32 } undef, i32 1, 0 ; <{ i32, i32 }> [#uses=1]
+ %res2 = insertvalue { i32, i32 } %res1, i32 2, 1 ; <{ i32, i32 }> [#uses=1]
+ ; And store it
+ store { i32, i32 } %res2, { i32, i32 }* %target
+ ; Actually use %target, so it doesn't get removed alltogether
+ %ptr = getelementptr { i32, i32 }* %target, i32 0, i32 0
+ %val = load i32* %ptr
+ ret i32 %val
+}
+
+define i32 @bar() {
+ %target = alloca [ 2 x i32 ] ; <{ i32, i32 }*> [#uses=1]
+ ; Build a first class array to store
+ %res1 = insertvalue [ 2 x i32 ] undef, i32 1, 0 ; <{ i32, i32 }> [#uses=1]
+ %res2 = insertvalue [ 2 x i32 ] %res1, i32 2, 1 ; <{ i32, i32 }> [#uses=1]
+ ; And store it
+ store [ 2 x i32 ] %res2, [ 2 x i32 ]* %target
+ ; Actually use %target, so it doesn't get removed alltogether
+ %ptr = getelementptr [ 2 x i32 ]* %target, i32 0, i32 0
+ %val = load i32* %ptr
+ ret i32 %val
+}
diff --git a/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll b/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll
new file mode 100644
index 000000000000..8fbbb6749a9c
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {call.*mem}
+; PR2369
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+
+define void @memtest1(i8* %dst, i8* %src) nounwind {
+entry:
+ %temp = alloca [200 x i8] ; <[100 x i8]*> [#uses=2]
+ %temp1 = bitcast [200 x i8]* %temp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %temp1, i8* %src, i32 200, i32 1 )
+ %temp3 = bitcast [200 x i8]* %temp to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %dst, i8* %temp3, i32 200, i32 1 )
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll b/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll
new file mode 100644
index 000000000000..a2386fdedcb7
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {s = alloca .struct.x}
+; PR2423
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+ %struct.x = type { [1 x i32], i32, i32 }
+
+define i32 @b() nounwind {
+entry:
+ %s = alloca %struct.x ; <%struct.x*> [#uses=2]
+ %r = alloca %struct.x ; <%struct.x*> [#uses=2]
+ call i32 @a( %struct.x* %s ) nounwind ; <i32>:0 [#uses=0]
+ %r1 = bitcast %struct.x* %r to i8* ; <i8*> [#uses=1]
+ %s2 = bitcast %struct.x* %s to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %r1, i8* %s2, i32 12, i32 8 )
+ getelementptr %struct.x* %r, i32 0, i32 0, i32 1 ; <i32*>:1 [#uses=1]
+ load i32* %1, align 4 ; <i32>:2 [#uses=1]
+ ret i32 %2
+}
+
+declare i32 @a(%struct.x*)
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll b/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll
new file mode 100644
index 000000000000..6640383973e2
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll
@@ -0,0 +1,24 @@
+; This test checks to see if scalarrepl also works when a gep with all zeroes is
+; used instead of a bitcast to prepare a memmove pointer argument. Previously,
+; this would not work when there was a vector involved in the struct, preventing
+; scalarrepl from removing the alloca below.
+
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis > %t
+; RUN: cat %t | not grep alloca
+
+%struct.two = type <{ < 2 x i8 >, i16 }>
+
+define void @main(%struct.two* %D, i16 %V) {
+entry:
+ %S = alloca %struct.two
+ %S.2 = getelementptr %struct.two* %S, i32 0, i32 1
+ store i16 %V, i16* %S.2
+ ; This gep is effectively a bitcast to i8*, but is sometimes generated
+ ; because the type of the first element in %struct.two is i8.
+ %tmpS = getelementptr %struct.two* %S, i32 0, i32 0, i32 0
+ %tmpD = bitcast %struct.two* %D to i8*
+ call void @llvm.memmove.i32(i8* %tmpD, i8* %tmpS, i32 4, i32 1)
+ ret void
+}
+
+declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind
diff --git a/test/Transforms/ScalarRepl/2009-01-09-scalarrepl-empty.ll b/test/Transforms/ScalarRepl/2009-01-09-scalarrepl-empty.ll
new file mode 100644
index 000000000000..9cdf4a0ef245
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-01-09-scalarrepl-empty.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis
+; PR3304
+
+ %struct.c37304a__vrec = type { i8, %struct.c37304a__vrec___disc___XVN }
+ %struct.c37304a__vrec___disc___XVN = type {
+%struct.c37304a__vrec___disc___XVN___O }
+ %struct.c37304a__vrec___disc___XVN___O = type { }
+
+define void @_ada_c37304a() {
+entry:
+ %v = alloca %struct.c37304a__vrec ;
+ %0 = getelementptr %struct.c37304a__vrec* %v, i32 0, i32 0
+ store i8 8, i8* %0, align 1
+ unreachable
+}
diff --git a/test/Transforms/ScalarRepl/2009-02-02-ScalarPromoteOutOfRange.ll b/test/Transforms/ScalarRepl/2009-02-02-ScalarPromoteOutOfRange.ll
new file mode 100644
index 000000000000..af34baa0c5cf
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-02-02-ScalarPromoteOutOfRange.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | grep {ret i32 %x}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+
+%pair = type { [1 x i32], i32 }
+
+define i32 @f(i32 %x, i32 %y) {
+ %instance = alloca %pair
+ %first = getelementptr %pair* %instance, i32 0, i32 0
+ %cast = bitcast [1 x i32]* %first to i32*
+ store i32 %x, i32* %cast
+ %second = getelementptr %pair* %instance, i32 0, i32 1
+ store i32 %y, i32* %second
+ %v = load i32* %cast
+ ret i32 %v
+}
diff --git a/test/Transforms/ScalarRepl/2009-02-05-LoadFCA.ll b/test/Transforms/ScalarRepl/2009-02-05-LoadFCA.ll
new file mode 100644
index 000000000000..3bea5738ab80
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-02-05-LoadFCA.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine -inline -instcombine | llvm-dis | grep {ret i32 42}
+; PR3489
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "x86_64-apple-darwin10.0"
+ %struct.anon = type <{ i32, i32, i32 }>
+
+define i32 @f({ i64, i64 }) nounwind {
+entry:
+ %tmp = alloca { i64, i64 }, align 8 ; <{ i64, i64 }*> [#uses=2]
+ store { i64, i64 } %0, { i64, i64 }* %tmp
+ %1 = bitcast { i64, i64 }* %tmp to %struct.anon* ; <%struct.anon*> [#uses=1]
+ %2 = load %struct.anon* %1, align 8 ; <%struct.anon> [#uses=1]
+ %tmp3 = extractvalue %struct.anon %2, 0
+ ret i32 %tmp3
+}
+
+define i32 @g() {
+ %a = call i32 @f({i64,i64} { i64 42, i64 1123123123123123 })
+ ret i32 %a
+}
diff --git a/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll b/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll
new file mode 100644
index 000000000000..4fc491b29798
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll
@@ -0,0 +1,19 @@
+; The store into %p should end up with a known alignment of 1, since the memcpy
+; is only known to access it with 1-byte alignment.
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {store i16 1, .*, align 1}
+; PR3720
+
+ %struct.st = type { i16 }
+
+define void @f(i8* %p) nounwind {
+entry:
+ %s = alloca %struct.st, align 4 ; <%struct.st*> [#uses=2]
+ %0 = getelementptr %struct.st* %s, i32 0, i32 0 ; <i16*> [#uses=1]
+ store i16 1, i16* %0, align 4
+ %s1 = bitcast %struct.st* %s to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32(i8* %p, i8* %s1, i32 2, i32 1)
+ ret void
+}
+
+declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind
+
diff --git a/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll b/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll
new file mode 100644
index 000000000000..437e732653f9
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll
@@ -0,0 +1,184 @@
+; RUN: llvm-as < %s | opt -scalarrepl -disable-output -stats |& grep "Number of aggregates converted to scalar"
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin9.6"
+ type { } ; type %0
+ type { i8*, i32, i32, i16, i16, %2, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %2, %3*, i32, [3 x i8], [1 x i8], %2, i32, i64 } ; type %1
+ type { i8*, i32 } ; type %2
+ type opaque ; type %3
+ type { i32 } ; type %4
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
+ %llvm.dbg.composite.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0*, %0*, i32 }
+ %llvm.dbg.derivedtype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0* }
+ %llvm.dbg.subprogram.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1 }
+ %llvm.dbg.subrange.type = type { i32, i64, i64 }
+ %llvm.dbg.variable.type = type { i32, %0*, i8*, %0*, i32, %0* }
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+internal constant [8 x i8] c"PR491.c\00", section "llvm.metadata" ; <[8 x i8]*>:0 [#uses=1]
+internal constant [77 x i8] c"/Volumes/Nanpura/mainline/llvm/projects/llvm-test/SingleSource/Regression/C/\00", section "llvm.metadata" ; <[77 x i8]*>:1 [#uses=1]
+internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*>:2 [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 1, i8* getelementptr ([8 x i8]* @0, i32 0, i32 0), i8* getelementptr ([77 x i8]* @1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*>:3 [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @3, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+internal constant [5 x i8] c"char\00", section "llvm.metadata" ; <[5 x i8]*>:4 [#uses=1]
+@llvm.dbg.basictype5 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @4, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, i32 6 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype5 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype6 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+internal constant [13 x i8] c"unsigned int\00", section "llvm.metadata" ; <[13 x i8]*>:5 [#uses=1]
+@llvm.dbg.basictype8 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @5, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 7 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype6 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype8 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+internal constant [12 x i8] c"assert_fail\00", section "llvm.metadata" ; <[12 x i8]*>:6 [#uses=1]
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @6, i32 0, i32 0), i8* getelementptr ([12 x i8]* @6, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 4, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to %0*), i1 true, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=0]
+internal constant [2 x i8] c"l\00", section "llvm.metadata" ; <[2 x i8]*>:7 [#uses=1]
+@__stderrp = external global %1* ; <%1**> [#uses=4]
+internal constant [35 x i8] c"assertion failed in line %u: '%s'\0A\00", section "__TEXT,__cstring,cstring_literals" ; <[35 x i8]*>:8 [#uses=1]
+@llvm.dbg.array13 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite14 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array13 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+internal constant [5 x i8] c"test\00", section "llvm.metadata" ; <[5 x i8]*>:9 [#uses=1]
+@llvm.dbg.subprogram16 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @9, i32 0, i32 0), i8* getelementptr ([5 x i8]* @9, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 10, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite14 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+internal constant [9 x i8] c"long int\00", section "llvm.metadata" ; <[9 x i8]*>:10 [#uses=1]
+@llvm.dbg.basictype21 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @10, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.derivedtype22 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to %0*), i8* getelementptr ([2 x i8]* @7, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 20, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype21 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.subrange = internal constant %llvm.dbg.subrange.type { i32 458785, i64 0, i64 3 }, section "llvm.metadata" ; <%llvm.dbg.subrange.type*> [#uses=1]
+@llvm.dbg.array23 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.subrange.type* @llvm.dbg.subrange to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+internal constant [14 x i8] c"unsigned char\00", section "llvm.metadata" ; <[14 x i8]*>:11 [#uses=1]
+@llvm.dbg.basictype25 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @11, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, i32 8 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.composite26 = internal constant %llvm.dbg.composite.type { i32 458753, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype25 to %0*), %0* bitcast ([1 x %0*]* @llvm.dbg.array23 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+internal constant [2 x i8] c"c\00", section "llvm.metadata" ; <[2 x i8]*>:12 [#uses=1]
+@llvm.dbg.derivedtype28 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to %0*), i8* getelementptr ([2 x i8]* @12, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 20, i64 32, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite26 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array29 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype22 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype28 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite30 = internal constant %llvm.dbg.composite.type { i32 458775, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 20, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array29 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+internal constant [2 x i8] c"u\00", section "llvm.metadata" ; <[2 x i8]*>:13 [#uses=1]
+@llvm.dbg.variable32 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to %0*), i8* getelementptr ([2 x i8]* @13, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 20, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite30 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+internal constant [11 x i8] c"u.l == 128\00", section "__TEXT,__cstring,cstring_literals" ; <[11 x i8]*>:14 [#uses=1]
+internal constant [8 x i8] c"u.l < 0\00", section "__TEXT,__cstring,cstring_literals" ; <[8 x i8]*>:15 [#uses=1]
+@llvm.dbg.array35 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+@llvm.dbg.composite36 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array35 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*>:16 [#uses=1]
+@llvm.dbg.subprogram38 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @16, i32 0, i32 0), i8* getelementptr ([5 x i8]* @16, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 28, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite36 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+
+declare void @llvm.dbg.func.start(%0*) nounwind readnone
+
+declare void @llvm.dbg.declare(%0*, %0*) nounwind readnone
+
+declare void @llvm.dbg.stoppoint(i32, i32, %0*) nounwind readnone
+
+declare i32 @fprintf(%1* nocapture, i8* nocapture, ...) nounwind
+
+declare void @llvm.dbg.region.end(%0*) nounwind readnone
+
+define i32 @test(i32) nounwind {
+; <label>:1
+ %2 = alloca %4, align 8 ; <%4*> [#uses=7]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to %0*))
+ %3 = bitcast %4* %2 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %3, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable32 to %0*))
+ call void @llvm.dbg.stoppoint(i32 21, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %4 = getelementptr %4* %2, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %4, align 8
+ %5 = bitcast %4* %2 to i8* ; <i8*> [#uses=1]
+ store i8 -128, i8* %5, align 8
+ call void @llvm.dbg.stoppoint(i32 22, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %6 = getelementptr %4* %2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = load i32* %6, align 8 ; <i32> [#uses=1]
+ %8 = icmp eq i32 %7, 128 ; <i1> [#uses=1]
+ br i1 %8, label %12, label %9
+
+; <label>:9 ; preds = %1
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %10 = load %1** @__stderrp, align 4 ; <%1*> [#uses=1]
+ %11 = call i32 (%1*, i8*, ...)* @fprintf(%1* %10, i8* getelementptr ([35 x i8]* @8, i32 0, i32 0), i32 22, i8* getelementptr ([11 x i8]* @14, i32 0, i32 0)) nounwind ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ br label %12
+
+; <label>:12 ; preds = %9, %1
+ %.0 = phi i32 [ 0, %9 ], [ 1, %1 ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 22, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %13 = and i32 %.0, %0 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 23, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %14 = getelementptr %4* %2, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %14, align 8
+ %15 = bitcast %4* %2 to [4 x i8]* ; <[4 x i8]*> [#uses=1]
+ %16 = getelementptr [4 x i8]* %15, i32 0, i32 3 ; <i8*> [#uses=1]
+ store i8 -128, i8* %16, align 1
+ call void @llvm.dbg.stoppoint(i32 24, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %17 = getelementptr %4* %2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %18 = load i32* %17, align 8 ; <i32> [#uses=1]
+ %19 = icmp slt i32 %18, 0 ; <i1> [#uses=1]
+ br i1 %19, label %23, label %20
+
+; <label>:20 ; preds = %12
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %21 = load %1** @__stderrp, align 4 ; <%1*> [#uses=1]
+ %22 = call i32 (%1*, i8*, ...)* @fprintf(%1* %21, i8* getelementptr ([35 x i8]* @8, i32 0, i32 0), i32 24, i8* getelementptr ([8 x i8]* @15, i32 0, i32 0)) nounwind ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ br label %23
+
+; <label>:23 ; preds = %20, %12
+ %.01 = phi i32 [ 0, %20 ], [ 1, %12 ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 24, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %24 = and i32 %.01, %13 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 25, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to %0*))
+ ret i32 %24
+}
+
+define i32 @main() nounwind {
+; <label>:0
+ %1 = alloca %4, align 8 ; <%4*> [#uses=7]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram38 to %0*))
+ call void @llvm.dbg.stoppoint(i32 29, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %2 = bitcast %4* %1 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %2, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable32 to %0*)) nounwind
+ call void @llvm.dbg.stoppoint(i32 21, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %3 = getelementptr %4* %1, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %3, align 8
+ %4 = bitcast %4* %1 to i8* ; <i8*> [#uses=1]
+ store i8 -128, i8* %4, align 8
+ call void @llvm.dbg.stoppoint(i32 22, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %5 = getelementptr %4* %1, i32 0, i32 0 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 8 ; <i32> [#uses=1]
+ %7 = icmp eq i32 %6, 128 ; <i1> [#uses=1]
+ br i1 %7, label %11, label %8
+
+; <label>:8 ; preds = %0
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %9 = load %1** @__stderrp, align 4 ; <%1*> [#uses=1]
+ %10 = call i32 (%1*, i8*, ...)* @fprintf(%1* %9, i8* getelementptr ([35 x i8]* @8, i32 0, i32 0), i32 22, i8* getelementptr ([11 x i8]* @14, i32 0, i32 0)) nounwind ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ br label %11
+
+; <label>:11 ; preds = %8, %0
+ %.0.i = phi i32 [ 0, %8 ], [ 1, %0 ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 23, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %12 = getelementptr %4* %1, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %12, align 8
+ %13 = bitcast %4* %1 to [4 x i8]* ; <[4 x i8]*> [#uses=1]
+ %14 = getelementptr [4 x i8]* %13, i32 0, i32 3 ; <i8*> [#uses=1]
+ store i8 -128, i8* %14, align 1
+ call void @llvm.dbg.stoppoint(i32 24, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %15 = getelementptr %4* %1, i32 0, i32 0 ; <i32*> [#uses=1]
+ %16 = load i32* %15, align 8 ; <i32> [#uses=1]
+ %17 = icmp slt i32 %16, 0 ; <i1> [#uses=1]
+ br i1 %17, label %test.exit, label %18
+
+; <label>:18 ; preds = %11
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %19 = load %1** @__stderrp, align 4 ; <%1*> [#uses=1]
+ %20 = call i32 (%1*, i8*, ...)* @fprintf(%1* %19, i8* getelementptr ([35 x i8]* @8, i32 0, i32 0), i32 24, i8* getelementptr ([8 x i8]* @15, i32 0, i32 0)) nounwind ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ br label %test.exit
+
+test.exit: ; preds = %18, %11
+ %.01.i = phi i32 [ 0, %18 ], [ 1, %11 ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 24, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %21 = and i32 %.01.i, %.0.i ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 25, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) nounwind
+ %tmp = xor i32 %21, 1 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 29, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram38 to %0*))
+ ret i32 %tmp
+}
diff --git a/test/Transforms/ScalarRepl/2009-03-17-CleanUp.ll b/test/Transforms/ScalarRepl/2009-03-17-CleanUp.ll
new file mode 100644
index 000000000000..13055ea87b60
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-03-17-CleanUp.ll
@@ -0,0 +1,3961 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep store | not grep undef
+
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+ type { } ; type %0
+ type { double, double } ; type %1
+ type { i32, void ()* } ; type %2
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
+ %llvm.dbg.composite.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0*, %0*, i32 }
+ %llvm.dbg.derivedtype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0* }
+ %llvm.dbg.global_variable.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1, %0* }
+ %llvm.dbg.subprogram.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1 }
+ %llvm.dbg.subrange.type = type { i32, i64, i64 }
+ %llvm.dbg.variable.type = type { i32, %0*, i8*, %0*, i32, %0* }
+ %struct..0._50 = type { i32 }
+ %struct..1__pthread_mutex_s = type { i32, i32, i32, i32, i32, %struct..0._50 }
+ %struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
+ %struct.__locale_struct = type { [13 x %struct.locale_data*], i16*, i32*, i32*, [13 x i8*] }
+ %struct.__pthread_slist_t = type { %struct.__pthread_slist_t* }
+ %struct.__si_class_type_info_pseudo = type { %struct.__type_info_pseudo, %"struct.std::type_info"* }
+ %struct.__type_info_pseudo = type { i8*, i8* }
+ %struct.locale_data = type opaque
+ %"struct.polynomial<double>" = type { i32 (...)**, double*, i32 }
+ %"struct.polynomial<std::complex<double> >" = type { i32 (...)**, %"struct.std::complex<double>"*, i32 }
+ %struct.pthread_attr_t = type { i32, [32 x i8] }
+ %struct.pthread_mutex_t = type { %struct..1__pthread_mutex_s }
+ %struct.pthread_mutexattr_t = type { i32 }
+ %"struct.std::allocator<char>" = type <{ i8 }>
+ %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i8, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"* }
+ %"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
+ %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" = type { i8* }
+ %"struct.std::complex<double>" = type { %1 }
+ %"struct.std::ctype<char>" = type { %"struct.std::locale::facet", %struct.__locale_struct*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 }
+ %"struct.std::exception" = type { i32 (...)** }
+ %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
+ %"struct.std::ios_base::Init" = type <{ i8 }>
+ %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
+ %"struct.std::ios_base::_Words" = type { i8*, i32 }
+ %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
+ %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+ %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
+ %"struct.std::num_put<char,std::ostreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
+ %"struct.std::overflow_error" = type { %"struct.std::runtime_error" }
+ %"struct.std::runtime_error" = type { %"struct.std::exception", %"struct.std::string" }
+ %"struct.std::string" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" }
+ %"struct.std::type_info" = type { i32 (...)**, i8* }
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str = internal constant [13 x i8] c"fftbench.cpp\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str1 = internal constant [42 x i8] c"/developer/home2/zsth/test/debug/tmp3/X3/\00", section "llvm.metadata" ; <[42 x i8]*> [#uses=1]
+@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([42 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str3 = internal constant [8 x i8] c"complex\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str4 = internal constant [110 x i8] c"/developer/home2/zsth/projects/llvm.org/install/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1\00", section "llvm.metadata" ; <[110 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit5 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([110 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str6 = internal constant [16 x i8] c"complex<double>\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str7 = internal constant [15 x i8] c"complex double\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str7, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 128, i64 64, i64 0, i32 0, i32 3 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@.str8 = internal constant [9 x i8] c"_M_value\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str8, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1195, i64 128, i64 64, i64 0, i32 1, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype9 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite10 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1161, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite10 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str11 = internal constant [7 x i8] c"double\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@llvm.dbg.basictype12 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str11, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 64, i64 0, i32 0, i32 4 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array13 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite14 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array13 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram15 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1215, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite14 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str16 = internal constant [15 x i8] c"complex<float>\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@.str18 = internal constant [14 x i8] c"complex float\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.basictype19 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str18, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 32, i64 0, i32 0, i32 3 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.derivedtype20 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str8, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1042, i64 64, i64 32, i64 0, i32 1, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype19 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype21 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite171 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array22 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype19 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite23 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array22 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram24 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1007, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite23 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str25 = internal constant [6 x i8] c"float\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.basictype26 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str25, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 4 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array27 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype26 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype26 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite28 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array27 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram29 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1062, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite28 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype30 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 128, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype31 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype30 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array32 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite33 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array32 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram34 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1464, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite33 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str35 = internal constant [21 x i8] c"complex<long double>\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@.str37 = internal constant [20 x i8] c"complex long double\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.basictype38 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([20 x i8]* @.str37, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 192, i64 32, i64 0, i32 0, i32 3 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.derivedtype39 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str8, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1348, i64 192, i64 32, i64 0, i32 1, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype38 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype40 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite122 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array41 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype38 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite42 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array41 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram43 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1314, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite42 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str44 = internal constant [12 x i8] c"long double\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.basictype45 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str44, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 96, i64 32, i64 0, i32 0, i32 4 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array46 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype45 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype45 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite47 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array46 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram48 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1352, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite47 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype49 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite171 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype50 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype49 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array51 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype50 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite52 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array51 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram53 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1480, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array54 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite55 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array54 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram56 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1484, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite55 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype57 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype45 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array58 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype57 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite59 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array58 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str60 = internal constant [5 x i8] c"real\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str61 = internal constant [24 x i8] c"_ZNSt7complexIeE4realEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram62 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str61, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1359, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite59 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str63 = internal constant [9 x i8] c"stddef.h\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str64 = internal constant [88 x i8] c"/developer/home2/zsth/projects/llvm.org/install/lib/gcc/i686-pc-linux-gnu/4.2.1/include\00", section "llvm.metadata" ; <[88 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit65 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @.str63, i32 0, i32 0), i8* getelementptr ([88 x i8]* @.str64, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str66 = internal constant [8 x i8] c"float_t\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype67 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str66, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit65 to %0*), i32 214, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype45 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str68 = internal constant [10 x i8] c"mathdef.h\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str69 = internal constant [18 x i8] c"/usr/include/bits\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit70 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([10 x i8]* @.str68, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str69, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str71 = internal constant [9 x i8] c"double_t\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype72 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str71, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit70 to %0*), i32 36, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype67 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype73 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 96, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype72 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype74 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype73 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype75 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 192, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite122 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype76 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype75 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array77 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype74 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype76 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite78 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array77 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str79 = internal constant [25 x i8] c"_ZNKSt7complexIeE4realEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram80 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str79, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1363, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite78 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str81 = internal constant [5 x i8] c"imag\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str82 = internal constant [24 x i8] c"_ZNSt7complexIeE4imagEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram83 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str82, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1367, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite59 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str84 = internal constant [25 x i8] c"_ZNKSt7complexIeE4imagEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram85 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str84, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1371, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite78 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype86 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite122 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array87 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype86 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype45 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite88 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array87 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str89 = internal constant [10 x i8] c"operator=\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str90 = internal constant [21 x i8] c"_ZNSt7complexIeEaSEe\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram91 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str90, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1375, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite88 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str92 = internal constant [11 x i8] c"operator+=\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str93 = internal constant [21 x i8] c"_ZNSt7complexIeEpLEe\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram94 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str93, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1383, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite88 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str95 = internal constant [11 x i8] c"operator-=\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str96 = internal constant [21 x i8] c"_ZNSt7complexIeEmIEe\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram97 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str96, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1390, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite88 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str98 = internal constant [11 x i8] c"operator*=\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str99 = internal constant [21 x i8] c"_ZNSt7complexIeEmLEe\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram100 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str99, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1397, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite88 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str101 = internal constant [11 x i8] c"operator/=\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str102 = internal constant [21 x i8] c"_ZNSt7complexIeEdVEe\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram103 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str102, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1404, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite88 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite104 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 55, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype105 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite104 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype106 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype105 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array107 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype86 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype40 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype106 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite108 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array107 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram109 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1335, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite108 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram110 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1337, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite108 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram111 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1339, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite108 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram112 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1341, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite108 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram113 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1343, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite108 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype114 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 192, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype38 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype115 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype114 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array116 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype115 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype76 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite117 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array116 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str118 = internal constant [6 x i8] c"__rep\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str119 = internal constant [26 x i8] c"_ZNKSt7complexIeE5__repEv\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram120 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str119, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1345, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite117 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array121 = internal constant [20 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype39 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram43 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram48 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram53 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram62 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram80 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram83 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram85 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram91 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram94 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram97 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram100 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram103 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram109 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram110 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram111 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram112 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram113 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram120 to %0*)], section "llvm.metadata" ; <[20 x %0*]*> [#uses=1]
+@llvm.dbg.composite122 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([21 x i8]* @.str35, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1310, i64 192, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([20 x %0*]* @llvm.dbg.array121 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype123 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 192, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite122 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype124 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype123 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array125 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype124 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite126 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array125 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram127 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1468, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite126 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype128 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype26 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array129 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype128 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite130 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array129 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str131 = internal constant [24 x i8] c"_ZNSt7complexIfE4realEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram132 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str131, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1046, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite130 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype133 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype26 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype134 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype133 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype135 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype49 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array136 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype134 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype135 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite137 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array136 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str138 = internal constant [25 x i8] c"_ZNKSt7complexIfE4realEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram139 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str138, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1050, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite137 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str140 = internal constant [24 x i8] c"_ZNSt7complexIfE4imagEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram141 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str140, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1054, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite130 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str142 = internal constant [25 x i8] c"_ZNKSt7complexIfE4imagEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram143 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str142, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1058, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite137 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype144 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite171 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array145 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype144 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype26 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite146 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array145 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str147 = internal constant [21 x i8] c"_ZNSt7complexIfEaSEf\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram148 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str147, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1069, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite146 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str149 = internal constant [21 x i8] c"_ZNSt7complexIfEpLEf\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram150 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str149, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1077, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite146 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str151 = internal constant [21 x i8] c"_ZNSt7complexIfEmIEf\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram152 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str151, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1084, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite146 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str153 = internal constant [21 x i8] c"_ZNSt7complexIfEmLEf\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram154 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str153, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1091, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite146 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str155 = internal constant [21 x i8] c"_ZNSt7complexIfEdVEf\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram156 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str155, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1098, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite146 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array157 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype144 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype21 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype106 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite158 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array157 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram159 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1029, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite158 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram160 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1031, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite158 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram161 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1033, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite158 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram162 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1035, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite158 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram163 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1037, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite158 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype164 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype19 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype165 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype164 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array166 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype165 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype135 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite167 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array166 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str168 = internal constant [26 x i8] c"_ZNKSt7complexIfE5__repEv\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram169 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str168, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1039, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite167 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array170 = internal constant [20 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype20 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram24 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram29 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram34 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram127 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram132 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram139 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram141 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram143 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram148 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram150 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram152 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram154 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram156 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram159 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram160 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram161 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram162 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram163 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram169 to %0*)], section "llvm.metadata" ; <[20 x %0*]*> [#uses=1]
+@llvm.dbg.composite171 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str16, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1003, i64 64, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([20 x %0*]* @llvm.dbg.array170 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype172 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite171 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype173 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype172 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array174 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype173 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite175 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array174 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram176 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1472, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite175 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array177 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype124 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite178 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array177 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram179 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1476, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite178 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype180 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array181 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype180 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite182 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array181 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str183 = internal constant [24 x i8] c"_ZNSt7complexIdE4realEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram184 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str183, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1199, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite182 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype185 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 64, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype186 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype185 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype187 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype30 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array188 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype186 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype187 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite189 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array188 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str190 = internal constant [25 x i8] c"_ZNKSt7complexIdE4realEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram191 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str190, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1203, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite189 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str192 = internal constant [24 x i8] c"_ZNSt7complexIdE4imagEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram193 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str192, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1207, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite182 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str194 = internal constant [25 x i8] c"_ZNKSt7complexIdE4imagEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram195 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str194, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1211, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite189 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype196 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array197 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype196 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite198 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array197 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str199 = internal constant [21 x i8] c"_ZNSt7complexIdEaSEd\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram200 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str199, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1222, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str201 = internal constant [21 x i8] c"_ZNSt7complexIdEpLEd\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram202 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str201, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1230, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str203 = internal constant [21 x i8] c"_ZNSt7complexIdEmIEd\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram204 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str203, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1237, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str205 = internal constant [21 x i8] c"_ZNSt7complexIdEmLEd\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram206 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str205, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1244, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str207 = internal constant [21 x i8] c"_ZNSt7complexIdEdVEd\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram208 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str207, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1251, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array209 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype196 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype106 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite210 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array209 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram211 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1182, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram212 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1184, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram213 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1186, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram214 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1188, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram215 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1190, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype216 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 128, i64 64, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype217 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype216 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array218 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype217 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype187 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite219 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array218 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str220 = internal constant [26 x i8] c"_ZNKSt7complexIdE5__repEv\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram221 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str220, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1192, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite219 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array222 = internal constant [20 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram15 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram176 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram179 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram184 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram191 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram193 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram195 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram200 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram202 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram204 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram206 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram208 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram211 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram212 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram213 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram214 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram215 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram221 to %0*)], section "llvm.metadata" ; <[20 x %0*]*> [#uses=1]
+@llvm.dbg.composite223 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str6, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1157, i64 128, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([20 x %0*]* @llvm.dbg.array222 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype224 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array225 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype224 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array225 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str226 = internal constant [22 x i8] c"_ZNSt7complexIdEC1ECd\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram227 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str226, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1161, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str230 = internal constant [4 x i8] c"__z\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.variable231 = internal constant %llvm.dbg.variable.type { i32 459009, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram227 to %0*), i8* getelementptr ([4 x i8]* @.str230, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1161, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram232 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str118, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str220, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1192, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite219 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram235 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str183, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1199, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite182 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram237 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str60, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str190, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1203, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite189 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram239 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str81, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str194, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1211, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite189 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str241 = internal constant [22 x i8] c"_ZNSt7complexIdEC1Edd\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram242 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str241, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1215, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite14 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str244 = internal constant [4 x i8] c"__r\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.subprogram248 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str199, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1222, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram252 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str101, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str207, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1251, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite198 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array255 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+@llvm.dbg.composite256 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array255 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str257 = internal constant [14 x i8] c"random_double\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram258 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str257, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str257, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 55, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite256 to %0*), i1 true, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=0]
+@.str259 = internal constant [7 x i8] c"result\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@_ZZL13random_doublevE4seed = internal global i32 1325 ; <i32*> [#uses=14]
+@.str266 = internal constant [19 x i8] c"polynomial<double>\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@.str268 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.basictype269 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str268, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array270 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+@llvm.dbg.composite271 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array270 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype272 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite271 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype273 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype272 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str274 = internal constant [17 x i8] c"_vptr.polynomial\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype275 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str274, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 84, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype273 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype276 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str277 = internal constant [8 x i8] c"m_coeff\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype278 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str277, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 164, i64 32, i64 32, i64 32, i32 2, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype276 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str279 = internal constant [13 x i8] c"unsigned int\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.basictype280 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str279, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 7 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@.str281 = internal constant [7 x i8] c"size_t\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype282 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str281, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit65 to %0*), i32 152, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str283 = internal constant [9 x i8] c"m_degree\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype284 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str283, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 167, i64 32, i64 32, i64 64, i32 2, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype285 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array286 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite287 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array286 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str288 = internal constant [11 x i8] c"polynomial\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.subprogram289 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 211, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite287 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype290 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype185 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array291 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype290 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite292 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array291 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram293 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 220, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite292 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array294 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype186 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite295 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array294 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram296 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 232, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite295 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype297 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 96, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype298 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype297 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array299 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype298 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite300 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array299 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram301 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 242, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite300 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array302 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite303 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array302 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str304 = internal constant [12 x i8] c"~polynomial\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.subprogram305 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 252, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite303 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype306 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array307 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype306 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype298 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite308 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array307 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str309 = internal constant [27 x i8] c"_ZN10polynomialIdEaSERKS0_\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram310 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str309, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 259, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite308 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array311 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype186 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite312 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array311 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str313 = internal constant [11 x i8] c"initialize\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str314 = internal constant [35 x i8] c"_ZN10polynomialIdE10initializeERKd\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram315 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str313, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str313, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str314, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 203, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite312 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array316 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype306 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite317 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array316 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str318 = internal constant [8 x i8] c"stretch\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str319 = internal constant [29 x i8] c"_ZN10polynomialIdE7stretchEj\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram320 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str318, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str318, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str319, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 276, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite317 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype321 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype297 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array322 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype321 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite323 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array322 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str324 = internal constant [7 x i8] c"degree\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str325 = internal constant [29 x i8] c"_ZNK10polynomialIdE6degreeEv\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram326 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str325, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 111, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite323 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array327 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype321 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite328 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array327 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str329 = internal constant [4 x i8] c"get\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str330 = internal constant [26 x i8] c"_ZNK10polynomialIdE3getEj\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram331 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str330, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 300, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite328 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array332 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype180 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite333 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array332 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str334 = internal constant [11 x i8] c"operator[]\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str335 = internal constant [23 x i8] c"_ZN10polynomialIdEixEj\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1]
+@llvm.dbg.subprogram336 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str335, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 306, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite333 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array337 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype12 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype321 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype186 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite338 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array337 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str339 = internal constant [11 x i8] c"operator()\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str340 = internal constant [26 x i8] c"_ZNK10polynomialIdEclERKd\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram341 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str339, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str339, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str340, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 313, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite338 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array342 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype321 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite343 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array342 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str344 = internal constant [10 x i8] c"operator-\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str345 = internal constant [24 x i8] c"_ZNK10polynomialIdEngEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram346 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str345, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 335, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite343 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str347 = internal constant [10 x i8] c"operator+\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str348 = internal constant [24 x i8] c"_ZNK10polynomialIdEpsEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram349 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str348, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 346, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite343 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array350 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype321 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype298 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite351 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array350 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str352 = internal constant [28 x i8] c"_ZNK10polynomialIdEplERKS0_\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram353 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str352, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 353, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite351 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str354 = internal constant [28 x i8] c"_ZNK10polynomialIdEmiERKS0_\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram355 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str354, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 376, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite351 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array356 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite357 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array356 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str358 = internal constant [5 x i8] c"log2\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str359 = internal constant [26 x i8] c"_ZN10polynomialIdE4log2Ej\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram360 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str358, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str358, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str359, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 404, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite357 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array361 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite362 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array361 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str363 = internal constant [10 x i8] c"flip_bits\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str364 = internal constant [32 x i8] c"_ZN10polynomialIdE9flip_bitsEjj\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram365 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str363, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str363, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str364, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 423, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite362 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array366 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite367 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array366 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str368 = internal constant [12 x i8] c"stretch_fft\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@.str369 = internal constant [34 x i8] c"_ZN10polynomialIdE11stretch_fftEv\00", section "llvm.metadata" ; <[34 x i8]*> [#uses=1]
+@llvm.dbg.subprogram370 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str368, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str368, i32 0, i32 0), i8* getelementptr ([34 x i8]* @.str369, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 443, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite367 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str371 = internal constant [34 x i8] c"polynomial<std::complex<double> >\00", section "llvm.metadata" ; <[34 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype373 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str274, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 84, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype273 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype374 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str277, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 164, i64 32, i64 32, i64 32, i32 2, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype224 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype375 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str283, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 167, i64 32, i64 32, i64 64, i32 2, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype376 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array377 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite378 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array377 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram379 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 211, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite378 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array380 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype187 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite381 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array380 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram382 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 220, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite381 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array383 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite384 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array383 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram385 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 232, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite384 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype386 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 96, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype387 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype386 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array388 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype387 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite389 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array388 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram390 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 242, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite389 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array391 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite392 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array391 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram393 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 252, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite392 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype394 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array395 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype394 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype387 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite396 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array395 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str397 = internal constant [39 x i8] c"_ZN10polynomialISt7complexIdEEaSERKS2_\00", section "llvm.metadata" ; <[39 x i8]*> [#uses=1]
+@llvm.dbg.subprogram398 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([39 x i8]* @.str397, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 259, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite396 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array399 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite400 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array399 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str401 = internal constant [49 x i8] c"_ZN10polynomialISt7complexIdEE10initializeERKS1_\00", section "llvm.metadata" ; <[49 x i8]*> [#uses=1]
+@llvm.dbg.subprogram402 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str313, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str313, i32 0, i32 0), i8* getelementptr ([49 x i8]* @.str401, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 203, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite400 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array403 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype394 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite404 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array403 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str405 = internal constant [41 x i8] c"_ZN10polynomialISt7complexIdEE7stretchEj\00", section "llvm.metadata" ; <[41 x i8]*> [#uses=1]
+@llvm.dbg.subprogram406 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str318, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str318, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str405, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 276, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite404 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype407 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype386 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array408 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype407 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite409 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array408 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str410 = internal constant [41 x i8] c"_ZNK10polynomialISt7complexIdEE6degreeEv\00", section "llvm.metadata" ; <[41 x i8]*> [#uses=1]
+@llvm.dbg.subprogram411 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str410, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 111, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite409 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array412 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype407 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite413 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array412 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str414 = internal constant [38 x i8] c"_ZNK10polynomialISt7complexIdEE3getEj\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1]
+@llvm.dbg.subprogram415 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str414, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 300, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite413 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array416 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype196 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite417 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array416 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str418 = internal constant [35 x i8] c"_ZN10polynomialISt7complexIdEEixEj\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram419 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str418, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 306, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite417 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array420 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype407 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite421 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array420 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str422 = internal constant [40 x i8] c"_ZNK10polynomialISt7complexIdEEclERKS1_\00", section "llvm.metadata" ; <[40 x i8]*> [#uses=1]
+@llvm.dbg.subprogram423 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str339, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str339, i32 0, i32 0), i8* getelementptr ([40 x i8]* @.str422, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 313, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite421 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array424 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype407 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite425 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array424 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str426 = internal constant [36 x i8] c"_ZNK10polynomialISt7complexIdEEngEv\00", section "llvm.metadata" ; <[36 x i8]*> [#uses=1]
+@llvm.dbg.subprogram427 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([36 x i8]* @.str426, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 335, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite425 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str428 = internal constant [36 x i8] c"_ZNK10polynomialISt7complexIdEEpsEv\00", section "llvm.metadata" ; <[36 x i8]*> [#uses=1]
+@llvm.dbg.subprogram429 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([36 x i8]* @.str428, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 346, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite425 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array430 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype407 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype387 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite431 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array430 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str432 = internal constant [40 x i8] c"_ZNK10polynomialISt7complexIdEEplERKS2_\00", section "llvm.metadata" ; <[40 x i8]*> [#uses=1]
+@llvm.dbg.subprogram433 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([40 x i8]* @.str432, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 353, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite431 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str434 = internal constant [40 x i8] c"_ZNK10polynomialISt7complexIdEEmiERKS2_\00", section "llvm.metadata" ; <[40 x i8]*> [#uses=1]
+@llvm.dbg.subprogram435 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([40 x i8]* @.str434, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 376, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite431 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str436 = internal constant [38 x i8] c"_ZN10polynomialISt7complexIdEE4log2Ej\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1]
+@llvm.dbg.subprogram437 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str358, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str358, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str436, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 404, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite357 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str438 = internal constant [44 x i8] c"_ZN10polynomialISt7complexIdEE9flip_bitsEjj\00", section "llvm.metadata" ; <[44 x i8]*> [#uses=1]
+@llvm.dbg.subprogram439 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str363, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str363, i32 0, i32 0), i8* getelementptr ([44 x i8]* @.str438, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 423, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite362 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array440 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite441 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array440 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str442 = internal constant [46 x i8] c"_ZN10polynomialISt7complexIdEE11stretch_fftEv\00", section "llvm.metadata" ; <[46 x i8]*> [#uses=1]
+@llvm.dbg.subprogram443 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str368, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str368, i32 0, i32 0), i8* getelementptr ([46 x i8]* @.str442, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 443, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite441 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str444 = internal constant [49 x i8] c"polynomial<std::complex<std::complex<double> > >\00", section "llvm.metadata" ; <[49 x i8]*> [#uses=1]
+@llvm.dbg.composite445 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([49 x i8]* @.str444, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 84, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array446 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite445 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype387 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite447 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array446 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str448 = internal constant [12 x i8] c"bit_reverse\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@.str449 = internal constant [50 x i8] c"_ZN10polynomialISt7complexIdEE11bit_reverseERKS2_\00", section "llvm.metadata" ; <[50 x i8]*> [#uses=1]
+@llvm.dbg.subprogram450 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([50 x i8]* @.str449, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 469, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite447 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype451 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite445 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype452 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype451 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array453 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite445 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype452 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite454 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array453 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str455 = internal constant [59 x i8] c"_ZN10polynomialISt7complexIdEE11bit_reverseERKS_IS0_IS1_EE\00", section "llvm.metadata" ; <[59 x i8]*> [#uses=1]
+@llvm.dbg.subprogram456 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([59 x i8]* @.str455, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 483, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite454 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str457 = internal constant [4 x i8] c"fft\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str458 = internal constant [41 x i8] c"_ZN10polynomialISt7complexIdEE3fftERKS2_\00", section "llvm.metadata" ; <[41 x i8]*> [#uses=1]
+@llvm.dbg.subprogram459 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str457, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str457, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str458, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 497, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite447 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str460 = internal constant [12 x i8] c"inverse_fft\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@.str461 = internal constant [59 x i8] c"_ZN10polynomialISt7complexIdEE11inverse_fftERKS_IS0_IS1_EE\00", section "llvm.metadata" ; <[59 x i8]*> [#uses=1]
+@llvm.dbg.subprogram462 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str460, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str460, i32 0, i32 0), i8* getelementptr ([59 x i8]* @.str461, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 535, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite454 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str463 = internal constant [10 x i8] c"operator*\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str464 = internal constant [40 x i8] c"_ZNK10polynomialISt7complexIdEEmlERKS2_\00", section "llvm.metadata" ; <[40 x i8]*> [#uses=1]
+@llvm.dbg.subprogram465 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([40 x i8]* @.str464, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 576, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite431 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str466 = internal constant [39 x i8] c"_ZN10polynomialISt7complexIdEEpLERKS2_\00", section "llvm.metadata" ; <[39 x i8]*> [#uses=1]
+@llvm.dbg.subprogram467 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([39 x i8]* @.str466, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 625, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite396 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str468 = internal constant [39 x i8] c"_ZN10polynomialISt7complexIdEEmIERKS2_\00", section "llvm.metadata" ; <[39 x i8]*> [#uses=1]
+@llvm.dbg.subprogram469 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([39 x i8]* @.str468, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 636, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite396 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str470 = internal constant [39 x i8] c"_ZN10polynomialISt7complexIdEEmLERKS2_\00", section "llvm.metadata" ; <[39 x i8]*> [#uses=1]
+@llvm.dbg.subprogram471 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([39 x i8]* @.str470, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 647, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite396 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array472 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite473 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array472 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str474 = internal constant [8 x i8] c"acquire\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str475 = internal constant [41 x i8] c"_ZN10polynomialISt7complexIdEE7acquireEv\00", section "llvm.metadata" ; <[41 x i8]*> [#uses=1]
+@llvm.dbg.subprogram476 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str475, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 181, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite473 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str477 = internal constant [8 x i8] c"release\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str478 = internal constant [41 x i8] c"_ZN10polynomialISt7complexIdEE7releaseEv\00", section "llvm.metadata" ; <[41 x i8]*> [#uses=1]
+@llvm.dbg.subprogram479 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str478, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 188, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite473 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array480 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype376 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype187 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite481 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array480 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str482 = internal constant [10 x i8] c"deep_copy\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str483 = internal constant [47 x i8] c"_ZN10polynomialISt7complexIdEE9deep_copyEPKS1_\00", section "llvm.metadata" ; <[47 x i8]*> [#uses=1]
+@llvm.dbg.subprogram484 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([47 x i8]* @.str483, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 195, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite481 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array485 = internal constant [33 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype373 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype374 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype375 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram379 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram382 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram385 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram390 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram393 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram398 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram402 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram406 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram411 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram415 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram419 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram423 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram427 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram429 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram433 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram435 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram437 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram439 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram443 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram450 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram456 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram459 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram462 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram465 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram467 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram469 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram471 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram476 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram479 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram484 to %0*)], section "llvm.metadata" ; <[33 x %0*]*> [#uses=1]
+@llvm.dbg.composite486 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([34 x i8]* @.str371, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 84, i64 96, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([33 x %0*]* @llvm.dbg.array485 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array487 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype298 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite488 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array487 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str489 = internal constant [38 x i8] c"_ZN10polynomialIdE11bit_reverseERKS0_\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1]
+@llvm.dbg.subprogram490 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str489, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 469, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite488 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array491 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype387 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite492 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array491 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str493 = internal constant [52 x i8] c"_ZN10polynomialIdE11bit_reverseERKS_ISt7complexIdEE\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
+@llvm.dbg.subprogram494 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str493, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 483, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite492 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str495 = internal constant [29 x i8] c"_ZN10polynomialIdE3fftERKS0_\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram496 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str457, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str457, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str495, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 497, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite488 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str497 = internal constant [52 x i8] c"_ZN10polynomialIdE11inverse_fftERKS_ISt7complexIdEE\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
+@llvm.dbg.subprogram498 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str460, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str460, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str497, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 535, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite492 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str499 = internal constant [28 x i8] c"_ZNK10polynomialIdEmlERKS0_\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram500 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str499, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 576, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite351 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str501 = internal constant [27 x i8] c"_ZN10polynomialIdEpLERKS0_\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram502 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str501, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 625, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite308 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str503 = internal constant [27 x i8] c"_ZN10polynomialIdEmIERKS0_\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram504 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str503, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 636, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite308 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str505 = internal constant [27 x i8] c"_ZN10polynomialIdEmLERKS0_\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram506 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str98, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str505, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 647, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite308 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array507 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite508 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array507 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str509 = internal constant [29 x i8] c"_ZN10polynomialIdE7acquireEv\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram510 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str509, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 181, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite508 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str511 = internal constant [29 x i8] c"_ZN10polynomialIdE7releaseEv\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram512 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str511, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 188, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite508 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array513 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype290 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite514 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array513 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str515 = internal constant [33 x i8] c"_ZN10polynomialIdE9deep_copyEPKd\00", section "llvm.metadata" ; <[33 x i8]*> [#uses=1]
+@llvm.dbg.subprogram516 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([33 x i8]* @.str515, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 195, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite514 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array517 = internal constant [33 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype275 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype278 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype284 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram289 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram293 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram296 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram301 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram305 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram310 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram315 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram320 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram326 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram331 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram336 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram341 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram346 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram349 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram353 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram355 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram360 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram365 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram370 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram490 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram494 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram496 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram498 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram500 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram502 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram504 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram506 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram510 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram512 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram516 to %0*)], section "llvm.metadata" ; <[33 x %0*]*> [#uses=1]
+@llvm.dbg.composite518 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str266, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 84, i64 96, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([33 x %0*]* @llvm.dbg.array517 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype519 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array520 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype180 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype519 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite521 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array520 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram522 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str335, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 306, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite521 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram527 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str325, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 111, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite323 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram530 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str418, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 306, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite417 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array534 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype196 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype224 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite535 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array534 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str536 = internal constant [19 x i8] c"operator*=<double>\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@.str537 = internal constant [35 x i8] c"_ZNSt7complexIdEmLIdEERS0_RKS_IT_E\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram538 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str536, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str536, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str537, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1286, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite535 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str541 = internal constant [4 x i8] c"__t\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.variable542 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram538 to %0*), i8* getelementptr ([4 x i8]* @.str541, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1288, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram543 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([33 x i8]* @.str515, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 195, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite514 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram549 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str358, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str358, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str359, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 404, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite357 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array555 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite556 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array555 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str557 = internal constant [18 x i8] c"operator*<double>\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@.str558 = internal constant [32 x i8] c"_ZStmlIdESt7complexIT_ERKS2_S4_\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram559 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str557, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str557, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str558, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 378, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite556 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable564 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram559 to %0*), i8* getelementptr ([4 x i8]* @.str244, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 380, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram565 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str482, i32 0, i32 0), i8* getelementptr ([47 x i8]* @.str483, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 195, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite481 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram569 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str324, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str410, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 111, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite409 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array572 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype31 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite573 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array572 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str574 = internal constant [18 x i8] c"operator-<double>\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@.str575 = internal constant [29 x i8] c"_ZStngIdESt7complexIT_ERKS2_\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram576 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str574, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str574, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str575, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 443, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite573 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram578 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str330, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 300, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite328 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram581 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str363, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str363, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str364, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 423, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite362 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str591 = internal constant [19 x i8] c"operator/=<double>\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@.str592 = internal constant [35 x i8] c"_ZNSt7complexIdEdVIdEERS0_RKS_IT_E\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram593 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str591, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str591, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str592, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1297, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite535 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable596 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram593 to %0*), i8* getelementptr ([4 x i8]* @.str541, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1299, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str597 = internal constant [18 x i8] c"operator/<double>\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@.str598 = internal constant [32 x i8] c"_ZStdvIdESt7complexIT_ERKS2_S4_\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram599 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str597, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str597, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str598, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 408, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite556 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable602 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram599 to %0*), i8* getelementptr ([4 x i8]* @.str244, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 410, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str603 = internal constant [19 x i8] c"operator+=<double>\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@.str604 = internal constant [35 x i8] c"_ZNSt7complexIdEpLIdEERS0_RKS_IT_E\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram605 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str603, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str603, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str604, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1268, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite535 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str608 = internal constant [18 x i8] c"operator+<double>\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@.str609 = internal constant [32 x i8] c"_ZStplIdESt7complexIT_ERKS2_S4_\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram610 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str608, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str608, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str609, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 318, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite556 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable613 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram610 to %0*), i8* getelementptr ([4 x i8]* @.str244, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 320, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str614 = internal constant [19 x i8] c"operator-=<double>\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@.str615 = internal constant [35 x i8] c"_ZNSt7complexIdEmIIdEERS0_RKS_IT_E\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram616 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str614, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str614, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str615, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 1277, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite535 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str619 = internal constant [32 x i8] c"_ZStmiIdESt7complexIT_ERKS2_S4_\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram620 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str574, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str574, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str619, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 348, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite556 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable623 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram620 to %0*), i8* getelementptr ([4 x i8]* @.str244, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 350, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram624 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str329, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str414, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 300, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite413 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array627 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite628 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array627 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str629 = internal constant [42 x i8] c"__static_initialization_and_destruction_0\00", section "llvm.metadata" ; <[42 x i8]*> [#uses=1]
+@llvm.dbg.subprogram630 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([42 x i8]* @.str629, i32 0, i32 0), i8* getelementptr ([42 x i8]* @.str629, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 703, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite628 to %0*), i1 true, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=0]
+@.str635 = internal constant [9 x i8] c"iostream\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit636 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @.str635, i32 0, i32 0), i8* getelementptr ([110 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@_ZStL8__ioinit = internal global %"struct.std::allocator<char>" zeroinitializer ; <%"struct.std::allocator<char>"*> [#uses=2]
+@.str638 = internal constant [115 x i8] c"/developer/home2/zsth/projects/llvm.org/install/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits\00", section "llvm.metadata" ; <[115 x i8]*> [#uses=1]
+@__dso_handle = external global i8* ; <i8**> [#uses=1]
+@_ZGVN10polynomialIdE4PI2IE = weak global i64 0, align 8 ; <i64*> [#uses=1]
+@_ZN10polynomialIdE4PI2IE = weak global %"struct.std::complex<double>" zeroinitializer ; <%"struct.std::complex<double>"*> [#uses=3]
+@llvm.dbg.array654 = internal constant [1 x %0*] zeroinitializer, section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+@llvm.dbg.composite655 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array654 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str656 = internal constant [16 x i8] c"_GLOBAL__I_main\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram657 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str656, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str656, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 704, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite655 to %0*), i1 true, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype658 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* null }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array659 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype658 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite660 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array659 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str661 = internal constant [8 x i8] c"__tcf_0\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.subprogram662 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str661, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str661, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit636 to %0*), i32 77, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite660 to %0*), i1 true, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram665 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str511, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 188, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite508 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str667 = internal constant [23 x i8] c"_ZN10polynomialIdED0Ev\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1]
+@llvm.dbg.subprogram668 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str667, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 252, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite508 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@_ZTV10polynomialIdE = weak constant [4 x i32 (...)*] [i32 (...)* null, i32 (...)* bitcast (%struct.__class_type_info_pseudo* @_ZTI10polynomialIdE to i32 (...)*), i32 (...)* bitcast (void (%"struct.polynomial<double>"*)* @_ZN10polynomialIdED1Ev to i32 (...)*), i32 (...)* bitcast (void (%"struct.polynomial<double>"*)* @_ZN10polynomialIdED0Ev to i32 (...)*)], align 8 ; <[4 x i32 (...)*]*> [#uses=1]
+@_ZTI10polynomialIdE = weak constant %struct.__class_type_info_pseudo { %struct.__type_info_pseudo { i8* inttoptr (i32 add (i32 ptrtoint ([0 x i32 (...)*]* @_ZTVN10__cxxabiv117__class_type_infoE to i32), i32 8) to i8*), i8* getelementptr ([16 x i8]* @_ZTS10polynomialIdE, i32 0, i32 0) } } ; <%struct.__class_type_info_pseudo*> [#uses=1]
+@_ZTVN10__cxxabiv117__class_type_infoE = external constant [0 x i32 (...)*] ; <[0 x i32 (...)*]*> [#uses=1]
+@_ZTS10polynomialIdE = weak constant [16 x i8] c"10polynomialIdE\00" ; <[16 x i8]*> [#uses=1]
+@.str671 = internal constant [5 x i8] c"char\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.basictype672 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str671, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, i32 6 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@.str676 = internal constant [11 x i8] c"<built-in>\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit677 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @.str676, i32 0, i32 0), i8* getelementptr ([42 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@llvm.dbg.array680 = internal constant [0 x %0*] zeroinitializer, section "llvm.metadata" ; <[0 x %0*]*> [#uses=1]
+@.str690 = internal constant [23 x i8] c"_ZN10polynomialIdED1Ev\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1]
+@llvm.dbg.subprogram691 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str690, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 252, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite508 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram693 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str477, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str478, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 188, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite473 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str695 = internal constant [35 x i8] c"_ZN10polynomialISt7complexIdEED0Ev\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram696 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str695, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 252, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite473 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@_ZTV10polynomialISt7complexIdEE = weak constant [4 x i32 (...)*] [i32 (...)* null, i32 (...)* bitcast (%struct.__class_type_info_pseudo* @_ZTI10polynomialISt7complexIdEE to i32 (...)*), i32 (...)* bitcast (void (%"struct.polynomial<std::complex<double> >"*)* @_ZN10polynomialISt7complexIdEED1Ev to i32 (...)*), i32 (...)* bitcast (void (%"struct.polynomial<std::complex<double> >"*)* @_ZN10polynomialISt7complexIdEED0Ev to i32 (...)*)], align 8 ; <[4 x i32 (...)*]*> [#uses=1]
+@_ZTI10polynomialISt7complexIdEE = weak constant %struct.__class_type_info_pseudo { %struct.__type_info_pseudo { i8* inttoptr (i32 add (i32 ptrtoint ([0 x i32 (...)*]* @_ZTVN10__cxxabiv117__class_type_infoE to i32), i32 8) to i8*), i8* getelementptr ([28 x i8]* @_ZTS10polynomialISt7complexIdEE, i32 0, i32 0) } } ; <%struct.__class_type_info_pseudo*> [#uses=1]
+@_ZTS10polynomialISt7complexIdEE = weak constant [28 x i8] c"10polynomialISt7complexIdEE\00" ; <[28 x i8]*> [#uses=1]
+@.str707 = internal constant [35 x i8] c"_ZN10polynomialISt7complexIdEED1Ev\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram708 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str304, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str707, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 252, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite473 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram710 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str509, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 181, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite508 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str712 = internal constant [23 x i8] c"_ZN10polynomialIdEC1Ej\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1]
+@llvm.dbg.subprogram713 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str712, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 211, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite287 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str716 = internal constant [27 x i8] c"_ZN10polynomialIdEC1ERKS0_\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram717 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str716, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 242, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite300 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram720 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str318, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str318, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str319, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 276, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite317 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram729 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str309, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 259, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite308 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram732 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str474, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str475, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 181, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite473 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str734 = internal constant [35 x i8] c"_ZN10polynomialISt7complexIdEEC1Ej\00", section "llvm.metadata" ; <[35 x i8]*> [#uses=1]
+@llvm.dbg.subprogram735 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str288, i32 0, i32 0), i8* getelementptr ([35 x i8]* @.str734, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 211, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite378 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram738 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str489, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 469, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite488 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable744 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram738 to %0*), i8* getelementptr ([7 x i8]* @.str259, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 473, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram747 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str448, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str493, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 483, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite492 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable751 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram747 to %0*), i8* getelementptr ([7 x i8]* @.str259, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 487, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram753 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([39 x i8]* @.str397, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 259, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite396 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram756 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str368, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str368, i32 0, i32 0), i8* getelementptr ([34 x i8]* @.str369, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 443, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite367 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str759 = internal constant [35 x i8] c"overflow in fft polynomial stretch\00" ; <[35 x i8]*> [#uses=1]
+@_ZTISt14overflow_error = weak constant %struct.__si_class_type_info_pseudo { %struct.__type_info_pseudo { i8* inttoptr (i32 add (i32 ptrtoint ([0 x i32 (...)*]* @_ZTVN10__cxxabiv120__si_class_type_infoE to i32), i32 8) to i8*), i8* getelementptr ([19 x i8]* @_ZTSSt14overflow_error, i32 0, i32 0) }, %"struct.std::type_info"* bitcast (%struct.__si_class_type_info_pseudo* @_ZTISt13runtime_error to %"struct.std::type_info"*) } ; <%struct.__si_class_type_info_pseudo*> [#uses=2]
+@_ZTVN10__cxxabiv120__si_class_type_infoE = external constant [0 x i32 (...)*] ; <[0 x i32 (...)*]*> [#uses=1]
+@_ZTSSt14overflow_error = weak constant [19 x i8] c"St14overflow_error\00" ; <[19 x i8]*> [#uses=1]
+@_ZTISt13runtime_error = external constant %struct.__si_class_type_info_pseudo ; <%struct.__si_class_type_info_pseudo*> [#uses=1]
+@.str769 = internal constant [10 x i8] c"stdexcept\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit770 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([10 x i8]* @.str769, i32 0, i32 0), i8* getelementptr ([110 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str773 = internal constant [15 x i8] c"overflow_error\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@.str775 = internal constant [14 x i8] c"runtime_error\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@.str777 = internal constant [10 x i8] c"exception\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit778 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([10 x i8]* @.str777, i32 0, i32 0), i8* getelementptr ([110 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str780 = internal constant [16 x i8] c"_vptr.exception\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype781 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str780, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit778 to %0*), i32 57, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype273 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype782 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite800 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array783 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype782 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite784 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array783 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram785 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str777, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str777, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit778 to %0*), i32 59, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite784 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array786 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype782 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite787 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array786 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str788 = internal constant [11 x i8] c"~exception\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.subprogram789 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str788, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str788, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit778 to %0*), i32 60, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite787 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype790 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype791 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype790 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype792 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite800 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype793 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype792 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array794 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype793 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite795 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array794 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str796 = internal constant [5 x i8] c"what\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str797 = internal constant [24 x i8] c"_ZNKSt9exception4whatEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram798 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str796, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str796, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str797, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit778 to %0*), i32 63, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite795 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array799 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype781 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram785 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram789 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram798 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite800 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str777, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit778 to %0*), i32 57, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array799 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype801 = internal constant %llvm.dbg.derivedtype.type { i32 458780, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite800 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str802 = internal constant [12 x i8] c"stringfwd.h\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit803 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([12 x i8]* @.str802, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str804 = internal constant [64 x i8] c"basic_string<char,std::char_traits<char>,std::allocator<char> >\00", section "llvm.metadata" ; <[64 x i8]*> [#uses=1]
+@.str806 = internal constant [15 x i8] c"basic_string.h\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit807 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([15 x i8]* @.str806, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str808 = internal constant [13 x i8] c"_Alloc_hider\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str810 = internal constant [16 x i8] c"allocator<char>\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str812 = internal constant [16 x i8] c"new_allocator.h\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str813 = internal constant [114 x i8] c"/developer/home2/zsth/projects/llvm.org/install/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/ext\00", section "llvm.metadata" ; <[114 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit814 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([16 x i8]* @.str812, i32 0, i32 0), i8* getelementptr ([114 x i8]* @.str813, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str815 = internal constant [20 x i8] c"new_allocator<char>\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype817 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite877 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array818 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite819 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array818 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str820 = internal constant [14 x i8] c"new_allocator\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram821 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str820, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str820, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 68, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite819 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype822 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite877 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype823 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype822 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array824 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype823 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite825 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array824 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram826 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str820, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str820, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 70, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite825 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite827 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 54, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype828 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite827 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype829 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype828 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array830 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype829 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite831 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array830 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram832 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str820, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str820, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 73, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite831 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array833 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite834 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array833 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str835 = internal constant [15 x i8] c"~new_allocator\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram836 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str835, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str835, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 75, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite834 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype837 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype838 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype822 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype839 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array840 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype838 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype839 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite841 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array840 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str842 = internal constant [8 x i8] c"address\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str843 = internal constant [44 x i8] c"_ZNK9__gnu_cxx13new_allocatorIcE7addressERc\00", section "llvm.metadata" ; <[44 x i8]*> [#uses=1]
+@llvm.dbg.subprogram844 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str842, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str842, i32 0, i32 0), i8* getelementptr ([44 x i8]* @.str843, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 78, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite841 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype845 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype790 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array846 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype838 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype845 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite847 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array846 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str848 = internal constant [45 x i8] c"_ZNK9__gnu_cxx13new_allocatorIcE7addressERKc\00", section "llvm.metadata" ; <[45 x i8]*> [#uses=1]
+@llvm.dbg.subprogram849 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str842, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str842, i32 0, i32 0), i8* getelementptr ([45 x i8]* @.str848, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 81, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite847 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype850 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* null }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array851 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype850 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite852 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array851 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str853 = internal constant [9 x i8] c"allocate\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str854 = internal constant [46 x i8] c"_ZN9__gnu_cxx13new_allocatorIcE8allocateEjPKv\00", section "llvm.metadata" ; <[46 x i8]*> [#uses=1]
+@llvm.dbg.subprogram855 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str853, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str853, i32 0, i32 0), i8* getelementptr ([46 x i8]* @.str854, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 86, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite852 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array856 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite857 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array856 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str858 = internal constant [11 x i8] c"deallocate\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str859 = internal constant [48 x i8] c"_ZN9__gnu_cxx13new_allocatorIcE10deallocateEPcj\00", section "llvm.metadata" ; <[48 x i8]*> [#uses=1]
+@llvm.dbg.subprogram860 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str858, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str858, i32 0, i32 0), i8* getelementptr ([48 x i8]* @.str859, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 96, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite857 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array861 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype838 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite862 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array861 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str863 = internal constant [9 x i8] c"max_size\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str864 = internal constant [44 x i8] c"_ZNK9__gnu_cxx13new_allocatorIcE8max_sizeEv\00", section "llvm.metadata" ; <[44 x i8]*> [#uses=1]
+@llvm.dbg.subprogram865 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str863, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str863, i32 0, i32 0), i8* getelementptr ([44 x i8]* @.str864, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 100, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite862 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array866 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype845 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite867 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array866 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str868 = internal constant [10 x i8] c"construct\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str869 = internal constant [48 x i8] c"_ZN9__gnu_cxx13new_allocatorIcE9constructEPcRKc\00", section "llvm.metadata" ; <[48 x i8]*> [#uses=1]
+@llvm.dbg.subprogram870 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str868, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str868, i32 0, i32 0), i8* getelementptr ([48 x i8]* @.str869, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 106, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite867 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array871 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype817 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite872 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array871 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str873 = internal constant [8 x i8] c"destroy\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str874 = internal constant [43 x i8] c"_ZN9__gnu_cxx13new_allocatorIcE7destroyEPc\00", section "llvm.metadata" ; <[43 x i8]*> [#uses=1]
+@llvm.dbg.subprogram875 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str873, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str873, i32 0, i32 0), i8* getelementptr ([43 x i8]* @.str874, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 110, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite872 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array876 = internal constant [11 x %0*] [%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram821 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram826 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram832 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram836 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram844 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram849 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram855 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram860 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram865 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram870 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram875 to %0*)], section "llvm.metadata" ; <[11 x %0*]*> [#uses=1]
+@llvm.dbg.composite877 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([20 x i8]* @.str815, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit814 to %0*), i32 54, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([11 x %0*]* @llvm.dbg.array876 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype878 = internal constant %llvm.dbg.derivedtype.type { i32 458780, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite877 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype879 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite902 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array880 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype879 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite881 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array880 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str882 = internal constant [12 x i8] c"allocator.h\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit883 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([12 x i8]* @.str882, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str884 = internal constant [10 x i8] c"allocator\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.subprogram885 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str884, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str884, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit883 to %0*), i32 100, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite881 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype886 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite902 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype887 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype886 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array888 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype879 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite889 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array888 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram890 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str884, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str884, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit883 to %0*), i32 102, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite889 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite891 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 49, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype892 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite891 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype893 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype892 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array894 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype879 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype893 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite895 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array894 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram896 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str884, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str884, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit883 to %0*), i32 106, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite895 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array897 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype879 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite898 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array897 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str899 = internal constant [11 x i8] c"~allocator\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.subprogram900 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str899, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str899, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit883 to %0*), i32 108, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite898 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array901 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype878 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram885 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram890 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram896 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram900 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite902 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str810, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 49, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array901 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype903 = internal constant %llvm.dbg.derivedtype.type { i32 458780, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite902 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str904 = internal constant [5 x i8] c"_M_p\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype905 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str904, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 264, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype906 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite911 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array907 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype906 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite908 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array907 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram909 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str808, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str808, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 261, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite908 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array910 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype903 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype905 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram909 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite911 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str808, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 260, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array910 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str912 = internal constant [12 x i8] c"_M_dataplus\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype913 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str912, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 276, i64 32, i64 32, i64 0, i32 1, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite911 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str914 = internal constant [7 x i8] c"string\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype915 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str914, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 56, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1693 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype916 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype915 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype917 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype916 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array918 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite919 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array918 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str920 = internal constant [8 x i8] c"_M_data\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str921 = internal constant [17 x i8] c"_ZNKSs7_M_dataEv\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram922 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str920, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str920, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str921, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 279, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite919 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype923 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1693 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array924 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite925 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array924 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str926 = internal constant [17 x i8] c"_ZNSs7_M_dataEPc\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram927 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str920, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str920, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str926, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 283, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite925 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str928 = internal constant [5 x i8] c"_Rep\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str930 = internal constant [10 x i8] c"_Rep_base\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str932 = internal constant [10 x i8] c"_M_length\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype933 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str932, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 149, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str934 = internal constant [12 x i8] c"_M_capacity\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype935 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str934, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 150, i64 32, i64 32, i64 32, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str936 = internal constant [10 x i8] c"ptrdiff_t\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype937 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str936, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit677 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype938 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype937 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str939 = internal constant [8 x i8] c"types.h\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit940 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([8 x i8]* @.str939, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str69, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str941 = internal constant [10 x i8] c"__int32_t\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype942 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str941, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 43, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype938 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str943 = internal constant [8 x i8] c"__pid_t\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype944 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str943, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 145, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype942 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str945 = internal constant [10 x i8] c"__daddr_t\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype946 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str945, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 154, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype944 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str947 = internal constant [8 x i8] c"__key_t\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype948 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str947, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 157, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype946 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str949 = internal constant [12 x i8] c"__clockid_t\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype950 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str949, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 158, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype948 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str951 = internal constant [10 x i8] c"__ssize_t\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype952 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str951, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 181, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype950 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str953 = internal constant [11 x i8] c"__intptr_t\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype954 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str953, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 189, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype952 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str955 = internal constant [12 x i8] c"_G_config.h\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@.str956 = internal constant [13 x i8] c"/usr/include\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit957 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([12 x i8]* @.str955, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str958 = internal constant [11 x i8] c"_G_int32_t\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype959 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str958, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit957 to %0*), i32 55, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype954 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str960 = internal constant [11 x i8] c"nl_types.h\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit961 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @.str960, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str962 = internal constant [8 x i8] c"nl_item\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype963 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str962, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit961 to %0*), i32 34, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype959 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str964 = internal constant [7 x i8] c"time.h\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit965 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([7 x i8]* @.str964, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str966 = internal constant [10 x i8] c"clockid_t\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype967 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str966, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit965 to %0*), i32 77, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype963 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str968 = internal constant [6 x i8] c"pid_t\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype969 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str968, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit965 to %0*), i32 105, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype967 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str970 = internal constant [15 x i8] c"__sig_atomic_t\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype971 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str970, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit965 to %0*), i32 413, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype969 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str972 = internal constant [15 x i8] c"pthreadtypes.h\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit973 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([15 x i8]* @.str972, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str69, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str974 = internal constant [15 x i8] c"pthread_once_t\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype975 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str974, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit973 to %0*), i32 109, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype971 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype976 = internal constant %llvm.dbg.derivedtype.type { i32 458805, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype975 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str977 = internal constant [19 x i8] c"pthread_spinlock_t\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype978 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str977, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit973 to %0*), i32 142, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype976 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str979 = internal constant [10 x i8] c"pthread.h\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit980 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([10 x i8]* @.str979, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str981 = internal constant [8 x i8] c"ssize_t\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype982 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str981, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit980 to %0*), i32 1101, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype978 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str983 = internal constant [9 x i8] c"unistd.h\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit984 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @.str983, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str985 = internal constant [9 x i8] c"intptr_t\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype986 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str985, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit984 to %0*), i32 226, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype982 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str987 = internal constant [15 x i8] c"gthr-default.h\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@.str988 = internal constant [133 x i8] c"/developer/home2/zsth/projects/llvm.org/install/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/i686-pc-linux-gnu/bits\00", section "llvm.metadata" ; <[133 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit989 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([15 x i8]* @.str987, i32 0, i32 0), i8* getelementptr ([133 x i8]* @.str988, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str990 = internal constant [17 x i8] c"__gthread_once_t\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype991 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str990, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit989 to %0*), i32 46, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype986 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype992 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str941, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 43, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype991 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str993 = internal constant [9 x i8] c"stdint.h\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit994 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @.str993, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str995 = internal constant [8 x i8] c"int32_t\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype996 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str995, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit994 to %0*), i32 38, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype992 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str997 = internal constant [14 x i8] c"int_least32_t\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype998 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str997, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit994 to %0*), i32 67, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype996 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str999 = internal constant [13 x i8] c"int_fast16_t\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1000 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str999, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit994 to %0*), i32 91, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype998 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1001 = internal constant [13 x i8] c"int_fast32_t\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1002 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1001, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit994 to %0*), i32 97, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1000 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1003 = internal constant [11 x i8] c"postypes.h\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1004 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([11 x i8]* @.str1003, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1005 = internal constant [11 x i8] c"streamsize\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1006 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1005, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1004 to %0*), i32 72, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1002 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1007 = internal constant [17 x i8] c"/usr/include/sys\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1008 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([8 x i8]* @.str939, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1007, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1009 = internal constant [8 x i8] c"daddr_t\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1010 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1009, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1008 to %0*), i32 105, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1006 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1011 = internal constant [6 x i8] c"key_t\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1012 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1011, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1008 to %0*), i32 117, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1010 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1013 = internal constant [11 x i8] c"register_t\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1014 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1013, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1008 to %0*), i32 204, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1012 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1015 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str936, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit677 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1014 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1016 = internal constant [9 x i8] c"stdlib.h\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1017 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([9 x i8]* @.str1016, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1018 = internal constant [13 x i8] c"_Atomic_word\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1019 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1018, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1017 to %0*), i32 962, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1015 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1020 = internal constant [12 x i8] c"_M_refcount\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1021 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str1020, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 151, i64 32, i64 32, i64 64, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1019 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1022 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype933 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype935 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1021 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1023 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str930, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 148, i64 96, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1022 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype1024 = internal constant %llvm.dbg.derivedtype.type { i32 458780, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1023 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1025 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1091 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1026 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1025 to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+@llvm.dbg.composite1027 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array1026 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1028 = internal constant [13 x i8] c"_S_empty_rep\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str1029 = internal constant [27 x i8] c"_ZNSs4_Rep12_S_empty_repEv\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1030 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1028, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1028, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1029, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 180, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1027 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1031 = internal constant [5 x i8] c"bool\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.basictype1032 = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1031, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 8, i64 8, i64 0, i32 0, i32 2 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.derivedtype1033 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 96, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1091 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1034 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1033 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1035 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype1032 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1034 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1036 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1035 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1037 = internal constant [13 x i8] c"_M_is_leaked\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str1038 = internal constant [28 x i8] c"_ZNKSs4_Rep12_M_is_leakedEv\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1039 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1037, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1037, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1038, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 190, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1036 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1040 = internal constant [13 x i8] c"_M_is_shared\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str1041 = internal constant [28 x i8] c"_ZNKSs4_Rep12_M_is_sharedEv\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1042 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1040, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1040, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1041, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 194, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1036 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1043 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1091 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1044 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1045 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1044 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1046 = internal constant [14 x i8] c"_M_set_leaked\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@.str1047 = internal constant [28 x i8] c"_ZNSs4_Rep13_M_set_leakedEv\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1048 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1046, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1046, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1047, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 198, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1045 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1049 = internal constant [16 x i8] c"_M_set_sharable\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str1050 = internal constant [30 x i8] c"_ZNSs4_Rep15_M_set_sharableEv\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1051 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str1049, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1049, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1050, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 202, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1045 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1052 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1053 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1052 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1054 = internal constant [27 x i8] c"_M_set_length_and_sharable\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@.str1055 = internal constant [41 x i8] c"_ZNSs4_Rep26_M_set_length_and_sharableEj\00", section "llvm.metadata" ; <[41 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1056 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([27 x i8]* @.str1054, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1054, i32 0, i32 0), i8* getelementptr ([41 x i8]* @.str1055, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 206, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1053 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1057 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1058 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1057 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1059 = internal constant [11 x i8] c"_M_refdata\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1060 = internal constant [25 x i8] c"_ZNSs4_Rep10_M_refdataEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1061 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1059, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1059, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str1060, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 216, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1058 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1062 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1063 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1062 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1064 = internal constant [8 x i8] c"_M_grab\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1065 = internal constant [30 x i8] c"_ZNSs4_Rep7_M_grabERKSaIcES2_\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1066 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1064, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1064, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1065, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 220, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1063 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1067 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1068 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1067 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1069 = internal constant [17 x i8] c"basic_string.tcc\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1070 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([17 x i8]* @.str1069, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1071 = internal constant [10 x i8] c"_S_create\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str1072 = internal constant [31 x i8] c"_ZNSs4_Rep9_S_createEjjRKSaIcE\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1073 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str1071, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1071, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1072, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 529, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1068 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1074 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1075 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1074 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1076 = internal constant [11 x i8] c"_M_dispose\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1077 = internal constant [31 x i8] c"_ZNSs4_Rep10_M_disposeERKSaIcE\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1078 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1076, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1076, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1077, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 231, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1075 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1079 = internal constant [11 x i8] c"_M_destroy\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1080 = internal constant [31 x i8] c"_ZNSs4_Rep10_M_destroyERKSaIcE\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1081 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1079, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1079, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1080, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 427, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1075 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1082 = internal constant [11 x i8] c"_M_refcopy\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1083 = internal constant [25 x i8] c"_ZNSs4_Rep10_M_refcopyEv\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1084 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1082, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1082, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str1083, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 245, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1058 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1085 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1043 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1086 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1085 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1087 = internal constant [9 x i8] c"_M_clone\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str1088 = internal constant [29 x i8] c"_ZNSs4_Rep8_M_cloneERKSaIcEj\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1089 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str1087, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str1087, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str1088, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 606, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1086 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1090 = internal constant [14 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1024 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1030 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1039 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1042 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1048 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1051 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1056 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1061 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1066 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1073 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1078 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1081 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1084 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1089 to %0*)], section "llvm.metadata" ; <[14 x %0*]*> [#uses=1]
+@llvm.dbg.composite1091 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str928, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 155, i64 96, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([14 x %0*]* @llvm.dbg.array1090 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype1092 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1091 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1093 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1092 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1094 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1093 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1095 = internal constant [16 x i8] c"_ZNKSs6_M_repEv\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1096 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str1087, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str1087, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1095, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 287, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1094 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1097 = internal constant [15 x i8] c"stl_iterator.h\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1098 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([15 x i8]* @.str1097, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1099 = internal constant [97 x i8] c"__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >\00", section "llvm.metadata" ; <[97 x i8]*> [#uses=1]
+@.str1101 = internal constant [11 x i8] c"_M_current\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1102 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1101, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 639, i64 32, i64 32, i64 0, i32 2, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1103 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1104 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1103 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1105 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1104 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1106 = internal constant [18 x i8] c"__normal_iterator\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1107 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1106, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1106, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 650, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1105 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1108 = internal constant [10 x i8] c"__caddr_t\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1109 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str1108, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit940 to %0*), i32 188, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1110 = internal constant [15 x i8] c"__gnuc_va_list\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1111 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str1110, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit957 to %0*), i32 58, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1109 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1112 = internal constant [8 x i8] c"libio.h\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1113 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([8 x i8]* @.str1112, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str956, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1114 = internal constant [8 x i8] c"va_list\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1115 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1114, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1113 to %0*), i32 491, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1111 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1116 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1115 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1117 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1116 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1118 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1103 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1117 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1119 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1118 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1120 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1106, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1106, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 653, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1119 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite1121 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 637, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype1122 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 8, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1121 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1123 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1122 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1124 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1103 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1123 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1125 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1124 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1126 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1106, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1106, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 660, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1125 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1127 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1128 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1127 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1129 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype839 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1128 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1130 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1129 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1131 = internal constant [44 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPcSsEdeEv\00", section "llvm.metadata" ; <[44 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1132 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([44 x i8]* @.str1131, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 665, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1130 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1133 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1128 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1134 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1133 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1135 = internal constant [11 x i8] c"operator->\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1136 = internal constant [44 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPcSsEptEv\00", section "llvm.metadata" ; <[44 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1137 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1135, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1135, i32 0, i32 0), i8* getelementptr ([44 x i8]* @.str1136, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 669, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1134 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1138 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1139 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1138 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1103 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1140 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1139 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1141 = internal constant [11 x i8] c"operator++\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1142 = internal constant [43 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPcSsEppEv\00", section "llvm.metadata" ; <[43 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1143 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1141, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1141, i32 0, i32 0), i8* getelementptr ([43 x i8]* @.str1142, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 673, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1140 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1144 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1103 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1145 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1144 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1146 = internal constant [43 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPcSsEppEi\00", section "llvm.metadata" ; <[43 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1147 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1141, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1141, i32 0, i32 0), i8* getelementptr ([43 x i8]* @.str1146, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 680, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1145 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1148 = internal constant [11 x i8] c"operator--\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str1149 = internal constant [43 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPcSsEmmEv\00", section "llvm.metadata" ; <[43 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1150 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1148, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1148, i32 0, i32 0), i8* getelementptr ([43 x i8]* @.str1149, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 685, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1140 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1151 = internal constant [43 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPcSsEmmEi\00", section "llvm.metadata" ; <[43 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1152 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str1148, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1148, i32 0, i32 0), i8* getelementptr ([43 x i8]* @.str1151, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 692, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1145 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1153 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1015 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1154 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype839 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1128 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1153 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1155 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1154 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1156 = internal constant [46 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPcSsEixERKi\00", section "llvm.metadata" ; <[46 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1157 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([46 x i8]* @.str1156, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 697, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1155 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1158 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1138 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1103 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1153 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1159 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1158 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1160 = internal constant [45 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPcSsEpLERKi\00", section "llvm.metadata" ; <[45 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1161 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([45 x i8]* @.str1160, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 701, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1159 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1162 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1128 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1153 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1163 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1162 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1164 = internal constant [46 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPcSsEplERKi\00", section "llvm.metadata" ; <[46 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1165 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str347, i32 0, i32 0), i8* getelementptr ([46 x i8]* @.str1164, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 705, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1163 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1166 = internal constant [45 x i8] c"_ZN9__gnu_cxx17__normal_iteratorIPcSsEmIERKi\00", section "llvm.metadata" ; <[45 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1167 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str95, i32 0, i32 0), i8* getelementptr ([45 x i8]* @.str1166, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 709, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1159 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1168 = internal constant [46 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPcSsEmiERKi\00", section "llvm.metadata" ; <[46 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1169 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str344, i32 0, i32 0), i8* getelementptr ([46 x i8]* @.str1168, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 713, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1163 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1170 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1117 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1128 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1171 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1170 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1172 = internal constant [5 x i8] c"base\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1173 = internal constant [47 x i8] c"_ZNK9__gnu_cxx17__normal_iteratorIPcSsE4baseEv\00", section "llvm.metadata" ; <[47 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1174 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1172, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1172, i32 0, i32 0), i8* getelementptr ([47 x i8]* @.str1173, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 717, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1171 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1175 = internal constant [16 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1102 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1107 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1120 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1126 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1132 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1137 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1143 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1147 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1150 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1152 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1157 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1161 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1165 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1167 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1169 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1174 to %0*)], section "llvm.metadata" ; <[16 x %0*]*> [#uses=1]
+@llvm.dbg.composite1176 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([97 x i8]* @.str1099, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 637, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([16 x %0*]* @llvm.dbg.array1175 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1177 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1178 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1177 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1179 = internal constant [19 x i8] c"_ZNKSs9_M_ibeginEv\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1180 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1172, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1172, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1179, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 293, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1178 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1181 = internal constant [8 x i8] c"_M_iend\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1182 = internal constant [17 x i8] c"_ZNKSs7_M_iendEv\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1183 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1181, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1181, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1182, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 297, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1178 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1184 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1185 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1184 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1186 = internal constant [8 x i8] c"_M_leak\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1187 = internal constant [16 x i8] c"_ZNSs7_M_leakEv\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1188 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1186, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1186, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1187, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 301, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1185 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1189 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1190 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1189 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1191 = internal constant [9 x i8] c"_M_check\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str1192 = internal constant [21 x i8] c"_ZNKSs8_M_checkEjPKc\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1193 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str1191, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str1191, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1192, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 308, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1190 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1194 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1195 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1194 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1196 = internal constant [16 x i8] c"_M_check_length\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str1197 = internal constant [30 x i8] c"_ZNKSs15_M_check_lengthEjjPKc\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1198 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str1196, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1196, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1197, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 316, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1195 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1199 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1200 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1199 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1201 = internal constant [9 x i8] c"_M_limit\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str1202 = internal constant [19 x i8] c"_ZNKSs8_M_limitEjj\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1203 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str1201, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str1201, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1202, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 324, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1200 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1204 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype1032 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1205 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1204 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1206 = internal constant [12 x i8] c"_M_disjunct\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@.str1207 = internal constant [24 x i8] c"_ZNKSs11_M_disjunctEPKc\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1208 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str1206, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str1206, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str1207, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 332, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1205 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1209 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1210 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1209 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1211 = internal constant [8 x i8] c"_M_copy\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1212 = internal constant [21 x i8] c"_ZNSs7_M_copyEPcPKcj\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1213 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1211, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1211, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1212, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 341, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1214 = internal constant [8 x i8] c"_M_move\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1215 = internal constant [21 x i8] c"_ZNSs7_M_moveEPcPKcj\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1216 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1214, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1214, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1215, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 350, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1210 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1217 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1218 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1217 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1219 = internal constant [10 x i8] c"_M_assign\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str1220 = internal constant [21 x i8] c"_ZNSs9_M_assignEPcjc\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1221 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str1219, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1219, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1220, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 359, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1218 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1222 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* null, %0* null], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1223 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1222 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1224 = internal constant [14 x i8] c"_S_copy_chars\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1225 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 371, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1223 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1226 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1227 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1226 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1228 = internal constant [64 x i8] c"_ZNSs13_S_copy_charsEPcN9__gnu_cxx17__normal_iteratorIS_SsEES2_\00", section "llvm.metadata" ; <[64 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1229 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([64 x i8]* @.str1228, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 378, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1227 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1230 = internal constant [103 x i8] c"__normal_iterator<const char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >\00", section "llvm.metadata" ; <[103 x i8]*> [#uses=1]
+@llvm.dbg.composite1231 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([103 x i8]* @.str1230, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 637, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1232 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1231 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1231 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1233 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1232 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1234 = internal constant [65 x i8] c"_ZNSs13_S_copy_charsEPcN9__gnu_cxx17__normal_iteratorIPKcSsEES4_\00", section "llvm.metadata" ; <[65 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1235 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([65 x i8]* @.str1234, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 382, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1233 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1236 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1237 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1236 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1238 = internal constant [28 x i8] c"_ZNSs13_S_copy_charsEPcS_S_\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1239 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1238, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 386, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1237 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1240 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1241 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1240 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1242 = internal constant [30 x i8] c"_ZNSs13_S_copy_charsEPcPKcS1_\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1243 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1224, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1242, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 390, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1241 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1244 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1245 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1244 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1246 = internal constant [10 x i8] c"_M_mutate\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str1247 = internal constant [20 x i8] c"_ZNSs9_M_mutateEjjj\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1248 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str1246, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1246, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1247, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 451, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1245 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1249 = internal constant [13 x i8] c"_M_leak_hard\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str1250 = internal constant [22 x i8] c"_ZNSs12_M_leak_hardEv\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1251 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1249, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1249, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str1250, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 437, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1185 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1252 = internal constant [22 x i8] c"_ZNSs12_S_empty_repEv\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1253 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1028, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1028, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str1252, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 400, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1027 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1254 = internal constant [13 x i8] c"basic_string\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1255 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 2055, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1185 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1256 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1257 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1256 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1258 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 191, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1257 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1259 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype916 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1260 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1261 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1260 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1262 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 183, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1261 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1263 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1264 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1263 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1265 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 197, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1264 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1266 = internal constant [6 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1267 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1266 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1268 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 208, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1267 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1269 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1270 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1269 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1271 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 219, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1270 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1272 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1273 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1272 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1274 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 226, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1273 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1275 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1276 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1275 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1277 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 233, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1276 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1278 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1279 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1278 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1280 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1254, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 477, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1279 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1281 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1282 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1281 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1283 = internal constant [14 x i8] c"~basic_string\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1284 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1283, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1283, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 482, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1282 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1285 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1693 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1286 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1287 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1286 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1288 = internal constant [13 x i8] c"_ZNSsaSERKSs\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1289 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1288, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 490, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1287 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1290 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1291 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1290 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1292 = internal constant [12 x i8] c"_ZNSsaSEPKc\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1293 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str1292, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 498, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1291 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1294 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1295 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1294 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1296 = internal constant [10 x i8] c"_ZNSsaSEc\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1297 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str89, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1296, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 509, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1295 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1298 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1299 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1298 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1300 = internal constant [6 x i8] c"begin\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1301 = internal constant [14 x i8] c"_ZNSs5beginEv\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1302 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1300, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1300, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1301, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 521, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1299 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1303 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1231 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1304 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1303 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1305 = internal constant [15 x i8] c"_ZNKSs5beginEv\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1306 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1300, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1300, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1305, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 532, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1304 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1307 = internal constant [4 x i8] c"end\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1308 = internal constant [12 x i8] c"_ZNSs3endEv\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1309 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str1307, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str1307, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str1308, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 540, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1299 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1310 = internal constant [13 x i8] c"_ZNKSs3endEv\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1311 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str1307, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str1307, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1310, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 551, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1304 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1312 = internal constant [128 x i8] c"reverse_iterator<__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >\00", section "llvm.metadata" ; <[128 x i8]*> [#uses=1]
+@llvm.dbg.composite1313 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([128 x i8]* @.str1312, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 100, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1314 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1313 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1315 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1314 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1316 = internal constant [7 x i8] c"rbegin\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1317 = internal constant [15 x i8] c"_ZNSs6rbeginEv\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1318 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1316, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1316, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1317, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 560, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1315 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1319 = internal constant [134 x i8] c"reverse_iterator<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >\00", section "llvm.metadata" ; <[134 x i8]*> [#uses=1]
+@llvm.dbg.composite1320 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([134 x i8]* @.str1319, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1098 to %0*), i32 100, i64 0, i64 0, i64 0, i32 4, %0* null, %0* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1321 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1320 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1322 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1321 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1323 = internal constant [16 x i8] c"_ZNKSs6rbeginEv\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1324 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1316, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1316, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1323, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 569, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1322 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1325 = internal constant [5 x i8] c"rend\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1326 = internal constant [13 x i8] c"_ZNSs4rendEv\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1327 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1325, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1325, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1326, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 578, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1315 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1328 = internal constant [14 x i8] c"_ZNKSs4rendEv\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1329 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1325, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1325, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1328, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 587, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1322 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1330 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1331 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1330 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1332 = internal constant [5 x i8] c"size\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1333 = internal constant [14 x i8] c"_ZNKSs4sizeEv\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1334 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1332, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1332, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1333, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 595, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1331 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1335 = internal constant [7 x i8] c"length\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1336 = internal constant [16 x i8] c"_ZNKSs6lengthEv\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1337 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1335, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1335, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1336, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 601, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1331 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1338 = internal constant [18 x i8] c"_ZNKSs8max_sizeEv\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1339 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str863, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str863, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1338, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 606, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1331 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1340 = internal constant [4 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1341 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1340 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1342 = internal constant [7 x i8] c"resize\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1343 = internal constant [16 x i8] c"_ZNSs6resizeEjc\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1344 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1342, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1342, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1343, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 622, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1341 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1345 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1346 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1345 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1347 = internal constant [15 x i8] c"_ZNSs6resizeEj\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1348 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1342, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1342, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1347, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 633, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1346 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1349 = internal constant [9 x i8] c"capacity\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1]
+@.str1350 = internal constant [18 x i8] c"_ZNKSs8capacityEv\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1351 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([9 x i8]* @.str1349, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str1349, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1350, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 641, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1331 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite1352 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1345 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1353 = internal constant [8 x i8] c"reserve\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1354 = internal constant [16 x i8] c"_ZNSs7reserveEj\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1355 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1353, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1353, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1354, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 484, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1352 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1356 = internal constant [6 x i8] c"clear\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1357 = internal constant [14 x i8] c"_ZNSs5clearEv\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1358 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1356, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1356, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1357, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 668, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1185 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1359 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype1032 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1360 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1359 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1361 = internal constant [6 x i8] c"empty\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1362 = internal constant [15 x i8] c"_ZNKSs5emptyEv\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1363 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1361, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1361, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1362, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 675, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1360 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1364 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype845 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1365 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1364 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1366 = internal constant [11 x i8] c"_ZNKSsixEj\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1367 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1366, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 690, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1365 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1368 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype839 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1369 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1368 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1370 = internal constant [10 x i8] c"_ZNSsixEj\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1371 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str334, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1370, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 707, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1369 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1372 = internal constant [3 x i8] c"at\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1]
+@.str1373 = internal constant [12 x i8] c"_ZNKSs2atEj\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1374 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([3 x i8]* @.str1372, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str1372, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str1373, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 728, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1365 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1375 = internal constant [11 x i8] c"_ZNSs2atEj\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1376 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([3 x i8]* @.str1372, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str1372, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str1375, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 747, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1369 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1377 = internal constant [13 x i8] c"_ZNSspLERKSs\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1378 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1377, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 762, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1287 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1379 = internal constant [12 x i8] c"_ZNSspLEPKc\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1380 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str1379, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 771, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1291 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1381 = internal constant [10 x i8] c"_ZNSspLEc\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1382 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str92, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1381, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 780, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1295 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1383 = internal constant [7 x i8] c"append\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1384 = internal constant [18 x i8] c"_ZNSs6appendERKSs\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1385 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1384, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 330, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1287 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1386 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1387 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1386 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1388 = internal constant [20 x i8] c"_ZNSs6appendERKSsjj\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1389 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1388, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 347, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1387 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1390 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1391 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1390 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1392 = internal constant [18 x i8] c"_ZNSs6appendEPKcj\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1393 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1392, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 303, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1391 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1394 = internal constant [17 x i8] c"_ZNSs6appendEPKc\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1395 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1394, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 824, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1291 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1396 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1397 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1396 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1398 = internal constant [16 x i8] c"_ZNSs6appendEjc\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1399 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1398, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 286, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1397 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1400 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* null, %0* null], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1401 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1400 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1402 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1383, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 851, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1401 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1403 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1404 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1403 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1405 = internal constant [10 x i8] c"push_back\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str1406 = internal constant [18 x i8] c"_ZNSs9push_backEc\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1407 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str1405, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str1405, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1406, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 859, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1404 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1408 = internal constant [7 x i8] c"assign\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1409 = internal constant [18 x i8] c"_ZNSs6assignERKSs\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1410 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1409, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 248, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1287 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1411 = internal constant [20 x i8] c"_ZNSs6assignERKSsjj\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1412 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1411, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 889, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1387 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1413 = internal constant [18 x i8] c"_ZNSs6assignEPKcj\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1414 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1413, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 264, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1391 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1415 = internal constant [17 x i8] c"_ZNSs6assignEPKc\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1416 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1415, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 917, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1291 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1417 = internal constant [16 x i8] c"_ZNSs6assignEjc\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1418 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1417, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 933, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1397 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite1419 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1400 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1420 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1408, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 946, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1419 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1421 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1422 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1421 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1423 = internal constant [7 x i8] c"insert\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1424 = internal constant [53 x i8] c"_ZNSs6insertEN9__gnu_cxx17__normal_iteratorIPcSsEEjc\00", section "llvm.metadata" ; <[53 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1425 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([53 x i8]* @.str1424, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 962, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1422 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1426 = internal constant [5 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* null, %0* null], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1427 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1426 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1428 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 978, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1427 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1429 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1430 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1429 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1431 = internal constant [19 x i8] c"_ZNSs6insertEjRKSs\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1432 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1431, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 993, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1430 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1433 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1434 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1433 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1435 = internal constant [21 x i8] c"_ZNSs6insertEjRKSsjj\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1436 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1435, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1016, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1434 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1437 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1438 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1437 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1439 = internal constant [19 x i8] c"_ZNSs6insertEjPKcj\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1440 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1439, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 365, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1438 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1441 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1442 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1441 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1443 = internal constant [18 x i8] c"_ZNSs6insertEjPKc\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1444 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1443, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1056, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1442 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1445 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1446 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1445 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1447 = internal constant [17 x i8] c"_ZNSs6insertEjjc\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1448 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1447, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1079, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1446 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1449 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1450 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1449 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1451 = internal constant [52 x i8] c"_ZNSs6insertEN9__gnu_cxx17__normal_iteratorIPcSsEEc\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1452 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1423, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str1451, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1096, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1450 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1453 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1454 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1453 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1455 = internal constant [6 x i8] c"erase\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1456 = internal constant [15 x i8] c"_ZNSs5eraseEjj\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1457 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1455, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1455, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1456, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1120, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1454 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1458 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1459 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1458 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1460 = internal constant [50 x i8] c"_ZNSs5eraseEN9__gnu_cxx17__normal_iteratorIPcSsEE\00", section "llvm.metadata" ; <[50 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1461 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1455, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1455, i32 0, i32 0), i8* getelementptr ([50 x i8]* @.str1460, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1136, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1459 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1462 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1463 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1462 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1464 = internal constant [53 x i8] c"_ZNSs5eraseEN9__gnu_cxx17__normal_iteratorIPcSsEES2_\00", section "llvm.metadata" ; <[53 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1465 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1455, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1455, i32 0, i32 0), i8* getelementptr ([53 x i8]* @.str1464, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1156, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1463 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1466 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1467 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1466 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1468 = internal constant [8 x i8] c"replace\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1469 = internal constant [21 x i8] c"_ZNSs7replaceEjjRKSs\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1470 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1469, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1183, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1467 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1471 = internal constant [7 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[7 x %0*]*> [#uses=1]
+@llvm.dbg.composite1472 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([7 x %0*]* @llvm.dbg.array1471 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1473 = internal constant [23 x i8] c"_ZNSs7replaceEjjRKSsjj\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1474 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str1473, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1206, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1472 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1475 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1476 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1475 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1477 = internal constant [21 x i8] c"_ZNSs7replaceEjjPKcj\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1478 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1477, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 397, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1476 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1479 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1480 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1479 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1481 = internal constant [20 x i8] c"_ZNSs7replaceEjjPKc\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1482 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1481, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1248, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1480 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1483 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1484 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1483 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1485 = internal constant [19 x i8] c"_ZNSs7replaceEjjjc\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1486 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1485, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1271, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1484 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1487 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1488 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1487 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1489 = internal constant [59 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_RKSs\00", section "llvm.metadata" ; <[59 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1490 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([59 x i8]* @.str1489, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1289, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1488 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1491 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1492 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1491 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1493 = internal constant [59 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_PKcj\00", section "llvm.metadata" ; <[59 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1494 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([59 x i8]* @.str1493, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1307, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1492 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1495 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1496 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1495 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1497 = internal constant [58 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_PKc\00", section "llvm.metadata" ; <[58 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1498 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([58 x i8]* @.str1497, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1328, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1496 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1499 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1500 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1499 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1501 = internal constant [57 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_jc\00", section "llvm.metadata" ; <[57 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1502 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([57 x i8]* @.str1501, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1349, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1500 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1503 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* null, %0* null], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1504 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1503 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1505 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1373, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1504 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1506 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1507 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1506 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1508 = internal constant [61 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_S1_S1_\00", section "llvm.metadata" ; <[61 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1509 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([61 x i8]* @.str1508, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1385, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1507 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1510 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1511 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1510 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1512 = internal constant [61 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_PKcS4_\00", section "llvm.metadata" ; <[61 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1513 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([61 x i8]* @.str1512, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1396, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1511 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1514 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1515 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1514 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1516 = internal constant [61 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_S2_S2_\00", section "llvm.metadata" ; <[61 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1517 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([61 x i8]* @.str1516, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1406, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1515 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1518 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1231 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1231 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1519 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1518 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1520 = internal constant [70 x i8] c"_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_NS0_IPKcSsEES5_\00", section "llvm.metadata" ; <[70 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1521 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1468, i32 0, i32 0), i8* getelementptr ([70 x i8]* @.str1520, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1417, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1519 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1522 = internal constant [18 x i8] c"cpp_type_traits.h\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1523 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([18 x i8]* @.str1522, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1524 = internal constant [12 x i8] c"__true_type\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@llvm.dbg.composite1526 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str1524, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1523 to %0*), i32 97, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([0 x %0*]* @llvm.dbg.array680 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1527 = internal constant [7 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1526 to %0*)], section "llvm.metadata" ; <[7 x %0*]*> [#uses=1]
+@llvm.dbg.composite1528 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([7 x %0*]* @llvm.dbg.array1527 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1529 = internal constant [20 x i8] c"_M_replace_dispatch\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1530 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([20 x i8]* @.str1529, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1529, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1430, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1528 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1531 = internal constant [13 x i8] c"__false_type\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.composite1533 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1531, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1523 to %0*), i32 98, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([0 x %0*]* @llvm.dbg.array680 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1534 = internal constant [7 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1176 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1533 to %0*)], section "llvm.metadata" ; <[7 x %0*]*> [#uses=1]
+@llvm.dbg.composite1535 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([7 x %0*]* @llvm.dbg.array1534 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1536 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([20 x i8]* @.str1529, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1529, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1436, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1535 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1537 = internal constant [15 x i8] c"_M_replace_aux\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@.str1538 = internal constant [27 x i8] c"_ZNSs14_M_replace_auxEjjjc\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1539 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str1537, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1537, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1538, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 651, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1484 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1540 = internal constant [16 x i8] c"_M_replace_safe\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str1541 = internal constant [30 x i8] c"_ZNSs15_M_replace_safeEjjPKcj\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1542 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str1540, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1540, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1541, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 664, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1476 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1543 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1533 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1544 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1543 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1545 = internal constant [17 x i8] c"_S_construct_aux\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1546 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str1545, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1545, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1451, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1544 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1547 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1526 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1548 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1547 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1549 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str1545, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1545, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1460, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1548 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1550 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1551 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1550 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1552 = internal constant [13 x i8] c"_S_construct\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1553 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1466, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1551 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1554 = internal constant [26 x i8] c"stl_iterator_base_types.h\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit1555 = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 4, i8* getelementptr ([26 x i8]* @.str1554, i32 0, i32 0), i8* getelementptr ([115 x i8]* @.str638, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str1556 = internal constant [19 x i8] c"input_iterator_tag\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.composite1558 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([19 x i8]* @.str1556, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1555 to %0*), i32 80, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([0 x %0*]* @llvm.dbg.array680 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1559 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1558 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1560 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1559 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1561 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1476, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1560 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1562 = internal constant [21 x i8] c"forward_iterator_tag\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1564 = internal constant %llvm.dbg.derivedtype.type { i32 458780, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1555 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1558 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1565 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1564 to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1]
+@llvm.dbg.composite1566 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([21 x i8]* @.str1562, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1555 to %0*), i32 84, i64 8, i64 8, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array1565 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.array1567 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* null, %0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*), %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1566 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1568 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1567 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1569 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1483, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1568 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1570 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype887 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1571 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1570 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1572 = internal constant [30 x i8] c"_ZNSs12_S_constructEjcRKSaIcE\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1573 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1552, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1572, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 166, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1571 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1574 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1575 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1574 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1576 = internal constant [5 x i8] c"copy\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1577 = internal constant [17 x i8] c"_ZNKSs4copyEPcjj\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1578 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1576, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1576, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1577, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 705, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1575 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1579 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype923 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1285 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1580 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1579 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1581 = internal constant [5 x i8] c"swap\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1582 = internal constant [15 x i8] c"_ZNSs4swapERSs\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1583 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1581, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1581, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1582, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 501, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1580 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1584 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1585 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1584 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1586 = internal constant [6 x i8] c"c_str\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1587 = internal constant [15 x i8] c"_ZNKSs5c_strEv\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1588 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1586, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1586, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1587, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1522, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1585 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1589 = internal constant [5 x i8] c"data\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1590 = internal constant [14 x i8] c"_ZNKSs4dataEv\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1591 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1589, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1589, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1590, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1532, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1585 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1592 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite902 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1593 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1592 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1594 = internal constant [14 x i8] c"get_allocator\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@.str1595 = internal constant [24 x i8] c"_ZNKSs13get_allocatorEv\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1596 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1594, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1594, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str1595, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1539, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1593 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1597 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1598 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1597 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1599 = internal constant [5 x i8] c"find\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str1600 = internal constant [18 x i8] c"_ZNKSs4findEPKcjj\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1601 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1600, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 719, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1598 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1602 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1603 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1602 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1604 = internal constant [18 x i8] c"_ZNKSs4findERKSsj\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1605 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1604, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1567, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1603 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1606 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1607 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1606 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1608 = internal constant [17 x i8] c"_ZNKSs4findEPKcj\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1609 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1608, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1581, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1607 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1610 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype282 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype672 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1611 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1610 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1612 = internal constant [15 x i8] c"_ZNKSs4findEcj\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1613 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1599, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1612, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 742, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1611 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite1614 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1602 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1615 = internal constant [6 x i8] c"rfind\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1616 = internal constant [19 x i8] c"_ZNKSs5rfindERKSsj\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1617 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1616, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1611, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1614 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1618 = internal constant [19 x i8] c"_ZNKSs5rfindEPKcjj\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1619 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1618, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 760, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1598 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite1620 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1606 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1621 = internal constant [18 x i8] c"_ZNKSs5rfindEPKcj\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1622 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1621, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1639, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1620 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.composite1623 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1610 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1624 = internal constant [16 x i8] c"_ZNKSs5rfindEcj\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1625 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1615, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1624, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 781, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1623 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1626 = internal constant [14 x i8] c"find_first_of\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@.str1627 = internal constant [28 x i8] c"_ZNKSs13find_first_ofERKSsj\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1628 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1627, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1669, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1603 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1629 = internal constant [28 x i8] c"_ZNKSs13find_first_ofEPKcjj\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1630 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1629, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 798, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1598 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1631 = internal constant [27 x i8] c"_ZNKSs13find_first_ofEPKcj\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1632 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1631, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1697, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1607 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1633 = internal constant [25 x i8] c"_ZNKSs13find_first_ofEcj\00", section "llvm.metadata" ; <[25 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1634 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1626, i32 0, i32 0), i8* getelementptr ([25 x i8]* @.str1633, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1716, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1611 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1635 = internal constant [13 x i8] c"find_last_of\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str1636 = internal constant [27 x i8] c"_ZNKSs12find_last_ofERKSsj\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1637 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1636, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1730, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1614 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1638 = internal constant [27 x i8] c"_ZNKSs12find_last_ofEPKcjj\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1639 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1638, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 813, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1598 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1640 = internal constant [26 x i8] c"_ZNKSs12find_last_ofEPKcj\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1641 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1640, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1758, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1620 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1642 = internal constant [24 x i8] c"_ZNKSs12find_last_ofEcj\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1643 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1635, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str1642, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1777, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1623 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1644 = internal constant [18 x i8] c"find_first_not_of\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
+@.str1645 = internal constant [32 x i8] c"_ZNKSs17find_first_not_ofERKSsj\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1646 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str1645, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1791, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1603 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1647 = internal constant [32 x i8] c"_ZNKSs17find_first_not_ofEPKcjj\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1648 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([32 x i8]* @.str1647, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 834, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1598 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1649 = internal constant [31 x i8] c"_ZNKSs17find_first_not_ofEPKcj\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1650 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1649, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1820, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1607 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1651 = internal constant [29 x i8] c"_ZNKSs17find_first_not_ofEcj\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1652 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([18 x i8]* @.str1644, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str1651, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 846, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1611 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1653 = internal constant [17 x i8] c"find_last_not_of\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@.str1654 = internal constant [31 x i8] c"_ZNKSs16find_last_not_ofERKSsj\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1655 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1654, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1850, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1614 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1656 = internal constant [31 x i8] c"_ZNKSs16find_last_not_ofEPKcjj\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1657 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1656, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 857, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1598 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1658 = internal constant [30 x i8] c"_ZNKSs16find_last_not_ofEPKcj\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1659 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str1658, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1879, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1620 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1660 = internal constant [28 x i8] c"_ZNKSs16find_last_not_ofEcj\00", section "llvm.metadata" ; <[28 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1661 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1653, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str1660, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 878, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1623 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1662 = internal constant [4 x %0*] [%0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1693 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[4 x %0*]*> [#uses=1]
+@llvm.dbg.composite1663 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([4 x %0*]* @llvm.dbg.array1662 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1664 = internal constant [7 x i8] c"substr\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1665 = internal constant [17 x i8] c"_ZNKSs6substrEjj\00", section "llvm.metadata" ; <[17 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1666 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1664, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str1664, i32 0, i32 0), i8* getelementptr ([17 x i8]* @.str1665, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1911, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1663 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1667 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1668 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1667 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1669 = internal constant [8 x i8] c"compare\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1]
+@.str1670 = internal constant [20 x i8] c"_ZNKSs7compareERKSs\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1671 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1670, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit807 to %0*), i32 1929, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1668 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1672 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1673 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1672 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1674 = internal constant [22 x i8] c"_ZNKSs7compareEjjRKSs\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1675 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str1674, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 898, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1673 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1676 = internal constant [7 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1259 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[7 x %0*]*> [#uses=1]
+@llvm.dbg.composite1677 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([7 x %0*]* @llvm.dbg.array1676 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1678 = internal constant [24 x i8] c"_ZNKSs7compareEjjRKSsjj\00", section "llvm.metadata" ; <[24 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1679 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([24 x i8]* @.str1678, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 914, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1677 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1680 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1681 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1680 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1682 = internal constant [19 x i8] c"_ZNKSs7compareEPKc\00", section "llvm.metadata" ; <[19 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1683 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([19 x i8]* @.str1682, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 931, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1681 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1684 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1685 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1684 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1686 = internal constant [21 x i8] c"_ZNKSs7compareEjjPKc\00", section "llvm.metadata" ; <[21 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1687 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([21 x i8]* @.str1686, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 946, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1685 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1688 = internal constant [6 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype917 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype280 to %0*)], section "llvm.metadata" ; <[6 x %0*]*> [#uses=1]
+@llvm.dbg.composite1689 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([6 x %0*]* @llvm.dbg.array1688 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1690 = internal constant [22 x i8] c"_ZNKSs7compareEjjPKcj\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1691 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([8 x i8]* @.str1669, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str1690, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit1070 to %0*), i32 963, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1689 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1692 = internal constant [143 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype913 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram922 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram927 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1096 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1180 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1183 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1188 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1193 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1198 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1203 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1208 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1213 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1216 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1221 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1225 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1229 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1235 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1239 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1243 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1248 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1251 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1253 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1255 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1258 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1262 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1265 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1268 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1271 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1274 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1277 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1280 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1284 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1289 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1293 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1297 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1302 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1306 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1309 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1311 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1318 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1324 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1327 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1329 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1334 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1337 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1339 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1344 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1348 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1351 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1355 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1358 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1363 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1367 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1371 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1374 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1376 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1378 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1380 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1382 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1385 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1389 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1393 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1395 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1399 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1402 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1407 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1410 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1412 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1414 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1416 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1418 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1420 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1425 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1428 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1432 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1436 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1440 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1444 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1448 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1452 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1457 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1461 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1465 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1470 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1474 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1478 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1482 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1486 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1490 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1494 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1498 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1502 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1505 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1509 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1513 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1517 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1521 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1530 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1536 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1539 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1542 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1546 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1549 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1553 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1561 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1569 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1573 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1578 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1583 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1588 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1591 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1596 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1601 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1605 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1609 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1613 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1617 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1619 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1622 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1625 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1628 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1630 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1632 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1634 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1637 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1639 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1641 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1643 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1646 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1648 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1650 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1652 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1655 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1657 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1659 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1661 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1666 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1671 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1675 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1679 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1683 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1687 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1691 to %0*)], section "llvm.metadata" ; <[143 x %0*]*> [#uses=1]
+@llvm.dbg.composite1693 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([64 x i8]* @.str804, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 56, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([143 x %0*]* @llvm.dbg.array1692 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype1694 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str914, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 56, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1693 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str1695 = internal constant [7 x i8] c"_M_msg\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype1696 = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str1695, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 109, i64 32, i64 32, i64 32, i32 1, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1694 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1697 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1714 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1698 = internal constant %llvm.dbg.derivedtype.type { i32 458774, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str914, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit803 to %0*), i32 56, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype916 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1699 = internal constant %llvm.dbg.derivedtype.type { i32 458768, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1698 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1700 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1697 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1699 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1701 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1700 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1702 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str775, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str775, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 114, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1701 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1703 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1697 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1704 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1703 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1705 = internal constant [15 x i8] c"~runtime_error\00", section "llvm.metadata" ; <[15 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1706 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str1705, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str1705, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 117, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1704 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.derivedtype1707 = internal constant %llvm.dbg.derivedtype.type { i32 458790, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 64, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1714 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1708 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1707 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1709 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype791 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1708 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1710 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1709 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1711 = internal constant [29 x i8] c"_ZNKSt13runtime_error4whatEv\00", section "llvm.metadata" ; <[29 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1712 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str796, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str796, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str1711, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 122, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1710 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1713 = internal constant [5 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype801 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1696 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1702 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1706 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1712 to %0*)], section "llvm.metadata" ; <[5 x %0*]*> [#uses=1]
+@llvm.dbg.composite1714 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str775, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 108, i64 64, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([5 x %0*]* @llvm.dbg.array1713 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype1715 = internal constant %llvm.dbg.derivedtype.type { i32 458780, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1714 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype1716 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1721 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1717 = internal constant [3 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1716 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1699 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1718 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1717 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram1719 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str773, i32 0, i32 0), i8* getelementptr ([15 x i8]* @.str773, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 136, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1718 to %0*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1720 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1715 to %0*), %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1719 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1721 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([15 x i8]* @.str773, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 134, i64 64, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1720 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype1722 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1721 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1723 = internal constant [2 x %0*] [%0* null, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1722 to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1724 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1723 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1725 = internal constant [16 x i8] c"~overflow_error\00", section "llvm.metadata" ; <[16 x i8]*> [#uses=1]
+@.str1726 = internal constant [26 x i8] c"_ZNSt14overflow_errorD1Ev\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1727 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str1725, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1725, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1726, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*), i32 134, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1724 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@_ZTVSt14overflow_error = weak constant [5 x i32 (...)*] [i32 (...)* null, i32 (...)* bitcast (%struct.__si_class_type_info_pseudo* @_ZTISt14overflow_error to i32 (...)*), i32 (...)* bitcast (void (%"struct.std::overflow_error"*)* @_ZNSt14overflow_errorD1Ev to i32 (...)*), i32 (...)* bitcast (void (%"struct.std::overflow_error"*)* @_ZNSt14overflow_errorD0Ev to i32 (...)*), i32 (...)* bitcast (i8* (%"struct.std::runtime_error"*)* @_ZNKSt13runtime_error4whatEv to i32 (...)*)], align 8 ; <[5 x i32 (...)*]*> [#uses=1]
+@.str1735 = internal constant [26 x i8] c"_ZNSt14overflow_errorD0Ev\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1736 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([16 x i8]* @.str1725, i32 0, i32 0), i8* getelementptr ([16 x i8]* @.str1725, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1735, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 702, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1724 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array1738 = internal constant [2 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[2 x %0*]*> [#uses=1]
+@llvm.dbg.composite1739 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([2 x %0*]* @llvm.dbg.array1738 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1740 = internal constant [14 x i8] c"__complex_exp\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@.str1741 = internal constant [22 x i8] c"_ZSt13__complex_expCd\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1742 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([14 x i8]* @.str1740, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str1740, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str1741, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 730, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1739 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1744 = internal constant [12 x i8] c"exp<double>\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
+@.str1745 = internal constant [31 x i8] c"_ZSt3expIdESt7complexIT_ERKS2_\00", section "llvm.metadata" ; <[31 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1746 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str1744, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str1744, i32 0, i32 0), i8* getelementptr ([31 x i8]* @.str1745, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*), i32 738, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite573 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprogram1748 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str457, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str457, i32 0, i32 0), i8* getelementptr ([29 x i8]* @.str495, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 497, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite488 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable1751 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*), i8* getelementptr ([7 x i8]* @.str259, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 503, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1752 = internal constant [2 x i8] c"u\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable1753 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*), i8* getelementptr ([2 x i8]* @.str1752, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 501, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1754 = internal constant [2 x i8] c"t\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable1755 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*), i8* getelementptr ([2 x i8]* @.str1754, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 501, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1756 = internal constant [2 x i8] c"w\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable1757 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*), i8* getelementptr ([2 x i8]* @.str1756, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 501, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1758 = internal constant [3 x i8] c"wm\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1]
+@llvm.dbg.variable1759 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*), i8* getelementptr ([3 x i8]* @.str1758, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 501, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram1771 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([12 x i8]* @.str460, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str460, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str497, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 535, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite492 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable1774 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*), i8* getelementptr ([7 x i8]* @.str259, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 541, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.variable1775 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*), i8* getelementptr ([2 x i8]* @.str1752, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 539, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.variable1776 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*), i8* getelementptr ([2 x i8]* @.str1754, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 539, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.variable1777 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*), i8* getelementptr ([2 x i8]* @.str1756, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 539, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.variable1778 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*), i8* getelementptr ([3 x i8]* @.str1758, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 539, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite223 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.subprogram1785 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str463, i32 0, i32 0), i8* getelementptr ([28 x i8]* @.str499, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 576, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite351 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.variable1791 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*), i8* getelementptr ([7 x i8]* @.str259, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 614, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1794 = internal constant [5 x i8] c"dft2\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.variable1795 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*), i8* getelementptr ([5 x i8]* @.str1794, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 601, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1796 = internal constant [5 x i8] c"dft1\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.variable1797 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*), i8* getelementptr ([5 x i8]* @.str1796, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 600, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite486 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1798 = internal constant [3 x i8] c"a2\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1]
+@llvm.dbg.variable1799 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*), i8* getelementptr ([3 x i8]* @.str1798, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 591, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1800 = internal constant [3 x i8] c"a1\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1]
+@llvm.dbg.variable1801 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*), i8* getelementptr ([3 x i8]* @.str1800, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 590, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@llvm.dbg.derivedtype1802 = internal constant %llvm.dbg.derivedtype.type { i32 458767, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype837 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array1803 = internal constant [3 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype269 to %0*), %0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype1802 to %0*)], section "llvm.metadata" ; <[3 x %0*]*> [#uses=1]
+@llvm.dbg.composite1804 = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([3 x %0*]* @llvm.dbg.array1803 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str1805 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@llvm.dbg.subprogram1806 = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str1805, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1805, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 654, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite1804 to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str1816 = internal constant [6 x i8] c"poly3\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.variable1817 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1806 to %0*), i8* getelementptr ([6 x i8]* @.str1816, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 674, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1818 = internal constant [6 x i8] c"poly2\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.variable1819 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1806 to %0*), i8* getelementptr ([6 x i8]* @.str1818, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 673, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1820 = internal constant [6 x i8] c"poly1\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.variable1821 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1806 to %0*), i8* getelementptr ([6 x i8]* @.str1820, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 672, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite518 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+@.str1824 = internal constant [4 x i8] c"-ga\00", align 4 ; <[4 x i8]*> [#uses=0]
+@_ZSt4cout = external global %"struct.std::basic_ostream<char,std::char_traits<char> >" ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=3]
+@.str1825 = internal constant [32 x i8] c"\0Afftbench (Std. C++) run time: \00" ; <[32 x i8]*> [#uses=1]
+@.str1826 = internal constant [3 x i8] c"\0A\0A\00" ; <[3 x i8]*> [#uses=1]
+@llvm.global_ctors = appending global [1 x %2] [%2 { i32 65535, void ()* @_GLOBAL__I_main }] ; <[1 x %2]*> [#uses=0]
+
+@_ZL20__gthrw_pthread_oncePiPFvvE = alias weak i32 (i32*, void ()*)* @pthread_once ; <i32 (i32*, void ()*)*> [#uses=0]
+@_ZL27__gthrw_pthread_getspecificj = alias weak i8* (i32)* @pthread_getspecific ; <i8* (i32)*> [#uses=0]
+@_ZL27__gthrw_pthread_setspecificjPKv = alias weak i32 (i32, i8*)* @pthread_setspecific ; <i32 (i32, i8*)*> [#uses=0]
+@_ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_ = alias weak i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; <i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)*> [#uses=0]
+@_ZL22__gthrw_pthread_cancelm = alias weak i32 (i32)* @pthread_cancel ; <i32 (i32)*> [#uses=0]
+@_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+@_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+@_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+@_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = alias weak i32 (%struct.pthread_mutex_t*, %struct..0._50*)* @pthread_mutex_init ; <i32 (%struct.pthread_mutex_t*, %struct..0._50*)*> [#uses=0]
+@_ZL26__gthrw_pthread_key_createPjPFvPvE = alias weak i32 (i32*, void (i8*)*)* @pthread_key_create ; <i32 (i32*, void (i8*)*)*> [#uses=0]
+@_ZL26__gthrw_pthread_key_deletej = alias weak i32 (i32)* @pthread_key_delete ; <i32 (i32)*> [#uses=0]
+@_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = alias weak i32 (%struct..0._50*)* @pthread_mutexattr_init ; <i32 (%struct..0._50*)*> [#uses=0]
+@_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = alias weak i32 (%struct..0._50*, i32)* @pthread_mutexattr_settype ; <i32 (%struct..0._50*, i32)*> [#uses=0]
+@_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = alias weak i32 (%struct..0._50*)* @pthread_mutexattr_destroy ; <i32 (%struct..0._50*)*> [#uses=0]
+
+define i32 @main(i32 %argc, i8** nocapture %argv) {
+entry:
+ %n.0.reg2mem = alloca i32 ; <i32*> [#uses=5]
+ %poly3 = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=5]
+ %poly2 = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=6]
+ %poly1 = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=6]
+ %0 = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1806 to %0*))
+ %1 = bitcast %"struct.polynomial<double>"* %poly3 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %1, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1817 to %0*))
+ %2 = bitcast %"struct.polynomial<double>"* %poly2 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %2, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1819 to %0*))
+ %3 = bitcast %"struct.polynomial<double>"* %poly1 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %3, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1821 to %0*))
+ call void @llvm.dbg.stoppoint(i32 659, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %4 = icmp sgt i32 %argc, 1 ; <i1> [#uses=1]
+ br i1 %4, label %bb4, label %bb5
+
+bb1: ; preds = %bb4
+ call void @llvm.dbg.stoppoint(i32 663, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = getelementptr i8** %argv, i32 1 ; <i8**> [#uses=1]
+ %6 = load i8** %5, align 1 ; <i8*> [#uses=1]
+ %tmp = bitcast i8* %6 to i32* ; <i32*> [#uses=1]
+ %lhsv = load i32* %tmp, align 1 ; <i32> [#uses=1]
+ %7 = icmp eq i32 %lhsv, 6383405 ; <i1> [#uses=1]
+ br i1 %7, label %bb5, label %bb3
+
+bb3: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 661, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %8 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb4
+
+bb4: ; preds = %bb3, %entry
+ %i.0 = phi i32 [ %8, %bb3 ], [ 1, %entry ] ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 661, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %9 = icmp slt i32 %i.0, %argc ; <i1> [#uses=1]
+ br i1 %9, label %bb1, label %bb5
+
+bb5: ; preds = %bb4, %bb1, %entry
+ %ga_testing.0 = phi i8 [ 0, %entry ], [ 0, %bb4 ], [ 1, %bb1 ] ; <i8> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 672, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdEC1Ej(%"struct.polynomial<double>"* %poly1, i32 524288)
+ call void @llvm.dbg.stoppoint(i32 673, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdEC1Ej(%"struct.polynomial<double>"* %poly2, i32 524288)
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %bb5
+ call void @llvm.dbg.stoppoint(i32 674, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdEC1Ej(%"struct.polynomial<double>"* %poly3, i32 1048575)
+ to label %bb8.thread unwind label %lpad47
+
+bb8.thread: ; preds = %invcont
+ store i32 0, i32* %n.0.reg2mem
+ call void @llvm.dbg.stoppoint(i32 676, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb7
+
+bb7: ; preds = %bb8, %bb8.thread
+ call void @llvm.dbg.stoppoint(i32 678, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %n.0.reload3 = load i32* %n.0.reg2mem ; <i32> [#uses=1]
+ %10 = call double* @_ZN10polynomialIdEixEj(%"struct.polynomial<double>"* %poly1, i32 %n.0.reload3) nounwind ; <double*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 68, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %11 = load i32* @_ZZL13random_doublevE4seed, align 4 ; <i32> [#uses=1]
+ %12 = xor i32 %11, 123459876 ; <i32> [#uses=3]
+ store i32 %12, i32* @_ZZL13random_doublevE4seed, align 4
+ call void @llvm.dbg.stoppoint(i32 69, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %13 = sdiv i32 %12, 127773 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 70, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %14 = mul i32 %13, 127773 ; <i32> [#uses=1]
+ %15 = sub i32 %12, %14 ; <i32> [#uses=1]
+ %16 = mul i32 %15, 16807 ; <i32> [#uses=1]
+ %17 = mul i32 %13, 2836 ; <i32> [#uses=1]
+ %18 = sub i32 %16, %17 ; <i32> [#uses=2]
+ store i32 %18, i32* @_ZZL13random_doublevE4seed, align 4
+ call void @llvm.dbg.stoppoint(i32 72, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %19 = icmp slt i32 %18, 0 ; <i1> [#uses=1]
+ br i1 %19, label %bb.i, label %_ZL13random_doublev.exit
+
+bb.i: ; preds = %bb7
+ call void @llvm.dbg.stoppoint(i32 73, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %20 = load i32* @_ZZL13random_doublevE4seed, align 4 ; <i32> [#uses=1]
+ %21 = add i32 %20, 2147483647 ; <i32> [#uses=1]
+ store i32 %21, i32* @_ZZL13random_doublevE4seed, align 4
+ br label %_ZL13random_doublev.exit
+
+_ZL13random_doublev.exit: ; preds = %bb.i, %bb7
+ call void @llvm.dbg.stoppoint(i32 75, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %22 = load i32* @_ZZL13random_doublevE4seed, align 4 ; <i32> [#uses=2]
+ %23 = sitofp i32 %22 to double ; <double> [#uses=1]
+ %24 = mul double %23, 0x3E340000002813D9 ; <double> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 76, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %25 = xor i32 %22, 123459876 ; <i32> [#uses=1]
+ store i32 %25, i32* @_ZZL13random_doublevE4seed, align 4
+ call void @llvm.dbg.stoppoint(i32 78, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ store double %24, double* %10, align 8
+ call void @llvm.dbg.stoppoint(i32 679, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %n.0.reload4 = load i32* %n.0.reg2mem ; <i32> [#uses=1]
+ %26 = call double* @_ZN10polynomialIdEixEj(%"struct.polynomial<double>"* %poly2, i32 %n.0.reload4) nounwind ; <double*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 68, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %27 = load i32* @_ZZL13random_doublevE4seed, align 4 ; <i32> [#uses=1]
+ %28 = xor i32 %27, 123459876 ; <i32> [#uses=3]
+ store i32 %28, i32* @_ZZL13random_doublevE4seed, align 4
+ call void @llvm.dbg.stoppoint(i32 69, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %29 = sdiv i32 %28, 127773 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 70, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %30 = mul i32 %29, 127773 ; <i32> [#uses=1]
+ %31 = sub i32 %28, %30 ; <i32> [#uses=1]
+ %32 = mul i32 %31, 16807 ; <i32> [#uses=1]
+ %33 = mul i32 %29, 2836 ; <i32> [#uses=1]
+ %34 = sub i32 %32, %33 ; <i32> [#uses=2]
+ store i32 %34, i32* @_ZZL13random_doublevE4seed, align 4
+ call void @llvm.dbg.stoppoint(i32 72, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %35 = icmp slt i32 %34, 0 ; <i1> [#uses=1]
+ br i1 %35, label %bb.i1, label %bb8
+
+bb.i1: ; preds = %_ZL13random_doublev.exit
+ call void @llvm.dbg.stoppoint(i32 73, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %36 = load i32* @_ZZL13random_doublevE4seed, align 4 ; <i32> [#uses=1]
+ %37 = add i32 %36, 2147483647 ; <i32> [#uses=1]
+ store i32 %37, i32* @_ZZL13random_doublevE4seed, align 4
+ br label %bb8
+
+bb8: ; preds = %bb.i1, %_ZL13random_doublev.exit
+ call void @llvm.dbg.stoppoint(i32 75, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %38 = load i32* @_ZZL13random_doublevE4seed, align 4 ; <i32> [#uses=2]
+ %39 = sitofp i32 %38 to double ; <double> [#uses=1]
+ %40 = mul double %39, 0x3E340000002813D9 ; <double> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 76, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %41 = xor i32 %38, 123459876 ; <i32> [#uses=1]
+ store i32 %41, i32* @_ZZL13random_doublevE4seed, align 4
+ call void @llvm.dbg.stoppoint(i32 78, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ store double %40, double* %26, align 8
+ call void @llvm.dbg.stoppoint(i32 676, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %n.0.reload5 = load i32* %n.0.reg2mem ; <i32> [#uses=1]
+ %42 = add i32 %n.0.reload5, 1 ; <i32> [#uses=2]
+ store i32 %42, i32* %n.0.reg2mem
+ call void @llvm.dbg.stoppoint(i32 676, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %43 = icmp sgt i32 %42, 524287 ; <i1> [#uses=1]
+ br i1 %43, label %bb9, label %bb7
+
+bb9: ; preds = %bb8
+ call void @llvm.dbg.stoppoint(i32 687, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZNK10polynomialIdEmlERKS0_(%"struct.polynomial<double>"* noalias sret %0, %"struct.polynomial<double>"* %poly1, %"struct.polynomial<double>"* %poly2)
+ to label %invcont10 unwind label %lpad51
+
+invcont10: ; preds = %bb9
+ call void @llvm.dbg.stoppoint(i32 687, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %44 = invoke %"struct.polynomial<double>"* @_ZN10polynomialIdEaSERKS0_(%"struct.polynomial<double>"* %poly3, %"struct.polynomial<double>"* %0)
+ to label %invcont11 unwind label %lpad55 ; <%"struct.polynomial<double>"*> [#uses=0]
+
+invcont11: ; preds = %invcont10
+ call void @llvm.dbg.stoppoint(i32 687, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %0)
+ to label %bb16 unwind label %lpad51
+
+bb16: ; preds = %invcont11
+ call void @llvm.dbg.stoppoint(i32 695, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %toBool = icmp eq i8 %ga_testing.0, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %bb19, label %bb17
+
+bb17: ; preds = %bb16
+ call void @llvm.dbg.stoppoint(i32 696, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %45 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEd(%"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4cout, double 0.000000e+00)
+ to label %bb23 unwind label %lpad51 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+bb19: ; preds = %bb16
+ call void @llvm.dbg.stoppoint(i32 698, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %46 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(%"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4cout, i8* getelementptr ([32 x i8]* @.str1825, i32 0, i32 0))
+ to label %invcont20 unwind label %lpad51 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
+
+invcont20: ; preds = %bb19
+ call void @llvm.dbg.stoppoint(i32 698, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %47 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEd(%"struct.std::basic_ostream<char,std::char_traits<char> >"* %46, double 0.000000e+00)
+ to label %invcont21 unwind label %lpad51 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=1]
+
+invcont21: ; preds = %invcont20
+ call void @llvm.dbg.stoppoint(i32 698, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %48 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(%"struct.std::basic_ostream<char,std::char_traits<char> >"* %47, i8* getelementptr ([3 x i8]* @.str1826, i32 0, i32 0))
+ to label %bb23 unwind label %lpad51 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+bb23: ; preds = %invcont21, %bb17
+ call void @llvm.dbg.stoppoint(i32 700, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %49 = invoke %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSo5flushEv(%"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZSt4cout)
+ to label %invcont24 unwind label %lpad51 ; <%"struct.std::basic_ostream<char,std::char_traits<char> >"*> [#uses=0]
+
+invcont24: ; preds = %bb23
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %poly3)
+ to label %bb31 unwind label %lpad47
+
+bb31: ; preds = %invcont24
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %poly2)
+ to label %bb38 unwind label %lpad
+
+bb38: ; preds = %bb31
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %poly1)
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1806 to %0*))
+ ret i32 0
+
+lpad: ; preds = %bb31, %bb5
+ %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select46 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad
+
+lpad47: ; preds = %invcont24, %invcont
+ %eh_ptr48 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select50 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr48, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad75
+
+lpad51: ; preds = %bb23, %invcont21, %invcont20, %bb19, %bb17, %invcont11, %bb9
+ %eh_ptr52 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select54 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr52, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad76
+
+lpad55: ; preds = %invcont10
+ %eh_ptr56 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select58 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr56, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 687, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %0)
+ to label %ppad76 unwind label %lpad59
+
+lpad59: ; preds = %lpad55
+ %eh_ptr60 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select62 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr60, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 687, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad63: ; preds = %ppad76
+ %eh_ptr64 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select66 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr64, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad67: ; preds = %ppad75
+ %eh_ptr68 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select70 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr68, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad71: ; preds = %ppad
+ %eh_ptr72 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select74 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr72, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+ppad: ; preds = %ppad75, %lpad
+ %eh_exception.2 = phi i8* [ %eh_ptr, %lpad ], [ %eh_exception.1, %ppad75 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %poly1)
+ to label %Unwind unwind label %lpad71
+
+ppad75: ; preds = %ppad76, %lpad47
+ %eh_exception.1 = phi i8* [ %eh_ptr48, %lpad47 ], [ %eh_exception.0, %ppad76 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %poly2)
+ to label %ppad unwind label %lpad67
+
+ppad76: ; preds = %lpad55, %lpad51
+ %eh_exception.0 = phi i8* [ %eh_ptr52, %lpad51 ], [ %eh_ptr56, %lpad55 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 702, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %poly3)
+ to label %ppad75 unwind label %lpad63
+
+Unwind: ; preds = %ppad
+ call void @_Unwind_Resume(i8* %eh_exception.2)
+ unreachable
+}
+
+define internal void @_GLOBAL__I_main() {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram657 to %0*))
+ call void @llvm.dbg.stoppoint(i32 77, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit636 to %0*))
+ call void @_ZNSt8ios_base4InitC1Ev(%"struct.std::allocator<char>"* @_ZStL8__ioinit)
+ %0 = call i32 @__cxa_atexit(void (i8*)* @__tcf_0, i8* null, i8* bitcast (i8** @__dso_handle to i8*)) nounwind ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 400, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = load i8* bitcast (i64* @_ZGVN10polynomialIdE4PI2IE to i8*), align 8 ; <i8> [#uses=1]
+ %2 = icmp eq i8 %1, 0 ; <i1> [#uses=1]
+ br i1 %2, label %bb2.i, label %_Z41__static_initialization_and_destruction_0ii.exit
+
+bb2.i: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 400, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ store i8 1, i8* bitcast (i64* @_ZGVN10polynomialIdE4PI2IE to i8*), align 8
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* @_ZN10polynomialIdE4PI2IE, double 0.000000e+00, double 0x401921FB54442D18) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram657 to %0*))
+ ret void
+
+_Z41__static_initialization_and_destruction_0ii.exit: ; preds = %entry
+ ret void
+}
+
+define linkonce void @_ZNSt7complexIdEC1ECd(%"struct.std::complex<double>"* %this, %1 %__z) nounwind {
+entry:
+ %__z_addr = alloca %1, align 8 ; <%1*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram227 to %0*))
+ %0 = bitcast %1* %__z_addr to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable231 to %0*))
+ store %1 %__z, %1* %__z_addr, align 8
+ call void @llvm.dbg.stoppoint(i32 1161, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %2 = getelementptr %1* %__z_addr, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 8 ; <double> [#uses=1]
+ store double %3, double* %1, align 4
+ %4 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %5 = getelementptr %1* %__z_addr, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 8 ; <double> [#uses=1]
+ store double %6, double* %4, align 4
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram227 to %0*))
+ ret void
+}
+
+declare void @llvm.dbg.func.start(%0*) nounwind readnone
+
+declare void @llvm.dbg.declare(%0*, %0*) nounwind readnone
+
+declare void @llvm.dbg.stoppoint(i32, i32, %0*) nounwind readnone
+
+declare void @llvm.dbg.region.end(%0*) nounwind readnone
+
+define linkonce %1* @_ZNKSt7complexIdE5__repEv(%"struct.std::complex<double>"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram232 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1192, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0 ; <%1*> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram232 to %0*))
+ ret %1* %0
+}
+
+define linkonce double* @_ZNSt7complexIdE4realEv(%"struct.std::complex<double>"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram235 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1200, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram235 to %0*))
+ ret double* %0
+}
+
+define linkonce double* @_ZNKSt7complexIdE4realEv(%"struct.std::complex<double>"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram237 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1204, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram237 to %0*))
+ ret double* %0
+}
+
+define linkonce double* @_ZNKSt7complexIdE4imagEv(%"struct.std::complex<double>"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram239 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1212, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram239 to %0*))
+ ret double* %0
+}
+
+define linkonce void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %this, double %__r, double %__i) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram242 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1217, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %__r, double* %0, align 4
+ call void @llvm.dbg.stoppoint(i32 1218, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %__i, double* %1, align 4
+ call void @llvm.dbg.stoppoint(i32 1219, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram242 to %0*))
+ ret void
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZNSt7complexIdEaSEd(%"struct.std::complex<double>"* %this, double %__d) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram248 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1224, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %__d, double* %0, align 4
+ call void @llvm.dbg.stoppoint(i32 1225, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double 0.000000e+00, double* %1, align 4
+ call void @llvm.dbg.stoppoint(i32 1226, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram248 to %0*))
+ ret %"struct.std::complex<double>"* %this
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZNSt7complexIdEdVEd(%"struct.std::complex<double>"* %this, double %__d) nounwind {
+entry:
+ %0 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %1 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %2 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp1 = alloca %1, align 8 ; <%1*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram252 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1253, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %3 = getelementptr %1* %2, i32 0, i32 0 ; <double*> [#uses=1]
+ %4 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %5 = load double* %4, align 4 ; <double> [#uses=1]
+ store double %5, double* %3, align 8
+ %6 = getelementptr %1* %2, i32 0, i32 1 ; <double*> [#uses=1]
+ %7 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %8 = load double* %7, align 4 ; <double> [#uses=1]
+ store double %8, double* %6, align 8
+ %real = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %__d, double* %real, align 8
+ %imag = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ store double 0.000000e+00, double* %imag, align 8
+ %9 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %10 = getelementptr %1* %2, i32 0, i32 0 ; <double*> [#uses=1]
+ %11 = load double* %10, align 8 ; <double> [#uses=1]
+ store double %11, double* %9, align 8
+ %12 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %13 = getelementptr %1* %2, i32 0, i32 1 ; <double*> [#uses=1]
+ %14 = load double* %13, align 8 ; <double> [#uses=1]
+ store double %14, double* %12, align 8
+ %15 = getelementptr %1* %memtmp1, i32 0, i32 0 ; <double*> [#uses=1]
+ %16 = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ %17 = load double* %16, align 8 ; <double> [#uses=1]
+ store double %17, double* %15, align 8
+ %18 = getelementptr %1* %memtmp1, i32 0, i32 1 ; <double*> [#uses=1]
+ %19 = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ %20 = load double* %19, align 8 ; <double> [#uses=1]
+ store double %20, double* %18, align 8
+ %real2 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %real3 = load double* %real2, align 8 ; <double> [#uses=2]
+ %imag4 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %imag5 = load double* %imag4, align 8 ; <double> [#uses=2]
+ %real6 = getelementptr %1* %memtmp1, i32 0, i32 0 ; <double*> [#uses=1]
+ %real7 = load double* %real6, align 8 ; <double> [#uses=4]
+ %imag8 = getelementptr %1* %memtmp1, i32 0, i32 1 ; <double*> [#uses=1]
+ %imag9 = load double* %imag8, align 8 ; <double> [#uses=4]
+ %21 = mul double %real3, %real7 ; <double> [#uses=1]
+ %22 = mul double %imag5, %imag9 ; <double> [#uses=1]
+ %23 = add double %21, %22 ; <double> [#uses=1]
+ %24 = mul double %real7, %real7 ; <double> [#uses=1]
+ %25 = mul double %imag9, %imag9 ; <double> [#uses=1]
+ %26 = add double %24, %25 ; <double> [#uses=2]
+ %27 = fdiv double %23, %26 ; <double> [#uses=1]
+ %28 = mul double %imag5, %real7 ; <double> [#uses=1]
+ %29 = mul double %real3, %imag9 ; <double> [#uses=1]
+ %30 = sub double %28, %29 ; <double> [#uses=1]
+ %31 = fdiv double %30, %26 ; <double> [#uses=1]
+ %real10 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %27, double* %real10, align 8
+ %imag11 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %31, double* %imag11, align 8
+ %32 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %33 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ %34 = load double* %33, align 8 ; <double> [#uses=1]
+ store double %34, double* %32, align 4
+ %35 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %36 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ %37 = load double* %36, align 8 ; <double> [#uses=1]
+ store double %37, double* %35, align 4
+ call void @llvm.dbg.stoppoint(i32 1254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram252 to %0*))
+ ret %"struct.std::complex<double>"* %this
+}
+
+define linkonce double* @_ZN10polynomialIdEixEj(%"struct.polynomial<double>"* %this, i32 %term) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram522 to %0*))
+ call void @llvm.dbg.stoppoint(i32 308, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %1 = load double** %0, align 4 ; <double*> [#uses=1]
+ %2 = getelementptr double* %1, i32 %term ; <double*> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram522 to %0*))
+ ret double* %2
+}
+
+define linkonce i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram527 to %0*))
+ call void @llvm.dbg.stoppoint(i32 113, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram527 to %0*))
+ ret i32 %1
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %this, i32 %term) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram530 to %0*))
+ call void @llvm.dbg.stoppoint(i32 308, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ %1 = load %"struct.std::complex<double>"** %0, align 4 ; <%"struct.std::complex<double>"*> [#uses=1]
+ %2 = getelementptr %"struct.std::complex<double>"* %1, i32 %term ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram530 to %0*))
+ ret %"struct.std::complex<double>"* %2
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %this, %"struct.std::complex<double>"* %__z) nounwind {
+entry:
+ %__t = alloca %1, align 8 ; <%1*> [#uses=7]
+ %0 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %1 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp3 = alloca %1, align 8 ; <%1*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram538 to %0*))
+ %2 = bitcast %1* %__t to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %2, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable542 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1289, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %3 = call double* @_ZNKSt7complexIdE4realEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %4 = load double* %3, align 8 ; <double> [#uses=1]
+ %5 = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 8 ; <double> [#uses=1]
+ %real = getelementptr %1* %__t, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %4, double* %real, align 8
+ %imag = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %6, double* %imag, align 8
+ call void @llvm.dbg.stoppoint(i32 1290, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %7 = call double* @_ZNKSt7complexIdE4imagEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %8 = load double* %7, align 8 ; <double> [#uses=1]
+ %imag2 = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %8, double* %imag2, align 8
+ call void @llvm.dbg.stoppoint(i32 1291, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %9 = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ %10 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %11 = load double* %10, align 4 ; <double> [#uses=1]
+ store double %11, double* %9, align 8
+ %12 = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ %13 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %14 = load double* %13, align 4 ; <double> [#uses=1]
+ store double %14, double* %12, align 8
+ %15 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %16 = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ %17 = load double* %16, align 8 ; <double> [#uses=1]
+ store double %17, double* %15, align 8
+ %18 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %19 = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ %20 = load double* %19, align 8 ; <double> [#uses=1]
+ store double %20, double* %18, align 8
+ %21 = getelementptr %1* %memtmp3, i32 0, i32 0 ; <double*> [#uses=1]
+ %22 = getelementptr %1* %__t, i32 0, i32 0 ; <double*> [#uses=1]
+ %23 = load double* %22, align 8 ; <double> [#uses=1]
+ store double %23, double* %21, align 8
+ %24 = getelementptr %1* %memtmp3, i32 0, i32 1 ; <double*> [#uses=1]
+ %25 = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ %26 = load double* %25, align 8 ; <double> [#uses=1]
+ store double %26, double* %24, align 8
+ %real4 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %real5 = load double* %real4, align 8 ; <double> [#uses=2]
+ %imag6 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %imag7 = load double* %imag6, align 8 ; <double> [#uses=2]
+ %real8 = getelementptr %1* %memtmp3, i32 0, i32 0 ; <double*> [#uses=1]
+ %real9 = load double* %real8, align 8 ; <double> [#uses=2]
+ %imag10 = getelementptr %1* %memtmp3, i32 0, i32 1 ; <double*> [#uses=1]
+ %imag11 = load double* %imag10, align 8 ; <double> [#uses=2]
+ %27 = mul double %real5, %real9 ; <double> [#uses=1]
+ %28 = mul double %imag7, %imag11 ; <double> [#uses=1]
+ %29 = sub double %27, %28 ; <double> [#uses=1]
+ %30 = mul double %real5, %imag11 ; <double> [#uses=1]
+ %31 = mul double %real9, %imag7 ; <double> [#uses=1]
+ %32 = add double %30, %31 ; <double> [#uses=1]
+ %real12 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %29, double* %real12, align 8
+ %imag13 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %32, double* %imag13, align 8
+ %33 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %34 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ %35 = load double* %34, align 8 ; <double> [#uses=1]
+ store double %35, double* %33, align 4
+ %36 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %37 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ %38 = load double* %37, align 8 ; <double> [#uses=1]
+ store double %38, double* %36, align 4
+ call void @llvm.dbg.stoppoint(i32 1292, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram538 to %0*))
+ ret %"struct.std::complex<double>"* %this
+}
+
+define linkonce void @_ZN10polynomialIdE9deep_copyEPKd(%"struct.polynomial<double>"* %this, double* %source) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram543 to %0*))
+ call void @llvm.dbg.stoppoint(i32 197, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb1
+
+bb: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 198, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %1 = load double** %0, align 4 ; <double*> [#uses=1]
+ %2 = getelementptr double* %source, i32 %n.0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 1 ; <double> [#uses=1]
+ %4 = getelementptr double* %1, i32 %n.0 ; <double*> [#uses=1]
+ store double %3, double* %4, align 1
+ call void @llvm.dbg.stoppoint(i32 197, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = add i32 %n.0, 1 ; <i32> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %n.0 = phi i32 [ 0, %entry ], [ %5, %bb ] ; <i32> [#uses=4]
+ call void @llvm.dbg.stoppoint(i32 197, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %6 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %7 = load i32* %6, align 4 ; <i32> [#uses=1]
+ %8 = icmp ugt i32 %7, %n.0 ; <i1> [#uses=1]
+ br i1 %8, label %bb, label %return
+
+return: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 198, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram543 to %0*))
+ ret void
+}
+
+define linkonce i32 @_ZN10polynomialIdE4log2Ej(i32 %n) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram549 to %0*))
+ call void @llvm.dbg.stoppoint(i32 407, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb1
+
+bb: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 411, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = add i32 %c.0, 1 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 412, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = shl i32 %x.0, 1 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 414, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %2 = icmp eq i32 %1, 0 ; <i1> [#uses=1]
+ br i1 %2, label %return, label %bb1
+
+bb1: ; preds = %bb, %entry
+ %c.0 = phi i32 [ 0, %entry ], [ %0, %bb ] ; <i32> [#uses=2]
+ %x.0 = phi i32 [ 1, %entry ], [ %1, %bb ] ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 409, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %3 = icmp ult i32 %x.0, %n ; <i1> [#uses=1]
+ br i1 %3, label %bb, label %return
+
+return: ; preds = %bb1, %bb
+ %c.1 = phi i32 [ %c.0, %bb1 ], [ %0, %bb ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 418, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram549 to %0*))
+ ret i32 %c.1
+}
+
+define linkonce void @_ZStmlIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.std::complex<double>"* %__x, %"struct.std::complex<double>"* %__y) nounwind {
+entry:
+ %__r = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram559 to %0*))
+ %0 = bitcast %"struct.std::complex<double>"* %__r to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable564 to %0*))
+ call void @llvm.dbg.stoppoint(i32 380, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %2 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 4 ; <double> [#uses=1]
+ store double %3, double* %1, align 4
+ %4 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %5 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 4 ; <double> [#uses=1]
+ store double %6, double* %4, align 4
+ call void @llvm.dbg.stoppoint(i32 381, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %7 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %agg.result, %"struct.std::complex<double>"* %__y) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram559 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialISt7complexIdEE9deep_copyEPKS1_(%"struct.polynomial<std::complex<double> >"* %this, %"struct.std::complex<double>"* %source) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram565 to %0*))
+ call void @llvm.dbg.stoppoint(i32 197, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb1
+
+bb: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 198, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ %1 = load %"struct.std::complex<double>"** %0, align 4 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %2 = getelementptr %"struct.std::complex<double>"* %1, i32 %n.0, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = getelementptr %"struct.std::complex<double>"* %source, i32 %n.0, i32 0, i32 0 ; <double*> [#uses=1]
+ %4 = load double* %3, align 1 ; <double> [#uses=1]
+ store double %4, double* %2, align 1
+ %5 = getelementptr %"struct.std::complex<double>"* %1, i32 %n.0, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = getelementptr %"struct.std::complex<double>"* %source, i32 %n.0, i32 0, i32 1 ; <double*> [#uses=1]
+ %7 = load double* %6, align 1 ; <double> [#uses=1]
+ store double %7, double* %5, align 1
+ call void @llvm.dbg.stoppoint(i32 197, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %8 = add i32 %n.0, 1 ; <i32> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %n.0 = phi i32 [ 0, %entry ], [ %8, %bb ] ; <i32> [#uses=6]
+ call void @llvm.dbg.stoppoint(i32 197, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %9 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %10 = load i32* %9, align 4 ; <i32> [#uses=1]
+ %11 = icmp ugt i32 %10, %n.0 ; <i1> [#uses=1]
+ br i1 %11, label %bb, label %return
+
+return: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 198, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram565 to %0*))
+ ret void
+}
+
+define linkonce i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram569 to %0*))
+ call void @llvm.dbg.stoppoint(i32 113, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram569 to %0*))
+ ret i32 %1
+}
+
+define linkonce void @_ZStngIdESt7complexIT_ERKS2_(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.std::complex<double>"* %__x) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram576 to %0*))
+ call void @llvm.dbg.stoppoint(i32 444, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = call double* @_ZNKSt7complexIdE4imagEv(%"struct.std::complex<double>"* %__x) nounwind ; <double*> [#uses=1]
+ %1 = load double* %0, align 8 ; <double> [#uses=1]
+ %2 = sub double -0.000000e+00, %1 ; <double> [#uses=1]
+ %3 = call double* @_ZNKSt7complexIdE4realEv(%"struct.std::complex<double>"* %__x) nounwind ; <double*> [#uses=1]
+ %4 = load double* %3, align 8 ; <double> [#uses=1]
+ %5 = sub double -0.000000e+00, %4 ; <double> [#uses=1]
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %agg.result, double %5, double %2) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram576 to %0*))
+ ret void
+}
+
+define linkonce double @_ZNK10polynomialIdE3getEj(%"struct.polynomial<double>"* %this, i32 %term) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram578 to %0*))
+ call void @llvm.dbg.stoppoint(i32 302, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %1 = load double** %0, align 4 ; <double*> [#uses=1]
+ %2 = getelementptr double* %1, i32 %term ; <double*> [#uses=1]
+ %3 = load double* %2, align 1 ; <double> [#uses=1]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram578 to %0*))
+ ret double %3
+}
+
+define linkonce i32 @_ZN10polynomialIdE9flip_bitsEjj(i32 %k, i32 %bits) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram581 to %0*))
+ call void @llvm.dbg.stoppoint(i32 425, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = add i32 %bits, -1 ; <i32> [#uses=1]
+ %1 = shl i32 1, %0 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 427, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb3
+
+bb: ; preds = %bb3
+ call void @llvm.dbg.stoppoint(i32 431, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %2 = and i32 %rm.0, %k ; <i32> [#uses=1]
+ %3 = icmp ne i32 %2, 0 ; <i1> [#uses=1]
+ %4 = select i1 %3, i32 %lm.0, i32 0 ; <i32> [#uses=1]
+ %.r.1 = or i32 %r.1, %4 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 434, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = lshr i32 %lm.0, 1 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 435, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %6 = shl i32 %rm.0, 1 ; <i32> [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb, %entry
+ %r.1 = phi i32 [ 0, %entry ], [ %.r.1, %bb ] ; <i32> [#uses=2]
+ %rm.0 = phi i32 [ 1, %entry ], [ %6, %bb ] ; <i32> [#uses=2]
+ %lm.0 = phi i32 [ %1, %entry ], [ %5, %bb ] ; <i32> [#uses=3]
+ call void @llvm.dbg.stoppoint(i32 429, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %7 = icmp eq i32 %lm.0, 0 ; <i1> [#uses=1]
+ br i1 %7, label %return, label %bb
+
+return: ; preds = %bb3
+ call void @llvm.dbg.stoppoint(i32 438, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram581 to %0*))
+ ret i32 %r.1
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZNSt7complexIdEdVIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %this, %"struct.std::complex<double>"* %__z) nounwind {
+entry:
+ %__t = alloca %1, align 8 ; <%1*> [#uses=7]
+ %0 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %1 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp3 = alloca %1, align 8 ; <%1*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram593 to %0*))
+ %2 = bitcast %1* %__t to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %2, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable596 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1300, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %3 = call double* @_ZNKSt7complexIdE4realEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %4 = load double* %3, align 8 ; <double> [#uses=1]
+ %5 = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 8 ; <double> [#uses=1]
+ %real = getelementptr %1* %__t, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %4, double* %real, align 8
+ %imag = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %6, double* %imag, align 8
+ call void @llvm.dbg.stoppoint(i32 1301, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %7 = call double* @_ZNKSt7complexIdE4imagEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %8 = load double* %7, align 8 ; <double> [#uses=1]
+ %imag2 = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %8, double* %imag2, align 8
+ call void @llvm.dbg.stoppoint(i32 1302, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %9 = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ %10 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %11 = load double* %10, align 4 ; <double> [#uses=1]
+ store double %11, double* %9, align 8
+ %12 = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ %13 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %14 = load double* %13, align 4 ; <double> [#uses=1]
+ store double %14, double* %12, align 8
+ %15 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %16 = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ %17 = load double* %16, align 8 ; <double> [#uses=1]
+ store double %17, double* %15, align 8
+ %18 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %19 = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ %20 = load double* %19, align 8 ; <double> [#uses=1]
+ store double %20, double* %18, align 8
+ %21 = getelementptr %1* %memtmp3, i32 0, i32 0 ; <double*> [#uses=1]
+ %22 = getelementptr %1* %__t, i32 0, i32 0 ; <double*> [#uses=1]
+ %23 = load double* %22, align 8 ; <double> [#uses=1]
+ store double %23, double* %21, align 8
+ %24 = getelementptr %1* %memtmp3, i32 0, i32 1 ; <double*> [#uses=1]
+ %25 = getelementptr %1* %__t, i32 0, i32 1 ; <double*> [#uses=1]
+ %26 = load double* %25, align 8 ; <double> [#uses=1]
+ store double %26, double* %24, align 8
+ %real4 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %real5 = load double* %real4, align 8 ; <double> [#uses=2]
+ %imag6 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %imag7 = load double* %imag6, align 8 ; <double> [#uses=2]
+ %real8 = getelementptr %1* %memtmp3, i32 0, i32 0 ; <double*> [#uses=1]
+ %real9 = load double* %real8, align 8 ; <double> [#uses=4]
+ %imag10 = getelementptr %1* %memtmp3, i32 0, i32 1 ; <double*> [#uses=1]
+ %imag11 = load double* %imag10, align 8 ; <double> [#uses=4]
+ %27 = mul double %real5, %real9 ; <double> [#uses=1]
+ %28 = mul double %imag7, %imag11 ; <double> [#uses=1]
+ %29 = add double %27, %28 ; <double> [#uses=1]
+ %30 = mul double %real9, %real9 ; <double> [#uses=1]
+ %31 = mul double %imag11, %imag11 ; <double> [#uses=1]
+ %32 = add double %30, %31 ; <double> [#uses=2]
+ %33 = fdiv double %29, %32 ; <double> [#uses=1]
+ %34 = mul double %imag7, %real9 ; <double> [#uses=1]
+ %35 = mul double %real5, %imag11 ; <double> [#uses=1]
+ %36 = sub double %34, %35 ; <double> [#uses=1]
+ %37 = fdiv double %36, %32 ; <double> [#uses=1]
+ %real12 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %33, double* %real12, align 8
+ %imag13 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %37, double* %imag13, align 8
+ %38 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %39 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ %40 = load double* %39, align 8 ; <double> [#uses=1]
+ store double %40, double* %38, align 4
+ %41 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %42 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ %43 = load double* %42, align 8 ; <double> [#uses=1]
+ store double %43, double* %41, align 4
+ call void @llvm.dbg.stoppoint(i32 1303, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram593 to %0*))
+ ret %"struct.std::complex<double>"* %this
+}
+
+define linkonce void @_ZStdvIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.std::complex<double>"* %__x, %"struct.std::complex<double>"* %__y) {
+entry:
+ %__r = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram599 to %0*))
+ %0 = bitcast %"struct.std::complex<double>"* %__r to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable602 to %0*))
+ call void @llvm.dbg.stoppoint(i32 410, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %2 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 4 ; <double> [#uses=1]
+ store double %3, double* %1, align 4
+ %4 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %5 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 4 ; <double> [#uses=1]
+ store double %6, double* %4, align 4
+ call void @llvm.dbg.stoppoint(i32 411, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %7 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEdVIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %agg.result, %"struct.std::complex<double>"* %__y) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram599 to %0*))
+ ret void
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZNSt7complexIdEpLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %this, %"struct.std::complex<double>"* %__z) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram605 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1270, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %1 = load double* %0, align 4 ; <double> [#uses=1]
+ %2 = call double* @_ZNKSt7complexIdE4realEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %3 = load double* %2, align 8 ; <double> [#uses=1]
+ %4 = add double %1, %3 ; <double> [#uses=1]
+ %5 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %4, double* %5, align 4
+ call void @llvm.dbg.stoppoint(i32 1271, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %6 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %7 = load double* %6, align 4 ; <double> [#uses=1]
+ %8 = call double* @_ZNKSt7complexIdE4imagEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %9 = load double* %8, align 8 ; <double> [#uses=1]
+ %10 = add double %7, %9 ; <double> [#uses=1]
+ %11 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %10, double* %11, align 4
+ call void @llvm.dbg.stoppoint(i32 1272, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram605 to %0*))
+ ret %"struct.std::complex<double>"* %this
+}
+
+define linkonce void @_ZStplIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.std::complex<double>"* %__x, %"struct.std::complex<double>"* %__y) {
+entry:
+ %__r = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram610 to %0*))
+ %0 = bitcast %"struct.std::complex<double>"* %__r to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable613 to %0*))
+ call void @llvm.dbg.stoppoint(i32 320, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %2 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 4 ; <double> [#uses=1]
+ store double %3, double* %1, align 4
+ %4 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %5 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 4 ; <double> [#uses=1]
+ store double %6, double* %4, align 4
+ call void @llvm.dbg.stoppoint(i32 321, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %7 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEpLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %agg.result, %"struct.std::complex<double>"* %__y) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram610 to %0*))
+ ret void
+}
+
+define linkonce %"struct.std::complex<double>"* @_ZNSt7complexIdEmIIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %this, %"struct.std::complex<double>"* %__z) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram616 to %0*))
+ call void @llvm.dbg.stoppoint(i32 1279, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %0 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %1 = load double* %0, align 4 ; <double> [#uses=1]
+ %2 = call double* @_ZNKSt7complexIdE4realEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %3 = load double* %2, align 8 ; <double> [#uses=1]
+ %4 = sub double %1, %3 ; <double> [#uses=1]
+ %5 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ store double %4, double* %5, align 4
+ call void @llvm.dbg.stoppoint(i32 1280, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %6 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %7 = load double* %6, align 4 ; <double> [#uses=1]
+ %8 = call double* @_ZNKSt7complexIdE4imagEv(%"struct.std::complex<double>"* %__z) nounwind ; <double*> [#uses=1]
+ %9 = load double* %8, align 8 ; <double> [#uses=1]
+ %10 = sub double %7, %9 ; <double> [#uses=1]
+ %11 = getelementptr %"struct.std::complex<double>"* %this, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ store double %10, double* %11, align 4
+ call void @llvm.dbg.stoppoint(i32 1281, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram616 to %0*))
+ ret %"struct.std::complex<double>"* %this
+}
+
+define linkonce void @_ZStmiIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.std::complex<double>"* %__x, %"struct.std::complex<double>"* %__y) {
+entry:
+ %__r = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram620 to %0*))
+ %0 = bitcast %"struct.std::complex<double>"* %__r to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable623 to %0*))
+ call void @llvm.dbg.stoppoint(i32 350, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %1 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %2 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 4 ; <double> [#uses=1]
+ store double %3, double* %1, align 4
+ %4 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %5 = getelementptr %"struct.std::complex<double>"* %__x, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 4 ; <double> [#uses=1]
+ store double %6, double* %4, align 4
+ call void @llvm.dbg.stoppoint(i32 351, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %7 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEmIIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %agg.result, %"struct.std::complex<double>"* %__y) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram620 to %0*))
+ ret void
+}
+
+define linkonce void @_ZNK10polynomialISt7complexIdEE3getEj(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.polynomial<std::complex<double> >"* %this, i32 %term) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram624 to %0*))
+ call void @llvm.dbg.stoppoint(i32 302, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ %1 = load %"struct.std::complex<double>"** %0, align 4 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %2 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = getelementptr %"struct.std::complex<double>"* %1, i32 %term, i32 0, i32 0 ; <double*> [#uses=1]
+ %4 = load double* %3, align 1 ; <double> [#uses=1]
+ store double %4, double* %2, align 1
+ %5 = getelementptr %"struct.std::complex<double>"* %agg.result, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = getelementptr %"struct.std::complex<double>"* %1, i32 %term, i32 0, i32 1 ; <double*> [#uses=1]
+ %7 = load double* %6, align 1 ; <double> [#uses=1]
+ store double %7, double* %5, align 1
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram624 to %0*))
+ ret void
+}
+
+declare void @_ZNSt8ios_base4InitC1Ev(%"struct.std::allocator<char>"*)
+
+declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) nounwind
+
+define internal void @__tcf_0(i8* nocapture %unnamed_arg) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram662 to %0*))
+ call void @llvm.dbg.stoppoint(i32 77, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit636 to %0*))
+ call void @_ZNSt8ios_base4InitD1Ev(%"struct.std::allocator<char>"* @_ZStL8__ioinit)
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram662 to %0*))
+ ret void
+}
+
+declare void @_ZNSt8ios_base4InitD1Ev(%"struct.std::allocator<char>"*)
+
+define linkonce void @_ZN10polynomialIdE7releaseEv(%"struct.polynomial<double>"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram665 to %0*))
+ call void @llvm.dbg.stoppoint(i32 190, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %1 = load double** %0, align 4 ; <double*> [#uses=1]
+ %2 = icmp eq double* %1, null ; <i1> [#uses=1]
+ br i1 %2, label %return, label %bb
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 190, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %3 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %4 = load double** %3, align 4 ; <double*> [#uses=1]
+ %5 = bitcast double* %4 to i8* ; <i8*> [#uses=1]
+ call void @_ZdaPv(i8* %5) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram665 to %0*))
+ ret void
+
+return: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 190, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ ret void
+}
+
+declare void @_ZdaPv(i8*) nounwind
+
+define linkonce void @_ZN10polynomialIdED0Ev(%"struct.polynomial<double>"* %this) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram668 to %0*))
+ call void @llvm.dbg.stoppoint(i32 255, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialIdE, i32 0, i32 2), i32 (...)*** %0, align 4
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7releaseEv(%"struct.polynomial<double>"* %this) nounwind
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = bitcast %"struct.polynomial<double>"* %this to i8* ; <i8*> [#uses=1]
+ call void @_ZdlPv(i8* %1) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram668 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %this) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram691 to %0*))
+ call void @llvm.dbg.stoppoint(i32 255, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialIdE, i32 0, i32 2), i32 (...)*** %0, align 4
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7releaseEv(%"struct.polynomial<double>"* %this) nounwind
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ ret void
+}
+
+declare void @_ZdlPv(i8*) nounwind
+
+define linkonce void @_ZN10polynomialISt7complexIdEE7releaseEv(%"struct.polynomial<std::complex<double> >"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram693 to %0*))
+ call void @llvm.dbg.stoppoint(i32 190, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ %1 = load %"struct.std::complex<double>"** %0, align 4 ; <%"struct.std::complex<double>"*> [#uses=1]
+ %2 = icmp eq %"struct.std::complex<double>"* %1, null ; <i1> [#uses=1]
+ br i1 %2, label %return, label %bb
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 190, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %3 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ %4 = load %"struct.std::complex<double>"** %3, align 4 ; <%"struct.std::complex<double>"*> [#uses=1]
+ %5 = bitcast %"struct.std::complex<double>"* %4 to i8* ; <i8*> [#uses=1]
+ call void @_ZdaPv(i8* %5) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram693 to %0*))
+ ret void
+
+return: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 190, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialISt7complexIdEED0Ev(%"struct.polynomial<std::complex<double> >"* %this) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram696 to %0*))
+ call void @llvm.dbg.stoppoint(i32 255, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialISt7complexIdEE, i32 0, i32 2), i32 (...)*** %0, align 4
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialISt7complexIdEE7releaseEv(%"struct.polynomial<std::complex<double> >"* %this) nounwind
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = bitcast %"struct.polynomial<std::complex<double> >"* %this to i8* ; <i8*> [#uses=1]
+ call void @_ZdlPv(i8* %1) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram696 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %this) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram708 to %0*))
+ call void @llvm.dbg.stoppoint(i32 255, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialISt7complexIdEE, i32 0, i32 2), i32 (...)*** %0, align 4
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialISt7complexIdEE7releaseEv(%"struct.polynomial<std::complex<double> >"* %this) nounwind
+ call void @llvm.dbg.stoppoint(i32 254, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialIdE7acquireEv(%"struct.polynomial<double>"* %this) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram710 to %0*))
+ call void @llvm.dbg.stoppoint(i32 183, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ %2 = shl i32 %1, 3 ; <i32> [#uses=1]
+ %3 = call i8* @_Znaj(i32 %2) ; <i8*> [#uses=1]
+ %4 = bitcast i8* %3 to double* ; <double*> [#uses=1]
+ %5 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ store double* %4, double** %5, align 4
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram710 to %0*))
+ ret void
+}
+
+declare i8* @_Znaj(i32)
+
+define linkonce void @_ZN10polynomialIdEC1Ej(%"struct.polynomial<double>"* %this, i32 %degree) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram713 to %0*))
+ call void @llvm.dbg.stoppoint(i32 213, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialIdE, i32 0, i32 2), i32 (...)*** %0, align 4
+ %1 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ store double* null, double** %1, align 4
+ %2 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %degree, i32* %2, align 4
+ call void @llvm.dbg.stoppoint(i32 215, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7acquireEv(%"struct.polynomial<double>"* %this)
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram713 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialIdEC1ERKS0_(%"struct.polynomial<double>"* %this, %"struct.polynomial<double>"* %source) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram717 to %0*))
+ call void @llvm.dbg.stoppoint(i32 244, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialIdE, i32 0, i32 2), i32 (...)*** %0, align 4
+ %1 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ store double* null, double** %1, align 4
+ %2 = getelementptr %"struct.polynomial<double>"* %source, i32 0, i32 2 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ %4 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %3, i32* %4, align 4
+ call void @llvm.dbg.stoppoint(i32 246, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7acquireEv(%"struct.polynomial<double>"* %this)
+ call void @llvm.dbg.stoppoint(i32 247, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = getelementptr %"struct.polynomial<double>"* %source, i32 0, i32 1 ; <double**> [#uses=1]
+ %6 = load double** %5, align 4 ; <double*> [#uses=1]
+ call void @_ZN10polynomialIdE9deep_copyEPKd(%"struct.polynomial<double>"* %this, double* %6) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram717 to %0*))
+ ret void
+}
+
+define linkonce %"struct.polynomial<double>"* @_ZN10polynomialIdE7stretchEj(%"struct.polynomial<double>"* %this, i32 %degrees) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram720 to %0*))
+ call void @llvm.dbg.stoppoint(i32 278, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = icmp eq i32 %degrees, 0 ; <i1> [#uses=1]
+ br i1 %0, label %return, label %bb
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 280, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %2 = load double** %1, align 4 ; <double*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 281, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %3 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %4 = load i32* %3, align 4 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 283, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = add i32 %4, %degrees ; <i32> [#uses=1]
+ %6 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %5, i32* %6, align 4
+ call void @llvm.dbg.stoppoint(i32 284, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7acquireEv(%"struct.polynomial<double>"* %this)
+ call void @llvm.dbg.stoppoint(i32 286, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb2
+
+bb1: ; preds = %bb2
+ call void @llvm.dbg.stoppoint(i32 289, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %7 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %8 = load double** %7, align 4 ; <double*> [#uses=1]
+ %9 = getelementptr double* %2, i32 %n.0 ; <double*> [#uses=1]
+ %10 = load double* %9, align 1 ; <double> [#uses=1]
+ %11 = getelementptr double* %8, i32 %n.0 ; <double*> [#uses=1]
+ store double %10, double* %11, align 1
+ call void @llvm.dbg.stoppoint(i32 288, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %12 = add i32 %n.0, 1 ; <i32> [#uses=1]
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %n.0 = phi i32 [ 0, %bb ], [ %12, %bb1 ] ; <i32> [#uses=5]
+ call void @llvm.dbg.stoppoint(i32 288, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %13 = icmp ult i32 %n.0, %4 ; <i1> [#uses=1]
+ br i1 %13, label %bb1, label %bb5
+
+bb4: ; preds = %bb5
+ call void @llvm.dbg.stoppoint(i32 292, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %14 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 1 ; <double**> [#uses=1]
+ %15 = load double** %14, align 4 ; <double*> [#uses=1]
+ %16 = getelementptr double* %15, i32 %n.1 ; <double*> [#uses=1]
+ store double 0.000000e+00, double* %16, align 1
+ call void @llvm.dbg.stoppoint(i32 291, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %17 = add i32 %n.1, 1 ; <i32> [#uses=1]
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb2
+ %n.1 = phi i32 [ %17, %bb4 ], [ %n.0, %bb2 ] ; <i32> [#uses=3]
+ call void @llvm.dbg.stoppoint(i32 291, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %18 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %19 = load i32* %18, align 4 ; <i32> [#uses=1]
+ %20 = icmp ugt i32 %19, %n.1 ; <i1> [#uses=1]
+ br i1 %20, label %bb4, label %return
+
+return: ; preds = %bb5, %entry
+ call void @llvm.dbg.stoppoint(i32 295, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram720 to %0*))
+ ret %"struct.polynomial<double>"* %this
+}
+
+define linkonce %"struct.polynomial<double>"* @_ZN10polynomialIdEaSERKS0_(%"struct.polynomial<double>"* %this, %"struct.polynomial<double>"* %source) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram729 to %0*))
+ call void @llvm.dbg.stoppoint(i32 261, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ %2 = getelementptr %"struct.polynomial<double>"* %source, i32 0, i32 2 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ %4 = icmp eq i32 %1, %3 ; <i1> [#uses=1]
+ br i1 %4, label %bb1, label %bb
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 263, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7releaseEv(%"struct.polynomial<double>"* %this) nounwind
+ call void @llvm.dbg.stoppoint(i32 265, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = getelementptr %"struct.polynomial<double>"* %source, i32 0, i32 2 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 4 ; <i32> [#uses=1]
+ %7 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %6, i32* %7, align 4
+ call void @llvm.dbg.stoppoint(i32 266, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE7acquireEv(%"struct.polynomial<double>"* %this)
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ call void @llvm.dbg.stoppoint(i32 269, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %8 = getelementptr %"struct.polynomial<double>"* %source, i32 0, i32 1 ; <double**> [#uses=1]
+ %9 = load double** %8, align 4 ; <double*> [#uses=1]
+ call void @_ZN10polynomialIdE9deep_copyEPKd(%"struct.polynomial<double>"* %this, double* %9) nounwind
+ call void @llvm.dbg.stoppoint(i32 271, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram729 to %0*))
+ ret %"struct.polynomial<double>"* %this
+}
+
+define linkonce void @_ZN10polynomialISt7complexIdEE7acquireEv(%"struct.polynomial<std::complex<double> >"* %this) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram732 to %0*))
+ call void @llvm.dbg.stoppoint(i32 183, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=2]
+ %2 = shl i32 %1, 4 ; <i32> [#uses=1]
+ %3 = call i8* @_Znaj(i32 %2) ; <i8*> [#uses=1]
+ %4 = bitcast i8* %3 to %"struct.std::complex<double>"* ; <%"struct.std::complex<double>"*> [#uses=2]
+ br label %bb1
+
+bb: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 183, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %.0, double 0.000000e+00, double 0.000000e+00) nounwind
+ %5 = getelementptr %"struct.std::complex<double>"* %.0, i32 1 ; <%"struct.std::complex<double>"*> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %.01.in = phi i32 [ %1, %entry ], [ %.01, %bb ] ; <i32> [#uses=1]
+ %.0 = phi %"struct.std::complex<double>"* [ %4, %entry ], [ %5, %bb ] ; <%"struct.std::complex<double>"*> [#uses=2]
+ %.01 = add i32 %.01.in, -1 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 183, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %6 = icmp eq i32 %.01, -1 ; <i1> [#uses=1]
+ br i1 %6, label %bb2, label %bb
+
+bb2: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 183, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %7 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ store %"struct.std::complex<double>"* %4, %"struct.std::complex<double>"** %7, align 4
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram732 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialISt7complexIdEEC1Ej(%"struct.polynomial<std::complex<double> >"* %this, i32 %degree) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram735 to %0*))
+ call void @llvm.dbg.stoppoint(i32 213, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([4 x i32 (...)*]* @_ZTV10polynomialISt7complexIdEE, i32 0, i32 2), i32 (...)*** %0, align 4
+ %1 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ store %"struct.std::complex<double>"* null, %"struct.std::complex<double>"** %1, align 4
+ %2 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %degree, i32* %2, align 4
+ call void @llvm.dbg.stoppoint(i32 215, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialISt7complexIdEE7acquireEv(%"struct.polynomial<std::complex<double> >"* %this)
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram735 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialIdE11bit_reverseERKS0_(%"struct.polynomial<std::complex<double> >"* noalias sret %agg.result, %"struct.polynomial<double>"* %poly) {
+entry:
+ %result = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=1]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram738 to %0*))
+ %0 = bitcast %"struct.polynomial<std::complex<double> >"* %result to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable744 to %0*))
+ call void @llvm.dbg.stoppoint(i32 471, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %poly) nounwind ; <i32> [#uses=1]
+ %2 = call i32 @_ZN10polynomialIdE4log2Ej(i32 %1) nounwind ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 473, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %3 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %poly) nounwind ; <i32> [#uses=1]
+ call void @_ZN10polynomialISt7complexIdEEC1Ej(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %3)
+ call void @llvm.dbg.stoppoint(i32 475, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb6
+
+bb: ; preds = %bb6
+ call void @llvm.dbg.stoppoint(i32 476, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %4 = call double @_ZNK10polynomialIdE3getEj(%"struct.polynomial<double>"* %poly, i32 %n.0) nounwind ; <double> [#uses=1]
+ %5 = call i32 @_ZN10polynomialIdE9flip_bitsEjj(i32 %n.0, i32 %2) nounwind ; <i32> [#uses=1]
+ %6 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %5) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ %7 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEaSEd(%"struct.std::complex<double>"* %6, double %4) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 475, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %8 = add i32 %n.0, 1 ; <i32> [#uses=1]
+ br label %bb6
+
+bb6: ; preds = %bb, %entry
+ %n.0 = phi i32 [ 0, %entry ], [ %8, %bb ] ; <i32> [#uses=4]
+ call void @llvm.dbg.stoppoint(i32 475, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %9 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %poly) nounwind ; <i32> [#uses=1]
+ %10 = icmp ugt i32 %9, %n.0 ; <i1> [#uses=1]
+ br i1 %10, label %bb, label %return
+
+return: ; preds = %bb6
+ call void @llvm.dbg.stoppoint(i32 475, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram738 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialIdE11bit_reverseERKS_ISt7complexIdEE(%"struct.polynomial<std::complex<double> >"* noalias sret %agg.result, %"struct.polynomial<std::complex<double> >"* %poly) {
+entry:
+ %result = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=1]
+ %memtmp7 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram747 to %0*))
+ %0 = bitcast %"struct.polynomial<std::complex<double> >"* %result to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable751 to %0*))
+ call void @llvm.dbg.stoppoint(i32 485, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %1 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ %2 = call i32 @_ZN10polynomialIdE4log2Ej(i32 %1) nounwind ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 487, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %3 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ call void @_ZN10polynomialISt7complexIdEEC1Ej(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %3)
+ call void @llvm.dbg.stoppoint(i32 489, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb8
+
+bb: ; preds = %bb8
+ call void @llvm.dbg.stoppoint(i32 490, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %4 = call i32 @_ZN10polynomialIdE9flip_bitsEjj(i32 %n.0, i32 %2) nounwind ; <i32> [#uses=1]
+ %5 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %4) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ call void @_ZNK10polynomialISt7complexIdEE3getEj(%"struct.std::complex<double>"* noalias sret %memtmp7, %"struct.polynomial<std::complex<double> >"* %poly, i32 %n.0) nounwind
+ %6 = getelementptr %"struct.std::complex<double>"* %5, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %7 = getelementptr %"struct.std::complex<double>"* %memtmp7, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %8 = load double* %7, align 8 ; <double> [#uses=1]
+ store double %8, double* %6, align 4
+ %9 = getelementptr %"struct.std::complex<double>"* %5, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %10 = getelementptr %"struct.std::complex<double>"* %memtmp7, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %11 = load double* %10, align 8 ; <double> [#uses=1]
+ store double %11, double* %9, align 4
+ call void @llvm.dbg.stoppoint(i32 489, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %12 = add i32 %n.0, 1 ; <i32> [#uses=1]
+ br label %bb8
+
+bb8: ; preds = %bb, %entry
+ %n.0 = phi i32 [ 0, %entry ], [ %12, %bb ] ; <i32> [#uses=4]
+ call void @llvm.dbg.stoppoint(i32 489, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %13 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ %14 = icmp ugt i32 %13, %n.0 ; <i1> [#uses=1]
+ br i1 %14, label %bb, label %return
+
+return: ; preds = %bb8
+ call void @llvm.dbg.stoppoint(i32 489, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram747 to %0*))
+ ret void
+}
+
+define linkonce %"struct.polynomial<std::complex<double> >"* @_ZN10polynomialISt7complexIdEEaSERKS2_(%"struct.polynomial<std::complex<double> >"* %this, %"struct.polynomial<std::complex<double> >"* %source) {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram753 to %0*))
+ call void @llvm.dbg.stoppoint(i32 261, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %0 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %1 = load i32* %0, align 4 ; <i32> [#uses=1]
+ %2 = getelementptr %"struct.polynomial<std::complex<double> >"* %source, i32 0, i32 2 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ %4 = icmp eq i32 %1, %3 ; <i1> [#uses=1]
+ br i1 %4, label %bb1, label %bb
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 263, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialISt7complexIdEE7releaseEv(%"struct.polynomial<std::complex<double> >"* %this) nounwind
+ call void @llvm.dbg.stoppoint(i32 265, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %5 = getelementptr %"struct.polynomial<std::complex<double> >"* %source, i32 0, i32 2 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 4 ; <i32> [#uses=1]
+ %7 = getelementptr %"struct.polynomial<std::complex<double> >"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %6, i32* %7, align 4
+ call void @llvm.dbg.stoppoint(i32 266, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialISt7complexIdEE7acquireEv(%"struct.polynomial<std::complex<double> >"* %this)
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ call void @llvm.dbg.stoppoint(i32 269, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %8 = getelementptr %"struct.polynomial<std::complex<double> >"* %source, i32 0, i32 1 ; <%"struct.std::complex<double>"**> [#uses=1]
+ %9 = load %"struct.std::complex<double>"** %8, align 4 ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @_ZN10polynomialISt7complexIdEE9deep_copyEPKS1_(%"struct.polynomial<std::complex<double> >"* %this, %"struct.std::complex<double>"* %9) nounwind
+ call void @llvm.dbg.stoppoint(i32 271, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram753 to %0*))
+ ret %"struct.polynomial<std::complex<double> >"* %this
+}
+
+define linkonce i32 @_ZN10polynomialIdE11stretch_fftEv(%"struct.polynomial<double>"* %this) {
+entry:
+ %0 = alloca %"struct.std::allocator<char>", align 8 ; <%"struct.std::allocator<char>"*> [#uses=4]
+ %1 = alloca %"struct.std::string", align 8 ; <%"struct.std::string"*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram756 to %0*))
+ call void @llvm.dbg.stoppoint(i32 445, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb
+
+bb: ; preds = %bb1, %entry
+ %n.0 = phi i32 [ 1, %entry ], [ %5, %bb1 ] ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 449, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %2 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ %4 = icmp ugt i32 %3, %n.0 ; <i1> [#uses=1]
+ %5 = shl i32 %n.0, 1 ; <i32> [#uses=4]
+ br i1 %4, label %bb1, label %bb17
+
+bb1: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 454, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %6 = icmp eq i32 %5, 0 ; <i1> [#uses=1]
+ br i1 %6, label %bb2, label %bb
+
+bb2: ; preds = %bb1
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZNSaIcEC1Ev(%"struct.std::allocator<char>"* %0) nounwind
+ invoke void @_ZNSsC1EPKcRKSaIcE(%"struct.std::string"* %1, i8* getelementptr ([35 x i8]* @.str759, i32 0, i32 0), %"struct.std::allocator<char>"* %0)
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %bb2
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %7 = call i8* @__cxa_allocate_exception(i32 8) nounwind ; <i8*> [#uses=3]
+ %8 = bitcast i8* %7 to %"struct.std::overflow_error"* ; <%"struct.std::overflow_error"*> [#uses=1]
+ invoke void @_ZNSt14overflow_errorC1ERKSs(%"struct.std::overflow_error"* %8, %"struct.std::string"* %1)
+ to label %invcont3 unwind label %lpad23
+
+invcont3: ; preds = %invcont
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZNSsD1Ev(%"struct.std::string"* %1)
+ to label %bb11 unwind label %lpad31
+
+bb11: ; preds = %invcont3
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZNSaIcED1Ev(%"struct.std::allocator<char>"* %0) nounwind
+ call void @__cxa_throw(i8* %7, i8* bitcast (%struct.__si_class_type_info_pseudo* @_ZTISt14overflow_error to i8*), void (i8*)* bitcast (void (%"struct.std::overflow_error"*)* @_ZNSt14overflow_errorD1Ev to void (i8*)*)) noreturn
+ unreachable
+
+bb17: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 459, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %9 = getelementptr %"struct.polynomial<double>"* %this, i32 0, i32 2 ; <i32*> [#uses=1]
+ %10 = load i32* %9, align 4 ; <i32> [#uses=2]
+ %11 = sub i32 %5, %10 ; <i32> [#uses=3]
+ call void @llvm.dbg.stoppoint(i32 461, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %12 = icmp eq i32 %5, %10 ; <i1> [#uses=1]
+ br i1 %12, label %return, label %bb18
+
+bb18: ; preds = %bb17
+ call void @llvm.dbg.stoppoint(i32 462, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %13 = call %"struct.polynomial<double>"* @_ZN10polynomialIdE7stretchEj(%"struct.polynomial<double>"* %this, i32 %11) ; <%"struct.polynomial<double>"*> [#uses=0]
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram756 to %0*))
+ ret i32 %11
+
+return: ; preds = %bb17
+ call void @llvm.dbg.stoppoint(i32 464, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ ret i32 %11
+
+lpad: ; preds = %bb2
+ %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select22 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad
+
+lpad23: ; preds = %invcont
+ %eh_ptr24 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select26 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr24, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @__cxa_free_exception(i8* %7) nounwind
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZNSsD1Ev(%"struct.std::string"* %1)
+ to label %ppad unwind label %lpad27
+
+lpad27: ; preds = %lpad23
+ %eh_ptr28 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select30 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr28, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad31: ; preds = %invcont3
+ %eh_ptr32 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select34 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr32, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+ppad: ; preds = %lpad23, %lpad
+ %eh_exception.0 = phi i8* [ %eh_ptr, %lpad ], [ %eh_ptr24, %lpad23 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 455, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZNSaIcED1Ev(%"struct.std::allocator<char>"* %0) nounwind
+ call void @_Unwind_Resume(i8* %eh_exception.0)
+ unreachable
+}
+
+declare void @_ZNSaIcEC1Ev(%"struct.std::allocator<char>"*) nounwind
+
+declare void @_ZNSsC1EPKcRKSaIcE(%"struct.std::string"*, i8*, %"struct.std::allocator<char>"*)
+
+declare i8* @__cxa_allocate_exception(i32) nounwind
+
+declare void @_ZNSt14overflow_errorC1ERKSs(%"struct.std::overflow_error"*, %"struct.std::string"*)
+
+declare void @_ZNSsD1Ev(%"struct.std::string"*)
+
+declare i8* @llvm.eh.exception() nounwind
+
+declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
+
+declare void @__cxa_free_exception(i8*) nounwind
+
+declare void @_ZSt9terminatev() noreturn nounwind
+
+declare void @_ZNSaIcED1Ev(%"struct.std::allocator<char>"*) nounwind
+
+declare void @__cxa_throw(i8*, i8*, void (i8*)*) noreturn
+
+define linkonce void @_ZNSt14overflow_errorD1Ev(%"struct.std::overflow_error"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1727 to %0*))
+ call void @llvm.dbg.stoppoint(i32 134, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*))
+ %0 = getelementptr %"struct.std::overflow_error"* %this, i32 0, i32 0, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([5 x i32 (...)*]* @_ZTVSt14overflow_error, i32 0, i32 2), i32 (...)*** %0, align 4
+ %1 = getelementptr %"struct.std::overflow_error"* %this, i32 0, i32 0 ; <%"struct.std::runtime_error"*> [#uses=1]
+ call void @_ZNSt13runtime_errorD2Ev(%"struct.std::runtime_error"* %1) nounwind
+ call void @llvm.dbg.stoppoint(i32 134, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*))
+ ret void
+}
+
+declare i32 @__gxx_personality_v0(...)
+
+declare void @_Unwind_Resume(i8*)
+
+define linkonce void @_ZNSt14overflow_errorD0Ev(%"struct.std::overflow_error"* %this) nounwind {
+entry:
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1736 to %0*))
+ call void @llvm.dbg.stoppoint(i32 134, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*))
+ %0 = getelementptr %"struct.std::overflow_error"* %this, i32 0, i32 0, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ store i32 (...)** getelementptr ([5 x i32 (...)*]* @_ZTVSt14overflow_error, i32 0, i32 2), i32 (...)*** %0, align 4
+ %1 = getelementptr %"struct.std::overflow_error"* %this, i32 0, i32 0 ; <%"struct.std::runtime_error"*> [#uses=1]
+ call void @_ZNSt13runtime_errorD2Ev(%"struct.std::runtime_error"* %1) nounwind
+ call void @llvm.dbg.stoppoint(i32 134, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit770 to %0*))
+ %2 = bitcast %"struct.std::overflow_error"* %this to i8* ; <i8*> [#uses=1]
+ call void @_ZdlPv(i8* %2) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1736 to %0*))
+ ret void
+}
+
+declare i8* @_ZNKSt13runtime_error4whatEv(%"struct.std::runtime_error"*) nounwind
+
+declare void @_ZNSt13runtime_errorD2Ev(%"struct.std::runtime_error"*) nounwind
+
+define linkonce void @_ZSt13__complex_expCd(%1* noalias sret %agg.result, %1 %__z) nounwind {
+entry:
+ %0 = alloca %1, align 8 ; <%1*> [#uses=4]
+ %memtmp = alloca %1, align 8 ; <%1*> [#uses=3]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1742 to %0*))
+ call void @llvm.dbg.stoppoint(i32 730, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ call void @cexp(%1* noalias sret %memtmp, %1 %__z) nounwind
+ %1 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ %2 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %3 = load double* %2, align 8 ; <double> [#uses=1]
+ store double %3, double* %1, align 8
+ %4 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ %5 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %6 = load double* %5, align 8 ; <double> [#uses=1]
+ store double %6, double* %4, align 8
+ %7 = getelementptr %1* %agg.result, i32 0, i32 0 ; <double*> [#uses=1]
+ %8 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ %9 = load double* %8, align 8 ; <double> [#uses=1]
+ store double %9, double* %7, align 8
+ %10 = getelementptr %1* %agg.result, i32 0, i32 1 ; <double*> [#uses=1]
+ %11 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ %12 = load double* %11, align 8 ; <double> [#uses=1]
+ store double %12, double* %10, align 8
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1742 to %0*))
+ ret void
+}
+
+declare void @cexp(%1* noalias sret, %1) nounwind
+
+define linkonce void @_ZSt3expIdESt7complexIT_ERKS2_(%"struct.std::complex<double>"* noalias sret %agg.result, %"struct.std::complex<double>"* %__z) nounwind {
+entry:
+ %0 = alloca %1, align 8 ; <%1*> [#uses=3]
+ %1 = alloca %1, align 8 ; <%1*> [#uses=3]
+ %memtmp = alloca %1, align 8 ; <%1*> [#uses=3]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1746 to %0*))
+ call void @llvm.dbg.stoppoint(i32 738, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to %0*))
+ %2 = call %1* @_ZNKSt7complexIdE5__repEv(%"struct.std::complex<double>"* %__z) nounwind ; <%1*> [#uses=2]
+ %3 = getelementptr %1* %1, i32 0, i32 0 ; <double*> [#uses=1]
+ %4 = getelementptr %1* %2, i32 0, i32 0 ; <double*> [#uses=1]
+ %5 = load double* %4, align 8 ; <double> [#uses=1]
+ store double %5, double* %3, align 8
+ %6 = getelementptr %1* %1, i32 0, i32 1 ; <double*> [#uses=1]
+ %7 = getelementptr %1* %2, i32 0, i32 1 ; <double*> [#uses=1]
+ %8 = load double* %7, align 8 ; <double> [#uses=1]
+ store double %8, double* %6, align 8
+ %9 = load %1* %1, align 8 ; <%1> [#uses=1]
+ call void @_ZSt13__complex_expCd(%1* noalias sret %memtmp, %1 %9) nounwind
+ %10 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
+ %11 = getelementptr %1* %memtmp, i32 0, i32 0 ; <double*> [#uses=1]
+ %12 = load double* %11, align 8 ; <double> [#uses=1]
+ store double %12, double* %10, align 8
+ %13 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
+ %14 = getelementptr %1* %memtmp, i32 0, i32 1 ; <double*> [#uses=1]
+ %15 = load double* %14, align 8 ; <double> [#uses=1]
+ store double %15, double* %13, align 8
+ %16 = load %1* %0, align 8 ; <%1> [#uses=1]
+ call void @_ZNSt7complexIdEC1ECd(%"struct.std::complex<double>"* %agg.result, %1 %16) nounwind
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1746 to %0*))
+ ret void
+}
+
+define linkonce void @_ZN10polynomialIdE3fftERKS0_(%"struct.polynomial<std::complex<double> >"* noalias sret %agg.result, %"struct.polynomial<double>"* %poly) {
+entry:
+ %result = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=1]
+ %u = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=6]
+ %t = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=6]
+ %w = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=5]
+ %wm = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=5]
+ %0 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %1 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %memtmp20 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ %memtmp23 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ %memtmp24 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ %memtmp26 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*))
+ %2 = bitcast %"struct.polynomial<std::complex<double> >"* %result to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %2, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1751 to %0*))
+ %3 = bitcast %"struct.std::complex<double>"* %u to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %3, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1753 to %0*))
+ %4 = bitcast %"struct.std::complex<double>"* %t to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %4, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1755 to %0*))
+ %5 = bitcast %"struct.std::complex<double>"* %w to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %5, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1757 to %0*))
+ %6 = bitcast %"struct.std::complex<double>"* %wm to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %6, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1759 to %0*))
+ call void @llvm.dbg.stoppoint(i32 499, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %7 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %poly) nounwind ; <i32> [#uses=1]
+ %8 = call i32 @_ZN10polynomialIdE4log2Ej(i32 %7) nounwind ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 501, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %wm, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %w, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %t, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %u, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @llvm.dbg.stoppoint(i32 503, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE11bit_reverseERKS0_(%"struct.polynomial<std::complex<double> >"* noalias sret %agg.result, %"struct.polynomial<double>"* %poly)
+ call void @llvm.dbg.stoppoint(i32 508, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb32
+
+bb: ; preds = %bb32
+ call void @llvm.dbg.stoppoint(i32 510, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %9 = uitofp i32 %m.0 to double ; <double> [#uses=1]
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %0, double %9, double 0.000000e+00) nounwind
+ invoke void @_ZStdvIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %1, %"struct.std::complex<double>"* @_ZN10polynomialIdE4PI2IE, %"struct.std::complex<double>"* %0)
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 510, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt3expIdESt7complexIT_ERKS2_(%"struct.std::complex<double>"* noalias sret %memtmp20, %"struct.std::complex<double>"* %1) nounwind
+ %10 = getelementptr %"struct.std::complex<double>"* %wm, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %11 = getelementptr %"struct.std::complex<double>"* %memtmp20, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %12 = load double* %11, align 8 ; <double> [#uses=1]
+ store double %12, double* %10, align 8
+ %13 = getelementptr %"struct.std::complex<double>"* %wm, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %14 = getelementptr %"struct.std::complex<double>"* %memtmp20, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %15 = load double* %14, align 8 ; <double> [#uses=1]
+ store double %15, double* %13, align 8
+ call void @llvm.dbg.stoppoint(i32 511, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %16 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEaSEd(%"struct.std::complex<double>"* %w, double 1.000000e+00) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 513, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb30
+
+bb22: ; preds = %bb28
+ call void @llvm.dbg.stoppoint(i32 517, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %17 = add i32 %k.0, %m2.0 ; <i32> [#uses=1]
+ %18 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %17) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @_ZStmlIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %memtmp23, %"struct.std::complex<double>"* %w, %"struct.std::complex<double>"* %18) nounwind
+ %19 = getelementptr %"struct.std::complex<double>"* %t, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %20 = getelementptr %"struct.std::complex<double>"* %memtmp23, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %21 = load double* %20, align 8 ; <double> [#uses=1]
+ store double %21, double* %19, align 8
+ %22 = getelementptr %"struct.std::complex<double>"* %t, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %23 = getelementptr %"struct.std::complex<double>"* %memtmp23, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %24 = load double* %23, align 8 ; <double> [#uses=1]
+ store double %24, double* %22, align 8
+ call void @llvm.dbg.stoppoint(i32 518, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %25 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %k.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ %26 = getelementptr %"struct.std::complex<double>"* %u, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %27 = getelementptr %"struct.std::complex<double>"* %25, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %28 = load double* %27, align 4 ; <double> [#uses=1]
+ store double %28, double* %26, align 8
+ %29 = getelementptr %"struct.std::complex<double>"* %u, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %30 = getelementptr %"struct.std::complex<double>"* %25, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %31 = load double* %30, align 4 ; <double> [#uses=1]
+ store double %31, double* %29, align 8
+ call void @llvm.dbg.stoppoint(i32 519, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %32 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %k.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ invoke void @_ZStplIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %memtmp24, %"struct.std::complex<double>"* %u, %"struct.std::complex<double>"* %t)
+ to label %invcont25 unwind label %lpad
+
+invcont25: ; preds = %bb22
+ %33 = getelementptr %"struct.std::complex<double>"* %32, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %34 = getelementptr %"struct.std::complex<double>"* %memtmp24, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %35 = load double* %34, align 8 ; <double> [#uses=1]
+ store double %35, double* %33, align 4
+ %36 = getelementptr %"struct.std::complex<double>"* %32, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %37 = getelementptr %"struct.std::complex<double>"* %memtmp24, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %38 = load double* %37, align 8 ; <double> [#uses=1]
+ store double %38, double* %36, align 4
+ call void @llvm.dbg.stoppoint(i32 520, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %39 = add i32 %k.0, %m2.0 ; <i32> [#uses=1]
+ %40 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %39) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ invoke void @_ZStmiIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %memtmp26, %"struct.std::complex<double>"* %u, %"struct.std::complex<double>"* %t)
+ to label %invcont27 unwind label %lpad
+
+invcont27: ; preds = %invcont25
+ %41 = getelementptr %"struct.std::complex<double>"* %40, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %42 = getelementptr %"struct.std::complex<double>"* %memtmp26, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %43 = load double* %42, align 8 ; <double> [#uses=1]
+ store double %43, double* %41, align 4
+ %44 = getelementptr %"struct.std::complex<double>"* %40, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %45 = getelementptr %"struct.std::complex<double>"* %memtmp26, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %46 = load double* %45, align 8 ; <double> [#uses=1]
+ store double %46, double* %44, align 4
+ call void @llvm.dbg.stoppoint(i32 515, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %47 = add i32 %k.0, %m.0 ; <i32> [#uses=1]
+ br label %bb28
+
+bb28: ; preds = %bb30, %invcont27
+ %k.0 = phi i32 [ %47, %invcont27 ], [ %j.0, %bb30 ] ; <i32> [#uses=6]
+ call void @llvm.dbg.stoppoint(i32 515, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %48 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %poly) nounwind ; <i32> [#uses=1]
+ %49 = add i32 %48, -1 ; <i32> [#uses=1]
+ %50 = icmp ult i32 %49, %k.0 ; <i1> [#uses=1]
+ br i1 %50, label %bb29, label %bb22
+
+bb29: ; preds = %bb28
+ call void @llvm.dbg.stoppoint(i32 523, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %51 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %w, %"struct.std::complex<double>"* %wm) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 513, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %52 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %bb30
+
+bb30: ; preds = %bb29, %invcont
+ %j.0 = phi i32 [ 0, %invcont ], [ %52, %bb29 ] ; <i32> [#uses=3]
+ call void @llvm.dbg.stoppoint(i32 513, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %53 = add i32 %m2.0, -1 ; <i32> [#uses=1]
+ %54 = icmp ult i32 %53, %j.0 ; <i1> [#uses=1]
+ br i1 %54, label %bb31, label %bb28
+
+bb31: ; preds = %bb30
+ call void @llvm.dbg.stoppoint(i32 526, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %55 = shl i32 %m.0, 1 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 527, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %56 = shl i32 %m2.0, 1 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 508, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %57 = add i32 %s.0, 1 ; <i32> [#uses=1]
+ br label %bb32
+
+bb32: ; preds = %bb31, %entry
+ %m.0 = phi i32 [ 2, %entry ], [ %55, %bb31 ] ; <i32> [#uses=3]
+ %m2.0 = phi i32 [ 1, %entry ], [ %56, %bb31 ] ; <i32> [#uses=4]
+ %s.0 = phi i32 [ 0, %entry ], [ %57, %bb31 ] ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 508, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %58 = icmp ult i32 %s.0, %8 ; <i1> [#uses=1]
+ br i1 %58, label %bb, label %return
+
+return: ; preds = %bb32
+ call void @llvm.dbg.stoppoint(i32 530, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1748 to %0*))
+ ret void
+
+lpad: ; preds = %invcont25, %bb22, %bb
+ %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select40 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 530, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %agg.result)
+ to label %Unwind unwind label %lpad41
+
+lpad41: ; preds = %lpad
+ %eh_ptr42 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select44 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr42, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 530, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+Unwind: ; preds = %lpad
+ call void @_Unwind_Resume(i8* %eh_ptr)
+ unreachable
+}
+
+define linkonce void @_ZN10polynomialIdE11inverse_fftERKS_ISt7complexIdEE(%"struct.polynomial<std::complex<double> >"* noalias sret %agg.result, %"struct.polynomial<std::complex<double> >"* %poly) {
+entry:
+ %result = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=1]
+ %u = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=6]
+ %t = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=6]
+ %w = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=5]
+ %wm = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=5]
+ %0 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %1 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %2 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=2]
+ %memtmp22 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ %memtmp25 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ %memtmp26 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ %memtmp28 = alloca %"struct.std::complex<double>", align 8 ; <%"struct.std::complex<double>"*> [#uses=3]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*))
+ %3 = bitcast %"struct.polynomial<std::complex<double> >"* %result to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %3, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1774 to %0*))
+ %4 = bitcast %"struct.std::complex<double>"* %u to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %4, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1775 to %0*))
+ %5 = bitcast %"struct.std::complex<double>"* %t to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %5, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1776 to %0*))
+ %6 = bitcast %"struct.std::complex<double>"* %w to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %6, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1777 to %0*))
+ %7 = bitcast %"struct.std::complex<double>"* %wm to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %7, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1778 to %0*))
+ call void @llvm.dbg.stoppoint(i32 537, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %8 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ %9 = call i32 @_ZN10polynomialIdE4log2Ej(i32 %8) nounwind ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 539, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %wm, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %w, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %t, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %u, double 0.000000e+00, double 0.000000e+00) nounwind
+ call void @llvm.dbg.stoppoint(i32 541, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdE11bit_reverseERKS_ISt7complexIdEE(%"struct.polynomial<std::complex<double> >"* noalias sret %agg.result, %"struct.polynomial<std::complex<double> >"* %poly)
+ call void @llvm.dbg.stoppoint(i32 546, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb34
+
+bb: ; preds = %bb34
+ call void @llvm.dbg.stoppoint(i32 548, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %10 = uitofp i32 %m.0 to double ; <double> [#uses=1]
+ call void @_ZNSt7complexIdEC1Edd(%"struct.std::complex<double>"* %1, double %10, double 0.000000e+00) nounwind
+ call void @_ZStngIdESt7complexIT_ERKS2_(%"struct.std::complex<double>"* noalias sret %0, %"struct.std::complex<double>"* @_ZN10polynomialIdE4PI2IE) nounwind
+ invoke void @_ZStdvIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %2, %"struct.std::complex<double>"* %0, %"struct.std::complex<double>"* %1)
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 548, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt3expIdESt7complexIT_ERKS2_(%"struct.std::complex<double>"* noalias sret %memtmp22, %"struct.std::complex<double>"* %2) nounwind
+ %11 = getelementptr %"struct.std::complex<double>"* %wm, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %12 = getelementptr %"struct.std::complex<double>"* %memtmp22, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %13 = load double* %12, align 8 ; <double> [#uses=1]
+ store double %13, double* %11, align 8
+ %14 = getelementptr %"struct.std::complex<double>"* %wm, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %15 = getelementptr %"struct.std::complex<double>"* %memtmp22, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %16 = load double* %15, align 8 ; <double> [#uses=1]
+ store double %16, double* %14, align 8
+ call void @llvm.dbg.stoppoint(i32 549, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %17 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEaSEd(%"struct.std::complex<double>"* %w, double 1.000000e+00) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 551, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb32
+
+bb24: ; preds = %bb30
+ call void @llvm.dbg.stoppoint(i32 555, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %18 = add i32 %k.0, %m2.0 ; <i32> [#uses=1]
+ %19 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %18) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ call void @_ZStmlIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %memtmp25, %"struct.std::complex<double>"* %w, %"struct.std::complex<double>"* %19) nounwind
+ %20 = getelementptr %"struct.std::complex<double>"* %t, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %21 = getelementptr %"struct.std::complex<double>"* %memtmp25, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %22 = load double* %21, align 8 ; <double> [#uses=1]
+ store double %22, double* %20, align 8
+ %23 = getelementptr %"struct.std::complex<double>"* %t, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %24 = getelementptr %"struct.std::complex<double>"* %memtmp25, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %25 = load double* %24, align 8 ; <double> [#uses=1]
+ store double %25, double* %23, align 8
+ call void @llvm.dbg.stoppoint(i32 556, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %26 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %k.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ %27 = getelementptr %"struct.std::complex<double>"* %u, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %28 = getelementptr %"struct.std::complex<double>"* %26, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %29 = load double* %28, align 4 ; <double> [#uses=1]
+ store double %29, double* %27, align 8
+ %30 = getelementptr %"struct.std::complex<double>"* %u, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %31 = getelementptr %"struct.std::complex<double>"* %26, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %32 = load double* %31, align 4 ; <double> [#uses=1]
+ store double %32, double* %30, align 8
+ call void @llvm.dbg.stoppoint(i32 557, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %33 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %k.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ invoke void @_ZStplIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %memtmp26, %"struct.std::complex<double>"* %u, %"struct.std::complex<double>"* %t)
+ to label %invcont27 unwind label %lpad
+
+invcont27: ; preds = %bb24
+ %34 = getelementptr %"struct.std::complex<double>"* %33, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %35 = getelementptr %"struct.std::complex<double>"* %memtmp26, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %36 = load double* %35, align 8 ; <double> [#uses=1]
+ store double %36, double* %34, align 4
+ %37 = getelementptr %"struct.std::complex<double>"* %33, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %38 = getelementptr %"struct.std::complex<double>"* %memtmp26, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %39 = load double* %38, align 8 ; <double> [#uses=1]
+ store double %39, double* %37, align 4
+ call void @llvm.dbg.stoppoint(i32 558, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %40 = add i32 %k.0, %m2.0 ; <i32> [#uses=1]
+ %41 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %40) nounwind ; <%"struct.std::complex<double>"*> [#uses=2]
+ invoke void @_ZStmiIdESt7complexIT_ERKS2_S4_(%"struct.std::complex<double>"* noalias sret %memtmp28, %"struct.std::complex<double>"* %u, %"struct.std::complex<double>"* %t)
+ to label %invcont29 unwind label %lpad
+
+invcont29: ; preds = %invcont27
+ %42 = getelementptr %"struct.std::complex<double>"* %41, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %43 = getelementptr %"struct.std::complex<double>"* %memtmp28, i32 0, i32 0, i32 0 ; <double*> [#uses=1]
+ %44 = load double* %43, align 8 ; <double> [#uses=1]
+ store double %44, double* %42, align 4
+ %45 = getelementptr %"struct.std::complex<double>"* %41, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %46 = getelementptr %"struct.std::complex<double>"* %memtmp28, i32 0, i32 0, i32 1 ; <double*> [#uses=1]
+ %47 = load double* %46, align 8 ; <double> [#uses=1]
+ store double %47, double* %45, align 4
+ call void @llvm.dbg.stoppoint(i32 553, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %48 = add i32 %k.0, %m.0 ; <i32> [#uses=1]
+ br label %bb30
+
+bb30: ; preds = %bb32, %invcont29
+ %k.0 = phi i32 [ %48, %invcont29 ], [ %j.0, %bb32 ] ; <i32> [#uses=6]
+ call void @llvm.dbg.stoppoint(i32 553, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %49 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ %50 = add i32 %49, -1 ; <i32> [#uses=1]
+ %51 = icmp ult i32 %50, %k.0 ; <i1> [#uses=1]
+ br i1 %51, label %bb31, label %bb24
+
+bb31: ; preds = %bb30
+ call void @llvm.dbg.stoppoint(i32 561, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %52 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %w, %"struct.std::complex<double>"* %wm) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 551, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %53 = add i32 %j.0, 1 ; <i32> [#uses=1]
+ br label %bb32
+
+bb32: ; preds = %bb31, %invcont
+ %j.0 = phi i32 [ 0, %invcont ], [ %53, %bb31 ] ; <i32> [#uses=3]
+ call void @llvm.dbg.stoppoint(i32 551, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %54 = add i32 %m2.0, -1 ; <i32> [#uses=1]
+ %55 = icmp ult i32 %54, %j.0 ; <i1> [#uses=1]
+ br i1 %55, label %bb33, label %bb30
+
+bb33: ; preds = %bb32
+ call void @llvm.dbg.stoppoint(i32 564, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %56 = shl i32 %m.0, 1 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 565, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %57 = shl i32 %m2.0, 1 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 546, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %58 = add i32 %s.0, 1 ; <i32> [#uses=1]
+ br label %bb34
+
+bb34: ; preds = %bb33, %entry
+ %m.0 = phi i32 [ 2, %entry ], [ %56, %bb33 ] ; <i32> [#uses=3]
+ %m2.0 = phi i32 [ 1, %entry ], [ %57, %bb33 ] ; <i32> [#uses=4]
+ %s.0 = phi i32 [ 0, %entry ], [ %58, %bb33 ] ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 546, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %59 = icmp ult i32 %s.0, %9 ; <i1> [#uses=1]
+ br i1 %59, label %bb, label %bb37
+
+bb36: ; preds = %bb37
+ call void @llvm.dbg.stoppoint(i32 569, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %60 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ %61 = uitofp i32 %60 to double ; <double> [#uses=1]
+ %62 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %agg.result, i32 %j.1) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ %63 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEdVEd(%"struct.std::complex<double>"* %62, double %61) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 568, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %64 = add i32 %j.1, 1 ; <i32> [#uses=1]
+ br label %bb37
+
+bb37: ; preds = %bb36, %bb34
+ %j.1 = phi i32 [ %64, %bb36 ], [ 0, %bb34 ] ; <i32> [#uses=3]
+ call void @llvm.dbg.stoppoint(i32 568, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %65 = call i32 @_ZNK10polynomialISt7complexIdEE6degreeEv(%"struct.polynomial<std::complex<double> >"* %poly) nounwind ; <i32> [#uses=1]
+ %66 = icmp ugt i32 %65, %j.1 ; <i1> [#uses=1]
+ br i1 %66, label %bb36, label %return
+
+return: ; preds = %bb37
+ call void @llvm.dbg.stoppoint(i32 571, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1771 to %0*))
+ ret void
+
+lpad: ; preds = %invcont27, %bb24, %bb
+ %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select46 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 571, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %agg.result)
+ to label %Unwind unwind label %lpad47
+
+lpad47: ; preds = %lpad
+ %eh_ptr48 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select50 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr48, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 571, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+Unwind: ; preds = %lpad
+ call void @_Unwind_Resume(i8* %eh_ptr)
+ unreachable
+}
+
+define linkonce void @_ZNK10polynomialIdEmlERKS0_(%"struct.polynomial<double>"* noalias sret %agg.result, %"struct.polynomial<double>"* %this, %"struct.polynomial<double>"* %poly) {
+entry:
+ %result = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=1]
+ %dft2 = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=7]
+ %dft1 = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=6]
+ %a2 = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=8]
+ %a1 = alloca %"struct.polynomial<double>", align 8 ; <%"struct.polynomial<double>"*> [#uses=9]
+ %0 = alloca %"struct.polynomial<std::complex<double> >", align 8 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=4]
+ call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*))
+ %1 = bitcast %"struct.polynomial<double>"* %result to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %1, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1791 to %0*))
+ %2 = bitcast %"struct.polynomial<std::complex<double> >"* %dft2 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %2, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1795 to %0*))
+ %3 = bitcast %"struct.polynomial<std::complex<double> >"* %dft1 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %3, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1797 to %0*))
+ %4 = bitcast %"struct.polynomial<double>"* %a2 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %4, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1799 to %0*))
+ %5 = bitcast %"struct.polynomial<double>"* %a1 to %0* ; <%0*> [#uses=1]
+ call void @llvm.dbg.declare(%0* %5, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable1801 to %0*))
+ call void @llvm.dbg.stoppoint(i32 590, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdEC1ERKS0_(%"struct.polynomial<double>"* %a1, %"struct.polynomial<double>"* %this)
+ call void @llvm.dbg.stoppoint(i32 591, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdEC1ERKS0_(%"struct.polynomial<double>"* %a2, %"struct.polynomial<double>"* %poly)
+ to label %invcont unwind label %lpad
+
+invcont: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 594, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %6 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %a1) nounwind ; <i32> [#uses=1]
+ %7 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %a2) nounwind ; <i32> [#uses=1]
+ %8 = icmp ugt i32 %6, %7 ; <i1> [#uses=1]
+ br i1 %8, label %bb, label %bb26
+
+bb: ; preds = %invcont
+ call void @llvm.dbg.stoppoint(i32 595, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %9 = invoke i32 @_ZN10polynomialIdE11stretch_fftEv(%"struct.polynomial<double>"* %a1)
+ to label %invcont24 unwind label %lpad76 ; <i32> [#uses=1]
+
+invcont24: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 595, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %10 = invoke %"struct.polynomial<double>"* @_ZN10polynomialIdE7stretchEj(%"struct.polynomial<double>"* %a2, i32 %9)
+ to label %bb29 unwind label %lpad76 ; <%"struct.polynomial<double>"*> [#uses=0]
+
+bb26: ; preds = %invcont
+ call void @llvm.dbg.stoppoint(i32 597, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %11 = invoke i32 @_ZN10polynomialIdE11stretch_fftEv(%"struct.polynomial<double>"* %a2)
+ to label %invcont27 unwind label %lpad76 ; <i32> [#uses=1]
+
+invcont27: ; preds = %bb26
+ call void @llvm.dbg.stoppoint(i32 597, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %12 = invoke %"struct.polynomial<double>"* @_ZN10polynomialIdE7stretchEj(%"struct.polynomial<double>"* %a1, i32 %11)
+ to label %bb29 unwind label %lpad76 ; <%"struct.polynomial<double>"*> [#uses=0]
+
+bb29: ; preds = %invcont27, %invcont24
+ call void @llvm.dbg.stoppoint(i32 600, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdE3fftERKS0_(%"struct.polynomial<std::complex<double> >"* noalias sret %dft1, %"struct.polynomial<double>"* %a1)
+ to label %invcont30 unwind label %lpad76
+
+invcont30: ; preds = %bb29
+ call void @llvm.dbg.stoppoint(i32 601, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdE3fftERKS0_(%"struct.polynomial<std::complex<double> >"* noalias sret %dft2, %"struct.polynomial<double>"* %a2)
+ to label %invcont31 unwind label %lpad80
+
+invcont31: ; preds = %invcont30
+ call void @llvm.dbg.stoppoint(i32 604, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %13 = call i32 @_ZNK10polynomialIdE6degreeEv(%"struct.polynomial<double>"* %a1) nounwind ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 606, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ br label %bb33
+
+bb32: ; preds = %bb33
+ call void @llvm.dbg.stoppoint(i32 607, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %14 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %dft2, i32 %k15.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ %15 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %dft1, i32 %k15.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ %16 = call %"struct.std::complex<double>"* @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(%"struct.std::complex<double>"* %15, %"struct.std::complex<double>"* %14) nounwind ; <%"struct.std::complex<double>"*> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 606, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %17 = add i32 %k15.0, 1 ; <i32> [#uses=1]
+ br label %bb33
+
+bb33: ; preds = %bb32, %invcont31
+ %k15.0 = phi i32 [ 0, %invcont31 ], [ %17, %bb32 ] ; <i32> [#uses=4]
+ call void @llvm.dbg.stoppoint(i32 606, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %18 = icmp ult i32 %k15.0, %13 ; <i1> [#uses=1]
+ br i1 %18, label %bb32, label %bb34
+
+bb34: ; preds = %bb33
+ call void @llvm.dbg.stoppoint(i32 610, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdE11inverse_fftERKS_ISt7complexIdEE(%"struct.polynomial<std::complex<double> >"* noalias sret %0, %"struct.polynomial<std::complex<double> >"* %dft1)
+ to label %invcont35 unwind label %lpad84
+
+invcont35: ; preds = %bb34
+ call void @llvm.dbg.stoppoint(i32 610, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %19 = invoke %"struct.polynomial<std::complex<double> >"* @_ZN10polynomialISt7complexIdEEaSERKS2_(%"struct.polynomial<std::complex<double> >"* %dft2, %"struct.polynomial<std::complex<double> >"* %0)
+ to label %invcont36 unwind label %lpad88 ; <%"struct.polynomial<std::complex<double> >"*> [#uses=0]
+
+invcont36: ; preds = %invcont35
+ call void @llvm.dbg.stoppoint(i32 610, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %0)
+ to label %bb43 unwind label %lpad84
+
+bb43: ; preds = %invcont36
+ call void @llvm.dbg.stoppoint(i32 613, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %20 = add i32 %13, -1 ; <i32> [#uses=2]
+ call void @llvm.dbg.stoppoint(i32 614, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdEC1Ej(%"struct.polynomial<double>"* %agg.result, i32 %20)
+ to label %bb46 unwind label %lpad84
+
+bb45: ; preds = %bb46
+ call void @llvm.dbg.stoppoint(i32 617, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %21 = call double* @_ZN10polynomialIdEixEj(%"struct.polynomial<double>"* %agg.result, i32 %k.0) nounwind ; <double*> [#uses=1]
+ %22 = call %"struct.std::complex<double>"* @_ZN10polynomialISt7complexIdEEixEj(%"struct.polynomial<std::complex<double> >"* %dft2, i32 %k.0) nounwind ; <%"struct.std::complex<double>"*> [#uses=1]
+ %23 = call double* @_ZNSt7complexIdE4realEv(%"struct.std::complex<double>"* %22) nounwind ; <double*> [#uses=1]
+ %24 = load double* %23, align 8 ; <double> [#uses=1]
+ store double %24, double* %21, align 8
+ call void @llvm.dbg.stoppoint(i32 616, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %25 = add i32 %k.0, 1 ; <i32> [#uses=1]
+ br label %bb46
+
+bb46: ; preds = %bb45, %bb43
+ %k.0 = phi i32 [ %25, %bb45 ], [ 0, %bb43 ] ; <i32> [#uses=4]
+ call void @llvm.dbg.stoppoint(i32 616, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ %26 = icmp ult i32 %k.0, %20 ; <i1> [#uses=1]
+ br i1 %26, label %bb45, label %bb47
+
+bb47: ; preds = %bb46
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %dft2)
+ to label %bb54 unwind label %lpad80
+
+bb54: ; preds = %bb47
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %dft1)
+ to label %bb61 unwind label %lpad76
+
+bb61: ; preds = %bb54
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %a2)
+ to label %bb68 unwind label %lpad
+
+bb68: ; preds = %bb61
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %a1)
+ call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram1785 to %0*))
+ ret void
+
+lpad: ; preds = %bb61, %entry
+ %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select75 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad
+
+lpad76: ; preds = %bb54, %bb29, %invcont27, %bb26, %invcont24, %bb
+ %eh_ptr77 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select79 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr77, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad112
+
+lpad80: ; preds = %bb47, %invcont30
+ %eh_ptr81 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select83 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr81, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad113
+
+lpad84: ; preds = %bb43, %invcont36, %bb34
+ %eh_ptr85 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select87 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr85, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ br label %ppad114
+
+lpad88: ; preds = %invcont35
+ %eh_ptr89 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2]
+ %eh_select91 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr89, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 610, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %0)
+ to label %ppad114 unwind label %lpad92
+
+lpad92: ; preds = %lpad88
+ %eh_ptr93 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select95 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr93, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 610, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad96: ; preds = %ppad114
+ %eh_ptr97 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select99 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr97, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad100: ; preds = %ppad113
+ %eh_ptr101 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select103 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr101, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad104: ; preds = %ppad112
+ %eh_ptr105 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select107 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr105, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+lpad108: ; preds = %ppad
+ %eh_ptr109 = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
+ %eh_select111 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr109, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 1) ; <i32> [#uses=0]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ call void @_ZSt9terminatev() noreturn nounwind
+ unreachable
+
+ppad: ; preds = %ppad112, %lpad
+ %eh_exception.3 = phi i8* [ %eh_ptr, %lpad ], [ %eh_exception.2, %ppad112 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %a1)
+ to label %Unwind unwind label %lpad108
+
+ppad112: ; preds = %ppad113, %lpad76
+ %eh_exception.2 = phi i8* [ %eh_ptr77, %lpad76 ], [ %eh_exception.1, %ppad113 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialIdED1Ev(%"struct.polynomial<double>"* %a2)
+ to label %ppad unwind label %lpad104
+
+ppad113: ; preds = %ppad114, %lpad80
+ %eh_exception.1 = phi i8* [ %eh_ptr81, %lpad80 ], [ %eh_exception.0, %ppad114 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %dft1)
+ to label %ppad112 unwind label %lpad100
+
+ppad114: ; preds = %lpad88, %lpad84
+ %eh_exception.0 = phi i8* [ %eh_ptr85, %lpad84 ], [ %eh_ptr89, %lpad88 ] ; <i8*> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 620, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*))
+ invoke void @_ZN10polynomialISt7complexIdEED1Ev(%"struct.polynomial<std::complex<double> >"* %dft2)
+ to label %ppad113 unwind label %lpad96
+
+Unwind: ; preds = %ppad
+ call void @_Unwind_Resume(i8* %eh_exception.3)
+ unreachable
+}
+
+declare i32 @strcmp(i8* nocapture, i8* nocapture) nounwind readonly
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSolsEd(%"struct.std::basic_ostream<char,std::char_traits<char> >"*, double)
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(%"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8*)
+
+declare %"struct.std::basic_ostream<char,std::char_traits<char> >"* @_ZNSo5flushEv(%"struct.std::basic_ostream<char,std::char_traits<char> >"*)
+
+declare extern_weak i32 @pthread_once(i32*, void ()*)
+
+declare extern_weak i8* @pthread_getspecific(i32)
+
+declare extern_weak i32 @pthread_setspecific(i32, i8*)
+
+declare extern_weak i32 @pthread_create(i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)
+
+declare extern_weak i32 @pthread_cancel(i32)
+
+declare extern_weak i32 @pthread_mutex_lock(%struct.pthread_mutex_t*)
+
+declare extern_weak i32 @pthread_mutex_trylock(%struct.pthread_mutex_t*)
+
+declare extern_weak i32 @pthread_mutex_unlock(%struct.pthread_mutex_t*)
+
+declare extern_weak i32 @pthread_mutex_init(%struct.pthread_mutex_t*, %struct..0._50*)
+
+declare extern_weak i32 @pthread_key_create(i32*, void (i8*)*)
+
+declare extern_weak i32 @pthread_key_delete(i32)
+
+declare extern_weak i32 @pthread_mutexattr_init(%struct..0._50*)
+
+declare extern_weak i32 @pthread_mutexattr_settype(%struct..0._50*, i32)
+
+declare extern_weak i32 @pthread_mutexattr_destroy(%struct..0._50*)
+
+declare i32 @memcmp(i8* nocapture, i8* nocapture, i32) nounwind readonly
diff --git a/test/Transforms/ScalarRepl/2009-04-21-ZeroLengthMemSet.ll b/test/Transforms/ScalarRepl/2009-04-21-ZeroLengthMemSet.ll
new file mode 100644
index 000000000000..2342f05aac7f
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-04-21-ZeroLengthMemSet.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis
+; rdar://6808691
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "x86_64-apple-darwin9.0"
+ type <{ i32, i16, i8, i8, i64, i64, i16, [0 x i16] }>
+
+define i32 @foo() {
+entry:
+ %.compoundliteral = alloca %0
+ %tmp228 = getelementptr %0* %.compoundliteral, i32 0, i32 7
+ %tmp229 = bitcast [0 x i16]* %tmp228 to i8*
+ call void @llvm.memset.i64(i8* %tmp229, i8 0, i64 0, i32 2)
+ unreachable
+}
+
+declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
diff --git a/test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll b/test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll
new file mode 100644
index 000000000000..0a604e9dcc3c
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-05-08-I1Crash.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis
+; PR4146
+
+ %wrapper = type { i1 }
+
+define void @f() {
+entry:
+ %w = alloca %wrapper, align 8 ; <%wrapper*> [#uses=1]
+ %0 = getelementptr %wrapper* %w, i64 0, i32 0 ; <i1*>
+ store i1 true, i1* %0
+ ret void
+}
diff --git a/test/Transforms/ScalarRepl/2009-06-01-BitcastIntPadding.ll b/test/Transforms/ScalarRepl/2009-06-01-BitcastIntPadding.ll
new file mode 100644
index 000000000000..ffdd679355a7
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2009-06-01-BitcastIntPadding.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -scalarrepl
+; PR4286
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "x86_64-undermydesk-freebsd8.0"
+ %struct.singlebool = type <{ i8 }>
+
+define zeroext i8 @doit() nounwind {
+entry:
+ %a = alloca %struct.singlebool, align 1 ; <%struct.singlebool*> [#uses=2]
+ %storetmp.i = bitcast %struct.singlebool* %a to i1* ; <i1*> [#uses=1]
+ store i1 true, i1* %storetmp.i
+ %tmp = getelementptr %struct.singlebool* %a, i64 0, i32 0 ; <i8*> [#uses=1]
+ %tmp1 = load i8* %tmp ; <i8> [#uses=1]
+ ret i8 %tmp1
+}
+
diff --git a/test/Transforms/ScalarRepl/AggregatePromote.ll b/test/Transforms/ScalarRepl/AggregatePromote.ll
new file mode 100644
index 000000000000..104a0f989760
--- /dev/null
+++ b/test/Transforms/ScalarRepl/AggregatePromote.ll
@@ -0,0 +1,51 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: not grep alloca
+
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8.0.0"
+
+define i64 @test1(i64 %X) {
+ %A = alloca i64 ; <i64*> [#uses=3]
+ store i64 %X, i64* %A
+ %B = bitcast i64* %A to i32* ; <i32*> [#uses=1]
+ %C = bitcast i32* %B to i8* ; <i8*> [#uses=1]
+ store i8 0, i8* %C
+ %Y = load i64* %A ; <i64> [#uses=1]
+ ret i64 %Y
+}
+
+define i8 @test2(i64 %X) {
+ %X_addr = alloca i64 ; <i64*> [#uses=2]
+ store i64 %X, i64* %X_addr
+ %tmp.0 = bitcast i64* %X_addr to i32* ; <i32*> [#uses=1]
+ %tmp.1 = getelementptr i32* %tmp.0, i32 1 ; <i32*> [#uses=1]
+ %tmp.2 = bitcast i32* %tmp.1 to i8* ; <i8*> [#uses=1]
+ %tmp.3 = getelementptr i8* %tmp.2, i32 3 ; <i8*> [#uses=1]
+ %tmp.2.upgrd.1 = load i8* %tmp.3 ; <i8> [#uses=1]
+ ret i8 %tmp.2.upgrd.1
+}
+
+define i16 @crafty(i64 %X) {
+ %a = alloca { i64 } ; <{ i64 }*> [#uses=2]
+ %tmp.0 = getelementptr { i64 }* %a, i32 0, i32 0 ; <i64*> [#uses=1]
+ store i64 %X, i64* %tmp.0
+ %tmp.3 = bitcast { i64 }* %a to [4 x i16]* ; <[4 x i16]*> [#uses=2]
+ %tmp.4 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 3 ; <i16*> [#uses=1]
+ %tmp.5 = load i16* %tmp.4 ; <i16> [#uses=1]
+ %tmp.8 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 2 ; <i16*> [#uses=1]
+ %tmp.9 = load i16* %tmp.8 ; <i16> [#uses=1]
+ %tmp.10 = or i16 %tmp.9, %tmp.5 ; <i16> [#uses=1]
+ ret i16 %tmp.10
+}
+
+define i16 @crafty2(i64 %X) {
+ %a = alloca i64 ; <i64*> [#uses=2]
+ store i64 %X, i64* %a
+ %tmp.3 = bitcast i64* %a to [4 x i16]* ; <[4 x i16]*> [#uses=2]
+ %tmp.4 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 3 ; <i16*> [#uses=1]
+ %tmp.5 = load i16* %tmp.4 ; <i16> [#uses=1]
+ %tmp.8 = getelementptr [4 x i16]* %tmp.3, i32 0, i32 2 ; <i16*> [#uses=1]
+ %tmp.9 = load i16* %tmp.8 ; <i16> [#uses=1]
+ %tmp.10 = or i16 %tmp.9, %tmp.5 ; <i16> [#uses=1]
+ ret i16 %tmp.10
+}
diff --git a/test/Transforms/ScalarRepl/DifferingTypes.ll b/test/Transforms/ScalarRepl/DifferingTypes.ll
new file mode 100644
index 000000000000..c0604142df89
--- /dev/null
+++ b/test/Transforms/ScalarRepl/DifferingTypes.ll
@@ -0,0 +1,15 @@
+; This is a feature test. Hopefully one day this will be implemented. The
+; generated code should perform the appropriate masking operations required
+; depending on the endianness of the target...
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: not grep alloca
+
+define i32 @testfunc(i32 %i, i8 %j) {
+ %I = alloca i32 ; <i32*> [#uses=3]
+ store i32 %i, i32* %I
+ %P = bitcast i32* %I to i8* ; <i8*> [#uses=1]
+ store i8 %j, i8* %P
+ %t = load i32* %I ; <i32> [#uses=1]
+ ret i32 %t
+}
+
diff --git a/test/Transforms/ScalarRepl/arraytest.ll b/test/Transforms/ScalarRepl/arraytest.ll
new file mode 100644
index 000000000000..911a8e38c087
--- /dev/null
+++ b/test/Transforms/ScalarRepl/arraytest.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -scalarrepl -mem2reg | llvm-dis | not grep alloca
+
+define i32 @test() {
+ %X = alloca [4 x i32] ; <[4 x i32]*> [#uses=1]
+ %Y = getelementptr [4 x i32]* %X, i64 0, i64 0 ; <i32*> [#uses=2]
+ store i32 0, i32* %Y
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/ScalarRepl/badarray.ll b/test/Transforms/ScalarRepl/badarray.ll
new file mode 100644
index 000000000000..c48848630564
--- /dev/null
+++ b/test/Transforms/ScalarRepl/badarray.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | not grep alloca
+; PR3466
+
+define i32 @test() {
+ %X = alloca [4 x i32] ; <[4 x i32]*> [#uses=1]
+ ; Off end of array!
+ %Y = getelementptr [4 x i32]* %X, i64 0, i64 6 ; <i32*> [#uses=2]
+ store i32 0, i32* %Y
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
+
+define i32 @test2() nounwind {
+entry:
+ %yx2.i = alloca float, align 4 ; <float*> [#uses=1]
+ %yx26.i = bitcast float* %yx2.i to i64* ; <i64*> [#uses=1]
+ %0 = load i64* %yx26.i, align 8 ; <i64> [#uses=0]
+ unreachable
+}
diff --git a/test/Transforms/ScalarRepl/basictest.ll b/test/Transforms/ScalarRepl/basictest.ll
new file mode 100644
index 000000000000..11a1d51a9676
--- /dev/null
+++ b/test/Transforms/ScalarRepl/basictest.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -scalarrepl -mem2reg | llvm-dis | not grep alloca
+
+define i32 @test() {
+ %X = alloca { i32, float } ; <{ i32, float }*> [#uses=1]
+ %Y = getelementptr { i32, float }* %X, i64 0, i32 0 ; <i32*> [#uses=2]
+ store i32 0, i32* %Y
+ %Z = load i32* %Y ; <i32> [#uses=1]
+ ret i32 %Z
+}
+
diff --git a/test/Transforms/ScalarRepl/bitfield-sroa.ll b/test/Transforms/ScalarRepl/bitfield-sroa.ll
new file mode 100644
index 000000000000..34dd120e3f8f
--- /dev/null
+++ b/test/Transforms/ScalarRepl/bitfield-sroa.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+; rdar://6532315
+%t = type { { i32, i16, i8, i8 } }
+
+define i8 @foo(i64 %A) {
+ %ALL = alloca %t, align 8
+ %tmp59172 = bitcast %t* %ALL to i64*
+ store i64 %A, i64* %tmp59172, align 8
+ %C = getelementptr %t* %ALL, i32 0, i32 0, i32 1
+ %D = bitcast i16* %C to i32*
+ %E = load i32* %D, align 4
+ %F = bitcast %t* %ALL to i8*
+ %G = load i8* %F, align 8
+ ret i8 %G
+}
+
diff --git a/test/Transforms/ScalarRepl/copy-aggregate.ll b/test/Transforms/ScalarRepl/copy-aggregate.ll
new file mode 100644
index 000000000000..4ab17ae2bbb9
--- /dev/null
+++ b/test/Transforms/ScalarRepl/copy-aggregate.ll
@@ -0,0 +1,57 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+; PR3290
+
+;; Store of integer to whole alloca struct.
+define i32 @test1(i64 %V) nounwind {
+ %X = alloca {{i32, i32}}
+ %Y = bitcast {{i32,i32}}* %X to i64*
+ store i64 %V, i64* %Y
+
+ %A = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 0
+ %B = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 1
+ %a = load i32* %A
+ %b = load i32* %B
+ %c = add i32 %a, %b
+ ret i32 %c
+}
+
+;; Store of integer to whole struct/array alloca.
+define float @test2(i128 %V) nounwind {
+ %X = alloca {[4 x float]}
+ %Y = bitcast {[4 x float]}* %X to i128*
+ store i128 %V, i128* %Y
+
+ %A = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 0
+ %B = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 3
+ %a = load float* %A
+ %b = load float* %B
+ %c = add float %a, %b
+ ret float %c
+}
+
+;; Load of whole alloca struct as integer
+define i64 @test3(i32 %a, i32 %b) nounwind {
+ %X = alloca {{i32, i32}}
+
+ %A = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 0
+ %B = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 1
+ store i32 %a, i32* %A
+ store i32 %b, i32* %B
+
+ %Y = bitcast {{i32,i32}}* %X to i64*
+ %Z = load i64* %Y
+ ret i64 %Z
+}
+
+;; load of integer from whole struct/array alloca.
+define i128 @test4(float %a, float %b) nounwind {
+ %X = alloca {[4 x float]}
+ %A = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 0
+ %B = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 3
+ store float %a, float* %A
+ store float %b, float* %B
+
+ %Y = bitcast {[4 x float]}* %X to i128*
+ %V = load i128* %Y
+ ret i128 %V
+}
diff --git a/test/Transforms/ScalarRepl/debuginfo.ll b/test/Transforms/ScalarRepl/debuginfo.ll
new file mode 100644
index 000000000000..63ecd687ac5b
--- /dev/null
+++ b/test/Transforms/ScalarRepl/debuginfo.ll
@@ -0,0 +1,105 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+ %struct.Sphere = type { %struct.Vec }
+ %struct.Vec = type { i32, i32, i32 }
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str = internal constant [6 x i8] c"r.cpp\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str3 = internal constant [4 x i8] c"Vec\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@.str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str6 = internal constant [2 x i8] c"y\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype7 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 32, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str8 = internal constant [2 x i8] c"z\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype9 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 64, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype10 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype11 = internal constant %llvm.dbg.derivedtype.type { i32 458790, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 96, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype12 = internal constant %llvm.dbg.derivedtype.type { i32 458768, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype11 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype10 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+@llvm.dbg.composite13 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite13 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array14 = internal constant [5 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype10 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+@llvm.dbg.composite15 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array14 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram16 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite15 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array17 = internal constant [5 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype7 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+@llvm.dbg.composite18 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, i64 96, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array17 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype19 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array20 = internal constant [5 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array20 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str21 = internal constant [13 x i8] c"__comp_ctor \00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+@.str22 = internal constant [14 x i8] c"_ZN3VecC1Eiii\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@llvm.dbg.array32 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+@llvm.dbg.composite33 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array32 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str34 = internal constant [10 x i8] c"operator-\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str35 = internal constant [14 x i8] c"_ZmiRK3VecS1_\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+@.str41 = internal constant [7 x i8] c"Sphere\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str43 = internal constant [7 x i8] c"center\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype44 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str43, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 14, i64 96, i64 32, i64 0, i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.derivedtype45 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array46 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype45 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+@llvm.dbg.composite47 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array46 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@.str48 = internal constant [11 x i8] c"ray_sphere\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+@.str49 = internal constant [30 x i8] c"_ZN6Sphere10ray_sphereERK3Vec\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+@llvm.dbg.subprogram50 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 16, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite47 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.array51 = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype44 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram50 to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
+@llvm.dbg.composite52 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str41, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, i64 96, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array51 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.derivedtype53 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@llvm.dbg.array54 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype53 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+@llvm.dbg.composite55 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array54 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprogram56 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 16, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite55 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str61 = internal constant [2 x i8] c"v\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable62 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*), i8* getelementptr ([2 x i8]* @.str61, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 17, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
+
+define i32 @_ZN6Sphere10ray_sphereERK3Vec(%struct.Sphere* %this, %struct.Vec* %Orig) nounwind {
+entry:
+ %v = alloca %struct.Vec, align 8 ; <%struct.Vec*> [#uses=4]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*))
+ %0 = bitcast %struct.Vec* %v to { }* ; <{ }*> [#uses=1]
+ call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable62 to { }*))
+ %1 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 2 ; <i32*> [#uses=1]
+ %2 = load i32* %1, align 4 ; <i32> [#uses=1]
+ %3 = getelementptr %struct.Vec* %Orig, i32 0, i32 2 ; <i32*> [#uses=1]
+ %4 = load i32* %3, align 4 ; <i32> [#uses=1]
+ %5 = sub i32 %2, %4 ; <i32> [#uses=1]
+ %6 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %7 = load i32* %6, align 4 ; <i32> [#uses=1]
+ %8 = getelementptr %struct.Vec* %Orig, i32 0, i32 1 ; <i32*> [#uses=1]
+ %9 = load i32* %8, align 4 ; <i32> [#uses=1]
+ %10 = sub i32 %7, %9 ; <i32> [#uses=1]
+ %11 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %12 = load i32* %11, align 4 ; <i32> [#uses=1]
+ %13 = getelementptr %struct.Vec* %Orig, i32 0, i32 0 ; <i32*> [#uses=1]
+ %14 = load i32* %13, align 4 ; <i32> [#uses=1]
+ %15 = sub i32 %12, %14 ; <i32> [#uses=1]
+ %16 = getelementptr %struct.Vec* %v, i32 0, i32 0 ; <i32*> [#uses=2]
+ store i32 %15, i32* %16, align 8
+ %17 = getelementptr %struct.Vec* %v, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 %10, i32* %17, align 4
+ %18 = getelementptr %struct.Vec* %v, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 %5, i32* %18, align 8
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
+ call void @llvm.dbg.stoppoint(i32 9, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
+ %19 = load i32* %16, align 8 ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 18, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*))
+ ret i32 %19
+}
diff --git a/test/Transforms/ScalarRepl/dg.exp b/test/Transforms/ScalarRepl/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/ScalarRepl/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/ScalarRepl/load-store-aggregate.ll b/test/Transforms/ScalarRepl/load-store-aggregate.ll
new file mode 100644
index 000000000000..df13db739f55
--- /dev/null
+++ b/test/Transforms/ScalarRepl/load-store-aggregate.ll
@@ -0,0 +1,30 @@
+; This testcase shows that scalarrepl is able to replace struct alloca's which
+; are directly loaded from or stored to (using the first class aggregates
+; feature).
+
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis > %t
+; RUN: cat %t | not grep alloca
+
+%struct.foo = type { i32, i32 }
+
+define i32 @test(%struct.foo* %P) {
+entry:
+ %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
+ %V = load %struct.foo* %P
+ store %struct.foo %V, %struct.foo* %L
+
+ %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp5 = load i32* %tmp4 ; <i32> [#uses=1]
+ ret i32 %tmp5
+}
+
+define %struct.foo @test2(i32 %A, i32 %B) {
+entry:
+ %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
+ %L.0 = getelementptr %struct.foo* %L, i32 0, i32 0
+ store i32 %A, i32* %L.0
+ %L.1 = getelementptr %struct.foo* %L, i32 0, i32 1
+ store i32 %B, i32* %L.1
+ %V = load %struct.foo* %L
+ ret %struct.foo %V
+}
diff --git a/test/Transforms/ScalarRepl/memcpy-from-global.ll b/test/Transforms/ScalarRepl/memcpy-from-global.ll
new file mode 100644
index 000000000000..ee77e1fdeb7e
--- /dev/null
+++ b/test/Transforms/ScalarRepl/memcpy-from-global.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep {call.*memcpy}
+@C.0.1248 = internal constant [128 x float] [ float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float -1.000000e+00, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00 ], align 32 ; <[128 x float]*> [#uses=1]
+
+define float @grad4(i32 %hash, float %x, float %y, float %z, float %w) {
+entry:
+ %lookupTable = alloca [128 x float], align 16 ; <[128 x float]*> [#uses=5]
+ %lookupTable1 = bitcast [128 x float]* %lookupTable to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %lookupTable1, i8* bitcast ([128 x float]* @C.0.1248 to i8*), i32 512, i32 16 )
+ %tmp3 = shl i32 %hash, 2 ; <i32> [#uses=1]
+ %tmp5 = and i32 %tmp3, 124 ; <i32> [#uses=4]
+ %tmp753 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp5 ; <float*> [#uses=1]
+ %tmp9 = load float* %tmp753 ; <float> [#uses=1]
+ %tmp11 = mul float %tmp9, %x ; <float> [#uses=1]
+ %tmp13 = add float %tmp11, 0.000000e+00 ; <float> [#uses=1]
+ %tmp17.sum52 = or i32 %tmp5, 1 ; <i32> [#uses=1]
+ %tmp1851 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp17.sum52 ; <float*> [#uses=1]
+ %tmp19 = load float* %tmp1851 ; <float> [#uses=1]
+ %tmp21 = mul float %tmp19, %y ; <float> [#uses=1]
+ %tmp23 = add float %tmp21, %tmp13 ; <float> [#uses=1]
+ %tmp27.sum50 = or i32 %tmp5, 2 ; <i32> [#uses=1]
+ %tmp2849 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp27.sum50 ; <float*> [#uses=1]
+ %tmp29 = load float* %tmp2849 ; <float> [#uses=1]
+ %tmp31 = mul float %tmp29, %z ; <float> [#uses=1]
+ %tmp33 = add float %tmp31, %tmp23 ; <float> [#uses=1]
+ %tmp37.sum48 = or i32 %tmp5, 3 ; <i32> [#uses=1]
+ %tmp3847 = getelementptr [128 x float]* %lookupTable, i32 0, i32 %tmp37.sum48 ; <float*> [#uses=1]
+ %tmp39 = load float* %tmp3847 ; <float> [#uses=1]
+ %tmp41 = mul float %tmp39, %w ; <float> [#uses=1]
+ %tmp43 = add float %tmp41, %tmp33 ; <float> [#uses=1]
+ ret float %tmp43
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
diff --git a/test/Transforms/ScalarRepl/memset-aggregate-byte-leader.ll b/test/Transforms/ScalarRepl/memset-aggregate-byte-leader.ll
new file mode 100644
index 000000000000..91d8ea900717
--- /dev/null
+++ b/test/Transforms/ScalarRepl/memset-aggregate-byte-leader.ll
@@ -0,0 +1,23 @@
+; PR1226
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: not grep {call void @llvm.memcpy.i32}
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep getelementptr
+; END.
+
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8.8.0"
+ %struct.foo = type { i8, i8 }
+
+
+define i32 @test1(%struct.foo* %P) {
+entry:
+ %L = alloca %struct.foo, align 2 ; <%struct.foo*> [#uses=1]
+ %L2 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i8*> [#uses=2]
+ %tmp13 = getelementptr %struct.foo* %P, i32 0, i32 0 ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %L2, i8* %tmp13, i32 2, i32 1 )
+ %tmp5 = load i8* %L2 ; <i8> [#uses=1]
+ %tmp56 = sext i8 %tmp5 to i32 ; <i32> [#uses=1]
+ ret i32 %tmp56
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
diff --git a/test/Transforms/ScalarRepl/memset-aggregate.ll b/test/Transforms/ScalarRepl/memset-aggregate.ll
new file mode 100644
index 000000000000..b7b33521bbce
--- /dev/null
+++ b/test/Transforms/ScalarRepl/memset-aggregate.ll
@@ -0,0 +1,66 @@
+; PR1226
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {ret i32 16843009}
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | grep {ret i16 514}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "i686-apple-darwin8"
+ %struct.bar = type { %struct.foo, i64, double }
+ %struct.foo = type { i32, i32 }
+
+
+define i32 @test1(%struct.foo* %P) {
+entry:
+ %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
+ %L2 = bitcast %struct.foo* %L to i8* ; <i8*> [#uses=1]
+ %tmp13 = bitcast %struct.foo* %P to i8* ; <i8*> [#uses=1]
+ call void @llvm.memcpy.i32( i8* %L2, i8* %tmp13, i32 8, i32 4 )
+ %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp5 = load i32* %tmp4 ; <i32> [#uses=1]
+ ret i32 %tmp5
+}
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+define i32 @test2() {
+entry:
+ %L = alloca [4 x %struct.foo], align 16 ; <[4 x %struct.foo]*> [#uses=2]
+ %L12 = bitcast [4 x %struct.foo]* %L to i8* ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %L12, i8 0, i32 32, i32 16 )
+ %tmp4 = getelementptr [4 x %struct.foo]* %L, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp5 = load i32* %tmp4 ; <i32> [#uses=1]
+ ret i32 %tmp5
+}
+
+declare void @llvm.memset.i32(i8*, i8, i32, i32)
+
+define i32 @test3() {
+entry:
+ %B = alloca %struct.bar, align 16 ; <%struct.bar*> [#uses=4]
+ %B1 = bitcast %struct.bar* %B to i8* ; <i8*> [#uses=1]
+ call void @llvm.memset.i32( i8* %B1, i8 1, i32 24, i32 16 )
+ %tmp3 = getelementptr %struct.bar* %B, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp3
+ %tmp4 = getelementptr %struct.bar* %B, i32 0, i32 2 ; <double*> [#uses=1]
+ store double 1.000000e+01, double* %tmp4
+ %tmp6 = getelementptr %struct.bar* %B, i32 0, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp7 = load i32* %tmp6 ; <i32> [#uses=1]
+ ret i32 %tmp7
+}
+
+
+ %struct.f = type { i32, i32, i32, i32, i32, i32 }
+
+define i16 @test4() nounwind {
+entry:
+ %A = alloca %struct.f, align 8 ; <%struct.f*> [#uses=3]
+ %0 = getelementptr %struct.f* %A, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %0, align 8
+ %1 = getelementptr %struct.f* %A, i32 0, i32 1 ; <i32*> [#uses=1]
+ %2 = bitcast i32* %1 to i8* ; <i8*> [#uses=1]
+ call void @llvm.memset.i32(i8* %2, i8 2, i32 12, i32 4)
+ %3 = getelementptr %struct.f* %A, i32 0, i32 2 ; <i32*> [#uses=1]
+ %4 = load i32* %3, align 8 ; <i32> [#uses=1]
+ %retval12 = trunc i32 %4 to i16 ; <i16> [#uses=1]
+ ret i16 %retval12
+}
diff --git a/test/Transforms/ScalarRepl/not-a-vector.ll b/test/Transforms/ScalarRepl/not-a-vector.ll
new file mode 100644
index 000000000000..e2111e7b31c2
--- /dev/null
+++ b/test/Transforms/ScalarRepl/not-a-vector.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep {7 x double}
+; RUN: llvm-as < %s | opt -scalarrepl -instcombine | llvm-dis | grep {ret double %B}
+
+define double @test(double %A, double %B) {
+ %ARR = alloca [7 x i64]
+ %C = bitcast [7 x i64]* %ARR to double*
+ store double %A, double* %C
+
+ %D = getelementptr [7 x i64]* %ARR, i32 0, i32 4
+ %E = bitcast i64* %D to double*
+ store double %B, double* %E
+
+ %F = getelementptr double* %C, i32 4
+ %G = load double* %F
+ ret double %G
+}
+
+
diff --git a/test/Transforms/ScalarRepl/phinodepromote.ll b/test/Transforms/ScalarRepl/phinodepromote.ll
new file mode 100644
index 000000000000..4eb8743bd1cf
--- /dev/null
+++ b/test/Transforms/ScalarRepl/phinodepromote.ll
@@ -0,0 +1,34 @@
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine -mem2reg | llvm-dis | not grep alloca
+;
+; This tests to see if mem2reg can promote alloca instructions whose addresses
+; are used by PHI nodes that are immediately loaded. The LLVM C++ front-end
+; often generates code that looks like this (when it codegen's ?: exprs as
+; lvalues), so handling this simple extension is quite useful.
+;
+; This testcase is what the following program looks like when it reaches
+; instcombine:
+;
+; template<typename T>
+; const T& max(const T& a1, const T& a2) { return a1 < a2 ? a1 : a2; }
+; int main() { return max(0, 1); }
+;
+; This test checks to make sure the combination of instcombine and mem2reg
+; perform the transformation.
+
+define i32 @main() {
+entry:
+ %mem_tmp.0 = alloca i32 ; <i32*> [#uses=3]
+ %mem_tmp.1 = alloca i32 ; <i32*> [#uses=3]
+ store i32 0, i32* %mem_tmp.0
+ store i32 1, i32* %mem_tmp.1
+ %tmp.1.i = load i32* %mem_tmp.1 ; <i32> [#uses=1]
+ %tmp.3.i = load i32* %mem_tmp.0 ; <i32> [#uses=1]
+ %tmp.4.i = icmp sle i32 %tmp.1.i, %tmp.3.i ; <i1> [#uses=1]
+ br i1 %tmp.4.i, label %cond_true.i, label %cond_continue.i
+cond_true.i: ; preds = %entry
+ br label %cond_continue.i
+cond_continue.i: ; preds = %cond_true.i, %entry
+ %mem_tmp.i.0 = phi i32* [ %mem_tmp.1, %cond_true.i ], [ %mem_tmp.0, %entry ] ; <i32*> [#uses=1]
+ %tmp.3 = load i32* %mem_tmp.i.0 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
diff --git a/test/Transforms/ScalarRepl/select_promote.ll b/test/Transforms/ScalarRepl/select_promote.ll
new file mode 100644
index 000000000000..901fa90dc96d
--- /dev/null
+++ b/test/Transforms/ScalarRepl/select_promote.ll
@@ -0,0 +1,18 @@
+; Test promotion of loads that use the result of a select instruction. This
+; should be simplified by the instcombine pass.
+
+; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | not grep alloca
+
+define i32 @main() {
+ %mem_tmp.0 = alloca i32 ; <i32*> [#uses=3]
+ %mem_tmp.1 = alloca i32 ; <i32*> [#uses=3]
+ store i32 0, i32* %mem_tmp.0
+ store i32 1, i32* %mem_tmp.1
+ %tmp.1.i = load i32* %mem_tmp.1 ; <i32> [#uses=1]
+ %tmp.3.i = load i32* %mem_tmp.0 ; <i32> [#uses=1]
+ %tmp.4.i = icmp sle i32 %tmp.1.i, %tmp.3.i ; <i1> [#uses=1]
+ %mem_tmp.i.0 = select i1 %tmp.4.i, i32* %mem_tmp.1, i32* %mem_tmp.0 ; <i32*> [#uses=1]
+ %tmp.3 = load i32* %mem_tmp.i.0 ; <i32> [#uses=1]
+ ret i32 %tmp.3
+}
+
diff --git a/test/Transforms/ScalarRepl/sroa-fca.ll b/test/Transforms/ScalarRepl/sroa-fca.ll
new file mode 100644
index 000000000000..1bfdaccc0d8d
--- /dev/null
+++ b/test/Transforms/ScalarRepl/sroa-fca.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis
+; Make sure that SROA "scalar conversion" can handle first class aggregates.
+
+define i64 @test({i32, i32} %A) {
+ %X = alloca i64
+ %Y = bitcast i64* %X to {i32,i32}*
+ store {i32,i32} %A, {i32,i32}* %Y
+
+ %Q = load i64* %X
+ ret i64 %Q
+}
+
+define {i32,i32} @test2(i64 %A) {
+ %X = alloca i64
+ %Y = bitcast i64* %X to {i32,i32}*
+ store i64 %A, i64* %X
+
+ %Q = load {i32,i32}* %Y
+ ret {i32,i32} %Q
+}
+
diff --git a/test/Transforms/ScalarRepl/sroa_two.ll b/test/Transforms/ScalarRepl/sroa_two.ll
new file mode 100644
index 000000000000..e0ea2bc93fec
--- /dev/null
+++ b/test/Transforms/ScalarRepl/sroa_two.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis
+
+define i32 @test(i32 %X) {
+ %Arr = alloca [2 x i32] ; <[2 x i32]*> [#uses=3]
+ %tmp.0 = getelementptr [2 x i32]* %Arr, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp.0
+ %tmp.1 = getelementptr [2 x i32]* %Arr, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 2, i32* %tmp.1
+ %tmp.3 = getelementptr [2 x i32]* %Arr, i32 0, i32 %X ; <i32*> [#uses=1]
+ %tmp.4 = load i32* %tmp.3 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+}
+
diff --git a/test/Transforms/ScalarRepl/union-fp-int.ll b/test/Transforms/ScalarRepl/union-fp-int.ll
new file mode 100644
index 000000000000..1c3b18b4a1e1
--- /dev/null
+++ b/test/Transforms/ScalarRepl/union-fp-int.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: not grep alloca
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: grep {bitcast.*float.*i32}
+
+define i32 @test(float %X) {
+ %X_addr = alloca float ; <float*> [#uses=2]
+ store float %X, float* %X_addr
+ %X_addr.upgrd.1 = bitcast float* %X_addr to i32* ; <i32*> [#uses=1]
+ %tmp = load i32* %X_addr.upgrd.1 ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
diff --git a/test/Transforms/ScalarRepl/union-packed.ll b/test/Transforms/ScalarRepl/union-packed.ll
new file mode 100644
index 000000000000..10d8a5d7ac4b
--- /dev/null
+++ b/test/Transforms/ScalarRepl/union-packed.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: not grep alloca
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: grep bitcast
+
+define <4 x i32> @test(<4 x float> %X) {
+ %X_addr = alloca <4 x float> ; <<4 x float>*> [#uses=2]
+ store <4 x float> %X, <4 x float>* %X_addr
+ %X_addr.upgrd.1 = bitcast <4 x float>* %X_addr to <4 x i32>* ; <<4 x i32>*> [#uses=1]
+ %tmp = load <4 x i32>* %X_addr.upgrd.1 ; <<4 x i32>> [#uses=1]
+ ret <4 x i32> %tmp
+}
+
diff --git a/test/Transforms/ScalarRepl/union-pointer.ll b/test/Transforms/ScalarRepl/union-pointer.ll
new file mode 100644
index 000000000000..269b4b9ff52e
--- /dev/null
+++ b/test/Transforms/ScalarRepl/union-pointer.ll
@@ -0,0 +1,41 @@
+; PR892
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
+; RUN: not grep alloca
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {ret i8}
+
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8.7.2"
+ %struct.Val = type { i32*, i32 }
+
+define i8* @test(i16* %X) {
+ %X_addr = alloca i16* ; <i16**> [#uses=2]
+ store i16* %X, i16** %X_addr
+ %X_addr.upgrd.1 = bitcast i16** %X_addr to i8** ; <i8**> [#uses=1]
+ %tmp = load i8** %X_addr.upgrd.1 ; <i8*> [#uses=1]
+ ret i8* %tmp
+}
+
+define void @test2(i64 %Op.0) {
+ %tmp = alloca %struct.Val, align 8 ; <%struct.Val*> [#uses=3]
+ %tmp1 = alloca %struct.Val, align 8 ; <%struct.Val*> [#uses=3]
+ %tmp.upgrd.2 = call i64 @_Z3foov( ) ; <i64> [#uses=1]
+ %tmp1.upgrd.3 = bitcast %struct.Val* %tmp1 to i64* ; <i64*> [#uses=1]
+ store i64 %tmp.upgrd.2, i64* %tmp1.upgrd.3
+ %tmp.upgrd.4 = getelementptr %struct.Val* %tmp, i32 0, i32 0 ; <i32**> [#uses=1]
+ %tmp2 = getelementptr %struct.Val* %tmp1, i32 0, i32 0 ; <i32**> [#uses=1]
+ %tmp.upgrd.5 = load i32** %tmp2 ; <i32*> [#uses=1]
+ store i32* %tmp.upgrd.5, i32** %tmp.upgrd.4
+ %tmp3 = getelementptr %struct.Val* %tmp, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp4 = getelementptr %struct.Val* %tmp1, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.upgrd.6 = load i32* %tmp4 ; <i32> [#uses=1]
+ store i32 %tmp.upgrd.6, i32* %tmp3
+ %tmp7 = bitcast %struct.Val* %tmp to { i64 }* ; <{ i64 }*> [#uses=1]
+ %tmp8 = getelementptr { i64 }* %tmp7, i32 0, i32 0 ; <i64*> [#uses=1]
+ %tmp9 = load i64* %tmp8 ; <i64> [#uses=1]
+ call void @_Z3bar3ValS_( i64 %Op.0, i64 %tmp9 )
+ ret void
+}
+
+declare i64 @_Z3foov()
+
+declare void @_Z3bar3ValS_(i64, i64)
diff --git a/test/Transforms/ScalarRepl/vector_memcpy.ll b/test/Transforms/ScalarRepl/vector_memcpy.ll
new file mode 100644
index 000000000000..56785788ff9a
--- /dev/null
+++ b/test/Transforms/ScalarRepl/vector_memcpy.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis > %t
+; RUN: grep {ret <16 x float> %A} %t
+; RUN: grep {ret <16 x float> zeroinitializer} %t
+
+define <16 x float> @foo(<16 x float> %A) nounwind {
+ %tmp = alloca <16 x float>, align 16
+ %tmp2 = alloca <16 x float>, align 16
+ store <16 x float> %A, <16 x float>* %tmp
+ %s = bitcast <16 x float>* %tmp to i8*
+ %s2 = bitcast <16 x float>* %tmp2 to i8*
+ call void @llvm.memcpy.i64(i8* %s2, i8* %s, i64 64, i32 16)
+
+ %R = load <16 x float>* %tmp2
+ ret <16 x float> %R
+}
+
+define <16 x float> @foo2(<16 x float> %A) nounwind {
+ %tmp2 = alloca <16 x float>, align 16
+
+ %s2 = bitcast <16 x float>* %tmp2 to i8*
+ call void @llvm.memset.i64(i8* %s2, i8 0, i64 64, i32 16)
+
+ %R = load <16 x float>* %tmp2
+ ret <16 x float> %R
+}
+
+
+declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind
+declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
diff --git a/test/Transforms/ScalarRepl/vector_promote.ll b/test/Transforms/ScalarRepl/vector_promote.ll
new file mode 100644
index 000000000000..a0d331719f06
--- /dev/null
+++ b/test/Transforms/ScalarRepl/vector_promote.ll
@@ -0,0 +1,64 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {load <4 x float>}
+
+define void @test(<4 x float>* %F, float %f) {
+entry:
+ %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3]
+ %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
+ %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp3, <4 x float>* %G
+ %G.upgrd.1 = getelementptr <4 x float>* %G, i32 0, i32 0 ; <float*> [#uses=1]
+ store float %f, float* %G.upgrd.1
+ %tmp4 = load <4 x float>* %G ; <<4 x float>> [#uses=2]
+ %tmp6 = add <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp6, <4 x float>* %F
+ ret void
+}
+
+define void @test2(<4 x float>* %F, float %f) {
+entry:
+ %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3]
+ %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
+ %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp3, <4 x float>* %G
+ %tmp.upgrd.2 = getelementptr <4 x float>* %G, i32 0, i32 2 ; <float*> [#uses=1]
+ store float %f, float* %tmp.upgrd.2
+ %tmp4 = load <4 x float>* %G ; <<4 x float>> [#uses=2]
+ %tmp6 = add <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp6, <4 x float>* %F
+ ret void
+}
+
+define void @test3(<4 x float>* %F, float* %f) {
+entry:
+ %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2]
+ %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
+ %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp3, <4 x float>* %G
+ %tmp.upgrd.3 = getelementptr <4 x float>* %G, i32 0, i32 2 ; <float*> [#uses=1]
+ %tmp.upgrd.4 = load float* %tmp.upgrd.3 ; <float> [#uses=1]
+ store float %tmp.upgrd.4, float* %f
+ ret void
+}
+
+define void @test4(<4 x float>* %F, float* %f) {
+entry:
+ %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2]
+ %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
+ %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
+ store <4 x float> %tmp3, <4 x float>* %G
+ %G.upgrd.5 = getelementptr <4 x float>* %G, i32 0, i32 0 ; <float*> [#uses=1]
+ %tmp.upgrd.6 = load float* %G.upgrd.5 ; <float> [#uses=1]
+ store float %tmp.upgrd.6, float* %f
+ ret void
+}
+
+define i32 @test5(float %X) { ;; should turn into bitcast.
+ %X_addr = alloca [4 x float]
+ %X1 = getelementptr [4 x float]* %X_addr, i32 0, i32 2
+ store float %X, float* %X1
+ %a = bitcast float* %X1 to i32*
+ %tmp = load i32* %a
+ ret i32 %tmp
+}
+
diff --git a/test/Transforms/ScalarRepl/volatile.ll b/test/Transforms/ScalarRepl/volatile.ll
new file mode 100644
index 000000000000..5f9fe0d89a5a
--- /dev/null
+++ b/test/Transforms/ScalarRepl/volatile.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {volatile load}
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {volatile store}
+
+define i32 @voltest(i32 %T) {
+ %A = alloca {i32, i32}
+ %B = getelementptr {i32,i32}* %A, i32 0, i32 0
+ volatile store i32 %T, i32* %B
+
+ %C = getelementptr {i32,i32}* %A, i32 0, i32 1
+ %X = volatile load i32* %C
+ ret i32 %X
+}
diff --git a/test/Transforms/SimplifyCFG/2002-05-05-EmptyBlockMerge.ll b/test/Transforms/SimplifyCFG/2002-05-05-EmptyBlockMerge.ll
new file mode 100644
index 000000000000..5682ff4e40df
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2002-05-05-EmptyBlockMerge.ll
@@ -0,0 +1,22 @@
+; Basic block #2 should not be merged into BB #3!
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: grep {br label}
+;
+
+declare void @foo()
+
+define void @cprop_test12(i32* %data) {
+bb0:
+ %reg108 = load i32* %data ; <i32> [#uses=2]
+ %cond218 = icmp ne i32 %reg108, 5 ; <i1> [#uses=1]
+ br i1 %cond218, label %bb3, label %bb2
+bb2: ; preds = %bb0
+ call void @foo( )
+ br label %bb3
+bb3: ; preds = %bb2, %bb0
+ %reg117 = phi i32 [ 110, %bb2 ], [ %reg108, %bb0 ] ; <i32> [#uses=1]
+ store i32 %reg117, i32* %data
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll b/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll
new file mode 100644
index 000000000000..c955d668898f
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2002-05-21-PHIElimination.ll
@@ -0,0 +1,19 @@
+; CFG Simplification is making a loop dead, then changing the add into:
+;
+; %V1 = add int %V1, 1
+;
+; Which is not valid SSA
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
+
+define void @test() {
+; <label>:0
+ br i1 true, label %end, label %Loop
+Loop: ; preds = %Loop, %0
+ %V = phi i32 [ 0, %0 ], [ %V1, %Loop ] ; <i32> [#uses=1]
+ %V1 = add i32 %V, 1 ; <i32> [#uses=1]
+ br label %Loop
+end: ; preds = %0
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/2002-06-24-PHINode.ll b/test/Transforms/SimplifyCFG/2002-06-24-PHINode.ll
new file mode 100644
index 000000000000..87b428600ba5
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2002-06-24-PHINode.ll
@@ -0,0 +1,14 @@
+; -simplifycfg is not folding blocks if there is a PHI node involved. This
+; should be fixed eventually
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define i32 @main(i32 %argc) {
+; <label>:0
+ br label %InlinedFunctionReturnNode
+InlinedFunctionReturnNode: ; preds = %0
+ %X = phi i32 [ 7, %0 ] ; <i32> [#uses=1]
+ %Y = add i32 %X, %argc ; <i32> [#uses=1]
+ ret i32 %Y
+}
+
diff --git a/test/Transforms/SimplifyCFG/2002-09-24-PHIAssertion.ll b/test/Transforms/SimplifyCFG/2002-09-24-PHIAssertion.ll
new file mode 100644
index 000000000000..75beb344a883
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2002-09-24-PHIAssertion.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -simplifycfg
+
+define i32 @test(i32 %A, i32 %B, i1 %cond) {
+J:
+ %C = add i32 %A, 12 ; <i32> [#uses=3]
+ br i1 %cond, label %L, label %L
+L: ; preds = %J, %J
+ %Q = phi i32 [ %C, %J ], [ %C, %J ] ; <i32> [#uses=1]
+ %D = add i32 %C, %B ; <i32> [#uses=1]
+ %E = add i32 %Q, %D ; <i32> [#uses=1]
+ ret i32 %E
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll b/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll
new file mode 100644
index 000000000000..c45a5c9da98c
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-03-07-DominateProblem.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+
+define void @test(i32* %ldo, i1 %c, i1 %d) {
+bb9:
+ br i1 %c, label %bb11, label %bb10
+bb10: ; preds = %bb9
+ br label %bb11
+bb11: ; preds = %bb10, %bb9
+ %reg330 = phi i32* [ null, %bb10 ], [ %ldo, %bb9 ] ; <i32*> [#uses=1]
+ br label %bb20
+bb20: ; preds = %bb20, %bb11
+ store i32* %reg330, i32** null
+ br i1 %d, label %bb20, label %done
+done: ; preds = %bb20
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll
new file mode 100644
index 000000000000..74e7428429de
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll
@@ -0,0 +1,13 @@
+; Do not remove the invoke!
+;
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+
+define i32 @test() {
+ %A = invoke i32 @test( )
+ to label %Ret unwind label %Ret2 ; <i32> [#uses=1]
+Ret: ; preds = %0
+ ret i32 %A
+Ret2: ; preds = %0
+ ret i32 undef
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-08-05-MishandleInvoke.ll b/test/Transforms/SimplifyCFG/2003-08-05-MishandleInvoke.ll
new file mode 100644
index 000000000000..9f56e07bfd62
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-08-05-MishandleInvoke.ll
@@ -0,0 +1,12 @@
+; Do not remove the invoke!
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep invoke
+
+define i32 @test() {
+ invoke i32 @test( )
+ to label %Ret unwind label %Ret ; <i32>:1 [#uses=0]
+Ret: ; preds = %0, %0
+ %A = add i32 0, 1 ; <i32> [#uses=1]
+ ret i32 %A
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll b/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll
new file mode 100644
index 000000000000..ea74692d05f7
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll
@@ -0,0 +1,22 @@
+; This test checks to make sure that 'br X, Dest, Dest' is folded into
+; 'br Dest'
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep {br i1 %c2}
+
+declare void @noop()
+
+define i32 @test(i1 %c1, i1 %c2) {
+ call void @noop( )
+ br i1 %c1, label %A, label %Y
+A: ; preds = %0
+ call void @noop( )
+ br i1 %c2, label %X, label %X
+X: ; preds = %Y, %A, %A
+ call void @noop( )
+ ret i32 0
+Y: ; preds = %0
+ call void @noop( )
+ br label %X
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll b/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
new file mode 100644
index 000000000000..a307573d3d33
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
@@ -0,0 +1,26 @@
+; This test checks to make sure that 'br X, Dest, Dest' is folded into
+; 'br Dest'. This can only happen after the 'Z' block is eliminated. This is
+; due to the fact that the SimplifyCFG function does not use
+; the ConstantFoldTerminator function.
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep {br i1 %c2}
+
+declare void @noop()
+
+define i32 @test(i1 %c1, i1 %c2) {
+ call void @noop( )
+ br i1 %c1, label %A, label %Y
+A: ; preds = %0
+ call void @noop( )
+ br i1 %c2, label %Z, label %X
+Z: ; preds = %A
+ br label %X
+X: ; preds = %Y, %Z, %A
+ call void @noop( )
+ ret i32 0
+Y: ; preds = %0
+ call void @noop( )
+ br label %X
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch-dbg.ll b/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch-dbg.ll
new file mode 100644
index 000000000000..c9f50907569a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch-dbg.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep switch
+
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+; Test folding all to same dest
+define i32 @test3(i1 %C) {
+ br i1 %C, label %Start, label %TheDest
+Start: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ switch i32 3, label %TheDest [
+ i32 0, label %TheDest
+ i32 1, label %TheDest
+ i32 2, label %TheDest
+ i32 5, label %TheDest
+ ]
+TheDest: ; preds = %Start, %Start, %Start, %Start, %Start, %0
+ ret i32 1234
+}
+
+; Test folding switch -> branch
+define i32 @test4(i32 %C) {
+ switch i32 %C, label %L1 [
+ i32 0, label %L2
+ ]
+L1: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret i32 0
+L2: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret i32 1
+}
+
+; Can fold into a cond branch!
+define i32 @test5(i32 %C) {
+ switch i32 %C, label %L1 [
+ i32 0, label %L2
+ i32 123, label %L1
+ ]
+L1: ; preds = %0, %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret i32 0
+L2: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret i32 1
+}
+
diff --git a/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll b/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll
new file mode 100644
index 000000000000..cd22e1edb15a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll
@@ -0,0 +1,80 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep switch
+
+; Test normal folding
+define i32 @test1() {
+ switch i32 5, label %Default [
+ i32 0, label %Foo
+ i32 1, label %Bar
+ i32 2, label %Baz
+ i32 5, label %TheDest
+ ]
+Default: ; preds = %0
+ ret i32 -1
+Foo: ; preds = %0
+ ret i32 -2
+Bar: ; preds = %0
+ ret i32 -3
+Baz: ; preds = %0
+ ret i32 -4
+TheDest: ; preds = %0
+ ret i32 1234
+}
+
+; Test folding to default dest
+define i32 @test2() {
+ switch i32 3, label %Default [
+ i32 0, label %Foo
+ i32 1, label %Bar
+ i32 2, label %Baz
+ i32 5, label %TheDest
+ ]
+Default: ; preds = %0
+ ret i32 1234
+Foo: ; preds = %0
+ ret i32 -2
+Bar: ; preds = %0
+ ret i32 -5
+Baz: ; preds = %0
+ ret i32 -6
+TheDest: ; preds = %0
+ ret i32 -8
+}
+
+; Test folding all to same dest
+define i32 @test3(i1 %C) {
+ br i1 %C, label %Start, label %TheDest
+Start: ; preds = %0
+ switch i32 3, label %TheDest [
+ i32 0, label %TheDest
+ i32 1, label %TheDest
+ i32 2, label %TheDest
+ i32 5, label %TheDest
+ ]
+TheDest: ; preds = %Start, %Start, %Start, %Start, %Start, %0
+ ret i32 1234
+}
+
+; Test folding switch -> branch
+define i32 @test4(i32 %C) {
+ switch i32 %C, label %L1 [
+ i32 0, label %L2
+ ]
+L1: ; preds = %0
+ ret i32 0
+L2: ; preds = %0
+ ret i32 1
+}
+
+; Can fold into a cond branch!
+define i32 @test5(i32 %C) {
+ switch i32 %C, label %L1 [
+ i32 0, label %L2
+ i32 123, label %L1
+ ]
+L1: ; preds = %0, %0
+ ret i32 0
+L2: ; preds = %0
+ ret i32 1
+}
+
diff --git a/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll b/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll
new file mode 100644
index 000000000000..de0d26245829
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll
@@ -0,0 +1,40 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+
+define void @symhash_add() {
+entry:
+ br i1 undef, label %then.0, label %UnifiedReturnBlock
+then.0: ; preds = %entry
+ br i1 undef, label %loopentry.2, label %loopentry.1.preheader
+loopentry.1.preheader: ; preds = %then.0
+ br label %loopentry.1.outer
+loopentry.1.outer: ; preds = %loopexit.1, %loopentry.1.preheader
+ br label %loopentry.1
+loopentry.1: ; preds = %endif.1, %then.4, %then.3, %then.1, %loopentry.1.outer
+ br i1 undef, label %loopexit.1, label %no_exit.1
+no_exit.1: ; preds = %loopentry.1
+ br i1 undef, label %then.1, label %else.0
+then.1: ; preds = %no_exit.1
+ br label %loopentry.1
+else.0: ; preds = %no_exit.1
+ br i1 undef, label %then.2, label %else.1
+then.2: ; preds = %else.0
+ br i1 undef, label %then.3, label %endif.1
+then.3: ; preds = %then.2
+ br label %loopentry.1
+else.1: ; preds = %else.0
+ br i1 undef, label %endif.1, label %then.4
+then.4: ; preds = %else.1
+ br label %loopentry.1
+endif.1: ; preds = %else.1, %then.2
+ br label %loopentry.1
+loopexit.1: ; preds = %loopentry.1
+ br i1 undef, label %loopentry.1.outer, label %loopentry.2
+loopentry.2: ; preds = %no_exit.2, %loopexit.1, %then.0
+ br i1 undef, label %loopexit.2, label %no_exit.2
+no_exit.2: ; preds = %loopentry.2
+ br label %loopentry.2
+loopexit.2: ; preds = %loopentry.2
+ ret void
+UnifiedReturnBlock: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/2005-06-16-PHICrash.ll b/test/Transforms/SimplifyCFG/2005-06-16-PHICrash.ll
new file mode 100644
index 000000000000..7fea2921b023
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2005-06-16-PHICrash.ll
@@ -0,0 +1,95 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; PR584
+@g_38098584 = external global i32 ; <i32*> [#uses=1]
+@g_60187400 = external global i32 ; <i32*> [#uses=1]
+@g_59182229 = external global i32 ; <i32*> [#uses=2]
+
+define i32 @_Z13func_26556482h(i8 %l_88173906) {
+entry:
+ %tmp.1 = bitcast i8 %l_88173906 to i8 ; <i8> [#uses=2]
+ %tmp.3 = icmp eq i8 %l_88173906, 0 ; <i1> [#uses=1]
+ br i1 %tmp.3, label %else.0, label %then.0
+then.0: ; preds = %entry
+ %tmp.5 = icmp eq i8 %l_88173906, 0 ; <i1> [#uses=1]
+ br i1 %tmp.5, label %else.1, label %then.1
+then.1: ; preds = %then.0
+ br label %return
+else.1: ; preds = %then.0
+ br label %loopentry.0
+loopentry.0: ; preds = %no_exit.0, %else.1
+ %i.0.1 = phi i32 [ 0, %else.1 ], [ %inc.0, %no_exit.0 ] ; <i32> [#uses=2]
+ %tmp.9 = icmp sgt i32 %i.0.1, 99 ; <i1> [#uses=1]
+ br i1 %tmp.9, label %endif.0, label %no_exit.0
+no_exit.0: ; preds = %loopentry.0
+ %inc.0 = add i32 %i.0.1, 1 ; <i32> [#uses=1]
+ br label %loopentry.0
+else.0: ; preds = %entry
+ %tmp.12 = sext i8 %tmp.1 to i32 ; <i32> [#uses=1]
+ br label %return
+endif.0: ; preds = %loopentry.0
+ %tmp.14 = sext i8 %tmp.1 to i32 ; <i32> [#uses=1]
+ %tmp.16 = zext i8 %l_88173906 to i32 ; <i32> [#uses=1]
+ %tmp.17 = icmp sgt i32 %tmp.14, %tmp.16 ; <i1> [#uses=1]
+ %tmp.19 = load i32* @g_59182229 ; <i32> [#uses=2]
+ br i1 %tmp.17, label %cond_true, label %cond_false
+cond_true: ; preds = %endif.0
+ %tmp.20 = icmp ne i32 %tmp.19, 1 ; <i1> [#uses=1]
+ br label %cond_continue
+cond_false: ; preds = %endif.0
+ %tmp.22 = icmp ne i32 %tmp.19, 0 ; <i1> [#uses=1]
+ br label %cond_continue
+cond_continue: ; preds = %cond_false, %cond_true
+ %mem_tmp.0 = phi i1 [ %tmp.20, %cond_true ], [ %tmp.22, %cond_false ] ; <i1> [#uses=1]
+ br i1 %mem_tmp.0, label %then.2, label %else.2
+then.2: ; preds = %cond_continue
+ %tmp.25 = zext i8 %l_88173906 to i32 ; <i32> [#uses=1]
+ br label %return
+else.2: ; preds = %cond_continue
+ br label %loopentry.1
+loopentry.1: ; preds = %endif.3, %else.2
+ %i.1.1 = phi i32 [ 0, %else.2 ], [ %inc.3, %endif.3 ] ; <i32> [#uses=2]
+ %i.3.2 = phi i32 [ undef, %else.2 ], [ %i.3.0, %endif.3 ] ; <i32> [#uses=2]
+ %l_88173906_addr.1 = phi i8 [ %l_88173906, %else.2 ], [ %l_88173906_addr.0, %endif.3 ] ; <i8> [#uses=3]
+ %tmp.29 = icmp sgt i32 %i.1.1, 99 ; <i1> [#uses=1]
+ br i1 %tmp.29, label %endif.2, label %no_exit.1
+no_exit.1: ; preds = %loopentry.1
+ %tmp.30 = load i32* @g_38098584 ; <i32> [#uses=1]
+ %tmp.31 = icmp eq i32 %tmp.30, 0 ; <i1> [#uses=1]
+ br i1 %tmp.31, label %else.3, label %then.3
+then.3: ; preds = %no_exit.1
+ br label %endif.3
+else.3: ; preds = %no_exit.1
+ br i1 false, label %else.4, label %then.4
+then.4: ; preds = %else.3
+ br label %endif.3
+else.4: ; preds = %else.3
+ br i1 false, label %else.5, label %then.5
+then.5: ; preds = %else.4
+ store i32 -1004318825, i32* @g_59182229
+ br label %return
+else.5: ; preds = %else.4
+ br label %loopentry.3
+loopentry.3: ; preds = %then.7, %else.5
+ %i.3.3 = phi i32 [ 0, %else.5 ], [ %inc.2, %then.7 ] ; <i32> [#uses=3]
+ %tmp.55 = icmp sgt i32 %i.3.3, 99 ; <i1> [#uses=1]
+ br i1 %tmp.55, label %endif.3, label %no_exit.3
+no_exit.3: ; preds = %loopentry.3
+ %tmp.57 = icmp eq i8 %l_88173906_addr.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp.57, label %else.7, label %then.7
+then.7: ; preds = %no_exit.3
+ store i32 16239, i32* @g_60187400
+ %inc.2 = add i32 %i.3.3, 1 ; <i32> [#uses=1]
+ br label %loopentry.3
+else.7: ; preds = %no_exit.3
+ br label %return
+endif.3: ; preds = %loopentry.3, %then.4, %then.3
+ %i.3.0 = phi i32 [ %i.3.2, %then.3 ], [ %i.3.2, %then.4 ], [ %i.3.3, %loopentry.3 ] ; <i32> [#uses=1]
+ %l_88173906_addr.0 = phi i8 [ 100, %then.3 ], [ %l_88173906_addr.1, %then.4 ], [ %l_88173906_addr.1, %loopentry.3 ] ; <i8> [#uses=1]
+ %inc.3 = add i32 %i.1.1, 1 ; <i32> [#uses=1]
+ br label %loopentry.1
+endif.2: ; preds = %loopentry.1
+ br label %return
+return: ; preds = %endif.2, %else.7, %then.5, %then.2, %else.0, %then.1
+ %result.0 = phi i32 [ 1624650671, %then.1 ], [ %tmp.25, %then.2 ], [ 3379, %then.5 ], [ 52410, %else.7 ], [ -1526438411, %endif.2 ], [ %tmp.12, %else.0 ] ; <i32> [#uses=1]
+ ret i32 %result.0
+}
diff --git a/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll b/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
new file mode 100644
index 000000000000..83143218b1ad
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
@@ -0,0 +1,71 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; END.
+
+define void @main() {
+entry:
+ %tmp.14.i19 = icmp eq i32 0, 2 ; <i1> [#uses=1]
+ br i1 %tmp.14.i19, label %endif.1.i20, label %read_min.exit
+endif.1.i20: ; preds = %entry
+ %tmp.9.i.i = icmp eq i8* null, null ; <i1> [#uses=1]
+ br i1 %tmp.9.i.i, label %then.i12.i, label %then.i.i
+then.i.i: ; preds = %endif.1.i20
+ ret void
+then.i12.i: ; preds = %endif.1.i20
+ %tmp.9.i4.i = icmp eq i8* null, null ; <i1> [#uses=1]
+ br i1 %tmp.9.i4.i, label %endif.2.i33, label %then.i5.i
+then.i5.i: ; preds = %then.i12.i
+ ret void
+endif.2.i33: ; preds = %then.i12.i
+ br i1 false, label %loopexit.0.i40, label %no_exit.0.i35
+no_exit.0.i35: ; preds = %no_exit.0.i35, %endif.2.i33
+ %tmp.130.i = icmp slt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.130.i, label %loopexit.0.i40.loopexit, label %no_exit.0.i35
+loopexit.0.i40.loopexit: ; preds = %no_exit.0.i35
+ br label %loopexit.0.i40
+loopexit.0.i40: ; preds = %loopexit.0.i40.loopexit, %endif.2.i33
+ %tmp.341.i = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.341.i, label %loopentry.1.i, label %read_min.exit
+loopentry.1.i: ; preds = %loopexit.0.i40
+ %tmp.347.i = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.347.i, label %no_exit.1.i41, label %loopexit.2.i44
+no_exit.1.i41: ; preds = %endif.5.i, %loopentry.1.i
+ %indvar.i42 = phi i32 [ %indvar.next.i, %endif.5.i ], [ 0, %loopentry.1.i ] ; <i32> [#uses=1]
+ %tmp.355.i = icmp eq i32 0, 3 ; <i1> [#uses=1]
+ br i1 %tmp.355.i, label %endif.5.i, label %read_min.exit
+endif.5.i: ; preds = %no_exit.1.i41
+ %tmp.34773.i = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+ %indvar.next.i = add i32 %indvar.i42, 1 ; <i32> [#uses=1]
+ br i1 %tmp.34773.i, label %no_exit.1.i41, label %loopexit.1.i.loopexit
+loopexit.1.i.loopexit: ; preds = %endif.5.i
+ ret void
+loopexit.2.i44: ; preds = %loopentry.1.i
+ ret void
+read_min.exit: ; preds = %no_exit.1.i41, %loopexit.0.i40, %entry
+ %tmp.23 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.23, label %endif.1, label %then.1
+then.1: ; preds = %read_min.exit
+ br i1 false, label %endif.0.i, label %then.0.i
+then.0.i: ; preds = %then.1
+ br i1 false, label %endif.1.i, label %then.1.i
+endif.0.i: ; preds = %then.1
+ br i1 false, label %endif.1.i, label %then.1.i
+then.1.i: ; preds = %endif.0.i, %then.0.i
+ br i1 false, label %getfree.exit, label %then.2.i
+endif.1.i: ; preds = %endif.0.i, %then.0.i
+ br i1 false, label %getfree.exit, label %then.2.i
+then.2.i: ; preds = %endif.1.i, %then.1.i
+ ret void
+getfree.exit: ; preds = %endif.1.i, %then.1.i
+ ret void
+endif.1: ; preds = %read_min.exit
+ %tmp.27.i = getelementptr i32* null, i32 0 ; <i32*> [#uses=0]
+ br i1 false, label %loopexit.0.i15, label %no_exit.0.i14
+no_exit.0.i14: ; preds = %endif.1
+ ret void
+loopexit.0.i15: ; preds = %endif.1
+ br i1 false, label %primal_start_artificial.exit, label %no_exit.1.i16
+no_exit.1.i16: ; preds = %no_exit.1.i16, %loopexit.0.i15
+ br i1 false, label %primal_start_artificial.exit, label %no_exit.1.i16
+primal_start_artificial.exit: ; preds = %no_exit.1.i16, %loopexit.0.i15
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll b/test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll
new file mode 100644
index 000000000000..51490a00eb47
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll
@@ -0,0 +1,75 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; END.
+
+ %arraytype.1.Char = type { i32, [0 x i8] }
+ %arraytype.4.Signed = type { i32, [0 x i32] }
+ %functiontype.23 = type %structtype.Task* (%structtype.Task*, %structtype.Packet*, %structtype.FailedRun*)
+ %functiontype.27 = type %structtype.object* ()
+ %functiontype.28 = type i1 (%structtype.object*, %structtype.object_vtable*)
+ %functiontype.39 = type i32 (%structtype.listiter*)
+ %opaquetype.RuntimeTypeInfo = type i8* (i8*)
+ %structtype.AssertionError_vtable = type { %structtype.FailedRun_vtable }
+ %structtype.DeviceTask = type { %structtype.Task }
+ %structtype.FailedRun = type { %structtype.object }
+ %structtype.FailedRun_vtable = type { %structtype.object_vtable }
+ %structtype.Packet = type { %structtype.object, %structtype.list.1*, i32, i32, i32, %structtype.Packet* }
+ %structtype.Task = type { %structtype.TaskState, %structtype.FailedRun*, i32, %structtype.Packet*, %structtype.Task*, i32 }
+ %structtype.TaskState = type { %structtype.object, i1, i1, i1 }
+ %structtype.list.1 = type { %arraytype.4.Signed* }
+ %structtype.listiter = type { %structtype.list.1*, i32 }
+ %structtype.object = type { %structtype.object_vtable* }
+ %structtype.object_vtable = type { %structtype.object_vtable*, %opaquetype.RuntimeTypeInfo*, %arraytype.1.Char*, %functiontype.27* }
+@structinstance.59 = external global %structtype.AssertionError_vtable ; <%structtype.AssertionError_vtable*> [#uses=0]
+
+declare fastcc i1 @ll_isinstance__objectPtr_object_vtablePtr()
+
+declare fastcc void @ll_listnext__listiterPtr()
+
+define fastcc void @WorkTask.fn() {
+block0:
+ br label %block1
+block1: ; preds = %block0
+ %v2542 = call fastcc i1 @ll_isinstance__objectPtr_object_vtablePtr( ) ; <i1> [#uses=1]
+ br i1 %v2542, label %block4, label %block2
+block2: ; preds = %block1
+ br label %block3
+block3: ; preds = %block2
+ unwind
+block4: ; preds = %block1
+ br label %block5
+block5: ; preds = %block4
+ %v2565 = icmp eq %structtype.Packet* null, null ; <i1> [#uses=1]
+ br i1 %v2565, label %block15, label %block6
+block6: ; preds = %block5
+ %self_2575 = phi %structtype.DeviceTask* [ null, %block5 ] ; <%structtype.DeviceTask*> [#uses=1]
+ br i1 false, label %block14, label %block7
+block7: ; preds = %block14, %block6
+ %self_2635 = phi %structtype.DeviceTask* [ %self_2575, %block6 ], [ null, %block14 ] ; <%structtype.DeviceTask*> [#uses=1]
+ %tmp.124 = getelementptr %structtype.Packet* null, i32 0, i32 2 ; <i32*> [#uses=0]
+ br label %block8
+block8: ; preds = %block10, %block7
+ %self_2672 = phi %structtype.DeviceTask* [ %self_2635, %block7 ], [ null, %block10 ] ; <%structtype.DeviceTask*> [#uses=0]
+ invoke fastcc void @ll_listnext__listiterPtr( )
+ to label %block9 unwind label %block8_exception_handling
+block8_exception_handling: ; preds = %block8
+ br i1 false, label %block8_exception_found_branchto_block12, label %block8_not_exception_structinstance.10
+block8_not_exception_structinstance.10: ; preds = %block8_exception_handling
+ unwind
+block8_exception_found_branchto_block12: ; preds = %block8_exception_handling
+ br label %block12
+block9: ; preds = %block8
+ br i1 false, label %block11, label %block10
+block10: ; preds = %block11, %block9
+ br label %block8
+block11: ; preds = %block9
+ br label %block10
+block12: ; preds = %block8_exception_found_branchto_block12
+ br label %block13
+block13: ; preds = %block15, %block12
+ ret void
+block14: ; preds = %block6
+ br label %block7
+block15: ; preds = %block5
+ %v2586 = phi %structtype.DeviceTask* [ null, %block5 ] ; <%structtype.DeviceTask*> [#uses=0]
+ br label %block13
+}
diff --git a/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll b/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll
new file mode 100644
index 000000000000..a0fe7817743a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+
+define i1 @foo() {
+ %X = invoke i1 @foo( )
+ to label %N unwind label %F ; <i1> [#uses=1]
+F: ; preds = %0
+ ret i1 false
+N: ; preds = %0
+ br i1 %X, label %A, label %B
+A: ; preds = %N
+ ret i1 true
+B: ; preds = %N
+ ret i1 true
+}
+
diff --git a/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll b/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll
new file mode 100644
index 000000000000..27413fcf9fa1
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2005-12-03-IncorrectPHIFold.ll
@@ -0,0 +1,124 @@
+; Make sure this doesn't turn into an infinite loop
+
+; RUN: llvm-as < %s | opt -simplifycfg -constprop -simplifycfg |\
+; RUN: llvm-dis | grep bb86
+; END.
+
+%struct.anon = type { i32, i32, i32, i32, [1024 x i8] }
+@_zero_ = external global %struct.anon* ; <%struct.anon**> [#uses=2]
+@_one_ = external global %struct.anon* ; <%struct.anon**> [#uses=4]
+@str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=0]
+
+declare i32 @bc_compare(%struct.anon*, %struct.anon*)
+
+declare void @free_num(%struct.anon**)
+
+declare %struct.anon* @copy_num(%struct.anon*)
+
+declare void @init_num(%struct.anon**)
+
+declare %struct.anon* @new_num(i32, i32)
+
+declare void @int2num(%struct.anon**, i32)
+
+declare void @bc_multiply(%struct.anon*, %struct.anon*, %struct.anon**, i32)
+
+declare void @bc_raise(%struct.anon*, %struct.anon*, %struct.anon**, i32)
+
+declare i32 @bc_divide(%struct.anon*, %struct.anon*, %struct.anon**, i32)
+
+declare void @bc_add(%struct.anon*, %struct.anon*, %struct.anon**)
+
+declare i32 @_do_compare(%struct.anon*, %struct.anon*, i32, i32)
+
+declare i32 @printf(i8*, ...)
+
+define i32 @bc_sqrt(%struct.anon** %num, i32 %scale) {
+entry:
+ %guess = alloca %struct.anon* ; <%struct.anon**> [#uses=7]
+ %guess1 = alloca %struct.anon* ; <%struct.anon**> [#uses=7]
+ %point5 = alloca %struct.anon* ; <%struct.anon**> [#uses=3]
+ %tmp = load %struct.anon** %num ; <%struct.anon*> [#uses=1]
+ %tmp1 = load %struct.anon** @_zero_ ; <%struct.anon*> [#uses=1]
+ %tmp.upgrd.1 = call i32 @bc_compare( %struct.anon* %tmp, %struct.anon* %tmp1 ) ; <i32> [#uses=2]
+ %tmp.upgrd.2 = icmp slt i32 %tmp.upgrd.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp.upgrd.2, label %cond_true, label %cond_false
+cond_true: ; preds = %entry
+ ret i32 0
+cond_false: ; preds = %entry
+ %tmp5 = icmp eq i32 %tmp.upgrd.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp5, label %cond_true6, label %cond_next13
+cond_true6: ; preds = %cond_false
+ call void @free_num( %struct.anon** %num )
+ %tmp8 = load %struct.anon** @_zero_ ; <%struct.anon*> [#uses=1]
+ %tmp9 = call %struct.anon* @copy_num( %struct.anon* %tmp8 ) ; <%struct.anon*> [#uses=1]
+ store %struct.anon* %tmp9, %struct.anon** %num
+ ret i32 1
+cond_next13: ; preds = %cond_false
+ %tmp15 = load %struct.anon** %num ; <%struct.anon*> [#uses=1]
+ %tmp16 = load %struct.anon** @_one_ ; <%struct.anon*> [#uses=1]
+ %tmp17 = call i32 @bc_compare( %struct.anon* %tmp15, %struct.anon* %tmp16 ) ; <i32> [#uses=2]
+ %tmp19 = icmp eq i32 %tmp17, 0 ; <i1> [#uses=1]
+ br i1 %tmp19, label %cond_true20, label %cond_next27
+cond_true20: ; preds = %cond_next13
+ call void @free_num( %struct.anon** %num )
+ %tmp22 = load %struct.anon** @_one_ ; <%struct.anon*> [#uses=1]
+ %tmp23 = call %struct.anon* @copy_num( %struct.anon* %tmp22 ) ; <%struct.anon*> [#uses=1]
+ store %struct.anon* %tmp23, %struct.anon** %num
+ ret i32 1
+cond_next27: ; preds = %cond_next13
+ %tmp29 = load %struct.anon** %num ; <%struct.anon*> [#uses=1]
+ %tmp30 = getelementptr %struct.anon* %tmp29, i32 0, i32 2 ; <i32*> [#uses=1]
+ %tmp31 = load i32* %tmp30 ; <i32> [#uses=2]
+ %tmp33 = icmp sge i32 %tmp31, %scale ; <i1> [#uses=1]
+ %max = select i1 %tmp33, i32 %tmp31, i32 %scale ; <i32> [#uses=4]
+ %tmp35 = add i32 %max, 2 ; <i32> [#uses=0]
+ call void @init_num( %struct.anon** %guess )
+ call void @init_num( %struct.anon** %guess1 )
+ %tmp36 = call %struct.anon* @new_num( i32 1, i32 1 ) ; <%struct.anon*> [#uses=2]
+ store %struct.anon* %tmp36, %struct.anon** %point5
+ %tmp.upgrd.3 = getelementptr %struct.anon* %tmp36, i32 0, i32 4, i32 1 ; <i8*> [#uses=1]
+ store i8 5, i8* %tmp.upgrd.3
+ %tmp39 = icmp slt i32 %tmp17, 0 ; <i1> [#uses=1]
+ br i1 %tmp39, label %cond_true40, label %cond_false43
+cond_true40: ; preds = %cond_next27
+ %tmp41 = load %struct.anon** @_one_ ; <%struct.anon*> [#uses=1]
+ %tmp42 = call %struct.anon* @copy_num( %struct.anon* %tmp41 ) ; <%struct.anon*> [#uses=1]
+ store %struct.anon* %tmp42, %struct.anon** %guess
+ br label %bb80.outer
+cond_false43: ; preds = %cond_next27
+ call void @int2num( %struct.anon** %guess, i32 10 )
+ %tmp45 = load %struct.anon** %num ; <%struct.anon*> [#uses=1]
+ %tmp46 = getelementptr %struct.anon* %tmp45, i32 0, i32 1 ; <i32*> [#uses=1]
+ %tmp47 = load i32* %tmp46 ; <i32> [#uses=1]
+ call void @int2num( %struct.anon** %guess1, i32 %tmp47 )
+ %tmp48 = load %struct.anon** %guess1 ; <%struct.anon*> [#uses=1]
+ %tmp49 = load %struct.anon** %point5 ; <%struct.anon*> [#uses=1]
+ call void @bc_multiply( %struct.anon* %tmp48, %struct.anon* %tmp49, %struct.anon** %guess1, i32 %max )
+ %tmp51 = load %struct.anon** %guess1 ; <%struct.anon*> [#uses=1]
+ %tmp52 = getelementptr %struct.anon* %tmp51, i32 0, i32 2 ; <i32*> [#uses=1]
+ store i32 0, i32* %tmp52
+ %tmp53 = load %struct.anon** %guess ; <%struct.anon*> [#uses=1]
+ %tmp54 = load %struct.anon** %guess1 ; <%struct.anon*> [#uses=1]
+ call void @bc_raise( %struct.anon* %tmp53, %struct.anon* %tmp54, %struct.anon** %guess, i32 %max )
+ br label %bb80.outer
+bb80.outer: ; preds = %cond_true83, %cond_false43, %cond_true40
+ %done.1.ph = phi i32 [ 1, %cond_true83 ], [ 0, %cond_true40 ], [ 0, %cond_false43 ] ; <i32> [#uses=1]
+ br label %bb80
+bb80: ; preds = %cond_true83, %bb80.outer
+ %tmp82 = icmp eq i32 %done.1.ph, 0 ; <i1> [#uses=1]
+ br i1 %tmp82, label %cond_true83, label %bb86
+cond_true83: ; preds = %bb80
+ %tmp71 = call i32 @_do_compare( %struct.anon* null, %struct.anon* null, i32 0, i32 1 ) ; <i32> [#uses=1]
+ %tmp76 = icmp eq i32 %tmp71, 0 ; <i1> [#uses=1]
+ br i1 %tmp76, label %bb80.outer, label %bb80
+bb86: ; preds = %bb80
+ call void @free_num( %struct.anon** %num )
+ %tmp88 = load %struct.anon** %guess ; <%struct.anon*> [#uses=1]
+ %tmp89 = load %struct.anon** @_one_ ; <%struct.anon*> [#uses=1]
+ %tmp92 = call i32 @bc_divide( %struct.anon* %tmp88, %struct.anon* %tmp89, %struct.anon** %num, i32 %max ) ; <i32> [#uses=0]
+ call void @free_num( %struct.anon** %guess )
+ call void @free_num( %struct.anon** %guess1 )
+ call void @free_num( %struct.anon** %point5 )
+ ret i32 1
+}
diff --git a/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll b/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll
new file mode 100644
index 000000000000..4400624d184d
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+
+define void @polnel_() {
+entry:
+ %tmp595 = icmp slt i32 0, 0 ; <i1> [#uses=4]
+ br i1 %tmp595, label %bb148.critedge, label %cond_true40
+bb36: ; preds = %bb43
+ br i1 %tmp595, label %bb43, label %cond_true40
+cond_true40: ; preds = %bb46, %cond_true40, %bb36, %entry
+ %tmp397 = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp397, label %bb43, label %cond_true40
+bb43: ; preds = %cond_true40, %bb36
+ br i1 false, label %bb53, label %bb36
+bb46: ; preds = %bb53
+ br i1 %tmp595, label %bb53, label %cond_true40
+bb53: ; preds = %bb46, %bb43
+ br i1 false, label %bb102, label %bb46
+bb92.preheader: ; preds = %bb102
+ ret void
+bb102: ; preds = %bb53
+ br i1 %tmp595, label %bb148, label %bb92.preheader
+bb148.critedge: ; preds = %entry
+ ret void
+bb148: ; preds = %bb102
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll b/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
new file mode 100644
index 000000000000..4981cf3c9aa3
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
@@ -0,0 +1,413 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; END.
+
+define void @main(i32 %c) {
+entry:
+ %tmp.9 = icmp eq i32 %c, 2 ; <i1> [#uses=1]
+ br i1 %tmp.9, label %endif.0, label %then.0
+then.0: ; preds = %entry
+ ret void
+endif.0: ; preds = %entry
+ br i1 false, label %then.1, label %endif.1
+then.1: ; preds = %endif.0
+ ret void
+endif.1: ; preds = %endif.0
+ br i1 false, label %then.2, label %endif.2
+then.2: ; preds = %endif.1
+ ret void
+endif.2: ; preds = %endif.1
+ br i1 false, label %then.3, label %loopentry.0
+then.3: ; preds = %endif.2
+ ret void
+loopentry.0: ; preds = %endif.2
+ br i1 false, label %no_exit.0.preheader, label %loopexit.0
+no_exit.0.preheader: ; preds = %loopentry.0
+ br label %no_exit.0
+no_exit.0: ; preds = %endif.4, %no_exit.0.preheader
+ br i1 false, label %then.4, label %endif.4
+then.4: ; preds = %no_exit.0
+ ret void
+endif.4: ; preds = %no_exit.0
+ br i1 false, label %no_exit.0, label %loopexit.0.loopexit
+loopexit.0.loopexit: ; preds = %endif.4
+ br label %loopexit.0
+loopexit.0: ; preds = %loopexit.0.loopexit, %loopentry.0
+ br i1 false, label %then.5, label %loopentry.1
+then.5: ; preds = %loopexit.0
+ ret void
+loopentry.1: ; preds = %loopexit.0
+ %tmp.143 = icmp sgt i32 0, 0 ; <i1> [#uses=4]
+ br i1 %tmp.143, label %no_exit.1.preheader, label %loopexit.1
+no_exit.1.preheader: ; preds = %loopentry.1
+ br label %no_exit.1
+no_exit.1: ; preds = %endif.6, %no_exit.1.preheader
+ br i1 false, label %then.6, label %shortcirc_next.3
+shortcirc_next.3: ; preds = %no_exit.1
+ br i1 false, label %then.6, label %shortcirc_next.4
+shortcirc_next.4: ; preds = %shortcirc_next.3
+ br i1 false, label %then.6, label %endif.6
+then.6: ; preds = %shortcirc_next.4, %shortcirc_next.3, %no_exit.1
+ ret void
+endif.6: ; preds = %shortcirc_next.4
+ br i1 false, label %no_exit.1, label %loopexit.1.loopexit
+loopexit.1.loopexit: ; preds = %endif.6
+ br label %loopexit.1
+loopexit.1: ; preds = %loopexit.1.loopexit, %loopentry.1
+ br i1 false, label %then.i, label %loopentry.0.i
+then.i: ; preds = %loopexit.1
+ ret void
+loopentry.0.i: ; preds = %loopexit.1
+ br i1 %tmp.143, label %no_exit.0.i.preheader, label %readvector.exit
+no_exit.0.i.preheader: ; preds = %loopentry.0.i
+ br label %no_exit.0.i
+no_exit.0.i: ; preds = %loopexit.1.i, %no_exit.0.i.preheader
+ br i1 false, label %no_exit.1.i.preheader, label %loopexit.1.i
+no_exit.1.i.preheader: ; preds = %no_exit.0.i
+ br label %no_exit.1.i
+no_exit.1.i: ; preds = %loopexit.2.i, %no_exit.1.i.preheader
+ br i1 false, label %no_exit.2.i.preheader, label %loopexit.2.i
+no_exit.2.i.preheader: ; preds = %no_exit.1.i
+ br label %no_exit.2.i
+no_exit.2.i: ; preds = %no_exit.2.i, %no_exit.2.i.preheader
+ br i1 false, label %no_exit.2.i, label %loopexit.2.i.loopexit
+loopexit.2.i.loopexit: ; preds = %no_exit.2.i
+ br label %loopexit.2.i
+loopexit.2.i: ; preds = %loopexit.2.i.loopexit, %no_exit.1.i
+ br i1 false, label %no_exit.1.i, label %loopexit.1.i.loopexit
+loopexit.1.i.loopexit: ; preds = %loopexit.2.i
+ br label %loopexit.1.i
+loopexit.1.i: ; preds = %loopexit.1.i.loopexit, %no_exit.0.i
+ br i1 false, label %no_exit.0.i, label %readvector.exit.loopexit
+readvector.exit.loopexit: ; preds = %loopexit.1.i
+ br label %readvector.exit
+readvector.exit: ; preds = %readvector.exit.loopexit, %loopentry.0.i
+ br i1 %tmp.143, label %loopentry.1.preheader.i, label %loopexit.0.i
+loopentry.1.preheader.i: ; preds = %readvector.exit
+ br label %loopentry.1.outer.i
+loopentry.1.outer.i: ; preds = %loopexit.1.i110, %loopentry.1.preheader.i
+ br label %loopentry.1.i85
+loopentry.1.i85.loopexit: ; preds = %hamming.exit16.i
+ br label %loopentry.1.i85
+loopentry.1.i85: ; preds = %loopentry.1.i85.loopexit, %loopentry.1.outer.i
+ br i1 false, label %no_exit.1.preheader.i, label %loopexit.1.i110.loopexit1
+no_exit.1.preheader.i: ; preds = %loopentry.1.i85
+ br label %no_exit.1.i87
+no_exit.1.i87: ; preds = %then.1.i107, %no_exit.1.preheader.i
+ br i1 false, label %no_exit.i.i101.preheader, label %hamming.exit.i104
+no_exit.i.i101.preheader: ; preds = %no_exit.1.i87
+ br label %no_exit.i.i101
+no_exit.i.i101: ; preds = %no_exit.i.i101, %no_exit.i.i101.preheader
+ br i1 false, label %no_exit.i.i101, label %hamming.exit.i104.loopexit
+hamming.exit.i104.loopexit: ; preds = %no_exit.i.i101
+ br label %hamming.exit.i104
+hamming.exit.i104: ; preds = %hamming.exit.i104.loopexit, %no_exit.1.i87
+ br i1 false, label %no_exit.i15.i.preheader, label %hamming.exit16.i
+no_exit.i15.i.preheader: ; preds = %hamming.exit.i104
+ br label %no_exit.i15.i
+no_exit.i15.i: ; preds = %no_exit.i15.i, %no_exit.i15.i.preheader
+ br i1 false, label %no_exit.i15.i, label %hamming.exit16.i.loopexit
+hamming.exit16.i.loopexit: ; preds = %no_exit.i15.i
+ br label %hamming.exit16.i
+hamming.exit16.i: ; preds = %hamming.exit16.i.loopexit, %hamming.exit.i104
+ br i1 false, label %loopentry.1.i85.loopexit, label %then.1.i107
+then.1.i107: ; preds = %hamming.exit16.i
+ br i1 false, label %no_exit.1.i87, label %loopexit.1.i110.loopexit
+loopexit.1.i110.loopexit: ; preds = %then.1.i107
+ br label %loopexit.1.i110
+loopexit.1.i110.loopexit1: ; preds = %loopentry.1.i85
+ br label %loopexit.1.i110
+loopexit.1.i110: ; preds = %loopexit.1.i110.loopexit1, %loopexit.1.i110.loopexit
+ br i1 false, label %loopentry.1.outer.i, label %loopexit.0.i.loopexit
+loopexit.0.i.loopexit: ; preds = %loopexit.1.i110
+ br label %loopexit.0.i
+loopexit.0.i: ; preds = %loopexit.0.i.loopexit, %readvector.exit
+ br i1 false, label %UnifiedReturnBlock.i113, label %then.2.i112
+then.2.i112: ; preds = %loopexit.0.i
+ br label %checkham.exit
+UnifiedReturnBlock.i113: ; preds = %loopexit.0.i
+ br label %checkham.exit
+checkham.exit: ; preds = %UnifiedReturnBlock.i113, %then.2.i112
+ br i1 false, label %loopentry.1.i14.preheader, label %loopentry.3.i.preheader
+loopentry.1.i14.preheader: ; preds = %checkham.exit
+ br label %loopentry.1.i14
+loopentry.1.i14: ; preds = %loopexit.1.i18, %loopentry.1.i14.preheader
+ br i1 false, label %no_exit.1.i16.preheader, label %loopexit.1.i18
+no_exit.1.i16.preheader: ; preds = %loopentry.1.i14
+ br label %no_exit.1.i16
+no_exit.1.i16: ; preds = %no_exit.1.i16, %no_exit.1.i16.preheader
+ br i1 false, label %no_exit.1.i16, label %loopexit.1.i18.loopexit
+loopexit.1.i18.loopexit: ; preds = %no_exit.1.i16
+ br label %loopexit.1.i18
+loopexit.1.i18: ; preds = %loopexit.1.i18.loopexit, %loopentry.1.i14
+ br i1 false, label %loopentry.1.i14, label %loopentry.3.i.loopexit
+loopentry.3.i.loopexit: ; preds = %loopexit.1.i18
+ br label %loopentry.3.i.preheader
+loopentry.3.i.preheader: ; preds = %loopentry.3.i.loopexit, %checkham.exit
+ br label %loopentry.3.i
+loopentry.3.i: ; preds = %endif.1.i, %loopentry.3.i.preheader
+ br i1 false, label %loopentry.4.i.preheader, label %endif.1.i
+loopentry.4.i.preheader: ; preds = %loopentry.3.i
+ br label %loopentry.4.i
+loopentry.4.i: ; preds = %loopexit.4.i, %loopentry.4.i.preheader
+ br i1 false, label %no_exit.4.i.preheader, label %loopexit.4.i
+no_exit.4.i.preheader: ; preds = %loopentry.4.i
+ br label %no_exit.4.i
+no_exit.4.i: ; preds = %no_exit.4.i.backedge, %no_exit.4.i.preheader
+ br i1 false, label %endif.0.i, label %else.i
+else.i: ; preds = %no_exit.4.i
+ br i1 false, label %no_exit.4.i.backedge, label %loopexit.4.i.loopexit
+no_exit.4.i.backedge: ; preds = %endif.0.i, %else.i
+ br label %no_exit.4.i
+endif.0.i: ; preds = %no_exit.4.i
+ br i1 false, label %no_exit.4.i.backedge, label %loopexit.4.i.loopexit
+loopexit.4.i.loopexit: ; preds = %endif.0.i, %else.i
+ br label %loopexit.4.i
+loopexit.4.i: ; preds = %loopexit.4.i.loopexit, %loopentry.4.i
+ br i1 false, label %loopentry.4.i, label %endif.1.i.loopexit
+endif.1.i.loopexit: ; preds = %loopexit.4.i
+ br label %endif.1.i
+endif.1.i: ; preds = %endif.1.i.loopexit, %loopentry.3.i
+ %exitcond = icmp eq i32 0, 10 ; <i1> [#uses=1]
+ br i1 %exitcond, label %generateT.exit, label %loopentry.3.i
+generateT.exit: ; preds = %endif.1.i
+ br i1 false, label %then.0.i, label %loopentry.1.i30.preheader
+then.0.i: ; preds = %generateT.exit
+ ret void
+loopentry.1.i30.loopexit: ; preds = %loopexit.3.i
+ br label %loopentry.1.i30.backedge
+loopentry.1.i30.preheader: ; preds = %generateT.exit
+ br label %loopentry.1.i30
+loopentry.1.i30: ; preds = %loopentry.1.i30.backedge, %loopentry.1.i30.preheader
+ br i1 %tmp.143, label %no_exit.0.i31.preheader, label %loopentry.1.i30.backedge
+loopentry.1.i30.backedge: ; preds = %loopentry.1.i30, %loopentry.1.i30.loopexit
+ br label %loopentry.1.i30
+no_exit.0.i31.preheader: ; preds = %loopentry.1.i30
+ br label %no_exit.0.i31
+no_exit.0.i31: ; preds = %loopexit.3.i, %no_exit.0.i31.preheader
+ br i1 false, label %then.1.i, label %else.0.i
+then.1.i: ; preds = %no_exit.0.i31
+ br i1 undef, label %then.0.i29, label %loopentry.0.i31
+then.0.i29: ; preds = %then.1.i
+ unreachable
+loopentry.0.i31: ; preds = %then.1.i
+ br i1 false, label %no_exit.0.i38.preheader, label %loopentry.1.i.preheader
+no_exit.0.i38.preheader: ; preds = %loopentry.0.i31
+ br label %no_exit.0.i38
+no_exit.0.i38: ; preds = %no_exit.0.i38, %no_exit.0.i38.preheader
+ br i1 undef, label %no_exit.0.i38, label %loopentry.1.i.preheader.loopexit
+loopentry.1.i.preheader.loopexit: ; preds = %no_exit.0.i38
+ br label %loopentry.1.i.preheader
+loopentry.1.i.preheader: ; preds = %loopentry.1.i.preheader.loopexit, %loopentry.0.i31
+ br label %loopentry.1.i
+loopentry.1.i: ; preds = %endif.2.i, %loopentry.1.i.preheader
+ br i1 undef, label %loopentry.2.i39.preheader, label %loopexit.1.i79.loopexit2
+loopentry.2.i39.preheader: ; preds = %loopentry.1.i
+ br label %loopentry.2.i39
+loopentry.2.i39: ; preds = %loopexit.5.i77, %loopentry.2.i39.preheader
+ br i1 false, label %loopentry.3.i40.preheader, label %hamming.exit.i71
+loopentry.3.i40.preheader: ; preds = %loopentry.2.i39
+ br label %loopentry.3.i40
+loopentry.3.i40: ; preds = %loopexit.3.i51, %loopentry.3.i40.preheader
+ br i1 false, label %no_exit.3.preheader.i42, label %loopexit.3.i51
+no_exit.3.preheader.i42: ; preds = %loopentry.3.i40
+ br label %no_exit.3.i49
+no_exit.3.i49: ; preds = %no_exit.3.i49, %no_exit.3.preheader.i42
+ br i1 undef, label %no_exit.3.i49, label %loopexit.3.i51.loopexit
+loopexit.3.i51.loopexit: ; preds = %no_exit.3.i49
+ br label %loopexit.3.i51
+loopexit.3.i51: ; preds = %loopexit.3.i51.loopexit, %loopentry.3.i40
+ br i1 undef, label %loopentry.3.i40, label %loopentry.4.i52
+loopentry.4.i52: ; preds = %loopexit.3.i51
+ br i1 false, label %no_exit.4.i54.preheader, label %hamming.exit.i71
+no_exit.4.i54.preheader: ; preds = %loopentry.4.i52
+ br label %no_exit.4.i54
+no_exit.4.i54: ; preds = %no_exit.4.backedge.i, %no_exit.4.i54.preheader
+ br i1 undef, label %then.1.i55, label %endif.1.i56
+then.1.i55: ; preds = %no_exit.4.i54
+ br i1 undef, label %no_exit.4.backedge.i, label %loopexit.4.i57
+no_exit.4.backedge.i: ; preds = %endif.1.i56, %then.1.i55
+ br label %no_exit.4.i54
+endif.1.i56: ; preds = %no_exit.4.i54
+ br i1 undef, label %no_exit.4.backedge.i, label %loopexit.4.i57
+loopexit.4.i57: ; preds = %endif.1.i56, %then.1.i55
+ br i1 false, label %no_exit.i.i69.preheader, label %hamming.exit.i71
+no_exit.i.i69.preheader: ; preds = %loopexit.4.i57
+ br label %no_exit.i.i69
+no_exit.i.i69: ; preds = %no_exit.i.i69, %no_exit.i.i69.preheader
+ br i1 undef, label %no_exit.i.i69, label %hamming.exit.i71.loopexit
+hamming.exit.i71.loopexit: ; preds = %no_exit.i.i69
+ br label %hamming.exit.i71
+hamming.exit.i71: ; preds = %hamming.exit.i71.loopexit, %loopexit.4.i57, %loopentry.4.i52, %loopentry.2.i39
+ br i1 undef, label %endif.2.i, label %loopentry.5.i72
+loopentry.5.i72: ; preds = %hamming.exit.i71
+ br i1 false, label %shortcirc_next.i74.preheader, label %loopexit.5.i77
+shortcirc_next.i74.preheader: ; preds = %loopentry.5.i72
+ br label %shortcirc_next.i74
+shortcirc_next.i74: ; preds = %no_exit.5.i76, %shortcirc_next.i74.preheader
+ br i1 undef, label %no_exit.5.i76, label %loopexit.5.i77.loopexit
+no_exit.5.i76: ; preds = %shortcirc_next.i74
+ br i1 undef, label %shortcirc_next.i74, label %loopexit.5.i77.loopexit
+loopexit.5.i77.loopexit: ; preds = %no_exit.5.i76, %shortcirc_next.i74
+ br label %loopexit.5.i77
+loopexit.5.i77: ; preds = %loopexit.5.i77.loopexit, %loopentry.5.i72
+ br i1 undef, label %loopentry.2.i39, label %loopexit.1.i79.loopexit
+endif.2.i: ; preds = %hamming.exit.i71
+ br label %loopentry.1.i
+loopexit.1.i79.loopexit: ; preds = %loopexit.5.i77
+ br label %loopexit.1.i79
+loopexit.1.i79.loopexit2: ; preds = %loopentry.1.i
+ br label %loopexit.1.i79
+loopexit.1.i79: ; preds = %loopexit.1.i79.loopexit2, %loopexit.1.i79.loopexit
+ br i1 undef, label %then.3.i, label %loopentry.6.i80
+then.3.i: ; preds = %loopexit.1.i79
+ br i1 false, label %no_exit.6.i82.preheader, label %run.exit
+loopentry.6.i80: ; preds = %loopexit.1.i79
+ br i1 false, label %no_exit.6.i82.preheader, label %run.exit
+no_exit.6.i82.preheader: ; preds = %loopentry.6.i80, %then.3.i
+ br label %no_exit.6.i82
+no_exit.6.i82: ; preds = %no_exit.6.i82, %no_exit.6.i82.preheader
+ br i1 undef, label %no_exit.6.i82, label %run.exit.loopexit
+run.exit.loopexit: ; preds = %no_exit.6.i82
+ br label %run.exit
+run.exit: ; preds = %run.exit.loopexit, %loopentry.6.i80, %then.3.i
+ br i1 false, label %no_exit.1.i36.preheader, label %loopentry.3.i37
+else.0.i: ; preds = %no_exit.0.i31
+ br i1 false, label %then.0.i4, label %loopentry.0.i6
+then.0.i4: ; preds = %else.0.i
+ unreachable
+loopentry.0.i6: ; preds = %else.0.i
+ br i1 false, label %no_exit.0.i8.preheader, label %loopentry.2.i.preheader
+no_exit.0.i8.preheader: ; preds = %loopentry.0.i6
+ br label %no_exit.0.i8
+no_exit.0.i8: ; preds = %no_exit.0.i8, %no_exit.0.i8.preheader
+ br i1 false, label %no_exit.0.i8, label %loopentry.2.i.preheader.loopexit
+loopentry.2.i.preheader.loopexit: ; preds = %no_exit.0.i8
+ br label %loopentry.2.i.preheader
+loopentry.2.i.preheader: ; preds = %loopentry.2.i.preheader.loopexit, %loopentry.0.i6
+ br label %loopentry.2.i
+loopentry.2.i: ; preds = %endif.3.i19, %loopentry.2.i.preheader
+ br i1 false, label %loopentry.3.i10.preheader, label %loopentry.4.i15
+loopentry.3.i10.preheader: ; preds = %loopentry.2.i
+ br label %loopentry.3.i10
+loopentry.3.i10: ; preds = %loopexit.3.i14, %loopentry.3.i10.preheader
+ br i1 false, label %no_exit.3.preheader.i, label %loopexit.3.i14
+no_exit.3.preheader.i: ; preds = %loopentry.3.i10
+ br label %no_exit.3.i12
+no_exit.3.i12: ; preds = %no_exit.3.i12, %no_exit.3.preheader.i
+ br i1 false, label %no_exit.3.i12, label %loopexit.3.i14.loopexit
+loopexit.3.i14.loopexit: ; preds = %no_exit.3.i12
+ br label %loopexit.3.i14
+loopexit.3.i14: ; preds = %loopexit.3.i14.loopexit, %loopentry.3.i10
+ br i1 false, label %loopentry.3.i10, label %loopentry.4.i15.loopexit
+loopentry.4.i15.loopexit: ; preds = %loopexit.3.i14
+ br label %loopentry.4.i15
+loopentry.4.i15: ; preds = %loopentry.4.i15.loopexit, %loopentry.2.i
+ br i1 false, label %loopentry.5.outer.i.preheader, label %loopentry.7.i
+loopentry.5.outer.i.preheader: ; preds = %loopentry.4.i15
+ br label %loopentry.5.outer.i
+loopentry.5.outer.i: ; preds = %loopexit.5.i, %loopentry.5.outer.i.preheader
+ br label %loopentry.5.i
+loopentry.5.i: ; preds = %endif.1.i18, %loopentry.5.outer.i
+ br i1 false, label %no_exit.5.i.preheader, label %loopexit.5.i.loopexit3
+no_exit.5.i.preheader: ; preds = %loopentry.5.i
+ br label %no_exit.5.i
+no_exit.5.i: ; preds = %then.2.i, %no_exit.5.i.preheader
+ br i1 false, label %loopentry.6.i, label %endif.1.i18
+loopentry.6.i: ; preds = %no_exit.5.i
+ br i1 false, label %no_exit.6.preheader.i, label %loopexit.6.i
+no_exit.6.preheader.i: ; preds = %loopentry.6.i
+ br label %no_exit.6.i
+no_exit.6.i: ; preds = %no_exit.6.i, %no_exit.6.preheader.i
+ br i1 false, label %no_exit.6.i, label %loopexit.6.i.loopexit
+loopexit.6.i.loopexit: ; preds = %no_exit.6.i
+ br label %loopexit.6.i
+loopexit.6.i: ; preds = %loopexit.6.i.loopexit, %loopentry.6.i
+ br i1 false, label %then.2.i, label %endif.1.i18
+then.2.i: ; preds = %loopexit.6.i
+ br i1 false, label %no_exit.5.i, label %loopexit.5.i.loopexit
+endif.1.i18: ; preds = %loopexit.6.i, %no_exit.5.i
+ br label %loopentry.5.i
+loopexit.5.i.loopexit: ; preds = %then.2.i
+ br label %loopexit.5.i
+loopexit.5.i.loopexit3: ; preds = %loopentry.5.i
+ br label %loopexit.5.i
+loopexit.5.i: ; preds = %loopexit.5.i.loopexit3, %loopexit.5.i.loopexit
+ br i1 false, label %loopentry.5.outer.i, label %loopentry.7.i.loopexit
+loopentry.7.i.loopexit: ; preds = %loopexit.5.i
+ br label %loopentry.7.i
+loopentry.7.i: ; preds = %loopentry.7.i.loopexit, %loopentry.4.i15
+ br i1 false, label %no_exit.7.i.preheader, label %hamming.exit.i
+no_exit.7.i.preheader: ; preds = %loopentry.7.i
+ br label %no_exit.7.i
+no_exit.7.i: ; preds = %no_exit.7.i, %no_exit.7.i.preheader
+ br i1 false, label %no_exit.7.i, label %loopexit.7.i
+loopexit.7.i: ; preds = %no_exit.7.i
+ br i1 false, label %no_exit.i.i.preheader, label %hamming.exit.i
+no_exit.i.i.preheader: ; preds = %loopexit.7.i
+ br label %no_exit.i.i
+no_exit.i.i: ; preds = %no_exit.i.i, %no_exit.i.i.preheader
+ br i1 false, label %no_exit.i.i, label %hamming.exit.i.loopexit
+hamming.exit.i.loopexit: ; preds = %no_exit.i.i
+ br label %hamming.exit.i
+hamming.exit.i: ; preds = %hamming.exit.i.loopexit, %loopexit.7.i, %loopentry.7.i
+ br i1 false, label %endif.3.i19, label %loopentry.8.i
+loopentry.8.i: ; preds = %hamming.exit.i
+ br i1 false, label %shortcirc_next.i.preheader, label %loopexit.8.i
+shortcirc_next.i.preheader: ; preds = %loopentry.8.i
+ br label %shortcirc_next.i
+shortcirc_next.i: ; preds = %no_exit.8.i, %shortcirc_next.i.preheader
+ br i1 false, label %no_exit.8.i, label %loopexit.8.i.loopexit
+no_exit.8.i: ; preds = %shortcirc_next.i
+ br i1 false, label %shortcirc_next.i, label %loopexit.8.i.loopexit
+loopexit.8.i.loopexit: ; preds = %no_exit.8.i, %shortcirc_next.i
+ br label %loopexit.8.i
+loopexit.8.i: ; preds = %loopexit.8.i.loopexit, %loopentry.8.i
+ br i1 false, label %no_exit.9.i.preheader, label %endif.3.i19
+no_exit.9.i.preheader: ; preds = %loopexit.8.i
+ br label %no_exit.9.i
+no_exit.9.i: ; preds = %no_exit.9.i, %no_exit.9.i.preheader
+ br i1 false, label %no_exit.9.i, label %endif.3.i19.loopexit
+endif.3.i19.loopexit: ; preds = %no_exit.9.i
+ br label %endif.3.i19
+endif.3.i19: ; preds = %endif.3.i19.loopexit, %loopexit.8.i, %hamming.exit.i
+ br i1 false, label %loopentry.2.i, label %loopexit.1.i20
+loopexit.1.i20: ; preds = %endif.3.i19
+ br i1 false, label %then.4.i, label %UnifiedReturnBlock.i
+then.4.i: ; preds = %loopexit.1.i20
+ br label %runcont.exit
+UnifiedReturnBlock.i: ; preds = %loopexit.1.i20
+ br label %runcont.exit
+runcont.exit: ; preds = %UnifiedReturnBlock.i, %then.4.i
+ br i1 false, label %no_exit.1.i36.preheader, label %loopentry.3.i37
+no_exit.1.i36.preheader: ; preds = %runcont.exit, %run.exit
+ br label %no_exit.1.i36
+no_exit.1.i36: ; preds = %no_exit.1.i36, %no_exit.1.i36.preheader
+ br i1 false, label %no_exit.1.i36, label %loopentry.3.i37.loopexit
+loopentry.3.i37.loopexit: ; preds = %no_exit.1.i36
+ br label %loopentry.3.i37
+loopentry.3.i37: ; preds = %loopentry.3.i37.loopexit, %runcont.exit, %run.exit
+ br i1 false, label %loopentry.4.i38.preheader, label %loopexit.3.i
+loopentry.4.i38.preheader: ; preds = %loopentry.3.i37
+ br label %loopentry.4.i38
+loopentry.4.i38: ; preds = %loopexit.4.i42, %loopentry.4.i38.preheader
+ br i1 false, label %no_exit.3.i.preheader, label %loopexit.4.i42
+no_exit.3.i.preheader: ; preds = %loopentry.4.i38
+ br label %no_exit.3.i
+no_exit.3.i: ; preds = %no_exit.3.i.backedge, %no_exit.3.i.preheader
+ br i1 false, label %endif.3.i, label %else.1.i
+else.1.i: ; preds = %no_exit.3.i
+ br i1 false, label %no_exit.3.i.backedge, label %loopexit.4.i42.loopexit
+no_exit.3.i.backedge: ; preds = %endif.3.i, %else.1.i
+ br label %no_exit.3.i
+endif.3.i: ; preds = %no_exit.3.i
+ br i1 false, label %no_exit.3.i.backedge, label %loopexit.4.i42.loopexit
+loopexit.4.i42.loopexit: ; preds = %endif.3.i, %else.1.i
+ br label %loopexit.4.i42
+loopexit.4.i42: ; preds = %loopexit.4.i42.loopexit, %loopentry.4.i38
+ br i1 false, label %loopentry.4.i38, label %loopexit.3.i.loopexit
+loopexit.3.i.loopexit: ; preds = %loopexit.4.i42
+ br label %loopexit.3.i
+loopexit.3.i: ; preds = %loopexit.3.i.loopexit, %loopentry.3.i37
+ %tmp.13.i155 = icmp slt i32 0, 0 ; <i1> [#uses=1]
+ br i1 %tmp.13.i155, label %no_exit.0.i31, label %loopentry.1.i30.loopexit
+}
diff --git a/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll b/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll
new file mode 100644
index 000000000000..e410c35450bb
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll
@@ -0,0 +1,98 @@
+; RUN: llvm-as < %s | opt -gvn -simplifycfg \
+; RUN: -disable-output
+; PR867
+; END.
+
+target datalayout = "E-p:32:32"
+target triple = "powerpc-apple-darwin8"
+ %struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
+ %struct.eh_status = type opaque
+ %struct.emit_status = type { i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, i32, %struct.location_t, i32, i8*, %struct.rtx_def** }
+ %struct.expr_status = type { i32, i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* }
+ %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, i32, i32, i32, i32, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i8, i32, i64, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, i32, %struct.var_refs_queue*, i32, i32, %struct.rtvec_def*, %struct.tree_node*, i32, i32, i32, %struct.machine_function*, i32, i32, i8, i8, %struct.language_function*, %struct.rtx_def*, i32, i32, i32, i32, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, i8, i8, i8 }
+ %struct.initial_value_struct = type opaque
+ %struct.lang_decl = type opaque
+ %struct.lang_type = type opaque
+ %struct.language_function = type opaque
+ %struct.location_t = type { i8*, i32 }
+ %struct.machine_function = type { i32, i32, i8*, i32, i32 }
+ %struct.rtunion = type { i32 }
+ %struct.rtvec_def = type { i32, [1 x %struct.rtx_def*] }
+ %struct.rtx_def = type { i16, i8, i8, %struct.u }
+ %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* }
+ %struct.temp_slot = type opaque
+ %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, i8, i8, i8, i8, i8 }
+ %struct.tree_decl = type { %struct.tree_common, %struct.location_t, i32, %struct.tree_node*, i8, i8, i8, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_decl* }
+ %struct.tree_decl_u1 = type { i64 }
+ %struct.tree_decl_u2 = type { %struct.function* }
+ %struct.tree_node = type { %struct.tree_decl }
+ %struct.tree_type = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i32, i16, i8, i8, i32, %struct.tree_node*, %struct.tree_node*, %struct.rtunion, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_type* }
+ %struct.u = type { [1 x i64] }
+ %struct.var_refs_queue = type { %struct.rtx_def*, i32, i32, %struct.var_refs_queue* }
+ %struct.varasm_status = type opaque
+ %struct.varray_head_tag = type { i32, i32, i32, i8*, %struct.u }
+ %union.tree_ann_d = type opaque
+@mode_class = external global [35 x i8] ; <[35 x i8]*> [#uses=3]
+
+define void @fold_builtin_classify() {
+entry:
+ %tmp63 = load i32* null ; <i32> [#uses=1]
+ switch i32 %tmp63, label %bb276 [
+ i32 414, label %bb145
+ i32 417, label %bb
+ ]
+bb: ; preds = %entry
+ ret void
+bb145: ; preds = %entry
+ %tmp146 = load %struct.tree_node** null ; <%struct.tree_node*> [#uses=1]
+ %tmp148 = getelementptr %struct.tree_node* %tmp146, i32 0, i32 0, i32 0, i32 1 ; <%struct.tree_node**> [#uses=1]
+ %tmp149 = load %struct.tree_node** %tmp148 ; <%struct.tree_node*> [#uses=1]
+ %tmp150 = bitcast %struct.tree_node* %tmp149 to %struct.tree_type* ; <%struct.tree_type*> [#uses=1]
+ %tmp151 = getelementptr %struct.tree_type* %tmp150, i32 0, i32 6 ; <i16*> [#uses=1]
+ %tmp151.upgrd.1 = bitcast i16* %tmp151 to i32* ; <i32*> [#uses=1]
+ %tmp152 = load i32* %tmp151.upgrd.1 ; <i32> [#uses=1]
+ %tmp154 = lshr i32 %tmp152, 16 ; <i32> [#uses=1]
+ %tmp154.mask = and i32 %tmp154, 127 ; <i32> [#uses=1]
+ %gep.upgrd.2 = zext i32 %tmp154.mask to i64 ; <i64> [#uses=1]
+ %tmp155 = getelementptr [35 x i8]* @mode_class, i32 0, i64 %gep.upgrd.2 ; <i8*> [#uses=1]
+ %tmp156 = load i8* %tmp155 ; <i8> [#uses=1]
+ %tmp157 = icmp eq i8 %tmp156, 4 ; <i1> [#uses=1]
+ br i1 %tmp157, label %cond_next241, label %cond_true158
+cond_true158: ; preds = %bb145
+ %tmp172 = load %struct.tree_node** null ; <%struct.tree_node*> [#uses=1]
+ %tmp174 = getelementptr %struct.tree_node* %tmp172, i32 0, i32 0, i32 0, i32 1 ; <%struct.tree_node**> [#uses=1]
+ %tmp175 = load %struct.tree_node** %tmp174 ; <%struct.tree_node*> [#uses=1]
+ %tmp176 = bitcast %struct.tree_node* %tmp175 to %struct.tree_type* ; <%struct.tree_type*> [#uses=1]
+ %tmp177 = getelementptr %struct.tree_type* %tmp176, i32 0, i32 6 ; <i16*> [#uses=1]
+ %tmp177.upgrd.3 = bitcast i16* %tmp177 to i32* ; <i32*> [#uses=1]
+ %tmp178 = load i32* %tmp177.upgrd.3 ; <i32> [#uses=1]
+ %tmp180 = lshr i32 %tmp178, 16 ; <i32> [#uses=1]
+ %tmp180.mask = and i32 %tmp180, 127 ; <i32> [#uses=1]
+ %gep.upgrd.4 = zext i32 %tmp180.mask to i64 ; <i64> [#uses=1]
+ %tmp181 = getelementptr [35 x i8]* @mode_class, i32 0, i64 %gep.upgrd.4 ; <i8*> [#uses=1]
+ %tmp182 = load i8* %tmp181 ; <i8> [#uses=1]
+ %tmp183 = icmp eq i8 %tmp182, 8 ; <i1> [#uses=1]
+ br i1 %tmp183, label %cond_next241, label %cond_true184
+cond_true184: ; preds = %cond_true158
+ %tmp185 = load %struct.tree_node** null ; <%struct.tree_node*> [#uses=1]
+ %tmp187 = getelementptr %struct.tree_node* %tmp185, i32 0, i32 0, i32 0, i32 1 ; <%struct.tree_node**> [#uses=1]
+ %tmp188 = load %struct.tree_node** %tmp187 ; <%struct.tree_node*> [#uses=1]
+ %tmp189 = bitcast %struct.tree_node* %tmp188 to %struct.tree_type* ; <%struct.tree_type*> [#uses=1]
+ %tmp190 = getelementptr %struct.tree_type* %tmp189, i32 0, i32 6 ; <i16*> [#uses=1]
+ %tmp190.upgrd.5 = bitcast i16* %tmp190 to i32* ; <i32*> [#uses=1]
+ %tmp191 = load i32* %tmp190.upgrd.5 ; <i32> [#uses=1]
+ %tmp193 = lshr i32 %tmp191, 16 ; <i32> [#uses=1]
+ %tmp193.mask = and i32 %tmp193, 127 ; <i32> [#uses=1]
+ %gep.upgrd.6 = zext i32 %tmp193.mask to i64 ; <i64> [#uses=1]
+ %tmp194 = getelementptr [35 x i8]* @mode_class, i32 0, i64 %gep.upgrd.6 ; <i8*> [#uses=1]
+ %tmp195 = load i8* %tmp194 ; <i8> [#uses=1]
+ %tmp196 = icmp eq i8 %tmp195, 4 ; <i1> [#uses=1]
+ br i1 %tmp196, label %cond_next241, label %cond_true197
+cond_true197: ; preds = %cond_true184
+ ret void
+cond_next241: ; preds = %cond_true184, %cond_true158, %bb145
+ %tmp245 = load i32* null ; <i32> [#uses=0]
+ ret void
+bb276: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll b/test/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll
new file mode 100644
index 000000000000..0d056eed74e1
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll
@@ -0,0 +1,28 @@
+; PR957
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep select
+
+@G = extern_weak global i32
+
+define i32 @test(i32 %tmp) {
+cond_false179:
+ %tmp181 = icmp eq i32 %tmp, 0 ; <i1> [#uses=1]
+ br i1 %tmp181, label %cond_true182, label %cond_next185
+cond_true182: ; preds = %cond_false179
+ br label %cond_next185
+cond_next185: ; preds = %cond_true182, %cond_false179
+ %d0.3 = phi i32 [ udiv (i32 1, i32 ptrtoint (i32* @G to i32)), %cond_true182 ], [ %tmp, %cond_false179 ] ; <i32> [#uses=1]
+ ret i32 %d0.3
+}
+
+define i32 @test2(i32 %tmp) {
+cond_false179:
+ %tmp181 = icmp eq i32 %tmp, 0 ; <i1> [#uses=1]
+ br i1 %tmp181, label %cond_true182, label %cond_next185
+cond_true182: ; preds = %cond_false179
+ br label %cond_next185
+cond_next185: ; preds = %cond_true182, %cond_false179
+ %d0.3 = phi i32 [ udiv (i32 1, i32 ptrtoint (i32* @G to i32)), %cond_true182 ], [ %tmp, %cond_false179 ] ; <i32> [#uses=1]
+ call i32 @test( i32 4 ) ; <i32>:0 [#uses=0]
+ ret i32 %d0.3
+}
diff --git a/test/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll
new file mode 100644
index 000000000000..f22ca6ca330a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll
@@ -0,0 +1,555 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; END.
+ %struct..4._102 = type { %struct.QVectorData* }
+ %struct..5._125 = type { %struct.QMapData* }
+ %struct.QAbstractTextDocumentLayout = type { %struct.QObject }
+ %struct.QBasicAtomic = type { i32 }
+ %struct.QFont = type { %struct.QFontPrivate*, i32 }
+ %struct.QFontMetrics = type { %struct.QFontPrivate* }
+ %struct.QFontPrivate = type opaque
+ %"struct.QFragmentMap<QTextBlockData>" = type { %struct.QFragmentMapData }
+ %struct.QFragmentMapData = type { %"struct.QFragmentMapData::._154", i32 }
+ %"struct.QFragmentMapData::._154" = type { %"struct.QFragmentMapData::Header"* }
+ %"struct.QFragmentMapData::Header" = type { i32, i32, i32, i32, i32, i32, i32, i32 }
+ %"struct.QHash<uint,QHashDummyValue>" = type { %"struct.QHash<uint,QHashDummyValue>::._152" }
+ %"struct.QHash<uint,QHashDummyValue>::._152" = type { %struct.QHashData* }
+ %struct.QHashData = type { %"struct.QHashData::Node"*, %"struct.QHashData::Node"**, %struct.QBasicAtomic, i32, i32, i16, i16, i32, i8 }
+ %"struct.QHashData::Node" = type { %"struct.QHashData::Node"*, i32 }
+ %"struct.QList<QObject*>::._92" = type { %struct.QListData }
+ %"struct.QList<QPointer<QObject> >" = type { %"struct.QList<QObject*>::._92" }
+ %struct.QListData = type { %"struct.QListData::Data"* }
+ %"struct.QListData::Data" = type { %struct.QBasicAtomic, i32, i32, i32, i8, [1 x i8*] }
+ %"struct.QMap<QUrl,QVariant>" = type { %struct..5._125 }
+ %struct.QMapData = type { %"struct.QMapData::Node"*, [12 x %"struct.QMapData::Node"*], %struct.QBasicAtomic, i32, i32, i32, i8 }
+ %"struct.QMapData::Node" = type { %"struct.QMapData::Node"*, [1 x %"struct.QMapData::Node"*] }
+ %struct.QObject = type { i32 (...)**, %struct.QObjectData* }
+ %struct.QObjectData = type { i32 (...)**, %struct.QObject*, %struct.QObject*, %"struct.QList<QPointer<QObject> >", i8, [3 x i8], i32, i32 }
+ %struct.QObjectPrivate = type { %struct.QObjectData, i32, %struct.QObject*, %"struct.QList<QPointer<QObject> >", %"struct.QVector<QAbstractTextDocumentLayout::Selection>", %struct.QString }
+ %struct.QPaintDevice = type { i32 (...)**, i16 }
+ %struct.QPainter = type { %struct.QPainterPrivate* }
+ %struct.QPainterPrivate = type opaque
+ %struct.QPointF = type { double, double }
+ %struct.QPrinter = type { %struct.QPaintDevice, %struct.QPrinterPrivate* }
+ %struct.QPrinterPrivate = type opaque
+ %struct.QRectF = type { double, double, double, double }
+ %"struct.QSet<uint>" = type { %"struct.QHash<uint,QHashDummyValue>" }
+ %"struct.QSharedDataPointer<QTextFormatPrivate>" = type { %struct.QTextFormatPrivate* }
+ %struct.QString = type { %"struct.QString::Data"* }
+ %"struct.QString::Data" = type { %struct.QBasicAtomic, i32, i32, i16*, i8, i8, [1 x i16] }
+ %struct.QTextBlockFormat = type { %struct.QTextFormat }
+ %struct.QTextBlockGroup = type { %struct.QAbstractTextDocumentLayout }
+ %struct.QTextDocumentConfig = type { %struct.QString }
+ %struct.QTextDocumentPrivate = type { %struct.QObjectPrivate, %struct.QString, %"struct.QVector<QAbstractTextDocumentLayout::Selection>", i1, i32, i32, i1, i32, i32, i32, i32, i1, %struct.QTextFormatCollection, %struct.QTextBlockGroup*, %struct.QAbstractTextDocumentLayout*, %"struct.QFragmentMap<QTextBlockData>", %"struct.QFragmentMap<QTextBlockData>", i32, %"struct.QList<QPointer<QObject> >", %"struct.QList<QPointer<QObject> >", %"struct.QMap<QUrl,QVariant>", %"struct.QMap<QUrl,QVariant>", %"struct.QMap<QUrl,QVariant>", %struct.QTextDocumentConfig, i1, i1, %struct.QPointF }
+ %struct.QTextFormat = type { %"struct.QSharedDataPointer<QTextFormatPrivate>", i32 }
+ %struct.QTextFormatCollection = type { %"struct.QVector<QAbstractTextDocumentLayout::Selection>", %"struct.QVector<QAbstractTextDocumentLayout::Selection>", %"struct.QSet<uint>", %struct.QFont }
+ %struct.QTextFormatPrivate = type opaque
+ %"struct.QVector<QAbstractTextDocumentLayout::Selection>" = type { %struct..4._102 }
+ %struct.QVectorData = type { %struct.QBasicAtomic, i32, i32, i8 }
+
+define void @_ZNK13QTextDocument5printEP8QPrinter(%struct.QAbstractTextDocumentLayout* %this, %struct.QPrinter* %printer) {
+entry:
+ %tmp = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=2]
+ %tmp.upgrd.1 = alloca %struct.QRectF, align 16 ; <%struct.QRectF*> [#uses=5]
+ %tmp2 = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=3]
+ %tmp.upgrd.2 = alloca %struct.QFontMetrics, align 16 ; <%struct.QFontMetrics*> [#uses=4]
+ %tmp.upgrd.3 = alloca %struct.QFont, align 16 ; <%struct.QFont*> [#uses=4]
+ %tmp3 = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=2]
+ %p = alloca %struct.QPainter, align 16 ; <%struct.QPainter*> [#uses=14]
+ %body = alloca %struct.QRectF, align 16 ; <%struct.QRectF*> [#uses=9]
+ %pageNumberPos = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=4]
+ %scaledPageSize = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=6]
+ %printerPageSize = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=3]
+ %fmt = alloca %struct.QTextBlockFormat, align 16 ; <%struct.QTextBlockFormat*> [#uses=5]
+ %font = alloca %struct.QFont, align 16 ; <%struct.QFont*> [#uses=5]
+ %tmp.upgrd.4 = call %struct.QTextDocumentPrivate* @_ZNK13QTextDocument6d_funcEv( %struct.QAbstractTextDocumentLayout* %this ) ; <%struct.QTextDocumentPrivate*> [#uses=5]
+ %tmp.upgrd.5 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1]
+ call void @_ZN8QPainterC1EP12QPaintDevice( %struct.QPainter* %p, %struct.QPaintDevice* %tmp.upgrd.5 )
+ %tmp.upgrd.6 = invoke i1 @_ZNK8QPainter8isActiveEv( %struct.QPainter* %p )
+ to label %invcont unwind label %cleanup329 ; <i1> [#uses=1]
+invcont: ; preds = %entry
+ br i1 %tmp.upgrd.6, label %cond_next, label %cleanup328
+cond_next: ; preds = %invcont
+ %tmp8 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %this )
+ to label %invcont7 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=0]
+invcont7: ; preds = %cond_next
+ %tmp10 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26 ; <%struct.QPointF*> [#uses=1]
+ call void @_ZN7QPointFC1Edd( %struct.QPointF* %tmp, double 0.000000e+00, double 0.000000e+00 )
+ call void @_ZN6QRectFC1ERK7QPointFRK6QSizeF( %struct.QRectF* %body, %struct.QPointF* %tmp, %struct.QPointF* %tmp10 )
+ call void @_ZN7QPointFC1Ev( %struct.QPointF* %pageNumberPos )
+ %tmp12 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26 ; <%struct.QPointF*> [#uses=1]
+ %tmp13 = call i1 @_ZNK6QSizeF7isValidEv( %struct.QPointF* %tmp12 ) ; <i1> [#uses=1]
+ br i1 %tmp13, label %cond_next15, label %bb
+cond_next15: ; preds = %invcont7
+ %tmp17 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26 ; <%struct.QPointF*> [#uses=1]
+ %tmp.upgrd.7 = call double @_ZNK6QSizeF6heightEv( %struct.QPointF* %tmp17 ) ; <double> [#uses=1]
+ %tmp18 = fcmp oeq double %tmp.upgrd.7, 0x41DFFFFFFFC00000 ; <i1> [#uses=1]
+ br i1 %tmp18, label %bb, label %cond_next20
+cond_next20: ; preds = %cond_next15
+ br label %bb21
+bb: ; preds = %cond_next15, %invcont7
+ br label %bb21
+bb21: ; preds = %bb, %cond_next20
+ %iftmp.406.0 = phi i1 [ false, %bb ], [ true, %cond_next20 ] ; <i1> [#uses=1]
+ br i1 %iftmp.406.0, label %cond_true24, label %cond_false
+cond_true24: ; preds = %bb21
+ %tmp.upgrd.8 = invoke i32 @_Z13qt_defaultDpiv( )
+ to label %invcont25 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont25: ; preds = %cond_true24
+ %tmp26 = sitofp i32 %tmp.upgrd.8 to double ; <double> [#uses=2]
+ %tmp30 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %this )
+ to label %invcont29 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=1]
+invcont29: ; preds = %invcont25
+ %tmp32 = invoke %struct.QPaintDevice* @_ZNK27QAbstractTextDocumentLayout11paintDeviceEv( %struct.QAbstractTextDocumentLayout* %tmp30 )
+ to label %invcont31 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=3]
+invcont31: ; preds = %invcont29
+ %tmp34 = icmp eq %struct.QPaintDevice* %tmp32, null ; <i1> [#uses=1]
+ br i1 %tmp34, label %cond_next42, label %cond_true35
+cond_true35: ; preds = %invcont31
+ %tmp38 = invoke i32 @_ZNK12QPaintDevice11logicalDpiXEv( %struct.QPaintDevice* %tmp32 )
+ to label %invcont37 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont37: ; preds = %cond_true35
+ %tmp38.upgrd.9 = sitofp i32 %tmp38 to double ; <double> [#uses=1]
+ %tmp41 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp32 )
+ to label %invcont40 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont40: ; preds = %invcont37
+ %tmp41.upgrd.10 = sitofp i32 %tmp41 to double ; <double> [#uses=1]
+ br label %cond_next42
+cond_next42: ; preds = %invcont40, %invcont31
+ %sourceDpiY.2 = phi double [ %tmp41.upgrd.10, %invcont40 ], [ %tmp26, %invcont31 ] ; <double> [#uses=1]
+ %sourceDpiX.2 = phi double [ %tmp38.upgrd.9, %invcont40 ], [ %tmp26, %invcont31 ] ; <double> [#uses=1]
+ %tmp44 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1]
+ %tmp46 = invoke i32 @_ZNK12QPaintDevice11logicalDpiXEv( %struct.QPaintDevice* %tmp44 )
+ to label %invcont45 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont45: ; preds = %cond_next42
+ %tmp46.upgrd.11 = sitofp i32 %tmp46 to double ; <double> [#uses=1]
+ %tmp48 = fdiv double %tmp46.upgrd.11, %sourceDpiX.2 ; <double> [#uses=2]
+ %tmp50 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1]
+ %tmp52 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp50 )
+ to label %invcont51 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont51: ; preds = %invcont45
+ %tmp52.upgrd.12 = sitofp i32 %tmp52 to double ; <double> [#uses=1]
+ %tmp54 = fdiv double %tmp52.upgrd.12, %sourceDpiY.2 ; <double> [#uses=2]
+ invoke void @_ZN8QPainter5scaleEdd( %struct.QPainter* %p, double %tmp48, double %tmp54 )
+ to label %invcont57 unwind label %cleanup329
+invcont57: ; preds = %invcont51
+ %tmp.upgrd.13 = getelementptr %struct.QPointF* %scaledPageSize, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp60 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26, i32 0 ; <double*> [#uses=1]
+ %tmp61 = load double* %tmp60 ; <double> [#uses=1]
+ store double %tmp61, double* %tmp.upgrd.13
+ %tmp62 = getelementptr %struct.QPointF* %scaledPageSize, i32 0, i32 1 ; <double*> [#uses=1]
+ %tmp63 = getelementptr %struct.QTextDocumentPrivate* %tmp.upgrd.4, i32 0, i32 26, i32 1 ; <double*> [#uses=1]
+ %tmp64 = load double* %tmp63 ; <double> [#uses=1]
+ store double %tmp64, double* %tmp62
+ %tmp65 = call double* @_ZN6QSizeF6rwidthEv( %struct.QPointF* %scaledPageSize ) ; <double*> [#uses=2]
+ %tmp67 = load double* %tmp65 ; <double> [#uses=1]
+ %tmp69 = mul double %tmp67, %tmp48 ; <double> [#uses=1]
+ store double %tmp69, double* %tmp65
+ %tmp71 = call double* @_ZN6QSizeF7rheightEv( %struct.QPointF* %scaledPageSize ) ; <double*> [#uses=2]
+ %tmp73 = load double* %tmp71 ; <double> [#uses=1]
+ %tmp75 = mul double %tmp73, %tmp54 ; <double> [#uses=1]
+ store double %tmp75, double* %tmp71
+ %tmp78 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1]
+ %tmp80 = invoke i32 @_ZNK12QPaintDevice6heightEv( %struct.QPaintDevice* %tmp78 )
+ to label %invcont79 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont79: ; preds = %invcont57
+ %tmp82 = getelementptr %struct.QPrinter* %printer, i32 0, i32 0 ; <%struct.QPaintDevice*> [#uses=1]
+ %tmp84 = invoke i32 @_ZNK12QPaintDevice5widthEv( %struct.QPaintDevice* %tmp82 )
+ to label %invcont83 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont83: ; preds = %invcont79
+ %tmp80.upgrd.14 = sitofp i32 %tmp80 to double ; <double> [#uses=1]
+ %tmp84.upgrd.15 = sitofp i32 %tmp84 to double ; <double> [#uses=1]
+ call void @_ZN6QSizeFC1Edd( %struct.QPointF* %printerPageSize, double %tmp84.upgrd.15, double %tmp80.upgrd.14 )
+ %tmp85 = call double @_ZNK6QSizeF6heightEv( %struct.QPointF* %printerPageSize ) ; <double> [#uses=1]
+ %tmp86 = call double @_ZNK6QSizeF6heightEv( %struct.QPointF* %scaledPageSize ) ; <double> [#uses=1]
+ %tmp87 = fdiv double %tmp85, %tmp86 ; <double> [#uses=1]
+ %tmp88 = call double @_ZNK6QSizeF5widthEv( %struct.QPointF* %printerPageSize ) ; <double> [#uses=1]
+ %tmp89 = call double @_ZNK6QSizeF5widthEv( %struct.QPointF* %scaledPageSize ) ; <double> [#uses=1]
+ %tmp90 = fdiv double %tmp88, %tmp89 ; <double> [#uses=1]
+ invoke void @_ZN8QPainter5scaleEdd( %struct.QPainter* %p, double %tmp90, double %tmp87 )
+ to label %cond_next194 unwind label %cleanup329
+cond_false: ; preds = %bb21
+ %tmp.upgrd.16 = getelementptr %struct.QAbstractTextDocumentLayout* %this, i32 0, i32 0 ; <%struct.QObject*> [#uses=1]
+ %tmp95 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument5cloneEP7QObject( %struct.QAbstractTextDocumentLayout* %this, %struct.QObject* %tmp.upgrd.16 )
+ to label %invcont94 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=9]
+invcont94: ; preds = %cond_false
+ %tmp99 = invoke %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %tmp95 )
+ to label %invcont98 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=1]
+invcont98: ; preds = %invcont94
+ %tmp101 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p )
+ to label %invcont100 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=1]
+invcont100: ; preds = %invcont98
+ invoke void @_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice( %struct.QAbstractTextDocumentLayout* %tmp99, %struct.QPaintDevice* %tmp101 )
+ to label %invcont103 unwind label %cleanup329
+invcont103: ; preds = %invcont100
+ %tmp105 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p )
+ to label %invcont104 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=1]
+invcont104: ; preds = %invcont103
+ %tmp107 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp105 )
+ to label %invcont106 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont106: ; preds = %invcont104
+ %tmp108 = sitofp i32 %tmp107 to double ; <double> [#uses=1]
+ %tmp109 = mul double %tmp108, 0x3FE93264C993264C ; <double> [#uses=1]
+ %tmp109.upgrd.17 = fptosi double %tmp109 to i32 ; <i32> [#uses=3]
+ %tmp.upgrd.18 = call %struct.QTextBlockGroup* @_ZNK13QTextDocument9rootFrameEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) ; <%struct.QTextBlockGroup*> [#uses=1]
+ invoke void @_ZNK10QTextFrame11frameFormatEv( %struct.QTextBlockFormat* sret %fmt, %struct.QTextBlockGroup* %tmp.upgrd.18 )
+ to label %invcont111 unwind label %cleanup329
+invcont111: ; preds = %invcont106
+ %tmp112 = sitofp i32 %tmp109.upgrd.17 to double ; <double> [#uses=1]
+ invoke void @_ZN16QTextFrameFormat9setMarginEd( %struct.QTextBlockFormat* %fmt, double %tmp112 )
+ to label %invcont114 unwind label %cleanup192
+invcont114: ; preds = %invcont111
+ %tmp116 = call %struct.QTextBlockGroup* @_ZNK13QTextDocument9rootFrameEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) ; <%struct.QTextBlockGroup*> [#uses=1]
+ invoke void @_ZN10QTextFrame14setFrameFormatERK16QTextFrameFormat( %struct.QTextBlockGroup* %tmp116, %struct.QTextBlockFormat* %fmt )
+ to label %invcont117 unwind label %cleanup192
+invcont117: ; preds = %invcont114
+ %tmp119 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p )
+ to label %invcont118 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1]
+invcont118: ; preds = %invcont117
+ %tmp121 = invoke i32 @_ZNK12QPaintDevice6heightEv( %struct.QPaintDevice* %tmp119 )
+ to label %invcont120 unwind label %cleanup192 ; <i32> [#uses=1]
+invcont120: ; preds = %invcont118
+ %tmp121.upgrd.19 = sitofp i32 %tmp121 to double ; <double> [#uses=1]
+ %tmp123 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p )
+ to label %invcont122 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1]
+invcont122: ; preds = %invcont120
+ %tmp125 = invoke i32 @_ZNK12QPaintDevice5widthEv( %struct.QPaintDevice* %tmp123 )
+ to label %invcont124 unwind label %cleanup192 ; <i32> [#uses=1]
+invcont124: ; preds = %invcont122
+ %tmp125.upgrd.20 = sitofp i32 %tmp125 to double ; <double> [#uses=1]
+ call void @_ZN6QRectFC1Edddd( %struct.QRectF* %tmp.upgrd.1, double 0.000000e+00, double 0.000000e+00, double %tmp125.upgrd.20, double %tmp121.upgrd.19 )
+ %tmp126 = getelementptr %struct.QRectF* %body, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp127 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp128 = load double* %tmp127 ; <double> [#uses=1]
+ store double %tmp128, double* %tmp126
+ %tmp129 = getelementptr %struct.QRectF* %body, i32 0, i32 1 ; <double*> [#uses=1]
+ %tmp130 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 1 ; <double*> [#uses=1]
+ %tmp131 = load double* %tmp130 ; <double> [#uses=1]
+ store double %tmp131, double* %tmp129
+ %tmp132 = getelementptr %struct.QRectF* %body, i32 0, i32 2 ; <double*> [#uses=1]
+ %tmp133 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 2 ; <double*> [#uses=1]
+ %tmp134 = load double* %tmp133 ; <double> [#uses=1]
+ store double %tmp134, double* %tmp132
+ %tmp135 = getelementptr %struct.QRectF* %body, i32 0, i32 3 ; <double*> [#uses=1]
+ %tmp136 = getelementptr %struct.QRectF* %tmp.upgrd.1, i32 0, i32 3 ; <double*> [#uses=1]
+ %tmp137 = load double* %tmp136 ; <double> [#uses=1]
+ store double %tmp137, double* %tmp135
+ %tmp138 = call double @_ZNK6QRectF6heightEv( %struct.QRectF* %body ) ; <double> [#uses=1]
+ %tmp139 = sitofp i32 %tmp109.upgrd.17 to double ; <double> [#uses=1]
+ %tmp140 = sub double %tmp138, %tmp139 ; <double> [#uses=1]
+ %tmp142 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p )
+ to label %invcont141 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1]
+invcont141: ; preds = %invcont124
+ invoke void @_ZNK13QTextDocument11defaultFontEv( %struct.QFont* sret %tmp.upgrd.3, %struct.QAbstractTextDocumentLayout* %tmp95 )
+ to label %invcont144 unwind label %cleanup192
+invcont144: ; preds = %invcont141
+ invoke void @_ZN12QFontMetricsC1ERK5QFontP12QPaintDevice( %struct.QFontMetrics* %tmp.upgrd.2, %struct.QFont* %tmp.upgrd.3, %struct.QPaintDevice* %tmp142 )
+ to label %invcont146 unwind label %cleanup173
+invcont146: ; preds = %invcont144
+ %tmp149 = invoke i32 @_ZNK12QFontMetrics6ascentEv( %struct.QFontMetrics* %tmp.upgrd.2 )
+ to label %invcont148 unwind label %cleanup168 ; <i32> [#uses=1]
+invcont148: ; preds = %invcont146
+ %tmp149.upgrd.21 = sitofp i32 %tmp149 to double ; <double> [#uses=1]
+ %tmp150 = add double %tmp140, %tmp149.upgrd.21 ; <double> [#uses=1]
+ %tmp152 = invoke %struct.QPaintDevice* @_ZNK8QPainter6deviceEv( %struct.QPainter* %p )
+ to label %invcont151 unwind label %cleanup168 ; <%struct.QPaintDevice*> [#uses=1]
+invcont151: ; preds = %invcont148
+ %tmp154 = invoke i32 @_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp152 )
+ to label %invcont153 unwind label %cleanup168 ; <i32> [#uses=1]
+invcont153: ; preds = %invcont151
+ %tmp155 = mul i32 %tmp154, 5 ; <i32> [#uses=1]
+ %tmp156 = sdiv i32 %tmp155, 72 ; <i32> [#uses=1]
+ %tmp156.upgrd.22 = sitofp i32 %tmp156 to double ; <double> [#uses=1]
+ %tmp157 = add double %tmp150, %tmp156.upgrd.22 ; <double> [#uses=1]
+ %tmp158 = call double @_ZNK6QRectF5widthEv( %struct.QRectF* %body ) ; <double> [#uses=1]
+ %tmp159 = sitofp i32 %tmp109.upgrd.17 to double ; <double> [#uses=1]
+ %tmp160 = sub double %tmp158, %tmp159 ; <double> [#uses=1]
+ call void @_ZN7QPointFC1Edd( %struct.QPointF* %tmp2, double %tmp160, double %tmp157 )
+ %tmp161 = getelementptr %struct.QPointF* %pageNumberPos, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp162 = getelementptr %struct.QPointF* %tmp2, i32 0, i32 0 ; <double*> [#uses=1]
+ %tmp163 = load double* %tmp162 ; <double> [#uses=1]
+ store double %tmp163, double* %tmp161
+ %tmp164 = getelementptr %struct.QPointF* %pageNumberPos, i32 0, i32 1 ; <double*> [#uses=1]
+ %tmp165 = getelementptr %struct.QPointF* %tmp2, i32 0, i32 1 ; <double*> [#uses=1]
+ %tmp166 = load double* %tmp165 ; <double> [#uses=1]
+ store double %tmp166, double* %tmp164
+ invoke void @_ZN12QFontMetricsD1Ev( %struct.QFontMetrics* %tmp.upgrd.2 )
+ to label %cleanup171 unwind label %cleanup173
+cleanup168: ; preds = %invcont151, %invcont148, %invcont146
+ invoke void @_ZN12QFontMetricsD1Ev( %struct.QFontMetrics* %tmp.upgrd.2 )
+ to label %cleanup173 unwind label %cleanup173
+cleanup171: ; preds = %invcont153
+ invoke void @_ZN5QFontD1Ev( %struct.QFont* %tmp.upgrd.3 )
+ to label %finally170 unwind label %cleanup192
+cleanup173: ; preds = %cleanup168, %cleanup168, %invcont153, %invcont144
+ invoke void @_ZN5QFontD1Ev( %struct.QFont* %tmp.upgrd.3 )
+ to label %cleanup192 unwind label %cleanup192
+finally170: ; preds = %cleanup171
+ invoke void @_ZNK13QTextDocument11defaultFontEv( %struct.QFont* sret %font, %struct.QAbstractTextDocumentLayout* %tmp95 )
+ to label %invcont177 unwind label %cleanup192
+invcont177: ; preds = %finally170
+ invoke void @_ZN5QFont12setPointSizeEi( %struct.QFont* %font, i32 10 )
+ to label %invcont179 unwind label %cleanup187
+invcont179: ; preds = %invcont177
+ invoke void @_ZN13QTextDocument14setDefaultFontERK5QFont( %struct.QAbstractTextDocumentLayout* %tmp95, %struct.QFont* %font )
+ to label %invcont181 unwind label %cleanup187
+invcont181: ; preds = %invcont179
+ call void @_ZNK6QRectF4sizeEv( %struct.QPointF* sret %tmp3, %struct.QRectF* %body )
+ invoke void @_ZN13QTextDocument11setPageSizeERK6QSizeF( %struct.QAbstractTextDocumentLayout* %tmp95, %struct.QPointF* %tmp3 )
+ to label %cleanup185 unwind label %cleanup187
+cleanup185: ; preds = %invcont181
+ invoke void @_ZN5QFontD1Ev( %struct.QFont* %font )
+ to label %cleanup190 unwind label %cleanup192
+cleanup187: ; preds = %invcont181, %invcont179, %invcont177
+ invoke void @_ZN5QFontD1Ev( %struct.QFont* %font )
+ to label %cleanup192 unwind label %cleanup192
+cleanup190: ; preds = %cleanup185
+ invoke void @_ZN16QTextFrameFormatD1Ev( %struct.QTextBlockFormat* %fmt )
+ to label %cond_next194 unwind label %cleanup329
+cleanup192: ; preds = %cleanup187, %cleanup187, %cleanup185, %finally170, %cleanup173, %cleanup173, %cleanup171, %invcont141, %invcont124, %invcont122, %invcont120, %invcont118, %invcont117, %invcont114, %invcont111
+ invoke void @_ZN16QTextFrameFormatD1Ev( %struct.QTextBlockFormat* %fmt )
+ to label %cleanup329 unwind label %cleanup329
+cond_next194: ; preds = %cleanup190, %invcont83
+ %clonedDoc.1 = phi %struct.QAbstractTextDocumentLayout* [ null, %invcont83 ], [ %tmp95, %cleanup190 ] ; <%struct.QAbstractTextDocumentLayout*> [#uses=3]
+ %doc.1 = phi %struct.QAbstractTextDocumentLayout* [ %this, %invcont83 ], [ %tmp95, %cleanup190 ] ; <%struct.QAbstractTextDocumentLayout*> [#uses=2]
+ %tmp197 = invoke i1 @_ZNK8QPrinter13collateCopiesEv( %struct.QPrinter* %printer )
+ to label %invcont196 unwind label %cleanup329 ; <i1> [#uses=1]
+invcont196: ; preds = %cond_next194
+ br i1 %tmp197, label %cond_true200, label %cond_false204
+cond_true200: ; preds = %invcont196
+ %tmp203 = invoke i32 @_ZNK8QPrinter9numCopiesEv( %struct.QPrinter* %printer )
+ to label %invcont202 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont202: ; preds = %cond_true200
+ br label %cond_next208
+cond_false204: ; preds = %invcont196
+ %tmp207 = invoke i32 @_ZNK8QPrinter9numCopiesEv( %struct.QPrinter* %printer )
+ to label %invcont206 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont206: ; preds = %cond_false204
+ br label %cond_next208
+cond_next208: ; preds = %invcont206, %invcont202
+ %pageCopies.0 = phi i32 [ %tmp203, %invcont202 ], [ 1, %invcont206 ] ; <i32> [#uses=2]
+ %docCopies.0 = phi i32 [ 1, %invcont202 ], [ %tmp207, %invcont206 ] ; <i32> [#uses=2]
+ %tmp211 = invoke i32 @_ZNK8QPrinter8fromPageEv( %struct.QPrinter* %printer )
+ to label %invcont210 unwind label %cleanup329 ; <i32> [#uses=3]
+invcont210: ; preds = %cond_next208
+ %tmp214 = invoke i32 @_ZNK8QPrinter6toPageEv( %struct.QPrinter* %printer )
+ to label %invcont213 unwind label %cleanup329 ; <i32> [#uses=3]
+invcont213: ; preds = %invcont210
+ %tmp216 = icmp eq i32 %tmp211, 0 ; <i1> [#uses=1]
+ br i1 %tmp216, label %cond_true217, label %cond_next225
+cond_true217: ; preds = %invcont213
+ %tmp219 = icmp eq i32 %tmp214, 0 ; <i1> [#uses=1]
+ br i1 %tmp219, label %cond_true220, label %cond_next225
+cond_true220: ; preds = %cond_true217
+ %tmp223 = invoke i32 @_ZNK13QTextDocument9pageCountEv( %struct.QAbstractTextDocumentLayout* %doc.1 )
+ to label %invcont222 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont222: ; preds = %cond_true220
+ br label %cond_next225
+cond_next225: ; preds = %invcont222, %cond_true217, %invcont213
+ %toPage.1 = phi i32 [ %tmp223, %invcont222 ], [ %tmp214, %cond_true217 ], [ %tmp214, %invcont213 ] ; <i32> [#uses=2]
+ %fromPage.1 = phi i32 [ 1, %invcont222 ], [ %tmp211, %cond_true217 ], [ %tmp211, %invcont213 ] ; <i32> [#uses=2]
+ %tmp.page = invoke i32 @_ZNK8QPrinter9pageOrderEv( %struct.QPrinter* %printer )
+ to label %invcont227 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont227: ; preds = %cond_next225
+ %tmp228 = icmp eq i32 %tmp.page, 1 ; <i1> [#uses=1]
+ br i1 %tmp228, label %cond_true230, label %cond_next234
+cond_true230: ; preds = %invcont227
+ br label %cond_next234
+cond_next234: ; preds = %cond_true230, %invcont227
+ %ascending.1 = phi i1 [ false, %cond_true230 ], [ true, %invcont227 ] ; <i1> [#uses=1]
+ %toPage.2 = phi i32 [ %fromPage.1, %cond_true230 ], [ %toPage.1, %invcont227 ] ; <i32> [#uses=1]
+ %fromPage.2 = phi i32 [ %toPage.1, %cond_true230 ], [ %fromPage.1, %invcont227 ] ; <i32> [#uses=1]
+ br label %bb309
+bb237: ; preds = %cond_true313, %cond_next293
+ %iftmp.410.4 = phi i1 [ %iftmp.410.5, %cond_true313 ], [ %iftmp.410.1, %cond_next293 ] ; <i1> [#uses=1]
+ %page.4 = phi i32 [ %fromPage.2, %cond_true313 ], [ %page.3, %cond_next293 ] ; <i32> [#uses=4]
+ br label %bb273
+invcont240: ; preds = %cond_true277
+ %tmp242 = icmp eq i32 %tmp241, 2 ; <i1> [#uses=1]
+ br i1 %tmp242, label %bb252, label %cond_next244
+cond_next244: ; preds = %invcont240
+ %tmp247 = invoke i32 @_ZNK8QPrinter12printerStateEv( %struct.QPrinter* %printer )
+ to label %invcont246 unwind label %cleanup329 ; <i32> [#uses=1]
+invcont246: ; preds = %cond_next244
+ %tmp248 = icmp eq i32 %tmp247, 3 ; <i1> [#uses=1]
+ br i1 %tmp248, label %bb252, label %bb253
+bb252: ; preds = %invcont246, %invcont240
+ br label %bb254
+bb253: ; preds = %invcont246
+ br label %bb254
+bb254: ; preds = %bb253, %bb252
+ %iftmp.410.0 = phi i1 [ true, %bb252 ], [ false, %bb253 ] ; <i1> [#uses=2]
+ br i1 %iftmp.410.0, label %UserCanceled, label %cond_next258
+cond_next258: ; preds = %bb254
+ invoke fastcc void @_Z9printPageiP8QPainterPK13QTextDocumentRK6QRectFRK7QPointF( i32 %page.4, %struct.QPainter* %p, %struct.QAbstractTextDocumentLayout* %doc.1, %struct.QRectF* %body, %struct.QPointF* %pageNumberPos )
+ to label %invcont261 unwind label %cleanup329
+invcont261: ; preds = %cond_next258
+ %tmp263 = add i32 %pageCopies.0, -1 ; <i32> [#uses=1]
+ %tmp265 = icmp sgt i32 %tmp263, %j.4 ; <i1> [#uses=1]
+ br i1 %tmp265, label %cond_true266, label %cond_next270
+cond_true266: ; preds = %invcont261
+ %tmp269 = invoke i1 @_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer )
+ to label %cond_next270 unwind label %cleanup329 ; <i1> [#uses=0]
+cond_next270: ; preds = %cond_true266, %invcont261
+ %tmp272 = add i32 %j.4, 1 ; <i32> [#uses=1]
+ br label %bb273
+bb273: ; preds = %cond_next270, %bb237
+ %iftmp.410.1 = phi i1 [ %iftmp.410.4, %bb237 ], [ %iftmp.410.0, %cond_next270 ] ; <i1> [#uses=2]
+ %j.4 = phi i32 [ 0, %bb237 ], [ %tmp272, %cond_next270 ] ; <i32> [#uses=3]
+ %tmp276 = icmp slt i32 %j.4, %pageCopies.0 ; <i1> [#uses=1]
+ br i1 %tmp276, label %cond_true277, label %bb280
+cond_true277: ; preds = %bb273
+ %tmp241 = invoke i32 @_ZNK8QPrinter12printerStateEv( %struct.QPrinter* %printer )
+ to label %invcont240 unwind label %cleanup329 ; <i32> [#uses=1]
+bb280: ; preds = %bb273
+ %tmp283 = icmp eq i32 %page.4, %toPage.2 ; <i1> [#uses=1]
+ br i1 %tmp283, label %bb297, label %cond_next285
+cond_next285: ; preds = %bb280
+ br i1 %ascending.1, label %cond_true287, label %cond_false290
+cond_true287: ; preds = %cond_next285
+ %tmp289 = add i32 %page.4, 1 ; <i32> [#uses=1]
+ br label %cond_next293
+cond_false290: ; preds = %cond_next285
+ %tmp292 = add i32 %page.4, -1 ; <i32> [#uses=1]
+ br label %cond_next293
+cond_next293: ; preds = %cond_false290, %cond_true287
+ %page.3 = phi i32 [ %tmp289, %cond_true287 ], [ %tmp292, %cond_false290 ] ; <i32> [#uses=1]
+ %tmp296 = invoke i1 @_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer )
+ to label %bb237 unwind label %cleanup329 ; <i1> [#uses=0]
+bb297: ; preds = %bb280
+ %tmp299 = add i32 %docCopies.0, -1 ; <i32> [#uses=1]
+ %tmp301 = icmp sgt i32 %tmp299, %i.1 ; <i1> [#uses=1]
+ br i1 %tmp301, label %cond_true302, label %cond_next306
+cond_true302: ; preds = %bb297
+ %tmp305 = invoke i1 @_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer )
+ to label %cond_next306 unwind label %cleanup329 ; <i1> [#uses=0]
+cond_next306: ; preds = %cond_true302, %bb297
+ %tmp308 = add i32 %i.1, 1 ; <i32> [#uses=1]
+ br label %bb309
+bb309: ; preds = %cond_next306, %cond_next234
+ %iftmp.410.5 = phi i1 [ undef, %cond_next234 ], [ %iftmp.410.1, %cond_next306 ] ; <i1> [#uses=1]
+ %i.1 = phi i32 [ 0, %cond_next234 ], [ %tmp308, %cond_next306 ] ; <i32> [#uses=3]
+ %tmp312 = icmp slt i32 %i.1, %docCopies.0 ; <i1> [#uses=1]
+ br i1 %tmp312, label %cond_true313, label %UserCanceled
+cond_true313: ; preds = %bb309
+ br label %bb237
+UserCanceled: ; preds = %bb309, %bb254
+ %tmp318 = icmp eq %struct.QAbstractTextDocumentLayout* %clonedDoc.1, null ; <i1> [#uses=1]
+ br i1 %tmp318, label %cleanup327, label %cond_true319
+cond_true319: ; preds = %UserCanceled
+ %tmp.upgrd.23 = getelementptr %struct.QAbstractTextDocumentLayout* %clonedDoc.1, i32 0, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
+ %tmp.upgrd.24 = load i32 (...)*** %tmp.upgrd.23 ; <i32 (...)**> [#uses=1]
+ %tmp322 = getelementptr i32 (...)** %tmp.upgrd.24, i32 4 ; <i32 (...)**> [#uses=1]
+ %tmp.upgrd.25 = load i32 (...)** %tmp322 ; <i32 (...)*> [#uses=1]
+ %tmp.upgrd.26 = bitcast i32 (...)* %tmp.upgrd.25 to void (%struct.QAbstractTextDocumentLayout*)* ; <void (%struct.QAbstractTextDocumentLayout*)*> [#uses=1]
+ invoke void %tmp.upgrd.26( %struct.QAbstractTextDocumentLayout* %clonedDoc.1 )
+ to label %cleanup327 unwind label %cleanup329
+cleanup327: ; preds = %cond_true319, %UserCanceled
+ call void @_ZN8QPainterD1Ev( %struct.QPainter* %p )
+ ret void
+cleanup328: ; preds = %invcont
+ call void @_ZN8QPainterD1Ev( %struct.QPainter* %p )
+ ret void
+cleanup329: ; preds = %cond_true319, %cond_true302, %cond_next293, %cond_true277, %cond_true266, %cond_next258, %cond_next244, %cond_next225, %cond_true220, %invcont210, %cond_next208, %cond_false204, %cond_true200, %cond_next194, %cleanup192, %cleanup192, %cleanup190, %invcont106, %invcont104, %invcont103, %invcont100, %invcont98, %invcont94, %cond_false, %invcont83, %invcont79, %invcont57, %invcont51, %invcont45, %cond_next42, %invcont37, %cond_true35, %invcont29, %invcont25, %cond_true24, %cond_next, %entry
+ call void @_ZN8QPainterD1Ev( %struct.QPainter* %p )
+ unwind
+}
+
+declare void @_ZN6QSizeFC1Edd(%struct.QPointF*, double, double)
+
+declare i1 @_ZNK6QSizeF7isValidEv(%struct.QPointF*)
+
+declare double @_ZNK6QSizeF5widthEv(%struct.QPointF*)
+
+declare double @_ZNK6QSizeF6heightEv(%struct.QPointF*)
+
+declare double* @_ZN6QSizeF6rwidthEv(%struct.QPointF*)
+
+declare double* @_ZN6QSizeF7rheightEv(%struct.QPointF*)
+
+declare %struct.QTextDocumentPrivate* @_ZNK13QTextDocument6d_funcEv(%struct.QAbstractTextDocumentLayout*)
+
+declare void @_ZN7QPointFC1Ev(%struct.QPointF*)
+
+declare void @_ZN7QPointFC1Edd(%struct.QPointF*, double, double)
+
+declare void @_ZN16QTextFrameFormat9setMarginEd(%struct.QTextBlockFormat*, double)
+
+declare void @_ZN6QRectFC1Edddd(%struct.QRectF*, double, double, double, double)
+
+declare void @_ZN6QRectFC1ERK7QPointFRK6QSizeF(%struct.QRectF*, %struct.QPointF*, %struct.QPointF*)
+
+declare double @_ZNK6QRectF5widthEv(%struct.QRectF*)
+
+declare double @_ZNK6QRectF6heightEv(%struct.QRectF*)
+
+declare void @_ZNK6QRectF4sizeEv(%struct.QPointF*, %struct.QRectF*)
+
+declare void @_ZN16QTextFrameFormatD1Ev(%struct.QTextBlockFormat*)
+
+declare void @_ZNK10QTextFrame11frameFormatEv(%struct.QTextBlockFormat*, %struct.QTextBlockGroup*)
+
+declare void @_ZN10QTextFrame14setFrameFormatERK16QTextFrameFormat(%struct.QTextBlockGroup*, %struct.QTextBlockFormat*)
+
+declare i32 @_ZNK12QPaintDevice5widthEv(%struct.QPaintDevice*)
+
+declare i32 @_ZNK12QPaintDevice6heightEv(%struct.QPaintDevice*)
+
+declare i32 @_ZNK12QPaintDevice11logicalDpiXEv(%struct.QPaintDevice*)
+
+declare i32 @_ZNK12QPaintDevice11logicalDpiYEv(%struct.QPaintDevice*)
+
+declare %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument5cloneEP7QObject(%struct.QAbstractTextDocumentLayout*, %struct.QObject*)
+
+declare void @_ZN5QFontD1Ev(%struct.QFont*)
+
+declare %struct.QAbstractTextDocumentLayout* @_ZNK13QTextDocument14documentLayoutEv(%struct.QAbstractTextDocumentLayout*)
+
+declare %struct.QTextBlockGroup* @_ZNK13QTextDocument9rootFrameEv(%struct.QAbstractTextDocumentLayout*)
+
+declare i32 @_ZNK13QTextDocument9pageCountEv(%struct.QAbstractTextDocumentLayout*)
+
+declare void @_ZNK13QTextDocument11defaultFontEv(%struct.QFont*, %struct.QAbstractTextDocumentLayout*)
+
+declare void @_ZN13QTextDocument14setDefaultFontERK5QFont(%struct.QAbstractTextDocumentLayout*, %struct.QFont*)
+
+declare void @_ZN13QTextDocument11setPageSizeERK6QSizeF(%struct.QAbstractTextDocumentLayout*, %struct.QPointF*)
+
+declare void @_Z9printPageiP8QPainterPK13QTextDocumentRK6QRectFRK7QPointF(i32, %struct.QPainter*, %struct.QAbstractTextDocumentLayout*, %struct.QRectF*, %struct.QPointF*)
+
+declare void @_ZN12QFontMetricsD1Ev(%struct.QFontMetrics*)
+
+declare void @_ZN8QPainterC1EP12QPaintDevice(%struct.QPainter*, %struct.QPaintDevice*)
+
+declare i1 @_ZNK8QPainter8isActiveEv(%struct.QPainter*)
+
+declare i32 @_Z13qt_defaultDpiv()
+
+declare %struct.QPaintDevice* @_ZNK27QAbstractTextDocumentLayout11paintDeviceEv(%struct.QAbstractTextDocumentLayout*)
+
+declare void @_ZN8QPainter5scaleEdd(%struct.QPainter*, double, double)
+
+declare %struct.QPaintDevice* @_ZNK8QPainter6deviceEv(%struct.QPainter*)
+
+declare void @_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice(%struct.QAbstractTextDocumentLayout*, %struct.QPaintDevice*)
+
+declare void @_ZN12QFontMetricsC1ERK5QFontP12QPaintDevice(%struct.QFontMetrics*, %struct.QFont*, %struct.QPaintDevice*)
+
+declare i32 @_ZNK12QFontMetrics6ascentEv(%struct.QFontMetrics*)
+
+declare void @_ZN5QFont12setPointSizeEi(%struct.QFont*, i32)
+
+declare i1 @_ZNK8QPrinter13collateCopiesEv(%struct.QPrinter*)
+
+declare i32 @_ZNK8QPrinter9numCopiesEv(%struct.QPrinter*)
+
+declare i32 @_ZNK8QPrinter8fromPageEv(%struct.QPrinter*)
+
+declare i32 @_ZNK8QPrinter6toPageEv(%struct.QPrinter*)
+
+declare i32 @_ZNK8QPrinter9pageOrderEv(%struct.QPrinter*)
+
+declare i32 @_ZNK8QPrinter12printerStateEv(%struct.QPrinter*)
+
+declare i1 @_ZN8QPrinter7newPageEv(%struct.QPrinter*)
+
+declare void @_ZN8QPainterD1Ev(%struct.QPainter*)
diff --git a/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll b/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll
new file mode 100644
index 000000000000..d433f0482955
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll
@@ -0,0 +1,131 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
+; END.
+
+; ModuleID = '2006-12-08-Ptr-ICmp-Branch.ll'
+target datalayout = "e-p:32:32"
+target triple = "i686-pc-linux-gnu"
+ %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+ %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
+ %struct.charsequence = type { i8*, i32, i32 }
+ %struct.trie_s = type { [26 x %struct.trie_s*], i32 }
+@str = external global [14 x i8] ; <[14 x i8]*> [#uses=0]
+@str.upgrd.1 = external global [32 x i8] ; <[32 x i8]*> [#uses=0]
+@str.upgrd.2 = external global [12 x i8] ; <[12 x i8]*> [#uses=0]
+@C.0.2294 = external global %struct.charsequence ; <%struct.charsequence*> [#uses=3]
+@t = external global %struct.trie_s* ; <%struct.trie_s**> [#uses=0]
+@str.upgrd.3 = external global [3 x i8] ; <[3 x i8]*> [#uses=0]
+@str.upgrd.4 = external global [26 x i8] ; <[26 x i8]*> [#uses=0]
+
+declare void @charsequence_reset(%struct.charsequence*)
+
+declare void @free(i8*)
+
+declare void @charsequence_push(%struct.charsequence*, i8)
+
+declare i8* @charsequence_val(%struct.charsequence*)
+
+declare i32 @_IO_getc(%struct.FILE*)
+
+declare i32 @tolower(i32)
+
+declare %struct.trie_s* @trie_insert(%struct.trie_s*, i8*)
+
+declare i32 @feof(%struct.FILE*)
+
+define void @addfile(%struct.trie_s* %t, %struct.FILE* %f) {
+entry:
+ %t_addr = alloca %struct.trie_s* ; <%struct.trie_s**> [#uses=2]
+ %f_addr = alloca %struct.FILE* ; <%struct.FILE**> [#uses=3]
+ %c = alloca i8, align 1 ; <i8*> [#uses=7]
+ %wstate = alloca i32, align 4 ; <i32*> [#uses=4]
+ %cs = alloca %struct.charsequence, align 16 ; <%struct.charsequence*> [#uses=7]
+ %str = alloca i8*, align 4 ; <i8**> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store %struct.trie_s* %t, %struct.trie_s** %t_addr
+ store %struct.FILE* %f, %struct.FILE** %f_addr
+ store i32 0, i32* %wstate
+ %tmp = getelementptr %struct.charsequence* %cs, i64 0, i32 0 ; <i8**> [#uses=1]
+ %tmp1 = getelementptr %struct.charsequence* @C.0.2294, i64 0, i32 0 ; <i8**> [#uses=1]
+ %tmp.upgrd.5 = load i8** %tmp1 ; <i8*> [#uses=1]
+ store i8* %tmp.upgrd.5, i8** %tmp
+ %tmp.upgrd.6 = getelementptr %struct.charsequence* %cs, i64 0, i32 1 ; <i32*> [#uses=1]
+ %tmp2 = getelementptr %struct.charsequence* @C.0.2294, i64 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.upgrd.7 = load i32* %tmp2 ; <i32> [#uses=1]
+ store i32 %tmp.upgrd.7, i32* %tmp.upgrd.6
+ %tmp3 = getelementptr %struct.charsequence* %cs, i64 0, i32 2 ; <i32*> [#uses=1]
+ %tmp4 = getelementptr %struct.charsequence* @C.0.2294, i64 0, i32 2 ; <i32*> [#uses=1]
+ %tmp5 = load i32* %tmp4 ; <i32> [#uses=1]
+ store i32 %tmp5, i32* %tmp3
+ br label %bb33
+bb: ; preds = %bb33
+ %tmp.upgrd.8 = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1]
+ %tmp.upgrd.9 = call i32 @_IO_getc( %struct.FILE* %tmp.upgrd.8 ) ; <i32> [#uses=1]
+ %tmp6 = call i32 @tolower( i32 %tmp.upgrd.9 ) ; <i32> [#uses=1]
+ %tmp6.upgrd.10 = trunc i32 %tmp6 to i8 ; <i8> [#uses=1]
+ store i8 %tmp6.upgrd.10, i8* %c
+ %tmp7 = load i32* %wstate ; <i32> [#uses=1]
+ %tmp.upgrd.11 = icmp ne i32 %tmp7, 0 ; <i1> [#uses=1]
+ br i1 %tmp.upgrd.11, label %cond_true, label %cond_false
+cond_true: ; preds = %bb
+ %tmp.upgrd.12 = load i8* %c ; <i8> [#uses=1]
+ %tmp8 = icmp sle i8 %tmp.upgrd.12, 96 ; <i1> [#uses=1]
+ br i1 %tmp8, label %cond_true9, label %cond_next
+cond_true9: ; preds = %cond_true
+ br label %bb16
+cond_next: ; preds = %cond_true
+ %tmp10 = load i8* %c ; <i8> [#uses=1]
+ %tmp11 = icmp sgt i8 %tmp10, 122 ; <i1> [#uses=1]
+ br i1 %tmp11, label %cond_true12, label %cond_next13
+cond_true12: ; preds = %cond_next
+ br label %bb16
+cond_next13: ; preds = %cond_next
+ %tmp14 = load i8* %c ; <i8> [#uses=1]
+ %tmp14.upgrd.13 = sext i8 %tmp14 to i32 ; <i32> [#uses=1]
+ %tmp1415 = trunc i32 %tmp14.upgrd.13 to i8 ; <i8> [#uses=1]
+ call void @charsequence_push( %struct.charsequence* %cs, i8 %tmp1415 )
+ br label %bb21
+bb16: ; preds = %cond_true12, %cond_true9
+ %tmp17 = call i8* @charsequence_val( %struct.charsequence* %cs ) ; <i8*> [#uses=1]
+ store i8* %tmp17, i8** %str
+ %tmp.upgrd.14 = load %struct.trie_s** %t_addr ; <%struct.trie_s*> [#uses=1]
+ %tmp18 = load i8** %str ; <i8*> [#uses=1]
+ %tmp19 = call %struct.trie_s* @trie_insert( %struct.trie_s* %tmp.upgrd.14, i8* %tmp18 ) ; <%struct.trie_s*> [#uses=0]
+ %tmp20 = load i8** %str ; <i8*> [#uses=1]
+ call void @free( i8* %tmp20 )
+ store i32 0, i32* %wstate
+ br label %bb21
+bb21: ; preds = %bb16, %cond_next13
+ br label %cond_next32
+cond_false: ; preds = %bb
+ %tmp22 = load i8* %c ; <i8> [#uses=1]
+ %tmp23 = icmp sgt i8 %tmp22, 96 ; <i1> [#uses=1]
+ br i1 %tmp23, label %cond_true24, label %cond_next31
+cond_true24: ; preds = %cond_false
+ %tmp25 = load i8* %c ; <i8> [#uses=1]
+ %tmp26 = icmp sle i8 %tmp25, 122 ; <i1> [#uses=1]
+ br i1 %tmp26, label %cond_true27, label %cond_next30
+cond_true27: ; preds = %cond_true24
+ call void @charsequence_reset( %struct.charsequence* %cs )
+ %tmp28 = load i8* %c ; <i8> [#uses=1]
+ %tmp28.upgrd.15 = sext i8 %tmp28 to i32 ; <i32> [#uses=1]
+ %tmp2829 = trunc i32 %tmp28.upgrd.15 to i8 ; <i8> [#uses=1]
+ call void @charsequence_push( %struct.charsequence* %cs, i8 %tmp2829 )
+ store i32 1, i32* %wstate
+ br label %cond_next30
+cond_next30: ; preds = %cond_true27, %cond_true24
+ br label %cond_next31
+cond_next31: ; preds = %cond_next30, %cond_false
+ br label %cond_next32
+cond_next32: ; preds = %cond_next31, %bb21
+ br label %bb33
+bb33: ; preds = %cond_next32, %entry
+ %tmp34 = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1]
+ %tmp35 = call i32 @feof( %struct.FILE* %tmp34 ) ; <i32> [#uses=1]
+ %tmp36 = icmp eq i32 %tmp35, 0 ; <i1> [#uses=1]
+ br i1 %tmp36, label %bb, label %bb37
+bb37: ; preds = %bb33
+ br label %return
+return: ; preds = %bb37
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll b/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
new file mode 100644
index 000000000000..449047b0d32f
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep invoke
+
+declare i32 @func(i8*) nounwind
+
+define i32 @test() {
+ invoke i32 @func( i8* null )
+ to label %Cont unwind label %Other ; <i32>:1 [#uses=0]
+
+Cont: ; preds = %0
+ ret i32 0
+
+Other: ; preds = %0
+ ret i32 1
+}
diff --git a/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll b/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll
new file mode 100644
index 000000000000..fe1ca80468be
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll
@@ -0,0 +1,37 @@
+;RUN: llvm-as < %s | opt -simplifycfg -disable-output
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+
+define i32 @bork() nounwind {
+entry:
+ br label %bb5.outer
+
+bb5.outer.loopexit: ; preds = %bb5
+ br label %bb5.outer
+
+bb5.outer: ; preds = %bb5.outer.loopexit, %entry
+ %undo.0.ph = phi i32 [ 0, %entry ], [ 1, %bb5.outer.loopexit ] ; <i32> [#uses=1]
+ br label %bb5
+
+bb5: ; preds = %bb5, %bb5.outer
+ %tmp6 = tail call i32 (...)* @foo( ) nounwind ; <i32> [#uses=1]
+ switch i32 %tmp6, label %bb13 [
+ i32 -1, label %bb10
+ i32 102, label %bb5
+ i32 110, label %bb5.outer.loopexit
+ ]
+
+bb10: ; preds = %bb5
+ %tmp12 = tail call i32 (...)* @bar( i32 %undo.0.ph ) nounwind ; <i32> [#uses=0]
+ br label %UnifiedReturnBlock
+
+bb13: ; preds = %bb5
+ br label %UnifiedReturnBlock
+
+UnifiedReturnBlock: ; preds = %bb13, %bb10
+ %UnifiedRetVal = phi i32 [ 1, %bb10 ], [ 258, %bb13 ] ; <i32> [#uses=1]
+ ret i32 %UnifiedRetVal
+}
+
+declare i32 @foo(...)
+
+declare i32 @bar(...)
diff --git a/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll b/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll
new file mode 100644
index 000000000000..43ff690150e3
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-01-02-hoist-fp-add.ll
@@ -0,0 +1,26 @@
+; The phi should not be eliminated in this case, because the fp op could trap.
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {= phi double}
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+@G = weak global double 0.000000e+00, align 8 ; <double*> [#uses=2]
+
+define void @test(i32 %X, i32 %Y, double %Z) {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %tmp = load double* @G, align 8 ; <double> [#uses=2]
+ %tmp3 = icmp eq i32 %X, %Y ; <i1> [#uses=1]
+ %tmp34 = zext i1 %tmp3 to i8 ; <i8> [#uses=1]
+ %toBool = icmp ne i8 %tmp34, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %cond_true, label %cond_next
+
+cond_true: ; preds = %entry
+ %tmp7 = add double %tmp, %Z ; <double> [#uses=1]
+ br label %cond_next
+
+cond_next: ; preds = %cond_true, %entry
+ %F.0 = phi double [ %tmp, %entry ], [ %tmp7, %cond_true ] ; <double> [#uses=1]
+ store double %F.0, double* @G, align 8
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll b/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll
new file mode 100644
index 000000000000..5ee13526785d
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll
@@ -0,0 +1,43 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; rdar://5882392
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin9"
+ %struct.Py_complex = type { double, double }
+
+define %struct.Py_complex @_Py_c_pow(double %a.0, double %a.1, double %b.0, double %b.1) nounwind {
+entry:
+ %tmp7 = fcmp une double %b.0, 0.000000e+00 ; <i1> [#uses=1]
+ %tmp11 = fcmp une double %b.1, 0.000000e+00 ; <i1> [#uses=1]
+ %bothcond = or i1 %tmp7, %tmp11 ; <i1> [#uses=1]
+ br i1 %bothcond, label %bb15, label %bb53
+
+bb15: ; preds = %entry
+ %tmp18 = fcmp une double %a.0, 0.000000e+00 ; <i1> [#uses=1]
+ %tmp24 = fcmp une double %a.1, 0.000000e+00 ; <i1> [#uses=1]
+ %bothcond1 = or i1 %tmp18, %tmp24 ; <i1> [#uses=1]
+ br i1 %bothcond1, label %bb29, label %bb27
+
+bb27: ; preds = %bb15
+ %tmp28 = call i32* @__error( ) nounwind ; <i32*> [#uses=1]
+ store i32 33, i32* %tmp28, align 4
+ ret double undef, double undef
+
+bb29: ; preds = %bb15
+ %tmp36 = fcmp une double %b.1, 0.000000e+00 ; <i1> [#uses=1]
+ br i1 %tmp36, label %bb39, label %bb47
+
+bb39: ; preds = %bb29
+ br label %bb47
+
+bb47: ; preds = %bb39, %bb29
+ ret double undef, double undef
+
+bb53: ; preds = %entry
+ ret double undef, double undef
+}
+
+declare i32* @__error()
+
+declare double @pow(double, double) nounwind readonly
+
+declare double @cos(double) nounwind readonly
diff --git a/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll b/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
new file mode 100644
index 000000000000..a370b9521090
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; PR2256
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-mingw32"
+
+define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval %Z, i1 %cond) nounwind {
+bb: ; preds = %entry
+ br i1 %cond, label %bb48, label %bb40
+
+bb40: ; preds = %bb
+ store i32 34, i32* null, align 4
+ br label %bb196
+
+bb48: ; preds = %bb.bb48_crit_edge, %entry.bb48_crit_edge
+ %tmp53 = icmp eq i32 0, 1280 ; <i1> [#uses=1]
+ br i1 %tmp53, label %bb56, label %bb174
+
+bb56: ; preds = %bb48
+ %iftmp.0.0 = select i1 false, x86_fp80 0xK3FFFC90FDAA22168C235, x86_fp80 0xKBFFFC90FDAA22168C235 ; <x86_fp80> [#uses=0]
+ br label %bb196
+
+
+bb174: ; preds = %bb144, %bb114
+ %tmp191 = mul x86_fp80 0xK00000000000000000000, 0xK3FFE8000000000000000 ; <x86_fp80> [#uses=1]
+ br label %bb196
+
+bb196: ; preds = %bb174, %bb56, %bb40
+ %Res.1.0 = phi x86_fp80 [ 0xK7FFF8000000000000000, %bb40 ], [ %tmp191, %bb174 ], [ 0xK00000000000000000000, %bb56 ] ; <x86_fp80> [#uses=1]
+ ret x86_fp80 0xK00000000000000000000, x86_fp80 %Res.1.0
+}
diff --git a/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll b/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll
new file mode 100644
index 000000000000..8af26402d671
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll
@@ -0,0 +1,131 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis > %t
+; RUN: not grep {^BB.tomerge} %t
+; RUN grep {^BB.nomerge} %t | count 2
+
+; ModuleID = '<stdin>'
+declare i1 @foo()
+
+declare i1 @bar(i32)
+
+; This function can't be merged
+define void @a() {
+entry:
+ br label %BB.nomerge
+
+BB.nomerge: ; preds = %Common, %entry
+ ; This phi has a conflicting value (0) with below phi (2), so blocks
+ ; can't be merged.
+ %a = phi i32 [ 1, %entry ], [ 0, %Common ] ; <i32> [#uses=1]
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.nomerge
+ %b = phi i32 [ %a, %BB.nomerge ], [ 2, %Common ] ; <i32> [#uses=0]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.nomerge, label %Succ
+
+Exit: ; preds = %Succ
+ ret void
+}
+
+; This function can't be merged
+define void @b() {
+entry:
+ br label %BB.nomerge
+
+BB.nomerge: ; preds = %Common, %entry
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.nomerge
+ ; This phi has confliction values for Common and (through BB) Common,
+ ; blocks can't be merged
+ %b = phi i32 [ 1, %BB.nomerge ], [ 2, %Common ] ; <i32> [#uses=0]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.nomerge, label %Succ
+
+Exit: ; preds = %Succ
+ ret void
+}
+
+; This function can be merged
+define void @c() {
+entry:
+ br label %BB.tomerge
+
+BB.tomerge: ; preds = %Common, %entry
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.tomerge, %Pre-Exit
+ ; This phi has identical values for Common and (through BB) Common,
+ ; blocks can't be merged
+ %b = phi i32 [ 1, %BB.tomerge ], [ 1, %Common ], [ 2, %Pre-Exit ]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Pre-Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.tomerge, label %Succ
+
+Pre-Exit: ; preds = %Succ
+ ; This adds a backedge, so the %b phi node gets a third branch and is
+ ; not completely trivial
+ %cond2 = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond2, label %Succ, label %Exit
+
+Exit: ; preds = %Pre-Exit
+ ret void
+}
+
+; This function can be merged
+define void @d() {
+entry:
+ br label %BB.tomerge
+
+BB.tomerge: ; preds = %Common, %entry
+ ; This phi has a matching value (0) with below phi (0), so blocks
+ ; can be merged.
+ %a = phi i32 [ 1, %entry ], [ 0, %Common ] ; <i32> [#uses=1]
+ br label %Succ
+
+Succ: ; preds = %Common, %BB.tomerge
+ %b = phi i32 [ %a, %BB.tomerge ], [ 0, %Common ] ; <i32> [#uses=0]
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Common, label %Exit
+
+Common: ; preds = %Succ
+ %cond = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.tomerge, label %Succ
+
+Exit: ; preds = %Succ
+ ret void
+}
+
+; This function can be merged
+define void @e() {
+entry:
+ br label %BB.tomerge
+
+BB.tomerge: ; preds = %Use, %entry
+ ; This phi is used somewhere else than Succ, but this should not prevent
+ ; merging this block
+ %a = phi i32 [ 1, %entry ], [ 0, %Use ] ; <i32> [#uses=1]
+ br label %Succ
+
+Succ: ; preds = %BB.tomerge
+ %conde = call i1 @foo( ) ; <i1> [#uses=1]
+ br i1 %conde, label %Use, label %Exit
+
+Use: ; preds = %Succ
+ %cond = call i1 @bar( i32 %a ) ; <i1> [#uses=1]
+ br i1 %cond, label %BB.tomerge, label %Exit
+
+Exit: ; preds = %Use, %Succ
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/2008-07-13-InfLoopMiscompile.ll b/test/Transforms/SimplifyCFG/2008-07-13-InfLoopMiscompile.ll
new file mode 100644
index 000000000000..0678e20ed4af
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-07-13-InfLoopMiscompile.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {%outval = phi i32 .*mux}
+; PR2540
+; Outval should end up with a select from 0/2, not all constants.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+@g_37 = common global i32 0 ; <i32*> [#uses=1]
+@.str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define i32 @main() nounwind {
+entry:
+ %l = load i32* @g_37, align 4 ; <i32> [#uses=1]
+ %cmpa = icmp ne i32 %l, 0 ; <i1> [#uses=3]
+ br i1 %cmpa, label %func_1.exit, label %mooseblock
+
+mooseblock: ; preds = %entry
+ %cmpb = icmp eq i1 %cmpa, false ; <i1> [#uses=2]
+ br i1 %cmpb, label %monkeyblock, label %beeblock
+
+monkeyblock: ; preds = %monkeyblock, %mooseblock
+ br i1 %cmpb, label %cowblock, label %monkeyblock
+
+beeblock: ; preds = %beeblock, %mooseblock
+ br i1 %cmpa, label %cowblock, label %beeblock
+
+cowblock: ; preds = %beeblock, %monkeyblock
+ %cowval = phi i32 [ 2, %beeblock ], [ 0, %monkeyblock ] ; <i32> [#uses=1]
+ br label %func_1.exit
+
+func_1.exit: ; preds = %cowblock, %entry
+ %outval = phi i32 [ %cowval, %cowblock ], [ 1, %entry ] ; <i32> [#uses=1]
+ %pout = tail call i32 (i8*, ...)* @printf( i8* noalias getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %outval ) nounwind ; <i32> [#uses=0]
+ ret i32 0
+}
+
+declare i32 @printf(i8*, ...) nounwind
diff --git a/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll b/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll
new file mode 100644
index 000000000000..82a2cc03033a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll
@@ -0,0 +1,60 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; PR 2777
+@g_103 = common global i32 0 ; <i32*> [#uses=1]
+
+define i32 @func_127(i32 %p_129) nounwind {
+entry:
+ load i32* @g_103, align 4 ; <i32>:0 [#uses=1]
+ icmp eq i32 %0, 0 ; <i1>:1 [#uses=2]
+ br i1 %1, label %bb6.preheader, label %entry.return_crit_edge
+
+entry.return_crit_edge: ; preds = %entry
+ br label %return
+
+bb6.preheader: ; preds = %entry
+ br i1 %1, label %bb6.preheader.split.us, label %bb6.preheader.split
+
+bb6.preheader.split.us: ; preds = %bb6.preheader
+ br label %return.loopexit.split
+
+bb6.preheader.split: ; preds = %bb6.preheader
+ br label %bb6
+
+bb6: ; preds = %bb17.bb6_crit_edge, %bb6.preheader.split
+ %indvar35 = phi i32 [ 0, %bb6.preheader.split ], [ %indvar.next36, %bb17.bb6_crit_edge ] ; <i32> [#uses=1]
+ %p_129_addr.3.reg2mem.0 = phi i32 [ %p_129_addr.2, %bb17.bb6_crit_edge ], [ %p_129, %bb6.preheader.split ] ; <i32> [#uses=3]
+ icmp eq i32 %p_129_addr.3.reg2mem.0, 0 ; <i1>:2 [#uses=1]
+ br i1 %2, label %bb6.bb17_crit_edge, label %bb8
+
+bb6.bb17_crit_edge: ; preds = %bb6
+ br label %bb17
+
+bb8: ; preds = %bb6
+ br label %bb13
+
+bb13: ; preds = %bb8
+ br label %bb17
+
+bb17: ; preds = %bb13, %bb6.bb17_crit_edge
+ %p_129_addr.2 = phi i32 [ %p_129_addr.3.reg2mem.0, %bb13 ], [ %p_129_addr.3.reg2mem.0, %bb6.bb17_crit_edge ] ; <i32> [#uses=1]
+ %indvar.next36 = add i32 %indvar35, 1 ; <i32> [#uses=2]
+ %exitcond37 = icmp eq i32 %indvar.next36, -1 ; <i1> [#uses=1]
+ br i1 %exitcond37, label %return.loopexit, label %bb17.bb6_crit_edge
+
+bb17.bb6_crit_edge: ; preds = %bb17
+ br label %bb6
+
+return.loopexit: ; preds = %bb17
+ br label %return.loopexit.split
+
+return.loopexit.split: ; preds = %return.loopexit, %bb6.preheader.split.us
+ br label %return
+
+return: ; preds = %return.loopexit.split, %entry.return_crit_edge
+ ret i32 1
+}
+
+define i32 @func_135(i8 zeroext %p_137, i32 %p_138, i32 %p_140) nounwind {
+entry:
+ ret i32 undef
+}
diff --git a/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll b/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
new file mode 100644
index 000000000000..b2d671da67f4
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+; PR 2800
+
+define void @foo() {
+start:
+ %tmp = call i1 @bar( ) ; <i1> [#uses=4]
+ br i1 %tmp, label %brtrue, label %brfalse
+
+brtrue: ; preds = %start
+ %tmpnew = and i1 %tmp, %tmp ; <i1> [#uses=1]
+ br label %brfalse
+
+brfalse: ; preds = %brtrue, %start
+ %andandtmp.0 = phi i1 [ %tmp, %start ], [ %tmpnew, %brtrue ] ; <i1> [#uses=0]
+ ret void
+}
+
+declare i1 @bar()
diff --git a/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll b/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll
new file mode 100644
index 000000000000..a061a82954b6
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -simplifycfg
+; PR2855
+
+define i32 @_Z1fPii(i32* %b, i32 %f) nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb9, %bb7, %bb, %entry
+ %__c2.2 = phi i32 [ undef, %entry ], [ %__c2.1, %bb7 ], [ %__c2.1, %bb9 ] ; <i32> [#uses=2]
+ %s.0 = phi i32 [ 0, %entry ], [ 0, %bb7 ], [ %2, %bb9 ] ; <i32> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %0 = icmp slt i32 0, %f ; <i1> [#uses=1]
+ br i1 %0, label %bb3, label %bb6
+
+bb3: ; preds = %bb1
+ %1 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb6, label %bb5
+
+bb5: ; preds = %bb3
+ br label %bb7
+
+bb6: ; preds = %bb3, %bb1
+ %__c2.0 = phi i32 [ 0, %bb3 ], [ %__c2.2, %bb1 ] ; <i32> [#uses=1]
+ br label %bb7
+
+bb7: ; preds = %bb6, %bb5
+ %__c2.1 = phi i32 [ 0, %bb5 ], [ %__c2.0, %bb6 ] ; <i32> [#uses=2]
+ %iftmp.1.0 = phi i1 [ false, %bb5 ], [ true, %bb6 ] ; <i1> [#uses=1]
+ br i1 %iftmp.1.0, label %bb, label %bb9
+
+bb9: ; preds = %bb7
+ %2 = add i32 %s.0, 2 ; <i32> [#uses=1]
+ br label %bb
+}
diff --git a/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll b/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
new file mode 100644
index 000000000000..7b4aee489b55
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
+define i32 @test() {
+entry:
+ br label %T
+T:
+ %C = phi i1 [false, %entry]
+ br i1 %C, label %X, label %Y
+X:
+ ret i32 2
+Y:
+ add i32 1, 2
+ ret i32 1
+}
diff --git a/test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll b/test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll
new file mode 100644
index 000000000000..b52d10dc3bc9
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll
@@ -0,0 +1,46 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep icmp
+; ModuleID = '/tmp/x.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-pc-linux-gnu"
+
+define i32 @x(i32 %x) {
+entry:
+ %cmp = icmp eq i32 %x, 8 ; <i1> [#uses=1]
+ br i1 %cmp, label %ifthen, label %ifend
+
+ifthen: ; preds = %entry
+ %call = call i32 (...)* @foo() ; <i32> [#uses=0]
+ br label %ifend
+
+ifend: ; preds = %ifthen, %entry
+ %cmp2 = icmp ne i32 %x, 8 ; <i1> [#uses=1]
+ br i1 %cmp2, label %ifthen3, label %ifend5
+
+ifthen3: ; preds = %ifend
+ %call4 = call i32 (...)* @foo() ; <i32> [#uses=0]
+ br label %ifend5
+
+ifend5: ; preds = %ifthen3, %ifend
+ %cmp7 = icmp eq i32 %x, 9 ; <i1> [#uses=1]
+ br i1 %cmp7, label %ifthen8, label %ifend10
+
+ifthen8: ; preds = %ifend5
+ %call9 = call i32 (...)* @bar() ; <i32> [#uses=0]
+ br label %ifend10
+
+ifend10: ; preds = %ifthen8, %ifend5
+ %cmp12 = icmp ne i32 %x, 9 ; <i1> [#uses=1]
+ br i1 %cmp12, label %ifthen13, label %ifend15
+
+ifthen13: ; preds = %ifend10
+ %call14 = call i32 (...)* @bar() ; <i32> [#uses=0]
+ br label %ifend15
+
+ifend15: ; preds = %ifthen13, %ifend10
+ ret i32 0
+}
+
+declare i32 @foo(...)
+
+declare i32 @bar(...)
+
diff --git a/test/Transforms/SimplifyCFG/2009-01-18-PHIPropCrash.ll b/test/Transforms/SimplifyCFG/2009-01-18-PHIPropCrash.ll
new file mode 100644
index 000000000000..fc34f5157ba6
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2009-01-18-PHIPropCrash.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
+; XFAIL: *
+; PR3016
+; Dead use caused invariant violation.
+
+define i32 @func_105(i1 %tmp5, i1 %tmp7) nounwind {
+BB:
+ br i1 true, label %BB2, label %BB1
+
+BB1: ; preds = %BB
+ br label %BB2
+
+BB2: ; preds = %BB1, %BB
+ %tmp3 = phi i1 [ true, %BB ], [ false, %BB1 ] ; <i1> [#uses=1]
+ br label %BB9
+
+BB9: ; preds = %BB11, %BB2
+ %tmp10 = phi i32 [ 0, %BB2 ], [ %tmp12, %BB11 ] ; <i32> [#uses=1]
+ br i1 %tmp5, label %BB11, label %BB13
+
+BB11: ; preds = %BB13, %BB9
+ %tmp12 = phi i32 [ 0, %BB13 ], [ %tmp10, %BB9 ] ; <i32> [#uses=2]
+ br i1 %tmp3, label %BB9, label %BB20
+
+BB13: ; preds = %BB13, %BB9
+ %tmp14 = phi i32 [ 0, %BB9 ], [ %tmp14, %BB13 ] ; <i32> [#uses=1]
+ br i1 %tmp7, label %BB13, label %BB11
+
+BB20: ; preds = %BB11
+ ret i32 %tmp12
+}
diff --git a/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll b/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll
new file mode 100644
index 000000000000..e65bafa6805d
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2009-01-19-UnconditionalTrappingConstantExpr.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {br i1 } | count 4
+; PR3354
+; Do not merge bb1 into the entry block, it might trap.
+
+@G = extern_weak global i32
+
+define i32 @test(i32 %tmp21, i32 %tmp24) {
+ %tmp25 = icmp sle i32 %tmp21, %tmp24
+ br i1 %tmp25, label %bb2, label %bb1
+
+bb1: ; preds = %bb
+ %tmp26 = icmp sgt i32 sdiv (i32 -32768, i32 ptrtoint (i32* @G to i32)), 0
+ br i1 %tmp26, label %bb6, label %bb2
+bb2:
+ ret i32 42
+
+bb6:
+ unwind
+}
+
+define i32 @test2(i32 %tmp21, i32 %tmp24, i1 %tmp34) {
+ br i1 %tmp34, label %bb5, label %bb6
+
+bb5: ; preds = %bb4
+ br i1 icmp sgt (i32 sdiv (i32 32767, i32 ptrtoint (i32* @G to i32)), i32 0), label %bb6, label %bb7
+bb6:
+ ret i32 42
+bb7:
+ unwind
+}
+
diff --git a/test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll b/test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll
new file mode 100644
index 000000000000..9033976108a9
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll
@@ -0,0 +1,108 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep select
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+external global <{ i8 }> ; <<{ i8 }>*>:0 [#uses=0]
+@__dso_handle = external global i8* ; <i8**> [#uses=0]
+@_ZSt3cin = external global { i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } } ; <{ i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+@_ZSt4cout = external global { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } } ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+external constant [2 x i8] ; <[2 x i8]*>:1 [#uses=1]
+@llvm.global_ctors = external global [1 x { i32, void ()* }] ; <[1 x { i32, void ()* }]*> [#uses=0]
+
+define i32 @main(i32, i8**) {
+; <label>:2
+ %3 = alloca [4096 x i8], align 1 ; <[4096 x i8]*> [#uses=1]
+ %4 = call { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNKSt9basic_iosIcSt11char_traitsIcEE5rdbufEv({ { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* }* getelementptr ({ i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt3cin, i32 0, i32 2)) ; <{ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*> [#uses=1]
+ %5 = getelementptr [4096 x i8]* %3, i32 0, i32 0 ; <i8*> [#uses=1]
+ %6 = call { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNSt15basic_streambufIcSt11char_traitsIcEE9pubsetbufEPci({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* %4, i8* %5, i32 4096) ; <{ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*> [#uses=0]
+ %7 = call { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNKSt9basic_iosIcSt11char_traitsIcEE5rdbufEv({ { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* }* getelementptr ({ i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt3cin, i32 0, i32 2)) ; <{ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*> [#uses=1]
+ br label %25
+
+; <label>:8 ; preds = %25
+ %9 = trunc i32 %26 to i8 ; <i8> [#uses=4]
+ %10 = add i32 %.02, 1 ; <i32> [#uses=3]
+ %11 = icmp eq i8 %9, 10 ; <i1> [#uses=1]
+ br i1 %11, label %12, label %14
+
+; <label>:12 ; preds = %8
+ %13 = add i32 %.1, 1 ; <i32> [#uses=1]
+ br label %14
+
+; <label>:14 ; preds = %12, %8
+ %.0 = phi i32 [ %.1, %8 ], [ %13, %12 ] ; <i32> [#uses=3]
+ %15 = icmp eq i8 %9, 32 ; <i1> [#uses=1]
+ br i1 %15, label %20, label %16
+
+; <label>:16 ; preds = %14
+ %17 = icmp eq i8 %9, 10 ; <i1> [#uses=1]
+ br i1 %17, label %20, label %18
+
+; <label>:18 ; preds = %16
+ %19 = icmp eq i8 %9, 9 ; <i1> [#uses=1]
+ br i1 %19, label %20, label %21
+
+; <label>:20 ; preds = %18, %16, %14
+ br label %25
+
+; <label>:21 ; preds = %18
+ %22 = icmp eq i32 %.03, 0 ; <i1> [#uses=1]
+ br i1 %22, label %23, label %25
+
+; <label>:23 ; preds = %21
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %24 = add i32 %.01, 1 ; <i32> [#uses=1]
+ br label %25
+
+; <label>:25 ; preds = %23, %21, %20, %2
+ %.03 = phi i32 [ 0, %2 ], [ %.03, %21 ], [ 1, %23 ], [ 0, %20 ] ; <i32> [#uses=2]
+ %.02 = phi i32 [ 0, %2 ], [ %10, %21 ], [ %10, %23 ], [ %10, %20 ] ; <i32> [#uses=2]
+ %.01 = phi i32 [ 0, %2 ], [ %.01, %21 ], [ %24, %23 ], [ %.01, %20 ] ; <i32> [#uses=4]
+ %.1 = phi i32 [ 0, %2 ], [ %.0, %21 ], [ %.0, %23 ], [ %.0, %20 ] ; <i32> [#uses=3]
+ %26 = call i32 @_ZNSt15basic_streambufIcSt11char_traitsIcEE6sbumpcEv({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* %7) ; <i32> [#uses=2]
+ %27 = icmp eq i32 %26, -1 ; <i1> [#uses=1]
+ br i1 %27, label %28, label %8
+
+; <label>:28 ; preds = %25
+ %29 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt4cout, i32 %.1) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+ %30 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %29, i8* getelementptr ([2 x i8]* @1, i32 0, i32 0)) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+ %31 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %30, i32 %.01) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+ %32 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %31, i8* getelementptr ([2 x i8]* @1, i32 0, i32 0)) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+ %33 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %32, i32 %.02) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1]
+ %34 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEPFRSoS_E({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %33, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* ({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*)* @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=0]
+ ret i32 0
+}
+
+declare void @""() section "__TEXT,__StaticInit,regular,pure_instructions"
+
+declare fastcc void @""() section "__TEXT,__StaticInit,regular,pure_instructions"
+
+declare void @_ZNSt8ios_base4InitC1Ev(<{ i8 }>*)
+
+declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) nounwind
+
+declare void @""(i8*)
+
+declare void @_ZNSt8ios_base4InitD1Ev(<{ i8 }>*)
+
+declare { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNKSt9basic_iosIcSt11char_traitsIcEE5rdbufEv({ { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* }*)
+
+declare { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNSt15basic_streambufIcSt11char_traitsIcEE9pubsetbufEPci({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, i8*, i32)
+
+declare i32 @_ZNSt15basic_streambufIcSt11char_traitsIcEE6sbumpcEv({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*)
+
+declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i32)
+
+declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8*)
+
+declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEPFRSoS_E({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* ({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*)*)
+
+declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*)
diff --git a/test/Transforms/SimplifyCFG/2009-05-12-externweak.ll b/test/Transforms/SimplifyCFG/2009-05-12-externweak.ll
new file mode 100644
index 000000000000..5969f27cdfcd
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/2009-05-12-externweak.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep select
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin10.0"
+module asm ".globl _foo"
+module asm "_foo: ret"
+module asm ".globl _i"
+module asm ".set _i, 0"
+@i = extern_weak global i32 ; <i32*> [#uses=2]
+@j = common global i32 0 ; <i32*> [#uses=1]
+@ed = common global double 0.000000e+00, align 8 ; <double*> [#uses=1]
+
+define i32 @main() nounwind ssp {
+entry:
+ br label %bb4
+
+bb: ; preds = %bb4
+ br i1 icmp ne (i32* @i, i32* null), label %bb1, label %bb2
+
+bb1: ; preds = %bb
+ %0 = load i32* @i, align 4 ; <i32> [#uses=1]
+ br label %bb3
+
+bb2: ; preds = %bb
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb1
+ %storemerge = phi i32 [ %0, %bb1 ], [ 0, %bb2 ] ; <i32> [#uses=2]
+ store i32 %storemerge, i32* @j
+ %1 = sitofp i32 %storemerge to double ; <double> [#uses=1]
+ %2 = call double @sin(double %1) nounwind readonly ; <double> [#uses=1]
+ %3 = add double %2, %d.0 ; <double> [#uses=1]
+ %4 = add i32 %l.0, 1 ; <i32> [#uses=1]
+ br label %bb4
+
+bb4: ; preds = %bb3, %entry
+ %d.0 = phi double [ undef, %entry ], [ %3, %bb3 ] ; <double> [#uses=2]
+ %l.0 = phi i32 [ 0, %entry ], [ %4, %bb3 ] ; <i32> [#uses=2]
+ %5 = icmp sgt i32 %l.0, 99 ; <i1> [#uses=1]
+ br i1 %5, label %bb5, label %bb
+
+bb5: ; preds = %bb4
+ store double %d.0, double* @ed, align 8
+ ret i32 0
+}
+
+declare double @sin(double) nounwind readonly
diff --git a/test/Transforms/SimplifyCFG/BrUnwind.ll b/test/Transforms/SimplifyCFG/BrUnwind.ll
new file mode 100644
index 000000000000..1acdecd5781a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/BrUnwind.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep {br label}
+
+define void @test(i1 %C) {
+ br i1 %C, label %A, label %B
+A: ; preds = %0
+ call void @test( i1 %C )
+ br label %X
+B: ; preds = %0
+ call void @test( i1 %C )
+ br label %X
+X: ; preds = %B, %A
+ unwind
+}
+
diff --git a/test/Transforms/SimplifyCFG/DeadSetCC.ll b/test/Transforms/SimplifyCFG/DeadSetCC.ll
new file mode 100644
index 000000000000..a4c8366e00fb
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/DeadSetCC.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep {icmp eq}
+
+; Check that simplifycfg deletes a dead 'seteq' instruction when it
+; folds a conditional branch into a switch instruction.
+
+declare void @foo()
+
+declare void @bar()
+
+define void @testcfg(i32 %V) {
+ %C = icmp eq i32 %V, 18 ; <i1> [#uses=1]
+ %D = icmp eq i32 %V, 180 ; <i1> [#uses=1]
+ %E = or i1 %C, %D ; <i1> [#uses=1]
+ br i1 %E, label %L1, label %Sw
+Sw: ; preds = %0
+ switch i32 %V, label %L1 [
+ i32 15, label %L2
+ i32 16, label %L2
+ ]
+L1: ; preds = %Sw, %0
+ call void @foo( )
+ ret void
+L2: ; preds = %Sw, %Sw
+ call void @bar( )
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll b/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
new file mode 100644
index 000000000000..55db7880f125
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
@@ -0,0 +1,18 @@
+; Test merging of blocks with phi nodes.
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep N:
+;
+
+define i32 @test(i1 %a) {
+Q:
+ br i1 %a, label %N, label %M
+N: ; preds = %Q
+ br label %M
+M: ; preds = %N, %Q
+ ; It's ok to merge N and M because the incoming values for W are the
+ ; same for both cases...
+ %W = phi i32 [ 2, %N ], [ 2, %Q ] ; <i32> [#uses=1]
+ %R = add i32 %W, 1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
diff --git a/test/Transforms/SimplifyCFG/HoistCode.ll b/test/Transforms/SimplifyCFG/HoistCode.ll
new file mode 100644
index 000000000000..d8894a6faa47
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/HoistCode.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define void @foo(i1 %C, i32* %P) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ store i32 7, i32* %P
+ ret void
+F: ; preds = %0
+ store i32 7, i32* %P
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/InvokeEliminate.ll b/test/Transforms/SimplifyCFG/InvokeEliminate.ll
new file mode 100644
index 000000000000..4f52f6b72e9e
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/InvokeEliminate.ll
@@ -0,0 +1,18 @@
+; This testcase checks to see if the simplifycfg pass is converting invoke
+; instructions to call instructions if the handler just rethrows the exception.
+
+; If this test is successful, the function should be reduced to 'call; ret'
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not egrep {\\(invoke\\)|\\(br\\)}
+
+declare void @bar()
+
+define i32 @test() {
+ invoke void @bar( )
+ to label %Ok unwind label %Rethrow
+Ok: ; preds = %0
+ ret i32 0
+Rethrow: ; preds = %0
+ unwind
+}
diff --git a/test/Transforms/SimplifyCFG/PhiBlockMerge.ll b/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
new file mode 100644
index 000000000000..f3844f7328e9
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
@@ -0,0 +1,22 @@
+; Test merging of blocks that only have PHI nodes in them
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep N:
+;
+
+define i32 @test(i1 %a, i1 %b) {
+; <label>:0
+ br i1 %a, label %M, label %O
+O: ; preds = %0
+ br i1 %b, label %N, label %Q
+Q: ; preds = %O
+ br label %N
+N: ; preds = %Q, %O
+ ; This block should be foldable into M
+ %Wp = phi i32 [ 0, %O ], [ 1, %Q ] ; <i32> [#uses=1]
+ br label %M
+M: ; preds = %N, %0
+ %W = phi i32 [ %Wp, %N ], [ 2, %0 ] ; <i32> [#uses=1]
+ %R = add i32 %W, 1 ; <i32> [#uses=1]
+ ret i32 %R
+}
+
diff --git a/test/Transforms/SimplifyCFG/PhiBlockMerge2.ll b/test/Transforms/SimplifyCFG/PhiBlockMerge2.ll
new file mode 100644
index 000000000000..24b3d118e7bc
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiBlockMerge2.ll
@@ -0,0 +1,27 @@
+; Test merging of blocks that only have PHI nodes in them. This tests the case
+; where the mergedinto block doesn't have any PHI nodes, and is in fact
+; dominated by the block-to-be-eliminated
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep N:
+;
+
+declare i1 @foo()
+
+define i32 @test(i1 %a, i1 %b) {
+ %c = call i1 @foo()
+ br i1 %c, label %N, label %P
+P:
+ %d = call i1 @foo()
+ br i1 %d, label %N, label %Q
+Q:
+ br label %N
+N:
+ %W = phi i32 [0, %0], [1, %Q], [2, %P]
+ ; This block should be foldable into M
+ br label %M
+
+M:
+ %R = add i32 %W, 1
+ ret i32 %R
+}
+
diff --git a/test/Transforms/SimplifyCFG/PhiEliminate.ll b/test/Transforms/SimplifyCFG/PhiEliminate.ll
new file mode 100644
index 000000000000..94697c96b78a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiEliminate.ll
@@ -0,0 +1,41 @@
+; Test a bunch of cases where the cfg simplification code should
+; be able to fold PHI nodes into computation in common cases. Folding the PHI
+; nodes away allows the branches to be eliminated, performing a simple form of
+; 'if conversion'.
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis > %t.xform
+; RUN: not grep phi %t.xform
+; RUN: grep ret %t.xform
+
+declare void @use(i1)
+
+declare void @use.upgrd.1(i32)
+
+define void @test2(i1 %c, i1 %d, i32 %V, i32 %V2) {
+; <label>:0
+ br i1 %d, label %X, label %F
+X: ; preds = %0
+ br i1 %c, label %T, label %F
+T: ; preds = %X
+ br label %F
+F: ; preds = %T, %X, %0
+ %B1 = phi i1 [ true, %0 ], [ false, %T ], [ false, %X ] ; <i1> [#uses=1]
+ %I7 = phi i32 [ %V, %0 ], [ %V2, %T ], [ %V2, %X ] ; <i32> [#uses=1]
+ call void @use( i1 %B1 )
+ call void @use.upgrd.1( i32 %I7 )
+ ret void
+}
+
+define void @test(i1 %c, i32 %V, i32 %V2) {
+; <label>:0
+ br i1 %c, label %T, label %F
+T: ; preds = %0
+ br label %F
+F: ; preds = %T, %0
+ %B1 = phi i1 [ true, %0 ], [ false, %T ] ; <i1> [#uses=1]
+ %I6 = phi i32 [ %V, %0 ], [ 0, %T ] ; <i32> [#uses=1]
+ call void @use( i1 %B1 )
+ call void @use.upgrd.1( i32 %I6 )
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/PhiEliminate2.ll b/test/Transforms/SimplifyCFG/PhiEliminate2.ll
new file mode 100644
index 000000000000..ec1b91a0d16e
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiEliminate2.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define i32 @test(i1 %C, i32 %V1, i32 %V2) {
+entry:
+ br i1 %C, label %then, label %Cont
+then: ; preds = %entry
+ %V3 = or i32 %V2, %V1 ; <i32> [#uses=1]
+ br label %Cont
+Cont: ; preds = %then, %entry
+ %V4 = phi i32 [ %V1, %entry ], [ %V3, %then ] ; <i32> [#uses=0]
+ call i32 @test( i1 false, i32 0, i32 0 ) ; <i32>:0 [#uses=0]
+ ret i32 %V1
+}
+
diff --git a/test/Transforms/SimplifyCFG/PhiNoEliminate.ll b/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
new file mode 100644
index 000000000000..dfe122abbf94
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep select
+
+;; The PHI node in this example should not be turned into a select, as we are
+;; not able to ifcvt the entire block. As such, converting to a select just
+;; introduces inefficiency without saving copies.
+
+define i32 @bar(i1 %C) {
+entry:
+ br i1 %C, label %then, label %endif
+then: ; preds = %entry
+ %tmp.3 = call i32 @qux( ) ; <i32> [#uses=0]
+ br label %endif
+endif: ; preds = %then, %entry
+ %R = phi i32 [ 123, %entry ], [ 12312, %then ] ; <i32> [#uses=1]
+ ;; stuff to disable tail duplication
+ call i32 @qux( ) ; <i32>:0 [#uses=0]
+ call i32 @qux( ) ; <i32>:1 [#uses=0]
+ call i32 @qux( ) ; <i32>:2 [#uses=0]
+ call i32 @qux( ) ; <i32>:3 [#uses=0]
+ call i32 @qux( ) ; <i32>:4 [#uses=0]
+ call i32 @qux( ) ; <i32>:5 [#uses=0]
+ call i32 @qux( ) ; <i32>:6 [#uses=0]
+ ret i32 %R
+}
+
+declare i32 @qux()
diff --git a/test/Transforms/SimplifyCFG/SpeculativeExec.ll b/test/Transforms/SimplifyCFG/SpeculativeExec.ll
new file mode 100644
index 000000000000..2be9124fe13a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/SpeculativeExec.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep select
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep br | count 2
+
+define i32 @t2(i32 %a, i32 %b, i32 %c) nounwind {
+entry:
+ %tmp1 = icmp eq i32 %b, 0
+ br i1 %tmp1, label %bb1, label %bb3
+
+bb1: ; preds = %entry
+ %tmp2 = icmp sgt i32 %c, 1
+ br i1 %tmp2, label %bb2, label %bb3
+
+bb2: ; preds = bb1
+ %tmp3 = add i32 %a, 1
+ br label %bb3
+
+bb3: ; preds = %bb2, %entry
+ %tmp4 = phi i32 [ %b, %entry ], [ %a, %bb1 ], [ %tmp3, %bb2 ]
+ %tmp5 = sub i32 %tmp4, 1
+ ret i32 %tmp5
+}
diff --git a/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll b/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
new file mode 100644
index 000000000000..e6c05f3beeb0
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
@@ -0,0 +1,33 @@
+; The unify-function-exit-nodes pass often makes basic blocks that just contain
+; a PHI node and a return. Make sure the simplify cfg can straighten out this
+; important case. This is basically the most trivial form of tail-duplication.
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep {br label}
+
+define i32 @test(i1 %B, i32 %A, i32 %B.upgrd.1) {
+ br i1 %B, label %T, label %F
+T: ; preds = %0
+ br label %ret
+F: ; preds = %0
+ br label %ret
+ret: ; preds = %F, %T
+ %X = phi i32 [ %A, %F ], [ %B.upgrd.1, %T ] ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+
+; Make sure it's willing to move unconditional branches to return instructions
+; as well, even if the return block is shared and the source blocks are
+; non-empty.
+define i32 @test2(i1 %B, i32 %A, i32 %B.upgrd.2) {
+ br i1 %B, label %T, label %F
+T: ; preds = %0
+ call i32 @test( i1 true, i32 5, i32 8 ) ; <i32>:1 [#uses=0]
+ br label %ret
+F: ; preds = %0
+ call i32 @test( i1 true, i32 5, i32 8 ) ; <i32>:2 [#uses=0]
+ br label %ret
+ret: ; preds = %F, %T
+ ret i32 %A
+}
diff --git a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
new file mode 100644
index 000000000000..3c4491937355
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep unreachable
+
+define void @test1(i1 %C, i1* %BP) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ store i1 %C, i1* %BP
+ unreachable
+F: ; preds = %0
+ ret void
+}
+
+define void @test2() {
+ invoke void @test2( )
+ to label %N unwind label %U
+U: ; preds = %0
+ unreachable
+N: ; preds = %0
+ ret void
+}
+
+define i32 @test3(i32 %v) {
+ switch i32 %v, label %default [
+ i32 1, label %U
+ i32 2, label %T
+ ]
+default: ; preds = %0
+ ret i32 1
+U: ; preds = %0
+ unreachable
+T: ; preds = %0
+ ret i32 2
+}
+
diff --git a/test/Transforms/SimplifyCFG/basictest.ll b/test/Transforms/SimplifyCFG/basictest.ll
new file mode 100644
index 000000000000..1fd629a4fd41
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/basictest.ll
@@ -0,0 +1,25 @@
+; Test CFG simplify removal of branch instructions...
+;
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define void @test1() {
+ br label %BB1
+BB1: ; preds = %0
+ ret void
+}
+
+define void @test2() {
+ ret void
+BB1: ; No predecessors!
+ ret void
+}
+
+define void @test3(i1 %T) {
+ br i1 %T, label %BB1, label %BB1
+BB1: ; preds = %0, %0
+ ret void
+}
+
+
+
+
diff --git a/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll b/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll
new file mode 100644
index 000000000000..b2f53a3da6d3
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch-branch-dbginfo.ll
@@ -0,0 +1,70 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {br i1} | count 1
+
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str = internal constant [7 x i8] c"cond.c\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+@.str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5555) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
+@.str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 393473, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0]
+@.str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable6 = internal constant %llvm.dbg.variable.type { i32 393473, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0]
+@.str7 = internal constant [2 x i8] c"y\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 393238, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([6 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, i64 0, i64 0, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype9 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+@.str8 = internal constant [6 x i8] c"uint1\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@llvm.dbg.basictype9 = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 7 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+
+define i32 @foo(i32 %x1, i1 zeroext %y2) nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp4 = icmp eq i32 %x1, 0 ; <i1> [#uses=1]
+ br i1 %tmp4, label %bb, label %bb14
+
+bb: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %y2, label %bb14, label %bb10
+
+bb7: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 7, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp9 = call i32 @g1(i32 %x1) nounwind ; <i32> [#uses=1]
+ ret i32 %tmp9
+
+bb10: ; preds = %bb
+ call void @llvm.dbg.stoppoint(i32 8, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp12 = add i32 %x1, 1 ; <i32> [#uses=1]
+ %tmp13 = call i32 @g2(i32 %tmp12) nounwind ; <i32> [#uses=1]
+ ret i32 %tmp13
+
+bb14: ; preds = %entry
+ call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp16 = call i32 @g1(i32 %x1) nounwind ; <i32> [#uses=1]
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ ret i32 %tmp16
+}
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare i32 @g1(i32)
+
+declare i32 @g2(i32)
+
+declare void @llvm.dbg.region.end({ }*) nounwind
diff --git a/test/Transforms/SimplifyCFG/branch-cond-merge.ll b/test/Transforms/SimplifyCFG/branch-cond-merge.ll
new file mode 100644
index 000000000000..ae465036584f
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch-cond-merge.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine \
+; RUN: -simplifycfg | llvm-dis | not grep call
+
+declare void @bar()
+
+define void @test(i32 %X, i32 %Y) {
+entry:
+ %tmp.2 = icmp ne i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %tmp.2, label %shortcirc_next, label %UnifiedReturnBlock
+shortcirc_next: ; preds = %entry
+ %tmp.3 = icmp ne i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %tmp.3, label %UnifiedReturnBlock, label %then
+then: ; preds = %shortcirc_next
+ call void @bar( )
+ ret void
+UnifiedReturnBlock: ; preds = %shortcirc_next, %entry
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/branch-cond-prop.ll b/test/Transforms/SimplifyCFG/branch-cond-prop.ll
new file mode 100644
index 000000000000..a7cd359689d9
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch-cond-prop.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep call
+
+declare void @bar()
+
+define void @test(i32 %X, i32 %Y) {
+entry:
+ %tmp.2 = icmp slt i32 %X, %Y ; <i1> [#uses=2]
+ br i1 %tmp.2, label %shortcirc_next, label %UnifiedReturnBlock
+shortcirc_next: ; preds = %entry
+ br i1 %tmp.2, label %UnifiedReturnBlock, label %then
+then: ; preds = %shortcirc_next
+ call void @bar( )
+ ret void
+UnifiedReturnBlock: ; preds = %shortcirc_next, %entry
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/branch-fold-test.ll b/test/Transforms/SimplifyCFG/branch-fold-test.ll
new file mode 100644
index 000000000000..444741f5b72d
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch-fold-test.ll
@@ -0,0 +1,17 @@
+; This test ensures that the simplifycfg pass continues to constant fold
+; terminator instructions.
+
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define i32 @test(i32 %A, i32 %B) {
+J:
+ %C = add i32 %A, 12 ; <i32> [#uses=2]
+ br i1 true, label %L, label %K
+L: ; preds = %J
+ %D = add i32 %C, %B ; <i32> [#uses=1]
+ ret i32 %D
+K: ; preds = %J
+ %E = add i32 %C, %B ; <i32> [#uses=1]
+ ret i32 %E
+}
+
diff --git a/test/Transforms/SimplifyCFG/branch-fold.ll b/test/Transforms/SimplifyCFG/branch-fold.ll
new file mode 100644
index 000000000000..d671b6edec45
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch-fold.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {br i1} | count 1
+
+define void @test(i32* %P, i32* %Q, i1 %A, i1 %B) {
+ br i1 %A, label %a, label %b
+a: ; preds = %0
+ br i1 %B, label %b, label %c
+b: ; preds = %a, %0
+ store i32 123, i32* %P
+ ret void
+c: ; preds = %a
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/branch-phi-thread.ll b/test/Transforms/SimplifyCFG/branch-phi-thread.ll
new file mode 100644
index 000000000000..c536b6c88716
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch-phi-thread.ll
@@ -0,0 +1,66 @@
+; RUN: llvm-as < %s | opt -simplifycfg -adce | llvm-dis | \
+; RUN: not grep {call void @f1}
+; END.
+
+declare void @f1()
+
+declare void @f2()
+
+declare void @f3()
+
+declare void @f4()
+
+define i32 @test1(i32 %X, i1 %D) {
+E:
+ %C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
+ br i1 %C, label %T, label %F
+T: ; preds = %A, %E
+ br i1 %C, label %B, label %A
+A: ; preds = %T
+ call void @f1( )
+ br i1 %D, label %T, label %F
+B: ; preds = %T
+ call void @f2( )
+ ret i32 345
+F: ; preds = %A, %E
+ call void @f3( )
+ ret i32 123
+}
+
+define i32 @test2(i32 %X, i1 %D) {
+E:
+ %C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
+ br i1 %C, label %T, label %F
+T: ; preds = %A, %E
+ %P = phi i1 [ true, %E ], [ %C, %A ] ; <i1> [#uses=1]
+ br i1 %P, label %B, label %A
+A: ; preds = %T
+ call void @f1( )
+ br i1 %D, label %T, label %F
+B: ; preds = %T
+ call void @f2( )
+ ret i32 345
+F: ; preds = %A, %E
+ call void @f3( )
+ ret i32 123
+}
+
+define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
+E:
+ %C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
+ br i1 %C, label %T, label %F
+T: ; preds = %A, %E
+ call void @f3( )
+ %XX = load i32* %AP ; <i32> [#uses=1]
+ store i32 %XX, i32* %BP
+ br i1 %C, label %B, label %A
+A: ; preds = %T
+ call void @f1( )
+ br i1 %D, label %T, label %F
+B: ; preds = %T
+ call void @f2( )
+ ret i32 345
+F: ; preds = %A, %E
+ call void @f3( )
+ ret i32 123
+}
diff --git a/test/Transforms/SimplifyCFG/branch_fold_dbg.ll b/test/Transforms/SimplifyCFG/branch_fold_dbg.ll
new file mode 100644
index 000000000000..d1d00b37aac2
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/branch_fold_dbg.ll
@@ -0,0 +1,122 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+; END.
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+
+define void @main() {
+entry:
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.14.i19 = icmp eq i32 0, 2 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.14.i19, label %endif.1.i20, label %read_min.exit
+endif.1.i20: ; preds = %entry
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.9.i.i = icmp eq i8* null, null ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.9.i.i, label %then.i12.i, label %then.i.i
+then.i.i: ; preds = %endif.1.i20
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+then.i12.i: ; preds = %endif.1.i20
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.9.i4.i = icmp eq i8* null, null ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.9.i4.i, label %endif.2.i33, label %then.i5.i
+then.i5.i: ; preds = %then.i12.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+endif.2.i33: ; preds = %then.i12.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %loopexit.0.i40, label %no_exit.0.i35
+no_exit.0.i35: ; preds = %no_exit.0.i35, %endif.2.i33
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.130.i = icmp slt i32 0, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.130.i, label %loopexit.0.i40.loopexit, label %no_exit.0.i35
+loopexit.0.i40.loopexit: ; preds = %no_exit.0.i35
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %loopexit.0.i40
+loopexit.0.i40: ; preds = %loopexit.0.i40.loopexit, %endif.2.i33
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.341.i = icmp eq i32 0, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.341.i, label %loopentry.1.i, label %read_min.exit
+loopentry.1.i: ; preds = %loopexit.0.i40
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.347.i = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.347.i, label %no_exit.1.i41, label %loopexit.2.i44
+no_exit.1.i41: ; preds = %endif.5.i, %loopentry.1.i
+ %indvar.i42 = phi i32 [ %indvar.next.i, %endif.5.i ], [ 0, %loopentry.1.i ] ; <i32> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.355.i = icmp eq i32 0, 3 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.355.i, label %endif.5.i, label %read_min.exit
+endif.5.i: ; preds = %no_exit.1.i41
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.34773.i = icmp sgt i32 0, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %indvar.next.i = add i32 %indvar.i42, 1 ; <i32> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.34773.i, label %no_exit.1.i41, label %loopexit.1.i.loopexit
+loopexit.1.i.loopexit: ; preds = %endif.5.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+loopexit.2.i44: ; preds = %loopentry.1.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+read_min.exit: ; preds = %no_exit.1.i41, %loopexit.0.i40, %entry
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.23 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 %tmp.23, label %endif.1, label %then.1
+then.1: ; preds = %read_min.exit
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %endif.0.i, label %then.0.i
+then.0.i: ; preds = %then.1
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %endif.1.i, label %then.1.i
+endif.0.i: ; preds = %then.1
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %endif.1.i, label %then.1.i
+then.1.i: ; preds = %endif.0.i, %then.0.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %getfree.exit, label %then.2.i
+endif.1.i: ; preds = %endif.0.i, %then.0.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %getfree.exit, label %then.2.i
+then.2.i: ; preds = %endif.1.i, %then.1.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+getfree.exit: ; preds = %endif.1.i, %then.1.i
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+endif.1: ; preds = %read_min.exit
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.27.i = getelementptr i32* null, i32 0 ; <i32*> [#uses=0]
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %loopexit.0.i15, label %no_exit.0.i14
+no_exit.0.i14: ; preds = %endif.1
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+loopexit.0.i15: ; preds = %endif.1
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %primal_start_artificial.exit, label %no_exit.1.i16
+no_exit.1.i16: ; preds = %no_exit.1.i16, %loopexit.0.i15
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br i1 false, label %primal_start_artificial.exit, label %no_exit.1.i16
+primal_start_artificial.exit: ; preds = %no_exit.1.i16, %loopexit.0.i15
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/dbginfo.ll b/test/Transforms/SimplifyCFG/dbginfo.ll
new file mode 100644
index 000000000000..38ecbb8f7629
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/dbginfo.ll
@@ -0,0 +1,73 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep region | count 2
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep func.start | count 2
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep "br label"
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.subrange.type = type { i32, i64, i64 }
+ %struct.Group = type { %struct.Scene, %struct.Sphere, %"struct.std::list<Scene*,std::allocator<Scene*> >" }
+ %struct.Ray = type { %struct.Vec, %struct.Vec }
+ %struct.Scene = type { i32 (...)** }
+ %struct.Sphere = type { %struct.Scene, %struct.Vec, double }
+ %struct.Vec = type { double, double, double }
+ %struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
+ %struct.__false_type = type <{ i8 }>
+ %"struct.__gnu_cxx::new_allocator<Scene*>" = type <{ i8 }>
+ %"struct.__gnu_cxx::new_allocator<std::_List_node<Scene*> >" = type <{ i8 }>
+ %struct.__si_class_type_info_pseudo = type { %struct.__type_info_pseudo, %"struct.std::type_info"* }
+ %struct.__type_info_pseudo = type { i8*, i8* }
+ %"struct.std::Hit" = type { double, %struct.Vec }
+ %"struct.std::_List_base<Scene*,std::allocator<Scene*> >" = type { %"struct.std::_List_base<Scene*,std::allocator<Scene*> >::_List_impl" }
+ %"struct.std::_List_base<Scene*,std::allocator<Scene*> >::_List_impl" = type { %"struct.std::_List_node_base" }
+ %"struct.std::_List_const_iterator<Scene*>" = type { %"struct.std::_List_node_base"* }
+ %"struct.std::_List_iterator<Scene*>" = type { %"struct.std::_List_node_base"* }
+ %"struct.std::_List_node<Scene*>" = type { %"struct.std::_List_node_base", %struct.Scene* }
+ %"struct.std::_List_node_base" = type { %"struct.std::_List_node_base"*, %"struct.std::_List_node_base"* }
+ %"struct.std::allocator<Scene*>" = type <{ i8 }>
+ %"struct.std::allocator<std::_List_node<Scene*> >" = type <{ i8 }>
+ %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i8, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"*, %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >"* }
+ %"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
+ %"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
+ %"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }
+ %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
+ %"struct.std::ios_base::Init" = type <{ i8 }>
+ %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
+ %"struct.std::ios_base::_Words" = type { i8*, i32 }
+ %"struct.std::list<Scene*,std::allocator<Scene*> >" = type { %"struct.std::_List_base<Scene*,std::allocator<Scene*> >" }
+ %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
+ %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
+ %"struct.std::locale::facet" = type { i32 (...)**, i32 }
+ %"struct.std::num_get<char,std::istreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
+ %"struct.std::num_put<char,std::ostreambuf_iterator<char, std::char_traits<char> > >" = type { %"struct.std::locale::facet" }
+ %"struct.std::numeric_limits<double>" = type <{ i8 }>
+ %"struct.std::type_info" = type { i32 (...)**, i8* }
+@llvm.dbg.subprogram947 = external constant %llvm.dbg.subprogram.type ; <%llvm.dbg.subprogram.type*> [#uses=1]
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
+
+declare void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(%struct.__false_type*) nounwind
+
+define void @_ZNSaIP5SceneED1Ev(%struct.__false_type* %this) nounwind {
+entry:
+ %this_addr = alloca %struct.__false_type* ; <%struct.__false_type**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram947 to { }*))
+ store %struct.__false_type* %this, %struct.__false_type** %this_addr
+ %0 = load %struct.__false_type** %this_addr, align 4 ; <%struct.__false_type*> [#uses=1]
+ call void @_ZN9__gnu_cxx13new_allocatorIP5SceneED2Ev(%struct.__false_type* %0) nounwind
+ br label %bb
+
+bb: ; preds = %entry
+ br label %return
+
+return: ; preds = %bb
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram947 to { }*))
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/dg.exp b/test/Transforms/SimplifyCFG/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/SimplifyCFG/hoist-common-code.dbg.ll b/test/Transforms/SimplifyCFG/hoist-common-code.dbg.ll
new file mode 100644
index 000000000000..ad5cd938aba6
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/hoist-common-code.dbg.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @bar(i32)
+
+define void @test(i1 %P, i32* %Q) {
+ br i1 %P, label %T, label %F
+T: ; preds = %0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ store i32 1, i32* %Q
+ %A = load i32* %Q ; <i32> [#uses=1]
+ call void @bar( i32 %A )
+ ret void
+F: ; preds = %0
+ store i32 1, i32* %Q
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %B = load i32* %Q ; <i32> [#uses=1]
+ call void @bar( i32 %B )
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/hoist-common-code.ll b/test/Transforms/SimplifyCFG/hoist-common-code.ll
new file mode 100644
index 000000000000..7512da263bd5
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/hoist-common-code.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+declare void @bar(i32)
+
+define void @test(i1 %P, i32* %Q) {
+ br i1 %P, label %T, label %F
+T: ; preds = %0
+ store i32 1, i32* %Q
+ %A = load i32* %Q ; <i32> [#uses=1]
+ call void @bar( i32 %A )
+ ret void
+F: ; preds = %0
+ store i32 1, i32* %Q
+ %B = load i32* %Q ; <i32> [#uses=1]
+ call void @bar( i32 %B )
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/iterative-simplify.ll b/test/Transforms/SimplifyCFG/iterative-simplify.ll
new file mode 100644
index 000000000000..9081b01b20a8
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/iterative-simplify.ll
@@ -0,0 +1,100 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep bb17
+; PR1786
+
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4 ; <i32*> [#uses=1]
+ %i = alloca i32, align 4 ; <i32*> [#uses=7]
+ %z = alloca i32, align 4 ; <i32*> [#uses=4]
+ %z16 = alloca i32, align 4 ; <i32*> [#uses=4]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 0, i32* %i
+ %toBool = icmp ne i8 1, 0 ; <i1> [#uses=1]
+ br i1 %toBool, label %cond_true, label %cond_false
+
+cond_true: ; preds = %entry
+ store i32 0, i32* %z
+ br label %bb
+
+bb: ; preds = %cond_next, %cond_true
+ %tmp = load i32* %z ; <i32> [#uses=1]
+ %tmp1 = sub i32 %tmp, 16384 ; <i32> [#uses=1]
+ store i32 %tmp1, i32* %z
+ %tmp2 = load i32* %i ; <i32> [#uses=1]
+ %tmp3 = add i32 %tmp2, 1 ; <i32> [#uses=1]
+ store i32 %tmp3, i32* %i
+ %tmp4 = load i32* %i ; <i32> [#uses=1]
+ %tmp5 = icmp sgt i32 %tmp4, 262144 ; <i1> [#uses=1]
+ %tmp56 = zext i1 %tmp5 to i8 ; <i8> [#uses=1]
+ %toBool7 = icmp ne i8 %tmp56, 0 ; <i1> [#uses=1]
+ br i1 %toBool7, label %cond_true8, label %cond_next
+
+cond_true8: ; preds = %bb
+ call void @abort( )
+ unreachable
+
+cond_next: ; preds = %bb
+ %tmp9 = load i32* %z ; <i32> [#uses=1]
+ %tmp10 = icmp ne i32 %tmp9, 0 ; <i1> [#uses=1]
+ %tmp1011 = zext i1 %tmp10 to i8 ; <i8> [#uses=1]
+ %toBool12 = icmp ne i8 %tmp1011, 0 ; <i1> [#uses=1]
+ br i1 %toBool12, label %bb, label %bb13
+
+bb13: ; preds = %cond_next
+ call void @exit( i32 0 )
+ unreachable
+
+cond_false: ; preds = %entry
+ %toBool14 = icmp ne i8 1, 0 ; <i1> [#uses=1]
+ br i1 %toBool14, label %cond_true15, label %cond_false33
+
+cond_true15: ; preds = %cond_false
+ store i32 0, i32* %z16
+ br label %bb17
+
+bb17: ; preds = %cond_next27, %cond_true15
+ %tmp18 = load i32* %z16 ; <i32> [#uses=1]
+ %tmp19 = sub i32 %tmp18, 16384 ; <i32> [#uses=1]
+ store i32 %tmp19, i32* %z16
+ %tmp20 = load i32* %i ; <i32> [#uses=1]
+ %tmp21 = add i32 %tmp20, 1 ; <i32> [#uses=1]
+ store i32 %tmp21, i32* %i
+ %tmp22 = load i32* %i ; <i32> [#uses=1]
+ %tmp23 = icmp sgt i32 %tmp22, 262144 ; <i1> [#uses=1]
+ %tmp2324 = zext i1 %tmp23 to i8 ; <i8> [#uses=1]
+ %toBool25 = icmp ne i8 %tmp2324, 0 ; <i1> [#uses=1]
+ br i1 %toBool25, label %cond_true26, label %cond_next27
+
+cond_true26: ; preds = %bb17
+ call void @abort( )
+ unreachable
+
+cond_next27: ; preds = %bb17
+ %tmp28 = load i32* %z16 ; <i32> [#uses=1]
+ %tmp29 = icmp ne i32 %tmp28, 0 ; <i1> [#uses=1]
+ %tmp2930 = zext i1 %tmp29 to i8 ; <i8> [#uses=1]
+ %toBool31 = icmp ne i8 %tmp2930, 0 ; <i1> [#uses=1]
+ br i1 %toBool31, label %bb17, label %bb32
+
+bb32: ; preds = %cond_next27
+ call void @exit( i32 0 )
+ unreachable
+
+cond_false33: ; preds = %cond_false
+ call void @exit( i32 0 )
+ unreachable
+
+cond_next34: ; No predecessors!
+ br label %cond_next35
+
+cond_next35: ; preds = %cond_next34
+ br label %return
+
+return: ; preds = %cond_next35
+ %retval36 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval36
+}
+
+declare void @abort()
+
+declare void @exit(i32)
diff --git a/test/Transforms/SimplifyCFG/noreturn-call.ll b/test/Transforms/SimplifyCFG/noreturn-call.ll
new file mode 100644
index 000000000000..0e1c6327e8b3
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/noreturn-call.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep unreachable
+; PR1796
+
+declare void @Finisher(i32) noreturn
+
+define void @YYY(i32) {
+ tail call void @Finisher(i32 %0) noreturn
+ tail call void @Finisher(i32 %0) noreturn
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/return-merge.ll b/test/Transforms/SimplifyCFG/return-merge.ll
new file mode 100644
index 000000000000..60267e9ec69b
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/return-merge.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define i32 @test1(i1 %C) {
+entry:
+ br i1 %C, label %T, label %F
+T: ; preds = %entry
+ ret i32 1
+F: ; preds = %entry
+ ret i32 0
+}
+
+define void @test2(i1 %C) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ ret void
+F: ; preds = %0
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/switch-simplify-crash.ll b/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
new file mode 100644
index 000000000000..74559a02647e
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
@@ -0,0 +1,108 @@
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
+
+define void @NewExtractNames() {
+entry:
+ br i1 false, label %endif.0, label %then.0
+then.0: ; preds = %entry
+ br i1 false, label %shortcirc_next.i, label %shortcirc_done.i
+shortcirc_next.i: ; preds = %then.0
+ br label %shortcirc_done.i
+shortcirc_done.i: ; preds = %shortcirc_next.i, %then.0
+ br i1 false, label %then.0.i, label %else.0.i
+then.0.i: ; preds = %shortcirc_done.i
+ br label %NewBase.exit
+else.0.i: ; preds = %shortcirc_done.i
+ br i1 false, label %endif.0.i, label %else.1.i
+else.1.i: ; preds = %else.0.i
+ br i1 false, label %endif.0.i, label %else.2.i
+else.2.i: ; preds = %else.1.i
+ br label %NewBase.exit
+endif.0.i: ; preds = %else.1.i, %else.0.i
+ br label %NewBase.exit
+NewBase.exit: ; preds = %endif.0.i, %else.2.i, %then.0.i
+ br label %endif.0
+endif.0: ; preds = %NewBase.exit, %entry
+ %tmp.32.mask = and i32 0, 31 ; <i32> [#uses=1]
+ switch i32 %tmp.32.mask, label %label.9 [
+ i32 16, label %loopentry.2
+ i32 15, label %loopentry.2
+ i32 14, label %loopentry.2
+ i32 13, label %loopentry.2
+ i32 10, label %loopentry.2
+ i32 20, label %loopentry.1
+ i32 19, label %loopentry.1
+ i32 2, label %loopentry.0
+ i32 0, label %switchexit
+ ]
+loopentry.0: ; preds = %endif.1, %endif.0
+ br i1 false, label %no_exit.0, label %switchexit
+no_exit.0: ; preds = %loopentry.0
+ br i1 false, label %then.1, label %else.1
+then.1: ; preds = %no_exit.0
+ br label %endif.1
+else.1: ; preds = %no_exit.0
+ br i1 false, label %shortcirc_next.0, label %shortcirc_done.0
+shortcirc_next.0: ; preds = %else.1
+ br label %shortcirc_done.0
+shortcirc_done.0: ; preds = %shortcirc_next.0, %else.1
+ br i1 false, label %then.2, label %endif.2
+then.2: ; preds = %shortcirc_done.0
+ br label %endif.2
+endif.2: ; preds = %then.2, %shortcirc_done.0
+ br label %endif.1
+endif.1: ; preds = %endif.2, %then.1
+ br label %loopentry.0
+loopentry.1: ; preds = %endif.3, %endif.0, %endif.0
+ br i1 false, label %no_exit.1, label %switchexit
+no_exit.1: ; preds = %loopentry.1
+ br i1 false, label %then.3, label %else.2
+then.3: ; preds = %no_exit.1
+ br label %endif.3
+else.2: ; preds = %no_exit.1
+ br i1 false, label %shortcirc_next.1, label %shortcirc_done.1
+shortcirc_next.1: ; preds = %else.2
+ br label %shortcirc_done.1
+shortcirc_done.1: ; preds = %shortcirc_next.1, %else.2
+ br i1 false, label %then.4, label %endif.4
+then.4: ; preds = %shortcirc_done.1
+ br label %endif.4
+endif.4: ; preds = %then.4, %shortcirc_done.1
+ br label %endif.3
+endif.3: ; preds = %endif.4, %then.3
+ br label %loopentry.1
+loopentry.2: ; preds = %endif.5, %endif.0, %endif.0, %endif.0, %endif.0, %endif.0
+ %i.3 = phi i32 [ 0, %endif.5 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ] ; <i32> [#uses=1]
+ %tmp.158 = icmp slt i32 %i.3, 0 ; <i1> [#uses=1]
+ br i1 %tmp.158, label %no_exit.2, label %switchexit
+no_exit.2: ; preds = %loopentry.2
+ br i1 false, label %shortcirc_next.2, label %shortcirc_done.2
+shortcirc_next.2: ; preds = %no_exit.2
+ br label %shortcirc_done.2
+shortcirc_done.2: ; preds = %shortcirc_next.2, %no_exit.2
+ br i1 false, label %then.5, label %endif.5
+then.5: ; preds = %shortcirc_done.2
+ br label %endif.5
+endif.5: ; preds = %then.5, %shortcirc_done.2
+ br label %loopentry.2
+label.9: ; preds = %endif.0
+ br i1 false, label %then.6, label %endif.6
+then.6: ; preds = %label.9
+ br label %endif.6
+endif.6: ; preds = %then.6, %label.9
+ store i32 0, i32* null
+ br label %switchexit
+switchexit: ; preds = %endif.6, %loopentry.2, %loopentry.1, %loopentry.0, %endif.0
+ br i1 false, label %endif.7, label %then.7
+then.7: ; preds = %switchexit
+ br i1 false, label %shortcirc_next.3, label %shortcirc_done.3
+shortcirc_next.3: ; preds = %then.7
+ br label %shortcirc_done.3
+shortcirc_done.3: ; preds = %shortcirc_next.3, %then.7
+ br i1 false, label %then.8, label %endif.8
+then.8: ; preds = %shortcirc_done.3
+ br label %endif.8
+endif.8: ; preds = %then.8, %shortcirc_done.3
+ br label %endif.7
+endif.7: ; preds = %endif.8, %switchexit
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/switch_create.ll b/test/Transforms/SimplifyCFG/switch_create.ll
new file mode 100644
index 000000000000..4994cd3960aa
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_create.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+declare void @foo1()
+
+declare void @foo2()
+
+define void @test1(i32 %V) {
+ %C1 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
+ %C2 = icmp eq i32 %V, 17 ; <i1> [#uses=1]
+ %CN = or i1 %C1, %C2 ; <i1> [#uses=1]
+ br i1 %CN, label %T, label %F
+T: ; preds = %0
+ call void @foo1( )
+ ret void
+F: ; preds = %0
+ call void @foo2( )
+ ret void
+}
+
+define void @test2(i32 %V) {
+ %C1 = icmp ne i32 %V, 4 ; <i1> [#uses=1]
+ %C2 = icmp ne i32 %V, 17 ; <i1> [#uses=1]
+ %CN = and i1 %C1, %C2 ; <i1> [#uses=1]
+ br i1 %CN, label %T, label %F
+T: ; preds = %0
+ call void @foo1( )
+ ret void
+F: ; preds = %0
+ call void @foo2( )
+ ret void
+}
+
+define void @test3(i32 %V) {
+ %C1 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
+ br i1 %C1, label %T, label %N
+N: ; preds = %0
+ %C2 = icmp eq i32 %V, 17 ; <i1> [#uses=1]
+ br i1 %C2, label %T, label %F
+T: ; preds = %N, %0
+ call void @foo1( )
+ ret void
+F: ; preds = %N
+ call void @foo2( )
+ ret void
+}
+
+
diff --git a/test/Transforms/SimplifyCFG/switch_formation.dbg.ll b/test/Transforms/SimplifyCFG/switch_formation.dbg.ll
new file mode 100644
index 000000000000..0ce01f1cfaea
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_formation.dbg.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+; END.
+
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+define i1 @_ZN4llvm11SetCondInst7classofEPKNS_11InstructionE({ i32, i32 }* %I) {
+entry:
+ %tmp.1.i = getelementptr { i32, i32 }* %I, i64 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.2.i = load i32* %tmp.1.i ; <i32> [#uses=6]
+ %tmp.2 = icmp eq i32 %tmp.2.i, 14 ; <i1> [#uses=1]
+ br i1 %tmp.2, label %shortcirc_done.4, label %shortcirc_next.0
+shortcirc_next.0: ; preds = %entry
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.6 = icmp eq i32 %tmp.2.i, 15 ; <i1> [#uses=1]
+ br i1 %tmp.6, label %shortcirc_done.4, label %shortcirc_next.1
+shortcirc_next.1: ; preds = %shortcirc_next.0
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.11 = icmp eq i32 %tmp.2.i, 16 ; <i1> [#uses=1]
+ br i1 %tmp.11, label %shortcirc_done.4, label %shortcirc_next.2
+shortcirc_next.2: ; preds = %shortcirc_next.1
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.16 = icmp eq i32 %tmp.2.i, 17 ; <i1> [#uses=1]
+ br i1 %tmp.16, label %shortcirc_done.4, label %shortcirc_next.3
+shortcirc_next.3: ; preds = %shortcirc_next.2
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.21 = icmp eq i32 %tmp.2.i, 18 ; <i1> [#uses=1]
+ br i1 %tmp.21, label %shortcirc_done.4, label %shortcirc_next.4
+shortcirc_next.4: ; preds = %shortcirc_next.3
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp.26 = icmp eq i32 %tmp.2.i, 19 ; <i1> [#uses=1]
+ br label %UnifiedReturnBlock
+shortcirc_done.4: ; preds = %shortcirc_next.3, %shortcirc_next.2, %shortcirc_next.1, %shortcirc_next.0, %entry
+ br label %UnifiedReturnBlock
+UnifiedReturnBlock: ; preds = %shortcirc_done.4, %shortcirc_next.4
+ %UnifiedRetVal = phi i1 [ %tmp.26, %shortcirc_next.4 ], [ true, %shortcirc_done.4 ] ; <i1> [#uses=1]
+ ret i1 %UnifiedRetVal
+}
+
diff --git a/test/Transforms/SimplifyCFG/switch_formation.ll b/test/Transforms/SimplifyCFG/switch_formation.ll
new file mode 100644
index 000000000000..534c471eaad7
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_formation.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+; END.
+
+define i1 @_ZN4llvm11SetCondInst7classofEPKNS_11InstructionE({ i32, i32 }* %I) {
+entry:
+ %tmp.1.i = getelementptr { i32, i32 }* %I, i64 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.2.i = load i32* %tmp.1.i ; <i32> [#uses=6]
+ %tmp.2 = icmp eq i32 %tmp.2.i, 14 ; <i1> [#uses=1]
+ br i1 %tmp.2, label %shortcirc_done.4, label %shortcirc_next.0
+shortcirc_next.0: ; preds = %entry
+ %tmp.6 = icmp eq i32 %tmp.2.i, 15 ; <i1> [#uses=1]
+ br i1 %tmp.6, label %shortcirc_done.4, label %shortcirc_next.1
+shortcirc_next.1: ; preds = %shortcirc_next.0
+ %tmp.11 = icmp eq i32 %tmp.2.i, 16 ; <i1> [#uses=1]
+ br i1 %tmp.11, label %shortcirc_done.4, label %shortcirc_next.2
+shortcirc_next.2: ; preds = %shortcirc_next.1
+ %tmp.16 = icmp eq i32 %tmp.2.i, 17 ; <i1> [#uses=1]
+ br i1 %tmp.16, label %shortcirc_done.4, label %shortcirc_next.3
+shortcirc_next.3: ; preds = %shortcirc_next.2
+ %tmp.21 = icmp eq i32 %tmp.2.i, 18 ; <i1> [#uses=1]
+ br i1 %tmp.21, label %shortcirc_done.4, label %shortcirc_next.4
+shortcirc_next.4: ; preds = %shortcirc_next.3
+ %tmp.26 = icmp eq i32 %tmp.2.i, 19 ; <i1> [#uses=1]
+ br label %UnifiedReturnBlock
+shortcirc_done.4: ; preds = %shortcirc_next.3, %shortcirc_next.2, %shortcirc_next.1, %shortcirc_next.0, %entry
+ br label %UnifiedReturnBlock
+UnifiedReturnBlock: ; preds = %shortcirc_done.4, %shortcirc_next.4
+ %UnifiedRetVal = phi i1 [ %tmp.26, %shortcirc_next.4 ], [ true, %shortcirc_done.4 ] ; <i1> [#uses=1]
+ ret i1 %UnifiedRetVal
+}
+
diff --git a/test/Transforms/SimplifyCFG/switch_switch_fold.ll b/test/Transforms/SimplifyCFG/switch_switch_fold.ll
new file mode 100644
index 000000000000..1590f343a5fd
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_switch_fold.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: grep switch | count 1
+
+; Test that a switch going to a switch on the same value can be merged. All
+; three switches in this example can be merged into one big one.
+
+declare void @foo1()
+
+declare void @foo2()
+
+declare void @foo3()
+
+declare void @foo4()
+
+define void @test1(i32 %V) {
+ switch i32 %V, label %F [
+ i32 4, label %T
+ i32 17, label %T
+ i32 5, label %T
+ i32 1234, label %F
+ ]
+T: ; preds = %0, %0, %0
+ switch i32 %V, label %F [
+ i32 4, label %A
+ i32 17, label %B
+ i32 42, label %C
+ ]
+A: ; preds = %T
+ call void @foo1( )
+ ret void
+B: ; preds = %F, %F, %T
+ call void @foo2( )
+ ret void
+C: ; preds = %T
+ call void @foo3( )
+ ret void
+F: ; preds = %F, %T, %0, %0
+ switch i32 %V, label %F [
+ i32 4, label %B
+ i32 18, label %B
+ i32 42, label %D
+ ]
+D: ; preds = %F
+ call void @foo4( )
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll b/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll
new file mode 100644
index 000000000000..3654b28eed4c
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll
@@ -0,0 +1,116 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: grep switch | count 1
+
+; ModuleID = '<stdin>'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i386-pc-linux-gnu"
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str = internal constant [10 x i8] c"swithh2.c\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+@.str1 = internal constant [38 x i8] c"/developer/home2/zsth/test/debug/tmp/\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1]
+@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([10 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+@llvm.dbg.array = internal constant [2 x { }*] [{ }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
+@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+@.str4 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@.str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0]
+
+define i32 @foo(i32 %x) nounwind {
+entry:
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ switch i32 %x, label %bb4 [
+ i32 1, label %bb
+ i32 2, label %bb1
+ i32 3, label %bb2
+ i32 4, label %bb3
+ ]
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb
+
+bb: ; preds = %0, %entry
+ call void @llvm.dbg.stoppoint(i32 3, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 3, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb1
+
+bb1: ; preds = %1, %entry
+ call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb2
+
+bb2: ; preds = %2, %entry
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb3
+
+bb3: ; preds = %3, %entry
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb4
+
+bb4: ; preds = %4, %entry
+ call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ switch i32 %x, label %bb7 [
+ i32 5, label %bb5
+ i32 6, label %bb6
+ ]
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb5
+
+bb5: ; preds = %5, %bb4
+ call void @llvm.dbg.stoppoint(i32 11, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 11, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb6
+
+bb6: ; preds = %6, %bb4
+ call void @llvm.dbg.stoppoint(i32 12, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+ ; No predecessors!
+ call void @llvm.dbg.stoppoint(i32 12, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb7
+
+bb7: ; preds = %7, %bb4
+ call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6, %bb5, %bb3, %bb2, %bb1, %bb
+ %.0 = phi i32 [ 4, %bb3 ], [ 3, %bb2 ], [ 2, %bb1 ], [ 1, %bb ], [ 6, %bb6 ], [ 5, %bb5 ], [ 0, %bb7 ] ; <i32> [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ br label %return
+
+return: ; preds = %bb8
+ call void @llvm.dbg.stoppoint(i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ ret i32 %.0
+}
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
diff --git a/test/Transforms/SimplifyCFG/switch_thread.ll b/test/Transforms/SimplifyCFG/switch_thread.ll
new file mode 100644
index 000000000000..a92528a3331f
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/switch_thread.ll
@@ -0,0 +1,79 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
+; RUN: not grep {call void @DEAD}
+
+; Test that we can thread a simple known condition through switch statements.
+
+declare void @foo1()
+
+declare void @foo2()
+
+declare void @DEAD()
+
+define void @test1(i32 %V) {
+ switch i32 %V, label %A [
+ i32 4, label %T
+ i32 17, label %Done
+ i32 1234, label %A
+ ]
+;; V == 4 if we get here.
+T: ; preds = %0
+ call void @foo1( )
+ ;; This switch is always statically determined.
+ switch i32 %V, label %A2 [
+ i32 4, label %B
+ i32 17, label %C
+ i32 42, label %C
+ ]
+A2: ; preds = %T
+ call void @DEAD( )
+ call void @DEAD( )
+ ;; always true
+ %cond2 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
+ br i1 %cond2, label %Done, label %C
+A: ; preds = %0, %0
+ call void @foo1( )
+ ;; always true
+ %cond = icmp ne i32 %V, 4 ; <i1> [#uses=1]
+ br i1 %cond, label %Done, label %C
+Done: ; preds = %B, %A, %A2, %0
+ ret void
+B: ; preds = %T
+ call void @foo2( )
+ ;; always true
+ %cond3 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
+ br i1 %cond3, label %Done, label %C
+C: ; preds = %B, %A, %A2, %T, %T
+ call void @DEAD( )
+ ret void
+}
+
+define void @test2(i32 %V) {
+ switch i32 %V, label %A [
+ i32 4, label %T
+ i32 17, label %D
+ i32 1234, label %E
+ ]
+;; V != 4, 17, 1234 here.
+A: ; preds = %0
+ call void @foo1( )
+ ;; This switch is always statically determined.
+ switch i32 %V, label %E [
+ i32 4, label %C
+ i32 17, label %C
+ i32 42, label %D
+ ]
+;; unreacahble.
+C: ; preds = %A, %A
+ call void @DEAD( )
+ ret void
+T: ; preds = %0
+ call void @foo1( )
+ call void @foo1( )
+ ret void
+D: ; preds = %A, %0
+ call void @foo1( )
+ ret void
+E: ; preds = %A, %0
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll b/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
new file mode 100644
index 000000000000..a73a82b36971
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {volatile load}
+; PR2967
+
+target datalayout =
+"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32"
+target triple = "i386-pc-linux-gnu"
+
+define void @foo(i32 %x) nounwind {
+entry:
+ %0 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb, label %return
+
+bb: ; preds = %entry
+ %1 = volatile load i32* null ; <i32> [#uses=0]
+ unreachable
+ br label %return
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/SimplifyCFG/two-entry-phi-return.dbg.ll b/test/Transforms/SimplifyCFG/two-entry-phi-return.dbg.ll
new file mode 100644
index 000000000000..62d4a4335a51
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/two-entry-phi-return.dbg.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+
+@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ;
+
+@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+define i1 @qux(i8* %m, i8* %n, i8* %o, i8* %p) nounwind {
+entry:
+ %tmp7 = icmp eq i8* %m, %n
+ br i1 %tmp7, label %bb, label %UnifiedReturnBlock
+
+bb:
+call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %tmp15 = icmp eq i8* %o, %p
+ br label %UnifiedReturnBlock
+
+UnifiedReturnBlock:
+ %result = phi i1 [ 0, %entry ], [ %tmp15, %bb ]
+ ret i1 %result
+}
diff --git a/test/Transforms/SimplifyCFG/two-entry-phi-return.ll b/test/Transforms/SimplifyCFG/two-entry-phi-return.ll
new file mode 100644
index 000000000000..19814ade4d91
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/two-entry-phi-return.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+define i1 @qux(i8* %m, i8* %n, i8* %o, i8* %p) nounwind {
+entry:
+ %tmp7 = icmp eq i8* %m, %n
+ br i1 %tmp7, label %bb, label %UnifiedReturnBlock
+
+bb:
+ %tmp15 = icmp eq i8* %o, %p
+ br label %UnifiedReturnBlock
+
+UnifiedReturnBlock:
+ %result = phi i1 [ 0, %entry ], [ %tmp15, %bb ]
+ ret i1 %result
+}
diff --git a/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll b/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll
new file mode 100644
index 000000000000..860a6ebf966b
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls -disable-output
+
+@G = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1]
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+define void @foo(i8* %P, i32* %X) {
+ call i32 (i8*, i8*, ...)* @sprintf( i8* %P, i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i32* %X ) ; <i32>:1 [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll b/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll
new file mode 100644
index 000000000000..5a56d24a35ab
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll
@@ -0,0 +1,29 @@
+; PR1307
+; RUN: llvm-as < %s | opt -simplify-libcalls -instcombine | llvm-dis > %t
+; RUN: grep {@str,.*i64 3} %t
+; RUN: grep {@str1,.*i64 7} %t
+; RUN: grep {ret i8.*null} %t
+; END.
+
+@str = internal constant [5 x i8] c"foog\00"
+@str1 = internal constant [8 x i8] c"blahhh!\00"
+@str2 = internal constant [5 x i8] c"Ponk\00"
+
+define i8* @test1() {
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; <i8*> [#uses=1]
+ ret i8* %tmp3
+}
+
+declare i8* @strchr(i8*, i32)
+
+define i8* @test2() {
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; <i8*> [#uses=1]
+ ret i8* %tmp3
+}
+
+define i8* @test3() {
+entry:
+ %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1]
+ ret i8* %tmp3
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll b/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll
new file mode 100644
index 000000000000..b6c0ffdb704f
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep i32
+; PR2341
+
+@_2E_str = external constant [5 x i8] ; <[5 x i8]*> [#uses=1]
+
+declare i32 @memcmp(i8*, i8*, i32) nounwind readonly
+
+define i1 @f(i8** %start_addr) {
+entry:
+ %tmp4 = load i8** %start_addr, align 4 ; <i8*> [#uses=1]
+ %tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8]* @_2E_str, i32 0, i32 0), i32 4 ) nounwind readonly ; <i32> [#uses=1]
+ %tmp6 = icmp eq i32 %tmp5, 0 ; <i1> [#uses=1]
+ ret i1 %tmp6
+}
diff --git a/test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll b/test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll
new file mode 100644
index 000000000000..d35da8d1efd2
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2008-12-20-StrcmpMemcmp.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep call.*memcmp
+
+@.str = internal constant [2 x i8] c"x\00"
+
+declare i32 @strcmp(i8* %dest, i8* %src)
+
+define i32 @foo(i8* %x, i8* %y) {
+ %A = call i32 @strcmp(i8* %x, i8* getelementptr ([2 x i8]* @.str, i32 0, i32 0))
+ ret i32 %A
+}
diff --git a/test/Transforms/SimplifyLibCalls/2009-01-04-Annotate.ll b/test/Transforms/SimplifyLibCalls/2009-01-04-Annotate.ll
new file mode 100644
index 000000000000..fcaf12e188da
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2009-01-04-Annotate.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis > %t
+; RUN: grep noalias %t | count 2
+; RUN: grep nocapture %t | count 3
+; RUN: grep nounwind %t | count 3
+; RUN: grep readonly %t | count 1
+
+declare i8* @fopen(i8*, i8*)
+declare i8 @strlen(i8*)
+declare i32* @realloc(i32*, i32)
+
+; Test deliberately wrong declaration
+declare i32 @strcpy(...)
diff --git a/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll b/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll
new file mode 100644
index 000000000000..551a2bb6b990
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2009-02-11-NotInitialized.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -inline -simplify-libcalls -functionattrs | \
+; RUN: llvm-dis | grep nocapture | count 2
+; Check that nocapture attributes are added when run after an SCC pass.
+; PR3520
+
+define i32 @use(i8* %x) nounwind readonly {
+entry:
+ %0 = tail call i64 @strlen(i8* %x) nounwind readonly ; <i64> [#uses=1]
+ %1 = trunc i64 %0 to i32 ; <i32> [#uses=1]
+ ret i32 %1
+}
+
+declare i64 @strlen(i8*) nounwind readonly
diff --git a/test/Transforms/SimplifyLibCalls/2009-02-12-StrTo.ll b/test/Transforms/SimplifyLibCalls/2009-02-12-StrTo.ll
new file mode 100644
index 000000000000..4aeff1c048d8
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2009-02-12-StrTo.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis > %t
+; RUN: grep nocapture %t | count 2
+; RUN: grep null %t | grep nocapture | count 1
+; RUN: grep null %t | grep call | grep readonly | count 1
+
+; Test that we add nocapture to the declaration, and to the second call only.
+
+declare float @strtol(i8* %s, i8** %endptr, i32 %base)
+
+define void @foo(i8* %x, i8** %endptr) {
+ call float @strtol(i8* %x, i8** %endptr, i32 10)
+ call float @strtol(i8* %x, i8** null, i32 10)
+ ret void
+}
diff --git a/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll b/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll
new file mode 100644
index 000000000000..f7209934f769
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls -instcombine | llvm-dis | grep {ret i32 -65}
+; PR4284
+
+define i32 @test() nounwind {
+entry:
+ %c0 = alloca i8, align 1 ; <i8*> [#uses=2]
+ %c2 = alloca i8, align 1 ; <i8*> [#uses=2]
+ store i8 64, i8* %c0
+ store i8 -127, i8* %c2
+ %call = call i32 @memcmp(i8* %c0, i8* %c2, i32 1) ; <i32> [#uses=1]
+ ret i32 %call
+}
+
+declare i32 @memcmp(i8*, i8*, i32)
diff --git a/test/Transforms/SimplifyLibCalls/ExitInMain.ll b/test/Transforms/SimplifyLibCalls/ExitInMain.ll
new file mode 100644
index 000000000000..8abf3b1cc46b
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/ExitInMain.ll
@@ -0,0 +1,15 @@
+; Test that the ExitInMainOptimization pass works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: grep {ret i32 3} | count 1
+; END.
+
+declare void @exit(i32)
+
+declare void @exitonly(i32)
+
+define i32 @main() {
+ call void @exitonly( i32 3 )
+ call void @exit( i32 3 )
+ ret i32 0
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/FFS.ll b/test/Transforms/SimplifyLibCalls/FFS.ll
new file mode 100644
index 000000000000..d6a504af867d
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/FFS.ll
@@ -0,0 +1,36 @@
+; Test that the ToAsciiOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*@ffs}
+
+@non_const = external global i32 ; <i32*> [#uses=1]
+
+declare i32 @ffs(i32)
+
+declare i32 @ffsl(i32)
+
+declare i32 @ffsll(i64)
+
+define i32 @main() {
+ %arg = load i32* @non_const ; <i32> [#uses=1]
+ %val0 = call i32 @ffs( i32 %arg ) ; <i32> [#uses=1]
+ %val1 = call i32 @ffs( i32 1 ) ; <i32> [#uses=1]
+ %val2 = call i32 @ffs( i32 2048 ) ; <i32> [#uses=1]
+ %val3 = call i32 @ffsl( i32 65536 ) ; <i32> [#uses=1]
+ %val4 = call i32 @ffsll( i64 1024 ) ; <i32> [#uses=1]
+ %val5 = call i32 @ffsll( i64 17179869184 ) ; <i32> [#uses=1]
+ %val6 = call i32 @ffsll( i64 1152921504606846976 ) ; <i32> [#uses=1]
+ %rslt1 = add i32 %val1, %val2 ; <i32> [#uses=1]
+ %rslt2 = add i32 %val3, %val4 ; <i32> [#uses=1]
+ %rslt3 = add i32 %val5, %val6 ; <i32> [#uses=1]
+ %rslt4 = add i32 %rslt1, %rslt2 ; <i32> [#uses=1]
+ %rslt5 = add i32 %rslt4, %rslt3 ; <i32> [#uses=2]
+ %rslt6 = add i32 %rslt5, %val0 ; <i32> [#uses=0]
+ ret i32 %rslt5
+}
+
+
+; PR4206
+define i32 @a(i64) nounwind {
+ %2 = call i32 @ffsll(i64 %0) ; <i32> [#uses=1]
+ ret i32 %2
+}
diff --git a/test/Transforms/SimplifyLibCalls/FPrintF.ll b/test/Transforms/SimplifyLibCalls/FPrintF.ll
new file mode 100644
index 000000000000..ac6b3c1f7097
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/FPrintF.ll
@@ -0,0 +1,25 @@
+; Test that the FPrintFOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*fprintf}
+;
+
+ %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
+@str = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1]
+@chr = constant [3 x i8] c"%c\00" ; <[3 x i8]*> [#uses=1]
+@hello = constant [13 x i8] c"hello world\0A\00" ; <[13 x i8]*> [#uses=1]
+@stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=3]
+
+declare i32 @fprintf(%struct._IO_FILE*, i8*, ...)
+
+define i32 @foo() {
+entry:
+ %tmp.1 = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=1]
+ %tmp.0 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf( %struct._IO_FILE* %tmp.1, i8* getelementptr ([13 x i8]* @hello, i32 0, i32 0) ) ; <i32> [#uses=0]
+ %tmp.4 = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=1]
+ %tmp.3 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf( %struct._IO_FILE* %tmp.4, i8* getelementptr ([3 x i8]* @str, i32 0, i32 0), i8* getelementptr ([13 x i8]* @hello, i32 0, i32 0) ) ; <i32> [#uses=0]
+ %tmp.8 = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=1]
+ %tmp.7 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf( %struct._IO_FILE* %tmp.8, i8* getelementptr ([3 x i8]* @chr, i32 0, i32 0), i32 33 ) ; <i32> [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/IsDigit.ll b/test/Transforms/SimplifyLibCalls/IsDigit.ll
new file mode 100644
index 000000000000..a290e0107d45
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/IsDigit.ll
@@ -0,0 +1,21 @@
+; Test that the IsDigitOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep call
+
+declare i32 @isdigit(i32)
+
+declare i32 @isascii(i32)
+
+define i32 @main() {
+ %val1 = call i32 @isdigit( i32 47 ) ; <i32> [#uses=1]
+ %val2 = call i32 @isdigit( i32 48 ) ; <i32> [#uses=1]
+ %val3 = call i32 @isdigit( i32 57 ) ; <i32> [#uses=1]
+ %val4 = call i32 @isdigit( i32 58 ) ; <i32> [#uses=1]
+ %rslt1 = add i32 %val1, %val2 ; <i32> [#uses=1]
+ %rslt2 = add i32 %val3, %val4 ; <i32> [#uses=1]
+ %sum = add i32 %rslt1, %rslt2 ; <i32> [#uses=1]
+ %rslt = call i32 @isdigit( i32 %sum ) ; <i32> [#uses=1]
+ %tmp = call i32 @isascii( i32 %rslt ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/MemCpy.ll b/test/Transforms/SimplifyLibCalls/MemCpy.ll
new file mode 100644
index 000000000000..4e33b0755f94
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/MemCpy.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -constprop -instcombine | llvm-dis | not grep {call.*llvm.memcpy.i32}
+
+@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
+@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1]
+@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1]
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
+
+define i32 @main() {
+ %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1]
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3]
+ call void @llvm.memcpy.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 )
+ call void @llvm.memcpy.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 )
+ call void @llvm.memcpy.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 )
+ ret i32 0
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/Printf.ll b/test/Transforms/SimplifyLibCalls/Printf.ll
new file mode 100644
index 000000000000..c892f0341ab3
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/Printf.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep putchar
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*printf}
+
+@str = internal constant [13 x i8] c"hello world\0A\00" ; <[13 x i8]*> [#uses=1]
+@str1 = internal constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
+
+define void @foo() {
+entry:
+ %tmp1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([13 x i8]* @str, i32 0, i32 0) ) ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @printf(i8*, ...)
+
+define void @bar() {
+entry:
+ %tmp1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([2 x i8]* @str1, i32 0, i32 0) ) ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/Puts.ll b/test/Transforms/SimplifyLibCalls/Puts.ll
new file mode 100644
index 000000000000..e9bb2b381c98
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/Puts.ll
@@ -0,0 +1,26 @@
+; Test that the PutsCatOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*fputs}
+;
+
+ %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
+@stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1]
+@empty = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+@len1 = constant [2 x i8] c"A\00" ; <[2 x i8]*> [#uses=1]
+@long = constant [7 x i8] c"hello\0A\00" ; <[7 x i8]*> [#uses=1]
+
+declare i32 @fputs(i8*, %struct._IO_FILE*)
+
+define i32 @main() {
+entry:
+ %out = load %struct._IO_FILE** @stdout ; <%struct._IO_FILE*> [#uses=3]
+ %s1 = getelementptr [1 x i8]* @empty, i32 0, i32 0 ; <i8*> [#uses=1]
+ %s2 = getelementptr [2 x i8]* @len1, i32 0, i32 0 ; <i8*> [#uses=1]
+ %s3 = getelementptr [7 x i8]* @long, i32 0, i32 0 ; <i8*> [#uses=1]
+ %a = call i32 @fputs( i8* %s1, %struct._IO_FILE* %out ) ; <i32> [#uses=0]
+ %b = call i32 @fputs( i8* %s2, %struct._IO_FILE* %out ) ; <i32> [#uses=0]
+ %c = call i32 @fputs( i8* %s3, %struct._IO_FILE* %out ) ; <i32> [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/SPrintF.ll b/test/Transforms/SimplifyLibCalls/SPrintF.ll
new file mode 100644
index 000000000000..53f5ef1f429e
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/SPrintF.ll
@@ -0,0 +1,36 @@
+; Test that the SPrintFOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*sprintf}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+@null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1]
+@fmt1 = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1]
+@fmt2 = constant [3 x i8] c"%c\00" ; <[3 x i8]*> [#uses=1]
+
+declare i32 @sprintf(i8*, i8*, ...)
+
+declare i32 @puts(i8*)
+
+define i32 @foo(i8* %p) {
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=7]
+ %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=2]
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %nh_p = getelementptr [7 x i8]* @null_hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %fmt1_p = getelementptr [3 x i8]* @fmt1, i32 0, i32 0 ; <i8*> [#uses=2]
+ %fmt2_p = getelementptr [3 x i8]* @fmt2, i32 0, i32 0 ; <i8*> [#uses=1]
+ store i8 0, i8* %target_p
+ %r1 = call i32 (i8*, i8*, ...)* @sprintf( i8* %target_p, i8* %hello_p ) ; <i32> [#uses=1]
+ %r2 = call i32 (i8*, i8*, ...)* @sprintf( i8* %target_p, i8* %null_p ) ; <i32> [#uses=1]
+ %r3 = call i32 (i8*, i8*, ...)* @sprintf( i8* %target_p, i8* %nh_p ) ; <i32> [#uses=1]
+ %r4 = call i32 (i8*, i8*, ...)* @sprintf( i8* %target_p, i8* %fmt1_p, i8* %hello_p ) ; <i32> [#uses=1]
+ %r4.1 = call i32 (i8*, i8*, ...)* @sprintf( i8* %target_p, i8* %fmt1_p, i8* %p ) ; <i32> [#uses=1]
+ %r5 = call i32 (i8*, i8*, ...)* @sprintf( i8* %target_p, i8* %fmt2_p, i32 82 ) ; <i32> [#uses=1]
+ %r6 = add i32 %r1, %r2 ; <i32> [#uses=1]
+ %r7 = add i32 %r3, %r6 ; <i32> [#uses=1]
+ %r8 = add i32 %r5, %r7 ; <i32> [#uses=1]
+ %r9 = add i32 %r8, %r4 ; <i32> [#uses=1]
+ %r10 = add i32 %r9, %r4.1 ; <i32> [#uses=1]
+ ret i32 %r10
+}
diff --git a/test/Transforms/SimplifyLibCalls/StrCat.ll b/test/Transforms/SimplifyLibCalls/StrCat.ll
new file mode 100644
index 000000000000..89ef4ea49a79
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrCat.ll
@@ -0,0 +1,29 @@
+; Test that the StrCatOptimizer works correctly
+; PR3661
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strcat}
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: grep {puts.*%arg1}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+@null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1]
+
+declare i8* @strcat(i8*, i8*)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=2]
+ store i8 0, i8* %arg1
+ %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt1 = call i8* @strcat( i8* %arg1, i8* %arg2 ) ; <i8*> [#uses=1]
+ %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt2 = call i8* @strcat( i8* %rslt1, i8* %arg3 ) ; <i8*> [#uses=1]
+ %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt3 = call i8* @strcat( i8* %rslt2, i8* %arg4 ) ; <i8*> [#uses=1]
+ call i32 @puts( i8* %rslt3 ) ; <i32>:1 [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/StrChr.ll b/test/Transforms/SimplifyLibCalls/StrChr.ll
new file mode 100644
index 000000000000..802639f72320
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrChr.ll
@@ -0,0 +1,22 @@
+; Test that the StrChrOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*@strchr}
+
+@hello = constant [14 x i8] c"hello world\5Cn\00" ; <[14 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+
+declare i8* @strchr(i8*, i32)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=2]
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %world = call i8* @strchr( i8* %hello_p, i32 119 ) ; <i8*> [#uses=1]
+ %ignore = call i8* @strchr( i8* %null_p, i32 119 ) ; <i8*> [#uses=0]
+ %len = call i32 @puts( i8* %world ) ; <i32> [#uses=1]
+ %index = add i32 %len, 112 ; <i32> [#uses=2]
+ %result = call i8* @strchr( i8* %hello_p, i32 %index ) ; <i8*> [#uses=0]
+ ret i32 %index
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/StrCmp.ll b/test/Transforms/SimplifyLibCalls/StrCmp.ll
new file mode 100644
index 000000000000..ae28e4a10008
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrCmp.ll
@@ -0,0 +1,28 @@
+; Test that the StrCmpOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strcmp}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@hell = constant [5 x i8] c"hell\00" ; <[5 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+
+declare i32 @strcmp(i8*, i8*)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=5]
+ %hell_p = getelementptr [5 x i8]* @hell, i32 0, i32 0 ; <i8*> [#uses=1]
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=4]
+ %temp1 = call i32 @strcmp( i8* %hello_p, i8* %hello_p ) ; <i32> [#uses=1]
+ %temp2 = call i32 @strcmp( i8* %null_p, i8* %null_p ) ; <i32> [#uses=1]
+ %temp3 = call i32 @strcmp( i8* %hello_p, i8* %null_p ) ; <i32> [#uses=1]
+ %temp4 = call i32 @strcmp( i8* %null_p, i8* %hello_p ) ; <i32> [#uses=1]
+ %temp5 = call i32 @strcmp( i8* %hell_p, i8* %hello_p ) ; <i32> [#uses=1]
+ %rslt1 = add i32 %temp1, %temp2 ; <i32> [#uses=1]
+ %rslt2 = add i32 %rslt1, %temp3 ; <i32> [#uses=1]
+ %rslt3 = add i32 %rslt2, %temp4 ; <i32> [#uses=1]
+ %rslt4 = add i32 %rslt3, %temp5 ; <i32> [#uses=1]
+ ret i32 %rslt4
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/StrCpy.ll b/test/Transforms/SimplifyLibCalls/StrCpy.ll
new file mode 100644
index 000000000000..f23582c46206
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrCpy.ll
@@ -0,0 +1,26 @@
+; Test that the StrCpyOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strcpy}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+@null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1]
+
+declare i8* @strcpy(i8*, i8*)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=2]
+ store i8 0, i8* %arg1
+ %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt1 = call i8* @strcpy( i8* %arg1, i8* %arg2 ) ; <i8*> [#uses=1]
+ %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt2 = call i8* @strcpy( i8* %rslt1, i8* %arg3 ) ; <i8*> [#uses=1]
+ %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt3 = call i8* @strcpy( i8* %rslt2, i8* %arg4 ) ; <i8*> [#uses=1]
+ call i32 @puts( i8* %rslt3 ) ; <i32>:1 [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/StrLen.ll b/test/Transforms/SimplifyLibCalls/StrLen.ll
new file mode 100644
index 000000000000..521a2242c9bf
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrLen.ll
@@ -0,0 +1,56 @@
+; Test that the StrCatOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strlen}
+
+target datalayout = "e-p:32:32"
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=3]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=3]
+@null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1]
+
+declare i32 @strlen(i8*)
+
+define i32 @test1() {
+ %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hello_l = call i32 @strlen( i8* %hello_p ) ; <i32> [#uses=1]
+ ret i32 %hello_l
+}
+
+define i32 @test2() {
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %null_l = call i32 @strlen( i8* %null_p ) ; <i32> [#uses=1]
+ ret i32 %null_l
+}
+
+define i32 @test3() {
+ %null_hello_p = getelementptr [7 x i8]* @null_hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %null_hello_l = call i32 @strlen( i8* %null_hello_p ) ; <i32> [#uses=1]
+ ret i32 %null_hello_l
+}
+
+define i1 @test4() {
+ %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hello_l = call i32 @strlen( i8* %hello_p ) ; <i32> [#uses=1]
+ %eq_hello = icmp eq i32 %hello_l, 0 ; <i1> [#uses=1]
+ ret i1 %eq_hello
+}
+
+define i1 @test5() {
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %null_l = call i32 @strlen( i8* %null_p ) ; <i32> [#uses=1]
+ %eq_null = icmp eq i32 %null_l, 0 ; <i1> [#uses=1]
+ ret i1 %eq_null
+}
+
+define i1 @test6() {
+ %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %hello_l = call i32 @strlen( i8* %hello_p ) ; <i32> [#uses=1]
+ %ne_hello = icmp ne i32 %hello_l, 0 ; <i1> [#uses=1]
+ ret i1 %ne_hello
+}
+
+define i1 @test7() {
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %null_l = call i32 @strlen( i8* %null_p ) ; <i32> [#uses=1]
+ %ne_null = icmp ne i32 %null_l, 0 ; <i1> [#uses=1]
+ ret i1 %ne_null
+}
diff --git a/test/Transforms/SimplifyLibCalls/StrNCat.ll b/test/Transforms/SimplifyLibCalls/StrNCat.ll
new file mode 100644
index 000000000000..0ce319c5e8f3
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrNCat.ll
@@ -0,0 +1,27 @@
+; Test that the StrNCatOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strncat}
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: grep {puts.*%arg1}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+@null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1]
+
+declare i8* @strncat(i8*, i8*, i32)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=2]
+ store i8 0, i8* %arg1
+ %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt1 = call i8* @strncat( i8* %arg1, i8* %arg2, i32 6 ) ; <i8*> [#uses=1]
+ %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt2 = call i8* @strncat( i8* %rslt1, i8* %arg3, i32 42 ) ; <i8*> [#uses=1]
+ %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt3 = call i8* @strncat( i8* %rslt2, i8* %arg4, i32 42 ) ; <i8*> [#uses=1]
+ call i32 @puts( i8* %rslt3 ) ; <i32>:1 [#uses=0]
+ ret i32 0
+}
diff --git a/test/Transforms/SimplifyLibCalls/StrNCmp.ll b/test/Transforms/SimplifyLibCalls/StrNCmp.ll
new file mode 100644
index 000000000000..f85394d30281
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrNCmp.ll
@@ -0,0 +1,28 @@
+; Test that the StrNCmpOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strncmp}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@hell = constant [5 x i8] c"hell\00" ; <[5 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+
+declare i32 @strncmp(i8*, i8*, i32)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %hello_p = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=5]
+ %hell_p = getelementptr [5 x i8]* @hell, i32 0, i32 0 ; <i8*> [#uses=1]
+ %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=4]
+ %temp1 = call i32 @strncmp( i8* %hello_p, i8* %hello_p, i32 5 ) ; <i32> [#uses=1]
+ %temp2 = call i32 @strncmp( i8* %null_p, i8* %null_p, i32 0 ) ; <i32> [#uses=1]
+ %temp3 = call i32 @strncmp( i8* %hello_p, i8* %null_p, i32 0 ) ; <i32> [#uses=1]
+ %temp4 = call i32 @strncmp( i8* %null_p, i8* %hello_p, i32 0 ) ; <i32> [#uses=1]
+ %temp5 = call i32 @strncmp( i8* %hell_p, i8* %hello_p, i32 4 ) ; <i32> [#uses=1]
+ %rslt1 = add i32 %temp1, %temp2 ; <i32> [#uses=1]
+ %rslt2 = add i32 %rslt1, %temp3 ; <i32> [#uses=1]
+ %rslt3 = add i32 %rslt2, %temp4 ; <i32> [#uses=1]
+ %rslt4 = add i32 %rslt3, %temp5 ; <i32> [#uses=1]
+ ret i32 %rslt4
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/StrNCpy.ll b/test/Transforms/SimplifyLibCalls/StrNCpy.ll
new file mode 100644
index 000000000000..011e9be94cbe
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/StrNCpy.ll
@@ -0,0 +1,25 @@
+; Test that the StrNCpyOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*strncpy}
+
+@hello = constant [6 x i8] c"hello\00" ; <[6 x i8]*> [#uses=1]
+@null = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1]
+@null_hello = constant [7 x i8] c"\00hello\00" ; <[7 x i8]*> [#uses=1]
+
+declare i8* @strncpy(i8*, i8*, i32)
+
+declare i32 @puts(i8*)
+
+define i32 @main() {
+ %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1]
+ %arg1 = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=2]
+ store i8 0, i8* %arg1
+ %arg2 = getelementptr [6 x i8]* @hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt1 = call i8* @strncpy( i8* %arg1, i8* %arg2, i32 6 ) ; <i8*> [#uses=1]
+ %arg3 = getelementptr [1 x i8]* @null, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt2 = call i8* @strncpy( i8* %rslt1, i8* %arg3, i32 42 ) ; <i8*> [#uses=1]
+ %arg4 = getelementptr [7 x i8]* @null_hello, i32 0, i32 0 ; <i8*> [#uses=1]
+ %rslt3 = call i8* @strncpy( i8* %rslt2, i8* %arg4, i32 42 ) ; <i8*> [#uses=1]
+ call i32 @puts( i8* %rslt3 ) ; <i32>:1 [#uses=0]
+ ret i32 0
+}
diff --git a/test/Transforms/SimplifyLibCalls/ToAscii.ll b/test/Transforms/SimplifyLibCalls/ToAscii.ll
new file mode 100644
index 000000000000..9200d2f67edf
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/ToAscii.ll
@@ -0,0 +1,21 @@
+; Test that the ToAsciiOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
+; RUN: not grep {call.*toascii}
+
+declare i32 @toascii(i32)
+
+define i32 @main() {
+ %val1 = call i32 @toascii( i32 1 ) ; <i32> [#uses=1]
+ %val2 = call i32 @toascii( i32 0 ) ; <i32> [#uses=1]
+ %val3 = call i32 @toascii( i32 127 ) ; <i32> [#uses=1]
+ %val4 = call i32 @toascii( i32 128 ) ; <i32> [#uses=1]
+ %val5 = call i32 @toascii( i32 255 ) ; <i32> [#uses=1]
+ %val6 = call i32 @toascii( i32 256 ) ; <i32> [#uses=1]
+ %rslt1 = add i32 %val1, %val2 ; <i32> [#uses=1]
+ %rslt2 = add i32 %val3, %val4 ; <i32> [#uses=1]
+ %rslt3 = add i32 %val5, %val6 ; <i32> [#uses=1]
+ %rslt4 = add i32 %rslt1, %rslt2 ; <i32> [#uses=1]
+ %rslt5 = add i32 %rslt4, %rslt3 ; <i32> [#uses=1]
+ ret i32 %rslt5
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/abs.ll b/test/Transforms/SimplifyLibCalls/abs.ll
new file mode 100644
index 000000000000..520189bb28f1
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/abs.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep {select i1 %ispos}
+; PR2337
+
+define i32 @test(i32 %x) {
+entry:
+ %call = call i32 @abs( i32 %x ) ; <i32> [#uses=1]
+ ret i32 %call
+}
+
+declare i32 @abs(i32)
+
diff --git a/test/Transforms/SimplifyLibCalls/dg.exp b/test/Transforms/SimplifyLibCalls/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/SimplifyLibCalls/exp2.ll b/test/Transforms/SimplifyLibCalls/exp2.ll
new file mode 100644
index 000000000000..dea3df4b51bc
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/exp2.ll
@@ -0,0 +1,38 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep {call.*ldexp} | count 4
+; rdar://5852514
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i386-apple-darwin8"
+
+define double @t1(i32 %x) nounwind {
+entry:
+ %tmp12 = sitofp i32 %x to double ; <double> [#uses=1]
+ %exp2 = tail call double @exp2( double %tmp12 ) ; <double> [#uses=1]
+ ret double %exp2
+}
+
+define float @t4(i8 zeroext %x) nounwind {
+entry:
+ %tmp12 = uitofp i8 %x to float ; <float> [#uses=1]
+ %tmp3 = tail call float @exp2f( float %tmp12 ) nounwind readonly ; <float> [#uses=1]
+ ret float %tmp3
+}
+
+declare float @exp2f(float) nounwind readonly
+
+define double @t3(i16 zeroext %x) nounwind {
+entry:
+ %tmp12 = uitofp i16 %x to double ; <double> [#uses=1]
+ %exp2 = tail call double @exp2( double %tmp12 ) ; <double> [#uses=1]
+ ret double %exp2
+}
+
+define double @t2(i16 signext %x) nounwind {
+entry:
+ %tmp12 = sitofp i16 %x to double ; <double> [#uses=1]
+ %exp2 = tail call double @exp2( double %tmp12 ) ; <double> [#uses=1]
+ ret double %exp2
+}
+
+declare double @exp2(double)
+
diff --git a/test/Transforms/SimplifyLibCalls/floor.ll b/test/Transforms/SimplifyLibCalls/floor.ll
new file mode 100644
index 000000000000..31eb3f65623f
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/floor.ll
@@ -0,0 +1,39 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis > %t
+; RUN: not grep {call.*floor(} %t
+; RUN: grep {call.*floorf(} %t
+; RUN: not grep {call.*ceil(} %t
+; RUN: grep {call.*ceilf(} %t
+; RUN: not grep {call.*nearbyint(} %t
+; RUN: grep {call.*nearbyintf(} %t
+; XFAIL: sparc
+
+declare double @floor(double)
+
+declare double @ceil(double)
+
+declare double @nearbyint(double)
+
+define float @test_floor(float %C) {
+ %D = fpext float %C to double ; <double> [#uses=1]
+ ; --> floorf
+ %E = call double @floor( double %D ) ; <double> [#uses=1]
+ %F = fptrunc double %E to float ; <float> [#uses=1]
+ ret float %F
+}
+
+define float @test_ceil(float %C) {
+ %D = fpext float %C to double ; <double> [#uses=1]
+ ; --> ceilf
+ %E = call double @ceil( double %D ) ; <double> [#uses=1]
+ %F = fptrunc double %E to float ; <float> [#uses=1]
+ ret float %F
+}
+
+define float @test_nearbyint(float %C) {
+ %D = fpext float %C to double ; <double> [#uses=1]
+ ; --> nearbyintf
+ %E = call double @nearbyint( double %D ) ; <double> [#uses=1]
+ %F = fptrunc double %E to float ; <float> [#uses=1]
+ ret float %F
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/half-powr.ll b/test/Transforms/SimplifyLibCalls/half-powr.ll
new file mode 100644
index 000000000000..f4e898c0b236
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/half-powr.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls-halfpowr | llvm-dis | %prcontext {mul float} 1 | grep {mul float} | count 8
+
+define float @__half_powrf4(float %f, float %g) nounwind readnone {
+entry:
+ %0 = fcmp olt float %f, 2.000000e+00 ; <i1> [#uses=1]
+ br i1 %0, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %1 = fdiv float %f, 3.000000e+00 ; <float> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %f_addr.0 = phi float [ %1, %bb ], [ %f, %entry ] ; <float> [#uses=1]
+ %2 = mul float %f_addr.0, %g ; <float> [#uses=1]
+ ret float %2
+}
+
+define void @foo(float* %p) nounwind {
+entry:
+ %0 = load float* %p, align 4 ; <float> [#uses=1]
+ %1 = getelementptr float* %p, i32 1 ; <float*> [#uses=1]
+ %2 = load float* %1, align 4 ; <float> [#uses=1]
+ %3 = getelementptr float* %p, i32 2 ; <float*> [#uses=1]
+ %4 = load float* %3, align 4 ; <float> [#uses=1]
+ %5 = getelementptr float* %p, i32 3 ; <float*> [#uses=1]
+ %6 = load float* %5, align 4 ; <float> [#uses=1]
+ %7 = getelementptr float* %p, i32 4 ; <float*> [#uses=1]
+ %8 = load float* %7, align 4 ; <float> [#uses=1]
+ %9 = getelementptr float* %p, i32 5 ; <float*> [#uses=1]
+ %10 = load float* %9, align 4 ; <float> [#uses=1]
+ %11 = tail call float @__half_powrf4(float %0, float %6) nounwind ; <float> [#uses=1]
+ %12 = tail call float @__half_powrf4(float %2, float %8) nounwind ; <float> [#uses=1]
+ %13 = tail call float @__half_powrf4(float %4, float %10) nounwind ; <float> [#uses=1]
+ %14 = getelementptr float* %p, i32 6 ; <float*> [#uses=1]
+ store float %11, float* %14, align 4
+ %15 = getelementptr float* %p, i32 7 ; <float*> [#uses=1]
+ store float %12, float* %15, align 4
+ %16 = getelementptr float* %p, i32 8 ; <float*> [#uses=1]
+ store float %13, float* %16, align 4
+ ret void
+}
diff --git a/test/Transforms/SimplifyLibCalls/memcmp.ll b/test/Transforms/SimplifyLibCalls/memcmp.ll
new file mode 100644
index 000000000000..7bdbc8d17e4f
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/memcmp.ll
@@ -0,0 +1,22 @@
+; Test that the memcmpOptimizer works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep {call.*memcmp}
+
+@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=0]
+@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=0]
+@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=0]
+
+declare i32 @memcmp(i8*, i8*, i32)
+
+define void @test(i8* %P, i8* %Q, i32 %N, i32* %IP, i1* %BP) {
+ %A = call i32 @memcmp( i8* %P, i8* %P, i32 %N ) ; <i32> [#uses=1]
+ volatile store i32 %A, i32* %IP
+ %B = call i32 @memcmp( i8* %P, i8* %Q, i32 0 ) ; <i32> [#uses=1]
+ volatile store i32 %B, i32* %IP
+ %C = call i32 @memcmp( i8* %P, i8* %Q, i32 1 ) ; <i32> [#uses=1]
+ volatile store i32 %C, i32* %IP
+ %D = call i32 @memcmp( i8* %P, i8* %Q, i32 2 ) ; <i32> [#uses=1]
+ %E = icmp eq i32 %D, 0 ; <i1> [#uses=1]
+ volatile store i1 %E, i1* %BP
+ ret void
+}
+
diff --git a/test/Transforms/SimplifyLibCalls/memmove.ll b/test/Transforms/SimplifyLibCalls/memmove.ll
new file mode 100644
index 000000000000..d960960c9c2e
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/memmove.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep {llvm.memmove}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+
+define i8* @test(i8* %a, i8* %b, i32 %x) {
+entry:
+ %call = call i8* @memmove(i8* %a, i8* %b, i32 %x )
+ ret i8* %call
+}
+
+declare i8* @memmove(i8*,i8*,i32)
+
diff --git a/test/Transforms/SimplifyLibCalls/memset.ll b/test/Transforms/SimplifyLibCalls/memset.ll
new file mode 100644
index 000000000000..0c109154a3e5
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/memset.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep {llvm.memset}
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
+target triple = "i686-pc-linux-gnu"
+
+define i8* @test(i8* %a, i32 %b, i32 %x) {
+entry:
+ %call = call i8* @memset(i8* %a, i32 %b, i32 %x )
+ ret i8* %call
+}
+
+declare i8* @memset(i8*,i32,i32)
+
diff --git a/test/Transforms/SimplifyLibCalls/pow2.ll b/test/Transforms/SimplifyLibCalls/pow2.ll
new file mode 100644
index 000000000000..a48abbaf1e74
--- /dev/null
+++ b/test/Transforms/SimplifyLibCalls/pow2.ll
@@ -0,0 +1,37 @@
+; Testcase for calls to the standard C "pow" function
+;
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep {call .pow}
+
+
+declare double @pow(double, double)
+declare float @powf(float, float)
+
+define double @test1(double %X) {
+ %Y = call double @pow( double %X, double 0.000000e+00 ) ; <double> [#uses=1]
+ ret double %Y
+}
+
+define double @test2(double %X) {
+ %Y = call double @pow( double %X, double -0.000000e+00 ) ; <double> [#uses=1]
+ ret double %Y
+}
+
+define double @test3(double %X) {
+ %Y = call double @pow( double 1.000000e+00, double %X ) ; <double> [#uses=1]
+ ret double %Y
+}
+
+define double @test4(double %X) {
+ %Y = call double @pow( double %X, double 2.0)
+ ret double %Y
+}
+
+define float @test4f(float %X) {
+ %Y = call float @powf( float %X, float 2.0)
+ ret float %Y
+}
+
+define float @test5f(float %X) {
+ %Y = call float @powf(float 2.0, float %X) ;; exp2
+ ret float %Y
+}
diff --git a/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll b/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll
new file mode 100644
index 000000000000..16cee15ee179
--- /dev/null
+++ b/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -strip | llvm-dis | grep foo | count 2
+; RUN: llvm-as < %s | opt -strip | llvm-dis | grep bar | count 2
+@llvm.used = appending global [2 x i8*] [ i8* bitcast (i32* @foo to i8*), i8* bitcast (i32 ()* @bar to i8*) ], section "llvm.metadata" ; <[2 x i8*]*> [#uses=0]
+@foo = internal constant i32 41 ; <i32*> [#uses=1]
+
+define internal i32 @bar() nounwind {
+entry:
+ ret i32 42
+}
+
+define i32 @main() nounwind {
+entry:
+ ret i32 0
+}
+
diff --git a/test/Transforms/StripSymbols/dg.exp b/test/Transforms/StripSymbols/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/StripSymbols/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/TailCallElim/accum_recursion.ll b/test/Transforms/TailCallElim/accum_recursion.ll
new file mode 100644
index 000000000000..e8c28ec80672
--- /dev/null
+++ b/test/Transforms/TailCallElim/accum_recursion.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | not grep call
+
+define i32 @factorial(i32 %x) {
+entry:
+ %tmp.1 = icmp sgt i32 %x, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %then, label %else
+then: ; preds = %entry
+ %tmp.6 = add i32 %x, -1 ; <i32> [#uses=1]
+ %tmp.4 = call i32 @factorial( i32 %tmp.6 ) ; <i32> [#uses=1]
+ %tmp.7 = mul i32 %tmp.4, %x ; <i32> [#uses=1]
+ ret i32 %tmp.7
+else: ; preds = %entry
+ ret i32 1
+}
+
diff --git a/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll b/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll
new file mode 100644
index 000000000000..4d63b595d7cc
--- /dev/null
+++ b/test/Transforms/TailCallElim/accum_recursion_constant_arg.ll
@@ -0,0 +1,20 @@
+; This is a more aggressive form of accumulator recursion insertion, which
+; requires noticing that X doesn't change as we perform the tailcall. Thanks
+; go out to the anonymous users of the demo script for "suggesting"
+; optimizations that should be done. :)
+
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | not grep call
+
+define i32 @mul(i32 %x, i32 %y) {
+entry:
+ %tmp.1 = icmp eq i32 %y, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %return, label %endif
+endif: ; preds = %entry
+ %tmp.8 = add i32 %y, -1 ; <i32> [#uses=1]
+ %tmp.5 = call i32 @mul( i32 %x, i32 %tmp.8 ) ; <i32> [#uses=1]
+ %tmp.9 = add i32 %tmp.5, %x ; <i32> [#uses=1]
+ ret i32 %tmp.9
+return: ; preds = %entry
+ ret i32 %x
+}
+
diff --git a/test/Transforms/TailCallElim/ackermann.ll b/test/Transforms/TailCallElim/ackermann.ll
new file mode 100644
index 000000000000..f65c66669e56
--- /dev/null
+++ b/test/Transforms/TailCallElim/ackermann.ll
@@ -0,0 +1,26 @@
+; This function contains two tail calls, which should be eliminated
+; RUN: llvm-as < %s | \
+; RUN: opt -tailcallelim -stats -disable-output |& grep {2 tailcallelim}
+
+define i32 @Ack(i32 %M.1, i32 %N.1) {
+entry:
+ %tmp.1 = icmp eq i32 %M.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %then.0, label %endif.0
+then.0: ; preds = %entry
+ %tmp.4 = add i32 %N.1, 1 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+endif.0: ; preds = %entry
+ %tmp.6 = icmp eq i32 %N.1, 0 ; <i1> [#uses=1]
+ br i1 %tmp.6, label %then.1, label %endif.1
+then.1: ; preds = %endif.0
+ %tmp.10 = add i32 %M.1, -1 ; <i32> [#uses=1]
+ %tmp.8 = call i32 @Ack( i32 %tmp.10, i32 1 ) ; <i32> [#uses=1]
+ ret i32 %tmp.8
+endif.1: ; preds = %endif.0
+ %tmp.13 = add i32 %M.1, -1 ; <i32> [#uses=1]
+ %tmp.17 = add i32 %N.1, -1 ; <i32> [#uses=1]
+ %tmp.14 = call i32 @Ack( i32 %M.1, i32 %tmp.17 ) ; <i32> [#uses=1]
+ %tmp.11 = call i32 @Ack( i32 %tmp.13, i32 %tmp.14 ) ; <i32> [#uses=1]
+ ret i32 %tmp.11
+}
+
diff --git a/test/Transforms/TailCallElim/dg.exp b/test/Transforms/TailCallElim/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/TailCallElim/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll b/test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll
new file mode 100644
index 000000000000..e20fe18d5ada
--- /dev/null
+++ b/test/Transforms/TailCallElim/dont-tce-tail-marked-call.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | \
+; RUN: grep {call i32 @foo}
+
+declare void @bar(i32*)
+
+define i32 @foo(i32 %N) {
+ %A = alloca i32, i32 %N ; <i32*> [#uses=2]
+ store i32 17, i32* %A
+ call void @bar( i32* %A )
+ %X = tail call i32 @foo( i32 %N ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/TailCallElim/inf-recursion.ll b/test/Transforms/TailCallElim/inf-recursion.ll
new file mode 100644
index 000000000000..fe00f4a764e9
--- /dev/null
+++ b/test/Transforms/TailCallElim/inf-recursion.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | grep call
+; Don't turn this into an infinite loop, this is probably the implementation
+; of fabs and we expect the codegen to lower fabs.
+
+define double @fabs(double %f) {
+entry:
+ %tmp2 = call double @fabs( double %f ) ; <double> [#uses=1]
+ ret double %tmp2
+}
+
diff --git a/test/Transforms/TailCallElim/intervening-inst.ll b/test/Transforms/TailCallElim/intervening-inst.ll
new file mode 100644
index 000000000000..ae4f50941f81
--- /dev/null
+++ b/test/Transforms/TailCallElim/intervening-inst.ll
@@ -0,0 +1,17 @@
+; This function contains intervening instructions which should be moved out of the way
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | not grep call
+
+define i32 @Test(i32 %X) {
+entry:
+ %tmp.1 = icmp eq i32 %X, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %then.0, label %endif.0
+then.0: ; preds = %entry
+ %tmp.4 = add i32 %X, 1 ; <i32> [#uses=1]
+ ret i32 %tmp.4
+endif.0: ; preds = %entry
+ %tmp.10 = add i32 %X, -1 ; <i32> [#uses=1]
+ %tmp.8 = call i32 @Test( i32 %tmp.10 ) ; <i32> [#uses=1]
+ %DUMMY = add i32 %X, 1 ; <i32> [#uses=0]
+ ret i32 %tmp.8
+}
+
diff --git a/test/Transforms/TailCallElim/move_alloca_for_tail_call.ll b/test/Transforms/TailCallElim/move_alloca_for_tail_call.ll
new file mode 100644
index 000000000000..bd2b93f7a8d6
--- /dev/null
+++ b/test/Transforms/TailCallElim/move_alloca_for_tail_call.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | \
+; RUN: %prcontext alloca 1 | grep {i32 @foo}
+
+declare void @bar(i32*)
+
+define i32 @foo() {
+ %A = alloca i32 ; <i32*> [#uses=2]
+ store i32 17, i32* %A
+ call void @bar( i32* %A )
+ %X = tail call i32 @foo( ) ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/TailCallElim/return_constant.ll b/test/Transforms/TailCallElim/return_constant.ll
new file mode 100644
index 000000000000..ab69a42b7851
--- /dev/null
+++ b/test/Transforms/TailCallElim/return_constant.ll
@@ -0,0 +1,17 @@
+; Though this case seems to be fairly unlikely to occur in the wild, someone
+; plunked it into the demo script, so maybe they care about it.
+;
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | not grep call
+
+define i32 @aaa(i32 %c) {
+entry:
+ %tmp.1 = icmp eq i32 %c, 0 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %return, label %else
+else: ; preds = %entry
+ %tmp.5 = add i32 %c, -1 ; <i32> [#uses=1]
+ %tmp.3 = call i32 @aaa( i32 %tmp.5 ) ; <i32> [#uses=0]
+ ret i32 0
+return: ; preds = %entry
+ ret i32 0
+}
+
diff --git a/test/Transforms/TailCallElim/trivial_codegen_tailcall.ll b/test/Transforms/TailCallElim/trivial_codegen_tailcall.ll
new file mode 100644
index 000000000000..90a8163ee321
--- /dev/null
+++ b/test/Transforms/TailCallElim/trivial_codegen_tailcall.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | \
+; RUN: grep {tail call void @foo}
+
+
+declare void @foo()
+
+define void @bar() {
+ call void @foo( )
+ ret void
+}
+
diff --git a/test/Transforms/TailDup/2003-06-24-Simpleloop.ll b/test/Transforms/TailDup/2003-06-24-Simpleloop.ll
new file mode 100644
index 000000000000..5c3b5394ef46
--- /dev/null
+++ b/test/Transforms/TailDup/2003-06-24-Simpleloop.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define void @motion_result7() {
+entry:
+ br label %endif
+endif: ; preds = %no_exit, %entry
+ %i.1 = phi i32 [ %inc, %no_exit ], [ 0, %entry ] ; <i32> [#uses=1]
+ %inc = add i32 %i.1, 1 ; <i32> [#uses=1]
+ br i1 false, label %no_exit, label %UnifiedExitNode
+no_exit: ; preds = %endif
+ br i1 false, label %UnifiedExitNode, label %endif
+UnifiedExitNode: ; preds = %no_exit, %endif
+ ret void
+}
+
diff --git a/test/Transforms/TailDup/2003-07-22-InfiniteLoop.ll b/test/Transforms/TailDup/2003-07-22-InfiniteLoop.ll
new file mode 100644
index 000000000000..705f8bcdd652
--- /dev/null
+++ b/test/Transforms/TailDup/2003-07-22-InfiniteLoop.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define i32 @sum() {
+entry:
+ br label %loopentry
+loopentry: ; preds = %loopentry, %entry
+ %i.0 = phi i32 [ 1, %entry ], [ %tmp.3, %loopentry ] ; <i32> [#uses=1]
+ %tmp.3 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %loopentry
+}
+
diff --git a/test/Transforms/TailDup/2003-08-23-InvalidatedPointers.ll b/test/Transforms/TailDup/2003-08-23-InvalidatedPointers.ll
new file mode 100644
index 000000000000..1fae77b0892e
--- /dev/null
+++ b/test/Transforms/TailDup/2003-08-23-InvalidatedPointers.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define i32 @sell_haggle() {
+entry:
+ br i1 false, label %then.5, label %UnifiedExitNode
+then.5: ; preds = %entry
+ br i1 false, label %loopentry.1.preheader, label %else.1
+else.1: ; preds = %then.5
+ br label %loopentry.1.preheader
+loopentry.1.preheader: ; preds = %else.1, %then.5
+ %final_ask.0 = phi i32 [ 0, %else.1 ], [ 0, %then.5 ] ; <i32> [#uses=2]
+ br label %loopentry.1
+loopentry.1: ; preds = %endif.17, %loopentry.1.preheader
+ switch i32 0, label %UnifiedExitNode [
+ i32 2, label %UnifiedExitNode
+ i32 1, label %endif.16
+ ]
+endif.16: ; preds = %loopentry.1
+ br i1 false, label %then.17, label %UnifiedExitNode
+then.17: ; preds = %endif.16
+ br i1 false, label %then.18, label %endif.17
+then.18: ; preds = %then.17
+ br i1 false, label %endif.17, label %UnifiedExitNode
+endif.17: ; preds = %then.18, %then.17
+ %cur_ask.3 = phi i32 [ %final_ask.0, %then.17 ], [ %final_ask.0, %then.18 ] ; <i32> [#uses=0]
+ br i1 false, label %loopentry.1, label %UnifiedExitNode
+UnifiedExitNode: ; preds = %endif.17, %then.18, %endif.16, %loopentry.1, %loopentry.1, %entry
+ ret i32 0
+}
diff --git a/test/Transforms/TailDup/2003-08-31-UnreachableBlocks.ll b/test/Transforms/TailDup/2003-08-31-UnreachableBlocks.ll
new file mode 100644
index 000000000000..e46471331d20
--- /dev/null
+++ b/test/Transforms/TailDup/2003-08-31-UnreachableBlocks.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define i32 @foo() {
+entry:
+ br label %return.i
+after_ret.i: ; No predecessors!
+ br label %return.i
+return.i: ; preds = %after_ret.i, %entry
+ %tmp.3 = ptrtoint i32* null to i32 ; <i32> [#uses=1]
+ br label %return.i1
+after_ret.i1: ; No predecessors!
+ br label %return.i1
+return.i1: ; preds = %after_ret.i1, %return.i
+ %tmp.8 = sub i32 %tmp.3, 0 ; <i32> [#uses=0]
+ ret i32 0
+}
+
diff --git a/test/Transforms/TailDup/2004-04-01-DemoteRegToStack.ll b/test/Transforms/TailDup/2004-04-01-DemoteRegToStack.ll
new file mode 100644
index 000000000000..81624ff65f79
--- /dev/null
+++ b/test/Transforms/TailDup/2004-04-01-DemoteRegToStack.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define void @interpret() {
+entry:
+ br label %retry
+retry: ; preds = %endif.4, %entry
+ %tmp.8 = call i32 @interp( ) ; <i32> [#uses=3]
+ switch i32 0, label %endif.4 [
+ i32 -25, label %return
+ i32 -16, label %return
+ ]
+endif.4: ; preds = %retry
+ br i1 false, label %return, label %retry
+return: ; preds = %endif.4, %retry, %retry
+ %result.0 = phi i32 [ %tmp.8, %retry ], [ %tmp.8, %retry ], [ %tmp.8, %endif.4 ] ; <i32> [#uses=0]
+ ret void
+}
+
+declare i32 @interp()
+
diff --git a/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll b/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll
new file mode 100644
index 000000000000..a67e8cdd0c4e
--- /dev/null
+++ b/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as < %s | opt -tailduplicate | llc
+; PR2323
+
+define i32 @func_27(i32 %p_28) nounwind {
+entry:
+ %tmp125 = trunc i32 %p_28 to i8 ; <i8> [#uses=1]
+ %tmp5.i = icmp eq i8 %tmp125, 0 ; <i1> [#uses=1]
+ br i1 %tmp5.i, label %bb8.i, label %bb.i
+
+bb.i: ; preds = %entry
+ br label %bb39.i
+
+bb8.i: ; preds = %entry
+ br label %bb11.i
+
+bb11.i: ; preds = %bb39.i, %bb8.i
+ %tmp126 = trunc i32 %p_28 to i8 ; <i8> [#uses=1]
+ br label %bb39.i
+
+bb39.i: ; preds = %bb11.i, %bb.i
+ %tmp127 = trunc i32 %p_28 to i8 ; <i8> [#uses=1]
+ br label %bb11.i
+
+func_29.exit: ; No predecessors!
+ ret i32 undef
+}
diff --git a/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll b/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
new file mode 100644
index 000000000000..c29e7d45c6ae
--- /dev/null
+++ b/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -tailduplicate -taildup-threshold=3 -stats -disable-output | not grep tailduplicate
+; XFAIL: *
+
+define i32 @foo(i32 %l) nounwind {
+entry:
+ %cond = icmp eq i32 %l, 1 ; <i1> [#uses=1]
+ br i1 %cond, label %bb, label %bb9
+
+bb: ; preds = %entry
+ br label %bb9
+
+bb5: ; preds = %bb9
+ %tmp7 = call i32 (...)* @bar( i32 %x.0 ) nounwind ; <i32> [#uses=1]
+ br label %bb9
+
+bb9: ; preds = %bb5, %bb, %entry
+ %x.0 = phi i32 [ 0, %entry ], [ %tmp7, %bb5 ], [ 1525, %bb ] ; <i32> [#uses=2]
+ %l_addr.0 = phi i32 [ %l, %entry ], [ %tmp11, %bb5 ], [ %l, %bb ] ; <i32> [#uses=1]
+ %tmp11 = add i32 %l_addr.0, -1 ; <i32> [#uses=2]
+ %tmp13 = icmp eq i32 %tmp11, -1 ; <i1> [#uses=1]
+ br i1 %tmp13, label %bb15, label %bb5
+
+bb15: ; preds = %bb9
+ ret i32 %x.0
+}
+
+declare i32 @bar(...)
diff --git a/test/Transforms/TailDup/MergeTest.ll b/test/Transforms/TailDup/MergeTest.ll
new file mode 100644
index 000000000000..0a3ab6d96216
--- /dev/null
+++ b/test/Transforms/TailDup/MergeTest.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | opt -tailduplicate -taildup-threshold=2 | llvm-dis | grep add | not grep uses=1
+
+define i32 @test1(i1 %C, i32 %A, i32* %P) {
+entry:
+ br i1 %C, label %L1, label %L2
+L1: ; preds = %entry
+ store i32 1, i32* %P
+ br label %L2
+L2: ; preds = %L1, %entry
+ %X = add i32 %A, 17 ; <i32> [#uses=1]
+ ret i32 %X
+}
+
+define i32 @test2(i1 %C, i32 %A, i32* %P) {
+entry:
+ br i1 %C, label %L1, label %L2
+L1: ; preds = %entry
+ store i32 1, i32* %P
+ br label %L3
+L2: ; preds = %entry
+ store i32 7, i32* %P
+ br label %L3
+L3: ; preds = %L2, %L1
+ %X = add i32 %A, 17 ; <i32> [#uses=1]
+ ret i32 %X
+}
+
diff --git a/test/Transforms/TailDup/PHIUpdateTest.ll b/test/Transforms/TailDup/PHIUpdateTest.ll
new file mode 100644
index 000000000000..6f86587b24d6
--- /dev/null
+++ b/test/Transforms/TailDup/PHIUpdateTest.ll
@@ -0,0 +1,16 @@
+; This test checks to make sure phi nodes are updated properly
+;
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define i32 @test(i1 %c, i32 %X, i32 %Y) {
+ br label %L
+L: ; preds = %F, %0
+ %A = add i32 %X, %Y ; <i32> [#uses=1]
+ br i1 %c, label %T, label %F
+F: ; preds = %L
+ br i1 %c, label %L, label %T
+T: ; preds = %F, %L
+ %V = phi i32 [ %A, %L ], [ 0, %F ] ; <i32> [#uses=1]
+ ret i32 %V
+}
+
diff --git a/test/Transforms/TailDup/basictest.ll b/test/Transforms/TailDup/basictest.ll
new file mode 100644
index 000000000000..ef368906378d
--- /dev/null
+++ b/test/Transforms/TailDup/basictest.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+declare void @__main()
+
+define i32 @main() {
+entry:
+ call void @__main( )
+ br label %loopentry
+loopentry: ; preds = %no_exit, %entry
+ %i.0 = phi i32 [ %inc, %no_exit ], [ 0, %entry ] ; <i32> [#uses=3]
+ %tmp.1 = icmp sle i32 %i.0, 99 ; <i1> [#uses=1]
+ br i1 %tmp.1, label %no_exit, label %return
+no_exit: ; preds = %loopentry
+ %tmp.51 = call i32 @main( ) ; <i32> [#uses=0]
+ %inc = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %loopentry
+return: ; preds = %loopentry
+ ret i32 %i.0
+}
+
diff --git a/test/Transforms/TailDup/basictest2.ll b/test/Transforms/TailDup/basictest2.ll
new file mode 100644
index 000000000000..f79d718cdb56
--- /dev/null
+++ b/test/Transforms/TailDup/basictest2.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+
+define void @ab() {
+entry:
+ br label %loopentry.5
+loopentry.5: ; preds = %no_exit.5, %entry
+ %poscnt.1 = phi i64 [ 0, %entry ], [ %tmp.289, %no_exit.5 ] ; <i64> [#uses=1]
+ %tmp.289 = ashr i64 %poscnt.1, 1 ; <i64> [#uses=1]
+ br i1 false, label %no_exit.5, label %loopexit.5
+no_exit.5: ; preds = %loopentry.5
+ br label %loopentry.5
+loopexit.5: ; preds = %loopentry.5
+ ret void
+}
+
diff --git a/test/Transforms/TailDup/dg.exp b/test/Transforms/TailDup/dg.exp
new file mode 100644
index 000000000000..f2005891a59a
--- /dev/null
+++ b/test/Transforms/TailDup/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/TailDup/if-tail-dup.ll b/test/Transforms/TailDup/if-tail-dup.ll
new file mode 100644
index 000000000000..7c4d9c25ef3e
--- /dev/null
+++ b/test/Transforms/TailDup/if-tail-dup.ll
@@ -0,0 +1,49 @@
+; RUN: llvm-as < %s | opt -tailduplicate | \
+; RUN: llc -march=x86 -o %t -f
+; RUN: grep {\\\<je\\\>} %t
+; RUN: not grep jmp %t
+; END.
+; This should have no unconditional jumps in it. The C source is:
+
+;void foo(int c, int* P) {
+; if (c & 1) P[0] = 1;
+; if (c & 2) P[1] = 1;
+; if (c & 4) P[2] = 1;
+; if (c & 8) P[3] = 1;
+;}
+
+define void @foo(i32 %c, i32* %P) {
+entry:
+ %tmp1 = and i32 %c, 1 ; <i32> [#uses=1]
+ %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
+ br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
+cond_true: ; preds = %entry
+ store i32 1, i32* %P
+ br label %cond_next
+cond_next: ; preds = %cond_true, %entry
+ %tmp5 = and i32 %c, 2 ; <i32> [#uses=1]
+ %tmp5.upgrd.2 = icmp eq i32 %tmp5, 0 ; <i1> [#uses=1]
+ br i1 %tmp5.upgrd.2, label %cond_next10, label %cond_true6
+cond_true6: ; preds = %cond_next
+ %tmp8 = getelementptr i32* %P, i32 1 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp8
+ br label %cond_next10
+cond_next10: ; preds = %cond_true6, %cond_next
+ %tmp13 = and i32 %c, 4 ; <i32> [#uses=1]
+ %tmp13.upgrd.3 = icmp eq i32 %tmp13, 0 ; <i1> [#uses=1]
+ br i1 %tmp13.upgrd.3, label %cond_next18, label %cond_true14
+cond_true14: ; preds = %cond_next10
+ %tmp16 = getelementptr i32* %P, i32 2 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp16
+ br label %cond_next18
+cond_next18: ; preds = %cond_true14, %cond_next10
+ %tmp21 = and i32 %c, 8 ; <i32> [#uses=1]
+ %tmp21.upgrd.4 = icmp eq i32 %tmp21, 0 ; <i1> [#uses=1]
+ br i1 %tmp21.upgrd.4, label %return, label %cond_true22
+cond_true22: ; preds = %cond_next18
+ %tmp24 = getelementptr i32* %P, i32 3 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp24
+ ret void
+return: ; preds = %cond_next18
+ ret void
+}