This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need help getting this simple code frag to optimize well. Aliasing problem?


With gcc 2.95 and 3.0, neither can optimize this simple
code very well.  Each emits code to effectively do the
if () check and increment twice.  Only thing I can think
of, is that I need to tell the compiler that the external
function call does not touch the local values on the stack.
I can't figure out how to do that.  Any input greatly
appreciated.

-Kevin


===== sample.cc ===============================
extern void doSomething(void);


  unsigned
someInstruction(unsigned modRM)
{
  unsigned a = 0;
  const unsigned cond = (modRM==1);

  if ( cond )
    a++;

  doSomething();

  if ( cond )
    a++;

  return a;
}

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]