[cfe-commits] r165988 - in /cfe/trunk: include/clang/Basic/ObjCRuntime.h lib/CodeGen/CGObjC.cpp lib/Driver/ToolChains.cpp lib/Driver/Tools.cpp lib/Sema/SemaExpr.cpp runtime/compiler-rt/Makefile test/CodeGenObjC/optimized-setter-ios-device.m test/

Nico Weber thakis at chromium.org
Mon Oct 15 16:21:34 PDT 2012


On Mon, Oct 15, 2012 at 3:45 PM, Daniel Dunbar <daniel.dunbar at gmail.com> wrote:
> There is a fix, in 165986. Just separated it into a different commit.

Ah, I didn't see that. Thanks!

(ps: This seems to work for me, but I need to build a few times for it
to work. I get intermittent failures while building compiler-rt the
first few tries. Repro: `make clean && make -j16` in the llvm root
directory.)

>
>  - Daniel
>
>
> On Oct 15, 2012, at 15:42, Nico Weber <thakis at chromium.org> wrote:
>
>> Why reland this without a build fix?
>>
>> On Mon, Oct 15, 2012 at 3:23 PM, Daniel Dunbar <daniel at zuster.org> wrote:
>>> Author: ddunbar
>>> Date: Mon Oct 15 17:23:53 2012
>>> New Revision: 165988
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=165988&view=rev
>>> Log:
>>> Un-revert r164907 and r164902 (+ follow-ups), 10.6 build fix to follow.
>>>
>>> Added:
>>>    cfe/trunk/test/CodeGenObjC/optimized-setter-ios-device.m
>>>      - copied, changed from r165977, cfe/trunk/test/CodeGenObjC/optimized-setter.m
>>>    cfe/trunk/test/CodeGenObjC/unoptimized-setter.m
>>>      - copied, changed from r165977, cfe/trunk/test/CodeGenObjC/optimized-setter.m
>>> Modified:
>>>    cfe/trunk/include/clang/Basic/ObjCRuntime.h
>>>    cfe/trunk/lib/CodeGen/CGObjC.cpp
>>>    cfe/trunk/lib/Driver/ToolChains.cpp
>>>    cfe/trunk/lib/Driver/Tools.cpp
>>>    cfe/trunk/lib/Sema/SemaExpr.cpp
>>>    cfe/trunk/runtime/compiler-rt/Makefile
>>>    cfe/trunk/test/CodeGenObjC/optimized-setter.m
>>>    cfe/trunk/test/Driver/darwin-ld.c
>>>    cfe/trunk/test/Driver/pic.c
>>>
>>> Modified: cfe/trunk/include/clang/Basic/ObjCRuntime.h
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/ObjCRuntime.h?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/Basic/ObjCRuntime.h (original)
>>> +++ cfe/trunk/include/clang/Basic/ObjCRuntime.h Mon Oct 15 17:23:53 2012
>>> @@ -157,6 +157,19 @@
>>>     llvm_unreachable("bad kind");
>>>   }
>>>
>>> +  /// \brief Does this runtime supports optimized setter entrypoints?
>>> +  bool hasOptimizedSetter() const {
>>> +    switch (getKind()) {
>>> +      case MacOSX:
>>> +        return getVersion() >= VersionTuple(10, 8);
>>> +      case iOS:
>>> +        return (getVersion() >= VersionTuple(6));
>>> +
>>> +      default:
>>> +      return false;
>>> +    }
>>> +  }
>>> +
>>>   /// Does this runtime allow the use of __weak?
>>>   bool allowsWeak() const {
>>>     return hasNativeWeak();
>>> @@ -177,7 +190,7 @@
>>>     switch (getKind()) {
>>>     case FragileMacOSX: return false;
>>>     case MacOSX: return getVersion() >= VersionTuple(10, 8);
>>> -    case iOS: return false;
>>> +    case iOS: return getVersion() >= VersionTuple(6);
>>>
>>>     // This is really a lie, because some implementations and versions
>>>     // of the runtime do not support ARC.  Probably -fgnu-runtime
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGObjC.cpp Mon Oct 15 17:23:53 2012
>>> @@ -1041,12 +1041,7 @@
>>> static bool UseOptimizedSetter(CodeGenModule &CGM) {
>>>   if (CGM.getLangOpts().getGC() != LangOptions::NonGC)
>>>     return false;
>>> -  const TargetInfo &Target = CGM.getContext().getTargetInfo();
>>> -
>>> -  if (Target.getPlatformName() != "macosx")
>>> -    return false;
>>> -
>>> -  return Target.getPlatformMinVersion() >= VersionTuple(10, 8);
>>> +  return CGM.getLangOpts().ObjCRuntime.hasOptimizedSetter();
>>> }
>>>
>>> void
>>> @@ -1106,7 +1101,7 @@
>>>     llvm::Value *setOptimizedPropertyFn = 0;
>>>     llvm::Value *setPropertyFn = 0;
>>>     if (UseOptimizedSetter(CGM)) {
>>> -      // 10.8 code and GC is off
>>> +      // 10.8 and iOS 6.0 code and GC is off
>>>       setOptimizedPropertyFn =
>>>         CGM.getObjCRuntime()
>>>            .GetOptimizedPropertySetFunction(strategy.isAtomic(),
>>>
>>> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>>> +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 15 17:23:53 2012
>>> @@ -332,7 +332,9 @@
>>>
>>>   // Darwin doesn't support real static executables, don't link any runtime
>>>   // libraries with -static.
>>> -  if (Args.hasArg(options::OPT_static))
>>> +  if (Args.hasArg(options::OPT_static) ||
>>> +      Args.hasArg(options::OPT_fapple_kext) ||
>>> +      Args.hasArg(options::OPT_mkernel))
>>>     return;
>>>
>>>   // Reject -static-libgcc for now, we can deal with this when and if someone
>>> @@ -676,7 +678,14 @@
>>>   llvm::sys::Path P(getDriver().ResourceDir);
>>>   P.appendComponent("lib");
>>>   P.appendComponent("darwin");
>>> -  P.appendComponent("libclang_rt.cc_kext.a");
>>> +
>>> +  // Use the newer cc_kext for iOS ARM after 6.0.
>>> +  if (!isTargetIPhoneOS() || isTargetIOSSimulator() ||
>>> +      !isIPhoneOSVersionLT(6, 0)) {
>>> +    P.appendComponent("libclang_rt.cc_kext.a");
>>> +  } else {
>>> +    P.appendComponent("libclang_rt.cc_kext_ios5.a");
>>> +  }
>>>
>>>   // For now, allow missing resource libraries to support developers who may
>>>   // not have compiler-rt checked out or integrated into their build.
>>> @@ -902,6 +911,25 @@
>>>   if (BoundArch)
>>>     AddDeploymentTarget(*DAL);
>>>
>>> +  // For iOS 6, undo the translation to add -static for -mkernel/-fapple-kext.
>>> +  // FIXME: It would be far better to avoid inserting those -static arguments,
>>> +  // but we can't check the deployment target in the translation code until
>>> +  // it is set here.
>>> +  if (isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) {
>>> +    for (ArgList::iterator it = DAL->begin(), ie = DAL->end(); it != ie; ) {
>>> +      Arg *A = *it;
>>> +      ++it;
>>> +      if (A->getOption().getID() != options::OPT_mkernel &&
>>> +          A->getOption().getID() != options::OPT_fapple_kext)
>>> +        continue;
>>> +      assert(it != ie && "unexpected argument translation");
>>> +      A = *it;
>>> +      assert(A->getOption().getID() == options::OPT_static &&
>>> +             "missing expected -static argument");
>>> +      it = DAL->getArgs().erase(it);
>>> +    }
>>> +  }
>>> +
>>>   // Validate the C++ standard library choice.
>>>   CXXStdlibType Type = GetCXXStdlibType(*DAL);
>>>   if (Type == ToolChain::CST_Libcxx) {
>>>
>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Oct 15 17:23:53 2012
>>> @@ -674,7 +674,9 @@
>>>                              ArgStringList &CmdArgs,
>>>                              bool KernelOrKext) const {
>>>   const Driver &D = getToolChain().getDriver();
>>> -  llvm::Triple Triple = getToolChain().getTriple();
>>> +  // Get the effective triple, which takes into account the deployment target.
>>> +  std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
>>> +  llvm::Triple Triple(TripleStr);
>>>
>>>   // Select the ABI to use.
>>>   //
>>> @@ -759,8 +761,10 @@
>>>
>>>   // Kernel code has more strict alignment requirements.
>>>   if (KernelOrKext) {
>>> -    CmdArgs.push_back("-backend-option");
>>> -    CmdArgs.push_back("-arm-long-calls");
>>> +    if (Triple.getOS() != llvm::Triple::IOS || Triple.isOSVersionLT(6)) {
>>> +      CmdArgs.push_back("-backend-option");
>>> +      CmdArgs.push_back("-arm-long-calls");
>>> +    }
>>>
>>>     CmdArgs.push_back("-backend-option");
>>>     CmdArgs.push_back("-arm-strict-align");
>>> @@ -1697,7 +1701,11 @@
>>>   }
>>>   // Note that these flags are trump-cards. Regardless of the order w.r.t. the
>>>   // PIC or PIE options above, if these show up, PIC is disabled.
>>> -  if (Args.hasArg(options::OPT_mkernel))
>>> +  llvm::Triple Triple(TripleStr);
>>> +  if ((Args.hasArg(options::OPT_mkernel) ||
>>> +       Args.hasArg(options::OPT_fapple_kext)) &&
>>> +      (Triple.getOS() != llvm::Triple::IOS ||
>>> +       Triple.isOSVersionLT(6)))
>>>     PICDisabled = true;
>>>   if (Args.hasArg(options::OPT_static))
>>>     PICDisabled = true;
>>> @@ -3690,7 +3698,10 @@
>>>   CheckCodeGenerationOptions(D, Args);
>>>
>>>   // Derived from cc1 spec.
>>> -  if (!Args.hasArg(options::OPT_mkernel) && !Args.hasArg(options::OPT_static) &&
>>> +  if ((!Args.hasArg(options::OPT_mkernel) ||
>>> +       (getDarwinToolChain().isTargetIPhoneOS() &&
>>> +        !getDarwinToolChain().isIPhoneOSVersionLT(6, 0))) &&
>>> +      !Args.hasArg(options::OPT_static) &&
>>>       !Args.hasArg(options::OPT_mdynamic_no_pic))
>>>     CmdArgs.push_back("-fPIC");
>>>
>>> @@ -4144,9 +4155,11 @@
>>>     CmdArgs.push_back("-force_cpusubtype_ALL");
>>>
>>>   if (getToolChain().getTriple().getArch() != llvm::Triple::x86_64 &&
>>> -      (Args.hasArg(options::OPT_mkernel) ||
>>> -       Args.hasArg(options::OPT_static) ||
>>> -       Args.hasArg(options::OPT_fapple_kext)))
>>> +      (((Args.hasArg(options::OPT_mkernel) ||
>>> +         Args.hasArg(options::OPT_fapple_kext)) &&
>>> +        (!getDarwinToolChain().isTargetIPhoneOS() ||
>>> +         getDarwinToolChain().isIPhoneOSVersionLT(6, 0))) ||
>>> +       Args.hasArg(options::OPT_static)))
>>>     CmdArgs.push_back("-static");
>>>
>>>   Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
>>> @@ -4507,7 +4520,7 @@
>>>             } else if (getDarwinToolChain().isTargetIPhoneOS()) {
>>>               if (getDarwinToolChain().isIPhoneOSVersionLT(3, 1))
>>>                 CmdArgs.push_back("-lcrt1.o");
>>> -              else
>>> +              else if (getDarwinToolChain().isIPhoneOSVersionLT(6, 0))
>>>                 CmdArgs.push_back("-lcrt1.3.1.o");
>>>             } else {
>>>               if (getDarwinToolChain().isMacosxVersionLT(10, 5))
>>>
>>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Oct 15 17:23:53 2012
>>> @@ -9770,11 +9770,8 @@
>>>
>>>   switch (ConvTy) {
>>>   case Compatible:
>>> -    DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
>>> -
>>> -    // XXX here with forced compatible cast
>>> -
>>> -    return false;
>>> +      DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
>>> +      return false;
>>>
>>>   case PointerToInt:
>>>     DiagKind = diag::ext_typecheck_convert_pointer_int;
>>> @@ -9857,7 +9854,6 @@
>>>     DiagKind = diag::err_arc_weak_unavailable_assign;
>>>     break;
>>>   case Incompatible:
>>> -    // XXX here
>>>     DiagKind = diag::err_typecheck_convert_incompatible;
>>>     ConvHints.tryToFixConversion(SrcExpr, SrcType, DstType, *this);
>>>     MayHaveConvFixit = true;
>>>
>>> Modified: cfe/trunk/runtime/compiler-rt/Makefile
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/compiler-rt/Makefile?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/runtime/compiler-rt/Makefile (original)
>>> +++ cfe/trunk/runtime/compiler-rt/Makefile Mon Oct 15 17:23:53 2012
>>> @@ -74,9 +74,9 @@
>>> ifeq ($(OS),Darwin)
>>> RuntimeDirs += darwin
>>> RuntimeLibrary.darwin.Configs := \
>>> -       eprintf.a 10.4.a osx.a cc_kext.a \
>>> +       eprintf.a 10.4.a osx.a ios.a cc_kext.a cc_kext_ios5.a \
>>>        asan_osx.a asan_osx_dynamic.dylib \
>>> -       profile_osx.a
>>> +       profile_osx.a profile_ios.a
>>> endif
>>>
>>> # On Linux, include a library which has all the runtime functions.
>>>
>>> Copied: cfe/trunk/test/CodeGenObjC/optimized-setter-ios-device.m (from r165977, cfe/trunk/test/CodeGenObjC/optimized-setter.m)
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/optimized-setter-ios-device.m?p2=cfe/trunk/test/CodeGenObjC/optimized-setter-ios-device.m&p1=cfe/trunk/test/CodeGenObjC/optimized-setter.m&r1=165977&r2=165988&rev=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGenObjC/optimized-setter.m (original)
>>> +++ cfe/trunk/test/CodeGenObjC/optimized-setter-ios-device.m Mon Oct 15 17:23:53 2012
>>> @@ -1,5 +1,5 @@
>>> -// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-macosx10.8.0 -o - | FileCheck %s
>>> -// rdar://10179974
>>> +// RUN: %clang_cc1 %s -emit-llvm -fobjc-runtime=ios-6.0.0 -triple thumbv7-apple-ios6.0.0 -o - | FileCheck %s
>>> +// rdar://11915017
>>>
>>> @interface I
>>> // void objc_setProperty_nonatomic(id self, SEL _cmd, id newValue, ptrdiff_t offset);
>>> @@ -26,8 +26,8 @@
>>> @synthesize atomicPropertyCopy;
>>> @end
>>>
>>> -// CHECK: call void @objc_setProperty_nonatomic
>>> -// CHECK: call void @objc_setProperty_nonatomic_copy
>>> -// CHECK: call void @objc_setProperty_atomic
>>> -// CHECK: call void @objc_setProperty_atomic_copy
>>> +// CHECK: call arm_aapcscc void @objc_setProperty_nonatomic
>>> +// CHECK: call arm_aapcscc void @objc_setProperty_nonatomic_copy
>>> +// CHECK: call arm_aapcscc void @objc_setProperty_atomic
>>> +// CHECK: call arm_aapcscc void @objc_setProperty_atomic_copy
>>>
>>>
>>> Modified: cfe/trunk/test/CodeGenObjC/optimized-setter.m
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/optimized-setter.m?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGenObjC/optimized-setter.m (original)
>>> +++ cfe/trunk/test/CodeGenObjC/optimized-setter.m Mon Oct 15 17:23:53 2012
>>> @@ -1,4 +1,5 @@
>>> -// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-macosx10.8.0 -o - | FileCheck %s
>>> +// RUN: %clang_cc1 %s -emit-llvm -fobjc-runtime=macosx-10.8 -triple x86_64-apple-macosx10.8.0 -o - | FileCheck %s
>>> +// RUN: %clang_cc1 %s -emit-llvm -fobjc-runtime=ios-6.0.0  -triple x86_64-apple-ios6.0.0 -o - | FileCheck %s
>>> // rdar://10179974
>>>
>>> @interface I
>>>
>>> Copied: cfe/trunk/test/CodeGenObjC/unoptimized-setter.m (from r165977, cfe/trunk/test/CodeGenObjC/optimized-setter.m)
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/unoptimized-setter.m?p2=cfe/trunk/test/CodeGenObjC/unoptimized-setter.m&p1=cfe/trunk/test/CodeGenObjC/optimized-setter.m&r1=165977&r2=165988&rev=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGenObjC/optimized-setter.m (original)
>>> +++ cfe/trunk/test/CodeGenObjC/unoptimized-setter.m Mon Oct 15 17:23:53 2012
>>> @@ -1,5 +1,5 @@
>>> -// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-macosx10.8.0 -o - | FileCheck %s
>>> -// rdar://10179974
>>> +// RUN: %clang_cc1 %s -emit-llvm -fobjc-runtime=macosx-10.6.0 -triple x86_64-apple-macosx10.6.0 -o - | FileCheck %s
>>> +// rdar://11858187
>>>
>>> @interface I
>>> // void objc_setProperty_nonatomic(id self, SEL _cmd, id newValue, ptrdiff_t offset);
>>> @@ -26,8 +26,7 @@
>>> @synthesize atomicPropertyCopy;
>>> @end
>>>
>>> -// CHECK: call void @objc_setProperty_nonatomic
>>> -// CHECK: call void @objc_setProperty_nonatomic_copy
>>> -// CHECK: call void @objc_setProperty_atomic
>>> -// CHECK: call void @objc_setProperty_atomic_copy
>>> -
>>> +// CHECK-NOT: call void @objc_setProperty_nonatomic
>>> +// CHECK-NOT: call void @objc_setProperty_nonatomic_copy
>>> +// CHECK-NOT: call void @objc_setProperty_atomic
>>> +// CHECK-NOT: call void @objc_setProperty_atomic_copy
>>>
>>> Modified: cfe/trunk/test/Driver/darwin-ld.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/Driver/darwin-ld.c (original)
>>> +++ cfe/trunk/test/Driver/darwin-ld.c Mon Oct 15 17:23:53 2012
>>> @@ -122,6 +122,10 @@
>>> // RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log
>>> // LINK_NO_CRT1-NOT: crt
>>>
>>> +// RUN: %clang -target armv7-apple-ios6.0 -miphoneos-version-min=6.0 -### %t.o 2> %t.log
>>> +// RUN: FileCheck -check-prefix=LINK_NO_IOS_CRT1 %s < %t.log
>>> +// LINK_NO_IOS_CRT1-NOT: crt
>>> +
>>> // RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log
>>> // RUN: FileCheck -check-prefix=LINK_PG %s < %t.log
>>> // LINK_PG: -lgcrt1.o
>>>
>>> Modified: cfe/trunk/test/Driver/pic.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/pic.c?rev=165988&r1=165987&r2=165988&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/Driver/pic.c (original)
>>> +++ cfe/trunk/test/Driver/pic.c Mon Oct 15 17:23:53 2012
>>> @@ -93,3 +93,13 @@
>>> // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC1
>>> // RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fPIC -### 2>&1 \
>>> // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
>>> +
>>> +// Checks for ARM
>>> +// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -### 2>&1 \
>>> +// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
>>> +// RUN: %clang -c %s -target armv7-apple-ios -mkernel -miphoneos-version-min=6.0.0 -### 2>&1 \
>>> +// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
>>> +// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \
>>> +// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
>>> +// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \
>>> +// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list