[AArch64][LoadStoreOptimizer] Turn a test into an assert. NFC.
authorQuentin Colombet <qcolombet@apple.com>
Fri, 7 Aug 2015 22:40:51 +0000 (22:40 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Fri, 7 Aug 2015 22:40:51 +0000 (22:40 +0000)
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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244366 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp

index fc65af3f66a4263158eee1bd22de01503c3bb9e4..442abf81e87c5b23a0b899a9a5b51129d0c71259 100644 (file)
@@ -589,8 +589,8 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
     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());