Hi! I wonder if llvm::APFloat::toString() can be const since it should not modify the APFloat. -Jochen
On Mar 6, 2010, at 3:39 AM, Jochen Wilhelmy wrote:> Hi! > > I wonder if llvm::APFloat::toString() can be const since > it should not modify the APFloat.Done in r97883, thanks.
Jochen Wilhelmy
2010-Mar-07 10:09 UTC
[LLVMdev] findNearestCommonDominator for PostDominatorTree
Hi! I'd like to find the point where the control flow joins after a branch. e.g. if I have the following function if (a < b) foo1(); else foo2(); bar(); Then the control flow splits at the basic block containing a < b with a branch as terminator instruction. At the basic block with bar() the control flow joins again (at first my control flow graph does not have loops). I would think I have to calculate the post dominator tree and then call findNearestCommonDominator on the two branches, but this function is missing. Does this have a reason? I would think it's just inline BasicBlock *findNearestCommonDominator(BasicBlock *A, BasicBlock *B) { return DT->findNearestCommonDominator(A, B); } like for llvm::DominatorTree. Is it possible to add it? The method of finding the control flow join should also work for this case: if (a < b) { foo1(); if (c < d) goto label; foo2(); } else { foo3(); label: foo4(); } bar(); - Jochen
Tobias Grosser
2010-Mar-07 11:25 UTC
[LLVMdev] findNearestCommonDominator for PostDominatorTree
On 03/07/2010 11:09 AM, Jochen Wilhelmy wrote:> Hi!Hi Jochen,> I'd like to find the point where the control flow joins after a branch. > > e.g. if I have the following function > > if (a< b) > foo1(); > else > foo2(); > bar(); > > Then the control flow splits at the basic block containing a< b with > a branch as terminator instruction. At the basic block with bar() the > control > flow joins again (at first my control flow graph does not have loops). > > I would think I have to calculate the post dominator tree and then call > findNearestCommonDominator on the two branches, but this function > is missing. Does this have a reason? I would think it's just > > inline BasicBlock *findNearestCommonDominator(BasicBlock *A, BasicBlock > *B) { > return DT->findNearestCommonDominator(A, B); > } > > like for llvm::DominatorTree. Is it possible to add it?It was probably just not added, as the PostDominatorTree is not used a lot at the moment. I added it. It is a trivial change. http://llvm.org/viewvc/llvm-project?rev=97915&view=rev It should just work, as the code paths are the same for both Dominator and PostDominatorTree in this case. In general the PostDominatorTree works well. I use it for the RegionInfo pass and it works flawless, but I think there may still be some bugs in cases with infinite loops. If this is the case please report back. They should be fixed anyways, as they are probably general PostDominatorTree bugs and not especially related to the findNearestCommonDominator() function.> The method of finding the control flow join should also work for this case:Yes.> if (a< b) > { > foo1(); > if (c< d) goto label; > foo2(); > } > else > { > foo3(); > label: > foo4(); > } > bar(); > > - JochenTobi