[llvm-commits] [llvm] r45775 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Tanya Lattner lattner at apple.com
Wed Jan 9 14:03:35 PST 2008


Just glancing at this briefly for the first time. I really think that  
runOnMachineFunction could benefit from comments that give an  
overview of the algorithm. Secondly, the classes/structs and member  
variables could also use some comments.
You should also explain what a dominance forest/node is and maybe  
some more comments on its construction. I'd also more closely  
document the trivial interferences. I know this stuff is in the  
paper, but it makes your code easier to understand for people who  
haven't read it. Yes, I'm a comment freak.

Is the DFS numbering of the MachineFunction something that would be  
useful for other optimizations? Maybe it could be pulled out and used  
as an analysis?

-Tanya



On Jan 9, 2008, at 2:41 AM, Owen Anderson wrote:

> Author: resistor
> Date: Wed Jan  9 04:41:39 2008
> New Revision: 45775
>
> URL: http://llvm.org/viewvc/llvm-project?rev=45775&view=rev
> Log:
> StrongPHIElim: Now with even fewer trivial bugs!
>
> Modified:
>     llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
>
> Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ 
> StrongPHIElimination.cpp?rev=45775&r1=45774&r2=45775&view=diff
>
> ====================================================================== 
> ========
> --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
> +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Jan  9  
> 04:41:39 2008
> @@ -215,7 +215,9 @@
>        stack.pop_back();
>        CurrentParent = stack.back();
>
> -      parentBlock = LV.getVarInfo(CurrentParent->getReg()).DefInst- 
> >getParent();
> +      parentBlock = CurrentParent->getReg() ?
> +                   LV.getVarInfo(CurrentParent->getReg()).DefInst- 
> >getParent() :
> +                   0;
>      }
>
>      DomForestNode* child = new DomForestNode(*I, CurrentParent);
> @@ -361,7 +363,7 @@
>    std::set<unsigned> ProcessedNames;
>
>    MachineBasicBlock::iterator P = MBB->begin();
> -  while (P->getOpcode() == TargetInstrInfo::PHI) {
> +  while (P != MBB->end() && P->getOpcode() == TargetInstrInfo::PHI) {
>      LiveVariables::VarInfo& PHIInfo = LV.getVarInfo(P->getOperand 
> (0).getReg());
>
>      unsigned DestReg = P->getOperand(0).getReg();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list