================
@@ -0,0 +1,141 @@
+; Test cross-module ThinLTO sliding when Sub's compile-time instanceStart
+; is stale due to Super's hidden extension ivar.
+;
+; Hierarchy:
+; NSObject
+; `- Super
+; int x; // x at offset 8
+; int hidden; // hidden at offset 12 (extension)
+; `- Sub
+; int y; // y compiled at 12, slid to 16
+;
+; RUN: rm -rf %t && split-file %s %t
+; RUN: opt -module-summary %t/sub.ll -o %t/sub.bc
+; RUN: opt -module-summary %t/super.ll -o %t/super.bc
+; RUN: llvm-lto2 run %t/sub.bc %t/super.bc -save-temps -o %t/out \
+; RUN: -r=%t/sub.bc,_OBJC_CLASS_$_Sub,plx \
+; RUN: -r=%t/sub.bc,_OBJC_CLASS_$_Super, \
+; RUN: -r=%t/sub.bc,_OBJC_IVAR_$_Sub.y,plx \
+; RUN: -r=%t/sub.bc,_OBJC_METACLASS_$_NSObject, \
+; RUN: -r=%t/sub.bc,_OBJC_METACLASS_$_Sub,plx \
+; RUN: -r=%t/sub.bc,_OBJC_METACLASS_$_Super, \
+; RUN: -r=%t/sub.bc,__objc_empty_cache, \
+; RUN: -r=%t/super.bc,_OBJC_CLASS_$_NSObject, \
+; RUN: -r=%t/super.bc,_OBJC_CLASS_$_Super,plx \
+; RUN: -r=%t/super.bc,_OBJC_IVAR_$_Super.hidden,plx \
+; RUN: -r=%t/super.bc,_OBJC_IVAR_$_Super.x,plx \
+; RUN: -r=%t/super.bc,_OBJC_METACLASS_$_NSObject, \
+; RUN: -r=%t/super.bc,_OBJC_METACLASS_$_Super,plx \
+; RUN: -r=%t/super.bc,__objc_empty_cache,
+;
+; Sub ivar offset should be slid from 12 to 16, and marked constant.
+; RUN: llvm-dis %t/out.1.4.opt.bc -o - | FileCheck %s --check-prefix=SUB
+; Super ivars are already constant and should be unchanged.
+; RUN: llvm-dis %t/out.2.4.opt.bc -o - | FileCheck %s --check-prefix=SUPER
+;
+; SUB: @"OBJC_IVAR_$_Sub.y" = {{.*}}constant i64 16
+; SUPER: @"OBJC_IVAR_$_Super.x" = {{.*}}constant i64 8
+; SUPER: @"OBJC_IVAR_$_Super.hidden" = {{.*}}constant i64 12
+
+; Segments:
+; Super.m / Sub.m - ingredients (requires Darwin SDK to regenerate)
+; gen - refresher
+; super.ll / sub.ll - per-module IR, used by ThinLTO path
+
+;--- Super.m
+#import <objc/NSObject.h>
+@interface Super : NSObject { int x; } @end
+@interface Super () { int hidden; } @end
+@implementation Super @end
+
+;--- Sub.m
+#import <objc/NSObject.h>
+@interface Super : NSObject { int x; } @end
+@interface Sub : Super { int y; } @end
+@implementation Sub @end
+
+;--- gen
+clang -target x86_64-apple-macosx10.15 -fobjc-runtime=macosx-10.15 -S
-emit-llvm -isysroot $(xcrun --show-sdk-path) Super.m -o super.ll
----------------
arsenm wrote:
Shouldn't have all of this code and commands not actually run as part of the
test, it's deceptive
https://github.com/llvm/llvm-project/pull/205970
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits