Skip to content

Commit 190e8b9

Browse files
committed
[TSAR, Tfm, Loop, Reversal] Fix, check that top level statement is induction variable.
1 parent 499f34d commit 190e8b9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Transform/Clang/LoopReversal.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,18 @@ class ClangLoopReverseVisitor
417417

418418

419419
bool isInductionRef(clang::Stmt *S, const clang::VarDecl *Induction) {
420-
do {
420+
if (auto *DRE{dyn_cast<clang::DeclRefExpr>(S)};
421+
DRE && DRE->getDecl() == Induction)
422+
return true;
423+
while (!S->children().empty()) {
421424
auto I(S->child_begin());
422425
if (++I != S->child_end())
423426
return false;
424427
S = *S->child_begin();
425428
if (auto *DRE{dyn_cast<clang::DeclRefExpr>(S)};
426429
DRE && DRE->getDecl() == Induction)
427430
return true;
428-
} while (!S->children().empty());
431+
}
429432
return false;
430433
};
431434

0 commit comments

Comments
 (0)