mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-22 13:32:09 +00:00
Remove unnecesary &*'s
llvm-svn: 5872
This commit is contained in:
parent
3e687b8b65
commit
db6b7ba364
@ -169,7 +169,7 @@ static inline bool ShouldInlineFunction(const CallInst *CI, const Function *F) {
|
||||
|
||||
static inline bool DoFunctionInlining(BasicBlock *BB) {
|
||||
for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) {
|
||||
if (CallInst *CI = dyn_cast<CallInst>(&*I)) {
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I)) {
|
||||
// Check to see if we should inline this function
|
||||
Function *F = CI->getCalledFunction();
|
||||
if (F && ShouldInlineFunction(CI, F)) {
|
||||
|
@ -386,7 +386,7 @@ void insertBB(Edge ed,
|
||||
for(BasicBlock::iterator BB2Inst = BB2->begin(), BBend = BB2->end();
|
||||
BB2Inst != BBend; ++BB2Inst){
|
||||
|
||||
if(PHINode *phiInst=dyn_cast<PHINode>(&*BB2Inst)){
|
||||
if(PHINode *phiInst=dyn_cast<PHINode>(BB2Inst)){
|
||||
int bbIndex=phiInst->getBasicBlockIndex(BB1);
|
||||
assert(bbIndex>=0);
|
||||
phiInst->setIncomingBlock(bbIndex, newBB);
|
||||
|
@ -133,7 +133,7 @@ void getBackEdgesVisit(BasicBlock *u,
|
||||
for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end();
|
||||
BB2Inst != BBend; ++BB2Inst){
|
||||
|
||||
if(PHINode *phiInst=dyn_cast<PHINode>(&*BB2Inst)){
|
||||
if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)){
|
||||
int bbIndex = phiInst->getBasicBlockIndex(u);
|
||||
if(bbIndex>=0){
|
||||
phiInst->setIncomingBlock(bbIndex, newBB);
|
||||
|
@ -87,7 +87,7 @@ bool ProfilePaths::runOnFunction(Function &F){
|
||||
nodes.push_back(nd);
|
||||
if(&*BB == ExitNode)
|
||||
exitNode=nd;
|
||||
if(&*BB==F.begin())
|
||||
if(BB==F.begin())
|
||||
startNode=nd;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//,
|
||||
BasicBlock *ExitNode = 0;
|
||||
for (Function::iterator I = M->begin(), E = M->end(); I != E; ++I){
|
||||
if (isa<ReturnInst>(I->getTerminator())) {
|
||||
ExitNode = &*I;
|
||||
ExitNode = I;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//,
|
||||
if(BB->size()==3 || BB->size() ==2){
|
||||
for(BasicBlock::iterator II = BB->begin(), IE = BB->end();
|
||||
II != IE; ++II){
|
||||
if(CallInst *callInst = dyn_cast<CallInst>(&*II)){
|
||||
if(CallInst *callInst = dyn_cast<CallInst>(II)){
|
||||
//std::cerr<<*callInst;
|
||||
Function *calledFunction = callInst->getCalledFunction();
|
||||
if(calledFunction && calledFunction->getName() == "trigger"){
|
||||
@ -199,7 +199,7 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//,
|
||||
continue;
|
||||
|
||||
//if(BB->size()==3)
|
||||
//if(CallInst *callInst = dyn_cast<CallInst>(&*BB->getInstList().begin()))
|
||||
//if(CallInst *callInst = dyn_cast<CallInst>(BB->getInstList().begin()))
|
||||
//if(callInst->getCalledFunction()->getName() == "trigger")
|
||||
//continue;
|
||||
|
||||
@ -216,20 +216,20 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//,
|
||||
Node *nd=findBB(nodes, BB);
|
||||
assert(nd && "No node for this edge!");
|
||||
|
||||
for(BasicBlock::succ_iterator s=succ_begin(&*BB), se=succ_end(&*BB);
|
||||
for(BasicBlock::succ_iterator s=succ_begin(BB), se=succ_end(BB);
|
||||
s!=se; ++s){
|
||||
|
||||
if(triggerBBs[*s] == 9){
|
||||
//if(!pathReg[M]){ //Get the path register for this!
|
||||
//if(BB->size()>8)
|
||||
// if(LoadInst *ldInst = dyn_cast<LoadInst>(&*BB->getInstList().begin()))
|
||||
// if(LoadInst *ldInst = dyn_cast<LoadInst>(BB->getInstList().begin()))
|
||||
// pathReg[M] = ldInst->getPointerOperand();
|
||||
//}
|
||||
continue;
|
||||
}
|
||||
//if((*s)->size()==3)
|
||||
//if(CallInst *callInst =
|
||||
// dyn_cast<CallInst>(&*(*s)->getInstList().begin()))
|
||||
// dyn_cast<CallInst>((*s)->getInstList().begin()))
|
||||
// if(callInst->getCalledFunction()->getName() == "trigger")
|
||||
// continue;
|
||||
|
||||
@ -284,11 +284,11 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//,
|
||||
VBI != VBE; ++VBI){
|
||||
for(BasicBlock::iterator BBI = (*VBI)->begin(), BBE = (*VBI)->end();
|
||||
BBI != BBE; ++BBI){
|
||||
if(LoadInst *ldInst = dyn_cast<LoadInst>(&*BBI)){
|
||||
if(LoadInst *ldInst = dyn_cast<LoadInst>(BBI)){
|
||||
if(pathReg[M] == ldInst->getPointerOperand())
|
||||
instToErase.push_back(ldInst);
|
||||
}
|
||||
else if(StoreInst *stInst = dyn_cast<StoreInst>(&*BBI)){
|
||||
else if(StoreInst *stInst = dyn_cast<StoreInst>(BBI)){
|
||||
if(pathReg[M] == stInst->getPointerOperand())
|
||||
instToErase.push_back(stInst);
|
||||
}
|
||||
|
@ -298,9 +298,9 @@ ReleasePtrSeqNumbers(BasicBlock *BB,
|
||||
ExternalFuncs& externalFuncs) {
|
||||
|
||||
for (BasicBlock::iterator II=BB->begin(), IE = BB->end(); II != IE; ++II)
|
||||
if (FreeInst *FI = dyn_cast<FreeInst>(&*II))
|
||||
if (FreeInst *FI = dyn_cast<FreeInst>(II))
|
||||
InsertReleaseInst(FI->getOperand(0), BB, FI,externalFuncs.ReleasePtrFunc);
|
||||
else if (AllocaInst *AI = dyn_cast<AllocaInst>(&*II))
|
||||
else if (AllocaInst *AI = dyn_cast<AllocaInst>(II))
|
||||
InsertRecordInst(AI, BB, AI->getNext(), externalFuncs.RecordPtrFunc);
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ static void TraceValuesAtBBExit(BasicBlock *BB,
|
||||
// instruction *preceding* InsertPos to check when to terminate the loop.
|
||||
//
|
||||
for (BasicBlock::iterator II = BB->begin(); &*II != InsertPos; ++II) {
|
||||
if (StoreInst *SI = dyn_cast<StoreInst>(&*II)) {
|
||||
if (StoreInst *SI = dyn_cast<StoreInst>(II)) {
|
||||
assert(valuesStoredInFunction &&
|
||||
"Should not be printing a store instruction at function exit");
|
||||
LoadInst *LI = new LoadInst(SI->getPointerOperand(), "reload." +
|
||||
|
@ -119,7 +119,7 @@ bool ADCE::dropReferencesOfDeadInstructionsInLiveBlock(BasicBlock *BB) {
|
||||
for (BasicBlock::iterator I = BB->begin(), E = --BB->end(); I != E; )
|
||||
if (!LiveSet.count(I)) { // Is this instruction alive?
|
||||
I->dropAllReferences(); // Nope, drop references...
|
||||
if (PHINode *PN = dyn_cast<PHINode>(&*I)) {
|
||||
if (PHINode *PN = dyn_cast<PHINode>(I)) {
|
||||
// We don't want to leave PHI nodes in the program that have
|
||||
// #arguments != #predecessors, so we remove them now.
|
||||
//
|
||||
@ -310,7 +310,7 @@ bool ADCE::doADCE() {
|
||||
// should be identical to the incoming values for LastDead.
|
||||
//
|
||||
for (BasicBlock::iterator II = NextAlive->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*II); ++II) {
|
||||
PHINode *PN = dyn_cast<PHINode>(II); ++II) {
|
||||
// Get the incoming value for LastDead...
|
||||
int OldIdx = PN->getBasicBlockIndex(LastDead);
|
||||
assert(OldIdx != -1 && "LastDead is not a pred of NextAlive!");
|
||||
|
@ -450,11 +450,11 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo,
|
||||
|
||||
// Put the newly discovered information into the RegionInfo...
|
||||
for (BasicBlock::iterator I = OldSucc->begin(), E = OldSucc->end(); I!=E; ++I)
|
||||
if (PHINode *PN = dyn_cast<PHINode>(&*I)) {
|
||||
if (PHINode *PN = dyn_cast<PHINode>(I)) {
|
||||
int OpNum = PN->getBasicBlockIndex(BB);
|
||||
assert(OpNum != -1 && "PHI doesn't have incoming edge for predecessor!?");
|
||||
PropagateEquality(PN, PN->getIncomingValue(OpNum), NewRI);
|
||||
} else if (SetCondInst *SCI = dyn_cast<SetCondInst>(&*I)) {
|
||||
} else if (SetCondInst *SCI = dyn_cast<SetCondInst>(I)) {
|
||||
Relation::KnownResult Res = getSetCCResult(SCI, NewRI);
|
||||
if (Res == Relation::Unknown) return false;
|
||||
PropagateEquality(SCI, ConstantBool::get(Res), NewRI);
|
||||
@ -563,7 +563,7 @@ void CEE::ForwardSuccessorTo(TerminatorInst *TI, unsigned SuccNo,
|
||||
// node with a new value.
|
||||
//
|
||||
for (BasicBlock::iterator I = OldSucc->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ) {
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ) {
|
||||
|
||||
// Get the value flowing across the old edge and remove the PHI node entry
|
||||
// for this edge: we are about to remove the edge! Don't remove the PHI
|
||||
@ -993,7 +993,7 @@ void CEE::ComputeReplacements(RegionInfo &RI) {
|
||||
bool CEE::SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI) {
|
||||
bool Changed = false;
|
||||
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ) {
|
||||
Instruction *Inst = &*I++;
|
||||
Instruction *Inst = I++;
|
||||
|
||||
// Convert instruction arguments to canonical forms...
|
||||
Changed |= SimplifyInstruction(Inst, RI);
|
||||
|
@ -44,7 +44,7 @@ DecomposePass::runOnBasicBlock(BasicBlock &BB)
|
||||
{
|
||||
bool changed = false;
|
||||
for (BasicBlock::iterator II = BB.begin(); II != BB.end(); )
|
||||
if (GetElementPtrInst *gep = dyn_cast<GetElementPtrInst>(&*II++)) // pre-inc
|
||||
if (GetElementPtrInst *gep = dyn_cast<GetElementPtrInst>(II++)) // pre-inc
|
||||
if (gep->getNumIndices() >= 2)
|
||||
changed |= DecomposeArrayRef(gep); // always modifies II
|
||||
return changed;
|
||||
|
@ -45,7 +45,7 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) {
|
||||
//
|
||||
std::vector<InductionVariable> IndVars; // Induction variables for block
|
||||
BasicBlock::iterator AfterPHIIt = Header->begin();
|
||||
for (; PHINode *PN = dyn_cast<PHINode>(&*AfterPHIIt); ++AfterPHIIt)
|
||||
for (; PHINode *PN = dyn_cast<PHINode>(AfterPHIIt); ++AfterPHIIt)
|
||||
IndVars.push_back(InductionVariable(PN, Loops));
|
||||
// AfterPHIIt now points to first nonphi instruction...
|
||||
|
||||
|
@ -319,12 +319,12 @@ void LICM::PromoteValuesInLoop() {
|
||||
// Rewrite all loads and stores in the block of the pointer...
|
||||
for (BasicBlock::iterator II = (*I)->begin(), E = (*I)->end();
|
||||
II != E; ++II) {
|
||||
if (LoadInst *L = dyn_cast<LoadInst>(&*II)) {
|
||||
if (LoadInst *L = dyn_cast<LoadInst>(II)) {
|
||||
std::map<Value*, AllocaInst*>::iterator
|
||||
I = ValueToAllocaMap.find(L->getOperand(0));
|
||||
if (I != ValueToAllocaMap.end())
|
||||
L->setOperand(0, I->second); // Rewrite load instruction...
|
||||
} else if (StoreInst *S = dyn_cast<StoreInst>(&*II)) {
|
||||
} else if (StoreInst *S = dyn_cast<StoreInst>(II)) {
|
||||
std::map<Value*, AllocaInst*>::iterator
|
||||
I = ValueToAllocaMap.find(S->getOperand(1));
|
||||
if (I != ValueToAllocaMap.end())
|
||||
|
@ -132,7 +132,7 @@ BasicBlock *Preheaders::SplitBlockPredecessors(BasicBlock *BB,
|
||||
//
|
||||
if (!Preds.empty()) { // Is the loop not obviously dead?
|
||||
for (BasicBlock::iterator I = BB->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ++I) {
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ++I) {
|
||||
|
||||
// Create the new PHI node, insert it into NewBB at the end of the block
|
||||
PHINode *NewPHI = new PHINode(PN->getType(), PN->getName()+".ph", BI);
|
||||
@ -160,7 +160,7 @@ BasicBlock *Preheaders::SplitBlockPredecessors(BasicBlock *BB,
|
||||
|
||||
} else { // Otherwise the loop is dead...
|
||||
for (BasicBlock::iterator I = BB->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ++I)
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ++I)
|
||||
// Insert dummy values as the incoming value...
|
||||
PN->addIncoming(Constant::getNullValue(PN->getType()), NewBB);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
|
||||
|
||||
// Loop over all of the instructions, looking for malloc or free instructions
|
||||
for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) {
|
||||
if (MallocInst *MI = dyn_cast<MallocInst>(&*I)) {
|
||||
if (MallocInst *MI = dyn_cast<MallocInst>(I)) {
|
||||
const Type *AllocTy = MI->getType()->getElementType();
|
||||
|
||||
// Get the number of bytes to be allocated for one element of the
|
||||
@ -114,7 +114,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
|
||||
I = --BBIL.erase(I); // remove and delete the malloc instr...
|
||||
Changed = true;
|
||||
++NumLowered;
|
||||
} else if (FreeInst *FI = dyn_cast<FreeInst>(&*I)) {
|
||||
} else if (FreeInst *FI = dyn_cast<FreeInst>(I)) {
|
||||
// Cast the argument to free into a ubyte*...
|
||||
CastInst *MCast = new CastInst(FI->getOperand(0),
|
||||
PointerType::get(Type::UByteTy), "", I);
|
||||
|
@ -43,7 +43,7 @@ bool PromotePass::runOnFunction(Function &F) {
|
||||
// Find allocas that are safe to promote, by looking at all instructions in
|
||||
// the entry node
|
||||
for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
|
||||
if (AllocaInst *AI = dyn_cast<AllocaInst>(&*I)) // Is it an alloca?
|
||||
if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) // Is it an alloca?
|
||||
if (isAllocaPromotable(AI, TD))
|
||||
Allocas.push_back(AI);
|
||||
|
||||
|
@ -224,7 +224,7 @@ bool Reassociate::ReassociateBB(BasicBlock *BB) {
|
||||
// the two operands are sorted incorrectly, fix it now.
|
||||
//
|
||||
if (BI->isAssociative()) {
|
||||
BinaryOperator *I = cast<BinaryOperator>(&*BI);
|
||||
BinaryOperator *I = cast<BinaryOperator>(BI);
|
||||
if (!I->use_empty()) {
|
||||
// Make sure that we don't have a tree-shaped computation. If we do,
|
||||
// linearize it. Convert (A+B)+(C+D) into ((A+B)+C)+D
|
||||
|
@ -474,7 +474,7 @@ void SCCP::visitTerminatorInst(TerminatorInst &TI) {
|
||||
// constant now may not be.
|
||||
//
|
||||
for (BasicBlock::iterator I = Succ->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ++I)
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ++I)
|
||||
visitPHINode(*PN);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ void SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) {
|
||||
// merge incoming values from NewBB instead of from TIBB.
|
||||
//
|
||||
for (BasicBlock::iterator I = DestBB->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ++I) {
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ++I) {
|
||||
// We no longer enter through TIBB, now we come in through NewBB.
|
||||
PN->replaceUsesOfWith(TIBB, NewBB);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ static bool PropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
|
||||
// Loop over all of the PHI nodes checking to see if there are
|
||||
// incompatible values coming in.
|
||||
for (BasicBlock::iterator I = Succ->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ++I) {
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ++I) {
|
||||
// Loop up the entries in the PHI node for BB and for *PI if the values
|
||||
// coming in are non-equal, we cannot merge these two blocks (instead we
|
||||
// should insert a conditional move or something, then merge the
|
||||
@ -56,7 +56,7 @@ static bool PropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
|
||||
|
||||
// Loop over all of the PHI nodes in the successor BB
|
||||
for (BasicBlock::iterator I = Succ->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*I); ++I) {
|
||||
PHINode *PN = dyn_cast<PHINode>(I); ++I) {
|
||||
Value *OldVal = PN->removeIncomingValue(BB, false);
|
||||
assert(OldVal && "No entry in PHI for Pred BB!");
|
||||
|
||||
|
@ -196,7 +196,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred) {
|
||||
} else {
|
||||
// Okay, now we know that we need to remove predecessor #pred_idx from all
|
||||
// PHI nodes. Iterate over each PHI node fixing them up
|
||||
for (iterator II = begin(); PHINode *PN = dyn_cast<PHINode>(&*II); ++II)
|
||||
for (iterator II = begin(); PHINode *PN = dyn_cast<PHINode>(II); ++II)
|
||||
PN->removeIncomingValue(Pred);
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I) {
|
||||
// incoming values...
|
||||
BasicBlock *Successor = *I;
|
||||
for (BasicBlock::iterator II = Successor->begin();
|
||||
PHINode *PN = dyn_cast<PHINode>(&*II); ++II) {
|
||||
PHINode *PN = dyn_cast<PHINode>(II); ++II) {
|
||||
int IDX = PN->getBasicBlockIndex(this);
|
||||
while (IDX != -1) {
|
||||
PN->setIncomingBlock((unsigned)IDX, New);
|
||||
|
Loading…
x
Reference in New Issue
Block a user