Repository: Qiskit/qiskit

Issue:
Remove MSBasisDecomposer from pass manager construction
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

### What is the expected enhancement?

The MSBasisDecomposer pass and `ms_basis_swap` check in https://github.com/Qiskit/qiskit-terra/blob/41cf87c/qiskit/compiler/transpile.py#L290 were introduced as workarounds to support transpiling to devices with other basis gates. This is now supported directly by the transpiler, so these can be removed. The MSBasisDecomposer pass should be deprecated with a note re-directing to the BasisTranslator. `ms_basis_swap` can be removed directly.


Discussion:
I can take this one.

Resolving patch:
diff --git a/qiskit/compiler/transpile.py b/qiskit/compiler/transpile.py
--- a/qiskit/compiler/transpile.py
+++ b/qiskit/compiler/transpile.py
@@ -30,7 +30,6 @@
 from qiskit.transpiler.exceptions import TranspilerError
 from qiskit.transpiler.passes import ApplyLayout
 from qiskit.converters import isinstanceint, isinstancelist, dag_to_circuit, circuit_to_dag
-from qiskit.transpiler.passes.basis.ms_basis_decomposer import MSBasisDecomposer
 from qiskit.transpiler.preset_passmanagers import (level_0_pass_manager,
                                                    level_1_pass_manager,
                                                    level_2_pass_manager,
@@ -285,20 +284,6 @@ def _transpile_circuit(circuit_config_tuple: Tuple[QuantumCircuit, Dict]) -> Qua
         pass_manager_config.initial_layout = _remap_layout_faulty_backend(
             pass_manager_config.initial_layout, transpile_config['faulty_qubits_map'])
 
-    ms_basis_swap = None
-    if (pass_manager_config.translation_method == 'unroller'
-            and pass_manager_config.basis_gates is not None):
-        # Workaround for ion trap support: If basis gates includes
-        # Mølmer-Sørensen (rxx) and the circuit includes gates outside the basis,
-        # first unroll to u3, cx, then run MSBasisDecomposer to target basis.
-        basic_insts = ['measure', 'reset', 'barrier', 'snapshot']
-        device_insts = set(pass_manager_config.basis_gates).union(basic_insts)
-        if 'rxx' in pass_manager_config.basis_gates and \
-                not device_insts >= circuit.count_ops().keys():
-            ms_basis_swap = pass_manager_config.basis_gates
-            pass_manager_config.basis_gates = list(
-                {'u3', 'cx'}.union(pass_manager_config.basis_gates))
-
     # we choose an appropriate one based on desired optimization level
     level = transpile_config['optimization_level']
 
@@ -313,9 +298,6 @@ def _transpile_circuit(circuit_config_tuple: Tuple[QuantumCircuit, Dict]) -> Qua
     else:
         raise TranspilerError("optimization_level can range from 0 to 3.")
 
-    if ms_basis_swap is not None:
-        pass_manager.append(MSBasisDecomposer(ms_basis_swap))
-
     result = pass_manager.run(circuit, callback=transpile_config['callback'],
                               output_name=transpile_config['output_name'])
 
diff --git a/qiskit/transpiler/passes/basis/ms_basis_decomposer.py b/qiskit/transpiler/passes/basis/ms_basis_decomposer.py
--- a/qiskit/transpiler/passes/basis/ms_basis_decomposer.py
+++ b/qiskit/transpiler/passes/basis/ms_basis_decomposer.py
@@ -12,6 +12,7 @@
 
 """Convert a circuit in ``U3, CX`` to ``Rx, Ry, Rxx`` without unrolling or simplification."""
 
+import warnings
 from qiskit.transpiler.basepasses import TransformationPass
 from qiskit.exceptions import QiskitError
 
@@ -29,11 +30,17 @@ class MSBasisDecomposer(TransformationPass):
     supported_input_gates = (U3Gate, CXGate)
 
     def __init__(self, basis_gates):
-        """MSBasisDecomposer initializer.
+        """Deprecated
+        MSBasisDecomposer initializer.
 
         Args:
             basis_gates (list[str]): Target basis names, e.g. `['rx', 'ry', 'rxx', 'ms']` .
         """
+        warnings.warn('The qiskit.transpiler.passes.basis.MSBasisDecomposer class is '
+                      'deprecated as of 0.16.0, and will be removed no earlier '
+                      'than 3 months after that release date. You should use the '
+                      'qiskit.transpiler.passes.basis.BasisTranslator class '
+                      'instead.', DeprecationWarning, stacklevel=2)
         super().__init__()
 
         self.basis_gates = basis_gates


Test patch: