Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Verifier] Add LandingPad type checks #87198

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlexDenisov
Copy link
Member

During lowering GlobalISel and SelectionDAG expect LandingPad type to have two elements, specifying wrong type leads to asssertion in debug builds and to a crash in release builds.

Verification attempts to prevent these crashes at an earlier stage thus helping with debugging.

Additional notes:

  • verification here only checks for the number of values in the LP type and not the exact types of the underlying values
  • verification allows more types than expected by GlobalISel: GlobalISel only allows StructType, but the CodeGen setup is not known at verification time. Proper behaviour would require fixing GlobalISel to follow the same logic as SelectionDAG
  • tests are updated to use a proper LP type, the updates include compatibility tests, which had the same type-related logic at least as of ~8 years ago[0]

[0] a029531

@@ -4378,6 +4378,29 @@ void Verifier::visitEHPadPredecessors(Instruction &I) {
}
}

// Recursively extract types from the LandingPad type
// Based on ComputeValueVTs
static void linearizeLandingPadTypes(Type *Ty,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is effectively a copy of ComputeValueVTs, but without type conversion and offset calculation which depends on TargetLowering information and DataLayout.
Not sure where to put this code or whether there is some existing functionality I can reuse.

Better suggestions are highly appreciated!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is overkill for what you're verifying. You can just check ArrayType::getNumElements or StructType::getNumElements is 2?

During lowering GlobalISel and SelectionDAG expect LandingPad type to
have two elements, specifying wrong type leads to asssertion in debug
builds and to a crash in release builds.

Verification attempts to prevent these crashes at an earlier stage thus
helping with debugging.

Additional notes:

 - verification here only checks for the number of values in the LP type
   and not the exact types of the underlying values
 - verification allows more types than expected by GlobalISel:
   GlobalISel only allows StructType, but the CodeGen setup is not known
   at verification time. Proper behaviour would require fixing
   GlobalISel to follow the same logic as SelectionDAG
 - tests are updated to use a proper LP type, the updates include
   compatibility tests, which had the same type-related logic at least
   as of ~8 years ago[0]

[0] llvm@a029531
@@ -4378,6 +4378,29 @@ void Verifier::visitEHPadPredecessors(Instruction &I) {
}
}

// Recursively extract types from the LandingPad type
// Based on ComputeValueVTs
static void linearizeLandingPadTypes(Type *Ty,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is overkill for what you're verifying. You can just check ArrayType::getNumElements or StructType::getNumElements is 2?

; CHECK:Only two-valued landingpads are supported
landingpad {ptr} cleanup
ret void
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use more negative test cases. Are 0 sized or scalable types allowed?

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 3, 2024

@llvm/pr-subscribers-llvm-ir

Author: AlexDenisov (AlexDenisov)

Changes

During lowering GlobalISel and SelectionDAG expect LandingPad type to have two elements, specifying wrong type leads to asssertion in debug builds and to a crash in release builds.

Verification attempts to prevent these crashes at an earlier stage thus helping with debugging.

Additional notes:

  • verification here only checks for the number of values in the LP type and not the exact types of the underlying values
  • verification allows more types than expected by GlobalISel: GlobalISel only allows StructType, but the CodeGen setup is not known at verification time. Proper behaviour would require fixing GlobalISel to follow the same logic as SelectionDAG
  • tests are updated to use a proper LP type, the updates include compatibility tests, which had the same type-related logic at least as of ~8 years ago[0]

[0] a029531


Patch is 33.58 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/87198.diff

31 Files Affected:

  • (modified) llvm/lib/IR/Verifier.cpp (+30)
  • (modified) llvm/test/Analysis/CallGraph/do-nothing-intrinsic.ll (+1-1)
  • (modified) llvm/test/Assembler/opaque-ptr.ll (+1-1)
  • (modified) llvm/test/Bitcode/compatibility.ll (+23-23)
  • (modified) llvm/test/Bitcode/operand-bundles.ll (+7-7)
  • (modified) llvm/test/Bitcode/use-list-order2.ll (+2-2)
  • (modified) llvm/test/Feature/OperandBundles/merge-func.ll (+2-2)
  • (modified) llvm/test/Linker/drop-attribute.ll (+1-1)
  • (modified) llvm/test/Transforms/ConstantHoisting/ARM/bad-cases.ll (+1-1)
  • (modified) llvm/test/Transforms/HotColdSplit/eh-pads.ll (+3-3)
  • (modified) llvm/test/Transforms/HotColdSplit/unwind.ll (+2-2)
  • (modified) llvm/test/Transforms/IROutliner/illegal-invoke.ll (+4-4)
  • (modified) llvm/test/Transforms/IROutliner/illegal-landingpad.ll (+4-4)
  • (modified) llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll (+2-2)
  • (modified) llvm/test/Transforms/Inline/deopt-bundles.ll (+3-3)
  • (modified) llvm/test/Transforms/Inline/deoptimize-intrinsic.ll (+1-1)
  • (modified) llvm/test/Transforms/Inline/guard-intrinsic.ll (+1-1)
  • (modified) llvm/test/Transforms/Inline/inline_returns_twice.ll (+4-4)
  • (modified) llvm/test/Transforms/Inline/invoke-cleanup.ll (+4-4)
  • (modified) llvm/test/Transforms/Inline/invoke-combine-clauses.ll (+12-12)
  • (modified) llvm/test/Transforms/InstCombine/freeze.ll (+8-8)
  • (modified) llvm/test/Transforms/InstSimplify/freeze.ll (+9-7)
  • (modified) llvm/test/Transforms/InstSimplify/known-never-nan.ll (+4-4)
  • (modified) llvm/test/Transforms/LowerInvoke/2003-12-10-Crash.ll (+1-1)
  • (modified) llvm/test/Transforms/MemCpyOpt/stack-move.ll (+4-4)
  • (modified) llvm/test/Transforms/SCCP/landingpad.ll (+2-2)
  • (modified) llvm/test/Transforms/SLPVectorizer/X86/horizontal.ll (+2-2)
  • (modified) llvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll (+1-1)
  • (modified) llvm/test/Transforms/SimplifyCFG/pr39807.ll (+1-1)
  • (modified) llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll (+1-1)
  • (added) llvm/test/Verifier/landingpad-types.ll (+16)
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 33f358440a312d..65c5f85419acd9 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -4378,6 +4378,29 @@ void Verifier::visitEHPadPredecessors(Instruction &I) {
   }
 }
 
+// Recursively extract types from the LandingPad type
+// Based on ComputeValueVTs
+static void linearizeLandingPadTypes(Type *Ty,
+                                     SmallVectorImpl<Type *> &LPITypes) {
+  if (StructType *STy = dyn_cast<StructType>(Ty)) {
+    for (unsigned I = 0, E = STy->getNumElements(); I != E; ++I) {
+      linearizeLandingPadTypes(STy->getElementType(I), LPITypes);
+    }
+    return;
+  }
+  // Given an array type, recursively traverse the elements.
+  if (ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
+    Type *EltTy = ATy->getElementType();
+    for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
+      linearizeLandingPadTypes(EltTy, LPITypes);
+    return;
+  }
+  // Interpret void as zero return values.
+  if (Ty->isVoidTy())
+    return;
+  LPITypes.push_back(Ty);
+}
+
 void Verifier::visitLandingPadInst(LandingPadInst &LPI) {
   // The landingpad instruction is ill-formed if it doesn't have any clauses and
   // isn't a cleanup.
@@ -4394,6 +4417,13 @@ void Verifier::visitLandingPadInst(LandingPadInst &LPI) {
           "inside a function.",
           &LPI);
 
+  if (!LandingPadResultTy->isTokenTy()) {
+    SmallVector<Type *, 4> linearizedLPITypes;
+    linearizeLandingPadTypes(LandingPadResultTy, linearizedLPITypes);
+    Check(linearizedLPITypes.size() == 2,
+          "Only two-valued landingpads are supported.", &LPI);
+  }
+
   Function *F = LPI.getParent()->getParent();
   Check(F->hasPersonalityFn(),
         "LandingPadInst needs to be in a function with a personality.", &LPI);
diff --git a/llvm/test/Analysis/CallGraph/do-nothing-intrinsic.ll b/llvm/test/Analysis/CallGraph/do-nothing-intrinsic.ll
index fc2c541736e7b3..8d8f98a35d62e6 100644
--- a/llvm/test/Analysis/CallGraph/do-nothing-intrinsic.ll
+++ b/llvm/test/Analysis/CallGraph/do-nothing-intrinsic.ll
@@ -5,7 +5,7 @@ define void @main() personality i8 0 {
   invoke void @llvm.donothing()
           to label %ret unwind label %unw
 unw:
-  %tmp = landingpad i8 cleanup
+  %tmp = landingpad { ptr, i8 } cleanup
   br label %ret
 ret:
   ret void
diff --git a/llvm/test/Assembler/opaque-ptr.ll b/llvm/test/Assembler/opaque-ptr.ll
index 236a64904bc957..7e1f792d201681 100644
--- a/llvm/test/Assembler/opaque-ptr.ll
+++ b/llvm/test/Assembler/opaque-ptr.ll
@@ -157,7 +157,7 @@ continue:
   ret void
 
 cleanup:
-  landingpad {}
+  landingpad { ptr, i8 }
     cleanup
   ret void
 }
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll
index b374924516d665..f8002fd12a273b 100644
--- a/llvm/test/Bitcode/compatibility.ll
+++ b/llvm/test/Bitcode/compatibility.ll
@@ -726,7 +726,7 @@ define void @f.no_personality() personality i8 3 {
 ; CHECK: define void @f.no_personality() personality i8 3
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -738,7 +738,7 @@ define void @f.personality() personality ptr @f.personality_handler {
 ; CHECK: define void @f.personality() personality ptr @f.personality_handler
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i32 cleanup
+  %cleanup = landingpad { ptr, i32 } cleanup
   br label %normal
 normal:
   ret void
@@ -1173,12 +1173,12 @@ defaultdest.2:
          to label %defaultdest unwind label %exc
          ; CHECK: to label %defaultdest unwind label %exc
 exc:
-  %cleanup = landingpad i32 cleanup
+  %cleanup = landingpad { ptr, i32 } cleanup
 
-  resume i32 undef
-  ; CHECK: resume i32 undef
-  resume i32 poison
-  ; CHECK: resume i32 poison
+  resume { ptr, i32 } undef
+  ; CHECK: resume { ptr, i32 } undef
+  resume { ptr, i32 } poison
+  ; CHECK: resume { ptr, i32 } poison
   unreachable
   ; CHECK: unreachable
 
@@ -1601,15 +1601,15 @@ define void @instructions.landingpad() personality i32 -2 {
   invoke void @llvm.donothing() to label %proceed unwind label %catch4
 
 catch1:
-  landingpad i32
-  ; CHECK: landingpad i32
+  landingpad { ptr, i32 }
+  ; CHECK: landingpad { ptr, i32 }
              cleanup
              ; CHECK: cleanup
   br label %proceed
 
 catch2:
-  landingpad i32
-  ; CHECK: landingpad i32
+  landingpad { ptr, i32 }
+  ; CHECK: landingpad { ptr, i32 }
              cleanup
              ; CHECK: cleanup
              catch ptr null
@@ -1617,8 +1617,8 @@ catch2:
   br label %proceed
 
 catch3:
-  landingpad i32
-  ; CHECK: landingpad i32
+  landingpad { ptr, i32 }
+  ; CHECK: landingpad { ptr, i32 }
              cleanup
              ; CHECK: cleanup
              catch ptr null
@@ -1628,8 +1628,8 @@ catch3:
   br label %proceed
 
 catch4:
-  landingpad i32
-  ; CHECK: landingpad i32
+  landingpad { ptr, i32 }
+  ; CHECK: landingpad { ptr, i32 }
              filter [2 x i32] zeroinitializer
              ; CHECK: filter [2 x i32] zeroinitializer
   br label %proceed
@@ -1831,7 +1831,7 @@ define void @invoke_with_operand_bundle0(ptr %ptr) personality i8 3 {
 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -1847,7 +1847,7 @@ define void @invoke_with_operand_bundle1(ptr %ptr) personality i8 3 {
 ; CHECK: invoke void @op_bundle_callee_0(){{$}}
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 
 normal:
@@ -1855,7 +1855,7 @@ normal:
 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
 
 exception1:
-  %cleanup1 = landingpad i8 cleanup
+  %cleanup1 = landingpad { ptr, i8 } cleanup
   br label %normal1
 
 normal1:
@@ -1863,7 +1863,7 @@ normal1:
 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception2:
-  %cleanup2 = landingpad i8 cleanup
+  %cleanup2 = landingpad { ptr, i8 } cleanup
   br label %normal2
 
 normal2:
@@ -1877,7 +1877,7 @@ define void @invoke_with_operand_bundle2(ptr %ptr) personality i8 3 {
 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"() ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -1892,7 +1892,7 @@ define void @invoke_with_operand_bundle3(ptr %ptr) personality i8 3 {
 ; CHECK: invoke void @op_bundle_callee_0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -1908,7 +1908,7 @@ define void @invoke_with_operand_bundle4(ptr %ptr) personality i8 3 {
 ; CHECK: invoke void @op_bundle_callee_1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -1925,7 +1925,7 @@ define void @invoke_with_operand_bundle_vaarg(ptr %ptr) personality i8 3 {
 ; CHECK: invoke void (...) @vaargs_func(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
diff --git a/llvm/test/Bitcode/operand-bundles.ll b/llvm/test/Bitcode/operand-bundles.ll
index ab28cffd84aa29..9f3fcd907910c8 100644
--- a/llvm/test/Bitcode/operand-bundles.ll
+++ b/llvm/test/Bitcode/operand-bundles.ll
@@ -68,7 +68,7 @@ define void @g0(i32* %ptr) personality i8 3 {
 ; CHECK: invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float  0.000000e+00, i64 100, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -84,7 +84,7 @@ define void @g1(i32* %ptr) personality i8 3 {
 ; CHECK: invoke void @callee0(){{$}}
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 
 normal:
@@ -92,7 +92,7 @@ normal:
 ; CHECK: invoke void @callee0() [ "foo"() ]
 
 exception1:
-  %cleanup1 = landingpad i8 cleanup
+  %cleanup1 = landingpad { ptr, i8 } cleanup
   br label %normal1
 
 normal1:
@@ -100,7 +100,7 @@ normal1:
 ; CHECK: invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception2:
-  %cleanup2 = landingpad i8 cleanup
+  %cleanup2 = landingpad { ptr, i8 } cleanup
   br label %normal2
 
 normal2:
@@ -114,7 +114,7 @@ define void @g2(i32* %ptr) personality i8 3 {
 ; CHECK: invoke void @callee0() [ "foo"() ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -129,7 +129,7 @@ define void @g3(i32* %ptr) personality i8 3 {
 ; CHECK: invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -145,7 +145,7 @@ define void @g4(i32* %ptr) personality i8 3 {
 ; CHECK: invoke void @callee1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float  0.000000e+00, i32 %l) ]
 
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
diff --git a/llvm/test/Bitcode/use-list-order2.ll b/llvm/test/Bitcode/use-list-order2.ll
index aafa3d552bbee6..41bc80619216c1 100644
--- a/llvm/test/Bitcode/use-list-order2.ll
+++ b/llvm/test/Bitcode/use-list-order2.ll
@@ -8,7 +8,7 @@ declare void @llvm.donothing() nounwind readnone
 define void @f.no_personality1() personality i8 0 {
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -21,7 +21,7 @@ normal:
 define void @f.no_personality2() personality i8 -1 {
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
diff --git a/llvm/test/Feature/OperandBundles/merge-func.ll b/llvm/test/Feature/OperandBundles/merge-func.ll
index 772cd774c8e537..16e1564fe63ad1 100644
--- a/llvm/test/Feature/OperandBundles/merge-func.ll
+++ b/llvm/test/Feature/OperandBundles/merge-func.ll
@@ -44,7 +44,7 @@ define i32 @f.invoke() personality i8 3 {
   ret i32 %v0
 
  exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   ret i32 0
 }
 
@@ -59,6 +59,6 @@ define i32 @g.invoke() personality i8 3 {
   ret i32 %v0
 
  exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   ret i32 0
 }
diff --git a/llvm/test/Linker/drop-attribute.ll b/llvm/test/Linker/drop-attribute.ll
index 9be95a89109b4e..69bcff5c4239c6 100644
--- a/llvm/test/Linker/drop-attribute.ll
+++ b/llvm/test/Linker/drop-attribute.ll
@@ -22,7 +22,7 @@ entry:
   invoke void @test_nocallback_call_site() nocallback
           to label %ret unwind label %unw
 unw:
-  %tmp = landingpad i8 cleanup
+  %tmp = landingpad { ptr, i8 } cleanup
   br label %ret
 ret:
   ret i32 0
diff --git a/llvm/test/Transforms/ConstantHoisting/ARM/bad-cases.ll b/llvm/test/Transforms/ConstantHoisting/ARM/bad-cases.ll
index 2cb46afb1f5bea..2b168791adc1af 100644
--- a/llvm/test/Transforms/ConstantHoisting/ARM/bad-cases.ll
+++ b/llvm/test/Transforms/ConstantHoisting/ARM/bad-cases.ll
@@ -123,7 +123,7 @@ define i32 @inline_asm_invoke() personality ptr null {
 L:
   ret i32 %X
 lpad:
-  %lp = landingpad i32
+  %lp = landingpad { ptr, i32 }
       cleanup
       catch ptr @exception_type
   ret i32 1
diff --git a/llvm/test/Transforms/HotColdSplit/eh-pads.ll b/llvm/test/Transforms/HotColdSplit/eh-pads.ll
index ad7baf97f68d0c..11c20628044d00 100644
--- a/llvm/test/Transforms/HotColdSplit/eh-pads.ll
+++ b/llvm/test/Transforms/HotColdSplit/eh-pads.ll
@@ -12,7 +12,7 @@ entry:
 
 exception:
   ; Note: EH pads are not candidates for region entry points.
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %continue_exception
 
 continue_exception:
@@ -42,7 +42,7 @@ continue:
 
 exception:
   ; Note: EH pads are not candidates for region entry points.
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %trivial-eh-handler
 
 trivial-eh-handler:
@@ -75,7 +75,7 @@ cold3:
   ret void
 
 cold4:
-  landingpad i8 cleanup
+  landingpad { ptr, i8 } cleanup
   ret void
 }
 
diff --git a/llvm/test/Transforms/HotColdSplit/unwind.ll b/llvm/test/Transforms/HotColdSplit/unwind.ll
index 058fb32f319ab2..c8ea4ba07908b9 100644
--- a/llvm/test/Transforms/HotColdSplit/unwind.ll
+++ b/llvm/test/Transforms/HotColdSplit/unwind.ll
@@ -16,7 +16,7 @@ entry:
   invoke void @llvm.donothing() to label %normal unwind label %exception
 
 exception:
-  %cleanup = landingpad i32 cleanup
+  %cleanup = landingpad { ptr, i32 } cleanup
   br i1 undef, label %normal, label %continue_exception
 
 continue_exception:
@@ -25,7 +25,7 @@ continue_exception:
   br label %resume-eh
 
 resume-eh:
-  resume i32 undef
+  resume { ptr, i32 } undef
 
 normal:
   br i1 undef, label %continue_exception, label %exit
diff --git a/llvm/test/Transforms/IROutliner/illegal-invoke.ll b/llvm/test/Transforms/IROutliner/illegal-invoke.ll
index 82d62b928a3f83..7d7d59d37eec9f 100644
--- a/llvm/test/Transforms/IROutliner/illegal-invoke.ll
+++ b/llvm/test/Transforms/IROutliner/illegal-invoke.ll
@@ -16,7 +16,7 @@ define void @function1() personality i8 3 {
 ; CHECK-NEXT:    invoke void @llvm.donothing()
 ; CHECK-NEXT:    to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]]
 ; CHECK:       exception:
-; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad i8
+; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad { ptr, i8 }
 ; CHECK-NEXT:    cleanup
 ; CHECK-NEXT:    br label [[NORMAL]]
 ; CHECK:       normal:
@@ -29,7 +29,7 @@ entry:
   store i32 3, ptr %b, align 4
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
@@ -44,7 +44,7 @@ define void @function2() personality i8 3 {
 ; CHECK-NEXT:    invoke void @llvm.donothing()
 ; CHECK-NEXT:    to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]]
 ; CHECK:       exception:
-; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad i8
+; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad { ptr, i8 }
 ; CHECK-NEXT:    cleanup
 ; CHECK-NEXT:    br label [[NORMAL]]
 ; CHECK:       normal:
@@ -57,7 +57,7 @@ entry:
   store i32 3, ptr %b, align 4
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   br label %normal
 normal:
   ret void
diff --git a/llvm/test/Transforms/IROutliner/illegal-landingpad.ll b/llvm/test/Transforms/IROutliner/illegal-landingpad.ll
index 5d70d55ab6e4e8..f966adc05d3661 100644
--- a/llvm/test/Transforms/IROutliner/illegal-landingpad.ll
+++ b/llvm/test/Transforms/IROutliner/illegal-landingpad.ll
@@ -15,7 +15,7 @@ define void @function1() personality i8 3 {
 ; CHECK-NEXT:    invoke void @llvm.donothing()
 ; CHECK-NEXT:    to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]]
 ; CHECK:       exception:
-; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad i8
+; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad { ptr, i8 }
 ; CHECK-NEXT:    cleanup
 ; CHECK-NEXT:    call void @outlined_ir_func_0(ptr [[A]], ptr [[B]])
 ; CHECK-NEXT:    br label [[NORMAL]]
@@ -27,7 +27,7 @@ entry:
   %b = alloca i32, align 4
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   store i32 2, ptr %a, align 4
   store i32 3, ptr %b, align 4
   br label %normal
@@ -43,7 +43,7 @@ define void @function2() personality i8 3 {
 ; CHECK-NEXT:    invoke void @llvm.donothing()
 ; CHECK-NEXT:    to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]]
 ; CHECK:       exception:
-; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad i8
+; CHECK-NEXT:    [[CLEANUP:%.*]] = landingpad { ptr, i8 }
 ; CHECK-NEXT:    cleanup
 ; CHECK-NEXT:    call void @outlined_ir_func_0(ptr [[A]], ptr [[B]])
 ; CHECK-NEXT:    br label [[NORMAL]]
@@ -55,7 +55,7 @@ entry:
   %b = alloca i32, align 4
   invoke void @llvm.donothing() to label %normal unwind label %exception
 exception:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   store i32 2, ptr %a, align 4
   store i32 3, ptr %b, align 4
   br label %normal
diff --git a/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll b/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
index 6f659a88da2e2b..9ec677471f6024 100644
--- a/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
+++ b/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
@@ -760,7 +760,7 @@ define i32 @test14a(i32 %start, ptr %p, ptr %q, i1 %c) personality i1 1 {
 ; CHECK-NEXT:    ret i32 [[TMP2]]
 ; CHECK:       exception:
 ; CHECK-NEXT:    [[FOO_LCSSA1_WIDE:%.*]] = phi i64 [ [[TMP1]], [[BACKEDGE]] ]
-; CHECK-NEXT:    [[TMP3:%.*]] = landingpad i1
+; CHECK-NEXT:    [[TMP3:%.*]] = landingpad { ptr, i1 }
 ; CHECK-NEXT:            cleanup
 ; CHECK-NEXT:    [[TMP4:%.*]] = trunc i64 [[FOO_LCSSA1_WIDE]] to i32
 ; CHECK-NEXT:    ret i32 [[TMP4]]
@@ -788,7 +788,7 @@ exit:
   ret i32 %foo
 
 exception:
-  landingpad i1
+  landingpad { ptr, i1 }
   cleanup
   ret i32 %foo
 }
diff --git a/llvm/test/Transforms/Inline/deopt-bundles.ll b/llvm/test/Transforms/Inline/deopt-bundles.ll
index 57175fabf0df4e..2017e8b34d9b85 100644
--- a/llvm/test/Transforms/Inline/deopt-bundles.ll
+++ b/llvm/test/Transforms/Inline/deopt-bundles.ll
@@ -73,7 +73,7 @@ define i32 @caller_3() personality i8 3 {
   ret i32 %x
 
  unwind:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   ret i32 101
 }
 
@@ -85,7 +85,7 @@ define i32 @callee_4() alwaysinline personality i8 3 {
   ret i32 %v
 
  unwind:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   ret i32 100
 }
 
@@ -105,7 +105,7 @@ define i32 @callee_5() alwaysinline personality i8 3 {
   ret i32 %v
 
  unwind:
-  %cleanup = landingpad i8 cleanup
+  %cleanup = landingpad { ptr, i8 } cleanup
   ret i32 100
 }
 
diff --git a/llvm/test/Transforms/Inline/deoptimize-intrinsic.ll b/llvm/test/Transforms/Inline/deoptimize-intrinsic.ll
index 1cc327ada7ee33..482bd7fa0a7517 100644
--- a/llvm/test/Transforms/Inline/deoptimize-intrinsic.ll
+++ b/llvm/test/Transforms/Inline/deoptimize-intrinsic.ll
@@ -82,7 +82,7 @@ entry:
 ; CHECK-NEXT:  ret i32 42
 
 unwind:
-  %lp = landingpad i32 cleanup
+  %lp = landingpad { ptr, i32 } cleanup
   ret i32 43
 
 normal:
diff --git a/llvm/test/Transforms/Inline/guard-intrinsic.ll b/llvm/test/Transforms/Inline/guard-intrinsic.ll
index 4e2bdfb196a404..e05b0e5d89ed92 100644
--- a/llvm/test/Transforms/Inline/guard-intrinsic.ll
+++ b/llvm/test/Transforms/Inline/guard-intrinsic.ll
@@ -30,7 +30,7 @@ entry:
        unwind label %unwind
 
 unwind:
-  %lp = landingpad i32 cleanup
+  %lp = landingpad { ptr, i32 } cleanup
   ret i32 43
 
 normal:
diff --git a/llvm/test/Transforms/Inline/inline_returns_twice.ll b/llvm/test/Transforms/Inline/inline_returns_twice.ll
index cacedc0e0bcf0a..ee7717e909000e 100644
--- a/llvm/test/Transforms/Inline/inline_returns_twice.ll
+++ b/llvm/test/Transforms/Inline/inline_returns_twice.ll
@@ -48,8 +48,8 @@ cont:
   ret i32 %add
 
 lpad:
-  %lp = landingpad i32 cleanup
-  resume i32 %lp
+  %lp = landingpad { ptr, i32 } cleanup
+  resume {ptr, i32} %lp
 }
 
 define i32 @outer3() {
@@ -71,8 +71,8 @@ cont:
   ret i32 %add
 
 lpad:
-  %lp = landingpad i32 cleanup
-  resume i32 %lp
+  %lp = landingpad { ptr, i32 } cleanup
+ ...
[truncated]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants