For PR786:

Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2006-11-02 20:25:50 +00:00
parent ef42a01113
commit 3ed469ccd7
80 changed files with 1927 additions and 1930 deletions

View File

@ -382,8 +382,8 @@ endif
# Options To Invoke Tools
#----------------------------------------------------------
CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -Wno-long-long \
-pedantic $(EXTRA_OPTIONS)
CompileCommonOpts := -pedantic -Wall -W -Wwrite-strings -Wno-long-long \
-Wunused -Wno-unused-parameter $(EXTRA_OPTIONS)
ifeq ($(OS),HP-UX)
CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE

View File

@ -399,7 +399,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
}
if (V1Size != ~0U && V2Size != ~0U)
if (const User *GEP = isGEP(V1)) {
if (isGEP(V1)) {
std::vector<Value*> GEPOperands;
const Value *BasePtr = GetGEPOperands(V1, GEPOperands);

View File

@ -512,7 +512,6 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
// try merge with NewTy: struct {t1, t2, stuff...} if offset lands exactly on a field in Ty
if (isa<StructType>(NewTy) && isa<StructType>(Ty)) {
DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n");
unsigned O = 0;
const StructType *STy = cast<StructType>(Ty);
const StructLayout &SL = *TD.getStructLayout(STy);
unsigned i = SL.getElementContainingOffset(Offset);
@ -537,7 +536,6 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
//try merge with NewTy: struct : {t1, t2, T} if offset lands on a field in Ty
if (isa<StructType>(Ty)) {
DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n");
unsigned O = 0;
const StructType *STy = cast<StructType>(Ty);
const StructLayout &SL = *TD.getStructLayout(STy);
unsigned i = SL.getElementContainingOffset(Offset);
@ -1280,9 +1278,9 @@ DSNode *DSGraph::addObjectToGraph(Value *Ptr, bool UseDeclaredType) {
if (GlobalValue *GV = dyn_cast<GlobalValue>(Ptr)) {
N->addGlobal(GV);
} else if (MallocInst *MI = dyn_cast<MallocInst>(Ptr)) {
} else if (isa<MallocInst>(Ptr)) {
N->setHeapNodeMarker();
} else if (AllocaInst *AI = dyn_cast<AllocaInst>(Ptr)) {
} else if (isa<AllocaInst>(Ptr)) {
N->setAllocaNodeMarker();
} else {
assert(0 && "Illegal memory object input!");
@ -1777,8 +1775,10 @@ static void removeIdenticalCalls(std::list<DSCallSite> &Calls) {
// Scan the call list cleaning it up as necessary...
DSNodeHandle LastCalleeNode;
#if 0
Function *LastCalleeFunc = 0;
unsigned NumDuplicateCalls = 0;
#endif
bool LastCalleeContainsExternalFunction = false;
unsigned NumDeleted = 0;
@ -2187,7 +2187,6 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
} while (Iterate);
// Move dead aux function calls to the end of the list
unsigned CurIdx = 0;
for (std::list<DSCallSite>::iterator CI = AuxFunctionCalls.begin(),
E = AuxFunctionCalls.end(); CI != E; )
if (AuxFCallsAlive.count(&*CI))

View File

@ -256,8 +256,6 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
for (++SI; SI != FuncECs.member_end(); ++SI) {
Function *F = *SI;
DSGraph *&FG = DSInfo[F];
DSGraph &CBUGraph = CBU->getDSGraph(*F);
if (GraphsMerged.insert(&CBUGraph).second) {
// Record the "folded" graph for the function.

View File

@ -409,7 +409,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) {
unsigned FieldNo =
(unsigned)cast<ConstantInt>(I.getOperand())->getZExtValue();
Offset += (unsigned)TD.getStructLayout(STy)->MemberOffsets[FieldNo];
} else if (const PointerType *PTy = dyn_cast<PointerType>(*I)) {
} else if (isa<PointerType>(*I)) {
if (!isa<Constant>(I.getOperand()) ||
!cast<Constant>(I.getOperand())->isNullValue())
Value.getNode()->setArrayMarker();

View File

@ -374,7 +374,6 @@ Andersens::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
if (Function *F = CS.getCalledFunction())
if (F->isExternal()) {
Node *N1 = getNode(P);
bool PointsToUniversalSet = false;
if (N1->begin() == N1->end())
return NoModRef; // P doesn't point to anything.

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,18 @@ void set_scan_string (const char * str) {
yy_scan_string (str);
}
// Construct a token value for a non-obsolete token
#define RET_TOK(type, Enum, sym) \
llvmAsmlval.type = Instruction::Enum; return sym
llvmAsmlval.type.opcode = Instruction::Enum; \
llvmAsmlval.type.obsolete = false; \
return sym
// Construct a token value for an obsolete token
#define RET_TOK_OBSOLETE(type, Enum, sym) \
llvmAsmlval.type.opcode = Instruction::Enum; \
llvmAsmlval.type.obsolete = true; \
return sym
namespace llvm {
@ -247,8 +257,14 @@ opaque { return OPAQUE; }
add { RET_TOK(BinaryOpVal, Add, ADD); }
sub { RET_TOK(BinaryOpVal, Sub, SUB); }
mul { RET_TOK(BinaryOpVal, Mul, MUL); }
div { RET_TOK(BinaryOpVal, Div, DIV); }
rem { RET_TOK(BinaryOpVal, Rem, REM); }
div { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); }
udiv { RET_TOK(BinaryOpVal, UDiv, UDIV); }
sdiv { RET_TOK(BinaryOpVal, SDiv, SDIV); }
fdiv { RET_TOK(BinaryOpVal, FDiv, FDIV); }
rem { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); }
urem { RET_TOK(BinaryOpVal, URem, UREM); }
srem { RET_TOK(BinaryOpVal, SRem, SREM); }
frem { RET_TOK(BinaryOpVal, FRem, FREM); }
and { RET_TOK(BinaryOpVal, And, AND); }
or { RET_TOK(BinaryOpVal, Or , OR ); }
xor { RET_TOK(BinaryOpVal, Xor, XOR); }

File diff suppressed because it is too large Load Diff

View File

@ -110,33 +110,35 @@
UDIV = 336,
SDIV = 337,
FDIV = 338,
REM = 339,
AND = 340,
OR = 341,
XOR = 342,
SETLE = 343,
SETGE = 344,
SETLT = 345,
SETGT = 346,
SETEQ = 347,
SETNE = 348,
MALLOC = 349,
ALLOCA = 350,
FREE = 351,
LOAD = 352,
STORE = 353,
GETELEMENTPTR = 354,
PHI_TOK = 355,
CAST = 356,
SELECT = 357,
SHL = 358,
SHR = 359,
VAARG = 360,
EXTRACTELEMENT = 361,
INSERTELEMENT = 362,
SHUFFLEVECTOR = 363,
VAARG_old = 364,
VANEXT_old = 365
UREM = 339,
SREM = 340,
FREM = 341,
AND = 342,
OR = 343,
XOR = 344,
SETLE = 345,
SETGE = 346,
SETLT = 347,
SETGT = 348,
SETEQ = 349,
SETNE = 350,
MALLOC = 351,
ALLOCA = 352,
FREE = 353,
LOAD = 354,
STORE = 355,
GETELEMENTPTR = 356,
PHI_TOK = 357,
CAST = 358,
SELECT = 359,
SHL = 360,
SHR = 361,
VAARG = 362,
EXTRACTELEMENT = 363,
INSERTELEMENT = 364,
SHUFFLEVECTOR = 365,
VAARG_old = 366,
VANEXT_old = 367
};
#endif
/* Tokens. */
@ -221,39 +223,41 @@
#define UDIV 336
#define SDIV 337
#define FDIV 338
#define REM 339
#define AND 340
#define OR 341
#define XOR 342
#define SETLE 343
#define SETGE 344
#define SETLT 345
#define SETGT 346
#define SETEQ 347
#define SETNE 348
#define MALLOC 349
#define ALLOCA 350
#define FREE 351
#define LOAD 352
#define STORE 353
#define GETELEMENTPTR 354
#define PHI_TOK 355
#define CAST 356
#define SELECT 357
#define SHL 358
#define SHR 359
#define VAARG 360
#define EXTRACTELEMENT 361
#define INSERTELEMENT 362
#define SHUFFLEVECTOR 363
#define VAARG_old 364
#define VANEXT_old 365
#define UREM 339
#define SREM 340
#define FREM 341
#define AND 342
#define OR 343
#define XOR 344
#define SETLE 345
#define SETGE 346
#define SETLT 347
#define SETGT 348
#define SETEQ 349
#define SETNE 350
#define MALLOC 351
#define ALLOCA 352
#define FREE 353
#define LOAD 354
#define STORE 355
#define GETELEMENTPTR 356
#define PHI_TOK 357
#define CAST 358
#define SELECT 359
#define SHL 360
#define SHR 361
#define VAARG 362
#define EXTRACTELEMENT 363
#define INSERTELEMENT 364
#define SHUFFLEVECTOR 365
#define VAARG_old 366
#define VANEXT_old 367
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 1011 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
#line 1016 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
@ -294,7 +298,7 @@ typedef union YYSTYPE {
llvm::Module::Endianness Endianness;
} YYSTYPE;
/* Line 1447 of yacc.c. */
#line 298 "llvmAsmParser.tab.h"
#line 302 "llvmAsmParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -836,7 +836,7 @@ sanitizeOpCode(OpcodeInfo<Instruction::BinaryOps> &OI, const PATypeHolder& PATy)
// Depending on the opcode ..
switch (OI.opcode) {
default:
GenerateError("Invalid Obsolete OpCode");
GenerateError("Invalid obsolete opCode (check Lexer.l)");
break;
case Instruction::UDiv:
// Handle cases where the opcode needs to change
@ -845,12 +845,17 @@ sanitizeOpCode(OpcodeInfo<Instruction::BinaryOps> &OI, const PATypeHolder& PATy)
else if (Ty->isSigned())
OI.opcode = Instruction::SDiv;
break;
case Instruction::URem:
if (Ty->isFloatingPoint())
OI.opcode = Instruction::FRem;
else if (Ty->isSigned())
OI.opcode = Instruction::SRem;
break;
}
// Its not obsolete any more, we fixed it.
OI.obsolete = false;
}
// common code from the two 'RunVMAsmParser' functions
static Module* RunParser(Module * M) {
@ -1113,7 +1118,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
// Binary Operators
%type <BinaryOpVal> ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
%token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
// Memory Instructions
@ -1151,7 +1156,7 @@ EINT64VAL : EUINT64VAL {
// Operations that are notably excluded from this list include:
// RET, BR, & SWITCH because they end basic blocks and are treated specially.
//
ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ;
ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM;
LogicalOps : AND | OR | XOR;
SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
@ -2465,8 +2470,11 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
!isa<PackedType>((*$2).get()))
GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands!");
if (isa<PackedType>((*$2).get()) && $1.opcode == Instruction::Rem)
GEN_ERROR("Rem not supported on packed types!");
if (isa<PackedType>((*$2).get()) &&
($1.opcode == Instruction::URem ||
$1.opcode == Instruction::SRem ||
$1.opcode == Instruction::FRem))
GEN_ERROR("U/S/FRem not supported on packed types!");
// Upgrade the opcode from obsolete versions before we do anything with it.
sanitizeOpCode($1,*$2);
CHECK_FOR_ERROR;

View File

@ -1383,7 +1383,6 @@ void BytecodeReader::ParseSymbolTable(Function *CurrentFunction,
unsigned NumEntries = read_vbr_uint();
unsigned Typ = 0;
bool isTypeType = read_typeid(Typ);
const Type *Ty = getType(Typ);
for (unsigned i = 0; i != NumEntries; ++i) {
// Symtab entry: [def slot #][name]

View File

@ -1273,7 +1273,7 @@ void llvm::WriteBytecodeToFile(const Module *M, std::ostream &Out,
Out.write(compressed_magic,4);
// Compress everything after the magic number (which we altered)
uint64_t zipSize = Compressor::compressToStream(
Compressor::compressToStream(
(char*)(FirstByte+4), // Skip the magic number
Buffer.size()-4, // Skip the magic number
Out // Where to write compressed data

View File

@ -766,7 +766,6 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
// Analyze the branch at the end of the pred.
MachineBasicBlock *PredBB = *PI;
MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough;
MachineBasicBlock *PredTBB = 0, *PredFBB = 0;
std::vector<MachineOperand> PredCond;
if (PredBB != MBB && !CanFallThrough(PredBB)) {
MBB->moveAfter(PredBB);
@ -781,7 +780,6 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
// Analyze the branch at the end of the block before the succ.
MachineBasicBlock *SuccBB = *SI;
MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev;
MachineBasicBlock *SuccPrevTBB = 0, *SuccPrevFBB = 0;
std::vector<MachineOperand> SuccPrevCond;
if (SuccBB != MBB && !CanFallThrough(SuccPrev)) {
MBB->moveBefore(SuccBB);

View File

@ -2132,7 +2132,6 @@ private:
} else {
EmitInt8(DW_CFA_def_cfa);
EOL("DW_CFA_def_cfa");
EmitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister()));
EOL("Register");
}

View File

@ -113,7 +113,6 @@ void ELFCodeEmitter::startFunction(MachineFunction &F) {
// Add padding zeros to the end of the buffer to make sure that the
// function will start on the correct byte alignment within the section.
size_t SectionOff = OutBuffer->size();
ELFWriter::align(*OutBuffer, Align);
FnStart = OutBuffer->size();

View File

@ -289,7 +289,6 @@ void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments,
//
// Also, if one range is a physreg and one is a vreg, we always merge from the
// vreg into the physreg, which leaves the vreg intervals pristine.
unsigned OtherOffs = 1, ThisOffs = 0;
if ((Other.ranges.size() > ranges.size() &&
MRegisterInfo::isVirtualRegister(reg)) ||
MRegisterInfo::isPhysicalRegister(Other.reg)) {

View File

@ -184,7 +184,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
if (tii_->isMoveInstr(*mii, srcReg, dstReg) &&
(RegRep = rep(srcReg)) == rep(dstReg)) {
// remove from def list
LiveInterval &interval = getOrCreateInterval(RegRep);
getOrCreateInterval(RegRep);
RemoveMachineInstrFromMaps(mii);
mii = mbbi->erase(mii);
++numPeep;

View File

@ -223,7 +223,6 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
for (df_ext_iterator<MachineBasicBlock*> DFI = df_ext_begin(Entry, Visited),
E = df_ext_end(Entry, Visited); DFI != E; ++DFI) {
MachineBasicBlock *MBB = *DFI;
unsigned BBNum = MBB->getNumber();
// Loop over all of the instructions, processing them.
for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end();

View File

@ -1041,7 +1041,6 @@ SDOperand DAGCombiner::visitAND(SDNode *N) {
ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0);
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
MVT::ValueType VT = N1.getValueType();
unsigned OpSizeInBits = MVT::getSizeInBits(VT);
// fold (and c1, c2) -> c1&c2
if (N0C && N1C)
@ -1319,7 +1318,7 @@ SDOperand DAGCombiner::visitOR(SDNode *N) {
/// MatchRotateHalf - Match "(X shl/srl V1) & V2" where V2 may not be present.
static bool MatchRotateHalf(SDOperand Op, SDOperand &Shift, SDOperand &Mask) {
if (Op.getOpcode() == ISD::AND) {
if (ConstantSDNode *RHSC = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
if (isa<ConstantSDNode>(Op.getOperand(1))) {
Mask = Op.getOperand(1);
Op = Op.getOperand(0);
} else {
@ -1856,9 +1855,6 @@ SDOperand DAGCombiner::visitSELECT_CC(SDNode *N) {
SDOperand N2 = N->getOperand(2);
SDOperand N3 = N->getOperand(3);
SDOperand N4 = N->getOperand(4);
ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0);
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2);
ISD::CondCode CC = cast<CondCodeSDNode>(N4)->get();
// fold select_cc lhs, rhs, x, x, cc -> x
@ -1900,7 +1896,7 @@ SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
MVT::ValueType VT = N->getValueType(0);
// fold (sext c1) -> c1
if (ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0))
if (isa<ConstantSDNode>(N0))
return DAG.getNode(ISD::SIGN_EXTEND, VT, N0);
// fold (sext (sext x)) -> (sext x)
@ -1958,7 +1954,7 @@ SDOperand DAGCombiner::visitZERO_EXTEND(SDNode *N) {
MVT::ValueType VT = N->getValueType(0);
// fold (zext c1) -> c1
if (ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0))
if (isa<ConstantSDNode>(N0))
return DAG.getNode(ISD::ZERO_EXTEND, VT, N0);
// fold (zext (zext x)) -> (zext x)
// fold (zext (aext x)) -> (zext x)
@ -3578,7 +3574,7 @@ SDOperand DAGCombiner::SimplifySetCC(MVT::ValueType VT, SDOperand N0,
if (ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.Val)) {
uint64_t C1 = N1C->getValue();
if (ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0.Val)) {
if (isa<ConstantSDNode>(N0.Val)) {
return DAG.FoldSetCC(VT, N0, N1, Cond);
} else {
// If the LHS is '(srl (ctlz x), 5)', the RHS is 0/1, and this is an
@ -3806,7 +3802,7 @@ SDOperand DAGCombiner::SimplifySetCC(MVT::ValueType VT, SDOperand N0,
return DAG.getSetCC(VT, N1, N0, ISD::getSetCCSwappedOperands(Cond));
}
if (ConstantFPSDNode *N0C = dyn_cast<ConstantFPSDNode>(N0.Val)) {
if (isa<ConstantFPSDNode>(N0.Val)) {
// Constant fold or commute setcc.
SDOperand O = DAG.FoldSetCC(VT, N0, N1, Cond);
if (O.Val) return O;

View File

@ -3690,7 +3690,6 @@ SDOperand SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) {
SmallVector<SDOperand, 8> Stores;
unsigned TypeByteSize =
MVT::getSizeInBits(Node->getOperand(0).getValueType())/8;
unsigned VectorSize = MVT::getSizeInBits(VT)/8;
// Store (in the right endianness) the elements to memory.
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
// Ignore undef elements.
@ -4802,7 +4801,6 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
bool HasMULHS = TLI.isOperationLegal(ISD::MULHS, NVT);
bool HasMULHU = TLI.isOperationLegal(ISD::MULHU, NVT);
bool UseLibCall = true;
if (HasMULHS || HasMULHU) {
SDOperand LL, LH, RL, RH;
ExpandOp(Node->getOperand(0), LL, LH);

View File

@ -257,7 +257,6 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
// While Available queue is not empty, grab the node with the highest
// priority. If it is not ready put it back. Schedule the node.
std::vector<SUnit*> NotReady;
SUnit *CurNode = NULL;
while (!AvailableQueue->empty()) {
SUnit *CurNode = AvailableQueue->pop();
while (CurNode && !isReady(CurNode, CurCycle)) {
@ -373,7 +372,6 @@ void ScheduleDAGRRList::ListScheduleTopDown() {
// While Available queue is not empty, grab the node with the highest
// priority. If it is not ready put it back. Schedule the node.
std::vector<SUnit*> NotReady;
SUnit *CurNode = NULL;
while (!AvailableQueue->empty()) {
SUnit *CurNode = AvailableQueue->pop();
while (CurNode && !isReady(CurNode, CurCycle)) {

View File

@ -505,7 +505,6 @@ enum {
RSLoadStore = 0x0C000000, // Two load store units
RSBranch = 0x02000000 // One branch unit
};
static InstrStage CallStage = { CallLatency, RSBranch };
static InstrStage LoadStage = { 5, RSLoadStore };
static InstrStage StoreStage = { 2, RSLoadStore };
static InstrStage IntStage = { 2, RSInteger };

View File

@ -1956,7 +1956,6 @@ UpdateNodeOperands(SDOperand InN, SDOperand Op1, SDOperand Op2) {
assert(N->getNumOperands() == 2 && "Update with wrong number of operands");
// Check to see if there is no change.
bool AnyChange = false;
if (Op1 == N->getOperand(0) && Op2 == N->getOperand(1))
return InN; // No operands changed, just return the input node.

View File

@ -2343,11 +2343,6 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
SDOperand AsmStr = DAG.getTargetExternalSymbol(IA->getAsmString().c_str(),
MVT::Other);
// Note, we treat inline asms both with and without side-effects as the same.
// If an inline asm doesn't have side effects and doesn't access memory, we
// could not choose to not chain it.
bool hasSideEffects = IA->hasSideEffects();
std::vector<InlineAsm::ConstraintInfo> Constraints = IA->ParseConstraints();
std::vector<MVT::ValueType> ConstraintVTs;
@ -3124,7 +3119,6 @@ static SDOperand getMemsetValue(SDOperand Value, MVT::ValueType VT,
static SDOperand getMemsetStringVal(MVT::ValueType VT,
SelectionDAG &DAG, TargetLowering &TLI,
std::string &Str, unsigned Offset) {
MVT::ValueType CurVT = VT;
uint64_t Val = 0;
unsigned MSB = getSizeInBits(VT) / 8;
if (TLI.isLittleEndian())

View File

@ -504,7 +504,6 @@ bool TargetLowering::SimplifyDemandedBits(SDOperand Op, uint64_t DemandedMask,
}
break;
case ISD::SIGN_EXTEND_INREG: {
MVT::ValueType VT = Op.getValueType();
MVT::ValueType EVT = cast<VTSDNode>(Op.getOperand(1))->getVT();
// Sign extension. Compute the demanded bits in the result that are not
@ -852,7 +851,6 @@ void TargetLowering::ComputeMaskedBits(SDOperand Op, uint64_t Mask,
}
return;
case ISD::SIGN_EXTEND_INREG: {
MVT::ValueType VT = Op.getValueType();
MVT::ValueType EVT = cast<VTSDNode>(Op.getOperand(1))->getVT();
// Sign extension. Compute the demanded bits in the result that are not

View File

@ -61,7 +61,7 @@ static const GlobalVariable *getNextStopPoint(const Value *V, unsigned &LineNo,
// If we found a stop point, check to see if it is earlier than what we
// already have. If so, remember it.
if (const Function *F = CI->getCalledFunction())
if (CI->getCalledFunction())
if (const DbgStopPointInst *SPI = dyn_cast<DbgStopPointInst>(CI)) {
unsigned CurLineNo = SPI->getLine();
unsigned CurColNo = SPI->getColumn();

View File

@ -906,7 +906,6 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) {
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
if (JT.empty() || JumpTableBase == 0) return;
unsigned Offset = 0;
assert(MJTI->getEntrySize() == sizeof(void*) && "Cross JIT'ing?");
// For each jump table, map each target in the jump table to the address of

View File

@ -23,20 +23,6 @@
#include <set>
using namespace llvm;
/// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
/// name of each externally-visible symbol defined in M.
///
static void
GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
DefinedSymbols.insert(I->getName());
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
DefinedSymbols.insert(I->getName());
}
/// GetAllUndefinedSymbols - calculates the set of undefined symbols that still
/// exist in an LLVM module. This is a bit tricky because there may be two
/// symbols with the same name but different LLVM types that will be resolved to

View File

@ -97,7 +97,6 @@ void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum)
void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
const MRegisterInfo &RI = *TM.getRegisterInfo();
int new_symbol;
switch (MO.getType()) {
case MachineOperand::MO_Register:

View File

@ -92,7 +92,6 @@ void AlphaCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) {
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
I != E; ++I) {
MachineInstr &MI = *I;
unsigned Opcode = MI.getOpcode();
switch(MI.getOpcode()) {
default:
MCE.emitWordLE(getBinaryCodeForInstr(*I));
@ -160,10 +159,6 @@ int AlphaCodeEmitter::getMachineOpValue(MachineInstr &MI, MachineOperand &MO) {
} else if (MO.isGlobalAddress() || MO.isExternalSymbol()
|| MO.isConstantPoolIndex()) {
DEBUG(std::cerr << MO << " is a relocated op for " << MI << "\n";);
bool isExternal = MO.isExternalSymbol() ||
(MO.isGlobalAddress() &&
( MO.getGlobal()->hasWeakLinkage() ||
MO.getGlobal()->isExternal()) );
unsigned Reloc = 0;
int Offset = 0;
bool useGOT = false;

View File

@ -324,7 +324,6 @@ SDNode *AlphaDAGToDAGISel::Select(SDOperand Op) {
// val32 >= IMM_LOW + IMM_LOW * IMM_MULT) //always true
break; //(zext (LDAH (LDA)))
//Else use the constant pool
MachineConstantPool *CP = BB->getParent()->getConstantPool();
ConstantInt *C = ConstantInt::get(Type::ULongTy, uval);
SDOperand CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
SDNode *Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI,

View File

@ -175,8 +175,6 @@ static SDOperand LowerJumpTable(SDOperand Op, SelectionDAG &DAG) {
SDOperand JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT);
SDOperand Zero = DAG.getConstant(0, PtrVT);
const TargetMachine &TM = DAG.getTarget();
SDOperand Hi = DAG.getNode(AlphaISD::GPRelHi, MVT::i64, JTI,
DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
SDOperand Lo = DAG.getNode(AlphaISD::GPRelLo, MVT::i64, JTI, Hi);
@ -207,7 +205,6 @@ static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG,
int &VarArgsOffset) {
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
SSARegMap *RegMap = MF.getSSARegMap();
std::vector<SDOperand> ArgValues;
SDOperand Root = Op.getOperand(0);
@ -225,7 +222,6 @@ static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG,
SDOperand ArgVal;
if (ArgNo < 6) {
unsigned Vreg;
switch (ObjectVT) {
default:
std::cerr << "Unknown Type " << ObjectVT << "\n";
@ -480,7 +476,6 @@ SDOperand AlphaTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
//Expand only on constant case
if (Op.getOperand(1).getOpcode() == ISD::Constant) {
MVT::ValueType VT = Op.Val->getValueType(0);
unsigned Opc = Op.Val->getOpcode() == ISD::UREM ? ISD::UDIV : ISD::SDIV;
SDOperand Tmp1 = Op.Val->getOpcode() == ISD::UREM ?
BuildUDIV(Op.Val, DAG, NULL) :
BuildSDIV(Op.Val, DAG, NULL);

View File

@ -702,7 +702,7 @@ void CWriter::printConstant(Constant *CPV) {
// The prefix for a quiet NaN is 0x7FF8. For a signalling NaN,
// it's 0x7ff4.
const unsigned long QuietNaN = 0x7ff8UL;
const unsigned long SignalNaN = 0x7ff4UL;
//const unsigned long SignalNaN = 0x7ff4UL;
// We need to grab the first part of the FP #
char Buffer[100];
@ -2140,7 +2140,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
gep_type_iterator E) {
bool HasImplicitAddress = false;
// If accessing a global value with no indexing, avoid *(&GV) syndrome
if (GlobalValue *V = dyn_cast<GlobalValue>(Ptr)) {
if (isa<GlobalValue>(Ptr)) {
HasImplicitAddress = true;
} else if (isDirectAlloca(Ptr)) {
HasImplicitAddress = true;

View File

@ -702,7 +702,7 @@ void CWriter::printConstant(Constant *CPV) {
// The prefix for a quiet NaN is 0x7FF8. For a signalling NaN,
// it's 0x7ff4.
const unsigned long QuietNaN = 0x7ff8UL;
const unsigned long SignalNaN = 0x7ff4UL;
//const unsigned long SignalNaN = 0x7ff4UL;
// We need to grab the first part of the FP #
char Buffer[100];
@ -2140,7 +2140,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
gep_type_iterator E) {
bool HasImplicitAddress = false;
// If accessing a global value with no indexing, avoid *(&GV) syndrome
if (GlobalValue *V = dyn_cast<GlobalValue>(Ptr)) {
if (isa<GlobalValue>(Ptr)) {
HasImplicitAddress = true;
} else if (isDirectAlloca(Ptr)) {
HasImplicitAddress = true;

View File

@ -337,11 +337,9 @@ SDNode *IA64DAGToDAGISel::Select(SDOperand Op) {
dyn_cast<GlobalAddressSDNode>(N->getOperand(1))) {
CallOpcode = IA64::BRCALL_IPREL_GA;
CallOperand = CurDAG->getTargetGlobalAddress(GASD->getGlobal(), MVT::i64);
} else if (ExternalSymbolSDNode *ESSDN = // FIXME: we currently NEED this
// case for correctness, to avoid
// "non-pic code with imm reloc.n
// against dynamic symbol" errors
dyn_cast<ExternalSymbolSDNode>(N->getOperand(1))) {
} else if (isa<ExternalSymbolSDNode>(N->getOperand(1))) {
// FIXME: we currently NEED this case for correctness, to avoid
// "non-pic code with imm reloc.n against dynamic symbol" errors
CallOpcode = IA64::BRCALL_IPREL_ES;
CallOperand = N->getOperand(1);
} else {

View File

@ -249,7 +249,6 @@ namespace {
DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM,
const TargetAsmInfo *T)
: PPCAsmPrinter(O, TM, T), DW(O, this, T) {
bool isPPC64 = Subtarget.isPPC64();
}
virtual const char *getPassName() const {
@ -308,7 +307,6 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
// Computing the address of a global symbol, not calling it.
GlobalValue *GV = MO.getGlobal();
std::string Name = Mang->getValueName(GV);
int offset = MO.getOffset();
// External or weakly linked global variables need non-lazily-resolved stubs
if (TM.getRelocationModel() != Reloc::Static) {

View File

@ -91,7 +91,6 @@ void PPCCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) {
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E; ++I){
MachineInstr &MI = *I;
unsigned Opcode = MI.getOpcode();
switch (MI.getOpcode()) {
default:
MCE.emitWordBE(getBinaryCodeForInstr(*I));

View File

@ -1134,7 +1134,6 @@ SDNode *PPCDAGToDAGISel::Select(SDOperand Op) {
SDOperand CCReg = SelectCC(N->getOperand(0), N->getOperand(1), CC);
unsigned BROpc = getBCCForSetCC(CC);
bool isFP = MVT::isFloatingPoint(N->getValueType(0));
unsigned SelectCCOp;
if (N->getValueType(0) == MVT::i32)
SelectCCOp = PPC::SELECT_CC_I4;
@ -1218,7 +1217,6 @@ SDNode *PPCDAGToDAGISel::MySelect_PPCcall(SDOperand N) {
SDOperand Chain(0, 0);
SDOperand N1(0, 0);
SDOperand Tmp0(0, 0);
SDNode *ResNode;
Chain = N.getOperand(0);
N1 = N.getOperand(1);

View File

@ -942,9 +942,7 @@ static SDNode *isBLACompatibleAddress(SDOperand Op, SelectionDAG &DAG) {
static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
SDOperand Callee = Op.getOperand(4);
unsigned NumOps = (Op.getNumOperands() - 5) / 2;

View File

@ -99,7 +99,7 @@ void PPCMachOWriter::GetTargetRelocation(MachineRelocation &MR,
case PPC::reloc_pcrel_bx:
Addr -= MR.getMachineCodeOffset();
Addr >>= 2;
Addr & 0xFFFFFF;
// ??? Addr & 0xFFFFFF; Possibly this was supposed to be Addr &= 0xFFFFFF ?
Addr <<= 2;
Addr |= (MOS.SectionData[MR.getMachineCodeOffset()] << 24);
fixword(MOS.SectionData, Addr, MR.getMachineCodeOffset());

View File

@ -370,7 +370,6 @@ MachineInstr *PPCRegisterInfo::foldMemoryOperand(MachineInstr *MI,
//
static bool hasFP(const MachineFunction &MF) {
const MachineFrameInfo *MFI = MF.getFrameInfo();
unsigned TargetAlign = MF.getTarget().getFrameInfo()->getStackAlignment();
// If frame pointers are forced, or if there are variable sized stack objects,
// use a frame pointer.

View File

@ -185,8 +185,6 @@ void SparcAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum,
return;
}
MachineOperand::MachineOperandType OpTy = MI->getOperand(opNum+1).getType();
if (MI->getOperand(opNum+1).isRegister() &&
MI->getOperand(opNum+1).getReg() == SP::G0)
return; // don't print "+%g0"

View File

@ -106,7 +106,6 @@ namespace {
bool isAtTop(unsigned RegNo) const { return getSlot(RegNo) == StackTop-1; }
void moveToTop(unsigned RegNo, MachineBasicBlock::iterator &I) {
if (!isAtTop(RegNo)) {
unsigned Slot = getSlot(RegNo);
unsigned STReg = getSTReg(RegNo);
unsigned RegOnTop = getStackEntry(0);

View File

@ -532,7 +532,6 @@ SDOperand X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG &DAG)
SDOperand X86TargetLowering::LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
SDOperand Callee = Op.getOperand(4);
MVT::ValueType RetVT= Op.Val->getValueType(0);
@ -1031,7 +1030,6 @@ X86TargetLowering::LowerX86_64CCCArguments(SDOperand Op, SelectionDAG &DAG) {
SDOperand
X86TargetLowering::LowerX86_64CCCCallTo(SDOperand Op, SelectionDAG &DAG) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
SDOperand Callee = Op.getOperand(4);
@ -1528,8 +1526,6 @@ X86TargetLowering::LowerFastCCArguments(SDOperand Op, SelectionDAG &DAG) {
SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG,
bool isFastCall) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
SDOperand Callee = Op.getOperand(4);
MVT::ValueType RetVT= Op.Val->getValueType(0);
@ -1549,11 +1545,13 @@ SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG,
{ X86::AX, X86::DX },
{ X86::EAX, X86::EDX }
};
#if 0
static const unsigned FastCallGPRArgRegs[][2] = {
{ X86::CL, X86::DL },
{ X86::CX, X86::DX },
{ X86::ECX, X86::EDX }
};
#endif
static const unsigned XMMArgRegs[] = {
X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3
};
@ -1906,7 +1904,6 @@ SDOperand X86TargetLowering::LowerStdCallCCArguments(SDOperand Op,
SDOperand X86TargetLowering::LowerStdCallCCCallTo(SDOperand Op,
SelectionDAG &DAG) {
SDOperand Chain = Op.getOperand(0);
unsigned CallingConv= cast<ConstantSDNode>(Op.getOperand(1))->getValue();
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
bool isTailCall = cast<ConstantSDNode>(Op.getOperand(3))->getValue() != 0;
SDOperand Callee = Op.getOperand(4);
@ -2841,7 +2838,7 @@ static bool isSplatMask(SDNode *N) {
unsigned i = 0;
for (; i != NumElems; ++i) {
SDOperand Elt = N->getOperand(i);
if (ConstantSDNode *EltV = dyn_cast<ConstantSDNode>(Elt)) {
if (isa<ConstantSDNode>(Elt)) {
ElementBase = Elt;
break;
}
@ -5431,7 +5428,6 @@ static SDOperand PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
SDOperand X86TargetLowering::PerformDAGCombine(SDNode *N,
DAGCombinerInfo &DCI) const {
TargetMachine &TM = getTargetMachine();
SelectionDAG &DAG = DCI.DAG;
switch (N->getOpcode()) {
default: break;

View File

@ -386,7 +386,6 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
std::string name = Mang->getValueName(I);
Constant *C = I->getInitializer();
unsigned Size = TD->getTypeSize(C->getType());
unsigned Align = TD->getPreferredAlignmentLog(I);
bool bCustomSegment = false;

View File

@ -537,7 +537,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
// a whole structure at a time), so the level raiser must be trying to
// store into the first field. Check for this and allow it now:
//
if (const StructType *SElTy = dyn_cast<StructType>(ElTy)) {
if (isa<StructType>(ElTy)) {
unsigned Offset = 0;
std::vector<Value*> Indices;
ElTy = getStructOffsetType(ElTy, Offset, Indices, TD, false);
@ -799,9 +799,6 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
Value *SrcPtr = VMCI->second;
if (ElTy != NewTy) {
// We check that this is a struct in the initial scan...
const StructType *SElTy = cast<StructType>(ElTy);
std::vector<Value*> Indices;
Indices.push_back(Constant::getNullValue(Type::UIntTy));

View File

@ -259,7 +259,6 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg) const {
// it is safe to unconditionally load the pointer. Use alias analysis to
// check to see if the pointer is guaranteed to not be modified from entry of
// the function to each of the load instructions.
Function &F = *Arg->getParent();
// Because there could be several/many load instructions, remember which
// blocks we know to be transparent to the load.
@ -508,7 +507,6 @@ Function *ArgPromotion::DoPromotion(Function *F,
GetElementPtrInst *GEP = cast<GetElementPtrInst>(I->use_back());
std::vector<Value*> Operands(GEP->op_begin()+1, GEP->op_end());
unsigned ArgNo = 0;
Function::arg_iterator TheArg = I2;
for (ScalarizeTable::iterator It = ArgIndices.begin();
*It != Operands; ++It, ++TheArg) {

View File

@ -1770,7 +1770,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
return false;
InstResult = RetVal;
}
} else if (TerminatorInst *TI = dyn_cast<TerminatorInst>(CurInst)) {
} else if (isa<TerminatorInst>(CurInst)) {
BasicBlock *NewBB = 0;
if (BranchInst *BI = dyn_cast<BranchInst>(CurInst)) {
if (BI->isUnconditional()) {

View File

@ -77,7 +77,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
BasicBlock* bb = new BasicBlock("entry",FN);
Instruction* c = new CastInst(FN->arg_begin(), Type::UIntTy, "c", bb);
Instruction* a = new MallocInst(Type::SByteTy, c, "m", bb);
Instruction* R = new ReturnInst(a, bb);
new ReturnInst(a, bb);
++NumBounce;
NumBounceSites += F->getNumUses();
F->replaceAllUsesWith(FN);

View File

@ -245,7 +245,7 @@ int SimpleInliner::getInlineCost(CallSite CS) {
// significant future optimization possibilities (like scalar promotion, and
// scalarization), so encourage the inlining of the function.
//
else if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) {
else if (isa<AllocaInst>(I)) {
if (ArgNo < CalleeFI.ArgumentWeights.size())
InlineCost -= CalleeFI.ArgumentWeights[ArgNo].AllocaWeight;

View File

@ -129,8 +129,6 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
DEBUG(std::cerr << " Inlining: cost=" << InlineCost
<< ", Call: " << *CS.getInstruction());
Function *Caller = CS.getInstruction()->getParent()->getParent();
// Attempt to inline the function...
if (InlineCallIfPossible(CS, CG, SCCFunctions)) {
// Remove this call site from the list.

View File

@ -496,7 +496,6 @@ void LowerSetJmp::visitInvokeInst(InvokeInst& II)
// If not reachable from a setjmp call, don't transform.
if (!DFSBlocks.count(BB)) return;
BasicBlock* NormalBB = II.getNormalDest();
BasicBlock* ExceptBB = II.getUnwindDest();
Function* Func = BB->getParent();

View File

@ -1106,7 +1106,7 @@ struct LLVMMemCpyMoveOptzn : public LibCallOptimization {
CastInst* DestCast =
new CastInst(dest,PointerType::get(castType),dest->getName()+".cast",ci);
LoadInst* LI = new LoadInst(SrcCast,SrcCast->getName()+".val",ci);
StoreInst* SI = new StoreInst(LI, DestCast, ci);
new StoreInst(LI, DestCast, ci);
ci->eraseFromParent();
return true;
}
@ -2063,7 +2063,7 @@ bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA) {
Constant* INTLZR = GV->getInitializer();
// Handle the ConstantAggregateZero case
if (ConstantAggregateZero *CAZ = dyn_cast<ConstantAggregateZero>(INTLZR)) {
if (isa<ConstantAggregateZero>(INTLZR)) {
// This is a degenerate case. The initializer is constant zero so the
// length of the string must be zero.
len = 0;

View File

@ -580,7 +580,6 @@ static void CollapsePhi(BasicBlock* btarget, BasicBlock* bsrc) {
for(BasicBlock::iterator ib = btarget->begin(), ie = btarget->end();
ib != ie; ++ib)
if (PHINode* phi = dyn_cast<PHINode>(&*ib)) {
unsigned total = phi->getNumIncomingValues();
std::map<BasicBlock*, Value*> counter;
for(unsigned i = 0; i < phi->getNumIncomingValues(); ) {
if (counter[phi->getIncomingBlock(i)]) {

View File

@ -56,7 +56,7 @@ static void InsertInstrumentationCall (BasicBlock *BB,
while (isa<AllocaInst>(InsertPos) || isa<PHINode>(InsertPos))
++InsertPos;
Instruction *InstrCall = new CallInst (InstrFn, Args, "", InsertPos);
new CallInst (InstrFn, Args, "", InsertPos);
}
bool TraceBasicBlocks::runOnModule(Module &M) {

View File

@ -726,7 +726,6 @@ void CEE::InsertRegionExitMerges(PHINode *BBVal, Instruction *OldVal,
const std::vector<BasicBlock*> &RegionExitBlocks) {
assert(BBVal->getType() == OldVal->getType() && "Should be derived values!");
BasicBlock *BB = BBVal->getParent();
BasicBlock *OldSucc = OldVal->getParent();
// Loop over all of the blocks we have to place PHIs in, doing it.
for (unsigned i = 0, e = RegionExitBlocks.size(); i != e; ++i) {

View File

@ -2579,8 +2579,6 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
}
Instruction *InstCombiner::visitFRem(BinaryOperator &I) {
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
return commonRemTransforms(I);
}
@ -3109,7 +3107,6 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
{
Value *A = 0, *B = 0;
ConstantInt *C1 = 0, *C2 = 0;
if (match(Op0, m_Or(m_Value(A), m_Value(B))))
if (A == Op1 || B == Op1) // (A | ?) & A --> A
return ReplaceInstUsesWith(I, Op1);
@ -5510,7 +5507,7 @@ static bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
// If the first operand is itself a cast, and is eliminable, do not count
// this as an eliminable cast. We would prefer to eliminate those two
// casts first.
if (CastInst *OpCast = dyn_cast<CastInst>(I->getOperand(0)))
if (isa<CastInst>(I->getOperand(0)))
return true;
++NumCastsRemoved;
@ -6192,7 +6189,6 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
if (Instruction *TI = dyn_cast<Instruction>(TrueVal))
if (Instruction *FI = dyn_cast<Instruction>(FalseVal))
if (TI->hasOneUse() && FI->hasOneUse()) {
bool isInverse = false;
Instruction *AddOp = 0, *SubOp = 0;
// Turn (select C, (op X, Y), (op X, Z)) -> (op X, (select C, Y, Z))
@ -6971,7 +6967,7 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {
// Insert and return the new operation.
if (isa<CastInst>(FirstInst))
return new CastInst(PhiVal, PN.getType());
else if (LoadInst *LI = dyn_cast<LoadInst>(FirstInst))
else if (isa<LoadInst>(FirstInst))
return new LoadInst(PhiVal, "", isVolatile);
else if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(FirstInst))
return BinaryOperator::create(BinOp->getOpcode(), PhiVal, ConstantOp);
@ -7327,7 +7323,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
// If the index will be to exactly the right offset with the scale taken
// out, perform the transformation.
if (Scale && Scale->getZExtValue() % ArrayEltSize == 0) {
if (ConstantInt *C = dyn_cast<ConstantInt>(Scale))
if (isa<ConstantInt>(Scale))
Scale = ConstantInt::get(Scale->getType(),
Scale->getZExtValue() / ArrayEltSize);
if (Scale->getZExtValue() != 1) {
@ -7501,7 +7497,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
Value *Op = LI.getOperand(0);
// load (cast X) --> cast (load X) iff safe
if (CastInst *CI = dyn_cast<CastInst>(Op))
if (isa<CastInst>(Op))
if (Instruction *Res = InstCombineLoadCast(*this, LI))
return Res;
@ -7728,7 +7724,7 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
// If the pointer destination is a cast, see if we can fold the cast into the
// source instead.
if (CastInst *CI = dyn_cast<CastInst>(Ptr))
if (isa<CastInst>(Ptr))
if (Instruction *Res = InstCombineStoreToCast(*this, SI))
return Res;
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
@ -8015,7 +8011,7 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
InsertNewInstBefore(newEI1, EI);
return BinaryOperator::create(BO->getOpcode(), newEI0, newEI1);
}
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
} else if (isa<LoadInst>(I)) {
Value *Ptr = InsertCastBefore(I->getOperand(0),
PointerType::get(EI.getType()), EI);
GetElementPtrInst *GEP =

View File

@ -307,7 +307,7 @@ static bool getSCEVStartAndStride(const SCEVHandle &SH, Loop *L,
Start = SCEVAddExpr::get(Start, AE->getOperand(i));
}
} else if (SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(SH)) {
} else if (isa<SCEVAddRecExpr>(SH)) {
TheAddRec = SH;
} else {
return false; // not analyzable.

View File

@ -92,7 +92,7 @@ static unsigned ApproximateLoopSize(const Loop *L) {
// Ignore PHI nodes in the header.
} else if (I->hasOneUse() && I->use_back() == Term) {
// Ignore instructions only used by the loop terminator.
} else if (DbgInfoIntrinsic *DbgI = dyn_cast<DbgInfoIntrinsic>(I)) {
} else if (isa<DbgInfoIntrinsic>(I)) {
// Ignore debug instructions
} else {
++Size;
@ -135,7 +135,6 @@ BasicBlock* LoopUnroll::FoldBlockIntoPredecessor(BasicBlock* BB) {
return 0;
DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred);
TerminatorInst *Term = OnlyPred->getTerminator();
// Resolve any PHI nodes at the start of the block. They are all
// guaranteed to have exactly one entry if they exist, unless there are

View File

@ -576,8 +576,6 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// Split all of the edges from inside the loop to their exit blocks. Update
// the appropriate Phi nodes as we do so.
unsigned NumBlocks = L->getBlocks().size();
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
BasicBlock *ExitBlock = ExitBlocks[i];
std::vector<BasicBlock*> Preds(pred_begin(ExitBlock), pred_end(ExitBlock));
@ -966,9 +964,8 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
BasicBlock* Split = SplitBlock(Old, SI);
Instruction* OldTerm = Old->getTerminator();
BranchInst* Branch = new BranchInst(Split, SI->getSuccessor(i),
ConstantBool::getTrue(),
OldTerm);
new BranchInst(Split, SI->getSuccessor(i),
ConstantBool::getTrue(), OldTerm);
Old->getTerminator()->eraseFromParent();

View File

@ -377,7 +377,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI,
Succs[BCValue.getConstant() == ConstantBool::getFalse()] = true;
}
}
} else if (InvokeInst *II = dyn_cast<InvokeInst>(&TI)) {
} else if (isa<InvokeInst>(&TI)) {
// Invoke instructions successors are always executable.
Succs[0] = Succs[1] = true;
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(&TI)) {
@ -436,7 +436,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) {
}
return false;
}
} else if (InvokeInst *II = dyn_cast<InvokeInst>(TI)) {
} else if (isa<InvokeInst>(TI)) {
// Invoke instructions successors are always executable.
return true;
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {

View File

@ -302,7 +302,7 @@ int SROA::isSafeUseOfAllocation(Instruction *User) {
if (const ArrayType *AT = dyn_cast<ArrayType>(*I)) {
uint64_t NumElements = AT->getNumElements();
if (ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand())) {
if (isa<ConstantInt>(I.getOperand())) {
// Check to make sure that index falls within the array. If not,
// something funny is going on, so we won't do the optimization.
//

View File

@ -161,7 +161,6 @@ bool TailCallElim::runOnFunction(Function &F) {
// occurs when a function passes an argument straight through to its tail
// call.
if (!ArgumentPHIs.empty()) {
unsigned NumIncoming = ArgumentPHIs[0]->getNumIncomingValues();
for (unsigned i = 0, e = ArgumentPHIs.size(); i != e; ++i) {
PHINode *PN = ArgumentPHIs[i];

View File

@ -361,10 +361,7 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
// requires the CFG to be up-to-date.
for (unsigned phino = 0, e = PHIToResolve.size(); phino != e; ) {
const PHINode *OPN = PHIToResolve[phino];
unsigned NumPreds = OPN->getNumIncomingValues();
unsigned BBPHIStart = phino;
const BasicBlock *OldBB = OPN->getParent();
BasicBlock *NewBB = cast<BasicBlock>(ValueMap[OldBB]);

View File

@ -763,7 +763,6 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB,
// If NewBB dominates some blocks, then it will dominate all blocks that
// NewBBSucc does.
if (NewBBDominatesNewBBSucc) {
BasicBlock *PredBlock = PredBlocks[0];
Function *F = NewBB->getParent();
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
if (DS.dominates(NewBBSucc, I))

View File

@ -370,7 +370,6 @@ splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes) {
// Scan all of the uses and see if the live range is live across an unwind
// edge. If we find a use live across an invoke edge, create an alloca
// and spill the value.
AllocaInst *SpillLoc = 0;
std::set<InvokeInst*> InvokesWithStoreInserted;
// Find all of the blocks that this value is live in.

View File

@ -1340,7 +1340,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
}
}
}
} else if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->begin())) {
} else if (isa<UnwindInst>(BB->begin())) {
// Check to see if the first instruction in this block is just an unwind.
// If so, replace any invoke instructions which use this as an exception
// destination with call instructions, and any unconditional branch
@ -1409,7 +1409,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
return 1;
} else { // Conditional branch
if (Value *CompVal = isValueEqualityComparison(BI)) {
if (isValueEqualityComparison(BI)) {
// If we only have one predecessor, and if it is a branch on this value,
// see if that predecessor totally determines the outcome of this
// switch.
@ -1764,7 +1764,6 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
if (OnlySucc) {
DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred);
TerminatorInst *Term = OnlyPred->getTerminator();
// Resolve any PHI nodes at the start of the block. They are all
// guaranteed to have exactly one entry if they exist, unless there are

View File

@ -753,7 +753,7 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
Out << '<' << PTy->getNumElements() << " x ";
printType(PTy->getElementType()) << '>';
}
else if (const OpaqueType *OTy = dyn_cast<OpaqueType>(Ty)) {
else if (isa<OpaqueType>(Ty)) {
Out << "opaque";
} else {
if (!Ty->isPrimitiveType())

View File

@ -116,7 +116,6 @@ StackerCompiler::compile(
}
}
Module *Result;
try
{
// Create the module we'll return

View File

@ -81,5 +81,3 @@ $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA)
uninstall-local::
$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
-$(Verb) $(RM) -f $(DestBytecodeLib)

View File

@ -14,4 +14,3 @@ LIBRARYNAME = m
BYTECODE_DESTINATION = $(CFERuntimeLibDir)
include $(LEVEL)/Makefile.common

View File

@ -525,7 +525,6 @@ bool BugDriver::debugOptimizerCrash(const std::string &ID) {
std::cout << "\n*** Debugging optimizer crash!\n";
// Reduce the list of passes which causes the optimizer to crash...
unsigned OldSize = PassesToRun.size();
if (!BugpointIsInterrupted)
ReducePassList(*this).reduceList(PassesToRun);

View File

@ -747,7 +747,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test,
// Pass on the arguments to the real function, return its result
if (F->getReturnType() == Type::VoidTy) {
CallInst *Call = new CallInst(FuncPtr, Args, "", DoCallBB);
new CallInst(FuncPtr, Args, "", DoCallBB);
new ReturnInst(DoCallBB);
} else {
CallInst *Call = new CallInst(FuncPtr, Args, "retval", DoCallBB);

View File

@ -445,7 +445,6 @@ bool
doExtract(std::string* ErrMsg) {
if (buildPaths(false, ErrMsg))
return true;
unsigned countDown = Count;
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
I != E; ++I ) {
if (Paths.empty() ||

View File

@ -57,7 +57,6 @@ main(int argc, char **argv) {
sys::PrintStackTraceOnErrorSignal();
std::ostream* Out = &std::cout; // Default to printing to stdout...
std::istream* In = &std::cin; // Default to reading stdin
std::string ErrorMessage;
BytecodeAnalysis bca;

View File

@ -383,7 +383,7 @@ CppWriter::getCppName(const Value* val) {
if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(val)) {
name = std::string("gvar_") +
getTypePrefix(GV->getType()->getElementType());
} else if (const Function* F = dyn_cast<Function>(val)) {
} else if (isa<Function>(val)) {
name = std::string("func_");
} else if (const Constant* C = dyn_cast<Constant>(val)) {
name = std::string("const_") + getTypePrefix(C->getType());
@ -536,7 +536,6 @@ CppWriter::printTypeInternal(const Type* Ty) {
break;
}
case Type::OpaqueTyID: {
const OpaqueType* OT = cast<OpaqueType>(Ty);
Out << "OpaqueType* " << typeName << " = OpaqueType::get();";
nl(Out);
break;

View File

@ -62,13 +62,6 @@ void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){
DumpAction(&cd->Linker);
}
/// This specifies the passes to run for OPT_FAST_COMPILE (-O1)
/// which should reduce the volume of code and make compilation
/// faster. This is also safe on any llvm module.
static const char* DefaultFastCompileOptimizations[] = {
"-simplifycfg", "-mem2reg", "-instcombine"
};
class CompilerDriverImpl : public CompilerDriver {
/// @name Constructors
/// @{

View File

@ -163,7 +163,6 @@ int main(int argc, char **argv) {
// FIXME: The choice of target should be controllable on the command line.
std::auto_ptr<TargetMachine> target;
TargetMachine* TM = NULL;
std::string ErrorMessage;
// Load the input module...
@ -233,9 +232,9 @@ int main(int argc, char **argv) {
Passes.add(P);
if (AnalyzeOnly) {
if (BasicBlockPass *BBP = dynamic_cast<BasicBlockPass*>(P))
if (dynamic_cast<BasicBlockPass*>(P))
Passes.add(new BasicBlockPassPrinter(PassInf));
else if (FunctionPass *FP = dynamic_cast<FunctionPass*>(P))
else if (dynamic_cast<FunctionPass*>(P))
Passes.add(new FunctionPassPrinter(PassInf));
else
Passes.add(new ModulePassPrinter(PassInf));

View File

@ -296,7 +296,6 @@ int main() {
for (unsigned opnum = 0, e = TheOperators.size(); opnum != e; ++opnum) {
Operator *Op = TheOperators[opnum];
unsigned short Mask = Op->ShuffleMask;
// Evaluate op(LHS,LHS)
unsigned ResultMask = Op->getTransformedMask(LHS, LHS);