[llvm] 62a1fbe - Enable compact unwind in all darwin simulators

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 21 16:14:07 PDT 2023


Author: Jon Roelofs
Date: 2023-07-21T16:13:47-07:00
New Revision: 62a1fbe9f7f95210480e166b9e4eb02a1389f54d

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

LOG: Enable compact unwind in all darwin simulators

... since they've always supported it.

rdar://104359594

Differential revision: https://reviews.llvm.org/D155988

Added: 
    llvm/test/CodeGen/X86/apple-simulator-compact-unwind.ll

Modified: 
    llvm/lib/MC/MCObjectFileInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index fbdb5a15fd9fed..0b5109e41e7171 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -48,6 +48,10 @@ static bool useCompactUnwind(const Triple &T) {
   if (T.isiOS() && T.isX86())
     return true;
 
+  // The rest of the simulators always have it.
+  if (T.isSimulatorEnvironment())
+    return true;
+
   return false;
 }
 
@@ -62,7 +66,8 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
       SectionKind::getReadOnly());
 
   if (T.isOSDarwin() &&
-      (T.getArch() == Triple::aarch64 || T.getArch() == Triple::aarch64_32))
+      (T.getArch() == Triple::aarch64 || T.getArch() == Triple::aarch64_32 ||
+      T.isSimulatorEnvironment()))
     SupportsCompactUnwindWithoutEHFrame = true;
 
   switch (Ctx->emitDwarfUnwindInfo()) {

diff  --git a/llvm/test/CodeGen/X86/apple-simulator-compact-unwind.ll b/llvm/test/CodeGen/X86/apple-simulator-compact-unwind.ll
new file mode 100644
index 00000000000000..fbf6888b3f1194
--- /dev/null
+++ b/llvm/test/CodeGen/X86/apple-simulator-compact-unwind.ll
@@ -0,0 +1,30 @@
+; RUN: llc -mtriple x86_64-apple-ios-simulator -filetype=obj -o - %s | \
+; RUN: llvm-objdump --macho --unwind-info - | \
+; RUN: FileCheck %s
+
+; RUN: llc -mtriple x86_64-apple-ios -filetype=obj -o - %s | \
+; RUN: llvm-objdump --macho --unwind-info - | \
+; RUN: FileCheck %s
+
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: noinline nounwind optnone ssp uwtable
+define i32 @rdar104359594() #0 {
+entry:
+  ret i32 0
+}
+
+attributes #0 = { noinline nounwind optnone ssp uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtin-calloc" "no-builtin-stpcpy" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cmov,+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+ssse3,+x87" "tune-cpu"="generic" }
+
+!llvm.module.flags = !{!0, !1, !2, !3}
+!llvm.ident = !{!4}
+
+!0 = !{i32 1, !"wchar_size", i32 4}
+!1 = !{i32 8, !"PIC Level", i32 2}
+!2 = !{i32 7, !"uwtable", i32 2}
+!3 = !{i32 7, !"frame-pointer", i32 2}
+!4 = !{!"clang"}
+
+; Check that we generate compact unwind for simulators, which have always
+; supported it.
+; CHECK: Contents of __compact_unwind section:


        


More information about the llvm-commits mailing list