search for: getlooppreheader

Displaying 6 results from an estimated 6 matches for "getlooppreheader".

2005 Aug 13
1
[LLVMdev] Adding instructions to loop
I am attempting to add instructions before and after all loops. To do this, I've added a simple function as follows: void addToAllLoops(Loop * IL) { addToAllLoops(IL); BasicBlock * PH = IL->getLoopPreheader(); Instruction *InstrCallPre = new CallInst(PrintLoopBegin, "", PH->getPrev()); return; } The function added is trivial: void printloopbegin() { fprintf (stderr,"Loop Beginning\n"); } The function is called from runOnFunction() as follows: P...
2019 Oct 30
2
How to make ScalarEvolution recompute SCEV values?
...rEvolution and LoopInfo analysis pass during my pass? This is my current CloneLoop function: Loop *cloneLoop(Function *F, Loop *L, LoopInfo *LI, const Twine &NameSuffix, ValueToValueMapTy &VMap) { // original preheader of the loop const auto PreHeader = L->getLoopPreheader(); // keep track of the original predecessors std::set<BasicBlock *> AllPredecessors; for (auto PredIt = pred_begin(PreHeader), E = pred_end(PreHeader); PredIt != E; PredIt++) AllPredecessors.insert(*PredIt); BasicBlock *ExitBlock = L->getExitBloc...
2004 May 02
1
[LLVMdev] hoisting problem.
...s a branch) Instruction* I2 = I->clone(); I2->setName("Billy"); I->replaceAllUsesWith(I2); I->getParent()->getInstList().remove(I); //we want to insert before the //branch at the end iplist<Instruction> preheaderInsts = L->getLoopPreheader()->getInstList(); iplist<Instruction>::iterator i = preheaderInsts.end(); i--; preheaderInsts.insert(i, I2); //I->getParent()->getInstList().remove(I); DEBUG(std::cerr << "HOIST: DONE\n"); return false; } ==========...
2010 Nov 17
1
[LLVMdev] L->isLoopInvariant giving wrong results?
...rved<ScalarEvolution>(); AU.addPreservedID(LoopSimplifyID); } }; } char MyLoopPass::ID=0; INITIALIZE_PASS(MyLoopPass, "myLICM", "simple LICM pass", false, false); bool MyLoopPass::runOnLoop(Loop * L, LPPassManager &lpm){ //find loop pre-header BasicBlock* pre=L->getLoopPreheader(); curLoop=L; changed=false; BasicBlock* lat=L->getLoopLatch(); LI = &getAnalysis<LoopInfo>(); DT = &getAnalysis<DominatorTree>(); errs() <<"Loop Pre-Header:" << *pre; errs() <<"Loop Latch:" << *lat; for (BasicBlock::iterator i =...
2010 Nov 17
0
[LLVMdev] L->isLoopInvariant giving wrong results?
i am getting seg fault on functions like I->eraseFromParent also. I'm assuming that the problem comes when i change the loop structure. On Thu, Nov 18, 2010 at 4:05 AM, Sreeraj a <writetosrj at gmail.com> wrote: > The funny thing is that i am manually able to hoist the Loop invariant > instruction to the basicBlock terminator, by editing the human readable form > and then
2010 Nov 17
2
[LLVMdev] L->isLoopInvariant giving wrong results?
The funny thing is that i am manually able to hoist the Loop invariant instruction to the basicBlock terminator, by editing the human readable form and then using llvm-as to convert it into bytecode. On Thu, Nov 18, 2010 at 4:01 AM, Chris Lattner <clattner at apple.com> wrote: > > On Nov 17, 2010, at 1:38 PM, Sreeraj a wrote: > > > Thanks Chris, > > > > I was