[llvm] [SelectionDAG] Add instantiated OPC_CheckType (PR #73283)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 17:45:01 PST 2023


================
@@ -2853,13 +2853,27 @@ static unsigned IsPredicateKnownToFail(const unsigned char *Table,
     Result = !::CheckOpcode(Table, Index, N.getNode());
     return Index;
   case SelectionDAGISel::OPC_CheckType:
-    Result = !::CheckType(Table, Index, N, SDISel.TLI,
-                          SDISel.CurDAG->getDataLayout());
+  case SelectionDAGISel::OPC_CheckTypeI32:
+  case SelectionDAGISel::OPC_CheckTypeI64: {
+    MVT::SimpleValueType VT;
+    switch (Opcode) {
+    case SelectionDAGISel::OPC_CheckTypeI32:
+      VT = MVT::i32;
+      break;
+    case SelectionDAGISel::OPC_CheckTypeI64:
+      VT = MVT::i64;
+      break;
+    default:
+      VT = (MVT::SimpleValueType)Table[Index++];
+      break;
+    }
+    Result = !::CheckType(VT, N, SDISel.TLI, SDISel.CurDAG->getDataLayout());
     return Index;
+  }
   case SelectionDAGISel::OPC_CheckTypeRes: {
     unsigned Res = Table[Index++];
-    Result = !::CheckType(Table, Index, N.getValue(Res), SDISel.TLI,
-                          SDISel.CurDAG->getDataLayout());
+    Result = !::CheckType((MVT::SimpleValueType)Table[Index++], N.getValue(Res),
----------------
ilovepi wrote:

I think we prefer `static_cast<MVT::SimpleValueType>(...)` over C-Style casting. see https://llvm.org/docs/CodingStandards.html#prefer-c-style-casts

Can you change this and other instances to use the appropriate cast?

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


More information about the llvm-commits mailing list