[llvm] r247433 - [IR] Print the label operands of a catchpad like an invoke

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 10:27:52 PDT 2015


Author: rnk
Date: Fri Sep 11 12:27:52 2015
New Revision: 247433

URL: http://llvm.org/viewvc/llvm-project?rev=247433&view=rev
Log:
[IR] Print the label operands of a catchpad like an invoke

The rest of the EH pads are fine, since they have at most one label and
take fewer operands for the personality.

Old catchpad vs. new:
  %5 = catchpad [i8* bitcast (i32 ()* @"\01?filt$0 at 0@main@@" to i8*)] to label %__except.ret.10 unwind label %catchendblock.9
-----
  %5 = catchpad [i8* bitcast (i32 ()* @"\01?filt$0 at 0@main@@" to i8*)]
          to label %__except.ret.10 unwind label %catchendblock.9

Modified:
    llvm/trunk/lib/IR/AsmWriter.cpp
    llvm/trunk/test/Bitcode/compatibility.ll
    llvm/trunk/test/CodeGen/WinEH/wineh-cloning.ll
    llvm/trunk/test/Transforms/SimplifyCFG/empty-cleanuppad.ll

Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=247433&r1=247432&r2=247433&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Fri Sep 11 12:27:52 2015
@@ -2847,7 +2847,7 @@ void AssemblyWriter::printInstruction(co
         Out << ", ";
       writeOperand(CPI->getArgOperand(Op), /*PrintType=*/true);
     }
-    Out << "] to ";
+    Out << "]\n          to ";
     writeOperand(CPI->getNormalDest(), /*PrintType=*/true);
     Out << " unwind ";
     writeOperand(CPI->getUnwindDest(), /*PrintType=*/true);

Modified: llvm/trunk/test/Bitcode/compatibility.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/compatibility.ll?rev=247433&r1=247432&r2=247433&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/compatibility.ll (original)
+++ llvm/trunk/test/Bitcode/compatibility.ll Fri Sep 11 12:27:52 2015
@@ -773,15 +773,18 @@ entry:
 
 catchpad1:
   catchpad [] to label %normal unwind label %exn.1
-  ; CHECK: catchpad [] to label %normal unwind label %exn.1
+  ; CHECK: catchpad []
+  ; CHECK-NEXT: to label %normal unwind label %exn.1
 
 catchpad2:
   catchpad [i32* %arg1] to label %normal unwind label %exn.2
-  ; CHECK: catchpad [i32* %arg1] to label %normal unwind label %exn.2
+  ; CHECK: catchpad [i32* %arg1]
+  ; CHECK-NEXT: to label %normal unwind label %exn.2
 
 catchpad3:
   catchpad [i32* %arg1, i32* %arg2] to label %normal unwind label %exn.3
-  ; CHECK: catchpad [i32* %arg1, i32* %arg2] to label %normal unwind label %exn.3
+  ; CHECK: catchpad [i32* %arg1, i32* %arg2] 
+  ; CHECK-NEXT: to label %normal unwind label %exn.3
 
 exn.1:
   catchendpad unwind label %terminate.1
@@ -835,7 +838,8 @@ cleanup:
 
 catchpad:
   %catch = catchpad [] to label %body unwind label %catchend
-  ; CHECK: %catch = catchpad [] to label %body unwind label %catchend
+  ; CHECK: %catch = catchpad []
+  ; CHECK-NEXT: to label %body unwind label %catchend
 
 body:
   invoke void @f.ccc() to label %continue unwind label %catchend

Modified: llvm/trunk/test/CodeGen/WinEH/wineh-cloning.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/wineh-cloning.ll?rev=247433&r1=247432&r2=247433&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WinEH/wineh-cloning.ll (original)
+++ llvm/trunk/test/CodeGen/WinEH/wineh-cloning.ll Fri Sep 11 12:27:52 2015
@@ -33,7 +33,8 @@ endcatch:
 ; CHECK:   invoke void @f()
 ; CHECK:     to label %[[EntryCopy:[^ ]+]] unwind label %catch
 ; CHECK: catch:
-; CHECK:   catchpad [] to label %[[CatchCopy:[^ ]+]] unwind
+; CHECK:   catchpad []
+; CHECK-NEXT: to label %[[CatchCopy:[^ ]+]] unwind
 ; CHECK: [[CatchCopy]]:
 ; CHECK:   [[LoadX2:%[^ ]+]] = load i32, i32* [[Slot]]
 ; CHECK:   call void @h(i32 [[LoadX2]]
@@ -96,7 +97,8 @@ exit:
 ; CHECK:   invoke void @f()
 ; CHECK:     to label %[[exit:[^ ]+]] unwind
 ; CHECK: catch:
-; CHECK:   catchpad [] to label %[[shared:[^ ]+]] unwind
+; CHECK:   catchpad []
+; CHECK-NEXT: to label %[[shared:[^ ]+]] unwind
 ; CHECK: cleanup:
 ; CHECK:   cleanuppad []
 ; CHECK:   call void @f()
@@ -411,7 +413,8 @@ unreachable:
 ; CHECK-NEXT:   %cleanup = cleanuppad
 ; CHECK-NEXT:   cleanupret %cleanup unwind label %outer
 ; CHECK:      outer:
-; CHECK-NEXT:   %catch = catchpad [] to label %catch.body unwind label %endpad
+; CHECK-NEXT:   %catch = catchpad []
+; CHECK-NEXT:	      to label %catch.body unwind label %endpad
 ; CHECK:      catch.body:
 ; CHECK-NEXT:   catchret %catch to label %exit
 ; CHECK:      endpad:

Modified: llvm/trunk/test/Transforms/SimplifyCFG/empty-cleanuppad.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/empty-cleanuppad.ll?rev=247433&r1=247432&r2=247433&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/empty-cleanuppad.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/empty-cleanuppad.ll Fri Sep 11 12:27:52 2015
@@ -126,7 +126,8 @@ ehcleanup.1:
 ; CHECK:   invoke void @g()
 ; CHECK:           to label %try.cont unwind label %catch.dispatch
 ; CHECK: catch.dispatch:
-; CHECK:   catchpad [i8* null, i8* null] to label %catch unwind label %catchendblock
+; CHECK:   catchpad [i8* null, i8* null]
+; CHECK-NEXT: to label %catch unwind label %catchendblock
 ; CHECK: catch:
 ; CHECK:   catchret
 ; CHECK: catchendblock:




More information about the llvm-commits mailing list