[llvm-commits] [llvm] r54333 - in /llvm/trunk: include/llvm/CodeGen/LiveVariables.h include/llvm/CodeGen/Passes.h include/llvm/Target/TargetOptions.h lib/CodeGen/LiveVariables.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/UnreachableBlockElim.cpp lib/Target/TargetMachine.cpp

Dan Gohman gohman at apple.com
Mon Aug 4 17:18:11 PDT 2008


On Aug 4, 2008, at 4:54 PM, Owen Anderson wrote:
> --- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Aug  4  
> 18:54:43 2008
> @@ -101,6 +101,11 @@
>   /// DisableJumpTables - This flag indicates jump tables should not  
> be
>   /// generated.
>   extern bool DisableJumpTables;
> +
> +  /// DisableCorrectBranchFolding - This flag indicates whether the  
> instruction
> +  /// selector should take care to update the CFG properly when
> +  /// folding branches.
> +  extern bool DisableCorrectBranchFolding;

Does this need to be in TargetOptions.h, or can it be a private option
in SelectionDAGISel.cpp?

>
> +char UnreachableMachineBlockElim::ID = 0;
> +
> +static RegisterPass<UnreachableMachineBlockElim>
> +Y("unreachable-mbb-elimination",
> +  "Remove unreachable machine basic blocks");
> +
> +const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y;
> +
> +bool  
> UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction  
> &F) {
> +  bool changed = true;
> +  bool result = false;
> +
> +  while (changed) {
> +    changed = iterateOnFunction(F);
> +    result |= changed;
> +  }

Is iteration necessary here? It looks like the code should get
everything done in one iteration.

>
>
>   // Actually remove the blocks now.
>   for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i)
> -    F.getBasicBlockList().erase(DeadBlocks[i]);
> +    DeadBlocks[i]->eraseFromParent();
>
> -  return true;
> +  return DeadBlocks.size();

How about
   return !DeadBlocks.empty();
?

Dan




More information about the llvm-commits mailing list