Robert Henry via llvm-dev
2019-Aug-01 23:54 UTC
[llvm-dev] how to generate select-free LLVM IR?
I run "clang ... --emit-llvm ....". I get LLVM IR select instructions out. I don't want select instructions, but want explicit control flow. Is there a way to do this? I'm scared of disabling the SimplifyCFG pass since it appears to do much more than just rewrite to use select statements. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190801/290e2db5/attachment.html>
Eli Friedman via llvm-dev
2019-Aug-02 19:16 UTC
[llvm-dev] how to generate select-free LLVM IR?
Probably you want to a pass to transform select instructions to control flow late, after optimizations have run. Trying to prevent clang IR generation and IR optimizations from forming selects is way too difficult. I don't think this transform exists as an independent pass, but you can borrow code from CodeGenPrepare::optimizeSelectInst. -Eli From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Robert Henry via llvm-dev Sent: Thursday, August 1, 2019 4:54 PM To: llvm-dev at lists.llvm.org Subject: [EXT] [llvm-dev] how to generate select-free LLVM IR? I run "clang ... --emit-llvm ....". I get LLVM IR select instructions out. I don't want select instructions, but want explicit control flow. Is there a way to do this? I'm scared of disabling the SimplifyCFG pass since it appears to do much more than just rewrite to use select statements. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190802/4a9dbe71/attachment.html>
Maxime Arthaud via llvm-dev
2019-Aug-04 17:55 UTC
[llvm-dev] how to generate select-free LLVM IR?
Hi Robert, You could write your own LLVM pass that lowers select instructions. Many static analyzers based on LLVM actually do that. See for instance in IKOS: https://github.com/NASA-SW-VnV/ikos/blob/master/frontend/llvm/src/pass/lower_select.cpp Best, -- Maxime Arthaud
Maybe Matching Threads
- Geting names of variables
- [cfe-dev] CFG simplification question, and preservation of branching in the original code
- Disabling select instructions
- [cfe-dev] CFG simplification question, and preservation of branching in the original code
- [cfe-dev] CFG simplification question, and preservation of branching in the original code