convert switch stmts to If statements

Hi All,
Is there a pass in llvm that converts switch statements to if statements?

George

From: "George Baah" <georgebaah@gmail.com>
To: "LLVM Developers Mailing List" <llvmdev@cs.uiuc.edu>
Sent: Monday, May 6, 2013 3:09:33 PM
Subject: [LLVMdev] convert switch stmts to If statements

Hi All, Is there a pass in llvm that converts switch statements to if
statements?

What do you mean by convert? SelectionDAGBuilder::visitSwitch in lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp converts the switch statements for code generation either into indirect jump tables or into binary-search trees (which I suppose you could call if statements).

-Hal

I mean an llvm Pass that transforms switch statements into if statements. For example, if I have code with switch statements then running the pass will convert all switches to ifs in the bytecode.

George

There is also the LowerSwitch pass that converts switch instructions to a sequence of branches.

Thanks!

George