[PATCH] Restrict select_cc -> (sll (setcc ...)) transform
Richard Sandiford
rsandifo at linux.vnet.ibm.com
Wed Jul 3 01:39:07 PDT 2013
Ping
Richard Sandiford <rsandifo at linux.vnet.ibm.com> writes:
> The DAG combiner changes something like:
>
> (select_cc A, B, 16, 0, CC)
>
> into:
>
> (sll (setcc A, B, C), 4)
>
> This is conditional on the usual:
>
> !LegalOperations || TLI.isOperationLegal(ISD::SETCC, ...)
>
> style of construct that's used throughout the file.
>
> I don't think this really counts as a simplification on targets without
> SETCC though. It turns one node into two, effectively:
>
> (select_cc A, B, 16, 0, CC)
>
> to:
>
> (sll (select_cc A, B, 1, 0, CC), 4)
>
> And we never get rid of the shift.
>
> The sll form doesn't seem any easier to analyse when combining users
> of the node. (Well, things like SelectionDAG::ComputeNumSignBits
> might need a SELECT_CC case, but I'll look at that separately.)
> Would it be OK to remove the !LegalOperations condition?
>
> FWIW, a similar transform has been disabled:
>
> // Check to see if this is the equivalent of setcc
> // FIXME: Turn all of these into setcc if setcc if setcc is legal
> // otherwise, go ahead with the folds.
> if (0 && N3C && N3C->isNullValue() && N2C && (N2C->getAPIntValue() == 1ULL)) {
>
> so maybe this kind of thing has been seen before. The patch changes
> the condition within that block too for consistency, even though it
> isn't being used yet.
>
> I added a new test rather than extending an existing one because I have
> other select_cc-combine things lined up. They'll go in this test too.
>
> Richard
>
>
> _______________________________________________
> 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: limit-shift-setcc.patch
Type: text/x-patch
Size: 1918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130703/086fe30a/attachment.bin>
More information about the llvm-commits
mailing list