[all-commits] [llvm/llvm-project] 1e3082: [WinEH] Apply funclet operand bundles to nounwind ...

Stefan Gränitz via All-commits all-commits at lists.llvm.org
Tue Jul 26 08:55:15 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e308204838b5edc5ffbd775896a004edb08c60a
  Author: Stefan Gränitz <stefan.graenitz at gmail.com>
  Date:   2022-07-26 (Tue, 26 Jul 2022)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    A clang/test/CodeGenObjCXX/arc-exceptions-seh.mm
    M llvm/include/llvm/IR/IntrinsicInst.h
    M llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
    M llvm/lib/IR/IntrinsicInst.cpp
    M llvm/lib/Transforms/Utils/InlineFunction.cpp
    A llvm/test/CodeGen/X86/win64-funclet-preisel-intrinsics.ll
    A llvm/test/Feature/OperandBundles/inliner-funclet-wineh.ll

  Log Message:
  [WinEH] Apply funclet operand bundles to nounwind intrinsics that lower to function calls in the course of IR transforms

WinEHPrepare marks any function call from EH funclets as unreachable, if it's not a nounwind intrinsic or has no proper funclet bundle operand. This
affects ARC intrinsics on Windows, because they are lowered to regular function calls in the PreISelIntrinsicLowering pass. It caused silent binary truncations and crashes during unwinding with the GNUstep ObjC runtime: https://github.com/gnustep/libobjc2/issues/222

This patch adds a new function `llvm::IntrinsicInst::mayLowerToFunctionCall()` that aims to collect all affected intrinsic IDs.
* Clang CodeGen uses it to determine whether or not it must emit a funclet bundle operand.
* PreISelIntrinsicLowering asserts that the function returns true for all ObjC runtime calls it lowers.
* LLVM uses it to determine whether or not a funclet bundle operand must be propagated to inlined call sites.

Reviewed By: theraven

Differential Revision: https://reviews.llvm.org/D128190

More information about the All-commits mailing list