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

[SimplifyCFG] Allow merging invoke's with different attrs #111713

Closed
wants to merge 2 commits into from

Conversation

goldsteinn
Copy link
Contributor

Same logic as other callsites, if the attributes are intersectable, we merge.

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 9, 2024

@llvm/pr-subscribers-llvm-transforms

Author: None (goldsteinn)

Changes

Same logic as other callsites, if the attributes are intersectable, we merge.


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

2 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/SimplifyCFG.cpp (+5-1)
  • (modified) llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad.ll (+222-56)
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 18d26aaf460662..566ae2cf1936e9 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2779,7 +2779,7 @@ bool CompatibleSets::shouldBelongToSameSet(ArrayRef<InvokeInst *> Invokes) {
   // including operand bundles.
   const InvokeInst *II0 = Invokes.front();
   for (auto *II : Invokes.drop_front())
-    if (!II->isSameOperationAs(II0))
+    if (!II->isSameOperationAs(II0, Instruction::CompareUsingIntersectedAttrs))
       return false;
 
   // Can we theoretically form the data operands for the merged `invoke`?
@@ -2918,6 +2918,10 @@ static void mergeCompatibleInvokesImpl(ArrayRef<InvokeInst *> Invokes,
     for (BasicBlock *OrigSuccBB : successors(II->getParent()))
       OrigSuccBB->removePredecessor(II->getParent());
     BranchInst::Create(MergedInvoke->getParent(), II->getParent());
+    bool Success = MergedInvoke->tryIntersectAttributes(II);
+    assert(Success && "Merged invokes with incompatible attributes");
+    // For NDEBUG Compile
+    (void)Success;
     II->replaceAllUsesWith(MergedInvoke);
     II->eraseFromParent();
     ++NumInvokesMerged;
diff --git a/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad.ll b/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad.ll
index f7f65ecac896a2..3aff1f0f4f3afa 100644
--- a/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad.ll
+++ b/llvm/test/Transforms/SimplifyCFG/X86/merge-compatible-invokes-of-landingpad.ll
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -sink-common-insts -S | FileCheck %s
 ; RUN: opt < %s -passes='simplifycfg<sink-common-insts>' -S | FileCheck %s
 
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu"
 
 ; Simple test, nothing interesting happens here.
 define void @t0_noop() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t0_noop(
+; CHECK-LABEL: define {{[^@]+}}@t0_noop() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
@@ -47,7 +47,7 @@ if.end:
 
 ; More interesting test, here we can merge the invokes.
 define void @t1_mergeable_invoke() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t1_mergeable_invoke(
+; CHECK-LABEL: define {{[^@]+}}@t1_mergeable_invoke() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -100,7 +100,7 @@ if.end:
 
 ; normal block is shared, but it is unreachable, so we are fine.
 define void @t2_shared_normal_dest() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t2_shared_normal_dest(
+; CHECK-LABEL: define {{[^@]+}}@t2_shared_normal_dest() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -150,7 +150,7 @@ if.end:
 
 ; shared normal destination is not unreachable.
 define void @t3_shared_identical_normal_dest() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t3_shared_identical_normal_dest(
+; CHECK-LABEL: define {{[^@]+}}@t3_shared_identical_normal_dest() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -202,7 +202,7 @@ if.end:
 
 ; normal destinations are not unreachable and not shared and can not be merged.
 define void @t4_normal_dests() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t4_normal_dests(
+; CHECK-LABEL: define {{[^@]+}}@t4_normal_dests() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -264,7 +264,7 @@ if.end:
 
 ; Invokes lead to different landing pads.
 define void @t5_different_landingpads() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t5_different_landingpads(
+; CHECK-LABEL: define {{[^@]+}}@t5_different_landingpads() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -335,7 +335,7 @@ if.end:
 
 ; The invoked functions are different
 define void @t6_different_invokes() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t6_different_invokes(
+; CHECK-LABEL: define {{[^@]+}}@t6_different_invokes() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -393,7 +393,7 @@ if.end:
 
 ; Merging of this invoke is disallowed
 define void @t7_nomerge0() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t7_nomerge0(
+; CHECK-LABEL: define {{[^@]+}}@t7_nomerge0() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -449,7 +449,7 @@ if.end:
   ret void
 }
 define void @t8_nomerge1() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t8_nomerge1(
+; CHECK-LABEL: define {{[^@]+}}@t8_nomerge1() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -505,7 +505,7 @@ if.end:
   ret void
 }
 define void @t9_nomerge2() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t9_nomerge2(
+; CHECK-LABEL: define {{[^@]+}}@t9_nomerge2() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -563,7 +563,7 @@ if.end:
 
 ; Just don't deal with inlineasm.
 define void @t10_inlineasm() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t10_inlineasm(
+; CHECK-LABEL: define {{[^@]+}}@t10_inlineasm() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -621,7 +621,7 @@ if.end:
 
 ; landingpad has PHI nodes, and the incoming values are incompatible.
 define void @t11_phi_in_landingpad_incompatible_incoming_values() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t11_phi_in_landingpad_incompatible_incoming_values(
+; CHECK-LABEL: define {{[^@]+}}@t11_phi_in_landingpad_incompatible_incoming_values() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -683,7 +683,7 @@ if.end:
 
 ; It is okay for the invoke to take arguments
 define void @t12_arguments_are_fine() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t12_arguments_are_fine(
+; CHECK-LABEL: define {{[^@]+}}@t12_arguments_are_fine() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -736,7 +736,7 @@ if.end:
 
 ; It is okay for the invoke to take different arguments
 define void @t13_different_arguments_are_fine() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t13_different_arguments_are_fine(
+; CHECK-LABEL: define {{[^@]+}}@t13_different_arguments_are_fine() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -790,7 +790,7 @@ if.end:
 
 ; There can be more than two invokes in a set
 define void @t14_three_invokes() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t14_three_invokes(
+; CHECK-LABEL: define {{[^@]+}}@t14_three_invokes() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN2_INVOKE:%.*]], label [[IF_ELSE0:%.*]]
@@ -856,7 +856,7 @@ if.end:
 
 ; If not all invokes of landingpad are compatible then we still merge compatible ones.
 define void @t15_three_invokes_only_two_compatible() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t15_three_invokes_only_two_compatible(
+; CHECK-LABEL: define {{[^@]+}}@t15_three_invokes_only_two_compatible() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE0:%.*]]
@@ -927,7 +927,7 @@ if.end:
 
 ; We succeed in merging invokes into two sets
 define void @t16_four_invokes_forming_two_sets() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t16_four_invokes_forming_two_sets(
+; CHECK-LABEL: define {{[^@]+}}@t16_four_invokes_forming_two_sets() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE0:%.*]]
@@ -1009,14 +1009,170 @@ if.end:
   ret void
 }
 
-; Attributes must match
+define void @t17_mismatched_attrs_okay_merge() personality ptr @__gxx_personality_v0 {
+; CHECK-LABEL: define {{[^@]+}}@t17_mismatched_attrs_okay_merge() personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
+; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
+; CHECK:       lpad:
+; CHECK-NEXT:    [[EH:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT:            cleanup
+; CHECK-NEXT:    call void @destructor()
+; CHECK-NEXT:    resume { ptr, i32 } [[EH]]
+; CHECK:       if.else:
+; CHECK-NEXT:    [[C1:%.*]] = call i1 @cond()
+; CHECK-NEXT:    br i1 [[C1]], label [[IF_THEN1_INVOKE]], label [[IF_END:%.*]]
+; CHECK:       if.then1.invoke:
+; CHECK-NEXT:    invoke void @simple_throw()
+; CHECK-NEXT:            to label [[IF_THEN1_CONT:%.*]] unwind label [[LPAD:%.*]]
+; CHECK:       if.then1.cont:
+; CHECK-NEXT:    unreachable
+; CHECK:       if.end:
+; CHECK-NEXT:    call void @sideeffect()
+; CHECK-NEXT:    ret void
+;
+entry:
+  %c0 = call i1 @cond()
+  br i1 %c0, label %if.then0, label %if.else
+
+if.then0:
+  invoke void @simple_throw() readnone to label %invoke.cont0 unwind label %lpad
+
+invoke.cont0:
+  unreachable
+
+lpad:
+  %eh = landingpad { ptr, i32 } cleanup
+  call void @destructor()
+  resume { ptr, i32 } %eh
+
+if.else:
+  %c1 = call i1 @cond()
+  br i1 %c1, label %if.then1, label %if.end
+
+if.then1:
+  invoke void @simple_throw() to label %invoke.cont2 unwind label %lpad
+
+invoke.cont2:
+  unreachable
+
+if.end:
+  call void @sideeffect()
+  ret void
+}
+
+define void @t17_mismatched_attrs_okay_merge_intersect() personality ptr @__gxx_personality_v0 {
+; CHECK-LABEL: define {{[^@]+}}@t17_mismatched_attrs_okay_merge_intersect() personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
+; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
+; CHECK:       lpad:
+; CHECK-NEXT:    [[EH:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT:            cleanup
+; CHECK-NEXT:    call void @destructor()
+; CHECK-NEXT:    resume { ptr, i32 } [[EH]]
+; CHECK:       if.else:
+; CHECK-NEXT:    [[C1:%.*]] = call i1 @cond()
+; CHECK-NEXT:    br i1 [[C1]], label [[IF_THEN1_INVOKE]], label [[IF_END:%.*]]
+; CHECK:       if.then1.invoke:
+; CHECK-NEXT:    invoke void @simple_throw() #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:            to label [[IF_THEN1_CONT:%.*]] unwind label [[LPAD:%.*]]
+; CHECK:       if.then1.cont:
+; CHECK-NEXT:    unreachable
+; CHECK:       if.end:
+; CHECK-NEXT:    call void @sideeffect()
+; CHECK-NEXT:    ret void
+;
+entry:
+  %c0 = call i1 @cond()
+  br i1 %c0, label %if.then0, label %if.else
+
+if.then0:
+  invoke void @simple_throw() readnone cold to label %invoke.cont0 unwind label %lpad
+
+invoke.cont0:
+  unreachable
+
+lpad:
+  %eh = landingpad { ptr, i32 } cleanup
+  call void @destructor()
+  resume { ptr, i32 } %eh
+
+if.else:
+  %c1 = call i1 @cond()
+  br i1 %c1, label %if.then1, label %if.end
+
+if.then1:
+  invoke void @simple_throw() readnone to label %invoke.cont2 unwind label %lpad
+
+invoke.cont2:
+  unreachable
+
+if.end:
+  call void @sideeffect()
+  ret void
+}
+
+define void @t17_mismatched_attrs_okay_merge_intersect2() personality ptr @__gxx_personality_v0 {
+; CHECK-LABEL: define {{[^@]+}}@t17_mismatched_attrs_okay_merge_intersect2() personality ptr @__gxx_personality_v0 {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
+; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
+; CHECK:       lpad:
+; CHECK-NEXT:    [[EH:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT:            cleanup
+; CHECK-NEXT:    call void @destructor()
+; CHECK-NEXT:    resume { ptr, i32 } [[EH]]
+; CHECK:       if.else:
+; CHECK-NEXT:    [[C1:%.*]] = call i1 @cond()
+; CHECK-NEXT:    br i1 [[C1]], label [[IF_THEN1_INVOKE]], label [[IF_END:%.*]]
+; CHECK:       if.then1.invoke:
+; CHECK-NEXT:    invoke void @simple_throw() #[[ATTR2]]
+; CHECK-NEXT:            to label [[IF_THEN1_CONT:%.*]] unwind label [[LPAD:%.*]]
+; CHECK:       if.then1.cont:
+; CHECK-NEXT:    unreachable
+; CHECK:       if.end:
+; CHECK-NEXT:    call void @sideeffect()
+; CHECK-NEXT:    ret void
+;
+entry:
+  %c0 = call i1 @cond()
+  br i1 %c0, label %if.then0, label %if.else
+
+if.then0:
+  invoke void @simple_throw() readnone to label %invoke.cont0 unwind label %lpad
+
+invoke.cont0:
+  unreachable
+
+lpad:
+  %eh = landingpad { ptr, i32 } cleanup
+  call void @destructor()
+  resume { ptr, i32 } %eh
+
+if.else:
+  %c1 = call i1 @cond()
+  br i1 %c1, label %if.then1, label %if.end
+
+if.then1:
+  invoke void @simple_throw() readnone cold to label %invoke.cont2 unwind label %lpad
+
+invoke.cont2:
+  unreachable
+
+if.end:
+  call void @sideeffect()
+  ret void
+}
+
+
 define void @t17_mismatched_attrs_prevent_merge() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t17_mismatched_attrs_prevent_merge(
+; CHECK-LABEL: define {{[^@]+}}@t17_mismatched_attrs_prevent_merge() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then0:
-; CHECK-NEXT:    invoke void @simple_throw() #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    invoke void @simple_throw() #[[ATTR3:[0-9]+]]
 ; CHECK-NEXT:            to label [[INVOKE_CONT0:%.*]] unwind label [[LPAD:%.*]]
 ; CHECK:       invoke.cont0:
 ; CHECK-NEXT:    unreachable
@@ -1042,7 +1198,7 @@ entry:
   br i1 %c0, label %if.then0, label %if.else
 
 if.then0:
-  invoke void @simple_throw() readnone to label %invoke.cont0 unwind label %lpad
+  invoke void @simple_throw() strictfp to label %invoke.cont0 unwind label %lpad
 
 invoke.cont0:
   unreachable
@@ -1067,9 +1223,10 @@ if.end:
   ret void
 }
 
+
 ; Common attributes are preserved
 define void @t18_attributes_are_preserved() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t18_attributes_are_preserved(
+; CHECK-LABEL: define {{[^@]+}}@t18_attributes_are_preserved() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -1122,7 +1279,7 @@ if.end:
 
 ; Fully identical operand bundles are good.
 define void @t19_compatible_operand_bundle() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t19_compatible_operand_bundle(
+; CHECK-LABEL: define {{[^@]+}}@t19_compatible_operand_bundle() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -1175,7 +1332,7 @@ if.end:
 
 ; Operand bundles must be compatible, else we can't merge.
 define void @t20_incompatible_operand_bundle() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t20_incompatible_operand_bundle(
+; CHECK-LABEL: define {{[^@]+}}@t20_incompatible_operand_bundle() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE:%.*]]
@@ -1233,7 +1390,8 @@ if.end:
 
 ; We need to PHI together the arguments of the operand bundles.
 define void @t21_semicompatible_operand_bundle(i32 %a, i32 %b) personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t21_semicompatible_operand_bundle(
+; CHECK-LABEL: define {{[^@]+}}@t21_semicompatible_operand_bundle
+; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -1246,7 +1404,7 @@ define void @t21_semicompatible_operand_bundle(i32 %a, i32 %b) personality ptr @
 ; CHECK-NEXT:    [[C1:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C1]], label [[IF_THEN1_INVOKE]], label [[IF_END:%.*]]
 ; CHECK:       if.then1.invoke:
-; CHECK-NEXT:    [[TMP0:%.*]] = phi i32 [ [[B:%.*]], [[IF_ELSE]] ], [ [[A:%.*]], [[ENTRY:%.*]] ]
+; CHECK-NEXT:    [[TMP0:%.*]] = phi i32 [ [[B]], [[IF_ELSE]] ], [ [[A]], [[ENTRY:%.*]] ]
 ; CHECK-NEXT:    invoke void @simple_throw() [ "abc"(i32 [[TMP0]]) ]
 ; CHECK-NEXT:            to label [[IF_THEN1_CONT:%.*]] unwind label [[LPAD:%.*]]
 ; CHECK:       if.then1.cont:
@@ -1288,7 +1446,7 @@ if.end:
 ; Even though the normal destinations are unreachable,
 ; they may have (dead) PHI nodes, so we must cleanup them.
 define void @t22_dead_phi_in_normal_dest() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t22_dead_phi_in_normal_dest(
+; CHECK-LABEL: define {{[^@]+}}@t22_dead_phi_in_normal_dest() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE:%.*]]
@@ -1343,7 +1501,7 @@ if.end:
 
 ; landingpad has PHI nodes, and out of three invokes, only two have compatible incoming values.
 define void @t23_phi_in_landingpad_compatible_incoming_values() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t23_phi_in_landingpad_compatible_incoming_values(
+; CHECK-LABEL: define {{[^@]+}}@t23_phi_in_landingpad_compatible_incoming_values() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN1_INVOKE:%.*]], label [[IF_ELSE0:%.*]]
@@ -1419,7 +1577,7 @@ if.end:
 ; landingpad has two PHI nodes, but depending on which PHI you look,
 ; the invoke sets would be different, so we can't merge invokes here.
 define void @t24_phi_in_landingpad_semi_compatible_incoming_values() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t24_phi_in_landingpad_semi_compatible_incoming_values(
+; CHECK-LABEL: define {{[^@]+}}@t24_phi_in_landingpad_semi_compatible_incoming_values() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] = call i1 @cond()
 ; CHECK-NEXT:    br i1 [[C0]], label [[IF_THEN0:%.*]], label [[IF_ELSE0:%.*]]
@@ -1503,7 +1661,7 @@ if.end:
 
 ; The normal destinations are shared, but the incoming values are incompatible.
 define void @t25_incompatible_phis_in_normal_destination() personality ptr @__gxx_personality_v0 {
-; CHECK-LABEL: @t25_incompatible_phis_in_normal_destination(
+; CHECK-LABEL: define {{[^@]+}}@t25_incompatible_phis_in_normal_destination() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C0:%.*]] ...
[truncated]

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1,4 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest regenerating with --version 5 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will regen before pushing.

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

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

LG

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

Successfully merging this pull request may close these issues.

4 participants