[WebAssembly] Misc. fixes in cfg-stackify-eh.ll

- Fix `preds` comments
- Delete nonexistent attributes in instructions (They used to exist in
  clang-generated files, but I removed most of them to make the tests
  tidy. We have only `nounwind` and `noreturn` left here.)
- Add missing `Function Attrs` comments in function declarations

 None of these affect test function semantics or test results for now.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D97179
This commit is contained in:
Heejin Ahn 2021-02-21 22:18:25 -08:00
parent c32aee5a5e
commit 946a09945f
1 changed files with 26 additions and 19 deletions

View File

@ -775,12 +775,12 @@ invoke.cont: ; preds = %entry
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %b, i32 100, i1 false)
call void @llvm.memmove.p0i8.p0i8.i32(i8* %a, i8* %b, i32 100, i1 false)
call void @llvm.memset.p0i8.i32(i8* %a, i8 0, i32 100, i1 false)
%call = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %o) #1
%call = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %o)
ret void
ehcleanup: ; preds = %entry
%0 = cleanuppad within none []
%call2 = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %o) #1 [ "funclet"(token %0) ]
%call2 = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %o) [ "funclet"(token %0) ]
cleanupret from %0 unwind to caller
}
@ -833,27 +833,27 @@ catch.start: ; preds = %catch.dispatch
%1 = catchpad within %0 [i8* bitcast ({ i8*, i8* }* @_ZTI7MyClass to i8*)]
%2 = call i8* @llvm.wasm.get.exception(token %1)
%3 = call i32 @llvm.wasm.get.ehselector(token %1)
%4 = call i32 @llvm.eh.typeid.for(i8* bitcast ({ i8*, i8* }* @_ZTI7MyClass to i8*)) #3
%4 = call i32 @llvm.eh.typeid.for(i8* bitcast ({ i8*, i8* }* @_ZTI7MyClass to i8*))
%matches = icmp eq i32 %3, %4
br i1 %matches, label %catch, label %rethrow
catch: ; preds = %catch.start
%5 = call i8* @__cxa_get_exception_ptr(i8* %2) #3 [ "funclet"(token %1) ]
%5 = call i8* @__cxa_get_exception_ptr(i8* %2) [ "funclet"(token %1) ]
%6 = bitcast i8* %5 to %class.MyClass*
%call = call %class.MyClass* @_ZN7MyClassC2ERKS_(%class.MyClass* %e, %class.MyClass* dereferenceable(4) %6) [ "funclet"(token %1) ]
%7 = call i8* @__cxa_begin_catch(i8* %2) #3 [ "funclet"(token %1) ]
%7 = call i8* @__cxa_begin_catch(i8* %2) [ "funclet"(token %1) ]
%x = getelementptr inbounds %class.MyClass, %class.MyClass* %e, i32 0, i32 0
%8 = load i32, i32* %x, align 4
invoke void @quux(i32 %8) [ "funclet"(token %1) ]
to label %invoke.cont2 unwind label %ehcleanup
invoke.cont2: ; preds = %catch
%call3 = call %class.MyClass* @_ZN7MyClassD2Ev(%class.MyClass* %e) #3 [ "funclet"(token %1) ]
%call3 = call %class.MyClass* @_ZN7MyClassD2Ev(%class.MyClass* %e) [ "funclet"(token %1) ]
call void @__cxa_end_catch() [ "funclet"(token %1) ]
catchret from %1 to label %for.inc
rethrow: ; preds = %catch.start
call void @llvm.wasm.rethrow() #6 [ "funclet"(token %1) ]
call void @llvm.wasm.rethrow() [ "funclet"(token %1) ]
unreachable
for.inc: ; preds = %invoke.cont2, %for.body
@ -862,7 +862,7 @@ for.inc: ; preds = %invoke.cont2, %for.
ehcleanup: ; preds = %catch
%9 = cleanuppad within %1 []
%call4 = call %class.MyClass* @_ZN7MyClassD2Ev(%class.MyClass* %e) #3 [ "funclet"(token %9) ]
%call4 = call %class.MyClass* @_ZN7MyClassD2Ev(%class.MyClass* %e) [ "funclet"(token %9) ]
invoke void @__cxa_end_catch() [ "funclet"(token %9) ]
to label %invoke.cont6 unwind label %terminate7
@ -875,7 +875,7 @@ for.end: ; preds = %for.cond
terminate7: ; preds = %ehcleanup
%10 = cleanuppad within %9 []
%11 = call i8* @llvm.wasm.get.exception(token %10)
call void @__clang_call_terminate(i8* %11) #7 [ "funclet"(token %10) ]
call void @__clang_call_terminate(i8* %11) [ "funclet"(token %10) ]
unreachable
}
@ -922,7 +922,7 @@ catch.start: ; preds = %catch.dispatch
%1 = catchpad within %0 [i8* null]
%2 = call i8* @llvm.wasm.get.exception(token %1)
%3 = call i32 @llvm.wasm.get.ehselector(token %1)
%4 = call i8* @__cxa_begin_catch(i8* %2) #2 [ "funclet"(token %1) ]
%4 = call i8* @__cxa_begin_catch(i8* %2) [ "funclet"(token %1) ]
call void @__cxa_end_catch() [ "funclet"(token %1) ]
catchret from %1 to label %try.cont
@ -982,7 +982,7 @@ catch.start: ; preds = %catch.dispatch
%1 = catchpad within %0 [i8* null]
%2 = call i8* @llvm.wasm.get.exception(token %1)
%3 = call i32 @llvm.wasm.get.ehselector(token %1)
%4 = call i8* @__cxa_begin_catch(i8* %2) #2 [ "funclet"(token %1) ]
%4 = call i8* @__cxa_begin_catch(i8* %2) [ "funclet"(token %1) ]
invoke void @__cxa_end_catch() [ "funclet"(token %1) ]
to label %invoke.cont2 unwind label %catch.dispatch3
@ -993,11 +993,11 @@ catch.start4: ; preds = %catch.dispatch3
%6 = catchpad within %5 [i8* null]
%7 = call i8* @llvm.wasm.get.exception(token %6)
%8 = call i32 @llvm.wasm.get.ehselector(token %6)
%9 = call i8* @__cxa_begin_catch(i8* %7) #2 [ "funclet"(token %6) ]
%9 = call i8* @__cxa_begin_catch(i8* %7) [ "funclet"(token %6) ]
call void @__cxa_end_catch() [ "funclet"(token %6) ]
catchret from %6 to label %try.cont8
try.cont8: ; preds = %invoke.cont, %invoke.cont2, %catch.start4
try.cont8: ; preds = %invoke.cont2, %catch.start4, %invoke.cont
ret void
invoke.cont2: ; preds = %catch.start
@ -1086,7 +1086,7 @@ if.then: ; preds = %for.body
to label %invoke.cont unwind label %ehcleanup
invoke.cont: ; preds = %if.then
%call2 = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %t) #4
%call2 = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %t)
ret i32 %call
for.inc: ; preds = %for.body
@ -1095,7 +1095,7 @@ for.inc: ; preds = %for.body
ehcleanup: ; preds = %if.then
%0 = cleanuppad within none []
%call3 = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %t) #4 [ "funclet"(token %0) ]
%call3 = call %class.Object* @_ZN6ObjectD2Ev(%class.Object* %t) [ "funclet"(token %0) ]
cleanupret from %0 unwind to caller
}
@ -1138,6 +1138,7 @@ declare void @quux(i32)
declare void @fun(i32)
; Function Attrs: nounwind
declare void @nothrow(i32) #0
; Function Attrs: nounwind
declare i32 @nothrow_i32() #0
; Function Attrs: nounwind
@ -1149,10 +1150,15 @@ declare %class.MyClass* @_ZN7MyClassD2Ev(%class.MyClass* returned) #0
declare %class.MyClass* @_ZN7MyClassC2ERKS_(%class.MyClass* returned, %class.MyClass* dereferenceable(4)) #0
declare i32 @__gxx_wasm_personality_v0(...)
declare i8* @llvm.wasm.get.exception(token)
declare i32 @llvm.wasm.get.ehselector(token)
declare void @llvm.wasm.rethrow()
declare i32 @llvm.eh.typeid.for(i8*)
; Function Attrs: nounwind
declare i8* @llvm.wasm.get.exception(token) #0
; Function Attrs: nounwind
declare i32 @llvm.wasm.get.ehselector(token) #0
; Function Attrs: noreturn
declare void @llvm.wasm.rethrow() #1
; Function Attrs: nounwind
declare i32 @llvm.eh.typeid.for(i8*) #0
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()
declare i8* @__cxa_get_exception_ptr(i8*)
@ -1166,3 +1172,4 @@ declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly,
declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1 immarg) #0
attributes #0 = { nounwind }
attributes #1 = { noreturn }