[PATCH] Enhance boolean simplification to handle more cases

Arnold Schwaighofer aschwaighofer at apple.com
Wed Apr 10 16:59:50 PDT 2013


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?


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-X86-dag-combine-Handle-more-cases-in-setcc-simplific.patch
Type: application/octet-stream
Size: 3265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130410/33b1b055/attachment.obj>


More information about the llvm-commits mailing list