[llvm] f6e1306 - [SelectionDAG] Mark LowerTypeTests as required and remove intrinsic handling from #142939 (#179249)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 5 02:16:53 PST 2026


Author: keremsahn
Date: 2026-02-05T11:16:48+01:00
New Revision: f6e130682f12c063ffb7c354fd6cb6f3b0606b98

URL: https://github.com/llvm/llvm-project/commit/f6e130682f12c063ffb7c354fd6cb6f3b0606b98
DIFF: https://github.com/llvm/llvm-project/commit/f6e130682f12c063ffb7c354fd6cb6f3b0606b98.diff

LOG: [SelectionDAG] Mark LowerTypeTests as required and remove intrinsic handling from #142939 (#179249)

Fixes #179125

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/test/CodeGen/X86/pr142937.ll
    llvm/test/Other/opt-bisect-new-pass-manager.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/LowerTypeTests.h b/llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
index a34cbaf72675b..bb8b40955077e 100644
--- a/llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
+++ b/llvm/include/llvm/Transforms/IPO/LowerTypeTests.h
@@ -218,6 +218,7 @@ class LowerTypeTestsPass : public PassInfoMixin<LowerTypeTestsPass> {
                          lowertypetests::DropTestKind::None)
       : ExportSummary(ExportSummary), ImportSummary(ImportSummary),
         DropTypeTests(DropTypeTests) {}
+  static bool isRequired() { return true; }
   LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 

diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 6045b55130925..e191cc5524a14 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7533,7 +7533,8 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
 
   case Intrinsic::type_test:
   case Intrinsic::public_type_test:
-    setValue(&I, getValue(ConstantInt::getTrue(I.getType())));
+    reportFatalUsageError("llvm.type.test intrinsic must be lowered by the "
+                          "LowerTypeTests pass before code generation");
     return;
 
   case Intrinsic::assume:

diff  --git a/llvm/test/CodeGen/X86/pr142937.ll b/llvm/test/CodeGen/X86/pr142937.ll
index 8be99e102ff5b..8001da4efcc6c 100644
--- a/llvm/test/CodeGen/X86/pr142937.ll
+++ b/llvm/test/CodeGen/X86/pr142937.ll
@@ -1,19 +1,10 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
-; RUN: llc < %s -mtriple=i686-- -O0   | FileCheck %s --check-prefix=X86
-; RUN: llc < %s -mtriple=x86_64-- -O0 | FileCheck %s --check-prefix=X64
+; RUN: not llc %s -mtriple=i686-- -O0 2>&1 | FileCheck %s
+; RUN: not llc %s -mtriple=x86_64-- -O0 2>&1 | FileCheck %s
+
+; CHECK: must be lowered by the LowerTypeTests pass
 
 define void @public_type_test() {
-; X86-LABEL: public_type_test:
-; X86:       # %bb.0: # %bb
-; X86-NEXT:    movb $1, %al
-; X86-NEXT:  # %bb.1: # %bb1
-; X86-NEXT:    retl
-;
-; X64-LABEL: public_type_test:
-; X64:       # %bb.0: # %bb
-; X64-NEXT:    movb $1, %al
-; X64-NEXT:  # %bb.1: # %bb1
-; X64-NEXT:    retq
 bb:
   %call = call i1 @llvm.public.type.test(ptr null, metadata !"typeinfo")
   br label %bb1
@@ -24,25 +15,6 @@ bb1:
 }
 
 define void @type_test() {
-; X86-LABEL: type_test:
-; X86:       # %bb.0: # %bb
-; X86-NEXT:    movb $1, %al
-; X86-NEXT:    testb $1, %al
-; X86-NEXT:    jne .LBB1_2
-; X86-NEXT:  # %bb.1: # %bb1
-; X86-NEXT:    ud1l 2(%eax), %eax
-; X86-NEXT:  .LBB1_2: # %bb2
-; X86-NEXT:    retl
-;
-; X64-LABEL: type_test:
-; X64:       # %bb.0: # %bb
-; X64-NEXT:    movb $1, %al
-; X64-NEXT:    testb $1, %al
-; X64-NEXT:    jne .LBB1_2
-; X64-NEXT:  # %bb.1: # %bb1
-; X64-NEXT:    ud1l 2(%eax), %eax
-; X64-NEXT:  .LBB1_2: # %bb2
-; X64-NEXT:    retq
 bb:
   %call = tail call i1 @llvm.type.test(ptr null, metadata !"typeinfo")
   br i1 %call, label %bb2, label %bb1
@@ -56,9 +28,6 @@ bb2:
 }
 
 declare i1 @llvm.public.type.test(ptr, metadata)
-
 declare void @llvm.assume(i1 noundef)
-
 declare i1 @llvm.type.test(ptr, metadata)
-
 declare void @llvm.ubsantrap(i8 immarg)

diff  --git a/llvm/test/Other/opt-bisect-new-pass-manager.ll b/llvm/test/Other/opt-bisect-new-pass-manager.ll
index 8f8078d4d8409..8e7915bd0db75 100644
--- a/llvm/test/Other/opt-bisect-new-pass-manager.ll
+++ b/llvm/test/Other/opt-bisect-new-pass-manager.ll
@@ -90,6 +90,18 @@
 ; CHECK-LIMIT-MULTI-PASS: BISECT: NOT running pass (8) function-attrs on (f4)
 ; CHECK-LIMIT-MULTI-PASS: BISECT: NOT running pass (9) early-cse on f4
 
+; RUN: opt -disable-output -debug-pass-manager \
+; RUN:     -passes=lowertypetests -opt-bisect-limit=-1 %s 2>&1 \
+; RUN:     | FileCheck %s --check-prefix=LTT-ALL
+; LTT-ALL-NOT: BISECT: {{.*}}LowerTypeTestsPass
+; LTT-ALL: Running pass: LowerTypeTestsPass
+
+; RUN: opt -disable-output -debug-pass-manager \
+; RUN:     -passes=lowertypetests -opt-bisect-limit=0 %s 2>&1 \
+; RUN:     | FileCheck %s --check-prefix=LTT-REQUIRED
+; LTT-REQUIRED-NOT: BISECT: {{.*}}LowerTypeTestsPass
+; LTT-REQUIRED: Running pass: LowerTypeTestsPass
+
 ; Make sure we don't skip writing the output to stdout.
 ; RUN: opt %s -opt-bisect-limit=0 -passes=early-cse | opt -S | FileCheck %s -check-prefix=CHECK-OUTPUT
 ; RUN: opt %s -opt-bisect-limit=0 -passes=early-cse -S | FileCheck %s -check-prefix=CHECK-OUTPUT


        


More information about the llvm-commits mailing list