[PATCH] D138123: [Verifier][WinEH] Check funclet tokens on intrinsic calls that may lower to function calls

Stefan Gränitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 06:27:06 PST 2022


sgraenitz added inline comments.


================
Comment at: llvm/lib/IR/Verifier.cpp:4909
 /// Allow intrinsics to be verified in different ways.
 void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
   Function *IF = Call.getCalledFunction();
----------------
rnk wrote:
> This property should be validated for invokes, calls, and callbr, right?
If I understand correctly, we can guarantee that for IR right after codegen, but not in between transformations -- because transformations must be allowed to introduce implausible calls? If we could guarantee it for calls across all transformations, then `WinEHPrepare::removeImplausibleInstructions()` doesn't seem to be necessary.


================
Comment at: llvm/lib/IR/Verifier.cpp:5757
+
+  // Verify funclet operand bundles for WinEH-like personalities
+  if (IntrinsicInst::mayLowerToFunctionCall(ID)) {
----------------
rnk wrote:
> I think these comments should discuss the purpose of this verification. Maybe we can say:
> ```
> // Verify that each function call belongs to exactly one funclet (or the main function),
> // and that there aren't any unmediated control transfers between funclets.
> ```
> 
> 
> belongs to exactly one funclet (or the main function)

As mentioned in D137944, I am not sure we can guarantee that when running the verifier in between transformations


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138123/new/

https://reviews.llvm.org/D138123



More information about the llvm-commits mailing list