public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* if-conv problem....
@ 2002-10-02 11:56 Deepak B. Nayak
  2002-10-02 14:39 ` Jim Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Deepak B. Nayak @ 2002-10-02 11:56 UTC (permalink / raw)
  To: gcc

hi
 if-conv pass is not working for gcc3.0....

following is the example
-------------------------------
      1 int main() 
      2 {
      3  int a,c; 
      4  if(c == a) 
      5  {
      6   c=c+2; 
      7  }
      8  else
      9  {
     10   c+=1; 
     11  }
     12 }           
-------------------------------------
output of .ce file is
------------------------------------------------------ 
      2 ;; Function main
      3
      4
      5 IF-THEN-ELSE block found, start 0, then 1, else 2, join 3
      6
      7 1 possible IF blocks searched. 
      8 0 IF blocks converted. 
      9 0 basic blocks deleted. 
     10                                       
--------------------------------------------------------

why if-conv is not working..??????

regards

deepak

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: if-conv problem....
  2002-10-02 11:56 if-conv problem Deepak B. Nayak
@ 2002-10-02 14:39 ` Jim Wilson
  2002-10-02 22:46   ` Deepak B. Nayak
  0 siblings, 1 reply; 7+ messages in thread
From: Jim Wilson @ 2002-10-02 14:39 UTC (permalink / raw)
  To: Deepak B. Nayak; +Cc: gcc

That isn't a complete bug report.  You didn't mention what target you
configured gcc for.  You didn't mention what compiler options you used.
You didn't mention which if-conv pass you are looking at.  There are two of
them.

Also, a testcase that is easy to compile is most useful.  The testcase you
included has to be edited before it can be compiled, because it includes
line numbers.  It is easy to fix, but it is an unnecessary annoyance.

I can't reproduce your problem with current gcc sources configured for an
ia64-linux target using -O0, -O1, or -O2.  I'd guess the problem is that
the testcase is bogus.  Both a and c are uninitialized, and c is dead at
the end of the function.  Try changing the function name to "sub", making
a and c function parameters, and adding a statement to return c at the end
of the function.

Jim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: if-conv problem....
  2002-10-02 14:39 ` Jim Wilson
@ 2002-10-02 22:46   ` Deepak B. Nayak
  2002-10-03  4:07     ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Deepak B. Nayak @ 2002-10-02 22:46 UTC (permalink / raw)
  To: Jim Wilson; +Cc: gcc


On 2 Oct 2002, Jim Wilson wrote:

> That isn't a complete bug report.  You didn't mention what target you
> configured gcc for.  You didn't mention what compiler options you used.
> You didn't mention which if-conv pass you are looking at.  There are two of
> them.
> 

sorry for this..this will not be repeated...
target is ia64-linux options we tried using are all -O,-O2,-O3


 
> Also, a testcase that is easy to compile is most useful.  The testcase you
> included has to be edited before it can be compiled, because it includes
> line numbers.  It is easy to fix, but it is an unnecessary annoyance.
>
 again sorry for this
 
> I can't reproduce your problem with current gcc sources configured for an
> ia64-linux target using -O0, -O1, or -O2.  I'd guess the problem is that
> the testcase is bogus.  Both a and c are uninitialized, and c is dead at
> the end of the function.  Try changing the function name to "sub", making
> a and c function parameters, and adding a statement to return c at the end
> of the function.
> 
> Jim
> 

 i did change the test case and the first if-conv pass did not if-convert
but second if-conv pass did the if-conversion

we wanted if-conv to be done before instr-combine pass so we need first
if-conv pass to work..but what is diff..???
why first pass did not work and second one did..???

testcase is as fallows...
-------------------------------------------------

       int sub(int a,int c) 
       {
        if(c == a) 
        {
         c=c+2; 
        }
        else
        {
         c+=1; 
        }
        return c; 
       }
     
     
      int main() 
      {
       int x,y; 
       sub(x,y); 
       printf("%d,%d\n",x,y); 
      }                         


regards

deepak

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: if-conv problem....
  2002-10-02 22:46   ` Deepak B. Nayak
@ 2002-10-03  4:07     ` Richard Henderson
  2002-10-03  5:07       ` Deepak B. Nayak
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2002-10-03  4:07 UTC (permalink / raw)
  To: Deepak B. Nayak; +Cc: Jim Wilson, gcc

On Thu, Oct 03, 2002 at 10:18:44AM +0530, Deepak B. Nayak wrote:
> we wanted if-conv to be done before instr-combine pass so we need first
> if-conv pass to work..but what is diff..???
> why first pass did not work and second one did..???

You need to spend some time actually reading the code.

Because the register allocator cannot handle predicated
instructions.  So we explicitly disable predication
until after reload.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: if-conv problem....
  2002-10-03  4:07     ` Richard Henderson
@ 2002-10-03  5:07       ` Deepak B. Nayak
  2002-10-03 12:26         ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Deepak B. Nayak @ 2002-10-03  5:07 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jim Wilson, gcc


> On Thu, Oct 03, 2002 at 10:18:44AM +0530, Deepak B. Nayak wrote:
> > we wanted if-conv to be done before instr-combine pass so we need first
> > if-conv pass to work..but what is diff..???
> > why first pass did not work and second one did..???
> 
> You need to spend some time actually reading the code.
> 
> Because the register allocator cannot handle predicated
> instructions.  So we explicitly disable predication
> until after reload.
> 
> 
> r~
> 

 then what is the use of having first if-conv pass...
 and even what is use of doing if-conv after reload ?????

to have if-conv before reg allocation do we need to change reg allocator
it self???

regards
deepak
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: if-conv problem....
  2002-10-03  5:07       ` Deepak B. Nayak
@ 2002-10-03 12:26         ` Richard Henderson
  2002-10-03 13:47           ` Jim Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2002-10-03 12:26 UTC (permalink / raw)
  To: Deepak B. Nayak; +Cc: gcc

On Thu, Oct 03, 2002 at 12:04:56PM +0530, Deepak B. Nayak wrote:
>  then what is the use of having first if-conv pass...
>  and even what is use of doing if-conv after reload ?????

There are lots of useful things to do with if-conversion
outside general predication: boolean sets (aka setcc),
conditional moves, absolute values, min, max ...

Like I said, you _really_ need to look at the code itself.
No one is going to hold your hand all the way through the
compiler.

> to have if-conv before reg allocation do we need to change reg allocator
> it self???

Yes.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: if-conv problem....
  2002-10-03 12:26         ` Richard Henderson
@ 2002-10-03 13:47           ` Jim Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Jim Wilson @ 2002-10-03 13:47 UTC (permalink / raw)
  To: Deepak B. Nayak; +Cc: gcc

> to have if-conv before reg allocation do we need to change reg allocator
> it self???

And there is no rotating register support in the reg allocator either.

Jim

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-10-03 19:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 11:56 if-conv problem Deepak B. Nayak
2002-10-02 14:39 ` Jim Wilson
2002-10-02 22:46   ` Deepak B. Nayak
2002-10-03  4:07     ` Richard Henderson
2002-10-03  5:07       ` Deepak B. Nayak
2002-10-03 12:26         ` Richard Henderson
2002-10-03 13:47           ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).