-static bool canMergeOpc(unsigned Opc, unsigned PairOpc, LdStPairFlags &Flags) {
- bool CanMergeOpc = Opc == PairOpc;
- // Opcodes match nothing more to check.
- if (CanMergeOpc)
- return true;
-
- // Try to match a signed-extended load/store with a zero-extended load/store.
- Flags.setSExtIdx(-1);
- bool IsValidLdStrOpc;
- unsigned NonSExtOpc = getMatchingNonSExtOpcode(Opc, &IsValidLdStrOpc);
- assert(IsValidLdStrOpc &&
- "Given Opc should be a Load or Store with an immediate");
- // Opc will be the first instruction in the pair.
- CanMergeOpc = NonSExtOpc == getMatchingNonSExtOpcode(PairOpc);
- if (CanMergeOpc) {
- Flags.setSExtIdx(NonSExtOpc == (unsigned)Opc ? 1 : 0);
- return true;
- }
-
- return false;
-}
-