[llvm] r244366 - [AArch64][LoadStoreOptimizer] Turn a test into an assert. NFC.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 15:40:51 PDT 2015


Author: qcolombet
Date: Fri Aug  7 17:40:51 2015
New Revision: 244366

URL: http://llvm.org/viewvc/llvm-project?rev=244366&view=rev
Log:
[AArch64][LoadStoreOptimizer] Turn a test into an assert. NFC.

At this point the given Opc must be valid, otherwise we should
not look for a matching pair to form paired load or store.

Thanks to Chad to point out this piece of code!

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=244366&r1=244365&r2=244366&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Fri Aug  7 17:40:51 2015
@@ -589,8 +589,8 @@ AArch64LoadStoreOpt::findMatchingInsn(Ma
     if (!CanMergeOpc) {
       bool IsValidLdStrOpc;
       unsigned NonSExtOpc = getMatchingNonSExtOpcode(Opc, &IsValidLdStrOpc);
-      if (!IsValidLdStrOpc)
-        continue;
+      assert(IsValidLdStrOpc &&
+             "Given Opc should be a Load or Store with an immediate");
       // Opc will be the first instruction in the pair.
       Flags.setSExtIdx(NonSExtOpc == (unsigned)Opc ? 1 : 0);
       CanMergeOpc = NonSExtOpc == getMatchingNonSExtOpcode(MI->getOpcode());




More information about the llvm-commits mailing list