[all-commits] [llvm/llvm-project] d6f994: [InlineCost] Check for conflicting target attribut...

kazutakahirata via All-commits all-commits at lists.llvm.org
Fri Jun 2 16:01:05 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6f994acb3d545b80161e24ab742c9c69d4bbf33
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-06-02 (Fri, 02 Jun 2023)

  Changed paths:
    M llvm/lib/Analysis/InlineCost.cpp
    A llvm/test/Transforms/Inline/target-features-vs-alwaysinline.ll

  Log Message:
  [InlineCost] Check for conflicting target attributes early

When we inline a callee into a caller, the compiler needs to make sure
that the caller supports a superset of instruction sets that the
callee is allowed to use.  Normally, we check for the compatibility of
target features via functionsHaveCompatibleAttributes, but that
happens after we decide to honor call site attribute
Attribute::AlwaysInline.  If the caller contains a call marked with
Attribute::AlwaysInline, which can happen with
__attribute__((flatten)) placed on the caller, the caller could end up
with code that cannot be lowered to assembly code.

This patch fixes the problem by checking the target feature
compatibility before we honor Attribute::AlwaysInline.

Fixes https://github.com/llvm/llvm-project/issues/62664

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

More information about the All-commits mailing list