[PATCH] D19042: AMDGPU: change a redundant if () to an assert(). NFC

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 16:40:15 PDT 2016


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.

I've been carrying this change around with me for a while, because the if ()
managed to confuse me while following the code. All callers ensure that the
assertion holds.

http://reviews.llvm.org/D19042

Files:
  lib/Target/AMDGPU/SIAnnotateControlFlow.cpp

Index: lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
===================================================================
--- lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
+++ lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
@@ -341,8 +341,7 @@
 void SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) {
   llvm::Loop *L = LI->getLoopFor(BB);
 
-  if (Stack.back().first != BB)
-    return;
+  assert(Stack.back().first == BB);
 
   if (L && L->getHeader() == BB) {
     // We can't insert an EndCF call into a loop header, because it will


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19042.53493.patch
Type: text/x-patch
Size: 535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/05786b63/attachment.bin>


More information about the llvm-commits mailing list