[PATCH] Enhance boolean simplification to handle more cases

Michael Liao michael.liao at intel.com
Wed Apr 10 17:03:37 PDT 2013


On Wed, 2013-04-10 at 18:59 -0500, Arnold Schwaighofer wrote:
> Incidentally, I have been working on a very similar patch today. You beat me to it. :P
> 
> I tried the test cases from your patch and my patch does not catch all of them (I am guessing because I am not flexible on which side the constant to the AND is). So let me review your patch.
> 
> +static SDValue checkBoolTestSetCCCombine(SelectionDAG &DAG,
> 
> I don't think the extra parameter is really needed. You only use it for debug output as far as I can tell.
> 
> +  DEBUG(dbgs() << "Unhandled node in boolean test checking: ");
> +  DEBUG(SetCC.getNode()->dump(&DAG));
> +  DEBUG(dbgs() << "\n");
> 
> This looks like debugging output from while you were developing, can you remove it?

I intentionally leave it there and want to capture some cases may need
handling in the future. I am not sure whether it's OK. If not, I will
leave them in my private branch.

Thanks
- Michael

> 
> 
> Otherwise, LGTM. 
> 
> But then, I am slightly biased as you can see from my solution below :)
> 
> On Apr 10, 2013, at 6:15 PM, Michael Liao <michael.liao at intel.com> wrote:
> 
> > Hi,
> > 
> > The attached patch (based on patch from Victor Umansky
> > <victor.umansky at intel.com>) enhances the boolean simplification in X86
> > backend. It allows more cases to be simplified as well, such as
> > SETCC_CARRY is used to produce the boolean result and the a boolean
> > value (i8) is truncated to i1 first (through AND $1). This helps
> > improving code quality for PTEST & other cases.
> > 
> > As a by-product, PR5443 is also fixed. Now, we could generate the same
> > neat sequence with or without use of overflow intrinsic.
> > 
> > Thanks for review.
> > - Michael
> > <0001-Enhance-boolean-simplfication-to-handle-more-cases.patch>_______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list