[llvm] r187899 - Move assert above first use of variable that we'd be asserting on.

Eric Christopher echristo at gmail.com
Wed Aug 7 11:51:09 PDT 2013


Author: echristo
Date: Wed Aug  7 13:51:09 2013
New Revision: 187899

URL: http://llvm.org/viewvc/llvm-project?rev=187899&view=rev
Log:
Move assert above first use of variable that we'd be asserting on.

Modified:
    llvm/trunk/lib/MC/MCAssembler.cpp

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=187899&r1=187898&r2=187899&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Wed Aug  7 13:51:09 2013
@@ -580,10 +580,10 @@ static void writeFragment(const MCAssemb
   case MCFragment::FT_Align: {
     ++stats::EmittedAlignFragments;
     const MCAlignFragment &AF = cast<MCAlignFragment>(F);
-    uint64_t Count = FragmentSize / AF.getValueSize();
-
     assert(AF.getValueSize() && "Invalid virtual align in concrete fragment!");
 
+    uint64_t Count = FragmentSize / AF.getValueSize();
+
     // FIXME: This error shouldn't actually occur (the front end should emit
     // multiple .align directives to enforce the semantics it wants), but is
     // severe enough that we want to report it. How to handle this?





More information about the llvm-commits mailing list