|
| 1 | +/*========================== begin_copyright_notice ============================ |
| 2 | + |
| 3 | +Copyright (C) 2025 Intel Corporation |
| 4 | + |
| 5 | +SPDX-License-Identifier: MIT |
| 6 | + |
| 7 | +============================= end_copyright_notice ===========================*/ |
| 8 | + |
| 9 | +/*========================== begin_copyright_notice ============================ |
| 10 | + |
| 11 | +Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 12 | +See https://llvm.org/LICENSE.txt for license information. |
| 13 | +SPDX-License-Identifier: Apache-2.0 with LLVM-exception |
| 14 | + |
| 15 | +============================= end_copyright_notice ===========================*/ |
| 16 | + |
| 17 | +This is a cherry-pick of commit https://github.com/llvm/llvm-project/commit/a87738f86b17f4a8dcde538c60826506e2a27ed1: |
| 18 | + |
| 19 | +"[AutoUpgrade] Don't upgrade intrinsics returning overloaded struct type" |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp |
| 24 | +index 7b9c55ff3..d0d5c9f4e 100644 |
| 25 | +--- a/llvm/lib/IR/AutoUpgrade.cpp |
| 26 | ++++ b/llvm/lib/IR/AutoUpgrade.cpp |
| 27 | +@@ -1131,7 +1131,8 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { |
| 28 | + } |
| 29 | + |
| 30 | + auto *ST = dyn_cast<StructType>(F->getReturnType()); |
| 31 | +- if (ST && (!ST->isLiteral() || ST->isPacked())) { |
| 32 | ++ if (ST && (!ST->isLiteral() || ST->isPacked()) && |
| 33 | ++ F->getIntrinsicID() != Intrinsic::not_intrinsic) { |
| 34 | + // Replace return type with literal non-packed struct. Only do this for |
| 35 | + // intrinsics declared to return a struct, not for intrinsics with |
| 36 | + // overloaded return type, in which case the exact struct type will be |
0 commit comments