[ARM] Support neon.vld auto-upgrade with opaque pointers
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 11 Sep 2021 14:33:19 +0000 (16:33 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 11 Sep 2021 14:34:32 +0000 (16:34 +0200)
This code manually constructs the intrinsic name, so we need to
use p0 instead of p0i8 in opaque pointer mode.

llvm/lib/IR/AutoUpgrade.cpp
llvm/test/CodeGen/ARM/vld-vst-upgrade.ll

index 0f20206..aaa9b04 100644 (file)
@@ -583,8 +583,10 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
       // Can't use Intrinsic::getDeclaration here as the return types might
       // then only be structurally equal.
       FunctionType* fType = FunctionType::get(F->getReturnType(), Tys, false);
+      StringRef Suffix =
+          F->getContext().supportsTypedPointers() ? "p0i8" : "p0";
       NewFn = Function::Create(fType, F->getLinkage(), F->getAddressSpace(),
-                               "llvm." + Name + ".p0i8", F->getParent());
+                               "llvm." + Name + "." + Suffix, F->getParent());
       return true;
     }
     static const Regex vstRegex("^arm\\.neon\\.vst([1234]|[234]lane)\\.v[a-z0-9]*$");
index fe868f6..8964e2a 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: llc -mtriple=arm-eabi -mattr=+neon < %s | FileCheck %s
+; RUN: llc -mtriple=arm-eabi -mattr=+neon -opaque-pointers < %s | FileCheck %s
 
 %struct.__neon_int32x2x2_t = type { <2 x i32>, <2 x i32> }
 %struct.__neon_int32x2x3_t = type { <2 x i32>, <2 x i32>, <2 x i32> }