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.

Thanks for any advice you may have,

Anirudh

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.

Cheers,

Hans

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.

Cheers,

Jon

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