[PATCH] D52118: [Loopinfo] Remove one latch case in getLoopID. NFC.
Michael Kruse via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 17 11:44:09 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342406: [Loopinfo] Remove one latch-case in getLoopID. NFC. (authored by Meinersbur, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D52118?vs=165567&id=165798#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52118
Files:
llvm/trunk/lib/Analysis/LoopInfo.cpp
Index: llvm/trunk/lib/Analysis/LoopInfo.cpp
===================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp
@@ -213,26 +213,21 @@
MDNode *Loop::getLoopID() const {
MDNode *LoopID = nullptr;
- if (BasicBlock *Latch = getLoopLatch()) {
- LoopID = Latch->getTerminator()->getMetadata(LLVMContext::MD_loop);
- } else {
- assert(!getLoopLatch() &&
- "The loop should have no single latch at this point");
- // Go through the latch blocks and check the terminator for the metadata.
- SmallVector<BasicBlock *, 4> LatchesBlocks;
- getLoopLatches(LatchesBlocks);
- for (BasicBlock *BB : LatchesBlocks) {
- TerminatorInst *TI = BB->getTerminator();
- MDNode *MD = TI->getMetadata(LLVMContext::MD_loop);
-
- if (!MD)
- return nullptr;
-
- if (!LoopID)
- LoopID = MD;
- else if (MD != LoopID)
- return nullptr;
- }
+
+ // Go through the latch blocks and check the terminator for the metadata.
+ SmallVector<BasicBlock *, 4> LatchesBlocks;
+ getLoopLatches(LatchesBlocks);
+ for (BasicBlock *BB : LatchesBlocks) {
+ TerminatorInst *TI = BB->getTerminator();
+ MDNode *MD = TI->getMetadata(LLVMContext::MD_loop);
+
+ if (!MD)
+ return nullptr;
+
+ if (!LoopID)
+ LoopID = MD;
+ else if (MD != LoopID)
+ return nullptr;
}
if (!LoopID || LoopID->getNumOperands() == 0 ||
LoopID->getOperand(0) != LoopID)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52118.165798.patch
Type: text/x-patch
Size: 1507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180917/b1284715/attachment.bin>
More information about the cfe-commits
mailing list