mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Make Transforms to be 4.3 warnings-clean
llvm-svn: 47371
This commit is contained in:
parent
9b1c5f2cac
commit
fd6b669c80
@ -178,7 +178,7 @@ static bool AnalyzeGlobal(Value *V, GlobalStatus &GS,
|
||||
// If this is a direct store to the global (i.e., the global is a scalar
|
||||
// value, not an aggregate), keep more specific information about
|
||||
// stores.
|
||||
if (GS.StoredType != GlobalStatus::isStored)
|
||||
if (GS.StoredType != GlobalStatus::isStored) {
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(SI->getOperand(1))){
|
||||
Value *StoredVal = SI->getOperand(0);
|
||||
if (StoredVal == GV->getInitializer()) {
|
||||
@ -201,6 +201,7 @@ static bool AnalyzeGlobal(Value *V, GlobalStatus &GS,
|
||||
} else {
|
||||
GS.StoredType = GlobalStatus::isStored;
|
||||
}
|
||||
}
|
||||
} else if (isa<GetElementPtrInst>(I)) {
|
||||
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
|
||||
} else if (isa<SelectInst>(I)) {
|
||||
@ -531,7 +532,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
|
||||
Value *NewPtr = NewGlobals[Val];
|
||||
|
||||
// Form a shorter GEP if needed.
|
||||
if (GEP->getNumOperands() > 3)
|
||||
if (GEP->getNumOperands() > 3) {
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(GEP)) {
|
||||
SmallVector<Constant*, 8> Idxs;
|
||||
Idxs.push_back(NullInt);
|
||||
@ -548,6 +549,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
|
||||
NewPtr = new GetElementPtrInst(NewPtr, Idxs.begin(), Idxs.end(),
|
||||
GEPI->getName()+"."+utostr(Val), GEPI);
|
||||
}
|
||||
}
|
||||
GEP->replaceAllUsesWith(NewPtr);
|
||||
|
||||
if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(GEP))
|
||||
|
@ -144,7 +144,7 @@ bool IPCP::PropagateConstantReturn(Function &F) {
|
||||
// Check to see if this function returns a constant.
|
||||
Value *RetVal = 0;
|
||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()))
|
||||
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
|
||||
if (isa<UndefValue>(RI->getOperand(0))) {
|
||||
// Ignore.
|
||||
} else if (Constant *C = dyn_cast<Constant>(RI->getOperand(0))) {
|
||||
@ -155,6 +155,7 @@ bool IPCP::PropagateConstantReturn(Function &F) {
|
||||
} else {
|
||||
return false; // Does not return a constant.
|
||||
}
|
||||
}
|
||||
|
||||
if (RetVal == 0) RetVal = UndefValue::get(F.getReturnType());
|
||||
|
||||
|
@ -174,17 +174,17 @@ template <> struct DenseMapInfo<Expression> {
|
||||
hash = e.secondVN + hash * 37;
|
||||
hash = e.thirdVN + hash * 37;
|
||||
|
||||
hash = (unsigned)((uintptr_t)e.type >> 4) ^
|
||||
(unsigned)((uintptr_t)e.type >> 9) +
|
||||
hash * 37;
|
||||
hash = ((unsigned)((uintptr_t)e.type >> 4) ^
|
||||
(unsigned)((uintptr_t)e.type >> 9)) +
|
||||
hash * 37;
|
||||
|
||||
for (SmallVector<uint32_t, 4>::const_iterator I = e.varargs.begin(),
|
||||
E = e.varargs.end(); I != E; ++I)
|
||||
hash = *I + hash * 37;
|
||||
|
||||
hash = (unsigned)((uintptr_t)e.function >> 4) ^
|
||||
(unsigned)((uintptr_t)e.function >> 9) +
|
||||
hash * 37;
|
||||
hash = ((unsigned)((uintptr_t)e.function >> 4) ^
|
||||
(unsigned)((uintptr_t)e.function >> 9)) +
|
||||
hash * 37;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
@ -171,9 +171,9 @@ template <> struct DenseMapInfo<Expression> {
|
||||
hash = e.secondVN + hash * 37;
|
||||
hash = e.thirdVN + hash * 37;
|
||||
|
||||
hash = (unsigned)((uintptr_t)e.type >> 4) ^
|
||||
(unsigned)((uintptr_t)e.type >> 9) +
|
||||
hash * 37;
|
||||
hash = ((unsigned)((uintptr_t)e.type >> 4) ^
|
||||
(unsigned)((uintptr_t)e.type >> 9)) +
|
||||
hash * 37;
|
||||
|
||||
for (SmallVector<uint32_t, 4>::const_iterator I = e.varargs.begin(),
|
||||
E = e.varargs.end(); I != E; ++I)
|
||||
@ -1599,7 +1599,7 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
|
||||
isa<ShuffleVectorInst>(U) ||
|
||||
isa<ExtractElementInst>(U) ||
|
||||
isa<InsertElementInst>(U) ||
|
||||
isa<SelectInst>(U))
|
||||
isa<SelectInst>(U)) {
|
||||
if (isa<BinaryOperator>(U->getOperand(1)) ||
|
||||
isa<CmpInst>(U->getOperand(1)) ||
|
||||
isa<ShuffleVectorInst>(U->getOperand(1)) ||
|
||||
@ -1612,12 +1612,13 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
|
||||
} else {
|
||||
s2 = U->getOperand(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Ternary Operators
|
||||
Value* s3 = 0;
|
||||
if (isa<ShuffleVectorInst>(U) ||
|
||||
isa<InsertElementInst>(U) ||
|
||||
isa<SelectInst>(U))
|
||||
isa<SelectInst>(U)) {
|
||||
if (isa<BinaryOperator>(U->getOperand(2)) ||
|
||||
isa<CmpInst>(U->getOperand(2)) ||
|
||||
isa<ShuffleVectorInst>(U->getOperand(2)) ||
|
||||
@ -1630,6 +1631,7 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB,
|
||||
} else {
|
||||
s3 = U->getOperand(2);
|
||||
}
|
||||
}
|
||||
|
||||
// Vararg operators
|
||||
SmallVector<Value*, 4> sVarargs;
|
||||
|
@ -2303,7 +2303,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
||||
// -(X >>u 31) -> (X >>s 31)
|
||||
// -(X >>s 31) -> (X >>u 31)
|
||||
if (C->isZero()) {
|
||||
if (BinaryOperator *SI = dyn_cast<BinaryOperator>(Op1))
|
||||
if (BinaryOperator *SI = dyn_cast<BinaryOperator>(Op1)) {
|
||||
if (SI->getOpcode() == Instruction::LShr) {
|
||||
if (ConstantInt *CU = dyn_cast<ConstantInt>(SI->getOperand(1))) {
|
||||
// Check to see if we are shifting out everything but the sign bit.
|
||||
@ -2325,7 +2325,8 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
||||
SI->getOperand(0), CU, SI->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try to fold constant sub into select arguments.
|
||||
@ -2408,7 +2409,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
||||
}
|
||||
|
||||
if (!Op0->getType()->isFPOrFPVector())
|
||||
if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0))
|
||||
if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
|
||||
if (Op0I->getOpcode() == Instruction::Add) {
|
||||
if (Op0I->getOperand(0) == Op1) // (Y+X)-Y == X
|
||||
return ReplaceInstUsesWith(I, Op0I->getOperand(1));
|
||||
@ -2418,6 +2419,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
||||
if (Op0I->getOperand(0) == Op1) // (X-Y)-X == -Y
|
||||
return BinaryOperator::createNeg(Op0I->getOperand(1), I.getName());
|
||||
}
|
||||
}
|
||||
|
||||
ConstantInt *C1;
|
||||
if (Value *X = dyn_castFoldableMul(Op0, C1)) {
|
||||
@ -3116,8 +3118,8 @@ struct FoldICmpLogical {
|
||||
bool shouldApply(Value *V) const {
|
||||
if (ICmpInst *ICI = dyn_cast<ICmpInst>(V))
|
||||
if (PredicatesFoldable(pred, ICI->getPredicate()))
|
||||
return (ICI->getOperand(0) == LHS && ICI->getOperand(1) == RHS ||
|
||||
ICI->getOperand(0) == RHS && ICI->getOperand(1) == LHS);
|
||||
return ((ICI->getOperand(0) == LHS && ICI->getOperand(1) == RHS) ||
|
||||
(ICI->getOperand(0) == RHS && ICI->getOperand(1) == LHS));
|
||||
return false;
|
||||
}
|
||||
Instruction *apply(Instruction &Log) const {
|
||||
@ -3499,7 +3501,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
|
||||
if (Instruction *CastOp = dyn_cast<Instruction>(CI->getOperand(0))) {
|
||||
if ((isa<TruncInst>(CI) || isa<BitCastInst>(CI)) &&
|
||||
CastOp->getNumOperands() == 2)
|
||||
if (ConstantInt *AndCI = dyn_cast<ConstantInt>(CastOp->getOperand(1)))
|
||||
if (ConstantInt *AndCI = dyn_cast<ConstantInt>(CastOp->getOperand(1))) {
|
||||
if (CastOp->getOpcode() == Instruction::And) {
|
||||
// Change: and (cast (and X, C1) to T), C2
|
||||
// into : and (cast X to T), trunc_or_bitcast(C1)&C2
|
||||
@ -3520,6 +3522,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
|
||||
if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2
|
||||
return ReplaceInstUsesWith(I, AndRHS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4384,7 +4387,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
|
||||
return BinaryOperator::createAdd(Op0I->getOperand(1), ConstantRHS);
|
||||
}
|
||||
|
||||
if (ConstantInt *Op0CI = dyn_cast<ConstantInt>(Op0I->getOperand(1)))
|
||||
if (ConstantInt *Op0CI = dyn_cast<ConstantInt>(Op0I->getOperand(1))) {
|
||||
if (Op0I->getOpcode() == Instruction::Add) {
|
||||
// ~(X-c) --> (-c-1)-X
|
||||
if (RHS->isAllOnesValue()) {
|
||||
@ -4414,6 +4417,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
|
||||
return &I;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try to fold constant and into select arguments.
|
||||
@ -5184,13 +5188,14 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
Op1 = CI2->getOperand(0);
|
||||
|
||||
// If Op1 is a constant, we can fold the cast into the constant.
|
||||
if (Op0->getType() != Op1->getType())
|
||||
if (Op0->getType() != Op1->getType()) {
|
||||
if (Constant *Op1C = dyn_cast<Constant>(Op1)) {
|
||||
Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
|
||||
} else {
|
||||
// Otherwise, cast the RHS right before the icmp
|
||||
Op1 = InsertBitCastBefore(Op1, Op0->getType(), I);
|
||||
}
|
||||
}
|
||||
return new ICmpInst(I.getPredicate(), Op0, Op1);
|
||||
}
|
||||
}
|
||||
@ -5437,8 +5442,8 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
|
||||
if (ConstantInt *XorCST = dyn_cast<ConstantInt>(LHSI->getOperand(1))) {
|
||||
// If this is a comparison that tests the signbit (X < 0) or (x > -1),
|
||||
// fold the xor.
|
||||
if (ICI.getPredicate() == ICmpInst::ICMP_SLT && RHSV == 0 ||
|
||||
ICI.getPredicate() == ICmpInst::ICMP_SGT && RHSV.isAllOnesValue()) {
|
||||
if ((ICI.getPredicate() == ICmpInst::ICMP_SLT && RHSV == 0) ||
|
||||
(ICI.getPredicate() == ICmpInst::ICMP_SGT && RHSV.isAllOnesValue())) {
|
||||
Value *CompareVal = LHSI->getOperand(0);
|
||||
|
||||
// If the sign bit of the XorCST is not set, there is no change to
|
||||
@ -8492,7 +8497,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
Args.push_back(Constant::getNullValue(FT->getParamType(i)));
|
||||
|
||||
// If we are removing arguments to the function, emit an obnoxious warning...
|
||||
if (FT->getNumParams() < NumActualArgs)
|
||||
if (FT->getNumParams() < NumActualArgs) {
|
||||
if (!FT->isVarArg()) {
|
||||
cerr << "WARNING: While resolving call to function '"
|
||||
<< Callee->getName() << "' arguments were dropped!\n";
|
||||
@ -8519,6 +8524,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||
attrVec.push_back(ParamAttrsWithIndex::get(i + 1, PAttrs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FT->getReturnType() == Type::VoidTy)
|
||||
Caller->setName(""); // Void type should not have a name.
|
||||
@ -9131,7 +9137,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
||||
// insert it. This explicit cast can make subsequent optimizations more
|
||||
// obvious.
|
||||
Value *Op = GEP.getOperand(i);
|
||||
if (TD->getTypeSizeInBits(Op->getType()) > TD->getPointerSizeInBits())
|
||||
if (TD->getTypeSizeInBits(Op->getType()) > TD->getPointerSizeInBits()) {
|
||||
if (Constant *C = dyn_cast<Constant>(Op)) {
|
||||
GEP.setOperand(i, ConstantExpr::getTrunc(C, TD->getIntPtrType()));
|
||||
MadeChange = true;
|
||||
@ -9141,6 +9147,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
||||
GEP.setOperand(i, Op);
|
||||
MadeChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MadeChange) return &GEP;
|
||||
@ -9383,7 +9390,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
||||
|
||||
Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) {
|
||||
// Convert: malloc Ty, C - where C is a constant != 1 into: malloc [C x Ty], 1
|
||||
if (AI.isArrayAllocation()) // Check C != 1
|
||||
if (AI.isArrayAllocation()) { // Check C != 1
|
||||
if (const ConstantInt *C = dyn_cast<ConstantInt>(AI.getArraySize())) {
|
||||
const Type *NewTy =
|
||||
ArrayType::get(AI.getAllocatedType(), C->getZExtValue());
|
||||
@ -9421,6 +9428,7 @@ Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) {
|
||||
} else if (isa<UndefValue>(AI.getArraySize())) {
|
||||
return ReplaceInstUsesWith(AI, Constant::getNullValue(AI.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
// If alloca'ing a zero byte object, replace the alloca with a null pointer.
|
||||
// Note that we only do this for alloca's, because malloc should allocate and
|
||||
@ -9669,7 +9677,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
||||
return ReplaceInstUsesWith(LI, GV->getInitializer());
|
||||
|
||||
// Instcombine load (constantexpr_GEP global, 0, ...) into the value loaded.
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Op))
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Op)) {
|
||||
if (CE->getOpcode() == Instruction::GetElementPtr) {
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
||||
if (GV->isConstant() && !GV->isDeclaration())
|
||||
@ -9690,6 +9698,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
||||
if (Instruction *Res = InstCombineLoadCast(*this, LI, TD))
|
||||
return Res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this load comes from anywhere in a constant global, and if the global
|
||||
|
@ -1608,8 +1608,8 @@ bool IPSCCP::runOnModule(Module &M) {
|
||||
Instruction *Inst = BI++;
|
||||
if (Inst->getType() != Type::VoidTy) {
|
||||
LatticeVal &IV = Values[Inst];
|
||||
if (IV.isConstant() || IV.isUndefined() &&
|
||||
!isa<TerminatorInst>(Inst)) {
|
||||
if (IV.isConstant() ||
|
||||
(IV.isUndefined() && !isa<TerminatorInst>(Inst))) {
|
||||
Constant *Const = IV.isConstant()
|
||||
? IV.getConstant() : UndefValue::get(Inst->getType());
|
||||
DOUT << " Constant: " << *Const << " = " << *Inst;
|
||||
|
@ -279,8 +279,8 @@ Value *TailCallElim::CanTransformAccumulatorRecursion(Instruction *I,
|
||||
"Associative operations should have 2 args!");
|
||||
|
||||
// Exactly one operand should be the result of the call instruction...
|
||||
if (I->getOperand(0) == CI && I->getOperand(1) == CI ||
|
||||
I->getOperand(0) != CI && I->getOperand(1) != CI)
|
||||
if ((I->getOperand(0) == CI && I->getOperand(1) == CI) ||
|
||||
(I->getOperand(0) != CI && I->getOperand(1) != CI))
|
||||
return 0;
|
||||
|
||||
// The only user of this instruction we allow is a single return instruction.
|
||||
|
@ -680,7 +680,7 @@ ExtractCodeRegion(const std::vector<BasicBlock*> &code) {
|
||||
PHINode *PN = cast<PHINode>(I);
|
||||
std::set<BasicBlock*> ProcessedPreds;
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||
if (BlocksToExtract.count(PN->getIncomingBlock(i)))
|
||||
if (BlocksToExtract.count(PN->getIncomingBlock(i))) {
|
||||
if (ProcessedPreds.insert(PN->getIncomingBlock(i)).second)
|
||||
PN->setIncomingBlock(i, codeReplacer);
|
||||
else {
|
||||
@ -689,6 +689,7 @@ ExtractCodeRegion(const std::vector<BasicBlock*> &code) {
|
||||
PN->removeIncomingValue(i, false);
|
||||
--i; --e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//cerr << "NEW FUNCTION: " << *newFunction;
|
||||
|
@ -391,7 +391,7 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
|
||||
// icmp_eq instructions that compare a value against a constant, return the
|
||||
// value being compared, and stick the constant into the Values vector.
|
||||
static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
|
||||
if (Instruction *Inst = dyn_cast<Instruction>(V))
|
||||
if (Instruction *Inst = dyn_cast<Instruction>(V)) {
|
||||
if (Inst->getOpcode() == Instruction::ICmp &&
|
||||
cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_EQ) {
|
||||
if (ConstantInt *C = dyn_cast<ConstantInt>(Inst->getOperand(1))) {
|
||||
@ -407,6 +407,7 @@ static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
|
||||
if (LHS == RHS)
|
||||
return LHS;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -414,7 +415,7 @@ static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
|
||||
// setne instructions that compare a value against a constant, return the value
|
||||
// being compared, and stick the constant into the Values vector.
|
||||
static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values){
|
||||
if (Instruction *Inst = dyn_cast<Instruction>(V))
|
||||
if (Instruction *Inst = dyn_cast<Instruction>(V)) {
|
||||
if (Inst->getOpcode() == Instruction::ICmp &&
|
||||
cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_NE) {
|
||||
if (ConstantInt *C = dyn_cast<ConstantInt>(Inst->getOperand(1))) {
|
||||
@ -430,6 +431,7 @@ static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values){
|
||||
if (LHS == RHS)
|
||||
return LHS;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -658,11 +660,12 @@ static bool SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI,
|
||||
ConstantInt *TIV = 0;
|
||||
BasicBlock *TIBB = TI->getParent();
|
||||
for (unsigned i = 0, e = PredCases.size(); i != e; ++i)
|
||||
if (PredCases[i].second == TIBB)
|
||||
if (PredCases[i].second == TIBB) {
|
||||
if (TIV == 0)
|
||||
TIV = PredCases[i].first;
|
||||
else
|
||||
return false; // Cannot handle multiple values coming to this block.
|
||||
}
|
||||
assert(TIV && "No edge from pred to succ?");
|
||||
|
||||
// Okay, we found the one constant that our value can be if we get into TI's
|
||||
@ -1190,8 +1193,8 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
"Can't Simplify entry block!");
|
||||
|
||||
// Remove basic blocks that have no predecessors... which are unreachable.
|
||||
if (pred_begin(BB) == pred_end(BB) ||
|
||||
*pred_begin(BB) == BB && ++pred_begin(BB) == pred_end(BB)) {
|
||||
if ((pred_begin(BB) == pred_end(BB)) ||
|
||||
(*pred_begin(BB) == BB && ++pred_begin(BB) == pred_end(BB))) {
|
||||
DOUT << "Removing BB: \n" << *BB;
|
||||
|
||||
// Loop through all of our successors and make sure they know that one
|
||||
@ -1235,11 +1238,12 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
SmallVector<BranchInst*, 8> CondBranchPreds;
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
|
||||
TerminatorInst *PTI = (*PI)->getTerminator();
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(PTI))
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(PTI)) {
|
||||
if (BI->isUnconditional())
|
||||
UncondBranchPreds.push_back(*PI);
|
||||
else
|
||||
CondBranchPreds.push_back(BI);
|
||||
}
|
||||
}
|
||||
|
||||
// If we found some, do the transformation!
|
||||
|
Loading…
Reference in New Issue
Block a user