[PATCH] D106256: [LoopFlatten][LoopInfo] Use Loop to identify latch compare instruction
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 19 03:08:09 PDT 2021
SjoerdMeijer added reviewers: fhahn, dmgreen.
SjoerdMeijer added inline comments.
================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:175
+ICmpInst *Loop::getLatchCmpInst() const {
+ if (BasicBlock *Latch = this->getLoopLatch())
if (BranchInst *BI = dyn_cast_or_null<BranchInst>(Latch->getTerminator()))
----------------
Nit: do we need the `this->`?
================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:300
assert(Header && "Expected a valid loop header");
- ICmpInst *CmpInst = getLatchCmpInst(*this);
+ ICmpInst *CmpInst = this->getLatchCmpInst();
if (!CmpInst)
----------------
Same
================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:115
// Latch block must end in a conditional branch.
BackBranch = dyn_cast<BranchInst>(Latch->getTerminator());
if (!BackBranch || !BackBranch->isConditional()) {
----------------
I was expecting we could perhaps get rid of a bit more code. This check is performed in `Loop::getLatchCmpInst`, so do we need it here?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106256/new/
https://reviews.llvm.org/D106256
More information about the llvm-commits
mailing list