[LLVMdev] Running a pass
Rahul Joshi
rujoshi at uiuc.edu
Wed Aug 13 15:32:01 PDT 2003
Hi,
I want to run the Mem2Reg pass on a function without using the the LLVM opt utility. I wrote some code, which I am not sure is correct:
TS_ASSERT(!verifyFunction(*function));
// find the dominance frontier of the CFG
DominanceFrontier DF;
DF.runOnFunction(*function);
// try to promote stack allocated variables
PromoteMemToReg(function->getRegAllocas(), DF, *tgt_data);
function->print(std::cout);
TS_ASSERT(!verifyFunction(*function));
Is this supposed to work? Or what is the preferred way passes
are to be run on functions? With the above code, my program
crashes even before main(), when doing some static
initialization in Type.cpp.
Thanks,
Rahul
More information about the llvm-dev
mailing list