This is the mail archive of the 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]

Re: gcc/1532: Redundant compare instructions on i386

Richard Henderson <> writes:

> On Tue, Jan 20, 2004 at 04:42:31PM -0500, Ian Lance Taylor wrote:
> > So I punted and wrote a quick pass in machine dependent reorg to
> > eliminate obvious duplicate comparison cases.  It works fine on this
> > test case--the resulting code is the same except that the redudant
> > comparison is eliminated.  But it kind of sucks because it doesn't do
> > any real dataflow analysis, so it will miss all but the most obvious
> > cases.
> This is actually not bad, I think, simply because almost everything
> clobbers the flags, and therefore data can't flow very far at all.
> About the only thing you could do better than what you did is to
> follow extended basic blocks.  I.e. follow jumps forward through
> jumps to blocks with only one incoming edge.

Hmmm, that's true, but also the machine dependent reorg pass is so
late in the process.  It would be nice to do this before reload, at
least, since it can potentially free up a register which won't be
needed for the second compare.  Admittedly you can't do any math,
since that would clobber the flags register, but you can at least move
stuff around.  I dunno.  Maybe it won't make any difference in


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