[LLVMdev] Efficient Pattern matching in Instruction Combine
suyog sarda
sardask01 at gmail.com
Mon Aug 18 07:31:16 PDT 2014
>
>
>>
> Daniel's suggestion could actually could be done pretty easily. (assume
> for now that we are most interested in boolean expressions over 3
> variables). There are two parts:
>
> 1. Add some code that evaluates a given 3-arg boolean expression at each
> of the 2^3 == 8 values, creating an 8-bit index.
>
> 2. Create a table of 2^8 == 256 entries (not *too* much work to do by
> hand) which has the "preferred" representation for each boolean function of
> 3 variables.
>
> Then, you just use the 8-bit index to look in the table for the
> "preferred" form of the expression. This approach could get a lot of "bang
> for your buck" without much code complexity or implementation difficulty.
>
> The same could be done for 2-variable expressions easily (might be a good
> starting point). For 4-variable expressions, it might be more difficult
> since the table would need 2^(2^4) == 16k entries.
>
>
Ok. Sounds good. I will try to come up with a patch. Thanks for the
suggestions.
--
With regards,
Suyog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140818/2faa1ba1/attachment.html>
More information about the llvm-dev
mailing list