[llvm] [SelectionDAG][X86] Handle `llvm.type.test` in DAGBuilder (PR #142939)

Abhishek Kaushik via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 05:14:20 PDT 2025


================
@@ -7384,6 +7384,22 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     setValue(&I, getValue(I.getOperand(0)));
     return;
 
+  case Intrinsic::type_test:
+  case Intrinsic::public_type_test: {
+    bool AllUsersAreAssume = llvm::all_of(I.users(), [](const User *U) {
+      if (const auto *call = dyn_cast<CallInst>(U)) {
+        return call->getIntrinsicID() == Intrinsic::assume;
+      }
+      return false;
+    });
+
+    if (AllUsersAreAssume)
+      setValue(&I, DAG.getUNDEF(MVT::i1));
+    else
+      setValue(&I, DAG.getConstant(1, sdl, MVT::i1));
----------------
abhishek-kaushik22 wrote:

I've changed it to always have a true value, so that we don't have false alarms when bisecting.

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


More information about the llvm-commits mailing list