[Mesa-dev] [PATCH 4/5] AMDGPU: Remove or document commented out code

Vincent Lejeune vljn at ovi.com
Thu Nov 29 12:58:16 PST 2012


Reviewed-By: Vincent Lejeune <vljn at ovi.com>


----- Mail original -----
> De : Tom Stellard <tom at stellard.net>
> À : mesa-dev at lists.freedesktop.org
> Cc : Tom Stellard <thomas.stellard at amd.com>
> Envoyé le : Mercredi 28 novembre 2012 23h50
> Objet : [Mesa-dev] [PATCH 4/5] AMDGPU: Remove or document commented out code
> 
> From: Tom Stellard <thomas.stellard at amd.com>
> 
> ---
> lib/Target/AMDGPU/AMDILCFGStructurizer.cpp | 97 +++---------------------------
> lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp    |  2 +-
> lib/Target/AMDGPU/AMDILIntrinsicInfo.cpp   |  2 -
> lib/Target/AMDGPU/SIInstructions.td        |  4 ++
> 4 files changed, 13 insertions(+), 92 deletions(-)
> 
> diff --git a/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp 
> b/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
> index b909d67..c43a76c 100644
> --- a/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
> +++ b/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp
> @@ -325,33 +325,13 @@ bool CFGStructurizer<PassT>::prepare(FuncT 
> &func, PassT &pass,
>    TRI = tri;
> 
>    bool changed = false;
> -  //func.RenumberBlocks();
> 
> -  //to do, if not reducible flow graph, make it so ???
> +  //FIXME: if not reducible flow graph, make it so ???
> 
>    if (DEBUGME) {
>          errs() << "AMDGPUCFGStructurizer::prepare\n";
> -    //func.viewCFG();
> -    //func.viewCFGOnly();
> -    //func.dump();
> -  }
> -
> -  //FIXME: gcc complains on this.
> -  //domTree = &pass.getAnalysis<DomTreeT>();
> -      //domTree = CFGTraits::getDominatorTree(pass);
> -      //if (DEBUGME) {
> -      //    domTree->print(errs());
> -    //}
> -
> -  //FIXME: gcc complains on this.
> -  //domTree = &pass.getAnalysis<DomTreeT>();
> -      //postDomTree = CFGTraits::getPostDominatorTree(pass);
> -      //if (DEBUGME) {
> -      //   postDomTree->print(errs());
> -    //}
> -
> -  //FIXME: gcc complains on this.
> -  //loopInfo = &pass.getAnalysis<LoopInfoT>();
> +  }
> +
>    loopInfo = CFGTraits::getLoopInfo(pass);
>    if (DEBUGME) {
>      errs() << "LoopInfo:\n";
> @@ -394,8 +374,6 @@ bool CFGStructurizer<PassT>::prepare(FuncT &func, 
> PassT &pass,
>        retBlks.push_back(curBlk);
>      }
>      assert(curBlk->succ_size() <= 2);
> -    //assert(curBlk->size() > 0);
> -    //removeEmptyBlock(curBlk) ??
>    } //for
> 
>    if (retBlks.size() >= 2) {
> @@ -413,35 +391,22 @@ bool CFGStructurizer<PassT>::run(FuncT &func, 
> PassT &pass,
>    funcRep = &func;
>    TRI = tri;
> 
> -  //func.RenumberBlocks();
> -
>    //Assume reducible CFG...
>    if (DEBUGME) {
>      errs() << "AMDGPUCFGStructurizer::run\n";
> -    //errs() << func.getFunction()->getNameStr() << 
> "\n";
>      func.viewCFG();
> -    //func.viewCFGOnly();
> -    //func.dump();
>    }
> 
> -#if 1
> -  //FIXME: gcc complains on this.
> -  //domTree = &pass.getAnalysis<DomTreeT>();
>    domTree = CFGTraits::getDominatorTree(pass);
>    if (DEBUGME) {
>      domTree->print(errs(), (const llvm::Module*)0);
>    }
> -#endif
> 
> -  //FIXME: gcc complains on this.
> -  //domTree = &pass.getAnalysis<DomTreeT>();
>    postDomTree = CFGTraits::getPostDominatorTree(pass);
>    if (DEBUGME) {
>      postDomTree->print(errs());
>    }
> 
> -  //FIXME: gcc complains on this.
> -  //loopInfo = &pass.getAnalysis<LoopInfoT>();
>    loopInfo = CFGTraits::getLoopInfo(pass);
>    if (DEBUGME) {
>      errs() << "LoopInfo:\n";
> @@ -449,7 +414,6 @@ bool CFGStructurizer<PassT>::run(FuncT &func, 
> PassT &pass,
>    }
> 
>    orderBlocks();
> -//#define STRESSTEST
> #ifdef STRESSTEST
>    //Use the worse block ordering to test the algorithm.
>    ReverseVector(orderedBlks);
> @@ -526,7 +490,6 @@ bool CFGStructurizer<PassT>::run(FuncT &func, 
> PassT &pass,
>              errs() << "repeat processing SCC" << 
> getSCCNum(curBlk)
>                     << "sccNumIter = " << sccNumIter 
> << "\n";
>              func.viewCFG();
> -            //func.viewCFGOnly();
>            }
>          } else {
>            // Finish the current scc.
> @@ -590,7 +553,6 @@ bool CFGStructurizer<PassT>::run(FuncT &func, 
> PassT &pass,
> 
>    if (DEBUGME) {
>      func.viewCFG();
> -    //func.dump();
>    }
> 
>    if (!finish) {
> @@ -673,7 +635,6 @@ int CFGStructurizer<PassT>::patternMatchGroup(BlockT 
> *curBlk) {
>    int numMatch = 0;
>    numMatch += serialPatternMatch(curBlk);
>    numMatch += ifPatternMatch(curBlk);
> -  //numMatch += switchPatternMatch(curBlk);
>    numMatch += loopendPatternMatch(curBlk);
>    numMatch += loopPatternMatch(curBlk);
>    return numMatch;
> @@ -915,10 +876,8 @@ int 
> CFGStructurizer<PassT>::loopbreakPatternMatch(LoopT *loopRep,
>      } // check all exit blocks
> 
>      if (allNotInPath) {
> -#if 1
> 
>        // TODO: Simplify, maybe separate function?
> -      //funcRep->viewCFG();
>        LoopT *parentLoopRep = loopRep->getParentLoop();
>        BlockT *parentLoopHeader = NULL;
>        if (parentLoopRep)
> @@ -944,9 +903,6 @@ int 
> CFGStructurizer<PassT>::loopbreakPatternMatch(LoopT *loopRep,
>          }
>          return -1;
>        }
> -#else
> -      return -1;
> -#endif
>      }
> 
>      // Handle side entry to exit path.
> @@ -996,7 +952,6 @@ int 
> CFGStructurizer<PassT>::loopbreakPatternMatch(LoopT *loopRep,
>      }
>    } // else
> 
> -  // LoopT *exitLandLoop = loopInfo->getLoopFor(exitLandBlk);
>    exitLandBlk = recordLoopLandBlock(loopRep, exitLandBlk, exitBlks, 
> exitBlkSet);
> 
>    // Fold break into the breaking block. Leverage across level breaks.
> @@ -1107,8 +1062,7 @@ int 
> CFGStructurizer<PassT>::handleJumpintoIfImp(BlockT *headBlk,
>        errs() << "check down = BB" << 
> downBlk->getNumber();
>      }
> 
> -    if (//postDomTree->dominates(downBlk, falseBlk) &&
> -        singlePathTo(falseBlk, downBlk) == SinglePath_InPath) {
> +    if (singlePathTo(falseBlk, downBlk) == SinglePath_InPath) {
>        if (DEBUGME) {
>          errs() << " working\n";
>        }
> @@ -1120,7 +1074,7 @@ int 
> CFGStructurizer<PassT>::handleJumpintoIfImp(BlockT *headBlk,
>        num += serialPatternMatch(*headBlk->succ_begin());
>        num += serialPatternMatch(*(++headBlk->succ_begin()));
>        num += ifPatternMatch(headBlk);
> -      assert(num > 0); //
> +      assert(num > 0);
> 
>        break;
>      }
> @@ -1195,16 +1149,6 @@ int 
> CFGStructurizer<PassT>::improveSimpleJumpintoIf(BlockT *headBlk,
>      return 0;
>    }
> 
> -#if 0
> -  if (DEBUGME) {
> -    errs() << "improveSimpleJumpintoIf: ";
> -    showImproveSimpleJumpintoIf(headBlk, trueBlk, falseBlk, landBlk, 0);
> -  }
> -#endif
> -
> -  // unsigned landPredSize = landBlk ? landBlk->pred_size() : 0;
> -  // May consider the # landBlk->pred_size() as it represents the number of
> -  // assignment initReg = .. needed to insert.
>    migrateTrue = needMigrateBlock(trueBlk);
>    migrateFalse = needMigrateBlock(falseBlk);
> 
> @@ -1225,7 +1169,6 @@ int 
> CFGStructurizer<PassT>::improveSimpleJumpintoIf(BlockT *headBlk,
>    if (DEBUGME) {
>      errs() << "before improveSimpleJumpintoIf: ";
>      showImproveSimpleJumpintoIf(headBlk, trueBlk, falseBlk, landBlk, 0);
> -    //showImproveSimpleJumpintoIf(headBlk, trueBlk, falseBlk, landBlk, 1);
>    }
> 
>    // org: headBlk => if () {trueBlk} else {falseBlk} => landBlk
> @@ -1308,7 +1251,6 @@ int 
> CFGStructurizer<PassT>::improveSimpleJumpintoIf(BlockT *headBlk,
>      // (initVal != 0)
>      CFGTraits::insertAssignInstrBefore(falseBlk, passRep, initReg, 0);
>    }
> -  //CFGTraits::insertInstrBefore(insertPos, AMDGPU::ENDIF, passRep);
> 
>    if (landBlkHasOtherPred) {
>      // add endif
> @@ -1327,7 +1269,6 @@ int 
> CFGStructurizer<PassT>::improveSimpleJumpintoIf(BlockT *headBlk,
>    if (DEBUGME) {
>      errs() << "result from improveSimpleJumpintoIf: ";
>      showImproveSimpleJumpintoIf(headBlk, trueBlk, falseBlk, landBlk, 0);
> -    //showImproveSimpleJumpintoIf(headBlk, trueBlk, falseBlk, landBlk, 1);
>    }
> 
>    // update landBlk
> @@ -1395,7 +1336,6 @@ void 
> CFGStructurizer<PassT>::handleLoopcontBlock(BlockT *contingBlk,
>    }
> 
>    settleLoopcontBlock(contingBlk, contBlk, initReg);
> -  //contingBlk->removeSuccessor(loopHeader);
> } //handleLoopcontBlock
> 
> template<class PassT>
> @@ -1404,7 +1344,6 @@ void CFGStructurizer<PassT>::mergeSerialBlock(BlockT 
> *dstBlk, BlockT *srcBlk) {
>      errs() << "serialPattern BB" << 
> dstBlk->getNumber()
>             << " <= BB" << srcBlk->getNumber() 
> << "\n";
>    }
> -  //removeUnconditionalBranch(dstBlk);
>    dstBlk->splice(dstBlk->end(), srcBlk, srcBlk->begin(), 
> srcBlk->end());
> 
>    dstBlk->removeSuccessor(srcBlk);
> @@ -1480,7 +1419,6 @@ void 
> CFGStructurizer<PassT>::mergeIfthenelseBlock(InstrT *branchInstr,
>    }
>    CFGTraits::insertInstrBefore(branchInstrPos, AMDGPU::ENDIF, passRep);
> 
> -  //curBlk->remove(branchInstrPos);
>    branchInstr->eraseFromParent();
> 
>    if (landBlk && trueBlk && falseBlk) {
> @@ -1643,7 +1581,6 @@ void 
> CFGStructurizer<PassT>::mergeLoopbreakBlock(BlockT *exitingBlk,
>    } //if_logical
> 
>    //now branchInst can be erase safely
> -  //exitingBlk->eraseFromParent(branchInstr);
>    branchInstr->eraseFromParent();
> 
>    //now take care of successors, retire blocks
> @@ -1714,12 +1651,11 @@ void 
> CFGStructurizer<PassT>::settleLoopcontBlock(BlockT *contingBlk,
>        CFGTraits::insertCondBranchBefore(branchInstrPos, branchOpcode, passRep, 
> DL);
>      }
> 
> -    //contingBlk->eraseFromParent(branchInstr);
>      branchInstr->eraseFromParent();
>    } else {
> -    /* if we've arrived here then we've already erased the branch 
> instruction
> -     * travel back up the basic block to see the last reference of our debug 
> location
> -     * we've just inserted that reference here so it should be 
> representative */
> +    // if we've arrived here then we've already erased the branch 
> instruction
> +    // travel back up the basic block to see the last reference of our debug 
> location
> +    // we've just inserted that reference here so it should be 
> representative
>      if (setReg != INVALIDREGNUM) {
>        CFGTraits::insertAssignInstrBefore(contingBlk, passRep, setReg, 1);
>        // insertEnd to ensure phi-moves, if exist, go before the continue-instr.
> @@ -1749,7 +1685,6 @@ CFGStructurizer<PassT>::relocateLoopcontBlock(LoopT 
> *parentLoopRep,
>                                                BlockT *exitLandBlk) {
>    std::set<BlockT *> endBlkSet;
> 
> -//  BlockT *parentLoopHead = parentLoopRep->getHeader();
> 
> 
>    for (typename std::set<BlockT *>::const_iterator iter = 
> exitBlkSet.begin(),
> @@ -2155,17 +2090,6 @@ void 
> CFGStructurizer<PassT>::addDummyExitBlock(SmallVector<BlockT*,
>      if (curInstr) {
>        curInstr->eraseFromParent();
>      }
> -#if 0
> -    if (curBlk->size()==0 && curBlk->pred_size() == 1) {
> -      if (DEBUGME) {
> -        errs() << "Replace empty block BB" <<  
> curBlk->getNumber()
> -          << " with dummyExitBlock\n";
> -      }
> -      BlockT *predb = *curBlk->pred_begin();
> -      predb->removeSuccessor(curBlk);
> -      curBlk = predb;
> -    } //handle empty curBlk
> -#endif
>      curBlk->addSuccessor(dummyExitBlk);
>      if (DEBUGME) {
>        errs() << "Add dummyExitBlock to BB" << 
> curBlk->getNumber()
> @@ -2213,8 +2137,6 @@ void CFGStructurizer<PassT>::retireBlock(BlockT 
> *dstBlk, BlockT *srcBlk) {
>    }
> 
>    srcBlkInfo->isRetired = true;
> -  //int i = srcBlk->succ_size();
> -  //int j = srcBlk->pred_size();
>    assert(srcBlk->succ_size() == 0 && srcBlk->pred_size() == 0
>           && "can't retire block yet");
> }
> @@ -2562,13 +2484,11 @@ protected:
> public:
>    AMDGPUCFGStructurizer(char &pid, TargetMachine &tm);
>    const TargetInstrInfo *getTargetInstrInfo() const;
> -  //bool runOnMachineFunction(MachineFunction &F);
> 
> private:
> 
> };   //end of class AMDGPUCFGStructurizer
> 
> -//char AMDGPUCFGStructurizer::ID = 0;
> } //end of namespace llvm
> AMDGPUCFGStructurizer::AMDGPUCFGStructurizer(char &pid, TargetMachine 
> &tm
>                                            )
> @@ -3063,7 +2983,6 @@ struct CFGStructTraits<AMDGPUCFGStructurizer> {
>      MachineFunction *func = srcBlk->getParent();
>      MachineBasicBlock *newBlk = func->CreateMachineBasicBlock();
>      func->push_back(newBlk);  //insert to function
> -    //newBlk->setNumber(srcBlk->getNumber());
>      for (MachineBasicBlock::iterator iter = srcBlk->begin(),
>           iterEnd = srcBlk->end();
>           iter != iterEnd; ++iter) {
> diff --git a/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp 
> b/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp
> index 9477b52..10ce6ad 100644
> --- a/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp
> +++ b/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp
> @@ -211,7 +211,7 @@ const Value * AMDGPUDAGToDAGISel::getBasePointerValue(const 
> Value *V) {
>            ValueQueue.push(I->getOperand(x));
>          }
>        } else {
> -        // assert(0 && "Found a Value that we didn't know how 
> to handle!");
> +        assert(!"Found a Value that we didn't know how to 
> handle!");
>        }
>      }
>      ValueQueue.pop();
> diff --git a/lib/Target/AMDGPU/AMDILIntrinsicInfo.cpp 
> b/lib/Target/AMDGPU/AMDILIntrinsicInfo.cpp
> index 75bdd37..0f65ce9 100644
> --- a/lib/Target/AMDGPU/AMDILIntrinsicInfo.cpp
> +++ b/lib/Target/AMDGPU/AMDILIntrinsicInfo.cpp
> @@ -37,8 +37,6 @@ AMDGPUIntrinsicInfo::getName(unsigned int IntrID, Type **Tys,
> #undef GET_INTRINSIC_NAME_TABLE
>    };
> 
> -  //assert(!isOverloaded(IntrID)
> -  //&& "AMDGPU Intrinsics are not overloaded");
>    if (IntrID < Intrinsic::num_intrinsics) {
>      return 0;
>    }
> diff --git a/lib/Target/AMDGPU/SIInstructions.td 
> b/lib/Target/AMDGPU/SIInstructions.td
> index 8512b48..a12ce55 100644
> --- a/lib/Target/AMDGPU/SIInstructions.td
> +++ b/lib/Target/AMDGPU/SIInstructions.td
> @@ -6,6 +6,10 @@
> // License. See LICENSE.TXT for details.
> //
> //===----------------------------------------------------------------------===//
> +// This file was originally auto-generated from a GPU register header file and
> +// all the instruction definitions were originally commented out.  Instructions
> +// that are not yet supported remain commented out.
> +//===----------------------------------------------------------------------===//
> 
> def isSI : Predicate<"Subtarget.device()"
>                              "->getGeneration() == 
> AMDGPUDeviceInfo::HD7XXX">;
> -- 
> 1.7.11.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list