[llvm] [SandboxIR] Implement CmpInst, FCmpInst, and ICmpInst (PR #106301)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 18:35:27 PDT 2024


================
@@ -107,6 +107,9 @@ DEF_INSTR(Cast,   OPCODES(\
                           ),                  CastInst)
 DEF_INSTR(PHI,            OP(PHI),            PHINode)
 DEF_INSTR(Unreachable,    OP(Unreachable),    UnreachableInst)
+DEF_INSTR(Cmp,            OP(Cmp),           CmpInst)
----------------
vporpo wrote:

`CmpInst` is (should be) an abstract class, so we will never have a `CmpInst` object. It will always be either an `ICmpInst` or an `FCmpInst`. So we don't need an entry for `CmpInst` here. There is no `Cmp` opcode.

This is similar to the way the call instructions are defined. They all inherit from `CallBase` but `CallBase` does not have an entry in the .def file as there are won't be any valid `CallBase` objects.

https://github.com/llvm/llvm-project/pull/106301


More information about the llvm-commits mailing list