From 09c1109b12945861d3eab1ef4548d61ba57126ed Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 13 Sep 2016 12:56:04 +0000 Subject: [LoopInterchange] Tidy up and remove unnecessary dyn_casts. NFC. llvm-svn: 281328 --- llvm/lib/Transforms/Scalar/LoopInterchange.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/LoopInterchange.cpp') diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index 2778817..6be6e22 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -87,18 +87,17 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level, // Scan the BB and collect legal loads and stores. for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ++I) { - Instruction *Ins = dyn_cast(I); - if (!Ins) + if (!isa(I)) return false; - LoadInst *Ld = dyn_cast(I); - StoreInst *St = dyn_cast(I); - if (!St && !Ld) - continue; - if (Ld && !Ld->isSimple()) - return false; - if (St && !St->isSimple()) - return false; - MemInstr.push_back(&*I); + if (LoadInst *Ld = dyn_cast(I)) { + if (!Ld->isSimple()) + return false; + MemInstr.push_back(&*I); + } else if (StoreInst *St = dyn_cast(I)) { + if (!St->isSimple()) + return false; + MemInstr.push_back(&*I); + } } } @@ -110,8 +109,8 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level, for (I = MemInstr.begin(), IE = MemInstr.end(); I != IE; ++I) { for (J = I, JE = MemInstr.end(); J != JE; ++J) { std::vector Dep; - Instruction *Src = dyn_cast(*I); - Instruction *Dst = dyn_cast(*J); + Instruction *Src = cast(*I); + Instruction *Dst = cast(*J); if (Src == Dst) continue; if (isa(Src) && isa(Dst)) -- cgit v1.1