[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer reid at x10sys.com
Mon Mar 26 11:33:44 PDT 2007


On Mon, 2007-03-26 at 11:29 -0700, Chris Lattner wrote:
> > @@ -57,6 +57,9 @@
> >  #include "llvm/ADT/STLExtras.h"
> >  #include <algorithm>
> >  #include <set>
> > +#ifndef NDEBUG
> > +#include <sstream>
> > +#endif
> 
> Please don't conditionally #include files.

Why? You would get sstream #included in a release build when it isn't
used in a release build.  Seems pointless to me.

> 
> Thanks for the patch, making instcombine's debug output nicer would  
> be very helpful,

Yup .. helped verify that the test case I had yesterday was wrong (after
the fix).

Reid.

> 
> -chris
> 
> >  using namespace llvm;
> >  using namespace llvm::PatternMatch;
> >
> > @@ -3134,7 +3137,7 @@
> >        // Otherwise, if Mask is 0+1+0+, and if B is known to have  
> > the low 0+
> >        // part, we don't need any explicit masks to take them out  
> > of A.  If that
> >        // is all N is, ignore it.
> > -      unsigned MB, ME;
> > +      unsigned MB = 0, ME = 0;
> >        if (isRunOfOnes(Mask, MB, ME)) {  // begin/end bit of run,  
> > inclusive
> >          uint32_t BitWidth = cast<IntegerType>(RHS->getType())- 
> > >getBitWidth();
> >          APInt Mask(APInt::getAllOnesValue(BitWidth));
> > @@ -9445,6 +9448,10 @@
> >      }
> >
> >      // Now that we have an instruction, try combining it to  
> > simplify it...
> > +#ifndef NDEBUG
> > +    std::string OrigI;
> > +#endif
> > +    DEBUG(std::ostringstream SS; I->print(SS); OrigI = SS.str(););
> >      if (Instruction *Result = visit(*I)) {
> >        ++NumCombined;
> >        // Should we replace the old instruction with a new one?
> > @@ -9483,7 +9490,8 @@
> >          // Erase the old instruction.
> >          InstParent->getInstList().erase(I);
> >        } else {
> > -        DOUT << "IC: MOD = " << *I;
> > +        DOUT << "IC: Mod = " << OrigI
> > +             << "    New = " << *I;
> >
> >          // If the instruction was modified, it's possible that it  
> > is now dead.
> >          // if so, remove it.
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070326/50e30b92/attachment.sig>


More information about the llvm-commits mailing list