I'd like to know if there is an optimization in llvm doing something
like an if-conversion on the IR. I only found IfConversion.cpp which
appears to only provide the desired functionality on machine code during
code-generation.
I want to transform branches into serial code with select-instructions
as a pre-processing step for further transformations.
If there is no such pass, I will possibly write one and share it
(although I have no idea how to do so yet), so please let me know :).
Cheers,
Ralf
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
SimplifyCFG should be doing this transform in very simple cases.
Depending on what you're doing, though, its might not be aggressive
enough.
-Eli
> Hello everyone,
>
> I'd like to know if there is an optimization in llvm doing something
> like an if-conversion on the IR. I only found IfConversion.cpp which
> appears to only provide the desired functionality on machine code
> during
> code-generation.
>
> I want to transform branches into serial code with select-instructions
> as a pre-processing step for further transformations.
>
> If there is no such pass, I will possibly write one and share it
> (although I have no idea how to do so yet), so please let me know :).
There is not any pass that can transform branches into serial code
with select-instructions. Simplify CFG can handle simple cases of
selecting one value based on a condition, but its goal is to simplify
cfg. This may not be enough for your needs.
If you write a separate pass, we'd like to integrate it in mainline
llvm sources.
-
Devang
Thank you for your answers. I will do my best to develop something which
could be useful for more people :).
Cheers,
Ralf
My recommendation is to write two passes: one that computes control
dependence and another that performs if-conversion. A
control-dependence analysis pass is useful for other analysis and
transform passes.
-- John T.
Sorry to dig up an old thread but I wondered what the status of
if-conversion in LLVM is. Has any work been done towards handling this as a
transform pass on the IR?