[LLVMdev] Boolean simplification in LLVM

Anirudh Sivaraman sk.anirudh at gmail.com
Thu Jun 18 09:53:20 PDT 2015


On Wed, Jun 17, 2015 at 1:00 PM, Jonathan Roelofs
<jonathan at codesourcery.com> wrote:
>
>
> On 6/17/15 10:41 AM, Hans Wennborg wrote:
>>
>> On Tue, Jun 16, 2015 at 6:57 PM, Anirudh Sivaraman <sk.anirudh at gmail.com>
>> wrote:
>>>
>>> I am trying to implement if-conversion as an LLVM pass. My reference
>>> is Chapter 7 of the book ""Optimizing Compilers for Modern
>>> Architectures", based on the suggestion here:
>>> https://groups.google.com/d/msg/llvm-dev/FlDGnqSGbR8/eH5hO9IBbXYJ Some
>>> steps in the if-conversion pass require simplification of Boolean
>>> Expressions. Is this doable within the LLVM API? llvm::ConstantExpr
>>> seems like the data structure to use, but I haven't found a way to
>>> simplify a value represented by a ConstantExpr.
>>
>>
>> Do you need simplification (e.g. "x + 0 = x") or constant folding? If
>> it's the former, see include/llvm/Analysis/InstructionSimplify.h. For
>> the latter, check out the functions in
>> include/llvm/Analysis/ConstantFolding.h.
>
>
> Kennedy/Allen's definition of Simplify() is on page 342.
>
> AFAIK, there isn't existing infrastructure that implements that procedure
> specifically.  I'd suggest implementing it in your pass.
>

Thanks for all these replies. I 'll probably implement Boolean
simplification myself in my own pass.

Anirudh

>
> Cheers,
>
> Jon
>
>>
>> Cheers,
>> Hans
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> --
> Jon Roelofs
> jonathan at codesourcery.com
> CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list