From ab2b328c78cd59d663358c550d7b951b55059c3d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 29 May 2003 15:12:27 +0000 Subject: [PATCH] Eliminate unnecessary ->get calls that are now automatically handled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6397 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../DataStructure/PgmDependenceGraph.cpp | 6 ++---- lib/Analysis/IPA/PgmDependenceGraph.cpp | 6 ++---- lib/Target/CBackend/CBackend.cpp | 4 ++-- lib/Target/CBackend/Writer.cpp | 4 ++-- lib/Transforms/ExprTypeConvert.cpp | 2 +- lib/Transforms/Utils/DemoteRegToStack.cpp | 18 ++++++++---------- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/lib/Analysis/DataStructure/PgmDependenceGraph.cpp b/lib/Analysis/DataStructure/PgmDependenceGraph.cpp index 63a0cdf0899..705a9449db7 100644 --- a/lib/Analysis/DataStructure/PgmDependenceGraph.cpp +++ b/lib/Analysis/DataStructure/PgmDependenceGraph.cpp @@ -15,15 +15,13 @@ // The MemoryDepAnalysis does build an explicit graph, which is used internally // here. That graph could be augmented with the other dependences above if // desired, but for most uses there will be little need to do that. +// //===----------------------------------------------------------------------===// #include "llvm/Analysis/PgmDependenceGraph.h" #include "llvm/Analysis/MemoryDepAnalysis.h" #include "llvm/Analysis/PostDominators.h" #include "llvm/Function.h" -#include "llvm/BasicBlock.h" -#include "llvm/Instruction.h" - //---------------------------------------------------------------------------- @@ -78,7 +76,7 @@ bool DepIterState::SetFirstSSADep() if (doIncomingDeps) for (Instruction::op_iterator E = depNode->getInstr().op_end(); ssaInEdgeIter != E && - (firstTarget = dyn_cast(ssaInEdgeIter->get()))== NULL; ) + (firstTarget = dyn_cast(ssaInEdgeIter))== NULL; ) ++ssaInEdgeIter; else for (Value::use_iterator E = depNode->getInstr().use_end(); diff --git a/lib/Analysis/IPA/PgmDependenceGraph.cpp b/lib/Analysis/IPA/PgmDependenceGraph.cpp index 63a0cdf0899..705a9449db7 100644 --- a/lib/Analysis/IPA/PgmDependenceGraph.cpp +++ b/lib/Analysis/IPA/PgmDependenceGraph.cpp @@ -15,15 +15,13 @@ // The MemoryDepAnalysis does build an explicit graph, which is used internally // here. That graph could be augmented with the other dependences above if // desired, but for most uses there will be little need to do that. +// //===----------------------------------------------------------------------===// #include "llvm/Analysis/PgmDependenceGraph.h" #include "llvm/Analysis/MemoryDepAnalysis.h" #include "llvm/Analysis/PostDominators.h" #include "llvm/Function.h" -#include "llvm/BasicBlock.h" -#include "llvm/Instruction.h" - //---------------------------------------------------------------------------- @@ -78,7 +76,7 @@ bool DepIterState::SetFirstSSADep() if (doIncomingDeps) for (Instruction::op_iterator E = depNode->getInstr().op_end(); ssaInEdgeIter != E && - (firstTarget = dyn_cast(ssaInEdgeIter->get()))== NULL; ) + (firstTarget = dyn_cast(ssaInEdgeIter))== NULL; ) ++ssaInEdgeIter; else for (Value::use_iterator E = depNode->getInstr().use_end(); diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index bfd6bc953e8..df95757200b 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -694,7 +694,7 @@ void CWriter::printContainedStructs(const Type *Ty, E = STy->getElementTypes().end(); I != E; ++I) { const Type *Ty1 = I->get(); if (isa(Ty1) || isa(Ty1)) - printContainedStructs(Ty1, StructPrinted); + printContainedStructs(*I, StructPrinted); } //Print structure type out.. @@ -1121,7 +1121,7 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I, return; } - const Constant *CI = dyn_cast(I->get()); + const Constant *CI = dyn_cast(I); if (HasImplicitAddress && (!CI || !CI->isNullValue())) Out << "(&"; diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index bfd6bc953e8..df95757200b 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -694,7 +694,7 @@ void CWriter::printContainedStructs(const Type *Ty, E = STy->getElementTypes().end(); I != E; ++I) { const Type *Ty1 = I->get(); if (isa(Ty1) || isa(Ty1)) - printContainedStructs(Ty1, StructPrinted); + printContainedStructs(*I, StructPrinted); } //Print structure type out.. @@ -1121,7 +1121,7 @@ void CWriter::printIndexingExpression(Value *Ptr, User::op_iterator I, return; } - const Constant *CI = dyn_cast(I->get()); + const Constant *CI = dyn_cast(I); if (HasImplicitAddress && (!CI || !CI->isNullValue())) Out << "(&"; diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index f8d5d1687f0..b7936377e76 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -1257,7 +1257,7 @@ static void RecursiveDelete(ValueMapCache &Cache, Instruction *I) { for (User::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) - if (Instruction *U = dyn_cast(OI->get())) { + if (Instruction *U = dyn_cast(OI)) { *OI = 0; RecursiveDelete(Cache, U); } diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index 76725ec14e0..0f547028969 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -1,14 +1,14 @@ //===- DemoteRegToStack.cpp - Move a virtual reg. to stack ------*- C++ -*-===// // -// This file provide the function DemoteRegToStack(). -// This function takes a virtual register computed by an -// Instruction& X and replaces it with a slot in the stack frame, -// allocated via alloca. It returns the pointer to the AllocaInst inserted. +// This file provide the function DemoteRegToStack(). This function takes a +// virtual register computed by an Instruction& X and replaces it with a slot in +// the stack frame, allocated via alloca. It returns the pointer to the +// AllocaInst inserted. +// //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/DemoteRegToStack.h" #include "llvm/Function.h" -#include "llvm/BasicBlock.h" #include "llvm/iMemory.h" #include "llvm/iPHINode.h" #include "llvm/iTerminators.h" @@ -16,7 +16,6 @@ #include "Support/hash_set" #include - //---------------------------------------------------------------------------- // function DemoteRegToStack() // @@ -28,11 +27,10 @@ typedef hash_set::iterator PhiSetIterator; // Helper function to push a phi *and* all its operands to the worklist! // Do not push an instruction if it is already in the result set of Phis to go. inline void PushOperandsOnWorkList(std::stack& workList, - PhiSet& phisToGo, PHINode* phiN) -{ - for (User::op_iterator OI=phiN->op_begin(), OE=phiN->op_end(); + PhiSet& phisToGo, PHINode* phiN) { + for (User::op_iterator OI = phiN->op_begin(), OE = phiN->op_end(); OI != OE; ++OI) - if (Instruction* opI = dyn_cast(OI->get())) + if (Instruction* opI = dyn_cast(OI)) if (!isa(opI) || phisToGo.find(cast(opI)) == phisToGo.end()) workList.push(opI);