pro64-support
[Top] [All Lists]

redundant part in lowering-to-cg

To: "''pro64-support@xxxxxxxxxxx' '" <pro64-support@xxxxxxxxxxx>
Subject: redundant part in lowering-to-cg
From: "Tuo, Tony" <tony.tuo@xxxxxxxxx>
Date: Tue, 31 Jul 2001 14:42:04 +0800
Cc: "Tuo, Tony" <tony.tuo@xxxxxxxxx>
Sender: owner-pro64-support@xxxxxxxxxxx
There is redundant code introduced in lowering-to-cg phase in some cases. The 
redundant part is marked in the end with string ">>>>>>". But this seems to be 
eliminated in the later phases.

The C code segment is as below:
 
main(void)
{
int from_type, to_type;
int sum=2222;
int c;
       if ((from_type)||(to_type==3333) )
          sum = 5555;
       else
           sum = 6666;
   printf("%d %d", sum, c);
}

Please note that there are uninitialized variables in this code segment.

Here is the IR dumped out using ir_b2a(Compile options: sgicc -keep -show -c -S 
-O3 -Wb,-trLOW -c -PHASE:c=off): 
LOC 0 0 source files:  1       "/home/ltuo/ifconv/ee-test3.c"
 LOC 1 2 main(void)
 LOC 1 3 {
FUNC_ENTRY <1,20,main>
BODY
 BLOCK
 PRAGMA 0 73 <null-st> 0 (0x0) # WOPT_FINISHED_OPTIMIZATION
 END_BLOCK
 BLOCK
 END_BLOCK
 BLOCK
 PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
 LOC 1 7        if ((from_type)||(to_type==3333) )
 LOC 1 8           sum = 5555;
 LOC 1 9        else
 LOC 1 10            sum = 6666;
 LOC 1 11    printf("%d %d", sum, c);
   U8LDA 0 <1,22,(6_bytes)_"%d_%d\000"> T<31,anon_ptr.,8>
  U8PARM 2 T<28,anon_ptr.,8> #  by_value
       U8U4LDID 0 <2,3,to_type> T<4,.predef_I4,4>
       I8INTCONST 3333 (0xd05)
      BI4EQ
     I8BCVT
       U8U4LDID 0 <2,2,from_type> T<4,.predef_I4,4>
       I8INTCONST 0 (0x0)
      BI4NE
     I8BCVT
    I8BIOR
    I8INTCONST 5555 (0x15b3)
    I8INTCONST 6666 (0x1a0a)
   I8SELECT
  I4PARM 2 T<4,.predef_I4,4> #  by_value
   U8U4LDID 0 <2,4,c> T<4,.predef_I4,4>
  I4PARM 2 T<4,.predef_I4,4> #  by_value
 VCALL 126 <1,21,printf> # flags 0x7e
 RETURN
 END_BLOCK 

Here is the IR input to CGexp phase in the .t file :(compile options:sgicc 
-keep -show -c -S -O3 -Wb,-ttexp:0xffffffff):
=======================================================================
WHIRL tree input to Convert_WHIRL_To_OPs:
=======================================================================
 LOC 0 0 source files:  1       "/home/ltuo/ifconv/ee-test3.c"
 LOC 1 2 main(void)
 LOC 1 3 {
FUNC_ENTRY <1,20,main>
BODY
 BLOCK
 PRAGMA 0 73 <null-st> 0 (0x0) # WOPT_FINISHED_OPTIMIZATION
 END_BLOCK
 BLOCK
 END_BLOCK
 BLOCK
 PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
 LOC 1 7        if ((from_type)||(to_type==3333) )
 LOC 1 8           sum = 5555;
 LOC 1 9        else
 LOC 1 10            sum = 6666;
 LOC 1 11    printf("%d %d", sum, c);
  U8LDA 0 <1,22,(6_bytes)_"%d_%d\000"> T<31,anon_ptr.,8>
 I8STID 127 <1,3,.preg_I8> T<5,.predef_I8,8> # $r127
     U8U4LDID 0 <2,3,to_type> T<4,.predef_I4,4>
     I8INTCONST 3333 (0xd05)
    I8I4EQ
     U8U4LDID 0 <2,2,from_type> T<4,.predef_I4,4>
     I8INTCONST 0 (0x0)
    I8I4NE
   I8BIOR
   I8INTCONST 5555 (0x15b3)
   I8INTCONST 6666 (0x1a0a)
  I8SELECT
 I8STID 126 <1,3,.preg_I8> T<5,.predef_I8,8> # $r126
  U8U4LDID 0 <2,4,c> T<4,.predef_I4,4>
 I8STID 125 <1,3,.preg_I8> T<5,.predef_I8,8> # $r125 
   U8LDA 0 <1,22,(6_bytes)_"%d_%d\000"> T<31,anon_ptr.,8>
  U8PARM 2 T<28,anon_ptr.,8> #  by_value
>>>>>>      U8U4LDID 0 <2,3,to_type> T<4,.predef_I4,4>
>>>>>>      I8INTCONST 3333 (0xd05)
>>>>>>     I8I4EQ
>>>>>>      U8U4LDID 0 <2,2,from_type> T<4,.predef_I4,4>
>>>>>>      I8INTCONST 0 (0x0)
>>>>>>     I8I4NE
>>>>>>    I8BIOR
>>>>>>    I8INTCONST 5555 (0x15b3)
>>>>>>    I8INTCONST 6666 (0x1a0a)
>>>>>>   I8SELECT
  I4PARM 2 T<4,.predef_I4,4> #  by_value
   U8U4LDID 0 <2,4,c> T<4,.predef_I4,4>
  I4PARM 2 T<4,.predef_I4,4> #  by_value
 VCALL 126 <1,21,printf> # flags 0x7e
 RETURN
 END_BLOCK  


Tony


<Prev in Thread] Current Thread [Next in Thread>