aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-12-08 17:15:51 +0100
committerNikita Popov <npopov@redhat.com>2023-12-08 17:18:20 +0100
commita87738f86b17f4a8dcde538c60826506e2a27ed1 (patch)
treecfc0d169b0e79fc3890b8eee8548dc5aee1829c5 /llvm/lib/IR
parentd5199b43bee5af88994b568447dc16ae967aac0c (diff)
downloadllvm-a87738f86b17f4a8dcde538c60826506e2a27ed1.zip
llvm-a87738f86b17f4a8dcde538c60826506e2a27ed1.tar.gz
llvm-a87738f86b17f4a8dcde538c60826506e2a27ed1.tar.bz2
[AutoUpgrade] Don't try to upgrade struct return of non-intrinsic
This code should only be run for intrinsics known to LLVM (otherwise it will crash), not for everything that starts with "llvm.".
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 67ee7b7..645691f 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -1293,7 +1293,8 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
}
auto *ST = dyn_cast<StructType>(F->getReturnType());
- if (ST && (!ST->isLiteral() || ST->isPacked())) {
+ if (ST && (!ST->isLiteral() || ST->isPacked()) &&
+ F->getIntrinsicID() != Intrinsic::not_intrinsic) {
// Replace return type with literal non-packed struct. Only do this for
// intrinsics declared to return a struct, not for intrinsics with
// overloaded return type, in which case the exact struct type will be