ó
\K]c           @   st  d  d l  Z  d  d l  m Z m Z d  d l m Z m Z d  d l m Z d  d l  m Z d  d l	 m
 Z
 d  d l  m Z d  d l m Z d  d	 l m Z m Z m Z m Z m Z m Z m Z d  d
 l  m Z d  d l  m Z d  d l Z d d l m Z d d l m Z d „  Z d „  Z  e  j! d „  ƒ Z" d „  Z# d „  Z$ d e j% f d „  ƒ  YZ& e' d k rpe j( ƒ  n  d S(   iÿÿÿÿN(   t   compilert   typing(   t   compile_isolatedt   Flags(   t   cpu(   t   types(   t
   cpu_target(   t   config(   t   type_annotations(   t   copy_propagatet   apply_copy_propagatet   get_name_var_tablet   remove_delst   remove_deadt   remove_call_handlerst   alias_func_extensions(   t   ir(   t   unittest_supporti   (   t
   needs_blas(   t   skip_parfors_unsupportedc         C   s9   d } |  d k r | | } n d } d | } | |  k  S(   Ni   i    i   (    (   t   bt   zt   wt   xt   yt   a(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_will_propagate   s    
c         C   s   t  d  S(   N(   t   False(   R   R   t   ct   d(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt	   null_func!   s    c         C   s   |  S(   N(    (   t   A(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   dummy_aliased_func$   s    c         C   s$   t  j j |  | d j | | ƒ d  S(   Ni    (   t   numbat   ir_utilst
   _add_aliast   name(   t   lhs_namet   argst	   alias_mapt   arg_aliases(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   alias_ext_dummy_func(   s    c         C   sl   xe |  j  j ƒ  D]T \ } } xE t | j ƒ D]4 \ } } t | t j ƒ r, | j j | k r, t	 Sq, Wq Wt
 S(   N(   t   blockst   itemst	   enumeratet   bodyt
   isinstanceR   t   Assignt   targetR$   t   TrueR   (   t   func_irt   vart   labelt   blockt   it   inst(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   findLhsAssign+   s
    $t   TestRemoveDeadc           B   s   e  Z e Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z e e d	 „  ƒ ƒ Z d
 „  Z d „  Z d „  Z RS(   c         C   s^   t  ƒ  } | j d t j t ƒ ƒ | j d ƒ | j d t j t ƒ ƒ t | | d | ƒj S(   Nt   auto_parallelt   nrtt   fastmatht   flags(   R   t   setR   t   ParallelOptionsR1   t   FastMathOptionsR   t   entry_point(   t   selft   funct	   arg_typest   fast_pflags(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   compile_parallel7   s
    	c         C   sF  t  j ƒ  } t j | ƒ } t j t ƒ } t j | | ƒ | j	 ƒ  | j	 ƒ  t
 j t
 j t
 j f } t j | | | d  ƒ \ } } } t j d | d | d | d d
 d d  d | d | d t j ƒ } t | j ƒ t | j | ƒ \ }	 }
 t | j |	 t | j ƒ | | ƒ t | j | j | ƒ |  j t | d	 ƒ ƒ Wd  QXd  S(   NR2   t   typemapt	   calltypest   liftedt   lifted_fromR&   t   return_typet   html_outputR   (    (   R   t   ContextR   t
   CPUContextR    t   run_frontendR   R   t   nested_contextt   refreshR   t   int64t   type_inference_staget   NoneR   t   TypeAnnotationR   t   HTMLR   R*   R	   R
   R   R   t	   arg_namest   assertFalseR8   (   RB   t	   typingctxt	   targetctxt   test_irR&   RG   RK   RH   t   type_annotationt   in_cpst   out_cps(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test1>   s,    

!	"c         C   sN   d „  } d „  } t  j | ƒ } t | j | j | ƒ |  j | | ƒ ƒ d  S(   Nc           S   s   t  j j d ƒ d  S(   Ni   (   t   npt   randomt   seed(    (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   call_np_random_seed\   s    c         S   sz   xs |  j  d j D]a } t | t j ƒ r t | j t j ƒ r | j j d k r |  j | j j	 ƒ j
 d k r t Sq Wt S(   Ni    t   callRb   (   R*   R-   R.   R   R/   t   valuet   Exprt   opt   get_definitionRC   t   attrR1   R   (   R2   R7   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   seed_call_exists_   s    (   R    RO   R   R*   RW   t
   assertTrue(   RB   Rc   Rj   R[   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test2[   s
    			c         C   sˆ   t  j d ƒ j d d ƒ } | j ƒ  } d } |  j | t j | ƒ t j | ƒ f ƒ } | | | ƒ | | | ƒ t  j j | | ƒ d  S(   Ni   i   i   i    (	   R`   t   aranget   reshapet   copyRF   R!   t   typeoft   testingt   assert_array_equal(   RB   RC   t   A1t   A2R6   t   pfunc(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   run_array_index_testl   s    *c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s   |  j  ƒ  } d | | <d  S(   Ni   (   t   ravel(   R   R6   t   B(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   w   s    (   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_ravelv   s    	c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s   |  j  } d | | <d  S(   Ni   (   t   flat(   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   ~   s    	(   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_flat}   s    	c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s   |  j  } d | | d f <d  S(   Ni   i    (   t   T(   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   …   s    	(   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_transpose1„   s    	c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s    |  j  ƒ  } d | | d f <d  S(   Ni   i    (   t	   transpose(   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   Œ   s    (   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_transpose2‹   s    	c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s#   t  j |  ƒ } d | | d f <d  S(   Ni   i    (   R`   R~   (   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   “   s    (   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_transpose3’   s    	c            sØ   d d l  m } | ƒ  j t j ƒ ‰  ‡  f d †  } t } t j | ƒ ‡  f d †  } t j d ƒ } | j	 ƒ  } z? |  j
 | t j | ƒ f ƒ } t j | ƒ | ƒ | | ƒ Wd  | t (X|  j | d | d ƒ d  S(   Niÿÿÿÿ(   t   _BLASc            s'   | ˆ  g k r# |  j  d j | k St S(   Ni   (   R&   R$   R   (   t   rhst   livest	   call_list(   t   xxnrm2(    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   remove_dead_xxnrm2    s    c            s/   t  j d ƒ } ˆ  d d | j d |  j ƒ d  S(   Ni   id   i   (   R`   t   onest   ctypes(   t   retR   (   R…   (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   ª   s    i   i    (   t   numba.targets.linalgR   t   numba_xxnrm2R   t   float64R   t   appendR`   t   zerosRo   RF   R!   Rp   t   njitt   assertEqual(   RB   R   R†   t   old_remove_handlersRC   Rs   Rt   Ru   (    (   R…   s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_ctypes™   s    c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s&   t  j |  d ƒ } d | | d f <d  S(   Ni   i   i    (   i   i   (   R`   Rn   (   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   ¼   s    (   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_reshape1»   s    	c         C   s   d „  } |  j  | ƒ d  S(   Nc         S   s&   |  j  d d ƒ } d | | d f <d  S(   Ni   i   i    (   Rn   (   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   Ã   s    (   Rv   (   RB   RC   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_reshape2Â   s    	c         C   sD   d „  } t  j ƒ  } z t t  d <|  j | ƒ Wd  | t j _  Xd  S(   Nc         S   s    t  |  ƒ } d | | d f <d  S(   Ni   i    (   R    (   R   R6   Rx   (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyRC   Ê   s    R    s   numba.tests.test_remove_dead(   R    s   numba.tests.test_remove_dead(   R   Ro   R)   Rv   R!   R"   (   RB   RC   t   old_ext_handlers(    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   test_alias_func_extÉ   s    	
(   t   __name__t
   __module__R   t   _numba_parallel_test_RF   R_   Rl   Rv   Ry   R{   R}   R   R€   R   R   R’   R“   R”   R–   (    (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyR9   3   s   				
					!		t   __main__()   R!   R    R   t   numba.compilerR   R   t   numba.targetsR   R   t   numba.targets.registryR   R   t   numba.annotationsR   t   numba.ir_utilsR	   R
   R   R   R   R   R   R   R   t   unittestt   numpyR`   t   matmul_usecaseR   t   supportR   R   R   R   R    R)   R8   t   TestCaseR9   R—   t   main(    (    (    s;   lib/python2.7/site-packages/numba/tests/test_remove_dead.pyt   <module>   s*   4					¥