[llvm-branch-commits] [llvm] release/19.x: [AArch64] Avoid NEON dot product in streaming[-compatible] functions (#101677) (PR #101933)

2024-08-05 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs approved this pull request.


https://github.com/llvm/llvm-project/pull/101933
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/19.x: [AArch64] Add streaming-mode stack hazard optimization remarks (#101695) (PR #102168)

2024-08-10 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

> Is there a huge upside to take this this late in the process?

I'll have to look more carefully over the patch on Monday, but this remark is 
_extremely_ valuable for people writing SME code: the problem it diagnoses is a 
performance glass jaw.

Also adding @aemerson @sdesmalen-arm, the other two SME experts.

https://github.com/llvm/llvm-project/pull/102168
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/19.x: [clang][AArch64] Point the nofp ABI check diagnostics at the callee (#103392) (PR #104027)

2024-08-14 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

https://github.com/llvm/llvm-project/issues/104055

https://github.com/llvm/llvm-project/pull/104027
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/19.x: [clang][AArch64] Point the nofp ABI check diagnostics at the callee (#103392) (PR #104027)

2024-08-15 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

> @jroelofs (or anyone else). If you would like to add a note about this fix in 
> the release notes (completely optional). Please reply to this comment with a 
> one or two sentence description of the fix. When you are done, please add the 
> release:note label to this PR.

Clang now diagnoses cases where a hard-float ABI would require passing 
arguments and/or return values in floating point registers on targets that do 
not have FP registers, e.g. via ``-mgeneral-regs-only`` or ``-march=...+nofp``.

https://github.com/llvm/llvm-project/pull/104027
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [InstCombiner] Remove unused `llvm.experimental.hot()` (PR #84851)

2024-03-11 Thread Jon Roelofs via llvm-branch-commits


@@ -56,7 +56,14 @@ using namespace CodeGen;
 // Experiment to make sanitizers easier to debug
 static llvm::cl::opt ClSanitizeDebugDeoptimization(
 "ubsan-unique-traps", llvm::cl::Optional,
-llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check"),
+llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check."),
+llvm::cl::init(false));
+
+// TODO: Introduce frontend options to enabled per sanitizers, similar to
+// `fsanitize-trap`.
+static llvm::cl::opt ClSanitizeExpHot(
+"ubsan-exp-hot", llvm::cl::Optional,
+llvm::cl::desc("Pass UBSAN checks if `llvm.experimental.hot()` is true."),

jroelofs wrote:

I'm not sure how best to do it, but it might be useful to have a remark that 
fires when one of these is optimized out.

https://github.com/llvm/llvm-project/pull/84851
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-11 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

Neat idea!

https://github.com/llvm/llvm-project/pull/84850
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [InstCombiner] Remove unused `llvm.experimental.hot()` (PR #84851)

2024-03-11 Thread Jon Roelofs via llvm-branch-commits


@@ -56,7 +56,14 @@ using namespace CodeGen;
 // Experiment to make sanitizers easier to debug
 static llvm::cl::opt ClSanitizeDebugDeoptimization(
 "ubsan-unique-traps", llvm::cl::Optional,
-llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check"),
+llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check."),
+llvm::cl::init(false));
+
+// TODO: Introduce frontend options to enabled per sanitizers, similar to
+// `fsanitize-trap`.
+static llvm::cl::opt ClSanitizeExpHot(
+"ubsan-exp-hot", llvm::cl::Optional,
+llvm::cl::desc("Pass UBSAN checks if `llvm.experimental.hot()` is true."),

jroelofs wrote:

np, I'll move this comment once you get that sorted.

https://github.com/llvm/llvm-project/pull/84851
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ubsan] Switch UBSAN optimization to `llvm.experimental.hot` (PR #84858)

2024-03-11 Thread Jon Roelofs via llvm-branch-commits


@@ -3805,6 +3812,12 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
 SanitizerHandler CheckHandlerID) {
   llvm::BasicBlock *Cont = createBasicBlock("cont");
 
+  if (ClSanitizeExpHot) {
+Checked =
+Builder.CreateOr(Checked, Builder.CreateCall(CGM.getIntrinsic(
+  llvm::Intrinsic::experimental_hot)));

jroelofs wrote:

It might be helpful if there were a remark that fired when one of these were 
optimized out.

Maybe we could get that with another intrinsic whose semantics are "print the 
message in a remark if this gets optimized out", and then stick one of those on 
the appropriate side of the condition, with an explanation on where it came 
from, and what the threshold was.

https://github.com/llvm/llvm-project/pull/84858
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang][ubsan] Switch UBSAN optimization to `llvm.experimental.hot` (PR #84858)

2024-03-11 Thread Jon Roelofs via llvm-branch-commits


@@ -3805,6 +3812,12 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
 SanitizerHandler CheckHandlerID) {
   llvm::BasicBlock *Cont = createBasicBlock("cont");
 
+  if (ClSanitizeExpHot) {
+Checked =
+Builder.CreateOr(Checked, Builder.CreateCall(CGM.getIntrinsic(
+  llvm::Intrinsic::experimental_hot)));

jroelofs wrote:

This would be the moral equivalent of diagnose_if

https://github.com/llvm/llvm-project/pull/84858
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [InstCombiner] Remove unused `llvm.experimental.hot()` (PR #84851)

2024-04-29 Thread Jon Roelofs via llvm-branch-commits


@@ -56,7 +56,14 @@ using namespace CodeGen;
 // Experiment to make sanitizers easier to debug
 static llvm::cl::opt ClSanitizeDebugDeoptimization(
 "ubsan-unique-traps", llvm::cl::Optional,
-llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check"),
+llvm::cl::desc("Deoptimize traps for UBSAN so there is 1 trap per check."),
+llvm::cl::init(false));
+
+// TODO: Introduce frontend options to enabled per sanitizers, similar to
+// `fsanitize-trap`.
+static llvm::cl::opt ClSanitizeExpHot(
+"ubsan-exp-hot", llvm::cl::Optional,
+llvm::cl::desc("Pass UBSAN checks if `llvm.experimental.hot()` is true."),

jroelofs wrote:

moved here: https://github.com/llvm/llvm-project/pull/84858/files#r1520603139

https://github.com/llvm/llvm-project/pull/84851
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] cd2a197 - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:24:11-08:00
New Revision: cd2a197bc2491d53d222eb67be18b741785c1f12

URL: 
https://github.com/llvm/llvm-project/commit/cd2a197bc2491d53d222eb67be18b741785c1f12
DIFF: 
https://github.com/llvm/llvm-project/commit/cd2a197bc2491d53d222eb67be18b741785c1f12.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [llvm] 7e4d36f - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:25:29-08:00
New Revision: 7e4d36f8a6babb62d734b125c5910987f352e51e

URL: 
https://github.com/llvm/llvm-project/commit/7e4d36f8a6babb62d734b125c5910987f352e51e
DIFF: 
https://github.com/llvm/llvm-project/commit/7e4d36f8a6babb62d734b125c5910987f352e51e.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [llvm] 1c14bde - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:28:21-08:00
New Revision: 1c14bde6e41ac375b2107a97b71b92f12e0bdf00

URL: 
https://github.com/llvm/llvm-project/commit/1c14bde6e41ac375b2107a97b71b92f12e0bdf00
DIFF: 
https://github.com/llvm/llvm-project/commit/1c14bde6e41ac375b2107a97b71b92f12e0bdf00.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [llvm] 52c44ee - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:31:52-08:00
New Revision: 52c44ee01b2a76062eb332a302c6bacc64e550f5

URL: 
https://github.com/llvm/llvm-project/commit/52c44ee01b2a76062eb332a302c6bacc64e550f5
DIFF: 
https://github.com/llvm/llvm-project/commit/52c44ee01b2a76062eb332a302c6bacc64e550f5.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [llvm] e132c89 - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:33:10-08:00
New Revision: e132c8909e40c9f61bfdbd90dd8cee30c2dbe074

URL: 
https://github.com/llvm/llvm-project/commit/e132c8909e40c9f61bfdbd90dd8cee30c2dbe074
DIFF: 
https://github.com/llvm/llvm-project/commit/e132c8909e40c9f61bfdbd90dd8cee30c2dbe074.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [llvm] 461b9b7 - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:34:59-08:00
New Revision: 461b9b7b6723fdb11aafeb410be3d9173538677d

URL: 
https://github.com/llvm/llvm-project/commit/461b9b7b6723fdb11aafeb410be3d9173538677d
DIFF: 
https://github.com/llvm/llvm-project/commit/461b9b7b6723fdb11aafeb410be3d9173538677d.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [llvm] 24f8f63 - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:38:32-08:00
New Revision: 24f8f639f9fb654838b78d8f14a06805e4772628

URL: 
https://github.com/llvm/llvm-project/commit/24f8f639f9fb654838b78d8f14a06805e4772628
DIFF: 
https://github.com/llvm/llvm-project/commit/24f8f639f9fb654838b78d8f14a06805e4772628.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO:

[llvm-branch-commits] [compiler-rt] [llvm] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs created 
https://github.com/llvm/llvm-project/pull/73685

None


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] bc15209 - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:39:44-08:00
New Revision: bc152095691b32d1ad8539dfd60f5089df5eed8d

URL: 
https://github.com/llvm/llvm-project/commit/bc152095691b32d1ad8539dfd60f5089df5eed8d
DIFF: 
https://github.com/llvm/llvm-project/commit/bc152095691b32d1ad8539dfd60f5089df5eed8d.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e448c5ed5c5d947..cb222e979db29d4 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -934,10 +934,11 @@ IFuncs
 ---
 
 IFuncs, like as aliases, don't create any new data or func. They are just a new
-symbol that dynamic linker resolves at runtime by calling a resolver function.
+symbol that is resolved at runtime by calling a resolver function.
 
-IFuncs have a name and a resolver that is a function called by dynamic linker
-that returns address of another function associated with the name.
+On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
+MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.

diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 2731ef452c79cbb..48fa6c478464c73 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -882,7 +882,11 @@ class AsmPrinter : public MachineFunctionPass {
 
   GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy &S);
   void emitGlobalAlias(Module &M, const GlobalAlias &GA);
-  void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+protected:
+  virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+private:
 
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 2527b1431289677..e0080b145d4f995 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -144,7 +144,12 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   // Try looking through a bitcast from one function type to another.
   // Commonly happens with calls to objc_msgSend().
   const Value *CalleeV = CB.getCalledOperand()->stripPointerCasts();
-  if (const Function *F = dyn_cast(CalleeV))
+  if (const GlobalIFunc *IF = dyn_cast(CalleeV);
+  IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
+// ld64 requires that .symbol_resolvers to be called via a stub, so these
+// must always be a diret call.
+Info.Callee = MachineOperand::CreateGA(IF, 0);
+  } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);
   else
 Info.Callee = MachineOperand::CreateReg(GetCalleeReg(), false);

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 5560c037aa3ee6b..94e76a43bf38d6d 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,6 +959,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
+
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2239,13 +2240,10 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features")) {
-Triple T(M.getTargetTriple());
-if (T.isX86()) {
-  StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
-  Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
-"512-bit vector arguments require 'evex512' for AVX512", V);
-}
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
+Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
+  "512-bit vector arguments require 'evex512' for AVX512", V);
   }
 
   checkUnsignedBaseTenFuncAttr

[llvm-branch-commits] [llvm] d4d16df - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:39:49-08:00
New Revision: d4d16df26295dfe69706332e26ae017283c1e36b

URL: 
https://github.com/llvm/llvm-project/commit/d4d16df26295dfe69706332e26ae017283c1e36b
DIFF: 
https://github.com/llvm/llvm-project/commit/d4d16df26295dfe69706332e26ae017283c1e36b.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/test/CodeGen/ifunc.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c
index 0b0a0549620f8b8..99d60dc0ea85dbd 100644
--- a/clang/test/CodeGen/ifunc.c
+++ b/clang/test/CodeGen/ifunc.c
@@ -3,6 +3,10 @@
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 
 int foo(int) __attribute__ ((ifunc("foo_ifunc")));
 
@@ -44,9 +48,13 @@ void* goo_ifunc(void) {
 // CHECK: call void @goo()
 
 // SAN: define internal nonnull ptr @foo_ifunc() #[[#FOO_IFUNC:]] {
+// MACSAN: define internal nonnull ptr @foo_ifunc() #[[#FOO_IFUNC:]] {
 
 // SAN: define dso_local noalias ptr @goo_ifunc() #[[#GOO_IFUNC:]] {
+// MACSAN: define noalias ptr @goo_ifunc() #[[#GOO_IFUNC:]] {
 
 // SAN-DAG: attributes #[[#FOO_IFUNC]] = {{{.*}} 
disable_sanitizer_instrumentation {{.*}}
+// MACSAN-DAG: attributes #[[#FOO_IFUNC]] = {{{.*}} 
disable_sanitizer_instrumentation {{.*}}
 
 // SAN-DAG: attributes #[[#GOO_IFUNC]] = {{{.*}} 
disable_sanitizer_instrumentation {{.*}}
+// MACSAN-DAG: attributes #[[#GOO_IFUNC]] = {{{.*}} 
disable_sanitizer_instrumentation {{.*}}

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e448c5ed5c5d947..cb222e979db29d4 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -934,10 +934,11 @@ IFuncs
 ---
 
 IFuncs, like as aliases, don't create any new data or func. They are just a new
-symbol that dynamic linker resolves at runtime by calling a resolver function.
+symbol that is resolved at runtime by calling a resolver function.
 
-IFuncs

[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs created 
https://github.com/llvm/llvm-project/pull/73687

Unlike ELF targets, MachO does not support the same kind of dynamic symbol
resolution at load time.  Instead, the corresponding MachO feature resolves
symbols lazily on first call.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs created 
https://github.com/llvm/llvm-project/pull/73688

None


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 60bbb99 - [𝘀𝗽𝗿] initial version

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T10:39:54-08:00
New Revision: 60bbb996f2e9251b288e2230c671cdcf997720ed

URL: 
https://github.com/llvm/llvm-project/commit/60bbb996f2e9251b288e2230c671cdcf997720ed
DIFF: 
https://github.com/llvm/llvm-project/commit/60bbb996f2e9251b288e2230c671cdcf997720ed.diff

LOG: [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll
llvm/test/Verifier/ifunc-macho.ll

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/TargetInfo.h
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/ifunc.c
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.h
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 03ed6accf700c4e..cef9f5578fa2baa 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -455,6 +455,9 @@ def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", 
"arm", "thumb", "aarch6
 def TargetELF : TargetSpec {
   let ObjectFormats = ["ELF"];
 }
+def TargetELFOrMachO : TargetSpec {
+  let ObjectFormats = ["ELF", "MachO"];
+}
 
 def TargetSupportsInitPriority : TargetSpec {
   let CustomCode = [{ !Target.getTriple().isOSzOS() }];
@@ -1665,7 +1668,7 @@ def IBOutletCollection : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def IFunc : Attr, TargetSpecificAttr {
+def IFunc : Attr, TargetSpecificAttr {
   let Spellings = [GCC<"ifunc">];
   let Args = [StringArgument<"Resolver">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index be74535e28d8a60..4c4c4eb606fb0dc 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,7 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-Non-ELF targets currently do not support this attribute.
+MachO targets support it, but with slightly 
diff erent semantics: the resolver is
+run at first call, instead of at load time by the runtime linker. Targets other
+than ELF and MachO currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 41f3c2e403cbef6..1fe2a18cd5dc9cc 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1424,6 +1424,8 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
+if (getTriple().isOSBinFormatMachO())
+  return true;
 return getTriple().isOSBinFormatELF() &&
((getTriple().isOSLinux() && !getTriple().isMusl()) ||
 getTriple().isOSFreeBSD());

diff  --git a/clang/test/CodeGen/attr-target-mv-va-args.c 
b/clang/test/CodeGen/attr-target-mv-va-args.c
index 96821c610235bdc..dbf5a74205c4c19 100644
--- a/clang/test/CodeGen/attr-target-mv-va-args.c
+++ b/clang/test/CodeGen/attr-target-mv-va-args.c
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,WINDOWS
 // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
 // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=NO-IFUNC,NO-IFUNC-ELF
+// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck 
%s --check-prefix=IFUNC-MACHO
 int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; }
 int __attribute__((target("arch=sandybridge"))) foo(int i, ...);
 int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;}
@@ -30,6 +31,24 @@ int bar(void) {
 // IFUNC-ELF: ret ptr @foo
 // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...)
 
+// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver
+// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 0
+// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 1
+// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...)
+// IFUNC-MACHO: ret i32 2
+// IFUNC-MACHO: define{{.*}} i32 @bar()
+// IFUNC-MACHO: call i32 (i32, ...) @foo.ifunc(i32 nound

[llvm-branch-commits] [llvm] [clang] [compiler-rt] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits


@@ -556,6 +556,8 @@ void X86AsmPrinter::emitGlobalIFunc(Module &M, const 
GlobalIFunc &GI) {
   JMP.setOpcode(X86::JMP_4);
   JMP.addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(;
   OutStreamer->emitInstruction(JMP, *Subtarget);
+
+  // FIXME: do the manual .symbol_resolver lowering that we did in 
AArch64AsmPrinter.

jroelofs wrote:

- [ ] FIXME: This comment belongs in a different commit in the patch stack.

https://github.com/llvm/llvm-project/pull/73685
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 8f6755e - git clang-format

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:04:43-08:00
New Revision: 8f6755e6b211c9b0206197f65304443e26e244eb

URL: 
https://github.com/llvm/llvm-project/commit/8f6755e6b211c9b0206197f65304443e26e244eb
DIFF: 
https://github.com/llvm/llvm-project/commit/8f6755e6b211c9b0206197f65304443e26e244eb.diff

LOG: git clang-format

Created using spr 1.3.4

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 5241aa6e1c0eade..37158900d2404dd 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ 

[llvm-branch-commits] [llvm] 0d426a9 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:04:46-08:00
New Revision: 0d426a93450c7bdc9868c6106e01efafa549eb86

URL: 
https://github.com/llvm/llvm-project/commit/0d426a93450c7bdc9868c6106e01efafa549eb86
DIFF: 
https://github.com/llvm/llvm-project/commit/0d426a93450c7bdc9868c6106e01efafa549eb86.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 5241aa6e1c0eade..37158900d2404dd 100644
--- a/llvm/lib

[llvm-branch-commits] [llvm] 15d50f3 - rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:04:55-08:00
New Revision: 15d50f3463a535112df427ef5213b0d939608e94

URL: 
https://github.com/llvm/llvm-project/commit/15d50f3463a535112df427ef5213b0d939608e94
DIFF: 
https://github.com/llvm/llvm-project/commit/15d50f3463a535112df427ef5213b0d939608e94.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 5241aa6e1c0eade..37158900d2404dd 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib

[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 7695f68 - rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:05:21-08:00
New Revision: 7695f68612c300a6b539d251f499cf22fdddb8f8

URL: 
https://github.com/llvm/llvm-project/commit/7695f68612c300a6b539d251f499cf22fdddb8f8
DIFF: 
https://github.com/llvm/llvm-project/commit/7695f68612c300a6b539d251f499cf22fdddb8f8.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 5241aa6e1c0eade..37158900d2404dd 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib

[llvm-branch-commits] [llvm] fac7c3d - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:04:59-08:00
New Revision: fac7c3d46800fc109f257d42341b621d10a9ccb7

URL: 
https://github.com/llvm/llvm-project/commit/fac7c3d46800fc109f257d42341b621d10a9ccb7
DIFF: 
https://github.com/llvm/llvm-project/commit/fac7c3d46800fc109f257d42341b621d10a9ccb7.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 5241aa6e1c0eade..37158900d2404dd 100644
--- a/llvm/lib

[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] de74c62 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:05:25-08:00
New Revision: de74c62118d9c2c9372a6ba862113f299ac6eb3a

URL: 
https://github.com/llvm/llvm-project/commit/de74c62118d9c2c9372a6ba862113f299ac6eb3a
DIFF: 
https://github.com/llvm/llvm-project/commit/de74c62118d9c2c9372a6ba862113f299ac6eb3a.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 5241aa6e1c0eade..37158900d2404dd 100644
--- a/llvm/lib

[llvm-branch-commits] [llvm] 413e538 - rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T11:05:28-08:00
New Revision: 413e538a113187663f413d20c354e8018cddca30

URL: 
https://github.com/llvm/llvm-project/commit/413e538a113187663f413d20c354e8018cddca30
DIFF: 
https://github.com/llvm/llvm-project/commit/413e538a113187663f413d20c354e8018cddca30.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 48fa6c478464c73..07b92871a0f0868 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -887,7 +887,6 @@ class AsmPrinter : public MachineFunctionPass {
   virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
 
 private:
-
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
 

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 94e76a43bf38d6d..bd90047a411a654 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,7 +959,6 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
-
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2240,7 +2239,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") && 
TT.isX86()) {
+  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features") &&
+  TT.isX86()) {
 StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
 Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
   "512-bit vector arguments require 'evex512' for AVX512", V);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 2dab8e126c9abd0..f4128332008fb83 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -71,10 +71,15 @@ using namespace llvm;
 
 namespace {
 
-enum class IFuncLowering { SymbolResolverIfSupported, SymbolResolverAlways, 
SymbolResolverNever };
+enum class IFuncLowering {
+  SymbolResolverIfSupported,
+  SymbolResolverAlways,
+  SymbolResolverNever
+};
 
 static cl::opt PreferredIFuncLowering(
-"arm64-darwin-ifunc-symbol_resolver", 
cl::init(IFuncLowering::SymbolResolverNever),
+"arm64-darwin-ifunc-symbol_resolver",
+cl::init(IFuncLowering::SymbolResolverNever),
 cl::desc("Pick the lowering for ifuncs on darwin platforms"), cl::Hidden,
 cl::values(
 clEnumValN(
@@ -1853,8 +1858,8 @@ void AArch64AsmPrinter::emitLinkerSymbolResolver(Module 
&M,
   OutStreamer->emitSymbolAttribute(Name, MCSA_SymbolResolver);
   emitVisibility(Name, GI.getVisibility());
 
-  // ld-prime does not seem to support aliases of symbol resolvers, so we have 
to
-  // tail call the resolver manually.
+  // ld-prime does not seem to support aliases of symbol resolvers, so we have
+  // to tail call the resolver manually.
   OutStreamer->emitInstruction(
   MCInstBuilder(AArch64::B)
   .addOperand(MCOperand::createExpr(lowerConstant(GI.getResolver(,
@@ -1887,8 +1892,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   assert(GI.hasLocalLinkage() && "Invalid ifunc linkage");
   };
 
-  MCSymbol *LazyPointer = 
TM.getObjFileLowering()->getContext().getOrCreateSymbol(
-  "_" + GI.getName() + ".lazy_pointer");
+  MCSymbol *LazyPointer =
+  TM.getObjFileLowering()->getContext().getOrCreateSymbol(
+  "_" + GI.getName() + ".lazy_pointer");
   MCSymbol *StubHelper =
   TM.getObjFileLowering()->getContext().getOrCreateSymbol(
   "_" + GI.getName() + ".stub_helper");
@@ -1943,9 +1949,10 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   }
 
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::LDRXui)
-.addReg(AArch64::X16)
-.addReg(AArch64::X16)
-.addImm(0), *STI);
+   .addReg(AArch64::X16)
+   .addReg(AArch64::X16)
+   .addImm(0),
+   *STI);
 
   OutStreamer->emitInstruction(MCInstBuilder(TM.getTargetTriple().isArm64e()
  ? AArch64::BRAAZ



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] [llvm] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [compiler-rt] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs edited 
https://github.com/llvm/llvm-project/pull/73685
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] dc1fcb4 - avoid writeback stp's

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:24:45-08:00
New Revision: dc1fcb464e3d9e8dd37a5bda1aa8894e127654e9

URL: 
https://github.com/llvm/llvm-project/commit/dc1fcb464e3d9e8dd37a5bda1aa8894e127654e9
DIFF: 
https://github.com/llvm/llvm-project/commit/dc1fcb464e3d9e8dd37a5bda1aa8894e127654e9.diff

LOG: avoid writeback stp's

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-16]
+  // sub   fp, sp, 16

[llvm-branch-commits] [llvm] 3b44869 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:24:48-08:00
New Revision: 3b44869576897de5613e65fa85b867cdc21151d0

URL: 
https://github.com/llvm/llvm-project/commit/3b44869576897de5613e65fa85b867cdc21151d0
DIFF: 
https://github.com/llvm/llvm-project/commit/3b44869576897de5613e65fa85b867cdc21151d0.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-1

[llvm-branch-commits] [llvm] 8d9c2a2 - rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:24:53-08:00
New Revision: 8d9c2a2d30b69f9b4e4411f8bf74117303bea94e

URL: 
https://github.com/llvm/llvm-project/commit/8d9c2a2d30b69f9b4e4411f8bf74117303bea94e
DIFF: 
https://github.com/llvm/llvm-project/commit/8d9c2a2d30b69f9b4e4411f8bf74117303bea94e.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-16]
+  // sub   fp, sp, 16
+  // stp 

[llvm-branch-commits] [llvm] 27dccd2 - rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:24:58-08:00
New Revision: 27dccd2b646ac953d0cf5489324d272db147ac3f

URL: 
https://github.com/llvm/llvm-project/commit/27dccd2b646ac953d0cf5489324d272db147ac3f
DIFF: 
https://github.com/llvm/llvm-project/commit/27dccd2b646ac953d0cf5489324d272db147ac3f.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-16]
+  // sub   fp, sp, 16
+  // stp 

[llvm-branch-commits] [clang] [llvm] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9375c35 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:24:56-08:00
New Revision: 9375c350abda40537ca1db27d2bde3fffb067f90

URL: 
https://github.com/llvm/llvm-project/commit/9375c350abda40537ca1db27d2bde3fffb067f90
DIFF: 
https://github.com/llvm/llvm-project/commit/9375c350abda40537ca1db27d2bde3fffb067f90.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-1

[llvm-branch-commits] [llvm] 9c8c292 - rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:25:02-08:00
New Revision: 9c8c292266cc805a567fa844871e3424429f1bc3

URL: 
https://github.com/llvm/llvm-project/commit/9c8c292266cc805a567fa844871e3424429f1bc3
DIFF: 
https://github.com/llvm/llvm-project/commit/9c8c292266cc805a567fa844871e3424429f1bc3.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-16]
+  // sub   fp, sp, 16
+  // stp 

[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] [clang] [llvm] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] a34d63c - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-28T14:25:01-08:00
New Revision: a34d63cab61b3d7bd327b6a90ee4b9e3ed568e85

URL: 
https://github.com/llvm/llvm-project/commit/a34d63cab61b3d7bd327b6a90ee4b9e3ed568e85
DIFF: 
https://github.com/llvm/llvm-project/commit/a34d63cab61b3d7bd327b6a90ee4b9e3ed568e85.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/addrsig-macho.ll
llvm/test/CodeGen/AArch64/ifunc-asm.ll

Removed: 
llvm/test/Verifier/ifunc-macho.ll



diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 15ff39883680369..b4ac0a70e7fde9c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2300,6 +2300,32 @@ bool AsmPrinter::doFinalization(Module &M) {
   // through user plugins.
   emitStackMaps();
 
+  // Print aliases in topological order, that is, for each alias a = b,
+  // b must be printed before a.
+  // This is because on some targets (e.g. PowerPC) linker expects aliases in
+  // such an order to generate correct TOC information.
+  SmallVector AliasStack;
+  SmallPtrSet AliasVisited;
+  for (const auto &Alias : M.aliases()) {
+if (Alias.hasAvailableExternallyLinkage())
+  continue;
+for (const GlobalAlias *Cur = &Alias; Cur;
+ Cur = dyn_cast(Cur->getAliasee())) {
+  if (!AliasVisited.insert(Cur).second)
+break;
+  AliasStack.push_back(Cur);
+}
+for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
+  emitGlobalAlias(M, *AncestorAlias);
+AliasStack.clear();
+  }
+
+  // IFuncs must come before deubginfo in case the backend decides to emit them
+  // as actual functions, since on MachO targets, we cannot create regular
+  // sections after DWARF.
+  for (const auto &IFunc : M.ifuncs())
+emitGlobalIFunc(M, IFunc);
+
   // Finalize debug and EH information.
   for (const HandlerInfo &HI : Handlers) {
 NamedRegionTimer T(HI.TimerName, HI.TimerDescription, HI.TimerGroupName,
@@ -2339,28 +2365,6 @@ bool AsmPrinter::doFinalization(Module &M) {
 }
   }
 
-  // Print aliases in topological order, that is, for each alias a = b,
-  // b must be printed before a.
-  // This is because on some targets (e.g. PowerPC) linker expects aliases in
-  // such an order to generate correct TOC information.
-  SmallVector AliasStack;
-  SmallPtrSet AliasVisited;
-  for (const auto &Alias : M.aliases()) {
-if (Alias.hasAvailableExternallyLinkage())
-  continue;
-for (const GlobalAlias *Cur = &Alias; Cur;
- Cur = dyn_cast(Cur->getAliasee())) {
-  if (!AliasVisited.insert(Cur).second)
-break;
-  AliasStack.push_back(Cur);
-}
-for (const GlobalAlias *AncestorAlias : llvm::reverse(AliasStack))
-  emitGlobalAlias(M, *AncestorAlias);
-AliasStack.clear();
-  }
-  for (const auto &IFunc : M.ifuncs())
-emitGlobalIFunc(M, IFunc);
-
   GCModuleInfo *MI = getAnalysisIfAvailable();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e0080b145d4f995..ce736178afc8b5a 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -147,7 +147,7 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   if (const GlobalIFunc *IF = dyn_cast(CalleeV);
   IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
 // ld64 requires that .symbol_resolvers to be called via a stub, so these
-// must always be a diret call.
+// must always be a direct call.
 Info.Callee = MachineOperand::CreateGA(IF, 0);
   } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);

diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f4128332008fb83..26b3a14e22b2ad9 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1965,65 +1965,71 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]!
-  // mov   fp, sp
-  // stp   x1, x0, [sp, #-16]!
-  // stp   x3, x2, [sp, #-16]!
-  // stp   x5, x4, [sp, #-16]!
-  // stp   x7, x6, [sp, #-16]!
-  // stp   d1, d0, [sp, #-16]!
-  // stp   d3, d2, [sp, #-16]!
-  // stp   d5, d4, [sp, #-16]!
-  // stp   d7, d6, [sp, #-16]!
+  // stp   fp, lr, [sp, #-1

[llvm-branch-commits] [clang] [compiler-rt] [llvm] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-28 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] bbeb3be - x86 support

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:21-08:00
New Revision: bbeb3beaf37d91911a96a20bb1825fa16dcfc094

URL: 
https://github.com/llvm/llvm-project/commit/bbeb3beaf37d91911a96a20bb1825fa16dcfc094
DIFF: 
https://github.com/llvm/llvm-project/commit/bbeb3beaf37d91911a96a20bb1825fa16dcfc094.diff

LOG: x86 support

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
 #inc

[llvm-branch-commits] [llvm] 68e1755 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:28-08:00
New Revision: 68e1755aef6ce4bf70d73f27ddabcebd8ced9804

URL: 
https://github.com/llvm/llvm-project/commit/68e1755aef6ce4bf70d73f27ddabcebd8ced9804
DIFF: 
https://github.com/llvm/llvm-project/commit/68e1755aef6ce4bf70d73f27ddabcebd8ced9804.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
 #include 

[llvm-branch-commits] [llvm] 6205bfd - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:25-08:00
New Revision: 6205bfd3ab2c8d8ff0a5128a97c1b73d7967761c

URL: 
https://github.com/llvm/llvm-project/commit/6205bfd3ab2c8d8ff0a5128a97c1b73d7967761c
DIFF: 
https://github.com/llvm/llvm-project/commit/6205bfd3ab2c8d8ff0a5128a97c1b73d7967761c.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExp

[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] e5f65ac - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:38-08:00
New Revision: e5f65ace88f017fad809e43f0146ddefc2d6160f

URL: 
https://github.com/llvm/llvm-project/commit/e5f65ace88f017fad809e43f0146ddefc2d6160f
DIFF: 
https://github.com/llvm/llvm-project/commit/e5f65ace88f017fad809e43f0146ddefc2d6160f.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExp

[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 44935a8 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:39-08:00
New Revision: 44935a897f12870bf23aaf5ab0e1a52b91fe9f95

URL: 
https://github.com/llvm/llvm-project/commit/44935a897f12870bf23aaf5ab0e1a52b91fe9f95
DIFF: 
https://github.com/llvm/llvm-project/commit/44935a897f12870bf23aaf5ab0e1a52b91fe9f95.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
 #include 

[llvm-branch-commits] [llvm] dd44429 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:34-08:00
New Revision: dd44429fd59d84c5489fd970d59e685707ffabb6

URL: 
https://github.com/llvm/llvm-project/commit/dd44429fd59d84c5489fd970d59e685707ffabb6
DIFF: 
https://github.com/llvm/llvm-project/commit/dd44429fd59d84c5489fd970d59e685707ffabb6.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCInst.h"
 #include 

[llvm-branch-commits] [llvm] [clang] [compiler-rt] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] [llvm] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] c67ce7f - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T08:23:32-08:00
New Revision: c67ce7fb42a599a11b3c743812fe8ccf52daed0c

URL: 
https://github.com/llvm/llvm-project/commit/c67ce7fb42a599a11b3c743812fe8ccf52daed0c
DIFF: 
https://github.com/llvm/llvm-project/commit/c67ce7fb42a599a11b3c743812fe8ccf52daed0c.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/ifunc-asm.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp 
b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index 26b3a14e22b2ad9..1b5b7c556c79f6b 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -1901,6 +1901,9 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getDataSection());
 
+  // _ifunc.lazy_pointer:
+  //   .quad _ifunc.stub_helper
+
   EmitLinkage(LazyPointer);
   OutStreamer->emitLabel(LazyPointer);
   emitVisibility(LazyPointer, GI.getVisibility());
@@ -1908,18 +1911,18 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
 
   OutStreamer->switchSection(OutContext.getObjectFileInfo()->getTextSection());
 
-  MCSymbol *Stub = getSymbol(&GI);
+  // _ifunc:
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   ldr x16, [x16]
+  //   br  x16
 
+  MCSymbol *Stub = getSymbol(&GI);
   EmitLinkage(Stub);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(Stub);
   emitVisibility(Stub, GI.getVisibility());
 
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // ldr   x16, [x16]
-  // brx16
-
   {
 MCInst Adrp;
 Adrp.setOpcode(AArch64::ADRP);
@@ -1960,39 +1963,40 @@ void AArch64AsmPrinter::emitManualSymbolResolver(Module 
&M,
.addReg(AArch64::X16),
*STI);
 
+  // _ifunc.stub_helper:
+  //   stp fp, lr, [sp, #-16]
+  //   sub fp, sp, 16
+  //   stp x1, x0, [sp, #-32]
+  //   stp x3, x2, [sp, #-48]
+  //   stp x5, x4, [sp, #-64]
+  //   stp x7, x6, [sp, #-80]
+  //   stp d1, d0, [sp, #-96]
+  //   stp d3, d2, [sp, #-112]
+  //   stp d5, d4, [sp, #-128]
+  //   stp d7, d6, [sp, #-144]
+  //   sub sp, sp, 144
+  //   bl  _resolver
+  //   adrpx16, lazy_pointer@GOTPAGE
+  //   ldr x16, [x16, lazy_pointer@GOTPAGEOFF]
+  //   str x0, [x16]
+  //   mov x16, x0
+  //   add sp, sp, 144
+  //   ldp d7, d6, [sp, #-144]
+  //   ldp d5, d4, [sp, #-128]
+  //   ldp d3, d2, [sp, #-112]
+  //   ldp d1, d0, [sp, #-96]
+  //   ldp x7, x6, [sp, #-80]
+  //   ldp x5, x4, [sp, #-64]
+  //   ldp x3, x2, [sp, #-48]
+  //   ldp x1, x0, [sp, #-32]
+  //   ldp fp, lr, [sp, #-16]
+  //   br  x16
+
   EmitLinkage(StubHelper);
   OutStreamer->emitCodeAlignment(Align(4), STI);
   OutStreamer->emitLabel(StubHelper);
   emitVisibility(StubHelper, GI.getVisibility());
 
-  // stp   fp, lr, [sp, #-16]
-  // sub   fp, sp, 16
-  // stp   x1, x0, [sp, #-32]
-  // stp   x3, x2, [sp, #-48]
-  // stp   x5, x4, [sp, #-64]
-  // stp   x7, x6, [sp, #-80]
-  // stp   d1, d0, [sp, #-96]
-  // stp   d3, d2, [sp, #-112]
-  // stp   d5, d4, [sp, #-128]
-  // stp   d7, d6, [sp, #-144]
-  // sub   sp, sp, 144
-  // bl_resolver
-  // adrp  x16, lazy_pointer@GOTPAGE
-  // ldr   x16, [x16, lazy_pointer@GOTPAGEOFF]
-  // str   x0, [x16]
-  // mov   x16, x0
-  // add   sp, sp, 144
-  // ldp   d7, d6, [sp, #-144]
-  // ldp   d5, d4, [sp, #-128]
-  // ldp   d3, d2, [sp, #-112]
-  // ldp   d1, d0, [sp, #-96]
-  // ldp   x7, x6, [sp, #-80]
-  // ldp   x5, x4, [sp, #-64]
-  // ldp   x3, x2, [sp, #-48]
-  // ldp   x1, x0, [sp, #-32]
-  // ldp   fp, lr, [sp, #-16]
-  // brx16
-
   OutStreamer->emitInstruction(MCInstBuilder(AArch64::STPXi)
.addReg(AArch64::FP)
.addReg(AArch64::LR)

diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 37158900d2404dd..b0f4b9d98437284 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -14,6 +14,7 @@
 #include "X86AsmPrinter.h"
 #include "MCTargetDesc/X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
+#include "MCTargetDesc/X86MCTargetDesc.h"
 #include "MCTargetDesc/X86TargetStreamer.h"
 #include "TargetInfo/X86TargetInfo.h"
 #include "X86InstrInfo.h"
@@ -34,6 +35,7 @@
 #include "llvm/MC/MCCodeEmitter.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExp

[llvm-branch-commits] [clang] [llvm] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

> Will this cause an ABI compatibility issue for any existing use of the 
> function multiversioning attributes on Darwin? I think it might, but I 
> haven't tried to confirm.

I don't think there is an ABI compatibility concern here for a couple of 
reasons:
* The corresponding builtins were unimplemented on Darwin until 
https://github.com/llvm/llvm-project/pull/73685 (FYI, this is part of a patch 
series: #73688, #73687, #73686, #73685)
* On AArch64, the IFunc lowering is required: 
https://github.com/llvm/llvm-project/blob/859338a695169d2804d6999f44e1e94bedf6ddd7/clang/lib/CodeGen/CodeGenFunction.cpp#L2746-L2748

https://github.com/llvm/llvm-project/pull/73688
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

This is part of a patch series:
* #73686
* #73688
* #73687
* #73685

https://github.com/llvm/llvm-project/pull/73687
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

> Do you need an OS version check here?

I don't think so, at least not yet. With #73686, support for this is entirely 
up to the compiler.

https://github.com/llvm/llvm-project/pull/73687
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [compiler-rt] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

jroelofs wrote:

This is part of a patch series:
* #73686
* #73688
* #73687
* #73685

https://github.com/llvm/llvm-project/pull/73685
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] aeb39b9 - adjust tests per review feedback

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T12:23:46-08:00
New Revision: aeb39b92bbd7670fb8c6b9e76a456a92199691b3

URL: 
https://github.com/llvm/llvm-project/commit/aeb39b92bbd7670fb8c6b9e76a456a92199691b3
DIFF: 
https://github.com/llvm/llvm-project/commit/aeb39b92bbd7670fb8c6b9e76a456a92199691b3.diff

LOG: adjust tests per review feedback

Created using spr 1.3.4

Added: 


Modified: 
clang/test/CodeGen/attr-ifunc.c
clang/test/CodeGen/attr-ifunc.cpp
clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
clang/test/SemaCXX/externc-ifunc-resolver.cpp

Removed: 




diff  --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}

diff  --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));

diff  --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp 
b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
index 0518a8dcc831dd4..be4453ae7eb08ce 100644
--- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }

diff  --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp 
b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
index aa44525bde2cae1..6c6c262c5f09d8e 100644
--- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 0041d6d - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T12:23:50-08:00
New Revision: 0041d6d015ae98b29820f649160c60a90c7c4220

URL: 
https://github.com/llvm/llvm-project/commit/0041d6d015ae98b29820f649160c60a90c7c4220
DIFF: 
https://github.com/llvm/llvm-project/commit/0041d6d015ae98b29820f649160c60a90c7c4220.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
clang/test/CodeGen/attr-ifunc.c
clang/test/CodeGen/attr-ifunc.cpp
clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
clang/test/SemaCXX/externc-ifunc-resolver.cpp

Removed: 




diff  --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}

diff  --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));

diff  --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp 
b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
index 0518a8dcc831dd4..be4453ae7eb08ce 100644
--- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }

diff  --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp 
b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
index aa44525bde2cae1..6c6c262c5f09d8e 100644
--- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687

>From aeb39b92bbd7670fb8c6b9e76a456a92199691b3 Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Wed, 29 Nov 2023 12:23:46 -0800
Subject: [PATCH] adjust tests per review feedback

Created using spr 1.3.4
---
 clang/test/CodeGen/attr-ifunc.c   | 20 +++
 clang/test/CodeGen/attr-ifunc.cpp |  4 
 .../CodeGenCXX/externc-ifunc-resolver.cpp |  2 ++
 clang/test/SemaCXX/externc-ifunc-resolver.cpp |  4 
 4 files changed, 30 insertions(+)

diff --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}
diff --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));
diff --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp 
b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
index 0518a8dcc831dd4..be4453ae7eb08ce 100644
--- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }
diff --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp 
b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
index aa44525bde2cae1..6c6c262c5f09d8e 100644
--- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] d0c0b86 - adjust tests per review feedback

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T12:23:52-08:00
New Revision: d0c0b8656f21672ff5b31f2e7ce3583b5008e38b

URL: 
https://github.com/llvm/llvm-project/commit/d0c0b8656f21672ff5b31f2e7ce3583b5008e38b
DIFF: 
https://github.com/llvm/llvm-project/commit/d0c0b8656f21672ff5b31f2e7ce3583b5008e38b.diff

LOG: adjust tests per review feedback

Created using spr 1.3.4

Added: 


Modified: 
clang/test/CodeGen/attr-cpuspecific.c
clang/test/CodeGen/attr-ifunc.c
clang/test/CodeGen/attr-ifunc.cpp
clang/test/CodeGen/attr-target-clones.c
clang/test/CodeGen/attr-target-mv-func-ptrs.c
clang/test/CodeGen/attr-target-mv.c
clang/test/CodeGenCXX/attr-cpuspecific.cpp
clang/test/CodeGenCXX/attr-target-clones.cpp
clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp
clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp
clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp
clang/test/CodeGenCXX/attr-target-mv-modules.cpp
clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
clang/test/CodeGenCXX/attr-target-mv-overloads.cpp
clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
clang/test/SemaCXX/externc-ifunc-resolver.cpp

Removed: 




diff  --git a/clang/test/CodeGen/attr-cpuspecific.c 
b/clang/test/CodeGen/attr-cpuspecific.c
index 9150597e8c5a847..5baa271b5240f0a 100644
--- a/clang/test/CodeGen/attr-cpuspecific.c
+++ b/clang/test/CodeGen/attr-cpuspecific.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,LINUX
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s --check-prefixes=CHECK,LINUX
 // RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o 
- %s | FileCheck %s --check-prefixes=CHECK,WINDOWS
 
 #ifdef _WIN64

diff  --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}

diff  --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));

diff  --git a/clang/test/CodeGen/attr-target-clones.c 
b/clang/test/CodeGen/attr-target-clones.c
index 98ffea40f56d887..32d4d6f32f68e56 100644
--- a/clang/test/CodeGen/attr-target-clones.c
+++ b/clang/test/CodeGen/attr-target-clones.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=LINUX,CHECK
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck 
%s --check-prefixes=DARWIN,CHECK
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=WINDOWS,CHECK
 
 // LI

[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] eafbe06 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T12:23:57-08:00
New Revision: eafbe063de80818d4a9e2714bf317fa759550f39

URL: 
https://github.com/llvm/llvm-project/commit/eafbe063de80818d4a9e2714bf317fa759550f39
DIFF: 
https://github.com/llvm/llvm-project/commit/eafbe063de80818d4a9e2714bf317fa759550f39.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
clang/test/CodeGen/attr-cpuspecific.c
clang/test/CodeGen/attr-ifunc.c
clang/test/CodeGen/attr-ifunc.cpp
clang/test/CodeGen/attr-target-clones.c
clang/test/CodeGen/attr-target-mv-func-ptrs.c
clang/test/CodeGen/attr-target-mv.c
clang/test/CodeGenCXX/attr-cpuspecific.cpp
clang/test/CodeGenCXX/attr-target-clones.cpp
clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp
clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp
clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp
clang/test/CodeGenCXX/attr-target-mv-modules.cpp
clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
clang/test/CodeGenCXX/attr-target-mv-overloads.cpp
clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
clang/test/SemaCXX/externc-ifunc-resolver.cpp

Removed: 




diff  --git a/clang/test/CodeGen/attr-cpuspecific.c 
b/clang/test/CodeGen/attr-cpuspecific.c
index 9150597e8c5a847..5baa271b5240f0a 100644
--- a/clang/test/CodeGen/attr-cpuspecific.c
+++ b/clang/test/CodeGen/attr-cpuspecific.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,LINUX
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s --check-prefixes=CHECK,LINUX
 // RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o 
- %s | FileCheck %s --check-prefixes=CHECK,WINDOWS
 
 #ifdef _WIN64

diff  --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}

diff  --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));

diff  --git a/clang/test/CodeGen/attr-target-clones.c 
b/clang/test/CodeGen/attr-target-clones.c
index 98ffea40f56d887..32d4d6f32f68e56 100644
--- a/clang/test/CodeGen/attr-target-clones.c
+++ b/clang/test/CodeGen/attr-target-clones.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=LINUX,CHECK
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck 
%s --check-prefixes=DARWIN,CHECK
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=WIND

[llvm-branch-commits] [clang] b6a5fe0 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T12:24:02-08:00
New Revision: b6a5fe0edbcbd6ce6d0078c6be096fd65f080b10

URL: 
https://github.com/llvm/llvm-project/commit/b6a5fe0edbcbd6ce6d0078c6be096fd65f080b10
DIFF: 
https://github.com/llvm/llvm-project/commit/b6a5fe0edbcbd6ce6d0078c6be096fd65f080b10.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
clang/test/CodeGen/attr-cpuspecific.c
clang/test/CodeGen/attr-ifunc.c
clang/test/CodeGen/attr-ifunc.cpp
clang/test/CodeGen/attr-target-clones.c
clang/test/CodeGen/attr-target-mv-func-ptrs.c
clang/test/CodeGen/attr-target-mv.c
clang/test/CodeGenCXX/attr-cpuspecific.cpp
clang/test/CodeGenCXX/attr-target-clones.cpp
clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp
clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp
clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp
clang/test/CodeGenCXX/attr-target-mv-modules.cpp
clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
clang/test/CodeGenCXX/attr-target-mv-overloads.cpp
clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
clang/test/SemaCXX/externc-ifunc-resolver.cpp

Removed: 




diff  --git a/clang/test/CodeGen/attr-cpuspecific.c 
b/clang/test/CodeGen/attr-cpuspecific.c
index 9150597e8c5a847..5baa271b5240f0a 100644
--- a/clang/test/CodeGen/attr-cpuspecific.c
+++ b/clang/test/CodeGen/attr-cpuspecific.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,LINUX
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s --check-prefixes=CHECK,LINUX
 // RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o 
- %s | FileCheck %s --check-prefixes=CHECK,WINDOWS
 
 #ifdef _WIN64

diff  --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}

diff  --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));

diff  --git a/clang/test/CodeGen/attr-target-clones.c 
b/clang/test/CodeGen/attr-target-clones.c
index 98ffea40f56d887..32d4d6f32f68e56 100644
--- a/clang/test/CodeGen/attr-target-clones.c
+++ b/clang/test/CodeGen/attr-target-clones.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=LINUX,CHECK
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck 
%s --check-prefixes=DARWIN,CHECK
 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=WINDOWS,CHECK
 
 // LINUX: $foo.resolver = comda

[llvm-branch-commits] [compiler-rt] [llvm] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] [llvm] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] b2d46d6 - review feedback

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:56:55-08:00
New Revision: b2d46d62984b685cd94597c957708e7b5b34d671

URL: 
https://github.com/llvm/llvm-project/commit/b2d46d62984b685cd94597c957708e7b5b34d671
DIFF: 
https://github.com/llvm/llvm-project/commit/b2d46d62984b685cd94597c957708e7b5b34d671.diff

LOG: review feedback

Created using spr 1.3.4

Added: 


Modified: 
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b4ac0a70e7fde9c..aaa7693c61f0e85 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2321,7 +2321,7 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   // IFuncs must come before deubginfo in case the backend decides to emit them
-  // as actual functions, since on MachO targets, we cannot create regular
+  // as actual functions, since on Mach-O targets, we cannot create regular
   // sections after DWARF.
   for (const auto &IFunc : M.ifuncs())
 emitGlobalIFunc(M, IFunc);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] c259170 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:56:58-08:00
New Revision: c259170dfdadbdadbabdc769b547d278045fc323

URL: 
https://github.com/llvm/llvm-project/commit/c259170dfdadbdadbabdc769b547d278045fc323
DIFF: 
https://github.com/llvm/llvm-project/commit/c259170dfdadbdadbabdc769b547d278045fc323.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b4ac0a70e7fde9c..aaa7693c61f0e85 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2321,7 +2321,7 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   // IFuncs must come before deubginfo in case the backend decides to emit them
-  // as actual functions, since on MachO targets, we cannot create regular
+  // as actual functions, since on Mach-O targets, we cannot create regular
   // sections after DWARF.
   for (const auto &IFunc : M.ifuncs())
 emitGlobalIFunc(M, IFunc);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] edf4acd - review feedback

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:57:00-08:00
New Revision: edf4acd0884b3e96411d6def562cbd3afaada41b

URL: 
https://github.com/llvm/llvm-project/commit/edf4acd0884b3e96411d6def562cbd3afaada41b
DIFF: 
https://github.com/llvm/llvm-project/commit/edf4acd0884b3e96411d6def562cbd3afaada41b.diff

LOG: review feedback

Created using spr 1.3.4

Added: 


Modified: 
clang/include/clang/Basic/AttrDocs.td
clang/test/CodeGen/ifunc.c
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 4c4c4eb606fb0dc..5e85ec52a4634e5 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,9 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-MachO targets support it, but with slightly 
diff erent semantics: the resolver is
-run at first call, instead of at load time by the runtime linker. Targets other
-than ELF and MachO currently do not support this attribute.
+Mach-O targets support it, but with slightly 
diff erent semantics: the resolver
+is run at first call, instead of at load time by the runtime linker. Targets
+other than ELF and Mach-O currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c
index 99d60dc0ea85dbd..a29b500e80bd50b 100644
--- a/clang/test/CodeGen/ifunc.c
+++ b/clang/test/CodeGen/ifunc.c
@@ -3,9 +3,13 @@
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=thread -O2 -emit-llvm 
-o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 
 int foo(int) __attribute__ ((ifunc("foo_ifunc")));

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b4ac0a70e7fde9c..aaa7693c61f0e85 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2321,7 +2321,7 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   // IFuncs must come before deubginfo in case the backend decides to emit them
-  // as actual functions, since on MachO targets, we cannot create regular
+  // as actual functions, since on Mach-O targets, we cannot create regular
   // sections after DWARF.
   for (const auto &IFunc : M.ifuncs())
 emitGlobalIFunc(M, IFunc);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ecbfa04 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:57:04-08:00
New Revision: ecbfa0495147d255964d8beeb89c8d8d80ec74a1

URL: 
https://github.com/llvm/llvm-project/commit/ecbfa0495147d255964d8beeb89c8d8d80ec74a1
DIFF: 
https://github.com/llvm/llvm-project/commit/ecbfa0495147d255964d8beeb89c8d8d80ec74a1.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
clang/include/clang/Basic/AttrDocs.td
clang/test/CodeGen/ifunc.c
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 4c4c4eb606fb0dc..5e85ec52a4634e5 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,9 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-MachO targets support it, but with slightly 
diff erent semantics: the resolver is
-run at first call, instead of at load time by the runtime linker. Targets other
-than ELF and MachO currently do not support this attribute.
+Mach-O targets support it, but with slightly 
diff erent semantics: the resolver
+is run at first call, instead of at load time by the runtime linker. Targets
+other than ELF and Mach-O currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c
index 99d60dc0ea85dbd..a29b500e80bd50b 100644
--- a/clang/test/CodeGen/ifunc.c
+++ b/clang/test/CodeGen/ifunc.c
@@ -3,9 +3,13 @@
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=thread -O2 -emit-llvm 
-o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 
 int foo(int) __attribute__ ((ifunc("foo_ifunc")));

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b4ac0a70e7fde9c..aaa7693c61f0e85 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2321,7 +2321,7 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   // IFuncs must come before deubginfo in case the backend decides to emit them
-  // as actual functions, since on MachO targets, we cannot create regular
+  // as actual functions, since on Mach-O targets, we cannot create regular
   // sections after DWARF.
   for (const auto &IFunc : M.ifuncs())
 emitGlobalIFunc(M, IFunc);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687

>From aeb39b92bbd7670fb8c6b9e76a456a92199691b3 Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Wed, 29 Nov 2023 12:23:46 -0800
Subject: [PATCH] adjust tests per review feedback

Created using spr 1.3.4
---
 clang/test/CodeGen/attr-ifunc.c   | 20 +++
 clang/test/CodeGen/attr-ifunc.cpp |  4 
 .../CodeGenCXX/externc-ifunc-resolver.cpp |  2 ++
 clang/test/SemaCXX/externc-ifunc-resolver.cpp |  4 
 4 files changed, 30 insertions(+)

diff --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}
diff --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));
diff --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp 
b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
index 0518a8dcc831dd4..be4453ae7eb08ce 100644
--- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }
diff --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp 
b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
index aa44525bde2cae1..6c6c262c5f09d8e 100644
--- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 6329152 - review feedback

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:57:05-08:00
New Revision: 6329152b1afd30cc065ccb2e4d3a1e6f11040b7f

URL: 
https://github.com/llvm/llvm-project/commit/6329152b1afd30cc065ccb2e4d3a1e6f11040b7f
DIFF: 
https://github.com/llvm/llvm-project/commit/6329152b1afd30cc065ccb2e4d3a1e6f11040b7f.diff

LOG: review feedback

Created using spr 1.3.4

Added: 


Modified: 
clang/include/clang/Basic/AttrDocs.td
clang/test/CodeGen/ifunc.c
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 4c4c4eb606fb0dc..5e85ec52a4634e5 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,9 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-MachO targets support it, but with slightly 
diff erent semantics: the resolver is
-run at first call, instead of at load time by the runtime linker. Targets other
-than ELF and MachO currently do not support this attribute.
+Mach-O targets support it, but with slightly 
diff erent semantics: the resolver
+is run at first call, instead of at load time by the runtime linker. Targets
+other than ELF and Mach-O currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c
index 99d60dc0ea85dbd..a29b500e80bd50b 100644
--- a/clang/test/CodeGen/ifunc.c
+++ b/clang/test/CodeGen/ifunc.c
@@ -3,9 +3,13 @@
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=thread -O2 -emit-llvm 
-o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 
 int foo(int) __attribute__ ((ifunc("foo_ifunc")));

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b4ac0a70e7fde9c..aaa7693c61f0e85 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2321,7 +2321,7 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   // IFuncs must come before deubginfo in case the backend decides to emit them
-  // as actual functions, since on MachO targets, we cannot create regular
+  // as actual functions, since on Mach-O targets, we cannot create regular
   // sections after DWARF.
   for (const auto &IFunc : M.ifuncs())
 emitGlobalIFunc(M, IFunc);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687

>From aeb39b92bbd7670fb8c6b9e76a456a92199691b3 Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Wed, 29 Nov 2023 12:23:46 -0800
Subject: [PATCH] adjust tests per review feedback

Created using spr 1.3.4
---
 clang/test/CodeGen/attr-ifunc.c   | 20 +++
 clang/test/CodeGen/attr-ifunc.cpp |  4 
 .../CodeGenCXX/externc-ifunc-resolver.cpp |  2 ++
 clang/test/SemaCXX/externc-ifunc-resolver.cpp |  4 
 4 files changed, 30 insertions(+)

diff --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}
diff --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));
diff --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp 
b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
index 0518a8dcc831dd4..be4453ae7eb08ce 100644
--- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }
diff --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp 
b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
index aa44525bde2cae1..6c6c262c5f09d8e 100644
--- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 63df438 - review feedback

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:57:14-08:00
New Revision: 63df4386d435230e93175d8c73254f65cfe173fa

URL: 
https://github.com/llvm/llvm-project/commit/63df4386d435230e93175d8c73254f65cfe173fa
DIFF: 
https://github.com/llvm/llvm-project/commit/63df4386d435230e93175d8c73254f65cfe173fa.diff

LOG: review feedback

Created using spr 1.3.4

Added: 


Modified: 
clang/include/clang/Basic/AttrDocs.td
clang/test/CodeGen/ifunc.c
compiler-rt/lib/builtins/cpu_model.c
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 4c4c4eb606fb0dc..5e85ec52a4634e5 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,9 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-MachO targets support it, but with slightly 
diff erent semantics: the resolver is
-run at first call, instead of at load time by the runtime linker. Targets other
-than ELF and MachO currently do not support this attribute.
+Mach-O targets support it, but with slightly 
diff erent semantics: the resolver
+is run at first call, instead of at load time by the runtime linker. Targets
+other than ELF and Mach-O currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c
index 99d60dc0ea85dbd..a29b500e80bd50b 100644
--- a/clang/test/CodeGen/ifunc.c
+++ b/clang/test/CodeGen/ifunc.c
@@ -3,9 +3,13 @@
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=thread -O2 -emit-llvm 
-o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 
 int foo(int) __attribute__ ((ifunc("foo_ifunc")));

diff  --git a/compiler-rt/lib/builtins/cpu_model.c 
b/compiler-rt/lib/builtins/cpu_model.c
index b0306f5f36baabf..5f5182859080c49 100644
--- a/compiler-rt/lib/builtins/cpu_model.c
+++ b/compiler-rt/lib/builtins/cpu_model.c
@@ -1291,7 +1291,7 @@ void __init_cpu_features_resolver(void) {
 static struct {
   const char *sysctl_name;
   enum CPUFeatures feature;
-} Features[] = {
+} features[] = {
 {"hw.optional.arm.FEAT_FlagM", FEAT_FLAGM},
 {"hw.optional.arm.FEAT_FlagM2", FEAT_FLAGM2},
 {"hw.optional.arm.FEAT_FHM", FEAT_FP16FML},
@@ -1319,9 +1319,9 @@ void __init_cpu_features_resolver(void) {
 {"hw.optional.arm.FEAT_BTI", FEAT_BTI},
 };
 
-for (size_t I = 0, E = sizeof(Features) / sizeof(Features[0]); I != E; ++I)
-  if (isKnownAndSupported(Features[I].sysctl_name))
-__aarch64_cpu_features.features |= (1ULL << Features[I].feature);
+for (size_t I = 0, E = sizeof(features) / sizeof(features[0]); I != E; ++I)
+  if (isKnownAndSupported(features[I].sysctl_name))
+__aarch64_cpu_features.features |= (1ULL << features[I].feature);
 
 __aarch64_cpu_features.features |= (1ULL << FEAT_INIT);
   });

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

di

[llvm-branch-commits] [llvm] 97e7926 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T13:57:10-08:00
New Revision: 97e7926f25d81fb6c6d87202f721c2e2cf6198f5

URL: 
https://github.com/llvm/llvm-project/commit/97e7926f25d81fb6c6d87202f721c2e2cf6198f5
DIFF: 
https://github.com/llvm/llvm-project/commit/97e7926f25d81fb6c6d87202f721c2e2cf6198f5.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
clang/include/clang/Basic/AttrDocs.td
clang/test/CodeGen/ifunc.c
llvm/docs/LangRef.rst
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 4c4c4eb606fb0dc..5e85ec52a4634e5 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5408,9 +5408,9 @@ considered inline.
 Not all targets support this attribute. ELF target support depends on both the
 linker and runtime linker, and is available in at least lld 4.0 and later,
 binutils 2.20.1 and later, glibc v2.11.1 and later, and FreeBSD 9.1 and later.
-MachO targets support it, but with slightly 
diff erent semantics: the resolver is
-run at first call, instead of at load time by the runtime linker. Targets other
-than ELF and MachO currently do not support this attribute.
+Mach-O targets support it, but with slightly 
diff erent semantics: the resolver
+is run at first call, instead of at load time by the runtime linker. Targets
+other than ELF and Mach-O currently do not support this attribute.
   }];
 }
 

diff  --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c
index 99d60dc0ea85dbd..a29b500e80bd50b 100644
--- a/clang/test/CodeGen/ifunc.c
+++ b/clang/test/CodeGen/ifunc.c
@@ -3,9 +3,13 @@
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=thread -O2 -emit-llvm 
-o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 // RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 
-emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN
 
 int foo(int) __attribute__ ((ifunc("foo_ifunc")));

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cb222e979db29d4..fece4ac7f127d6b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,7 +937,7 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
 lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b4ac0a70e7fde9c..aaa7693c61f0e85 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2321,7 +2321,7 @@ bool AsmPrinter::doFinalization(Module &M) {
   }
 
   // IFuncs must come before deubginfo in case the backend decides to emit them
-  // as actual functions, since on MachO targets, we cannot create regular
+  // as actual functions, since on Mach-O targets, we cannot create regular
   // sections after DWARF.
   for (const auto &IFunc : M.ifuncs())
 emitGlobalIFunc(M, IFunc);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] [llvm] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [compiler-rt] [clang] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] e6af9ea - fix docs build

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:07:49-08:00
New Revision: e6af9eaa469fa0f2cf3b1df7ec80bed3c2354cbe

URL: 
https://github.com/llvm/llvm-project/commit/e6af9eaa469fa0f2cf3b1df7ec80bed3c2354cbe
DIFF: 
https://github.com/llvm/llvm-project/commit/e6af9eaa469fa0f2cf3b1df7ec80bed3c2354cbe.diff

LOG: fix docs build

Created using spr 1.3.4

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 8825586 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:07:53-08:00
New Revision: 88255861a604165f81a29c8f69b3e16e6c0b74a3

URL: 
https://github.com/llvm/llvm-project/commit/88255861a604165f81a29c8f69b3e16e6c0b74a3
DIFF: 
https://github.com/llvm/llvm-project/commit/88255861a604165f81a29c8f69b3e16e6c0b74a3.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 2b76795 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:08:00-08:00
New Revision: 2b7679544836b2c0ef98f07395a6bfc9e0a5c202

URL: 
https://github.com/llvm/llvm-project/commit/2b7679544836b2c0ef98f07395a6bfc9e0a5c202
DIFF: 
https://github.com/llvm/llvm-project/commit/2b7679544836b2c0ef98f07395a6bfc9e0a5c202.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 80f3bd6 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:07:56-08:00
New Revision: 80f3bd69873471d40beef116a694d19a133b4959

URL: 
https://github.com/llvm/llvm-project/commit/80f3bd69873471d40beef116a694d19a133b4959
DIFF: 
https://github.com/llvm/llvm-project/commit/80f3bd69873471d40beef116a694d19a133b4959.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ad2f207 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:08:01-08:00
New Revision: ad2f207e251797ba1ac0abc945589dff4228ce8f

URL: 
https://github.com/llvm/llvm-project/commit/ad2f207e251797ba1ac0abc945589dff4228ce8f
DIFF: 
https://github.com/llvm/llvm-project/commit/ad2f207e251797ba1ac0abc945589dff4228ce8f.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] b3ed2e9 - [𝘀𝗽𝗿] changes introduced through rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:08:05-08:00
New Revision: b3ed2e9abc371f37b35f77d4d7f93d4673e5f333

URL: 
https://github.com/llvm/llvm-project/commit/b3ed2e9abc371f37b35f77d4d7f93d4673e5f333
DIFF: 
https://github.com/llvm/llvm-project/commit/b3ed2e9abc371f37b35f77d4d7f93d4673e5f333.diff

LOG: [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73687)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73687

>From aeb39b92bbd7670fb8c6b9e76a456a92199691b3 Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Wed, 29 Nov 2023 12:23:46 -0800
Subject: [PATCH] adjust tests per review feedback

Created using spr 1.3.4
---
 clang/test/CodeGen/attr-ifunc.c   | 20 +++
 clang/test/CodeGen/attr-ifunc.cpp |  4 
 .../CodeGenCXX/externc-ifunc-resolver.cpp |  2 ++
 clang/test/SemaCXX/externc-ifunc-resolver.cpp |  4 
 4 files changed, 30 insertions(+)

diff --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c
index 4f8fe13530fdb7b..2ad41edf20dfa01 100644
--- a/clang/test/CodeGen/attr-ifunc.c
+++ b/clang/test/CodeGen/attr-ifunc.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
-DCHECK_ALIASES %s
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 
 #if defined(_WIN32)
 void foo(void) {}
@@ -36,6 +37,25 @@ void *f6_resolver(void) 
__attribute__((ifunc("f6_resolver_resolver")));
 void f6(void) __attribute__((ifunc("f6_resolver")));
 // expected-error@-1 {{ifunc must point to a defined function}}
 
+#elif defined(__APPLE__)
+
+// NOTE: aliases are not supported on Darwin, so the above tests are not 
relevant.
+
+#define STR2(X) #X
+#define STR(X) STR2(X)
+#define PREFIX STR(__USER_LABEL_PREFIX__)
+
+void f1a(void) __asm("f1");
+void f1a(void) {}
+// expected-note@-1 {{previous definition is here}}
+void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1");
+// expected-error@-1 {{definition with same mangled name 'f1' as 
another definition}}
+void *f1_ifunc(void) { return 0; }
+
+void *f6_ifunc(int i);
+void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {}
+// expected-error@-1 {{definition 'f6' cannot also be an ifunc}}
+
 #else
 void f1a(void) __asm("f1");
 void f1a(void) {}
diff --git a/clang/test/CodeGen/attr-ifunc.cpp 
b/clang/test/CodeGen/attr-ifunc.cpp
index 5b5b2c14b4074b7..b6e342df46eb583 100644
--- a/clang/test/CodeGen/attr-ifunc.cpp
+++ b/clang/test/CodeGen/attr-ifunc.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify 
-emit-llvm-only %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 void *f1_ifunc(void) { return nullptr; }
 void f1(void) __attribute__((ifunc("f1_ifunc")));
diff --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp 
b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
index 0518a8dcc831dd4..be4453ae7eb08ce 100644
--- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck 
%s
+// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }
diff --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp 
b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
index aa44525bde2cae1..6c6c262c5f09d8e 100644
--- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp
+++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s
+// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s
 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only 
-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
 
 extern "C" {
 __attribute__((used)) static void *resolve_foo() { return 0; }

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [clang] [clang] Function Multi Versioning supports IFunc lowerings on Darwin platforms (PR #73688)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73688


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ee558d7 - rebase

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

Author: Jon Roelofs
Date: 2023-11-29T14:08:06-08:00
New Revision: ee558d7441ec003979409071f2968fbbb6b0c173

URL: 
https://github.com/llvm/llvm-project/commit/ee558d7441ec003979409071f2968fbbb6b0c173
DIFF: 
https://github.com/llvm/llvm-project/commit/ee558d7441ec003979409071f2968fbbb6b0c173.diff

LOG: rebase

Created using spr 1.3.4

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index fece4ac7f127d6b..51c60ecf5ac6586 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -937,8 +937,8 @@ IFuncs, like as aliases, don't create any new data or func. 
They are just a new
 symbol that is resolved at runtime by calling a resolver function.
 
 On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
-Mach-O platforms, they are lowered in terms of ``.symbol_resolver``s, which
-lazily resolve the callee the first time they are called.
+Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
+which lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] [clang] [llvm] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [llvm] [compiler-rt] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73685)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73685


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [compiler-rt] [clang] fixup! [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms (PR #73862)

2023-11-29 Thread Jon Roelofs via llvm-branch-commits

https://github.com/jroelofs created 
https://github.com/llvm/llvm-project/pull/73862

None


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


  1   2   3   >