Proper way to lower all ConstantExprs?

For my own Transform passes I need to lower all ConstantExpressions into Instructions in order to conveniently analyze the use-def def-use chains and operand comparisons. Could anyone possibly kindly share some insights on if there is any standard way to do this without crafting my own implementation and if not, should we add this feature into LLVM upstream?


There's a helper ConstantExpr::getAsInstruction to create an Instruction for a given ConstantExpr. I don't think there's any code to do this for *all* ConstantExprs/ConstantAggregates used by a given function; if you think you need this, you might want to reconsider your approach. (Recursively visiting constant expressions isn't very hard, if you need it.)