diff options
| author | Craig Topper <craig.topper@gmail.com> | 2017-03-24 02:58:02 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2017-03-24 02:58:02 +0000 |
| commit | 36f2e0eee834fca853e6e0df6b4fa76b06c0f329 (patch) | |
| tree | 06f137bc6b44b287f841ff85f3b9a4548403475c /llvm/lib/Transforms | |
| parent | df73e7c5b7c2f64f3d5b4c2677be8272bcdad024 (diff) | |
| download | bcm5719-llvm-36f2e0eee834fca853e6e0df6b4fa76b06c0f329.tar.gz bcm5719-llvm-36f2e0eee834fca853e6e0df6b4fa76b06c0f329.zip | |
[InstCombine] Use range-based for loop. NFC
llvm-svn: 298680
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 2241863de48..9cd22f65c99 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3019,12 +3019,11 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB, const DataLayout &DL, } // See if we can constant fold its operands. - for (User::op_iterator i = Inst->op_begin(), e = Inst->op_end(); i != e; - ++i) { - if (!isa<ConstantVector>(i) && !isa<ConstantExpr>(i)) + for (Use &U : Inst->operands()) { + if (!isa<ConstantVector>(U) && !isa<ConstantExpr>(U)) continue; - auto *C = cast<Constant>(i); + auto *C = cast<Constant>(U); Constant *&FoldRes = FoldedConstants[C]; if (!FoldRes) FoldRes = ConstantFoldConstant(C, DL, TLI); @@ -3035,7 +3034,7 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB, const DataLayout &DL, DEBUG(dbgs() << "IC: ConstFold operand of: " << *Inst << "\n Old = " << *C << "\n New = " << *FoldRes << '\n'); - *i = FoldRes; + U = FoldRes; MadeIRChange = true; } } |

