RE: [PATCH] D20561: Warn when taking address of packed member

2016-06-14 Thread Roger Ferrer Ibanez via cfe-commits
Hi Aaron, Euvgeni,

I'll try to whitelist these functions.

Kind regards,
Roger

-Original Message-
From: Aaron Ballman [mailto:aaron.ball...@gmail.com] 
Sent: 14 June 2016 00:30
To: Evgenii Stepanov
Cc: reviews+d20561+public+af1fea8a731d8...@reviews.llvm.org; Roger Ferrer 
Ibanez; Richard Smith; cfe-commits
Subject: Re: [PATCH] D20561: Warn when taking address of packed member

On Mon, Jun 13, 2016 at 7:17 PM, Evgenii Stepanov  wrote:
> On Mon, Jun 13, 2016 at 4:12 PM, Aaron Ballman  
> wrote:
>> On Mon, Jun 13, 2016 at 6:30 PM, Evgeniy Stepanov  wrote:
>>> eugenis added a subscriber: eugenis.
>>> eugenis added a comment.
>>>
>>> In http://reviews.llvm.org/D20561#446031, @aaron.ballman wrote:
>>>
 In http://reviews.llvm.org/D20561#445824, @rogfer01 wrote:

 > I think I wasn't clear with the purpose of the fix-it: there are a few 
 > cases where getting the address of an unaligned pointer is safe (i.e. 
 > false positives).
 >
 > For instance, when I checked Firefox and Chromium there are cases where 
 > getting the address of an unaligned pointer is fine. For the particular 
 > case of these two browsers, they both use a library (usrsctp) that 
 > represents protocol data as packed structs. That library passes 
 > addresses of packed fields to `memcpy` and `memmove` which is OK.


 I think this is a false-positive that should be fixed.
>>>
>>>
>>> This patch was committed without fixing the false positive case, why?
>>
>> Can you give some more code context, like perhaps a test case we can 
>> add to the suite? I believe the current behavior should be 
>> essentially false-positive-free because it only triggers the 
>> diagnostic when the alignments actually differ, so if there are other 
>> false-positives, I agree that we should determine a disposition for them.
>
> This is actually the same library the comment above is talking about:
> https://bugs.chromium.org/p/chromium/issues/detail?id=619640

The first example (gettimeofday()) looks to be a true-positive for sure. The 
remainder are tricky. They're not going to trigger UB in practice because the 
void * that memcpy() takes will get promptly typecast into a character pointer 
to avoid UB with the copy, and that's 1-byte aligned. There's a part of me that 
thinks it may be reasonable to assume that casting to void * always means 
"trust me, it'll be fine" because the pointer needs to be cast back out of a 
void
* to be useful, and so the diagnostic should be skipped in that case.
However, it's also just as likely to see code like (esp in C):

void func(void *ptr) {
  int *blah = ptr;
  *blah = 12;
}

void foo(void) {
  struct some_packed_struct s;
  func(&s.something);
}

which has drifted into UB.

Roger, is there a way to whitelist memcpy (memmove, memset, et al) for this 
check?

>>> Could this warning be excluded from -Wall?
>>
>> Would you like the warning to be excluded from -Wall even if the 
>> false-positive is fixed?
>
> No, the warning seems useful if the false positive is fixed.

Ok, good to know.

~Aaron

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


Re: [PATCH] D20903: Make system_error::message() thread safe. Fixes PR25598.

2016-06-14 Thread Erik Kessler via cfe-commits
erik65536 added a comment.

I don't see any other issues. Thanks for fixing this.


http://reviews.llvm.org/D20903



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


Re: [PATCH] D21277: Resubmit r270688: Using new TargetParser in Clang.

2016-06-14 Thread jojo.ma via cfe-commits
jojo added inline comments.


Comment at: lib/Basic/Targets.cpp:5709
@@ -5715,1 +5708,3 @@
+
+return false;
   }

echristo wrote:
> compnerd wrote:
> > Please collapse this:
> > 
> > return Name == "generic" || llvm::AArch64::parseCPUArch(Name) != 
> > llvm::ARM::AK_INVALID;
> ... why doesn't this actually set the cpu?
Agree, this looks better.


Comment at: lib/Basic/Targets.cpp:5709
@@ -5715,1 +5708,3 @@
+
+return false;
   }

jojo wrote:
> echristo wrote:
> > compnerd wrote:
> > > Please collapse this:
> > > 
> > > return Name == "generic" || llvm::AArch64::parseCPUArch(Name) != 
> > > llvm::ARM::AK_INVALID;
> > ... why doesn't this actually set the cpu?
> Agree, this looks better.
Actually,I have no idea also.
I just replaced the original implementation with the using of TargetParser.




Comment at: lib/Driver/Tools.cpp:2303
@@ +2302,3 @@
+const char *FeatureName = llvm::AArch64::getArchExtFeature(Feature);
+if (FeatureName)
+  Features.push_back(FeatureName);

compnerd wrote:
> I think that you should use the scoped if here:
> 
> if (const char *FeatureName = llvm::AArch64::getArchExtFeature(Feature))
>   Features.push_back(FeatureName);
Agree,Looks more accurate and concise.


Comment at: lib/Driver/Tools.cpp:2324
@@ +2323,3 @@
+unsigned ArchKind = llvm::AArch64::parseCPUArch(CPU);
+unsigned Extersion = llvm::AArch64::getDefaultExtensions(CPU,ArchKind);
+

compnerd wrote:
> NIT: Space after the comma.
Thanks.I will correct it.


Repository:
  rL LLVM

http://reviews.llvm.org/D21277



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


Re: [libcxx] r272632 - Ignore depricated warnings from and

2016-06-14 Thread Joerg Sonnenberger via cfe-commits
On Tue, Jun 14, 2016 at 03:26:11AM -, Eric Fiselier via cfe-commits wrote:
> Author: ericwf
> Date: Mon Jun 13 22:26:11 2016
> New Revision: 272632
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=272632&view=rev
> Log:
> Ignore depricated warnings from  and 

Commit message and change don't agree, do they?

Joerg
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21277: Resubmit r270688: Using new TargetParser in Clang.

2016-06-14 Thread jojo.ma via cfe-commits
jojo updated this revision to Diff 60658.
jojo added a comment.
Herald added a subscriber: mehdi_amini.

Update according to inline comments.


Repository:
  rL LLVM

http://reviews.llvm.org/D21277

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2299,24 +2299,8 @@
   text.split(Split, StringRef("+"), -1, false);
 
   for (StringRef Feature : Split) {
-const char *result = llvm::StringSwitch(Feature)
- .Case("fp", "+fp-armv8")
- .Case("simd", "+neon")
- .Case("crc", "+crc")
- .Case("crypto", "+crypto")
- .Case("fp16", "+fullfp16")
- .Case("profile", "+spe")
- .Case("ras", "+ras")
- .Case("nofp", "-fp-armv8")
- .Case("nosimd", "-neon")
- .Case("nocrc", "-crc")
- .Case("nocrypto", "-crypto")
- .Case("nofp16", "-fullfp16")
- .Case("noprofile", "-spe")
- .Case("noras", "-ras")
- .Default(nullptr);
-if (result)
-  Features.push_back(result);
+if (const char *FeatureName = llvm::AArch64::getArchExtFeature(Feature))
+  Features.push_back(FeatureName);
 else if (Feature == "neon" || Feature == "noneon")
   D.Diag(diag::err_drv_no_neon_modifier);
 else
@@ -2331,20 +2315,16 @@
   std::vector &Features) {
   std::pair Split = Mcpu.split("+");
   CPU = Split.first;
-  if (CPU == "cortex-a53" || CPU == "cortex-a57" ||
-  CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" ||
-  CPU == "kryo"   || CPU == "cortex-a73") {
-Features.push_back("+neon");
-Features.push_back("+crc");
-Features.push_back("+crypto");
-  } else if (CPU == "cyclone") {
-Features.push_back("+neon");
-Features.push_back("+crypto");
-  } else if (CPU == "generic") {
+
+  if (CPU == "generic") {
 Features.push_back("+neon");
   } else {
-return false;
-  }
+unsigned ArchKind = llvm::AArch64::parseCPUArch(CPU);
+unsigned Extersion = llvm::AArch64::getDefaultExtensions(CPU, ArchKind);
+
+if (!llvm::AArch64::getExtensionFeatures(Extersion, Features))
+  return false;
+   }
 
   if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))
 return false;
@@ -2356,20 +2336,13 @@
 getAArch64ArchFeaturesFromMarch(const Driver &D, StringRef March,
 const ArgList &Args,
 std::vector &Features) {
+  unsigned ArchKind;
   std::string MarchLowerCase = March.lower();
   std::pair Split = StringRef(MarchLowerCase).split("+");
 
-  if (Split.first == "armv8-a" || Split.first == "armv8a") {
-// ok, no additional features.
-  } else if (Split.first == "armv8.1-a" || Split.first == "armv8.1a") {
-Features.push_back("+v8.1a");
-  } else if (Split.first == "armv8.2-a" || Split.first == "armv8.2a" ) {
-Features.push_back("+v8.2a");
-  } else {
-return false;
-  }
-
-  if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))
+  ArchKind = llvm::AArch64::parseArch(Split.first);
+  if (ArchKind == llvm::ARM::AK_INVALID || !llvm::AArch64::getArchFeatures(ArchKind, Features) ||
+	  (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)))
 return false;
 
   return true;
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -5703,15 +5703,7 @@
   }
 
   bool setCPU(const std::string &Name) override {
-bool CPUKnown = llvm::StringSwitch(Name)
-.Case("generic", true)
-.Cases("cortex-a53", "cortex-a57", "cortex-a72",
-   "cortex-a35", "exynos-m1", true)
-.Case("cortex-a73", true)
-.Case("cyclone", true)
-.Case("kryo", true)
-.Default(false);
-return CPUKnown;
+return Name == "generic" || llvm::AArch64::parseCPUArch(Name) != llvm::ARM::AK_INVALID;
   }
 
   void getTargetDefines(const LangOptions &Opts,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [musl] Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-14 Thread Szabolcs Nagy via cfe-commits
* Rafael Esp?ndola  [2016-06-13 17:00:17 -0400]:
> Do you need someone to commit it for you?
> On Jun 13, 2016 9:50 AM, "Lei Zhang via cfe-commits" <
> > http://git.alpinelinux.org/cgit/aports/plain/main/clang/clang-0004-Add-musl-targets-and-dynamic-linker.patch
> >
> > This looks neat :)

the dynamic linker names need to be updated (ppc64*, mips64*
mips*-sf are missing) and it defaults to x86_64 which can
be bad.

there is some musl setting already for mips in the driver
which should probably be fixed.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r272632 - Ignore depricated warnings from and

2016-06-14 Thread Eric Fiselier via cfe-commits
The depreciation warnings are emitted from  and
 using "#warning". The actual types are not  marked
deprecated using attributes.
That's why the tests suppress "-W#warning". I'm trying to get our test
suite passing with -Wsystem-headers -Werror so this is a necessary evil.

Hope that clears things up.

/Eric

On Tue, Jun 14, 2016 at 2:36 AM, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Tue, Jun 14, 2016 at 03:26:11AM -, Eric Fiselier via cfe-commits
> wrote:
> > Author: ericwf
> > Date: Mon Jun 13 22:26:11 2016
> > New Revision: 272632
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=272632&view=rev
> > Log:
> > Ignore depricated warnings from  and 
>
> Commit message and change don't agree, do they?
>
> Joerg
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272645 - [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases.

2016-06-14 Thread Daniel Sanders via cfe-commits
Author: dsanders
Date: Tue Jun 14 03:58:50 2016
New Revision: 272645

URL: http://llvm.org/viewvc/llvm-project?rev=272645&view=rev
Log:
[mips] Defer validity check for CPU/ABI pairs and improve error message for 
invalid cases.

Summary:
The validity of ABI/CPU pairs is no longer checked on the fly but is
instead checked after initialization. As a result, invalid CPU/ABI pairs
can be reported as being known but invalid instead of being unknown. For
example, we now emit:
  error: ABI 'n32' is not supported on CPU 'mips32r2'
instead of:
  error: unknown target ABI 'n64'

Reviewers: atanasyan

Subscribers: sdardis, cfe-commits

Differential Revision: http://reviews.llvm.org/D21023

Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/mips-abi.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=272645&r1=272644&r2=272645&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Tue Jun 14 03:58:50 
2016
@@ -180,6 +180,9 @@ def err_target_unknown_triple : Error<
   "unknown target triple '%0', please use -triple or -arch">;
 def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
 def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
+def err_target_unsupported_abi : Error<"ABI '%0' is not supported on CPU 
'%1'">;
+def err_target_unsupported_abi_for_triple : Error<
+  "ABI '%0' is not supported for '%1'">;
 def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">;
 def err_target_unsupported_fpmath : Error<
 "the '%0' unit is not supported with this instruction set">;

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=272645&r1=272644&r2=272645&view=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Jun 14 03:58:50 2016
@@ -982,6 +982,11 @@ public:
   return getTargetOpts().SupportedOpenCLOptions;
   }
 
+  /// \brief Check the target is valid after it is fully initialized.
+  virtual bool validateTarget(DiagnosticsEngine &Diags) const {
+return true;
+  }
+
 protected:
   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
 return PointerWidth;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=272645&r1=272644&r2=272645&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Jun 14 03:58:50 2016
@@ -7112,34 +7112,38 @@ public:
 return IsNan2008;
   }
 
+  bool processorSupportsGPR64() const {
+return llvm::StringSwitch(CPU)
+.Case("mips3", true)
+.Case("mips4", true)
+.Case("mips5", true)
+.Case("mips64", true)
+.Case("mips64r2", true)
+.Case("mips64r3", true)
+.Case("mips64r5", true)
+.Case("mips64r6", true)
+.Case("octeon", true)
+.Default(false);
+return false;
+  }
+
   StringRef getABI() const override { return ABI; }
   bool setABI(const std::string &Name) override {
-// FIXME: The Arch component on the triple actually has no bearing on
-//whether the ABI is valid or not. It's features of the CPU that
-//matters and the size of the GPR's in particular.
-//However, we can't allow O32 on 64-bit processors just yet because
-//the backend still checks the Arch component instead of the ABI in
-//a few places.
-if (getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32") {
-setO32ABITypes();
-ABI = Name;
-return true;
-  }
+if (Name == "o32") {
+  setO32ABITypes();
+  ABI = Name;
+  return true;
 }
-if (getTriple().getArch() == llvm::Triple::mips64 ||
-getTriple().getArch() == llvm::Triple::mips64el) {
-  if (Name == "n32") {
-setN32ABITypes();
-ABI = Name;
-return true;
-  }
-  if (Name == "n64") {
-setN64ABITypes();
-ABI = Name;
-return true;
-  }
+
+if (Name == "n32") {
+  setN32ABITypes();
+  ABI = Name;
+  return true;
+}
+if (Name == "n64") {
+  setN64ABITypes();
+  ABI = Name;
+  return true;
 }
 return false;
   }
@@ -7189,26 +7193,25 @@ public:
   }
 
   bool setCPU(const std::string &Name) override {
-bool GPR64Required = ABI == "n32" || ABI ==

Re: [PATCH] D21303: [clang-tidy] Adds performance-returning-type check.

2016-06-14 Thread Marek Sokołowski via cfe-commits
mnbvmar added inline comments.


Comment at: clang-tidy/performance/ReturningTypeCheck.cpp:69
@@ +68,3 @@
+AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher,
+ haveOneActiveArgument) {
+  return anyOf(parameterCountIs(1),

Probably hasOneActiveArgument.


Comment at: clang-tidy/performance/ReturningTypeCheck.cpp:72
@@ +71,3 @@
+   allOf(unless(parameterCountIs(0)),
+ hasParameter(2, hasDefaultArgument(;
+}

In hasParameter(N, ...), argument id is 0-based. Did you mean to match the 
third parameter (1-based)?


Repository:
  rL LLVM

http://reviews.llvm.org/D21303



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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-14 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 60662.
Prazek marked an inline comment as done.
Prazek added a comment.

Runned on LLVM and bug fixed one thing


http://reviews.llvm.org/D20964

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseEmplaceCheck.cpp
  clang-tidy/modernize/UseEmplaceCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-emplace.rst
  test/clang-tidy/modernize-use-emplace.cpp

Index: test/clang-tidy/modernize-use-emplace.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-emplace.cpp
@@ -0,0 +1,287 @@
+// RUN: %check_clang_tidy %s modernize-use-emplace %t
+
+namespace std {
+template 
+class vector {
+public:
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template 
+  void emplace_back(Args &&... args){};
+};
+template 
+class list {
+public:
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template 
+  void emplace_back(Args &&... args){};
+};
+
+template 
+class deque {
+public:
+  void push_back(const T &) {}
+  void push_back(T &&) {}
+
+  template 
+  void emplace_back(Args &&... args){};
+};
+
+template 
+class pair {
+public:
+  pair() = default;
+  pair(const pair &) = default;
+  pair(pair &&) = default;
+
+  pair(const T1 &, const T2 &) {}
+  pair(T1 &&, T2 &&) {}
+
+  template 
+  pair(const pair &p){};
+  template 
+  pair(pair &&p){};
+};
+
+template 
+pair make_pair(T1, T2) {
+  return pair();
+};
+
+template 
+class unique_ptr {
+public:
+  unique_ptr(T *) {}
+};
+} // namespace std
+
+void testInts() {
+  std::vector v;
+  v.push_back(42);
+  v.push_back(int(42));
+  v.push_back(int{42});
+  int z;
+  v.push_back(z);
+}
+
+struct S {
+  S(int a, int b = 41) {}
+  S() {}
+  void push_back(S);
+};
+
+struct Convertable {
+  operator S() { return S{}; }
+};
+
+struct Zoz {
+  Zoz(S s) {}
+};
+
+Zoz getZoz(S s) { return Zoz(s); }
+
+void test_S() {
+  std::vector v;
+
+  v.push_back(S(1, 2));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back instead of push_back [modernize-use-emplace]
+  // CHECK-FIXES: v.emplace_back(1, 2);
+
+  v.push_back(S{1, 2});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, 2);
+
+  v.push_back(S());
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back();
+
+  v.push_back(S{});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back();
+
+  v.push_back(42);
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(42);
+
+  S temporary(42, 42);
+  temporary.push_back(temporary);
+  v.push_back(temporary);
+
+  v.push_back(Convertable());
+  v.push_back(Convertable{});
+  Convertable s;
+  v.push_back(s);
+}
+
+void test2() {
+  std::vector v;
+  v.push_back(Zoz(S(21, 37)));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(S(21, 37));
+
+  v.push_back(getZoz(S(1, 2)));
+}
+
+void testPair() {
+  std::vector> v;
+  v.push_back(std::pair(1, 2));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, 2);
+
+  std::vector> v2;
+  v2.push_back(std::pair(S(42, 42), Zoz(S(21, 37;
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v2.emplace_back(S(42, 42), Zoz(S(21, 37)));
+}
+
+void testSpaces() {
+  std::vector v;
+
+  // clang-format off
+
+  v.push_back(S(1, //arg1
+2 // arg2
+   ) // S
+  );
+  // CHECK-MESSAGES: :[[@LINE-4]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, //arg1
+  // CHECK-FIXES:2 // arg2
+  // CHECK-FIXES:  // S
+  // CHECK-FIXES:);
+
+  v.push_back(S   (1, 2));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, 2   );
+  v.push_back(S   {1, 2});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, 2   );
+
+  v.push_back(  S {});
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(   );
+
+  // clang-format on
+}
+
+void testPointers() {
+  std::vector v;
+  v.push_back(new int(5));
+
+  std::vector> v2;
+  v2.push_back(new int(42));
+  // This call can't be replaced with emplace_back.
+  // If emplacement will fail (not enough memory to add to vector)
+  // we will have leak of int because unique_ptr won't be constructed
+  // (and destructed) as in push_back case.
+
+  auto *ptr = new int;
+  v2.push_back(ptr);
+  // Same here
+}
+
+void testMakePair() {
+  std::vector> v;
+  // FIXME: add functionality to change calls of std::make_pair
+  v.push_back(std::make_

r272653 - Reverting "Warn when taking address of a packed member"

2016-06-14 Thread Roger Ferrer Ibanez via cfe-commits
Author: rogfer01
Date: Tue Jun 14 06:20:07 2016
New Revision: 272653

URL: http://llvm.org/viewvc/llvm-project?rev=272653&view=rev
Log:
Reverting "Warn when taking address of a packed member"

This new diagnostic is causing some false positives that have to be addressed.

This reverts commit 272552



Removed:
cfe/trunk/test/Sema/address-packed.c
cfe/trunk/test/SemaCXX/address-packed.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=272653&r1=272652&r2=272653&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 14 06:20:07 
2016
@@ -5388,9 +5388,6 @@ def warn_pointer_indirection_from_incomp
   "dereference of type %1 that was reinterpret_cast from type %0 has undefined 
"
   "behavior">,
   InGroup, DefaultIgnore;
-def warn_taking_address_of_packed_member : Warning<
-  "taking address of packed member %0 of class or structure %q1 may result in 
an unaligned pointer value">,
-  InGroup>;
 
 def err_objc_object_assignment : Error<
   "cannot assign to class object (%0 invalid)">;

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=272653&r1=272652&r2=272653&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Jun 14 06:20:07 2016
@@ -10521,30 +10521,6 @@ QualType Sema::CheckAddressOfOperand(Exp
 return QualType();
   }
 
-  // Taking the address of a data member/field of a packed
-  // struct may be a problem if the pointer value is dereferenced.
-  Expr *rhs = OrigOp.get();
-  const auto *ME = dyn_cast(rhs);
-  while (ME && isa(ME->getMemberDecl())) {
-QualType BaseType = ME->getBase()->getType();
-if (ME->isArrow())
-  BaseType = BaseType->getPointeeType();
-RecordDecl *RD = BaseType->getAs()->getDecl();
-
-ValueDecl *MD = ME->getMemberDecl();
-bool ByteAligned = Context.getTypeAlignInChars(MD->getType()).isOne();
-if (ByteAligned) // Attribute packed does not have any effect.
-  break;
-
-if (!ByteAligned &&
-(RD->hasAttr() || (MD->hasAttr( {
-  Diag(OpLoc, diag::warn_taking_address_of_packed_member)
-  << MD << RD << rhs->getSourceRange();
-  break;
-}
-ME = dyn_cast(ME->getBase());
-  }
-
   return Context.getPointerType(op->getType());
 }
 

Removed: cfe/trunk/test/Sema/address-packed.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/address-packed.c?rev=272652&view=auto
==
--- cfe/trunk/test/Sema/address-packed.c (original)
+++ cfe/trunk/test/Sema/address-packed.c (removed)
@@ -1,126 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-extern void f1(int *);
-extern void f2(char *);
-
-struct Ok {
-  char c;
-  int x;
-};
-
-struct __attribute__((packed)) Arguable {
-  char c0;
-  int x;
-  char c1;
-};
-
-union __attribute__((packed)) UnionArguable {
-  char c;
-  int x;
-};
-
-typedef struct Arguable ArguableT;
-
-struct Arguable *get_arguable();
-
-void g0(void) {
-  {
-struct Ok ok;
-f1(&ok.x); // no-warning
-f2(&ok.c); // no-warning
-  }
-  {
-struct Arguable arguable;
-f2(&arguable.c0); // no-warning
-f1(&arguable.x);  // expected-warning {{packed member 'x' of class or 
structure 'Arguable'}}
-f2(&arguable.c1); // no-warning
-  }
-  {
-union UnionArguable arguable;
-f2(&arguable.c); // no-warning
-f1(&arguable.x); // expected-warning {{packed member 'x' of class or 
structure 'UnionArguable'}}
-  }
-  {
-ArguableT arguable;
-f2(&arguable.c0); // no-warning
-f1(&arguable.x);  // expected-warning {{packed member 'x' of class or 
structure 'Arguable'}}
-f2(&arguable.c1); // no-warning
-  }
-  {
-struct Arguable *arguable = get_arguable();
-// These do not produce any warning because of the parentheses.
-f2(&(arguable->c0)); // no-warning
-f1(&(arguable->x));  // no-warning
-f2(&(arguable->c1)); // no-warning
-  }
-  {
-ArguableT *arguable = get_arguable();
-// These do not produce any warning because of the parentheses.
-f2(&(arguable->c0)); // no-warning
-f1(&(arguable->x));  // no-warning
-f2(&(arguable->c1)); // no-warning
-  }
-}
-
-struct S1 {
-  char c;
-  int i __attribute__((packed));
-};
-
-int *g1(struct S1 *s1) {
-  return &s1->i; // expected-warning {{packed member 'i' of class or structure 
'S1'}}
-}
-
-struct S2_i {
-  int i;
-};
-struct __attribute__((packed)) S2 {
-  char c;
-  struct S2_i inner;
-};
-
-int *g2(struct S2 *s2) {
-  return &s2->inn

Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-14 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 reopened this revision.
rogfer01 added a comment.
This revision is now accepted and ready to land.

I've reverted the commit.

During implementation of the white list I felt the changes were too much for a 
follow up commit, so I prefer some feedback first.


Repository:
  rL LLVM

http://reviews.llvm.org/D20561



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


[PATCH] D21322: [Clang][avx512][Intrinsics] adding prefetch gather intrinsics

2016-06-14 Thread michael zuckerman via cfe-commits
m_zuckerman created this revision.
m_zuckerman added reviewers: AsafBadouh, igorb, delena.
m_zuckerman added a subscriber: cfe-commits.

_mm512_prefetch_i64gather_ps
_mm512_prefetch_i32gather_pd
_mm512_prefetch_i64gather_pd
_mm512_prefetch_i32gather_ps

http://reviews.llvm.org/D21322

Files:
  lib/Headers/avx512pfintrin.h
  test/CodeGen/avx512pf-builtins.c

Index: lib/Headers/avx512pfintrin.h
===
--- lib/Headers/avx512pfintrin.h
+++ lib/Headers/avx512pfintrin.h
@@ -35,21 +35,40 @@
   __builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
  (long long const *)(addr), (int)(scale), \
  (int)(hint)); })
+
+#define _mm512_prefetch_i32gather_pd(index, addr, scale, hint) __extension__ 
({\
+  __builtin_ia32_gatherpfdpd((__mmask8) -1, (__v8si)(__m256i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
 
 #define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) ({\
   __builtin_ia32_gatherpfdps((__mmask16)(mask), \
  (__v16si)(__m512i)(index), (int const *)(addr), \
  (int)(scale), (int)(hint)); })
 
+#define _mm512_prefetch_i32gather_ps(index, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfdps((__mmask16) -1, \
+ (__v16si)(__m512i)(index), (int const *)(addr), \
+ (int)(scale), (int)(hint)); })
+
 #define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) 
__extension__ ({\
   __builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
  (long long const *)(addr), (int)(scale), \
  (int)(hint)); })
 
+#define _mm512_prefetch_i64gather_pd(index, addr, scale, hint) __extension__ 
({\
+  __builtin_ia32_gatherpfqpd((__mmask8) -1, (__v8di)(__m512i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
+
 #define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) ({\
   __builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
  (int const *)(addr), (int)(scale), (int)(hint)); 
})
 
+#define _mm512_prefetch_i64gather_ps(index, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfqps((__mmask8) -1, (__v8di)(__m512i)(index), \
+ (int const *)(addr), (int)(scale), (int)(hint)); 
})
+
 #define _mm512_prefetch_i32scatter_pd(addr, index, scale, hint) __extension__ 
({\
   __builtin_ia32_scatterpfdpd((__mmask8)-1, (__v8si)(__m256i)(index), \
   (long long *)(addr), (int)(scale), \
Index: test/CodeGen/avx512pf-builtins.c
===
--- test/CodeGen/avx512pf-builtins.c
+++ test/CodeGen/avx512pf-builtins.c
@@ -11,24 +11,48 @@
   return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i32gather_pd
+  // CHECK: @llvm.x86.avx512.gatherpf.dpd
+  return _mm512_prefetch_i32gather_pd(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.dps
   return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i32gather_ps(__m512i index,  void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i32gather_ps
+  // CHECK: @llvm.x86.avx512.gatherpf.dps
+  return _mm512_prefetch_i32gather_ps(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.qpd
   return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i64gather_pd
+  // CHECK: @llvm.x86.avx512.gatherpf.qpd
+  return _mm512_prefetch_i64gather_pd(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.qps
   return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i64gather_ps(__m512i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i64gather_ps
+  // CHECK: @llvm.x86.avx512.gatherpf.qps
+  return _mm512_prefet

r272654 - clang-format: [JS] Support annotated classes.

2016-06-14 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Jun 14 06:28:02 2016
New Revision: 272654

URL: http://llvm.org/viewvc/llvm-project?rev=272654&view=rev
Log:
clang-format: [JS] Support annotated classes.

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=272654&r1=272653&r2=272654&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Jun 14 06:28:02 2016
@@ -1461,7 +1461,8 @@ private:
 return Current->getPrecedence();
   if (Current->isOneOf(tok::period, tok::arrow))
 return PrecedenceArrowAndPeriod;
-  if (Style.Language == FormatStyle::LK_Java &&
+  if ((Style.Language == FormatStyle::LK_Java ||
+   Style.Language == FormatStyle::LK_JavaScript) &&
   Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements,
Keywords.kw_throws))
 return 0;

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=272654&r1=272653&r2=272654&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Jun 14 06:28:02 2016
@@ -948,6 +948,11 @@ TEST_F(FormatTestJS, ClassDeclarations)
"},\n"
"  };\n"
"}");
+  verifyFormat("@Component({\n"
+   "  moduleId: module.id,\n"
+   "})\n"
+   "class SessionListComponent implements OnDestroy, OnInit {\n"
+   "}");
 }
 
 TEST_F(FormatTestJS, InterfaceDeclarations) {


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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-14 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 removed rL LLVM as the repository for this revision.
rogfer01 updated this revision to Diff 60664.
rogfer01 added a comment.

This new patch adds a whitelist for memcpy, memmove, memset and memcmp.

I'm not entirely happy with the strategy that I'm using, where Parser 
communicates to Sema which is the LHS of a direct function call being parsed. 
Better approaches are of course welcome.


http://reviews.llvm.org/D20561

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Parse/ParseExpr.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaExpr.cpp
  test/Sema/address-packed-member-whitelist.c
  test/Sema/address-packed.c
  test/SemaCXX/address-packed-member-whitelist.cpp
  test/SemaCXX/address-packed.cpp

Index: test/SemaCXX/address-packed.cpp
===
--- /dev/null
+++ test/SemaCXX/address-packed.cpp
@@ -0,0 +1,100 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+extern void f1(int *);
+extern void f2(char *);
+
+struct __attribute__((packed)) Arguable {
+  int x;
+  char c;
+  static void foo();
+};
+
+extern void f3(void());
+
+namespace Foo {
+struct __attribute__((packed)) Arguable {
+  char c;
+  int x;
+  static void foo();
+};
+}
+
+struct Arguable *get_arguable();
+
+void g0() {
+  {
+Foo::Arguable arguable;
+f1(&arguable.x);   // expected-warning {{packed member 'x' of class or structure 'Foo::Arguable'}}
+f2(&arguable.c);   // no-warning
+f3(&arguable.foo); // no-warning
+  }
+  {
+Arguable arguable1;
+Arguable &arguable(arguable1);
+f1(&arguable.x);   // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2(&arguable.c);   // no-warning
+f3(&arguable.foo); // no-warning
+  }
+  {
+Arguable *arguable1;
+Arguable *&arguable(arguable1);
+f1(&arguable->x);   // expected-warning {{packed member 'x' of class or structure 'Arguable'}}
+f2(&arguable->c);   // no-warning
+f3(&arguable->foo); // no-warning
+  }
+}
+
+struct __attribute__((packed)) A {
+  int x;
+  char c;
+
+  int *f0() {
+return &this->x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  int *g0() {
+return &x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  char *h0() {
+return &c; // no-warning
+  }
+};
+
+struct B : A {
+  int *f1() {
+return &this->x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  int *g1() {
+return &x; // expected-warning {{packed member 'x' of class or structure 'A'}}
+  }
+
+  char *h1() {
+return &c; // no-warning
+  }
+};
+
+template 
+class __attribute__((packed)) S {
+  Ty X;
+
+public:
+  const Ty *get() const {
+return &X; // expected-warning {{packed member 'X' of class or structure 'S'}}
+   // expected-warning@-1 {{packed member 'X' of class or structure 'S'}}
+  }
+};
+
+template 
+void h(Ty *);
+
+void g1() {
+  S s1;
+  s1.get(); // expected-note {{in instantiation of member function 'S::get'}}
+
+  S s2;
+  s2.get();
+
+  S s3;
+  s3.get(); // expected-note {{in instantiation of member function 'S::get'}}
+}
Index: test/SemaCXX/address-packed-member-whitelist.cpp
===
--- /dev/null
+++ test/SemaCXX/address-packed-member-whitelist.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct B {
+  int x, y, z, w;
+} b;
+
+struct __attribute__((packed)) A {
+  struct B b;
+} a;
+
+typedef __typeof__(sizeof(int)) size_t;
+
+extern "C" {
+void *memcpy(void *dest, const void *src, size_t n);
+int memcmp(const void *s1, const void *s2, size_t n);
+void *memmove(void *dest, const void *src, size_t n);
+void *memset(void *s, int c, size_t n);
+}
+
+void *my_memcpy(void *dest, const void *src, size_t n);
+int my_memcmp(const void *s1, const void *s2, size_t n);
+void *my_memmove(void *dest, const void *src, size_t n);
+void *my_memset(void *s, int c, size_t n);
+
+int x;
+
+void foo() {
+  memcpy(&a.b, &b, sizeof(b)); // no-warning
+  memmove(&a.b, &b, sizeof(b));// no-warning
+  memset(&a.b, 0, sizeof(b));  // no-warning
+  x = memcmp(&a.b, &b, sizeof(b)); // no-warning
+
+  (memcpy)(&a.b, &b, sizeof(b)); // no-warning
+  (memmove)(&a.b, &b, sizeof(b));// no-warning
+  (memset)(&a.b, 0, sizeof(b));  // no-warning
+  x = (memcmp)(&a.b, &b, sizeof(b)); // no-warning
+
+  ::memcpy(&a.b, &b, sizeof(b)); // no-warning
+  ::memmove(&a.b, &b, sizeof(b));// no-warning
+  ::memset(&a.b, 0, sizeof(b));  // no-warning
+  x = ::memcmp(&a.b, &b, sizeof(b)); // no-warning
+
+  (::memcpy)(&a.b, &b, sizeof(b)); // no-warning
+  (::memmove)(&a.b, &b, sizeof(b));// no-warning
+  (::memset)(&a.b, 0, sizeof(b));  // no-warning
+  x = (::memcmp)(&a.b, &b, sizeof(b)); // no-warning
+
+  my_memcpy(&a.b, &b, sizeof(b)); // expected-warning {{packed member 'b' of class or structure 'A'}}
+  my_memmove(&a.b,

Re: [PATCH] D21322: [Clang][avx512][Intrinsics] adding prefetch gather intrinsics

2016-06-14 Thread Igor Breger via cfe-commits
igorb accepted this revision.
igorb added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D21322



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


r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Jun 14 07:04:26 2016
New Revision: 272656

URL: http://llvm.org/viewvc/llvm-project?rev=272656&view=rev
Log:
Add loop pragma for Loop Distribution

Summary:
This is similar to other loop pragmas like 'vectorize'.  Currently it
only has state values: distribute(enable) and distribute(disable).  When
one of these is specified the corresponding loop metadata is generated:

  !{!"llvm.loop.distribute.enable", i1 true/false}

As a result, loop distribution will be attempted on the loop even if
Loop Distribution in not enabled globally.  Analogously, with 'disable'
distribution can be turned off for an individual loop even when the pass
is otherwise enabled.

There are some slight differences compared to the existing loop pragmas.

1. There is no 'assume_safety' variant which makes its handling slightly
different from 'vectorize'/'interleave'.

2. Unlike the existing loop pragmas, it does not have a corresponding
numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
consistency checks in CheckForIncompatibleAttributes we don't need to
check it against other pragmas.  We just need to check for duplicates of
the same pragma.

Reviewers: rsmith, dexonsmith, aaron.ballman

Subscribers: bob.wilson, cfe-commits, hfinkel

Differential Revision: http://reviews.llvm.org/D19403

Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
cfe/trunk/lib/CodeGen/CGLoopInfo.h
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/SemaStmtAttr.cpp
cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
cfe/trunk/test/Misc/ast-print-pragmas.cpp
cfe/trunk/test/PCH/pragma-loop.cpp
cfe/trunk/test/Parser/pragma-loop-safety.cpp
cfe/trunk/test/Parser/pragma-loop.cpp

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656&r1=272655&r2=272656&view=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
@@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
 
 The ``#pragma clang loop`` directive is used to specify hints for optimizing 
the
 subsequent for, while, do-while, or c++11 range-based for loop. The directive
-provides options for vectorization, interleaving, and unrolling. Loop hints can
-be specified before any loop and will be ignored if the optimization is not 
safe
-to apply.
+provides options for vectorization, interleaving, unrolling and
+distribution. Loop hints can be specified before any loop and will be ignored 
if
+the optimization is not safe to apply.
 
 Vectorization and Interleaving
 --
@@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
 
 Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
 
+Loop Distribution
+-
+
+Loop Distribution allows splitting a loop into multiple loops.  This is
+beneficial for example when the entire loop cannot be vectorized but some of 
the
+resulting loops can.
+
+If ``distribute(enable))'' is specified and the loop has memory dependencies
+that inhibit vectorization, the compiler will attempt to isolate the offending
+operations into a new loop.  This optimization is not enabled by default, only
+loops marked with the pragma are considered.
+
+.. code-block:: c++
+
+  #pragma clang loop distribute(enable)
+  for (i = 0; i < N; ++i) {
+S1: A[i + 1] = A[i] + B[i];
+S2: C[i] = D[i] * E[i];
+  }
+
+This loop will be split into two loops between statements S1 and S2.  The
+second loop containing S2 will be vectorized.
+
+Loop Distribution is currently not enabled by default in the optimizer because
+it can hurt performance in some cases.  For example, instruction-level
+parallelism could be reduced by sequentializing the execution of the
+statements S1 and S2 above.
+
+If Loop Distribution is turned on globally with
+``-mllvm -enable-loop-distribution``, specifying ``distribute(disable)`` can
+be used the disable it on a per-loop basis.
+
 Additional Information
 --
 

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=272656&r1=272655&r2=272656&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Jun 14 07:04:26 2016
@@ -2186,6 +2186,7 @@ def LoopHint : Attr {
   /// interleave_count: interleaves 'Value' loop interations.
   /// unroll: fully unroll loop if State == Enable.
   /// unroll_count: unrolls loop 'Value' times.
+  /// distribute: attempt to distribute loop if State == Enable
 
   /// #pragma unroll  directive
   /// : fully unrolls loop.
@@ -

Re: [PATCH] D19403: Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272656: Add loop pragma for Loop Distribution (authored by 
anemet).

Changed prior to commit:
  http://reviews.llvm.org/D19403?vs=55445&id=60665#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19403

Files:
  cfe/trunk/docs/LanguageExtensions.rst
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
  cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
  cfe/trunk/lib/CodeGen/CGLoopInfo.h
  cfe/trunk/lib/Parse/ParsePragma.cpp
  cfe/trunk/lib/Sema/SemaStmtAttr.cpp
  cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
  cfe/trunk/test/Misc/ast-print-pragmas.cpp
  cfe/trunk/test/PCH/pragma-loop.cpp
  cfe/trunk/test/Parser/pragma-loop-safety.cpp
  cfe/trunk/test/Parser/pragma-loop.cpp

Index: cfe/trunk/docs/LanguageExtensions.rst
===
--- cfe/trunk/docs/LanguageExtensions.rst
+++ cfe/trunk/docs/LanguageExtensions.rst
@@ -2050,9 +2050,9 @@
 
 The ``#pragma clang loop`` directive is used to specify hints for optimizing the
 subsequent for, while, do-while, or c++11 range-based for loop. The directive
-provides options for vectorization, interleaving, and unrolling. Loop hints can
-be specified before any loop and will be ignored if the optimization is not safe
-to apply.
+provides options for vectorization, interleaving, unrolling and
+distribution. Loop hints can be specified before any loop and will be ignored if
+the optimization is not safe to apply.
 
 Vectorization and Interleaving
 --
@@ -2147,6 +2147,38 @@
 
 Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
 
+Loop Distribution
+-
+
+Loop Distribution allows splitting a loop into multiple loops.  This is
+beneficial for example when the entire loop cannot be vectorized but some of the
+resulting loops can.
+
+If ``distribute(enable))'' is specified and the loop has memory dependencies
+that inhibit vectorization, the compiler will attempt to isolate the offending
+operations into a new loop.  This optimization is not enabled by default, only
+loops marked with the pragma are considered.
+
+.. code-block:: c++
+
+  #pragma clang loop distribute(enable)
+  for (i = 0; i < N; ++i) {
+S1: A[i + 1] = A[i] + B[i];
+S2: C[i] = D[i] * E[i];
+  }
+
+This loop will be split into two loops between statements S1 and S2.  The
+second loop containing S2 will be vectorized.
+
+Loop Distribution is currently not enabled by default in the optimizer because
+it can hurt performance in some cases.  For example, instruction-level
+parallelism could be reduced by sequentializing the execution of the
+statements S1 and S2 above.
+
+If Loop Distribution is turned on globally with
+``-mllvm -enable-loop-distribution``, specifying ``distribute(disable)`` can
+be used the disable it on a per-loop basis.
+
 Additional Information
 --
 
Index: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
@@ -977,12 +977,12 @@
 // Pragma loop support.
 def err_pragma_loop_missing_argument : Error<
   "missing argument; expected %select{an integer value|"
-  "'enable', %select{'assume_safety'|'full'}1 or 'disable'}0">;
+  "'enable'%select{|, 'full'}1%select{|, 'assume_safety'}2 or 'disable'}0">;
 def err_pragma_loop_invalid_option : Error<
   "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
-  "vectorize_width, interleave, interleave_count, unroll, or unroll_count">;
+  "vectorize_width, interleave, interleave_count, unroll, unroll_count, or distribute">;
 def err_pragma_invalid_keyword : Error<
-  "invalid argument; expected 'enable', %select{'assume_safety'|'full'}0 or 'disable'">;
+  "invalid argument; expected 'enable'%select{|, 'full'}0%select{|, 'assume_safety'}1 or 'disable'">;
 
 // Pragma unroll support.
 def warn_pragma_unroll_cuda_value_in_parens : Warning<
Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -2186,6 +2186,7 @@
   /// interleave_count: interleaves 'Value' loop interations.
   /// unroll: fully unroll loop if State == Enable.
   /// unroll_count: unrolls loop 'Value' times.
+  /// distribute: attempt to distribute loop if State == Enable
 
   /// #pragma unroll  directive
   /// : fully unrolls loop.
@@ -2198,9 +2199,9 @@
   /// State of the loop optimization specified by the spelling.
   let Args = [EnumArgument<"Option", "OptionType",
   ["vectorize", "vectorize_width", "interleave", "interleave_count",
-   "unroll", "unroll_count"],
+   "unroll", "unroll_count", "distribute"],

[clang-tools-extra] r272657 - [include-fixer] remove redundant code.

2016-06-14 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue Jun 14 07:14:36 2016
New Revision: 272657

URL: http://llvm.org/viewvc/llvm-project?rev=272657&view=rev
Log:
[include-fixer] remove redundant code.

Modified:
clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp

Modified: clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp?rev=272657&r1=272656&r2=272657&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp Tue Jun 14 
07:14:36 2016
@@ -211,9 +211,8 @@ int includeFixerMain(int argc, const cha
 tooling::Replacements Replacements =
 clang::include_fixer::createInsertHeaderReplacements(
 Code->getBuffer(), FilePath, Context.Headers[0], InsertStyle);
-tooling::Replacements Replaces(Replacements.begin(), Replacements.end());
 std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replaces);
+tooling::applyAllReplacements(Code->getBuffer(), Replacements);
 llvm::outs() << ChangedCode;
 return 0;
   }


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


Re: [PATCH] D21295: Add a negative TBAA test

2016-06-14 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 updated this revision to Diff 60667.
rogfer01 added a comment.

Much simpler version thanks to @jmolloy comment.


http://reviews.llvm.org/D21295

Files:
  test/CodeGen/tbaa.cpp

Index: test/CodeGen/tbaa.cpp
===
--- test/CodeGen/tbaa.cpp
+++ test/CodeGen/tbaa.cpp
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -no-struct-path-tbaa 
-disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns %s 
-emit-llvm -o - | FileCheck %s -check-prefix=PATH
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O0 -disable-llvm-optzns %s 
-emit-llvm -o - | FileCheck %s -check-prefix=NO-TBAA
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -relaxed-aliasing 
-disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=NO-TBAA
 // Test TBAA metadata generated by front-end.
+//
+// NO-TBAA-NOT: !tbaa
 
 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;


Index: test/CodeGen/tbaa.cpp
===
--- test/CodeGen/tbaa.cpp
+++ test/CodeGen/tbaa.cpp
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -no-struct-path-tbaa -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O0 -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=NO-TBAA
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -relaxed-aliasing -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=NO-TBAA
 // Test TBAA metadata generated by front-end.
+//
+// NO-TBAA-NOT: !tbaa
 
 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps

2016-06-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272658: [Clang][AVX512][intrinsics] Adding missing 
intrinsics div_pd and div_ps (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D20626?vs=59663&id=60668#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20626

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c

Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -1972,10 +1972,15 @@
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
   return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
-__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d 
__B) {
-  // CHECK-LABEL: @test_mm512_mask_div_pd
+__m512d test_mm512_div_pd(__m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_div_pd
+  // CHECK: fdiv <8 x double>
+  return _mm512_div_pd(__a,__b); 
+}
+__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d 
__b) {
+  // CHECK-LABLE: @test_mm512_mask_div_pd
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
-  return _mm512_mask_div_pd(__W,__U,__A,__B); 
+  return _mm512_mask_div_pd(__w,__u,__a,__b); 
 }
 __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_maskz_div_pd
@@ -1997,6 +2002,11 @@
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
   return _mm512_maskz_div_round_ps(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
+__m512 test_mm512_div_ps(__m512 __A, __m512 __B) {
+  // CHECK-LABEL: @test_mm512_div_ps
+  // CHECK: fdiv <16 x float>
+  return _mm512_div_ps(__A,__B); 
+}
 __m512 test_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 
__B) {
   // CHECK-LABEL: @test_mm512_mask_div_ps
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -2446,6 +2446,12 @@
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U), (int)(R)); })
 
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_div_pd(__m512d __a, __m512d __b)
+{
+  return (__m512d)((__v8df)__a/(__v8df)__b);
+}
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
   return (__m512d) __builtin_ia32_divpd512_mask ((__v8df) __A,
@@ -2465,6 +2471,12 @@
  _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_div_ps(__m512 __a, __m512 __b)
+{
+  return (__m512)((__v16sf)__a/(__v16sf)__b);
+}
+
 static __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
   return (__m512) __builtin_ia32_divps512_mask ((__v16sf) __A,


Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -1972,10 +1972,15 @@
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
   return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
-__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
-  // CHECK-LABEL: @test_mm512_mask_div_pd
+__m512d test_mm512_div_pd(__m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_div_pd
+  // CHECK: fdiv <8 x double>
+  return _mm512_div_pd(__a,__b); 
+}
+__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_mask_div_pd
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
-  return _mm512_mask_div_pd(__W,__U,__A,__B); 
+  return _mm512_mask_div_pd(__w,__u,__a,__b); 
 }
 __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_maskz_div_pd
@@ -1997,6 +2002,11 @@
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
   return _mm512_maskz_div_round_ps(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
+__m512 test_mm512_div_ps(__m512 __A, __m512 __B) {
+  // CHECK-LABEL: @test_mm512_div_ps
+  // CHECK: fdiv <16 x float>
+  return _mm512_div_ps(__A,__B); 
+}
 __m512 test_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_mask_div_ps
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -2446,6 +2446,12 @@
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U), (int)(R)); })
 
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_div_pd(__m512d __

r272658 - [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps

2016-06-14 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Jun 14 07:38:58 2016
New Revision: 272658

URL: http://llvm.org/viewvc/llvm-project?rev=272658&view=rev
Log:
[Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps

Differential Revision: http://reviews.llvm.org/D20626

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=272658&r1=272657&r2=272658&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Jun 14 07:38:58 2016
@@ -2446,6 +2446,12 @@ _mm_maskz_div_sd(__mmask8 __U,__m128d __
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U), (int)(R)); })
 
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_div_pd(__m512d __a, __m512d __b)
+{
+  return (__m512d)((__v8df)__a/(__v8df)__b);
+}
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
   return (__m512d) __builtin_ia32_divpd512_mask ((__v8df) __A,
@@ -2465,6 +2471,12 @@ _mm512_maskz_div_pd(__mmask8 __U, __m512
  _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_div_ps(__m512 __a, __m512 __b)
+{
+  return (__m512)((__v16sf)__a/(__v16sf)__b);
+}
+
 static __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
   return (__m512) __builtin_ia32_divps512_mask ((__v16sf) __A,

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=272658&r1=272657&r2=272658&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Tue Jun 14 07:38:58 2016
@@ -1972,10 +1972,15 @@ __m512d test_mm512_maskz_div_round_pd(__
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
   return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
-__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d 
__B) {
-  // CHECK-LABEL: @test_mm512_mask_div_pd
+__m512d test_mm512_div_pd(__m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_div_pd
+  // CHECK: fdiv <8 x double>
+  return _mm512_div_pd(__a,__b); 
+}
+__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d 
__b) {
+  // CHECK-LABLE: @test_mm512_mask_div_pd
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
-  return _mm512_mask_div_pd(__W,__U,__A,__B); 
+  return _mm512_mask_div_pd(__w,__u,__a,__b); 
 }
 __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_maskz_div_pd
@@ -1997,6 +2002,11 @@ __m512 test_mm512_maskz_div_round_ps(__m
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
   return _mm512_maskz_div_round_ps(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
+__m512 test_mm512_div_ps(__m512 __A, __m512 __B) {
+  // CHECK-LABEL: @test_mm512_div_ps
+  // CHECK: fdiv <16 x float>
+  return _mm512_div_ps(__A,__B); 
+}
 __m512 test_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 
__B) {
   // CHECK-LABEL: @test_mm512_mask_div_ps
   // CHECK: @llvm.x86.avx512.mask.div.ps.512


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


[PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added a reviewer: djasper.
ioeric added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

do not add existing includes.

http://reviews.llvm.org/D21323

Files:
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp

Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -688,6 +688,14 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. 
#includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -688,6 +688,14 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. #includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272662 - Start adding support for Musl.

2016-06-14 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Tue Jun 14 07:47:24 2016
New Revision: 272662

URL: http://llvm.org/viewvc/llvm-project?rev=272662&view=rev
Log:
Start adding support for Musl.

The two patches together enable clang to support targets like
"x86_64-pc-linux-musl" and build binaries against musl-libc instead of
glibc. This make it easy for clang to work on some musl-based systems
like Alpine Linux and certain flavors of Gentoo.

Patch by Lei Zhang.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=272662&r1=272661&r2=272662&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Jun 14 07:47:24 2016
@@ -4152,6 +4152,8 @@ std::string Linux::getDynamicLinker(cons
 
   if (Triple.isAndroid())
 return Triple.isArch64Bit() ? "/system/bin/linker64" : 
"/system/bin/linker";
+  else if (Triple.getEnvironment() == llvm::Triple::Musl)
+return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";
 
   std::string LibDir;
   std::string Loader;

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=272662&r1=272661&r2=272662&view=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Tue Jun 14 07:47:24 2016
@@ -1571,3 +1571,13 @@
 // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMV7EB: "--be8"
 // CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"
+
+// Check dynamic-linker for musl-libc
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=i386-pc-linux-musl \
+// RUN:   | FileCheck --check-prefix=CHECK-MUSL32 %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-pc-linux-musl \
+// RUN:   | FileCheck --check-prefix=CHECK-MUSL64 %s
+// CHECK-MUSL32: "-dynamic-linker" "/lib/ld-musl-i386.so.1"
+// CHECK-MUSL64: "-dynamic-linker" "/lib/ld-musl-x86_64.so.1"


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


Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-14 Thread Rafael Espíndola via cfe-commits
On 13 June 2016 at 21:07, Lei Zhang  wrote:
> 2016-06-14 5:00 GMT+08:00 Rafael Espíndola :
>> Do you need someone to commit it for you?
>
> Yes, please :)

Committed.

Cheers,
Rafael
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Daniel Jasper via cfe-commits
djasper added a comment.

I am happy to get this in for now, but I actually think the right solution 
might be to let clang-format de-duplicate #includes in general. What do you 
think?


http://reviews.llvm.org/D21323



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


Re: [PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-14 Thread Martin Böhme via cfe-commits
mboehme updated this revision to Diff 60671.

http://reviews.llvm.org/D21223

Files:
  clang-tidy/misc/MoveConstantArgumentCheck.cpp
  docs/clang-tidy/checks/misc-move-const-arg.rst
  test/clang-tidy/misc-move-const-arg.cpp

Index: test/clang-tidy/misc-move-const-arg.cpp
===
--- test/clang-tidy/misc-move-const-arg.cpp
+++ test/clang-tidy/misc-move-const-arg.cpp
@@ -71,3 +71,90 @@
   f10(1);
   f10(1);
 }
+
+class NonMoveable {
+ public:
+  NonMoveable();
+  NonMoveable(const NonMoveable &);
+
+  NonMoveable &operator=(const NonMoveable &);
+};
+
+void callByConstRef(const NonMoveable &);
+void callByConstRef(int i, const NonMoveable &);
+
+void moveToConstReferencePositives() {
+  NonMoveable obj;
+
+  // Basic case.
+  callByConstRef(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(obj);
+
+  // Also works for second argument.
+  callByConstRef(1, std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(1, obj);
+
+  // Works if std::move() applied to a temporary.
+  callByConstRef(std::move(NonMoveable()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(NonMoveable());
+
+  // Works if calling a copy constructor.
+  NonMoveable other(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: passing result of std::move() as
+  // CHECK-FIXES: NonMoveable other(obj);
+
+  // Works if calling assignment operator.
+  other = std::move(obj);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: passing result of std::move() as
+  // CHECK-FIXES: other = obj;
+}
+
+class Moveable {
+ public:
+  Moveable();
+  Moveable(Moveable &&);
+
+  Moveable &operator=(Moveable &&);
+};
+
+void callByValue(Moveable);
+
+void callByRValueRef(Moveable &&);
+
+template 
+void templateFunction(T obj) {
+  T other = std::move(obj);
+}
+
+#define M3(T, obj)\
+  do {\
+T other = std::move(obj); \
+  } while (true)
+
+#define CALL(func) (func)()
+
+void moveToConstReferenceNegatives() {
+  // No warning when actual move takes place.
+  Moveable moveable;
+  callByValue(std::move(moveable));
+  callByRValueRef(std::move(moveable));
+  Moveable other(std::move(moveable));
+  other = std::move(moveable);
+
+  // No warning if std::move() not used.
+  NonMoveable non_moveable;
+  callByConstRef(non_moveable);
+
+  // No warning if instantiating a template.
+  templateFunction(non_moveable);
+
+  // No warning inside of macro expansions.
+  M3(NonMoveable, non_moveable);
+
+  // No warning inside of macro expansion, even if the macro expansion is inside
+  // a lambda that is, in turn, an argument to a macro.
+  CALL([non_moveable] { M3(NonMoveable, non_moveable); });
+}
Index: docs/clang-tidy/checks/misc-move-const-arg.rst
===
--- docs/clang-tidy/checks/misc-move-const-arg.rst
+++ docs/clang-tidy/checks/misc-move-const-arg.rst
@@ -3,13 +3,26 @@
 misc-move-const-arg
 ===
 
-The check warns if ``std::move()`` is called with a constant argument or an
-argument of a trivially-copyable type, e.g.:
+The check warns
+
+  - if ``std::move()`` is called with a constant argument,
+  - if ``std::move()`` is called with an argument of a trivially-copyable type,
+or
+  - if the result of ``std::move()`` is passed as a const reference argument.
+
+In all three cases, the check will suggest a fix that removes the
+``std::move()``.
+
+Here are examples of each of the three cases:
 
 .. code:: c++
 
   const string s;
   return std::move(s);  // Warning: std::move of the const variable has no effect
 
   int x;
   return std::move(x);  // Warning: std::move of the variable of a trivially-copyable type has no effect
+
+  void f(const string &s);
+  string s;
+  f(std::move(s));  // Warning: passing result of std::move as a const reference argument; no move will actually happen
Index: clang-tidy/misc/MoveConstantArgumentCheck.cpp
===
--- clang-tidy/misc/MoveConstantArgumentCheck.cpp
+++ clang-tidy/misc/MoveConstantArgumentCheck.cpp
@@ -17,51 +17,77 @@
 namespace tidy {
 namespace misc {
 
+static void ReplaceCallWithArg(const CallExpr *Call, DiagnosticBuilder &Diag,
+   const SourceManager &SM,
+   const LangOptions &LangOpts) {
+  const Expr *Arg = Call->getArg(0);
+
+  CharSourceRange BeforeArgumentsRange = Lexer::makeFileCharRange(
+  CharSourceRange::getCharRange(Call->getLocStart(), Arg->getLocStart()),
+  SM, LangOpts);
+  CharSourceRange AfterArgumentsRange = Lexer::makeFileCharRange(
+  CharSourceRange::getCharRange(Call->getLocEnd(),
+Call->getLocEnd().getLocWithOffset(1))

Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
ioeric added a comment.

It should be quite straight-forward to de-duplicate #includes in the same block 
in `sortIncludes`. I'm happy to add this into `sortIncludes`, but I'm not sure 
if this is a behavior users would expect from clang-format since it deletes 
code?

And maybe duplicated headers are not that common in the first place? I would 
rather rely on users (like #include_fixer) to make sure there is no duplicated 
#include.


http://reviews.llvm.org/D21323



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


Re: [PATCH] D20732: Don't use static variables in LambdaCapture

2016-06-14 Thread John Brawn via cfe-commits
john.brawn added a comment.

In http://reviews.llvm.org/D20732#456239, @jyknight wrote:

> This looks okay. The only downside: it will increase sizeof(Decl) on 32bit 
> platforms, since the layout is:
>  vtable ptr (4)
>  NextInContextAndBits ptr (4)
>  DeclCtx ptr (4)
>  Loc int (4)
>  bitfield int (4)
>
> Totaling 20 bytes, which will now be rounded up to 24 bytes. I don't know how 
> others feel, but it seems probably fine to me? On 64-bit platforms, it's 
> already 32 bytes, and that won't be affected.


I did an experiment compiling the top 5 largest llvm/clang source files with 
and without this patch and got the following numbers for "Maximum resident set 
size (kbytes)" reported by time -v

| **Source File** | **Before**  | **After**   | **Change**   |
| X86ISelLowering.cpp | 679824 +/- 28   | 679897 +/- 271  | 73 (0.01%)   |
| SemaDecl.cpp| 705379 +/- 440  | 705590 +/- 77   | 211 (0.03%)  |
| SemaExpr.cpp| 950729 +/- 6910 | 951654 +/- 5834 | 925 (0.10%)  |
| DAGCombiner.cpp | 443673 +/- 38   | 443721 +/- 16   | 48 (0.01%)   |
| SemaDeclCXX.cpp | 850441 +/- 4531 | 851891 +/- 5079 | 1450 (0.17%) |

I think a <0.2% increase in memory usage is fine.


Repository:
  rL LLVM

http://reviews.llvm.org/D20732



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


Re: [PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-14 Thread Martin Böhme via cfe-commits
mboehme added inline comments.


Comment at: test/clang-tidy/misc-move-const-arg.cpp:75-76
@@ +74,4 @@
+
+struct NonMoveable {
+ public:
+  NonMoveable();

aaron.ballman wrote:
> This type isn't non-moveable. For that, you need to explicitly delete the 
> move constructor. Perhaps a better name is `NonMoveConstructible`?
> 
> Also, no need for the `public` access specifier.
> This type isn't non-moveable. For that, you need to explicitly delete the 
> move constructor.

Can you expand on this?

The standard says: "If the definition of a class X does not explicitly declare 
a move constructor, one will be implicitly declared as defaulted if and only if 
- X does not have a user-declared copy constructor [...]" (12.8/9).

Because I'm declaring a copy constructor, I would thus have expected not to get 
an implicitly-declared move constructor. Where am I going wrong here?

> Perhaps a better name is NonMoveConstructible?

But the type _is_ move-constructible (in the sense of 
std::is_move_constructible<>).

> Also, no need for the public access specifier.

Oops -- thanks for catching this.

Actually, I meant to make this a class -- not sure how the "struct" slipped in 
there.


Comment at: test/clang-tidy/misc-move-const-arg.cpp:116
@@ +115,3 @@
+struct Moveable {
+ public:
+  Moveable();

aaron.ballman wrote:
> No need for the `public` access specifier.
Thanks for cathching this -- as above, I meant to make this a class.


http://reviews.llvm.org/D21223



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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Well, it is easy to not see duplicated #includes when they aren't properly 
sorted. When clang-format then goes in and sorts them, they end up next to each 
other. And I think no user really wants that.


http://reviews.llvm.org/D21323



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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
ioeric added a comment.

Agreed. So, do we still want to skip existing #includes here or simply rely on 
`sortIncludes` to de-duplicate?


http://reviews.llvm.org/D21323



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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Lets get this in for now. We can always remove it if we think it is no longer 
useful.



Comment at: unittests/Format/CleanupTest.cpp:692
@@ +691,3 @@
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \n";

Please also add a test with quoted #includes as well as combined forms 
(inserting  when there already is "vector" and vice versa).


http://reviews.llvm.org/D21323



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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 60675.
ioeric marked an inline comment as done.
ioeric added a comment.

- Addressed reviewer's comments: test case added.


http://reviews.llvm.org/D21323

Files:
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp

Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -688,6 +688,23 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
+TEST_F(CleanUpReplacementsTest, AddIncludesWithDifferentForms) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \"vector\"\n"
+ "#include \n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include \"vector\""),
+createInsertion("#include ")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. 
#includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -688,6 +688,23 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
+TEST_F(CleanUpReplacementsTest, AddIncludesWithDifferentForms) {
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \"vector\"\n"
+ "#include \n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include \"vector\""),
+createInsertion("#include ")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. #includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Cat

Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-14 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

A build of Firefox does not show any false positive now.


http://reviews.llvm.org/D20561



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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: unittests/Format/CleanupTest.cpp:693
@@ +692,3 @@
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),

Please add a line break after each "\n", i.e.:

  ... = "#include \"a.h\"\n"
"#include ";


Comment at: unittests/Format/CleanupTest.cpp:701
@@ +700,3 @@
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \"vector\"\n"
+ "#include \n#include \n";

Is this really what we want?


http://reviews.llvm.org/D21323



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


r272667 - [Clang][avx512][Intrinsics] adding prefetch gather intrinsics

2016-06-14 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Jun 14 08:45:17 2016
New Revision: 272667

URL: http://llvm.org/viewvc/llvm-project?rev=272667&view=rev
Log:
[Clang][avx512][Intrinsics] adding prefetch gather intrinsics

Differential Revision: http://reviews.llvm.org/D21322

Modified:
cfe/trunk/lib/Headers/avx512pfintrin.h
cfe/trunk/test/CodeGen/avx512pf-builtins.c

Modified: cfe/trunk/lib/Headers/avx512pfintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512pfintrin.h?rev=272667&r1=272666&r2=272667&view=diff
==
--- cfe/trunk/lib/Headers/avx512pfintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512pfintrin.h Tue Jun 14 08:45:17 2016
@@ -35,21 +35,40 @@
   __builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
  (long long const *)(addr), (int)(scale), \
  (int)(hint)); })
+  
+#define _mm512_prefetch_i32gather_pd(index, addr, scale, hint) __extension__ 
({\
+  __builtin_ia32_gatherpfdpd((__mmask8) -1, (__v8si)(__m256i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
 
 #define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) ({\
   __builtin_ia32_gatherpfdps((__mmask16)(mask), \
  (__v16si)(__m512i)(index), (int const *)(addr), \
  (int)(scale), (int)(hint)); })
 
+#define _mm512_prefetch_i32gather_ps(index, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfdps((__mmask16) -1, \
+ (__v16si)(__m512i)(index), (int const *)(addr), \
+ (int)(scale), (int)(hint)); })
+
 #define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) 
__extension__ ({\
   __builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
  (long long const *)(addr), (int)(scale), \
  (int)(hint)); })
 
+#define _mm512_prefetch_i64gather_pd(index, addr, scale, hint) __extension__ 
({\
+  __builtin_ia32_gatherpfqpd((__mmask8) -1, (__v8di)(__m512i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
+  
 #define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) ({\
   __builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
  (int const *)(addr), (int)(scale), (int)(hint)); 
})
 
+#define _mm512_prefetch_i64gather_ps(index, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfqps((__mmask8) -1, (__v8di)(__m512i)(index), \
+ (int const *)(addr), (int)(scale), (int)(hint)); 
})
+
 #define _mm512_prefetch_i32scatter_pd(addr, index, scale, hint) __extension__ 
({\
   __builtin_ia32_scatterpfdpd((__mmask8)-1, (__v8si)(__m256i)(index), \
   (long long *)(addr), (int)(scale), \

Modified: cfe/trunk/test/CodeGen/avx512pf-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512pf-builtins.c?rev=272667&r1=272666&r2=272667&view=diff
==
--- cfe/trunk/test/CodeGen/avx512pf-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512pf-builtins.c Tue Jun 14 08:45:17 2016
@@ -11,24 +11,48 @@ void test_mm512_mask_prefetch_i32gather_
   return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i32gather_pd
+  // CHECK: @llvm.x86.avx512.gatherpf.dpd
+  return _mm512_prefetch_i32gather_pd(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.dps
   return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i32gather_ps(__m512i index,  void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i32gather_ps
+  // CHECK: @llvm.x86.avx512.gatherpf.dps
+  return _mm512_prefetch_i32gather_ps(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.qpd
   return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i64gather_pd
+  // CHECK: @llvm.x86.avx512.gatherpf.qpd
+  return _mm512_prefetch_i64gather_pd(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @

Re: [PATCH] D21322: [Clang][avx512][Intrinsics] adding prefetch gather intrinsics

2016-06-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272667: [Clang][avx512][Intrinsics] adding prefetch gather 
intrinsics (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21322?vs=60663&id=60678#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21322

Files:
  cfe/trunk/lib/Headers/avx512pfintrin.h
  cfe/trunk/test/CodeGen/avx512pf-builtins.c

Index: cfe/trunk/test/CodeGen/avx512pf-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512pf-builtins.c
+++ cfe/trunk/test/CodeGen/avx512pf-builtins.c
@@ -11,24 +11,48 @@
   return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i32gather_pd
+  // CHECK: @llvm.x86.avx512.gatherpf.dpd
+  return _mm512_prefetch_i32gather_pd(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.dps
   return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i32gather_ps(__m512i index,  void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i32gather_ps
+  // CHECK: @llvm.x86.avx512.gatherpf.dps
+  return _mm512_prefetch_i32gather_ps(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.qpd
   return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i64gather_pd
+  // CHECK: @llvm.x86.avx512.gatherpf.qpd
+  return _mm512_prefetch_i64gather_pd(index, addr, 2, 1); 
+}
+
 void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.qps
   return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, 1); 
 }
 
+void test_mm512_prefetch_i64gather_ps(__m512i index, void const *addr, int 
hint) {
+  // CHECK-LABEL: @test_mm512_prefetch_i64gather_ps
+  // CHECK: @llvm.x86.avx512.gatherpf.qps
+  return _mm512_prefetch_i64gather_ps(index, addr, 2, 1); 
+}
+
 void test_mm512_prefetch_i32scatter_pd(void *addr, __m256i index) {
   // CHECK-LABEL: @test_mm512_prefetch_i32scatter_pd
   // CHECK: @llvm.x86.avx512.scatterpf.dpd.512
Index: cfe/trunk/lib/Headers/avx512pfintrin.h
===
--- cfe/trunk/lib/Headers/avx512pfintrin.h
+++ cfe/trunk/lib/Headers/avx512pfintrin.h
@@ -35,21 +35,40 @@
   __builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \
  (long long const *)(addr), (int)(scale), \
  (int)(hint)); })
+  
+#define _mm512_prefetch_i32gather_pd(index, addr, scale, hint) __extension__ 
({\
+  __builtin_ia32_gatherpfdpd((__mmask8) -1, (__v8si)(__m256i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
 
 #define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) ({\
   __builtin_ia32_gatherpfdps((__mmask16)(mask), \
  (__v16si)(__m512i)(index), (int const *)(addr), \
  (int)(scale), (int)(hint)); })
 
+#define _mm512_prefetch_i32gather_ps(index, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfdps((__mmask16) -1, \
+ (__v16si)(__m512i)(index), (int const *)(addr), \
+ (int)(scale), (int)(hint)); })
+
 #define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) 
__extension__ ({\
   __builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \
  (long long const *)(addr), (int)(scale), \
  (int)(hint)); })
 
+#define _mm512_prefetch_i64gather_pd(index, addr, scale, hint) __extension__ 
({\
+  __builtin_ia32_gatherpfqpd((__mmask8) -1, (__v8di)(__m512i)(index), \
+ (long long const *)(addr), (int)(scale), \
+ (int)(hint)); })
+  
 #define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) ({\
   __builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \
  (int const *)(addr), (int)(scale), (int)(hint)); 
})
 
+#define _mm512_prefetch_i64gather_ps(index, addr, scale, hint) ({\
+  __builtin_ia32_gatherpfqps((__mmask8) -1, (__v8di)(__m512i)(index), \
+ (int const *)(addr), (int)(scale

Re: [PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-14 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: test/clang-tidy/misc-move-const-arg.cpp:75-76
@@ +74,4 @@
+
+class NonMoveable {
+ public:
+  NonMoveable();

> Can you expand on this?
>
> The standard says: "If the definition of a class X does not explicitly 
> declare a move constructor, one will be implicitly declared as defaulted if 
> and only if - X does not have a user-declared copy constructor [...]" 
> (12.8/9).
>
> Because I'm declaring a copy constructor, I would thus have expected not to 
> get an implicitly-declared move constructor. Where am I going wrong here?

Move operations are optimized versions of a copy operation, so a failed move 
operation can fall back to perform a copy operation instead and achieve the 
same operational semantics but with slightly worse performance. Because you 
have a copy constructor, you do not get an implicitly-declared move constructor 
(so that's correct), but that doesn't mean the type cannot be used in a context 
where the user expects a move (i.e., calling `std::move()` on it) -- the 
operation just falls back on the copy constructor.

Basically, there's an operational difference between not having the 
implicitly-declared move constructor and having a deleted move constructor. In 
the former, fallback to copy happens and in the latter you get a diagnostic. So 
when I hear "non-moveable type", my brain assumes you mean "get a diagnostic 
when you try to move."


http://reviews.llvm.org/D21223



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


r272668 - clang-format: [JS] Fix failing format with TypeScript casts.

2016-06-14 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Tue Jun 14 08:54:38 2016
New Revision: 272668

URL: http://llvm.org/viewvc/llvm-project?rev=272668&view=rev
Log:
clang-format: [JS] Fix failing format with TypeScript casts.

Before, this could be formatted at all (with BracketAlignmentStyle
AlwaysBreak):

  foo = [
1, /* */
2
  ];

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=272668&r1=272667&r2=272668&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue Jun 14 08:54:38 2016
@@ -319,9 +319,9 @@ private:
 Left->Type = TT_JsComputedPropertyName;
   } else if (Style.Language == FormatStyle::LK_Proto ||
  (Parent &&
-  Parent->isOneOf(TT_BinaryOperator, tok::at, tok::comma,
-  tok::l_paren, tok::l_square, tok::question,
-  tok::colon, tok::kw_return,
+  Parent->isOneOf(TT_BinaryOperator, TT_TemplateCloser, 
tok::at,
+  tok::comma, tok::l_paren, tok::l_square,
+  tok::question, tok::colon, tok::kw_return,
   // Should only be relevant to JavaScript:
   tok::kw_default))) {
 Left->Type = TT_ArrayInitializerLSquare;

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=272668&r1=272667&r2=272668&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Tue Jun 14 08:54:38 2016
@@ -1205,6 +1205,10 @@ TEST_F(FormatTestJS, TemplateStrings) {
 TEST_F(FormatTestJS, CastSyntax) {
   verifyFormat("var x = foo;");
   verifyFormat("var x = foo as type;");
+  verifyFormat("foo = [\n"
+   "  1,  //\n"
+   "  2\n"
+   "];");
 }
 
 TEST_F(FormatTestJS, TypeArguments) {


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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 60680.
ioeric marked 2 inline comments as done.
ioeric added a comment.

- addressed reviewer's comments.


http://reviews.llvm.org/D21323

Files:
  lib/Format/Format.cpp
  unittests/Format/CleanupTest.cpp

Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -688,6 +688,29 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
+TEST_F(CleanUpReplacementsTest, AddIncludesWithDifferentForms) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  // FIXME: this might not be the best behavior.
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \"vector\"\n"
+ "#include \n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include \"vector\""),
+createInsertion("#include ")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. 
#includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];


Index: unittests/Format/CleanupTest.cpp
===
--- unittests/Format/CleanupTest.cpp
+++ unittests/Format/CleanupTest.cpp
@@ -688,6 +688,29 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
+TEST_F(CleanUpReplacementsTest, AddIncludesWithDifferentForms) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  // FIXME: this might not be the best behavior.
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \"vector\"\n"
+ "#include \n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include \"vector\""),
+createInsertion("#include ")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. #includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Li

Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
ioeric added inline comments.


Comment at: unittests/Format/CleanupTest.cpp:701
@@ +700,3 @@
+  std::string Code = "#include \"a.h\"\n#include \n";
+  std::string Expected = "#include \"a.h\"\n#include \"vector\"\n"
+ "#include \n#include \n";

djasper wrote:
> Is this really what we want?
I'm not sure... this might not be the best behavior. FIXME added.


http://reviews.llvm.org/D21323



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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good :-)


http://reviews.llvm.org/D21323



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


r272669 - [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue Jun 14 09:09:21 2016
New Revision: 272669

URL: http://llvm.org/viewvc/llvm-project?rev=272669&view=rev
Log:
[clang-format] do not add existing includes.

Summary: do not add existing includes.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D21323

Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/CleanupTest.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=272669&r1=272668&r2=272669&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Tue Jun 14 09:09:21 2016
@@ -1486,7 +1486,6 @@ unsigned getOffsetAfterHeaderGuardsAndCo
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. 
#includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@ fixCppIncludeInsertions(StringRef Code,
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@ fixCppIncludeInsertions(StringRef Code,
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];

Modified: cfe/trunk/unittests/Format/CleanupTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/CleanupTest.cpp?rev=272669&r1=272668&r2=272669&view=diff
==
--- cfe/trunk/unittests/Format/CleanupTest.cpp (original)
+++ cfe/trunk/unittests/Format/CleanupTest.cpp Tue Jun 14 09:09:21 2016
@@ -688,6 +688,29 @@ TEST_F(CleanUpReplacementsTest, NoNewLin
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
+TEST_F(CleanUpReplacementsTest, AddIncludesWithDifferentForms) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  // FIXME: this might not be the best behavior.
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \"vector\"\n"
+ "#include \n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include \"vector\""),
+createInsertion("#include ")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang


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


Re: [PATCH] D21323: [clang-format] do not add existing includes.

2016-06-14 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272669: [clang-format] do not add existing includes. 
(authored by ioeric).

Changed prior to commit:
  http://reviews.llvm.org/D21323?vs=60680&id=60681#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21323

Files:
  cfe/trunk/lib/Format/Format.cpp
  cfe/trunk/unittests/Format/CleanupTest.cpp

Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. 
#includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];
Index: cfe/trunk/unittests/Format/CleanupTest.cpp
===
--- cfe/trunk/unittests/Format/CleanupTest.cpp
+++ cfe/trunk/unittests/Format/CleanupTest.cpp
@@ -688,6 +688,29 @@
   EXPECT_EQ(Expected, apply(Code, Replaces));
 }
 
+TEST_F(CleanUpReplacementsTest, SkipExistingHeaders) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include "),
+createInsertion("#include \"a.h\"")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
+TEST_F(CleanUpReplacementsTest, AddIncludesWithDifferentForms) {
+  std::string Code = "#include \"a.h\"\n"
+ "#include \n";
+  // FIXME: this might not be the best behavior.
+  std::string Expected = "#include \"a.h\"\n"
+ "#include \"vector\"\n"
+ "#include \n"
+ "#include \n";
+  tooling::Replacements Replaces = {createInsertion("#include \"vector\""),
+createInsertion("#include ")};
+  EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang


Index: cfe/trunk/lib/Format/Format.cpp
===
--- cfe/trunk/lib/Format/Format.cpp
+++ cfe/trunk/lib/Format/Format.cpp
@@ -1486,7 +1486,6 @@
 // code.
 // FIXME: do not insert headers into conditional #include blocks, e.g. #includes
 // surrounded by compile condition "#if...".
-// FIXME: do not insert existing headers.
 // FIXME: insert empty lines between newly created blocks.
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
@@ -1533,10 +1532,12 @@
   TrimmedCode.split(Lines, '\n');
   unsigned Offset = MinInsertOffset;
   unsigned NextLineOffset;
+  std::set ExistingIncludes;
   for (auto Line : Lines) {
 NextLineOffset = std::min(Code.size(), Offset + Line.size() + 1);
 if (IncludeRegex.match(Line, &Matches)) {
   StringRef IncludeName = Matches[2];
+  ExistingIncludes.insert(IncludeName);
   int Category = Categories.getIncludePriority(
   IncludeName, /*CheckMainHeader=*/FirstIncludeOffset < 0);
   CategoryEndOffsets[Category] = NextLineOffset;
@@ -1572,6 +1573,11 @@
   "'#include ...'");
 (void)Matched;
 auto IncludeName = Matches[2];
+if (ExistingIncludes.find(IncludeName) != ExistingIncludes.end()) {
+  DEBUG(llvm::dbgs() << "Skip adding existing include : " << IncludeName
+ << "\n");
+  continue;
+}
 int Category =
 Categories.getIncludePriority(IncludeName, /*CheckMainHeader=*/true);
 Offset = CategoryEndOffsets[Category];
Index: cfe/trunk/unittests/Format/CleanupTest.cpp
==

Re: [PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-14 Thread Martin Böhme via cfe-commits
mboehme updated this revision to Diff 60686.

http://reviews.llvm.org/D21223

Files:
  clang-tidy/misc/MoveConstantArgumentCheck.cpp
  docs/clang-tidy/checks/misc-move-const-arg.rst
  test/clang-tidy/misc-move-const-arg.cpp

Index: test/clang-tidy/misc-move-const-arg.cpp
===
--- test/clang-tidy/misc-move-const-arg.cpp
+++ test/clang-tidy/misc-move-const-arg.cpp
@@ -71,3 +71,90 @@
   f10(1);
   f10(1);
 }
+
+class NoMoveSemantics {
+ public:
+  NoMoveSemantics();
+  NoMoveSemantics(const NoMoveSemantics &);
+
+  NoMoveSemantics &operator=(const NoMoveSemantics &);
+};
+
+void callByConstRef(const NoMoveSemantics &);
+void callByConstRef(int i, const NoMoveSemantics &);
+
+void moveToConstReferencePositives() {
+  NoMoveSemantics obj;
+
+  // Basic case.
+  callByConstRef(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(obj);
+
+  // Also works for second argument.
+  callByConstRef(1, std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(1, obj);
+
+  // Works if std::move() applied to a temporary.
+  callByConstRef(std::move(NoMoveSemantics()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: passing result of std::move() as
+  // CHECK-FIXES: callByConstRef(NoMoveSemantics());
+
+  // Works if calling a copy constructor.
+  NoMoveSemantics other(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: passing result of std::move() as
+  // CHECK-FIXES: NoMoveSemantics other(obj);
+
+  // Works if calling assignment operator.
+  other = std::move(obj);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: passing result of std::move() as
+  // CHECK-FIXES: other = obj;
+}
+
+class MoveSemantics {
+ public:
+  MoveSemantics();
+  MoveSemantics(MoveSemantics &&);
+
+  MoveSemantics &operator=(MoveSemantics &&);
+};
+
+void callByValue(MoveSemantics);
+
+void callByRValueRef(MoveSemantics &&);
+
+template 
+void templateFunction(T obj) {
+  T other = std::move(obj);
+}
+
+#define M3(T, obj)\
+  do {\
+T other = std::move(obj); \
+  } while (true)
+
+#define CALL(func) (func)()
+
+void moveToConstReferenceNegatives() {
+  // No warning when actual move takes place.
+  MoveSemantics move_semantics;
+  callByValue(std::move(move_semantics));
+  callByRValueRef(std::move(move_semantics));
+  MoveSemantics other(std::move(move_semantics));
+  other = std::move(move_semantics);
+
+  // No warning if std::move() not used.
+  NoMoveSemantics no_move_semantics;
+  callByConstRef(no_move_semantics);
+
+  // No warning if instantiating a template.
+  templateFunction(no_move_semantics);
+
+  // No warning inside of macro expansions.
+  M3(NoMoveSemantics, no_move_semantics);
+
+  // No warning inside of macro expansion, even if the macro expansion is inside
+  // a lambda that is, in turn, an argument to a macro.
+  CALL([no_move_semantics] { M3(NoMoveSemantics, no_move_semantics); });
+}
Index: docs/clang-tidy/checks/misc-move-const-arg.rst
===
--- docs/clang-tidy/checks/misc-move-const-arg.rst
+++ docs/clang-tidy/checks/misc-move-const-arg.rst
@@ -3,13 +3,26 @@
 misc-move-const-arg
 ===
 
-The check warns if ``std::move()`` is called with a constant argument or an
-argument of a trivially-copyable type, e.g.:
+The check warns
+
+  - if ``std::move()`` is called with a constant argument,
+  - if ``std::move()`` is called with an argument of a trivially-copyable type,
+or
+  - if the result of ``std::move()`` is passed as a const reference argument.
+
+In all three cases, the check will suggest a fix that removes the
+``std::move()``.
+
+Here are examples of each of the three cases:
 
 .. code:: c++
 
   const string s;
   return std::move(s);  // Warning: std::move of the const variable has no effect
 
   int x;
   return std::move(x);  // Warning: std::move of the variable of a trivially-copyable type has no effect
+
+  void f(const string &s);
+  string s;
+  f(std::move(s));  // Warning: passing result of std::move as a const reference argument; no move will actually happen
Index: clang-tidy/misc/MoveConstantArgumentCheck.cpp
===
--- clang-tidy/misc/MoveConstantArgumentCheck.cpp
+++ clang-tidy/misc/MoveConstantArgumentCheck.cpp
@@ -17,51 +17,77 @@
 namespace tidy {
 namespace misc {
 
+static void ReplaceCallWithArg(const CallExpr *Call, DiagnosticBuilder &Diag,
+   const SourceManager &SM,
+   const LangOptions &LangOpts) {
+  const Expr *Arg = Call->getArg(0);
+
+  CharSourceRange BeforeArgumentsRange = Lexer::makeFileCharRange(
+  CharSourceRange::getCharRange(Call->getLocStart(), Arg->getLocStart()),
+  SM, LangOpts);
+  CharSourceRange After

Re: [PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

2016-06-14 Thread Martin Böhme via cfe-commits
mboehme added inline comments.


Comment at: test/clang-tidy/misc-move-const-arg.cpp:75-76
@@ +74,4 @@
+
+class NonMoveable {
+ public:
+  NonMoveable();

aaron.ballman wrote:
> > Can you expand on this?
> >
> > The standard says: "If the definition of a class X does not explicitly 
> > declare a move constructor, one will be implicitly declared as defaulted if 
> > and only if - X does not have a user-declared copy constructor [...]" 
> > (12.8/9).
> >
> > Because I'm declaring a copy constructor, I would thus have expected not to 
> > get an implicitly-declared move constructor. Where am I going wrong here?
> 
> Move operations are optimized versions of a copy operation, so a failed move 
> operation can fall back to perform a copy operation instead and achieve the 
> same operational semantics but with slightly worse performance. Because you 
> have a copy constructor, you do not get an implicitly-declared move 
> constructor (so that's correct), but that doesn't mean the type cannot be 
> used in a context where the user expects a move (i.e., calling `std::move()` 
> on it) -- the operation just falls back on the copy constructor.
> 
> Basically, there's an operational difference between not having the 
> implicitly-declared move constructor and having a deleted move constructor. 
> In the former, fallback to copy happens and in the latter you get a 
> diagnostic. So when I hear "non-moveable type", my brain assumes you mean 
> "get a diagnostic when you try to move."
Ah, now I see what you mean.

I've renamed "NonMoveable" to "NoMoveSemantics" (and "Moveable" to 
"MoveSemantics" for consistency). What do you think?

(I don't like NonMoveConstructible because it's prone to the same ambiguity -- 
or even more so, because std::is_move_constructible<> uses exactly the same 
term and the type is move constructible in the sense of that trait.)


http://reviews.llvm.org/D21223



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


[libcxx] r272671 - Partially Revert r272613. FreeBSD needs the non-trivial constructors in pair.

2016-06-14 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Tue Jun 14 09:34:19 2016
New Revision: 272671

URL: http://llvm.org/viewvc/llvm-project?rev=272671&view=rev
Log:
Partially Revert r272613. FreeBSD needs the non-trivial constructors in pair.

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/utility

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=272671&r1=272670&r2=272671&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Jun 14 09:34:19 2016
@@ -746,8 +746,8 @@ template  struct __static_asse
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 
-#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-#  error the "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" option is no longer supported
+#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
 #endif
 
 #ifndef _LIBCPP_STD_VER
@@ -880,9 +880,7 @@ extern "C" void __sanitizer_annotate_con
 #if __cplusplus < 201103L
 #define _LIBCPP_CXX03_LANG
 #else
-#if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) \
- || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)  \
- || defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTION)
+#if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) || 
defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 #error Libc++ requires a feature complete C++11 compiler in C++11 or greater.
 #endif
 #endif

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=272671&r1=272670&r2=272671&view=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Tue Jun 14 09:34:19 2016
@@ -310,9 +310,18 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
   )
 : first(__p.first), second(__p.second) {}
 
-#if !defined(_LIBCPP_CXX03_LANG)
-_LIBCPP_INLINE_VISIBILITY pair(const pair& __p) = default;
-_LIBCPP_INLINE_VISIBILITY pair(pair&& __p) = default;
+#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && 
_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+_LIBCPP_INLINE_VISIBILITY
+pair(const pair& __p) = default;
+#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || 
!_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+_LIBCPP_INLINE_VISIBILITY
+pair(const pair& __p)
+_NOEXCEPT_(is_nothrow_copy_constructible::value &&
+   is_nothrow_copy_constructible::value)
+: first(__p.first),
+  second(__p.second)
+{
+}
 #endif
 
 _LIBCPP_INLINE_VISIBILITY
@@ -344,6 +353,19 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
 : first(_VSTD::forward<_U1>(__p.first)),
   second(_VSTD::forward<_U2>(__p.second)) {}
 
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+_LIBCPP_INLINE_VISIBILITY
+pair(pair&& __p) = default;
+#else
+_LIBCPP_INLINE_VISIBILITY
+pair(pair&& __p) 
_NOEXCEPT_(is_nothrow_move_constructible::value &&
+
is_nothrow_move_constructible::value)
+: first(_VSTD::forward(__p.first)),
+  second(_VSTD::forward(__p.second))
+{
+}
+#endif
+
 _LIBCPP_INLINE_VISIBILITY
 pair&
 operator=(pair&& __p) 
_NOEXCEPT_(is_nothrow_move_assignable::value &&


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


Re: r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Rafael Espíndola via cfe-commits
Looks like this broke the docs:
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/14690/steps/docs-clang-html/logs/stdio

Cheers,
Rafael


On 14 June 2016 at 08:04, Adam Nemet via cfe-commits
 wrote:
> Author: anemet
> Date: Tue Jun 14 07:04:26 2016
> New Revision: 272656
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272656&view=rev
> Log:
> Add loop pragma for Loop Distribution
>
> Summary:
> This is similar to other loop pragmas like 'vectorize'.  Currently it
> only has state values: distribute(enable) and distribute(disable).  When
> one of these is specified the corresponding loop metadata is generated:
>
>   !{!"llvm.loop.distribute.enable", i1 true/false}
>
> As a result, loop distribution will be attempted on the loop even if
> Loop Distribution in not enabled globally.  Analogously, with 'disable'
> distribution can be turned off for an individual loop even when the pass
> is otherwise enabled.
>
> There are some slight differences compared to the existing loop pragmas.
>
> 1. There is no 'assume_safety' variant which makes its handling slightly
> different from 'vectorize'/'interleave'.
>
> 2. Unlike the existing loop pragmas, it does not have a corresponding
> numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
> consistency checks in CheckForIncompatibleAttributes we don't need to
> check it against other pragmas.  We just need to check for duplicates of
> the same pragma.
>
> Reviewers: rsmith, dexonsmith, aaron.ballman
>
> Subscribers: bob.wilson, cfe-commits, hfinkel
>
> Differential Revision: http://reviews.llvm.org/D19403
>
> Modified:
> cfe/trunk/docs/LanguageExtensions.rst
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
> cfe/trunk/lib/CodeGen/CGLoopInfo.h
> cfe/trunk/lib/Parse/ParsePragma.cpp
> cfe/trunk/lib/Sema/SemaStmtAttr.cpp
> cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
> cfe/trunk/test/Misc/ast-print-pragmas.cpp
> cfe/trunk/test/PCH/pragma-loop.cpp
> cfe/trunk/test/Parser/pragma-loop-safety.cpp
> cfe/trunk/test/Parser/pragma-loop.cpp
>
> Modified: cfe/trunk/docs/LanguageExtensions.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656&r1=272655&r2=272656&view=diff
> ==
> --- cfe/trunk/docs/LanguageExtensions.rst (original)
> +++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
> @@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
>
>  The ``#pragma clang loop`` directive is used to specify hints for optimizing 
> the
>  subsequent for, while, do-while, or c++11 range-based for loop. The directive
> -provides options for vectorization, interleaving, and unrolling. Loop hints 
> can
> -be specified before any loop and will be ignored if the optimization is not 
> safe
> -to apply.
> +provides options for vectorization, interleaving, unrolling and
> +distribution. Loop hints can be specified before any loop and will be 
> ignored if
> +the optimization is not safe to apply.
>
>  Vectorization and Interleaving
>  --
> @@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
>
>  Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
>
> +Loop Distribution
> +-
> +
> +Loop Distribution allows splitting a loop into multiple loops.  This is
> +beneficial for example when the entire loop cannot be vectorized but some of 
> the
> +resulting loops can.
> +
> +If ``distribute(enable))'' is specified and the loop has memory dependencies
> +that inhibit vectorization, the compiler will attempt to isolate the 
> offending
> +operations into a new loop.  This optimization is not enabled by default, 
> only
> +loops marked with the pragma are considered.
> +
> +.. code-block:: c++
> +
> +  #pragma clang loop distribute(enable)
> +  for (i = 0; i < N; ++i) {
> +S1: A[i + 1] = A[i] + B[i];
> +S2: C[i] = D[i] * E[i];
> +  }
> +
> +This loop will be split into two loops between statements S1 and S2.  The
> +second loop containing S2 will be vectorized.
> +
> +Loop Distribution is currently not enabled by default in the optimizer 
> because
> +it can hurt performance in some cases.  For example, instruction-level
> +parallelism could be reduced by sequentializing the execution of the
> +statements S1 and S2 above.
> +
> +If Loop Distribution is turned on globally with
> +``-mllvm -enable-loop-distribution``, specifying ``distribute(disable)`` can
> +be used the disable it on a per-loop basis.
> +
>  Additional Information
>  --
>
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=272656&r1=272655&r2=272656&view=diff
> ==
> --- cfe/trunk/include/clan

Re: [PATCH] D21317: [sanitizer] Allow sanitize coverage w/o sanitizers.

2016-06-14 Thread Kostya Serebryany via cfe-commits
kcc added a comment.

What run-time is going to be linked when coverage is used w/o any of the 
sanitizers?


Repository:
  rL LLVM

http://reviews.llvm.org/D21317



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


[libcxx] r272679 - Found a couple bugs in the test suite. No functionality change.

2016-06-14 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jun 14 10:25:46 2016
New Revision: 272679

URL: http://llvm.org/viewvc/llvm-project?rev=272679&view=rev
Log:
Found a couple bugs in the test suite. No functionality change.

Modified:

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp

libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp?rev=272679&r1=272678&r2=272679&view=diff
==
--- 
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
 Tue Jun 14 10:25:46 2016
@@ -63,6 +63,7 @@ struct some_hash
 typedef T value_type;
 some_hash() {}
 some_hash(const some_hash&);
+std::size_t operator()(const T&) const { return 0; }
 };
 
 template 
@@ -71,6 +72,7 @@ struct some_hash2
 typedef T value_type;
 some_hash2() {}
 some_hash2(const some_hash2&);
+std::size_t operator()(const T&) const { return 0; }
 };
 
 #if TEST_STD_VER >= 14

Modified: 
libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp?rev=272679&r1=272678&r2=272679&view=diff
==
--- 
libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
 Tue Jun 14 10:25:46 2016
@@ -63,6 +63,7 @@ struct some_hash
 typedef T value_type;
 some_hash() {}
 some_hash(const some_hash&);
+std::size_t operator()(const T&) const { return 0; }
 };
 
 template 
@@ -71,6 +72,7 @@ struct some_hash2
 typedef T value_type;
 some_hash2() {}
 some_hash2(const some_hash2&);
+std::size_t operator()(const T&) const { return 0; }
 };
 
 #if TEST_STD_VER >= 14

Modified: 
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp?rev=272679&r1=272678&r2=272679&view=diff
==
--- 
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/memory/memory.resource.aliases/header_unordered_set_synop.pass.cpp
 Tue Jun 14 10:25:46 2016
@@ -60,7 +60,7 @@ int main()
 static_assert(std::is_same::value, "");
 }
 {
-pmr::unordered_set m;
+pmr::unordered_set m;
 assert(m.get_allocator().resource() == pmr::get_default_resource());
 }
 {
@@ -79,7 +79,7 @@ int main()
 static_assert(std::is_same::value, "");
 }
 {
-pmr::unordered_multiset m;
+pmr::unordered_multiset m;
 assert(m.get_allocator().resource() == pmr::get_default_resource());
 }
 }


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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-14 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.

LGTM, I think it would be nice if the block related code goes in a separate 
commit.

Thanks!


http://reviews.llvm.org/D20444



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


[libunwind] r272680 - [libunwind] Improve unwinder stack usage - III

2016-06-14 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Tue Jun 14 10:51:01 2016
New Revision: 272680

URL: http://llvm.org/viewvc/llvm-project?rev=272680&view=rev
Log:
[libunwind] Improve unwinder stack usage - III

Implement the same optimization committed under r271004 on non-EHABI,
non-SJLJ unwinder as well.

Change-Id: I7f80ed91a75d1e778b50ba87cf8fb68658a083c7

Modified:
libunwind/trunk/src/UnwindLevel1.c

Modified: libunwind/trunk/src/UnwindLevel1.c
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1.c?rev=272680&r1=272679&r2=272680&view=diff
==
--- libunwind/trunk/src/UnwindLevel1.c (original)
+++ libunwind/trunk/src/UnwindLevel1.c Tue Jun 14 10:51:01 2016
@@ -33,16 +33,15 @@
 #if !_LIBUNWIND_ARM_EHABI
 
 static _Unwind_Reason_Code
-unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
-  unw_cursor_t cursor1;
-  unw_init_local(&cursor1, uc);
+unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
+  unw_init_local(cursor, uc);
 
   // Walk each frame looking for a place to stop.
   bool handlerNotFound = true;
   while (handlerNotFound) {
 // Ask libuwind to get next frame (skip over first which is
 // _Unwind_RaiseException).
-int stepResult = unw_step(&cursor1);
+int stepResult = unw_step(cursor);
 if (stepResult == 0) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached 
"
  "bottom => _URC_END_OF_STACK\n",
@@ -58,7 +57,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
 // See if frame has code to run (has personality routine).
 unw_proc_info_t frameInfo;
 unw_word_t sp;
-if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) {
+if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
  "failed => _URC_FATAL_PHASE1_ERROR\n",
  (void *)exception_object);
@@ -70,12 +69,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
   char functionBuf[512];
   const char *functionName = functionBuf;
   unw_word_t offset;
-  if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf),
+  if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
  &offset) != UNW_ESUCCESS) ||
   (frameInfo.start_ip + offset > frameInfo.end_ip))
 functionName = ".anonymous.";
   unw_word_t pc;
-  unw_get_reg(&cursor1, UNW_REG_IP, &pc);
+  unw_get_reg(cursor, UNW_REG_IP, &pc);
   _LIBUNWIND_TRACE_UNWINDING(
   "unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64
   ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n",
@@ -93,13 +92,13 @@ unwind_phase1(unw_context_t *uc, _Unwind
   (void *)exception_object, (void *)(uintptr_t)p);
   _Unwind_Reason_Code personalityResult =
   (*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class,
-   exception_object, (struct _Unwind_Context *)(&cursor1));
+   exception_object, (struct _Unwind_Context *)(cursor));
   switch (personalityResult) {
   case _URC_HANDLER_FOUND:
 // found a catch clause or locals that need destructing in this frame
 // stop search and remember stack pointer at the frame
 handlerNotFound = false;
-unw_get_reg(&cursor1, UNW_REG_SP, &sp);
+unw_get_reg(cursor, UNW_REG_SP, &sp);
 exception_object->private_2 = (uintptr_t)sp;
 _LIBUNWIND_TRACE_UNWINDING(
 "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n",
@@ -127,9 +126,8 @@ unwind_phase1(unw_context_t *uc, _Unwind
 
 
 static _Unwind_Reason_Code
-unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
-  unw_cursor_t cursor2;
-  unw_init_local(&cursor2, uc);
+unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
+  unw_init_local(cursor, uc);
 
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
  (void *)exception_object);
@@ -139,7 +137,7 @@ unwind_phase2(unw_context_t *uc, _Unwind
 
 // Ask libuwind to get next frame (skip over first which is
 // _Unwind_RaiseException).
-int stepResult = unw_step(&cursor2);
+int stepResult = unw_step(cursor);
 if (stepResult == 0) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached 
"
  "bottom => _URC_END_OF_STACK\n",
@@ -155,8 +153,8 @@ unwind_phase2(unw_context_t *uc, _Unwind
 // Get info about this frame.
 unw_word_t sp;
 unw_proc_info_t frameInfo;
-unw_get_reg(&cursor2, UNW_REG_SP, &sp);
-if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
+unw_get_reg(cursor, UNW_REG_SP, &sp);
+if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
   _LIBUNWIND_TR

Re: [libunwind] r272680 - [libunwind] Improve unwinder stack usage - III

2016-06-14 Thread Jonathan Roelofs via cfe-commits



On 6/14/16 9:51 AM, Asiri Rathnayake via cfe-commits wrote:

Author: asiri
Date: Tue Jun 14 10:51:01 2016
New Revision: 272680

URL: http://llvm.org/viewvc/llvm-project?rev=272680&view=rev
Log:
[libunwind] Improve unwinder stack usage - III

Implement the same optimization committed under r271004 on non-EHABI,
non-SJLJ unwinder as well.


Thanks!


Jon



Change-Id: I7f80ed91a75d1e778b50ba87cf8fb68658a083c7

Modified:
 libunwind/trunk/src/UnwindLevel1.c

Modified: libunwind/trunk/src/UnwindLevel1.c
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1.c?rev=272680&r1=272679&r2=272680&view=diff
==
--- libunwind/trunk/src/UnwindLevel1.c (original)
+++ libunwind/trunk/src/UnwindLevel1.c Tue Jun 14 10:51:01 2016
@@ -33,16 +33,15 @@
  #if !_LIBUNWIND_ARM_EHABI

  static _Unwind_Reason_Code
-unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
-  unw_cursor_t cursor1;
-  unw_init_local(&cursor1, uc);
+unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
+  unw_init_local(cursor, uc);

// Walk each frame looking for a place to stop.
bool handlerNotFound = true;
while (handlerNotFound) {
  // Ask libuwind to get next frame (skip over first which is
  // _Unwind_RaiseException).
-int stepResult = unw_step(&cursor1);
+int stepResult = unw_step(cursor);
  if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached 
"
   "bottom => _URC_END_OF_STACK\n",
@@ -58,7 +57,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
  // See if frame has code to run (has personality routine).
  unw_proc_info_t frameInfo;
  unw_word_t sp;
-if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) {
+if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info 
"
   "failed => _URC_FATAL_PHASE1_ERROR\n",
   (void *)exception_object);
@@ -70,12 +69,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
-  if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf),
+  if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
   &offset) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
  functionName = ".anonymous.";
unw_word_t pc;
-  unw_get_reg(&cursor1, UNW_REG_IP, &pc);
+  unw_get_reg(cursor, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n",
@@ -93,13 +92,13 @@ unwind_phase1(unw_context_t *uc, _Unwind
(void *)exception_object, (void *)(uintptr_t)p);
_Unwind_Reason_Code personalityResult =
(*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class,
-   exception_object, (struct _Unwind_Context *)(&cursor1));
+   exception_object, (struct _Unwind_Context *)(cursor));
switch (personalityResult) {
case _URC_HANDLER_FOUND:
  // found a catch clause or locals that need destructing in this frame
  // stop search and remember stack pointer at the frame
  handlerNotFound = false;
-unw_get_reg(&cursor1, UNW_REG_SP, &sp);
+unw_get_reg(cursor, UNW_REG_SP, &sp);
  exception_object->private_2 = (uintptr_t)sp;
  _LIBUNWIND_TRACE_UNWINDING(
  "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n",
@@ -127,9 +126,8 @@ unwind_phase1(unw_context_t *uc, _Unwind


  static _Unwind_Reason_Code
-unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
-  unw_cursor_t cursor2;
-  unw_init_local(&cursor2, uc);
+unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
+  unw_init_local(cursor, uc);

_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
   (void *)exception_object);
@@ -139,7 +137,7 @@ unwind_phase2(unw_context_t *uc, _Unwind

  // Ask libuwind to get next frame (skip over first which is
  // _Unwind_RaiseException).
-int stepResult = unw_step(&cursor2);
+int stepResult = unw_step(cursor);
  if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached 
"
   "bottom => _URC_END_OF_STACK\n",
@@ -155,8 +153,8 @@ unwind_phase2(unw_context_t *uc, _Unwind
  // Get info about this frame.
  unw_word_t sp;
  unw_proc_info_t frameInfo;
-unw_get_reg(&cursor2, UNW_REG_SP, &sp);
-if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
+  

Re: [libunwind] r272680 - [libunwind] Improve unwinder stack usage - III

2016-06-14 Thread Asiri Rathnayake via cfe-commits
Sorry it took this long, got pushed down on my TODO list :)

Cheers,

/ Asiri

On Tue, Jun 14, 2016 at 5:04 PM, Jonathan Roelofs via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
>
> On 6/14/16 9:51 AM, Asiri Rathnayake via cfe-commits wrote:
>
>> Author: asiri
>> Date: Tue Jun 14 10:51:01 2016
>> New Revision: 272680
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=272680&view=rev
>> Log:
>> [libunwind] Improve unwinder stack usage - III
>>
>> Implement the same optimization committed under r271004 on non-EHABI,
>> non-SJLJ unwinder as well.
>>
>
> Thanks!
>
>
> Jon
>
>
>
>> Change-Id: I7f80ed91a75d1e778b50ba87cf8fb68658a083c7
>>
>> Modified:
>>  libunwind/trunk/src/UnwindLevel1.c
>>
>> Modified: libunwind/trunk/src/UnwindLevel1.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1.c?rev=272680&r1=272679&r2=272680&view=diff
>>
>> ==
>> --- libunwind/trunk/src/UnwindLevel1.c (original)
>> +++ libunwind/trunk/src/UnwindLevel1.c Tue Jun 14 10:51:01 2016
>> @@ -33,16 +33,15 @@
>>   #if !_LIBUNWIND_ARM_EHABI
>>
>>   static _Unwind_Reason_Code
>> -unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
>> -  unw_cursor_t cursor1;
>> -  unw_init_local(&cursor1, uc);
>> +unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception
>> *exception_object) {
>> +  unw_init_local(cursor, uc);
>>
>> // Walk each frame looking for a place to stop.
>> bool handlerNotFound = true;
>> while (handlerNotFound) {
>>   // Ask libuwind to get next frame (skip over first which is
>>   // _Unwind_RaiseException).
>> -int stepResult = unw_step(&cursor1);
>> +int stepResult = unw_step(cursor);
>>   if (stepResult == 0) {
>> _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step()
>> reached "
>>"bottom => _URC_END_OF_STACK\n",
>> @@ -58,7 +57,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
>>   // See if frame has code to run (has personality routine).
>>   unw_proc_info_t frameInfo;
>>   unw_word_t sp;
>> -if (unw_get_proc_info(&cursor1, &frameInfo) != UNW_ESUCCESS) {
>> +if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
>> _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p):
>> unw_get_proc_info "
>>"failed => _URC_FATAL_PHASE1_ERROR\n",
>>(void *)exception_object);
>> @@ -70,12 +69,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
>> char functionBuf[512];
>> const char *functionName = functionBuf;
>> unw_word_t offset;
>> -  if ((unw_get_proc_name(&cursor1, functionBuf, sizeof(functionBuf),
>> +  if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
>>&offset) != UNW_ESUCCESS) ||
>> (frameInfo.start_ip + offset > frameInfo.end_ip))
>>   functionName = ".anonymous.";
>> unw_word_t pc;
>> -  unw_get_reg(&cursor1, UNW_REG_IP, &pc);
>> +  unw_get_reg(cursor, UNW_REG_IP, &pc);
>> _LIBUNWIND_TRACE_UNWINDING(
>> "unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%"
>> PRIx64
>> ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n",
>> @@ -93,13 +92,13 @@ unwind_phase1(unw_context_t *uc, _Unwind
>> (void *)exception_object, (void *)(uintptr_t)p);
>> _Unwind_Reason_Code personalityResult =
>> (*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class,
>> -   exception_object, (struct _Unwind_Context *)(&cursor1));
>> +   exception_object, (struct _Unwind_Context *)(cursor));
>> switch (personalityResult) {
>> case _URC_HANDLER_FOUND:
>>   // found a catch clause or locals that need destructing in this
>> frame
>>   // stop search and remember stack pointer at the frame
>>   handlerNotFound = false;
>> -unw_get_reg(&cursor1, UNW_REG_SP, &sp);
>> +unw_get_reg(cursor, UNW_REG_SP, &sp);
>>   exception_object->private_2 = (uintptr_t)sp;
>>   _LIBUNWIND_TRACE_UNWINDING(
>>   "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n",
>> @@ -127,9 +126,8 @@ unwind_phase1(unw_context_t *uc, _Unwind
>>
>>
>>   static _Unwind_Reason_Code
>> -unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
>> -  unw_cursor_t cursor2;
>> -  unw_init_local(&cursor2, uc);
>> +unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception
>> *exception_object) {
>> +  unw_init_local(cursor, uc);
>>
>> _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
>>(void *)exception_object);
>> @@ -139,7 +137,7 @@ unwind_phase2(unw_context_t *uc, _Unwind
>>
>>   // Ask libuwind to get next frame (skip over first which is
>>   // _Unwind_RaiseException).
>> -int stepResult = unw_step(

Re: [PATCH] D21173: [X86] _MM_ALIGN16 attribute support for non-windows targets

2016-06-14 Thread Michael Kuperstein via cfe-commits
mkuper accepted this revision.
mkuper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D21173



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


Re: [PATCH] D18919: [Clang-tidy] Add check "modernize use using"

2016-06-14 Thread Krystyna via cfe-commits
krystyna updated this revision to Diff 60697.

Repository:
  rL LLVM

http://reviews.llvm.org/D18919

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseUsingCheck.cpp
  clang-tidy/modernize/UseUsingCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-using.rst
  test/clang-tidy/modernize-use-using.cpp

Index: test/clang-tidy/modernize-use-using.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-using.cpp
@@ -0,0 +1,82 @@
+// RUN: %check_clang_tidy %s modernize-use-using %t
+
+typedef int Type;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
+// CHECK-FIXES: using Type = int;
+
+typedef long LL;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using LL = long;
+
+typedef int Bla;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using Bla = int;
+
+typedef Bla Bla2;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using Bla2 = Bla;
+
+typedef void (*type)(int, int);
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using type = void (*)(int, int);
+
+typedef void (*type2)();
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using type2 = void (*)();
+
+class Class {
+  typedef long long Type;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef'
+  // CHECK-FIXES: using Type = long long;
+};
+
+typedef void (Class::*MyPtrType)(Bla) const;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using MyPtrType = void (Class::*)(Bla) const;
+
+class Iterable {
+public:
+  class Iterator {};
+};
+
+template 
+class Test {
+  typedef typename T::iterator Iter;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef'
+  // CHECK-FIXES: using Iter = typename T::iterator;
+};
+
+using balba = long long;
+
+union A {};
+
+typedef void (A::*PtrType)(int, int) const;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using PtrType = void (A::*)(int, int) const;
+
+typedef Class some_class;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using some_class = Class;
+
+typedef Class Cclass;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using Cclass = Class;
+
+typedef Cclass cclass2;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using cclass2 = Cclass;
+
+class cclass {};
+
+typedef void (cclass::*MyPtrType3)(Bla);
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using MyPtrType3 = void (cclass::*)(Bla);
+
+using my_class = int;
+
+typedef Test another;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using another = Test;
+
+typedef int bla1, bla2, bla3;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
Index: docs/clang-tidy/checks/modernize-use-using.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-using.rst
@@ -0,0 +1,26 @@
+.. title:: clang-tidy - modernize-use-using
+
+modernize-use-using
+===
+
+Use C++11's ``using`` instead of ``typedef``.
+
+Before:
+
+.. code:: c++
+
+  typedef int variable;
+
+  class Class{};
+  typedef void (Class::* MyPtrType)() const;
+
+After:
+
+.. code:: c++
+
+  using variable = int;
+
+  class Class{};
+  using MyPtrType = void (Class::*)() const;
+
+This check requires using C++11 or higher to run.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -105,6 +105,7 @@
modernize-use-default
modernize-use-nullptr
modernize-use-override
+   modernize-use-using
performance-faster-string-find
performance-for-range-copy
performance-implicit-cast-in-loop
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -201,6 +201,11 @@
 
   Finds integer literals which are cast to bool.
 
+- New `modernize-use-using
+  `_ check
+
+  Finds typedefs and replaces it with usings.
+
 - New `performance-faster-string-find
   `_ check
 
Index: clang-tidy/modernize/UseUsingCheck.h
===
--- /dev/null
+++ clang-

Re: r272604 - [docs] Coverage: Document the profile merge pool specifier

2016-06-14 Thread Vedant Kumar via cfe-commits
I think David got rid of that limitation.

The related warning in compiler-rt does not reflect this:

  PROF_WARN("%%m specifier can only be specified once at the end of %s.\n", 
...);

Fixed the warning in r272685.

thanks,
vedant

> On Jun 13, 2016, at 8:13 PM, Sean Silva  wrote:
> 
> 
> 
> On Mon, Jun 13, 2016 at 5:42 PM, Vedant Kumar via cfe-commits 
>  wrote:
> Author: vedantk
> Date: Mon Jun 13 19:42:12 2016
> New Revision: 272604
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=272604&view=rev
> Log:
> [docs] Coverage: Document the profile merge pool specifier
> 
> Modified:
> cfe/trunk/docs/SourceBasedCodeCoverage.rst
> 
> Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=272604&r1=272603&r2=272604&view=diff
> ==
> --- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
> +++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Mon Jun 13 19:42:12 2016
> @@ -78,6 +78,14 @@ directory structure will be created.  Ad
> 
>  * "%h" expands out to the hostname of the machine running the program.
> 
> +* "%Nm" expands out to the instrumented binary's signature. When this pattern
> +  is specified, the runtime creates a pool of N raw profiles which are used 
> for
> +  on-line profile merging. The runtime takes care of selecting a raw profile
> +  from the pool, locking it, and updating it before the program exits.  If N 
> is
> +  not specified (i.e the pattern is "%m"), it's assumed that ``N = 1``. N 
> must
> +  be between 1 and 9. The merge pool specifier can only occur once per 
> filename
> +  pattern.
> 
> There's also a limitation on the position IIRC (has to be at end).
> 
> -- Sean Silva
>  
> +
>  .. code-block:: console
> 
>  # Step 2: Run the program.
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 

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


[PATCH] D21329: Rename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD configuration in-tree.

2016-06-14 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: mclow.lists, dim, emaste, theraven.
EricWF added a subscriber: cfe-commits.
Herald added a subscriber: emaste.

This patch does the following:

* It renames `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR` to 
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`. 
* It automatically enables this option on FreeBSD in ABI V1, since that's the 
current ABI FreeBSD ships.
* It cleans up the handling of this option in `std::pair`.

I would like the sign off from the FreeBSD maintainers. They will no longer 
need to keep their `__config` changes downstream.

I'm still hoping to come up with a better way to maintain the ABI without 
needing these constructors.

http://reviews.llvm.org/D21329

Files:
  include/__config
  include/utility
  test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp

Index: test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
===
--- /dev/null
+++ test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
@@ -0,0 +1,55 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template  struct pair
+
+// Doesn't pass due to use of is_trivially_* trait.
+// XFAIL: gcc-4.9
+
+// Test that we properly provide the old non-trivial copy operations
+// when the ABI macro is defined.
+
+#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+#include 
+#include 
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
+struct Dummy {
+  Dummy(Dummy const&) = delete;
+  Dummy(Dummy &&) = default;
+};
+#endif
+
+int main()
+{
+typedef std::pair P;
+{
+static_assert(std::is_copy_constructible::value, "");
+static_assert(!std::is_trivially_copy_constructible::value, "");
+}
+#if TEST_STD_VER >= 11
+{
+static_assert(std::is_move_constructible::value, "");
+static_assert(!std::is_trivially_move_constructible::value, "");
+}
+{
+using P1 = std::pair;
+// This line fails because the non-trivial constructors do not provide
+// SFINAE.
+// static_assert(!std::is_copy_constructible::value, "");
+static_assert(!std::is_trivially_copy_constructible::value, "");
+static_assert(std::is_move_constructible::value, "");
+static_assert(!std::is_trivially_move_constructible::value, "");
+}
+#endif
+}
Index: include/utility
===
--- include/utility
+++ include/utility
@@ -285,9 +285,6 @@
 _T1 first;
 _T2 second;
 
-// pair(const pair&) = default;
-// pair(pair&&) = default;
-
 #ifndef _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
 template , _Dummy>::value &&
@@ -310,18 +307,30 @@
   )
 : first(__p.first), second(__p.second) {}
 
-#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-_LIBCPP_INLINE_VISIBILITY
-pair(const pair& __p) = default;
-#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
 _LIBCPP_INLINE_VISIBILITY
 pair(const pair& __p)
 _NOEXCEPT_(is_nothrow_copy_constructible::value &&
is_nothrow_copy_constructible::value)
 : first(__p.first),
   second(__p.second)
 {
 }
+
+# ifndef _LIBCPP_CXX03_LANG
+_LIBCPP_INLINE_VISIBILITY
+pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible::value &&
+is_nothrow_move_constructible::value)
+: first(_VSTD::forward(__p.first)),
+  second(_VSTD::forward(__p.second))
+{
+}
+# endif
+#elif !defined(_LIBCPP_CXX03_LANG)
+pair(pair const&) = default;
+pair(pair&&) = default;
+#else
+  // Use the implicitly declared copy constructor in C++03
 #endif
 
 _LIBCPP_INLINE_VISIBILITY
@@ -353,19 +362,6 @@
 : first(_VSTD::forward<_U1>(__p.first)),
   second(_VSTD::forward<_U2>(__p.second)) {}
 
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
-_LIBCPP_INLINE_VISIBILITY
-pair(pair&& __p) = default;
-#else
-_LIBCPP_INLINE_VISIBILITY
-pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible::value &&
-is_nothrow_move_constructible::value)
-: first(_VSTD::forward(__p.first)),
-  second(_VSTD::forward(__p.second))
-{
-}
-#endif
-
 _LIBCPP_INLINE_VISIBILITY
 pair&
 operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable::value &&
Index: include/__config

Re: [PATCH] D21241: Add an ASTMatcher for ignoring ExprWithCleanups.

2016-06-14 Thread Tim Shen via cfe-commits
timshen updated this revision to Diff 60704.
timshen added a comment.

Done.


http://reviews.llvm.org/D21241

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Index: unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1997,5 +1997,34 @@
   EXPECT_TRUE(notMatches(CppString2, returnStmt(forFunction(hasName("F");
 }
 
+TEST(IgnoringExprWithCleanups, MatchesExprWithCleanups) {
+  EXPECT_TRUE(
+  matches("struct A { ~A(); }; A Foo(); A x = Foo();",
+  varDecl(hasInitializer(ignoringExprWithCleanups(
+  cxxConstructExpr(has(materializeTemporaryExpr(;
+}
+
+TEST(IgnoringExprWithCleanups, MatchesWithoutExprWithCleanups) {
+  EXPECT_TRUE(matches(
+  "int x = 0; const int y = x;",
+  varDecl(hasInitializer(ignoringExprWithCleanups(
+  ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("x"));
+}
+
+TEST(IgnoringExprWithCleanups, DoesNotMatchIncorrectly) {
+  EXPECT_TRUE(notMatches("char c = ((3));",
+ varDecl(hasInitializer(ignoringExprWithCleanups(
+ ignoringParenImpCasts(unless(anything(;
+  EXPECT_TRUE(notMatches("float y = (float(0));",
+ varDecl(hasInitializer(ignoringExprWithCleanups(
+ ignoringParenImpCasts(integerLiteral()));
+  EXPECT_TRUE(notMatches("float y = (float)0;",
+ varDecl(hasInitializer(ignoringExprWithCleanups(
+ ignoringParenImpCasts(integerLiteral()));
+  EXPECT_TRUE(notMatches("char* p = static_cast(0);",
+ varDecl(hasInitializer(ignoringExprWithCleanups(
+ ignoringParenImpCasts(integerLiteral()));
+}
+
 } // namespace ast_matchers
 } // namespace clang
Index: lib/ASTMatchers/Dynamic/Registry.cpp
===
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -265,6 +265,7 @@
   REGISTER_MATCHER(hasUnarySelector);
   REGISTER_MATCHER(hasValueType);
   REGISTER_MATCHER(ifStmt);
+  REGISTER_MATCHER(ignoringExprWithCleanups);
   REGISTER_MATCHER(ignoringImpCasts);
   REGISTER_MATCHER(ignoringParenCasts);
   REGISTER_MATCHER(ignoringParenImpCasts);
Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -625,6 +625,16 @@
   return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder);
 }
 
+/// \brief Matches expressions that match InnerMatcher after ExprWithCleanups
+/// are stripped off.
+AST_MATCHER_P(Expr, ignoringExprWithCleanups, internal::Matcher,
+  InnerMatcher) {
+  auto E = &Node;
+  if (auto Cleanups = dyn_cast(E))
+E = Cleanups->getSubExpr();
+  return InnerMatcher.matches(*E, Finder, Builder);
+}
+
 /// \brief Matches types that match InnerMatcher after any parens are stripped.
 ///
 /// Given
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -2347,7 +2347,7 @@
   private:   int c;
   };
 fieldDecl(isPrivate())
-  matches 'int c;' 
+  matches 'int c;'
 
 
 
@@ -2361,7 +2361,7 @@
   private:   int c;
   };
 fieldDecl(isProtected())
-  matches 'int b;' 
+  matches 'int b;'
 
 
 
@@ -2375,7 +2375,7 @@
   private:   int c;
   };
 fieldDecl(isPublic())
-  matches 'int a;' 
+  matches 'int a;'
 
 
 
@@ -4432,6 +4432,12 @@
 
 
 
+MatcherExpr>ignoringExprWithCleanupsMatcherExpr> InnerMatcher
+Matches expressions that match InnerMatcher after ExprWithCleanups
+are stripped off.
+
+
+
 MatcherExpr>ignoringImpCastsMatcherExpr> InnerMatcher
 Matches expressions that match InnerMatcher after any implicit casts
 are stripped off.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] D21098: [libcxx] [test] Replace __cplusplus comparisons with TEST_STD_VER and __has_feature with TEST_HAS_FEATURE.

2016-06-14 Thread Stephan T. Lavavej via cfe-commits
[Eric Fiselier] 
> Please change the `TEST_HAS_FEATURE(XXX)` into `TEST_STD_VER >= 11` for the 
> following C++11 features:
> - `cxx_noexcept`
> - `cxx_atomic`
> - `cxx_access_control_sfinae`
> Also if the entire test is wrapped in a `TEST_HAS_FEATURE(XXX)` please 
> translate that into a `// UNSUPPORTED: c++98, c++03` comment at the top of 
> the file.

Sure. Would you like cxx_attributes and/or cxx_strong_enums to receive the same 
treatment?

STL
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21256: Improved Visual Studio 2015 visualization of SmallVectorImpl

2016-06-14 Thread Michael Spertus via cfe-commits
On Mon, Jun 13, 2016 at 11:27 AM, Zachary Turner  wrote:

> I agree that it can be annoying to say "hey guys, i would normally do post
> commit review on this, but i wanted to give the courtesy of a heads up",
> and then potentially waiting an indeterminate amount of time.
>
> I think that actually discourages these kind of changes going up at all,
> because people will just say "well that's easy i just won't give the heads
> up then", which i think would be a net loss


I agree with this (which is why I did it the way I did in the first
place!).  While I'm not planning on doing a "heads up" diff going forward
unless there is a change in community standards, do we want to consider
such a change in community standards? How would that happen?

Thanks,
Mike


> On Mon, Jun 13, 2016 at 9:10 AM Aaron Ballman 
> wrote:
>
>> On Mon, Jun 13, 2016 at 11:55 AM, Michael Spertus 
>> wrote:
>> > Hi David,
>> > While I understand the initial reasoning. I have found that this is
>> like a
>> > hundred times better for working on Clang in practice and can't imagine
>> > working without it. The point is that many Clang data structures contain
>> > SmallVectors and having to do zero expansion clicks instead of multiple
>> each
>> > time you take a step through the code is really helpful. If you want me
>> to
>> > back it out and rereview we can, but I'd encourage you to try it out
>> first.
>>
>> Yeah, SmallVectors are somewhat click-heavy in MSVC currently. I've
>> not had the chance to try this patch out on anything practical, but it
>> seems like it is an improvement from what I've seen.
>>
>> > To ask more about the aside, I'm sorry if I violated community norms.
>> Let me
>> > tell you my reasoning, and you can clarify how I should handle in the
>> > future: Aaron approved me to do post-commit reviews on natvis changes,
>> which
>> > I have done frequently. For this change, I wasn't putting it into
>> > phabricator because I thought pre-commit approval is required but more
>> as a
>> > heads up. Should I change that to be if I don't feel comfortable
>> submitting
>> > without phabricator, then do the full review process?
>>
>> When you want to give the community a heads up on something, putting
>> it into phab (or starting an RFC thread on the mailing list) is a good
>> choice. However, when you start a patch in phab, it's good form to
>> wait for a reviewer to sign off before committing even if you could
>> also handle it with post-commit review. I'm not too worried about this
>> change, so I'm not suggesting it should be backed out.
>>
>> ~Aaron
>>
>> >
>> > Thanks,
>> >
>> > Mike
>> >
>> > On Mon, Jun 13, 2016 at 10:16 AM, David Blaikie 
>> wrote:
>> >>
>> >> As for the original change proposed: My guiding principle would be "do
>> >> whatever std::vector does". (& that's what I did when implementing GDB
>> >> pretty printers for SmallVector/SmallString/ArrayRef, etc... )
>> >>
>> >> An aside: We generally don't do time limited reviews like this. Either
>> >> something needs review because you're not sure about it, or it
>> doesn't. It
>> >> sounds like the feedback you were looking for probably would've been
>> fine a
>> >> post-commit review feedback just as easily & perhaps might've been a
>> better
>> >> option. (while in this case it was fine - it's sort of a community
>> >> habit/standards thing - we don't want to create the idea that lack of
>> >> feedback is consent/approval in the review process)
>> >>
>> >> On Sun, Jun 12, 2016 at 7:01 PM, Mike Spertus via cfe-commits
>> >>  wrote:
>> >>>
>> >>> mspertus closed this revision.
>> >>> mspertus added a comment.
>> >>>
>> >>> revision 272525
>> >>>
>> >>>
>> >>> http://reviews.llvm.org/D21256
>> >>>
>> >>>
>> >>>
>> >>> ___
>> >>> cfe-commits mailing list
>> >>> cfe-commits@lists.llvm.org
>> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> >>
>> >>
>> >
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21098: [libcxx] [test] Replace __cplusplus comparisons with TEST_STD_VER and __has_feature with TEST_HAS_FEATURE.

2016-06-14 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D21098#457726, @STL_MSFT wrote:

> [Eric Fiselier]
>
> > Please change the `TEST_HAS_FEATURE(XXX)` into `TEST_STD_VER >= 11` for the 
> > following C++11 features:
>
> > 
>
> > - `cxx_noexcept`
>
> > - `cxx_atomic`
>
> > - `cxx_access_control_sfinae` Also if the entire test is wrapped in a 
> > `TEST_HAS_FEATURE(XXX)` please translate that into a `// UNSUPPORTED: 
> > c++98, c++03` comment at the top of the file.
>
>
> Sure. Would you like cxx_attributes and/or cxx_strong_enums to receive the 
> same treatment?


Yeah, `cxx_strong_enums` and `cxx_attributes` can be changed as well. I wasn't 
on top of it last night apparently.

Thank you for this patch. I know it's huge but it's also a huge improvement.

> STL





http://reviews.llvm.org/D21098



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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-14 Thread Richard Smith via cfe-commits
rsmith added a comment.

This still looks like it will have has lots of false positives for cases like:

  struct __attribute__((packed)) A {
char c;
int n;
  } a;
  void *p = &a.n;

It also looks like it will now have false negatives for cases like:

  memcpy(x, y, *&a.n);

I think whitelisting specific functions is not a reasonable approach here; 
instead, how about deferring the check until you see how the misaligned pointer 
is used? A couple of approaches seem feasible:

- you could extend the conversion-checking code in SemaChecking to look for 
such misaligned operations that are not immediately converted to a pointer type 
with suitable (lower) alignment requirements
- you could build a list in Sema of the cases that are pending a diagnostic, 
produce diagnostics at the end of the full-expression, and remove items from 
the list when you see a suitable conversion applied to them

In any case, this diagnostic should apply to reference binding as well as 
pointers.

GCC appears to check this as a separate step, at least after it applies its 
fold; for example:

  struct __attribute__((packed, aligned(4))) S { char c[4]; int n; } s;
  int k;
  int &r = true ? s.n : k; // gcc rejects, "cannot bind paced field 's.S::n' to 
'int&'
  int &s = false ? s.n : k; // gcc accepts


http://reviews.llvm.org/D20561



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


Re: [PATCH] D20772: Automatically detect export lists for OS X.

2016-06-14 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

Accepting to commit.


http://reviews.llvm.org/D20772



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


Re: [PATCH] D21317: [sanitizer] Allow sanitize coverage w/o sanitizers.

2016-06-14 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

ubsan_standalone (that's what the needsUbsanRt change is for).


Repository:
  rL LLVM

http://reviews.llvm.org/D21317



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


Re: Virtual patch: `svn mv lib/Headers/Intrin.h lib/Headers/intrin.h`

2016-06-14 Thread Nico Weber via cfe-commits
I locally set up an SVN repo with a file called "File.txt" and then renamed
it with `svn mv` using a new svn client (1.8).

Then I tried updating several local checkouts of my local repo with svn
1.6.6 clients. All methods of updating I tried (`svn up`, `svn co
current_checkout_url@2`) worked without problems. So this does seem to work
fine as far as I can tell.

On Wed, Jun 8, 2016 at 1:38 PM, Nico Weber  wrote:

> On Wed, Jun 8, 2016 at 1:27 PM, Hans Wennborg  wrote:
>
>> On Wed, Jun 8, 2016 at 10:20 AM, Nico Weber  wrote:
>> > It looks like we're starting to be more careful about header case.
>> MSVC's
>> > intrin.h is called intrin.h with a lower-case 'i'; ours starts with an
>> > upper-case 'I' for no good reason.
>> >
>> > It looks like file-only renames work fine as of svn 1.7 without any
>> > workarounds
>> > (
>> http://subversion.apache.org/docs/release-notes/1.7.html#windows-case-change
>> ),
>> > so let's `svn mv` the file to its correct case.
>> >
>> > SGTM?
>>
>> Hmm, from http://subversion.apache.org/faq.html#case-change it seems
>> users with pre-1.7 svn might run into problems when updating past the
>> name change? Do users with such ancient versions still exist? Turns
>> out I seem to be on svn 1.6.6 myself :-/
>>
>
> 1.7 was released 6 years ago. I think it's ok if people who use an old svn
> need to do some manual work when they update. I can mention what people
> need to do in the CL description (also explained at
> http://subversion.apache.org/faq.html#case-change).
>
> I'm guessing most people get clang via the git mirror, and I think with
> git this will hopefully just work (?)
>
> Anyone else out there still on svn 1.6? Hans uses Chromium's depot_tools
> svn (and Chromium's clang/win/tot bots do too, so they'll need some care),
> but I'd expect that most people who don't happen to work on Chromium
> probably have a newer svn by now?
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21317: [sanitizer] Allow sanitize coverage w/o sanitizers.

2016-06-14 Thread Kostya Serebryany via cfe-commits
kcc added a comment.

Can you at least add a compiler-rt test where we ensure that this flag can not 
be used such that it wil compile but fail to link?

E.g.

  clang -fsanitize-coverage=edge x.c 

should compile *and* link (and run)


Repository:
  rL LLVM

http://reviews.llvm.org/D21317



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-14 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

FTR, I finally test it out for compile time and could not notice any difference 
besides noise. Thanks Eric!


http://reviews.llvm.org/D19843



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


r272695 - [perf-training] Ignore 'Profile Note' warnings from the runtime

2016-06-14 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Tue Jun 14 14:06:48 2016
New Revision: 272695

URL: http://llvm.org/viewvc/llvm-project?rev=272695&view=rev
Log:
[perf-training] Ignore 'Profile Note' warnings from the runtime

After r272599, -DLLVM_BUILD_INSTRUMENTED passes a default argument to
-fprofile-instr-generate. This confuses the perf-helper script because
the runtime emits a note stating that the default is overridden by the
LLVM_PROFILE_FILE environment variable.

Change the perf-helper script s.t it does not treat these notes as
failures.

This isn't a strictly NFC change, but I don't see a simple way to add a
test for it.

Modified:
cfe/trunk/utils/perf-training/perf-helper.py

Modified: cfe/trunk/utils/perf-training/perf-helper.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/perf-helper.py?rev=272695&r1=272694&r2=272695&view=diff
==
--- cfe/trunk/utils/perf-training/perf-helper.py (original)
+++ cfe/trunk/utils/perf-training/perf-helper.py Tue Jun 14 14:06:48 2016
@@ -122,6 +122,7 @@ def get_cc1_command_for_args(cmd, env):
   ln.startswith('Target:') or
   ln.startswith('Thread model:') or
   ln.startswith('InstalledDir:') or
+  ln.startswith('LLVM Profile Note') or
   ' version ' in ln):
   continue
   cc_commands.append(ln)


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


Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60718.
pirama added a comment.
Herald added subscribers: danalbert, tberghammer.

- Add TargetInfo for 32-bit and 64-bit RenderScript


http://reviews.llvm.org/D20602

Files:
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Expr.cpp
  lib/Basic/Targets.cpp
  lib/Sema/SemaExprMember.cpp
  test/CodeGen/ext-vector.c
  test/CodeGen/renderscript.c
  test/Misc/warning-flags.c
  test/Sema/ext_vector_components.c
  test/SemaOpenCL/ext_vectors.cl

Index: test/SemaOpenCL/ext_vectors.cl
===
--- /dev/null
+++ test/SemaOpenCL/ext_vectors.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+
+void test_ext_vector_accessors(float4 V) {
+  V = V.wzyx;
+  V = V.abgr; // expected-warning {{vector component name 'a' is an OpenCL version 2.2 feature}}
+  V = V.xyzr; // expected-warning {{vector component name 'r' is an OpenCL version 2.2 feature}} \
+  // expected-error {{illegal vector component name 'r'}}
+}
Index: test/Sema/ext_vector_components.c
===
--- test/Sema/ext_vector_components.c
+++ test/Sema/ext_vector_components.c
@@ -39,6 +39,33 @@
 vec4.x = vec16.sF;
   
 vec4p->yz = vec4p->xy;
+
+vec2.a; // expected-error {{vector component access exceeds type 'float2'}}
+vec2.rgba; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.rgba; // expected-warning {{expression result unused}}
+vec4.rgbz; // expected-error {{illegal vector component name 'z'}}
+vec4.rgbc; // expected-error {{illegal vector component name 'c'}}
+vec4.xyzr; // expected-error {{illegal vector component name 'r'}}
+vec4.s01b; // expected-error {{vector component access exceeds type 'float4'}}
+
+vec3 = vec4.rgb; // legal, shorten
+f = vec2.r; // legal, shorten
+f = vec4.rg.r; // legal, shorten
+vec4_2.rgba = vec4.xyzw; // legal, no intermingling
+
+vec4_2.rgbr = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgbb = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgga = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.x = f;
+vec2.rr = vec2_2.rg; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.gr = vec2_2.rg;
+vec2.gr.g = vec2_2.r;
+vec4 = (float4){ 1,2,3,4 };
+vec4.rg.b; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.r = vec16.sf;
+vec4.g = vec16.sF;
+
+vec4p->gb = vec4p->rg;
 }
 
 float2 lo(float3 x) { return x.lo; }
Index: test/Misc/warning-flags.c
===
--- test/Misc/warning-flags.c
+++ test/Misc/warning-flags.c
@@ -18,15 +18,16 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (84):
+CHECK: Warnings without flags (85):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
 CHECK-NEXT:   ext_initializer_string_for_char_array_too_long
 CHECK-NEXT:   ext_missing_declspec
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
+CHECK-NEXT:   ext_opencl_ext_vector_type_rgba_selector
 CHECK-NEXT:   ext_plain_complex
 CHECK-NEXT:   ext_template_arg_extra_parens
 CHECK-NEXT:   ext_typecheck_comparison_of_pointer_integer
Index: test/CodeGen/renderscript.c
===
--- /dev/null
+++ test/CodeGen/renderscript.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=renderscript32 -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS32
+// RUN: %clang_cc1 %s -triple=renderscript64 -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS64
+// RUN: %clang_cc1 %s -triple=armv7-none-linux-gnueabi -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-ARM
+
+// Ensure that the bitcode has the correct triple
+// CHECK-RS32: target triple = "armv7-none-linux-gnueabi"
+// CHECK-RS64: target triple = "aarch64-linux-android"
+// CHECK-ARM: target triple = "armv7-none-linux-gnueabi"
+
+// Ensure that long data type has 8-byte size and alignment in RenderScript
+#ifdef __RENDERSCRIPT__
+#define LONG_WIDTH_AND_ALIGN 8
+#else
+#define LONG_WIDTH_AND_ALIGN 4
+#endif
+
+_Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+
+// CHECK-RS32: i64 @test_long(i64 %v)
+// CHECK-RS64: i64 @test

[PATCH] D21334: Add TargetInfo for 32-bit and 64-bit RenderScript

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama created this revision.
pirama added reviewers: rsmith, echristo.
pirama added subscribers: srhines, cfe-commits.
Herald added subscribers: mehdi_amini, danalbert, tberghammer, aemerson.

The TargetInfo for 'renderscript32' and 'renderscript64' ArchTypes are
subclasses of ARMleTargetInfo and AArch64leTargetInfo respectively.

RenderScript32TargetInfo modifies the ARM ABI to set LongWidth and
LongAlign to be 64-bits.  Other than this modification, the underlying
TargetInfo base classes is initialized as if they have "armv7" and
"aarch64" architecture type respectively.

http://reviews.llvm.org/D21334

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/renderscript.c

Index: test/CodeGen/renderscript.c
===
--- /dev/null
+++ test/CodeGen/renderscript.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=renderscript32 -emit-llvm -o - -Werror | 
FileCheck %s -check-prefix=CHECK-RS32
+// RUN: %clang_cc1 %s -triple=renderscript64 -emit-llvm -o - -Werror | 
FileCheck %s -check-prefix=CHECK-RS64
+// RUN: %clang_cc1 %s -triple=armv7-none-linux-gnueabi -emit-llvm -o - -Werror 
| FileCheck %s -check-prefix=CHECK-ARM
+
+// Ensure that the bitcode has the correct triple
+// CHECK-RS32: target triple = "armv7-none-linux-gnueabi"
+// CHECK-RS64: target triple = "aarch64-linux-android"
+// CHECK-ARM: target triple = "armv7-none-linux-gnueabi"
+
+// Ensure that long data type has 8-byte size and alignment in RenderScript
+#ifdef __RENDERSCRIPT__
+#define LONG_WIDTH_AND_ALIGN 8
+#else
+#define LONG_WIDTH_AND_ALIGN 4
+#endif
+
+_Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+
+// CHECK-RS32: i64 @test_long(i64 %v)
+// CHECK-RS64: i64 @test_long(i64 %v)
+// CHECK-ARM: i32 @test_long(i32 %v)
+long test_long(long v) {
+  return v + 1;
+}
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7992,6 +7992,43 @@
 return true;
   }
 };
+
+// 32-bit RenderScript is armv7 with width and align of 'long' set to 8-bytes
+class RenderScript32TargetInfo : public ARMleTargetInfo {
+public:
+  RenderScript32TargetInfo(const llvm::Triple &Triple,
+   const TargetOptions &Opts)
+  : ARMleTargetInfo(
+  llvm::Triple("armv7", Triple.getVendorName(), Triple.getOSName(),
+Triple.getEnvironmentName()),
+  Opts)
+  {
+LongWidth = LongAlign = 64;
+  }
+  void getTargetDefines(const LangOptions &Opts,
+MacroBuilder &Builder) const override {
+Builder.defineMacro("__RENDERSCRIPT__");
+ARMleTargetInfo::getTargetDefines(Opts, Builder);
+  }
+};
+
+// 64-bit RenderScript is aarch64
+class RenderScript64TargetInfo : public AArch64leTargetInfo {
+public:
+  RenderScript64TargetInfo(const llvm::Triple &Triple,
+   const TargetOptions &Opts)
+  : AArch64leTargetInfo(
+  llvm::Triple("aarch64", Triple.getVendorName(), Triple.getOSName(),
+   Triple.getEnvironmentName()),
+  Opts) { }
+
+  void getTargetDefines(const LangOptions &Opts,
+MacroBuilder &Builder) const override {
+Builder.defineMacro("__RENDERSCRIPT__");
+AArch64leTargetInfo::getTargetDefines(Opts, Builder);
+  }
+};
+
 } // end anonymous namespace
 
 
//===--===//
@@ -8420,6 +8457,11 @@
 if (!(Triple == llvm::Triple("wasm64-unknown-unknown")))
   return nullptr;
 return new WebAssemblyOSTargetInfo(Triple, Opts);
+
+  case llvm::Triple::renderscript32:
+return new LinuxTargetInfo(Triple, Opts);
+  case llvm::Triple::renderscript64:
+return new LinuxTargetInfo(Triple, Opts);
   }
 }
 


Index: test/CodeGen/renderscript.c
===
--- /dev/null
+++ test/CodeGen/renderscript.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=renderscript32 -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS32
+// RUN: %clang_cc1 %s -triple=renderscript64 -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS64
+// RUN: %clang_cc1 %s -triple=armv7-none-linux-gnueabi -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-ARM
+
+// Ensure that the bitcode has the correct triple
+// CHECK-RS32: target triple = "armv7-none-linux-gnueabi"
+// CHECK-RS64: target triple = "aarch64-linux-android"
+// CHECK-ARM: target triple = "armv7-none-linux-gnueabi"
+
+// Ensure that long data type has 8-byte size and alignment in RenderScript
+#ifdef __RENDERSCRIPT__
+#define LONG_WIDTH_AND_ALIGN 8
+#else
+#define LONG_WIDTH_AND_ALIGN 4
+#endif
+
+_Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+
+

Re: [PATCH] D21334: Add TargetInfo for 32-bit and 64-bit RenderScript

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a comment.

http://reviews.llvm.org/D21333 is the corresponding patch to LLVM


http://reviews.llvm.org/D21334



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


Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60723.
pirama added a comment.

- Undo bad merge from different patch


http://reviews.llvm.org/D20602

Files:
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Expr.cpp
  lib/Sema/SemaExprMember.cpp
  test/CodeGen/ext-vector.c
  test/Misc/warning-flags.c
  test/Sema/ext_vector_components.c
  test/SemaOpenCL/ext_vectors.cl

Index: test/SemaOpenCL/ext_vectors.cl
===
--- /dev/null
+++ test/SemaOpenCL/ext_vectors.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+
+void test_ext_vector_accessors(float4 V) {
+  V = V.wzyx;
+  V = V.abgr; // expected-warning {{vector component name 'a' is an OpenCL version 2.2 feature}}
+  V = V.xyzr; // expected-warning {{vector component name 'r' is an OpenCL version 2.2 feature}} \
+  // expected-error {{illegal vector component name 'r'}}
+}
Index: test/Sema/ext_vector_components.c
===
--- test/Sema/ext_vector_components.c
+++ test/Sema/ext_vector_components.c
@@ -39,6 +39,33 @@
 vec4.x = vec16.sF;
   
 vec4p->yz = vec4p->xy;
+
+vec2.a; // expected-error {{vector component access exceeds type 'float2'}}
+vec2.rgba; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.rgba; // expected-warning {{expression result unused}}
+vec4.rgbz; // expected-error {{illegal vector component name 'z'}}
+vec4.rgbc; // expected-error {{illegal vector component name 'c'}}
+vec4.xyzr; // expected-error {{illegal vector component name 'r'}}
+vec4.s01b; // expected-error {{vector component access exceeds type 'float4'}}
+
+vec3 = vec4.rgb; // legal, shorten
+f = vec2.r; // legal, shorten
+f = vec4.rg.r; // legal, shorten
+vec4_2.rgba = vec4.xyzw; // legal, no intermingling
+
+vec4_2.rgbr = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgbb = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec4_2.rgga = vec4.rgba; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.x = f;
+vec2.rr = vec2_2.rg; // expected-error {{vector is not assignable (contains duplicate components)}}
+vec2.gr = vec2_2.rg;
+vec2.gr.g = vec2_2.r;
+vec4 = (float4){ 1,2,3,4 };
+vec4.rg.b; // expected-error {{vector component access exceeds type 'float2'}}
+vec4.r = vec16.sf;
+vec4.g = vec16.sF;
+
+vec4p->gb = vec4p->rg;
 }
 
 float2 lo(float3 x) { return x.lo; }
Index: test/Misc/warning-flags.c
===
--- test/Misc/warning-flags.c
+++ test/Misc/warning-flags.c
@@ -18,15 +18,16 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (84):
+CHECK: Warnings without flags (85):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
 CHECK-NEXT:   ext_initializer_string_for_char_array_too_long
 CHECK-NEXT:   ext_missing_declspec
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name
 CHECK-NEXT:   ext_new_paren_array_nonconst
+CHECK-NEXT:   ext_opencl_ext_vector_type_rgba_selector
 CHECK-NEXT:   ext_plain_complex
 CHECK-NEXT:   ext_template_arg_extra_parens
 CHECK-NEXT:   ext_typecheck_comparison_of_pointer_integer
Index: test/CodeGen/ext-vector.c
===
--- test/CodeGen/ext-vector.c
+++ test/CodeGen/ext-vector.c
@@ -301,3 +301,40 @@
   char valC;
   char16 destVal = valC ? valA : valB;
 }
+
+typedef __attribute__(( ext_vector_type(16) )) float float16;
+
+float16 vec16, vec16_2;
+
+// CHECK: @test_rgba
+void test_rgba() {
+  // CHECK: fadd <4 x float>
+  vec4_2 = vec4.abgr + vec4;
+
+  // CHECK: shufflevector {{.*}} 
+  vec2 = vec4.rg;
+  // CHECK: shufflevector {{.*}} 
+  vec2_2 = vec4.ba;
+  // CHECK: extractelement {{.*}} 2
+  f = vec4.b;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec4_2.;
+
+  // CHECK: insertelement {{.*}} 0
+  vec2.r = f;
+  // CHECK: shufflevector {{.*}} 
+  vec2.gr = vec2;
+
+  // CHECK: extractelement {{.*}} 0
+  f = vec4_2.rg.r;
+  // CHECK: shufflevector {{.*}} 
+  // CHECK: shufflevector {{.*}} 
+  // CHECK: shufflevector {{.*}} 
+  vec4.rgb = vec4.bgr;
+
+  // CHECK: extractelement {{.*}} 11
+  // CHECK: insertelement {{.*}} 2
+  vec4.b = vec16.sb;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec16.sabcd;
+}
Index: lib/Sema/SemaExprMember.cpp
===
--- lib/Sema/SemaExprMember.cpp
+++ lib/Se

Re: [PATCH] D20709: For RenderScript, set alignment and width of long to 64-bits

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a comment.

http://reviews.llvm.org/D21333 and http://reviews.llvm.org/D21334 add the 
RenderScript triple and modify 'long' based off the triple.

r272317, r272342, r272438 take care of the LangOpt and handling of  '-x 
renderscript' and '.rs' extensions.


http://reviews.llvm.org/D20709



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


Re: [PATCH] D21334: Add TargetInfo for 32-bit and 64-bit RenderScript

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a comment.

This patch is based on the discussion in http://reviews.llvm.org/D20709.


http://reviews.llvm.org/D21334



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


Re: r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
On it, sorry about it.

> On Jun 14, 2016, at 4:51 PM, Rafael Espíndola  
> wrote:
> 
> Looks like this broke the docs:
> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/14690/steps/docs-clang-html/logs/stdio
> 
> Cheers,
> Rafael
> 
> 
> On 14 June 2016 at 08:04, Adam Nemet via cfe-commits
>  wrote:
>> Author: anemet
>> Date: Tue Jun 14 07:04:26 2016
>> New Revision: 272656
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=272656&view=rev
>> Log:
>> Add loop pragma for Loop Distribution
>> 
>> Summary:
>> This is similar to other loop pragmas like 'vectorize'.  Currently it
>> only has state values: distribute(enable) and distribute(disable).  When
>> one of these is specified the corresponding loop metadata is generated:
>> 
>>  !{!"llvm.loop.distribute.enable", i1 true/false}
>> 
>> As a result, loop distribution will be attempted on the loop even if
>> Loop Distribution in not enabled globally.  Analogously, with 'disable'
>> distribution can be turned off for an individual loop even when the pass
>> is otherwise enabled.
>> 
>> There are some slight differences compared to the existing loop pragmas.
>> 
>> 1. There is no 'assume_safety' variant which makes its handling slightly
>> different from 'vectorize'/'interleave'.
>> 
>> 2. Unlike the existing loop pragmas, it does not have a corresponding
>> numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
>> consistency checks in CheckForIncompatibleAttributes we don't need to
>> check it against other pragmas.  We just need to check for duplicates of
>> the same pragma.
>> 
>> Reviewers: rsmith, dexonsmith, aaron.ballman
>> 
>> Subscribers: bob.wilson, cfe-commits, hfinkel
>> 
>> Differential Revision: http://reviews.llvm.org/D19403
>> 
>> Modified:
>>cfe/trunk/docs/LanguageExtensions.rst
>>cfe/trunk/include/clang/Basic/Attr.td
>>cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>>cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
>>cfe/trunk/lib/CodeGen/CGLoopInfo.h
>>cfe/trunk/lib/Parse/ParsePragma.cpp
>>cfe/trunk/lib/Sema/SemaStmtAttr.cpp
>>cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
>>cfe/trunk/test/Misc/ast-print-pragmas.cpp
>>cfe/trunk/test/PCH/pragma-loop.cpp
>>cfe/trunk/test/Parser/pragma-loop-safety.cpp
>>cfe/trunk/test/Parser/pragma-loop.cpp
>> 
>> Modified: cfe/trunk/docs/LanguageExtensions.rst
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656&r1=272655&r2=272656&view=diff
>> ==
>> --- cfe/trunk/docs/LanguageExtensions.rst (original)
>> +++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
>> @@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
>> 
>> The ``#pragma clang loop`` directive is used to specify hints for optimizing 
>> the
>> subsequent for, while, do-while, or c++11 range-based for loop. The directive
>> -provides options for vectorization, interleaving, and unrolling. Loop hints 
>> can
>> -be specified before any loop and will be ignored if the optimization is not 
>> safe
>> -to apply.
>> +provides options for vectorization, interleaving, unrolling and
>> +distribution. Loop hints can be specified before any loop and will be 
>> ignored if
>> +the optimization is not safe to apply.
>> 
>> Vectorization and Interleaving
>> --
>> @@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
>> 
>> Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
>> 
>> +Loop Distribution
>> +-
>> +
>> +Loop Distribution allows splitting a loop into multiple loops.  This is
>> +beneficial for example when the entire loop cannot be vectorized but some 
>> of the
>> +resulting loops can.
>> +
>> +If ``distribute(enable))'' is specified and the loop has memory dependencies
>> +that inhibit vectorization, the compiler will attempt to isolate the 
>> offending
>> +operations into a new loop.  This optimization is not enabled by default, 
>> only
>> +loops marked with the pragma are considered.
>> +
>> +.. code-block:: c++
>> +
>> +  #pragma clang loop distribute(enable)
>> +  for (i = 0; i < N; ++i) {
>> +S1: A[i + 1] = A[i] + B[i];
>> +S2: C[i] = D[i] * E[i];
>> +  }
>> +
>> +This loop will be split into two loops between statements S1 and S2.  The
>> +second loop containing S2 will be vectorized.
>> +
>> +Loop Distribution is currently not enabled by default in the optimizer 
>> because
>> +it can hurt performance in some cases.  For example, instruction-level
>> +parallelism could be reduced by sequentializing the execution of the
>> +statements S1 and S2 above.
>> +
>> +If Loop Distribution is turned on globally with
>> +``-mllvm -enable-loop-distribution``, specifying ``distribute(disable)`` can
>> +be used the disable it on a per-loop basis.
>> +
>> Additional Information
>> --
>> 
>> 
>> Modified: cfe/trunk/include/clang/Basic/Attr.td
>> URL: 
>> h

Re: Virtual patch: `svn mv lib/Headers/Intrin.h lib/Headers/intrin.h`

2016-06-14 Thread Hans Wennborg via cfe-commits
SGTM, then :-)

On Tue, Jun 14, 2016 at 11:54 AM, Nico Weber  wrote:
> I locally set up an SVN repo with a file called "File.txt" and then renamed
> it with `svn mv` using a new svn client (1.8).
>
> Then I tried updating several local checkouts of my local repo with svn
> 1.6.6 clients. All methods of updating I tried (`svn up`, `svn co
> current_checkout_url@2`) worked without problems. So this does seem to work
> fine as far as I can tell.
>
> On Wed, Jun 8, 2016 at 1:38 PM, Nico Weber  wrote:
>>
>> On Wed, Jun 8, 2016 at 1:27 PM, Hans Wennborg  wrote:
>>>
>>> On Wed, Jun 8, 2016 at 10:20 AM, Nico Weber  wrote:
>>> > It looks like we're starting to be more careful about header case.
>>> > MSVC's
>>> > intrin.h is called intrin.h with a lower-case 'i'; ours starts with an
>>> > upper-case 'I' for no good reason.
>>> >
>>> > It looks like file-only renames work fine as of svn 1.7 without any
>>> > workarounds
>>> >
>>> > (http://subversion.apache.org/docs/release-notes/1.7.html#windows-case-change),
>>> > so let's `svn mv` the file to its correct case.
>>> >
>>> > SGTM?
>>>
>>> Hmm, from http://subversion.apache.org/faq.html#case-change it seems
>>> users with pre-1.7 svn might run into problems when updating past the
>>> name change? Do users with such ancient versions still exist? Turns
>>> out I seem to be on svn 1.6.6 myself :-/
>>
>>
>> 1.7 was released 6 years ago. I think it's ok if people who use an old svn
>> need to do some manual work when they update. I can mention what people need
>> to do in the CL description (also explained at
>> http://subversion.apache.org/faq.html#case-change).
>>
>> I'm guessing most people get clang via the git mirror, and I think with
>> git this will hopefully just work (?)
>>
>> Anyone else out there still on svn 1.6? Hans uses Chromium's depot_tools
>> svn (and Chromium's clang/win/tot bots do too, so they'll need some care),
>> but I'd expect that most people who don't happen to work on Chromium
>> probably have a newer svn by now?
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20339: Update clang for D20260

2016-06-14 Thread Peter Collingbourne via cfe-commits
pcc added a comment.

Ping.


http://reviews.llvm.org/D20339



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


r272699 - Fix documentation bot after r272656

2016-06-14 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Tue Jun 14 14:33:16 2016
New Revision: 272699

URL: http://llvm.org/viewvc/llvm-project?rev=272699&view=rev
Log:
Fix documentation bot after r272656

Modified:
cfe/trunk/docs/LanguageExtensions.rst

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272699&r1=272698&r2=272699&view=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 14:33:16 2016
@@ -2154,7 +2154,7 @@ Loop Distribution allows splitting a loo
 beneficial for example when the entire loop cannot be vectorized but some of 
the
 resulting loops can.
 
-If ``distribute(enable))'' is specified and the loop has memory dependencies
+If ``distribute(enable))`` is specified and the loop has memory dependencies
 that inhibit vectorization, the compiler will attempt to isolate the offending
 operations into a new loop.  This optimization is not enabled by default, only
 loops marked with the pragma are considered.


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


Re: r272656 - Add loop pragma for Loop Distribution

2016-06-14 Thread Adam Nemet via cfe-commits
r272699 should do it.

> On Jun 14, 2016, at 9:32 PM, Adam Nemet via cfe-commits 
>  wrote:
> 
> On it, sorry about it.
> 
>> On Jun 14, 2016, at 4:51 PM, Rafael Espíndola  
>> wrote:
>> 
>> Looks like this broke the docs:
>> http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/14690/steps/docs-clang-html/logs/stdio
>> 
>> Cheers,
>> Rafael
>> 
>> 
>> On 14 June 2016 at 08:04, Adam Nemet via cfe-commits
>>  wrote:
>>> Author: anemet
>>> Date: Tue Jun 14 07:04:26 2016
>>> New Revision: 272656
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=272656&view=rev
>>> Log:
>>> Add loop pragma for Loop Distribution
>>> 
>>> Summary:
>>> This is similar to other loop pragmas like 'vectorize'.  Currently it
>>> only has state values: distribute(enable) and distribute(disable).  When
>>> one of these is specified the corresponding loop metadata is generated:
>>> 
>>> !{!"llvm.loop.distribute.enable", i1 true/false}
>>> 
>>> As a result, loop distribution will be attempted on the loop even if
>>> Loop Distribution in not enabled globally.  Analogously, with 'disable'
>>> distribution can be turned off for an individual loop even when the pass
>>> is otherwise enabled.
>>> 
>>> There are some slight differences compared to the existing loop pragmas.
>>> 
>>> 1. There is no 'assume_safety' variant which makes its handling slightly
>>> different from 'vectorize'/'interleave'.
>>> 
>>> 2. Unlike the existing loop pragmas, it does not have a corresponding
>>> numeric pragma like 'vectorize' -> 'vectorize_width'.  So for the
>>> consistency checks in CheckForIncompatibleAttributes we don't need to
>>> check it against other pragmas.  We just need to check for duplicates of
>>> the same pragma.
>>> 
>>> Reviewers: rsmith, dexonsmith, aaron.ballman
>>> 
>>> Subscribers: bob.wilson, cfe-commits, hfinkel
>>> 
>>> Differential Revision: http://reviews.llvm.org/D19403
>>> 
>>> Modified:
>>>   cfe/trunk/docs/LanguageExtensions.rst
>>>   cfe/trunk/include/clang/Basic/Attr.td
>>>   cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>>>   cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
>>>   cfe/trunk/lib/CodeGen/CGLoopInfo.h
>>>   cfe/trunk/lib/Parse/ParsePragma.cpp
>>>   cfe/trunk/lib/Sema/SemaStmtAttr.cpp
>>>   cfe/trunk/test/CodeGenCXX/pragma-loop.cpp
>>>   cfe/trunk/test/Misc/ast-print-pragmas.cpp
>>>   cfe/trunk/test/PCH/pragma-loop.cpp
>>>   cfe/trunk/test/Parser/pragma-loop-safety.cpp
>>>   cfe/trunk/test/Parser/pragma-loop.cpp
>>> 
>>> Modified: cfe/trunk/docs/LanguageExtensions.rst
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=272656&r1=272655&r2=272656&view=diff
>>> ==
>>> --- cfe/trunk/docs/LanguageExtensions.rst (original)
>>> +++ cfe/trunk/docs/LanguageExtensions.rst Tue Jun 14 07:04:26 2016
>>> @@ -2050,9 +2050,9 @@ Extensions for loop hint optimizations
>>> 
>>> The ``#pragma clang loop`` directive is used to specify hints for 
>>> optimizing the
>>> subsequent for, while, do-while, or c++11 range-based for loop. The 
>>> directive
>>> -provides options for vectorization, interleaving, and unrolling. Loop 
>>> hints can
>>> -be specified before any loop and will be ignored if the optimization is 
>>> not safe
>>> -to apply.
>>> +provides options for vectorization, interleaving, unrolling and
>>> +distribution. Loop hints can be specified before any loop and will be 
>>> ignored if
>>> +the optimization is not safe to apply.
>>> 
>>> Vectorization and Interleaving
>>> --
>>> @@ -2147,6 +2147,38 @@ to the same code size limit as with ``un
>>> 
>>> Unrolling of a loop can be prevented by specifying ``unroll(disable)``.
>>> 
>>> +Loop Distribution
>>> +-
>>> +
>>> +Loop Distribution allows splitting a loop into multiple loops.  This is
>>> +beneficial for example when the entire loop cannot be vectorized but some 
>>> of the
>>> +resulting loops can.
>>> +
>>> +If ``distribute(enable))'' is specified and the loop has memory 
>>> dependencies
>>> +that inhibit vectorization, the compiler will attempt to isolate the 
>>> offending
>>> +operations into a new loop.  This optimization is not enabled by default, 
>>> only
>>> +loops marked with the pragma are considered.
>>> +
>>> +.. code-block:: c++
>>> +
>>> +  #pragma clang loop distribute(enable)
>>> +  for (i = 0; i < N; ++i) {
>>> +S1: A[i + 1] = A[i] + B[i];
>>> +S2: C[i] = D[i] * E[i];
>>> +  }
>>> +
>>> +This loop will be split into two loops between statements S1 and S2.  The
>>> +second loop containing S2 will be vectorized.
>>> +
>>> +Loop Distribution is currently not enabled by default in the optimizer 
>>> because
>>> +it can hurt performance in some cases.  For example, instruction-level
>>> +parallelism could be reduced by sequentializing the execution of the
>>> +statements S1 and S2 above.
>>> +
>>> +If Loop Distribution is turned on globally with
>>> +``-mllvm -enable-loop-distribution

[PATCH] D21337: [CUDA] Give templated device functions internal linkage, templated kernels external linkage.

2016-06-14 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: rsmith.
jlebar added subscribers: tra, cfe-commits.

This lets LLVM perform IPO over these functions.  In particular, it
allows LLVM to emit ld.global.nc for loads to __restrict pointers in
kernels that are never written to.

http://reviews.llvm.org/D21337

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGenCUDA/ptx-kernels.cu

Index: test/CodeGenCUDA/ptx-kernels.cu
===
--- test/CodeGenCUDA/ptx-kernels.cu
+++ test/CodeGenCUDA/ptx-kernels.cu
@@ -19,11 +19,11 @@
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+// CHECK-DAG: define void @_Z16templated_kernelIiEvT_(
 
 namespace {
 __global__ void anonymous_ns_kernel() {}
-// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+// CHECK-DAG: define void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
 }
 
 void host_function() {
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2679,9 +2679,18 @@
   // explicit instantiations can occur in multiple translation units
   // and must all be equivalent. However, we are not allowed to
   // throw away these explicit instantiations.
-  if (Linkage == GVA_StrongODR)
-return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage
-: llvm::Function::ExternalLinkage;
+  //
+  // We don't currently support CUDA device code spread out across multiple 
TUs,
+  // so say that CUDA templates are either external (for kernels) or internal.
+  // This lets llvm perform aggressive inter-procedural optimizations.
+  if (Linkage == GVA_StrongODR) {
+if (Context.getLangOpts().AppleKext)
+  return llvm::Function::ExternalLinkage;
+if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice)
+  return D->hasAttr() ? llvm::Function::ExternalLinkage
+  : llvm::Function::InternalLinkage;
+return llvm::Function::WeakODRLinkage;
+  }
 
   // C++ doesn't have tentative definitions and thus cannot have common
   // linkage.


Index: test/CodeGenCUDA/ptx-kernels.cu
===
--- test/CodeGenCUDA/ptx-kernels.cu
+++ test/CodeGenCUDA/ptx-kernels.cu
@@ -19,11 +19,11 @@
 
 // Make sure host-instantiated kernels are preserved on device side.
 template  __global__ void templated_kernel(T param) {}
-// CHECK-DAG: define weak_odr void @_Z16templated_kernelIiEvT_(
+// CHECK-DAG: define void @_Z16templated_kernelIiEvT_(
 
 namespace {
 __global__ void anonymous_ns_kernel() {}
-// CHECK-DAG: define weak_odr void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
+// CHECK-DAG: define void @_ZN12_GLOBAL__N_119anonymous_ns_kernelEv(
 }
 
 void host_function() {
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2679,9 +2679,18 @@
   // explicit instantiations can occur in multiple translation units
   // and must all be equivalent. However, we are not allowed to
   // throw away these explicit instantiations.
-  if (Linkage == GVA_StrongODR)
-return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage
-: llvm::Function::ExternalLinkage;
+  //
+  // We don't currently support CUDA device code spread out across multiple TUs,
+  // so say that CUDA templates are either external (for kernels) or internal.
+  // This lets llvm perform aggressive inter-procedural optimizations.
+  if (Linkage == GVA_StrongODR) {
+if (Context.getLangOpts().AppleKext)
+  return llvm::Function::ExternalLinkage;
+if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice)
+  return D->hasAttr() ? llvm::Function::ExternalLinkage
+  : llvm::Function::InternalLinkage;
+return llvm::Function::WeakODRLinkage;
+  }
 
   // C++ doesn't have tentative definitions and thus cannot have common
   // linkage.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-14 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

In http://reviews.llvm.org/D20444#457588, @Anastasia wrote:

> LGTM, I think it would be nice if the block related code goes in a separate 
> commit.
>
> Thanks!


Will do. Thanks.


http://reviews.llvm.org/D20444



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


r272701 - Rename Intrin.h to intrin.h, that's how all the documentation calls it.

2016-06-14 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Jun 14 14:54:40 2016
New Revision: 272701

URL: http://llvm.org/viewvc/llvm-project?rev=272701&view=rev
Log:
Rename Intrin.h to intrin.h, that's how all the documentation calls it.

Added:
cfe/trunk/lib/Headers/intrin.h   (props changed)
  - copied unchanged from r272700, cfe/trunk/lib/Headers/Intrin.h
Removed:
cfe/trunk/lib/Headers/Intrin.h

Removed: cfe/trunk/lib/Headers/Intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=272700&view=auto
==
--- cfe/trunk/lib/Headers/Intrin.h (original)
+++ cfe/trunk/lib/Headers/Intrin.h (removed)
@@ -1,957 +0,0 @@
-/* === Intrin.h ---===
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- *===---===
- */
-
-/* Only include this if we're compiling for the windows platform. */
-#ifndef _MSC_VER
-#include_next 
-#else
-
-#ifndef __INTRIN_H
-#define __INTRIN_H
-
-/* First include the standard intrinsics. */
-#if defined(__i386__) || defined(__x86_64__)
-#include 
-#endif
-
-/* For the definition of jmp_buf. */
-#if __STDC_HOSTED__
-#include 
-#endif
-
-/* Define the default attributes for the functions in this file. */
-#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(__MMX__)
-/* And the random ones that aren't in those files. */
-__m64 _m_from_float(float);
-float _m_to_float(__m64);
-#endif
-
-/* Other assorted instruction intrinsics. */
-void __addfsbyte(unsigned long, unsigned char);
-void __addfsdword(unsigned long, unsigned long);
-void __addfsword(unsigned long, unsigned short);
-void __code_seg(const char *);
-static __inline__
-void __cpuid(int[4], int);
-static __inline__
-void __cpuidex(int[4], int, int);
-void __debugbreak(void);
-__int64 __emul(int, int);
-unsigned __int64 __emulu(unsigned int, unsigned int);
-void __cdecl __fastfail(unsigned int);
-unsigned int __getcallerseflags(void);
-static __inline__
-void __halt(void);
-unsigned char __inbyte(unsigned short);
-void __inbytestring(unsigned short, unsigned char *, unsigned long);
-void __incfsbyte(unsigned long);
-void __incfsdword(unsigned long);
-void __incfsword(unsigned long);
-unsigned long __indword(unsigned short);
-void __indwordstring(unsigned short, unsigned long *, unsigned long);
-void __int2c(void);
-void __invlpg(void *);
-unsigned short __inword(unsigned short);
-void __inwordstring(unsigned short, unsigned short *, unsigned long);
-void __lidt(void *);
-unsigned __int64 __ll_lshift(unsigned __int64, int);
-__int64 __ll_rshift(__int64, int);
-void __llwpcb(void *);
-unsigned char __lwpins32(unsigned int, unsigned int, unsigned int);
-void __lwpval32(unsigned int, unsigned int, unsigned int);
-unsigned int __lzcnt(unsigned int);
-unsigned short __lzcnt16(unsigned short);
-static __inline__
-void __movsb(unsigned char *, unsigned char const *, size_t);
-static __inline__
-void __movsd(unsigned long *, unsigned long const *, size_t);
-static __inline__
-void __movsw(unsigned short *, unsigned short const *, size_t);
-void __nop(void);
-void __nvreg_restore_fence(void);
-void __nvreg_save_fence(void);
-void __outbyte(unsigned short, unsigned char);
-void __outbytestring(unsigned short, unsigned char *, unsigned long);
-void __outdword(unsigned short, unsigned long);
-void __outdwordstring(unsigned short, unsigned long *, unsigned long);
-void __outword(unsigned short, unsigned short);
-void __outwordstring(unsigned short, unsigned short *, unsigned long);
-static __inline__
-unsigned int __popcnt(unsigned int);
-static __inline__
-unsigned short __popcnt16(unsigned short);
-unsigned long __readcr0(void);
-unsigned long __readcr2(void);
-static __inline__
-unsigned long __readcr3(void);
-unsigned long __readcr4(void);
-

Re: r272701 - Rename Intrin.h to intrin.h, that's how all the documentation calls it.

2016-06-14 Thread Nico Weber via cfe-commits
This change was generated by running `svn mv -m "Rename Intrin.h to
intrin.h, that's how all the documentation calls it."
https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/Intrin.h
https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/intrin.h` – I
didn't manually do anything with that svn:mergeinfo chunk.

On Tue, Jun 14, 2016 at 9:54 PM, Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: nico
> Date: Tue Jun 14 14:54:40 2016
> New Revision: 272701
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272701&view=rev
> Log:
> Rename Intrin.h to intrin.h, that's how all the documentation calls it.
>
> Added:
> cfe/trunk/lib/Headers/intrin.h   (props changed)
>   - copied unchanged from r272700, cfe/trunk/lib/Headers/Intrin.h
> Removed:
> cfe/trunk/lib/Headers/Intrin.h
>
> Removed: cfe/trunk/lib/Headers/Intrin.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=272700&view=auto
>
> ==
> --- cfe/trunk/lib/Headers/Intrin.h (original)
> +++ cfe/trunk/lib/Headers/Intrin.h (removed)
> @@ -1,957 +0,0 @@
> -/* === Intrin.h
> ---===
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining
> a copy
> - * of this software and associated documentation files (the "Software"),
> to deal
> - * in the Software without restriction, including without limitation the
> rights
> - * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> - * copies of the Software, and to permit persons to whom the Software is
> - * furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be
> included in
> - * all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL THE
> - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING FROM,
> - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> IN
> - * THE SOFTWARE.
> - *
> -
> *===---===
> - */
> -
> -/* Only include this if we're compiling for the windows platform. */
> -#ifndef _MSC_VER
> -#include_next 
> -#else
> -
> -#ifndef __INTRIN_H
> -#define __INTRIN_H
> -
> -/* First include the standard intrinsics. */
> -#if defined(__i386__) || defined(__x86_64__)
> -#include 
> -#endif
> -
> -/* For the definition of jmp_buf. */
> -#if __STDC_HOSTED__
> -#include 
> -#endif
> -
> -/* Define the default attributes for the functions in this file. */
> -#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -#if defined(__MMX__)
> -/* And the random ones that aren't in those files. */
> -__m64 _m_from_float(float);
> -float _m_to_float(__m64);
> -#endif
> -
> -/* Other assorted instruction intrinsics. */
> -void __addfsbyte(unsigned long, unsigned char);
> -void __addfsdword(unsigned long, unsigned long);
> -void __addfsword(unsigned long, unsigned short);
> -void __code_seg(const char *);
> -static __inline__
> -void __cpuid(int[4], int);
> -static __inline__
> -void __cpuidex(int[4], int, int);
> -void __debugbreak(void);
> -__int64 __emul(int, int);
> -unsigned __int64 __emulu(unsigned int, unsigned int);
> -void __cdecl __fastfail(unsigned int);
> -unsigned int __getcallerseflags(void);
> -static __inline__
> -void __halt(void);
> -unsigned char __inbyte(unsigned short);
> -void __inbytestring(unsigned short, unsigned char *, unsigned long);
> -void __incfsbyte(unsigned long);
> -void __incfsdword(unsigned long);
> -void __incfsword(unsigned long);
> -unsigned long __indword(unsigned short);
> -void __indwordstring(unsigned short, unsigned long *, unsigned long);
> -void __int2c(void);
> -void __invlpg(void *);
> -unsigned short __inword(unsigned short);
> -void __inwordstring(unsigned short, unsigned short *, unsigned long);
> -void __lidt(void *);
> -unsigned __int64 __ll_lshift(unsigned __int64, int);
> -__int64 __ll_rshift(__int64, int);
> -void __llwpcb(void *);
> -unsigned char __lwpins32(unsigned int, unsigned int, unsigned int);
> -void __lwpval32(unsigned int, unsigned int, unsigned int);
> -unsigned int __lzcnt(unsigned int);
> -unsigned short __lzcnt16(unsigned short);
> -static __inline__
> -void __movsb(unsigned char *, unsigned char const *, size_t);
> -static __inline__
> -void __movsd(unsigned long *, unsigned long const *, size_t);
> -static __inline__
> -void __movsw(unsigned short *, unsigned short const *, size_t);
> -void __nop(void);
> -void __nvreg_r

Re: Virtual patch: `svn mv lib/Headers/Intrin.h lib/Headers/intrin.h`

2016-06-14 Thread Nico Weber via cfe-commits
r272701, thanks!

On Tue, Jun 14, 2016 at 9:34 PM, Hans Wennborg  wrote:

> SGTM, then :-)
>
> On Tue, Jun 14, 2016 at 11:54 AM, Nico Weber  wrote:
> > I locally set up an SVN repo with a file called "File.txt" and then
> renamed
> > it with `svn mv` using a new svn client (1.8).
> >
> > Then I tried updating several local checkouts of my local repo with svn
> > 1.6.6 clients. All methods of updating I tried (`svn up`, `svn co
> > current_checkout_url@2`) worked without problems. So this does seem to
> work
> > fine as far as I can tell.
> >
> > On Wed, Jun 8, 2016 at 1:38 PM, Nico Weber  wrote:
> >>
> >> On Wed, Jun 8, 2016 at 1:27 PM, Hans Wennborg 
> wrote:
> >>>
> >>> On Wed, Jun 8, 2016 at 10:20 AM, Nico Weber 
> wrote:
> >>> > It looks like we're starting to be more careful about header case.
> >>> > MSVC's
> >>> > intrin.h is called intrin.h with a lower-case 'i'; ours starts with
> an
> >>> > upper-case 'I' for no good reason.
> >>> >
> >>> > It looks like file-only renames work fine as of svn 1.7 without any
> >>> > workarounds
> >>> >
> >>> > (
> http://subversion.apache.org/docs/release-notes/1.7.html#windows-case-change
> ),
> >>> > so let's `svn mv` the file to its correct case.
> >>> >
> >>> > SGTM?
> >>>
> >>> Hmm, from http://subversion.apache.org/faq.html#case-change it seems
> >>> users with pre-1.7 svn might run into problems when updating past the
> >>> name change? Do users with such ancient versions still exist? Turns
> >>> out I seem to be on svn 1.6.6 myself :-/
> >>
> >>
> >> 1.7 was released 6 years ago. I think it's ok if people who use an old
> svn
> >> need to do some manual work when they update. I can mention what people
> need
> >> to do in the CL description (also explained at
> >> http://subversion.apache.org/faq.html#case-change).
> >>
> >> I'm guessing most people get clang via the git mirror, and I think with
> >> git this will hopefully just work (?)
> >>
> >> Anyone else out there still on svn 1.6? Hans uses Chromium's depot_tools
> >> svn (and Chromium's clang/win/tot bots do too, so they'll need some
> care),
> >> but I'd expect that most people who don't happen to work on Chromium
> >> probably have a newer svn by now?
> >>
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21338: cc1_main: Do not print statistics in -disable_free mode.

2016-06-14 Thread Matthias Braun via cfe-commits
MatzeB created this revision.
MatzeB added reviewers: doug.gregor, bkramer.
MatzeB added a subscriber: cfe-commits.
MatzeB set the repository for this revision to rL LLVM.
Herald added a subscriber: mcrosier.

llvm statistics are currently printed when the destructor of a
"static ManagedStatic StatInfo" in llvm runs.
This destructor currently runs in each case as part of llvm_shutdown()
which is run even in disable_free mode as part of main(). I assume that
this hasn't always been the case.

Removing the special code here avoids the statistics getting printed
twice.

Repository:
  rL LLVM

http://reviews.llvm.org/D21338

Files:
  tools/driver/cc1_main.cpp

Index: tools/driver/cc1_main.cpp
===
--- tools/driver/cc1_main.cpp
+++ tools/driver/cc1_main.cpp
@@ -126,8 +126,6 @@
 
   // When running with -disable-free, don't do any destruction or shutdown.
   if (Clang->getFrontendOpts().DisableFree) {
-if (llvm::AreStatisticsEnabled() || Clang->getFrontendOpts().ShowStats)
-  llvm::PrintStatistics();
 BuryPointer(std::move(Clang));
 return !Success;
   }


Index: tools/driver/cc1_main.cpp
===
--- tools/driver/cc1_main.cpp
+++ tools/driver/cc1_main.cpp
@@ -126,8 +126,6 @@
 
   // When running with -disable-free, don't do any destruction or shutdown.
   if (Clang->getFrontendOpts().DisableFree) {
-if (llvm::AreStatisticsEnabled() || Clang->getFrontendOpts().ShowStats)
-  llvm::PrintStatistics();
 BuryPointer(std::move(Clang));
 return !Success;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272702 - s/Intrin.h/intrin.h/, trying to fix the build after r272701

2016-06-14 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Jun 14 15:14:24 2016
New Revision: 272702

URL: http://llvm.org/viewvc/llvm-project?rev=272702&view=rev
Log:
s/Intrin.h/intrin.h/, trying to fix the build after r272701

Modified:
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c
cfe/trunk/test/CodeGen/ms-mm-align.c
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=272702&r1=272701&r2=272702&view=diff
==
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Tue Jun 14 15:14:24 2016
@@ -37,7 +37,7 @@ set(files
   htmxlintrin.h
   ia32intrin.h
   immintrin.h
-  Intrin.h
+  intrin.h
   inttypes.h
   iso646.h
   limits.h

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=272702&r1=272701&r2=272702&view=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Tue Jun 14 15:14:24 2016
@@ -1,4 +1,4 @@
-/* === Intrin.h ---===
+/* === intrin.h ---===
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
@@ -23,7 +23,7 @@
 
 /* Only include this if we're compiling for the windows platform. */
 #ifndef _MSC_VER
-#include_next 
+#include_next 
 #else
 
 #ifndef __INTRIN_H

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=272702&r1=272701&r2=272702&view=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Tue Jun 14 15:14:24 2016
@@ -8,11 +8,11 @@
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
-// Intrin.h needs size_t, but -ffreestanding prevents us from getting it from
+// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
 // stddef.h.  Work around it with this typedef.
 typedef __SIZE_TYPE__ size_t;
 
-#include 
+#include 
 
 void *test_InterlockedExchangePointer(void * volatile *Target, void *Value) {
   return _InterlockedExchangePointer(Target, Value);

Modified: cfe/trunk/test/CodeGen/ms-mm-align.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-mm-align.c?rev=272702&r1=272701&r2=272702&view=diff
==
--- cfe/trunk/test/CodeGen/ms-mm-align.c (original)
+++ cfe/trunk/test/CodeGen/ms-mm-align.c Tue Jun 14 15:14:24 2016
@@ -2,10 +2,10 @@
 // RUN: -triple i686--windows -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix CHECK
 
-// Intrin.h needs size_t, but -ffreestanding prevents us from getting it from
+// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
 // stddef.h.  Work around it with this typedef.
 typedef __SIZE_TYPE__ size_t;
-#include 
+#include 
 
 void capture_ptr(int* i);
 void test_mm_align16(int p) {

Modified: cfe/trunk/test/Headers/ms-intrin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=272702&r1=272701&r2=272702&view=diff
==
--- cfe/trunk/test/Headers/ms-intrin.cpp (original)
+++ cfe/trunk/test/Headers/ms-intrin.cpp Tue Jun 14 15:14:24 2016
@@ -20,11 +20,11 @@
 
 // REQUIRES: x86-registered-target
 
-// Intrin.h needs size_t, but -ffreestanding prevents us from getting it from
+// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
 // stddef.h.  Work around it with this typedef.
 typedef __SIZE_TYPE__ size_t;
 
-#include 
+#include 
 
 // Use some C++ to make sure we closed the extern "C" brackets.
 template 


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


Re: [PATCH] D21334: Add TargetInfo for 32-bit and 64-bit RenderScript

2016-06-14 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60735.
pirama added a comment.

- revise test


http://reviews.llvm.org/D21334

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/renderscript.c

Index: test/CodeGen/renderscript.c
===
--- /dev/null
+++ test/CodeGen/renderscript.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=renderscript32-none-linux-gnueabi -emit-llvm -o 
- -Werror | FileCheck %s -check-prefix=CHECK-RS32
+// RUN: %clang_cc1 %s -triple=renderscript64-none-linux-android -emit-llvm -o 
- -Werror | FileCheck %s -check-prefix=CHECK-RS64
+// RUN: %clang_cc1 %s -triple=armv7-none-linux-gnueabi -emit-llvm -o - -Werror 
| FileCheck %s -check-prefix=CHECK-ARM
+
+// Ensure that the bitcode has the correct triple
+// CHECK-RS32: target triple = "armv7-none-linux-gnueabi"
+// CHECK-RS64: target triple = "aarch64-none-linux-android"
+// CHECK-ARM: target triple = "armv7-none-linux-gnueabi"
+
+// Ensure that long data type has 8-byte size and alignment in RenderScript
+#ifdef __RENDERSCRIPT__
+#define LONG_WIDTH_AND_ALIGN 8
+#else
+#define LONG_WIDTH_AND_ALIGN 4
+#endif
+
+_Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+
+// CHECK-RS32: i64 @test_long(i64 %v)
+// CHECK-RS64: i64 @test_long(i64 %v)
+// CHECK-ARM: i32 @test_long(i32 %v)
+long test_long(long v) {
+  return v + 1;
+}
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7992,6 +7992,43 @@
 return true;
   }
 };
+
+// 32-bit RenderScript is armv7 with width and align of 'long' set to 8-bytes
+class RenderScript32TargetInfo : public ARMleTargetInfo {
+public:
+  RenderScript32TargetInfo(const llvm::Triple &Triple,
+   const TargetOptions &Opts)
+  : ARMleTargetInfo(
+  llvm::Triple("armv7", Triple.getVendorName(), Triple.getOSName(),
+Triple.getEnvironmentName()),
+  Opts)
+  {
+LongWidth = LongAlign = 64;
+  }
+  void getTargetDefines(const LangOptions &Opts,
+MacroBuilder &Builder) const override {
+Builder.defineMacro("__RENDERSCRIPT__");
+ARMleTargetInfo::getTargetDefines(Opts, Builder);
+  }
+};
+
+// 64-bit RenderScript is aarch64
+class RenderScript64TargetInfo : public AArch64leTargetInfo {
+public:
+  RenderScript64TargetInfo(const llvm::Triple &Triple,
+   const TargetOptions &Opts)
+  : AArch64leTargetInfo(
+  llvm::Triple("aarch64", Triple.getVendorName(), Triple.getOSName(),
+   Triple.getEnvironmentName()),
+  Opts) { }
+
+  void getTargetDefines(const LangOptions &Opts,
+MacroBuilder &Builder) const override {
+Builder.defineMacro("__RENDERSCRIPT__");
+AArch64leTargetInfo::getTargetDefines(Opts, Builder);
+  }
+};
+
 } // end anonymous namespace
 
 
//===--===//
@@ -8420,6 +8457,11 @@
 if (!(Triple == llvm::Triple("wasm64-unknown-unknown")))
   return nullptr;
 return new WebAssemblyOSTargetInfo(Triple, Opts);
+
+  case llvm::Triple::renderscript32:
+return new LinuxTargetInfo(Triple, Opts);
+  case llvm::Triple::renderscript64:
+return new LinuxTargetInfo(Triple, Opts);
   }
 }
 


Index: test/CodeGen/renderscript.c
===
--- /dev/null
+++ test/CodeGen/renderscript.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=renderscript32-none-linux-gnueabi -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS32
+// RUN: %clang_cc1 %s -triple=renderscript64-none-linux-android -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-RS64
+// RUN: %clang_cc1 %s -triple=armv7-none-linux-gnueabi -emit-llvm -o - -Werror | FileCheck %s -check-prefix=CHECK-ARM
+
+// Ensure that the bitcode has the correct triple
+// CHECK-RS32: target triple = "armv7-none-linux-gnueabi"
+// CHECK-RS64: target triple = "aarch64-none-linux-android"
+// CHECK-ARM: target triple = "armv7-none-linux-gnueabi"
+
+// Ensure that long data type has 8-byte size and alignment in RenderScript
+#ifdef __RENDERSCRIPT__
+#define LONG_WIDTH_AND_ALIGN 8
+#else
+#define LONG_WIDTH_AND_ALIGN 4
+#endif
+
+_Static_assert(sizeof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_WIDTH_AND_ALIGN, "sizeof long is wrong");
+
+// CHECK-RS32: i64 @test_long(i64 %v)
+// CHECK-RS64: i64 @test_long(i64 %v)
+// CHECK-ARM: i32 @test_long(i32 %v)
+long test_long(long v) {
+  return v + 1;
+}
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7992,6 +7992,43 @@
 return true;
   }
 };
+
+// 32-bit RenderScript is armv7 with width and a

Re: r272701 - Rename Intrin.h to intrin.h, that's how all the documentation calls it.

2016-06-14 Thread Vitaly Buka via cfe-commits
Probably the bot was broken by this CL
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/9922

On Tue, Jun 14, 2016 at 1:03 PM Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> This change was generated by running `svn mv -m "Rename Intrin.h to
> intrin.h, that's how all the documentation calls it."
> https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/Intrin.h
> https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/intrin.h`
>  –
> I didn't manually do anything with that svn:mergeinfo chunk.
>
> On Tue, Jun 14, 2016 at 9:54 PM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: nico
>> Date: Tue Jun 14 14:54:40 2016
>> New Revision: 272701
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=272701&view=rev
>> Log:
>> Rename Intrin.h to intrin.h, that's how all the documentation calls it.
>>
>> Added:
>> cfe/trunk/lib/Headers/intrin.h   (props changed)
>>   - copied unchanged from r272700, cfe/trunk/lib/Headers/Intrin.h
>> Removed:
>> cfe/trunk/lib/Headers/Intrin.h
>>
>> Removed: cfe/trunk/lib/Headers/Intrin.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=272700&view=auto
>>
>> ==
>> --- cfe/trunk/lib/Headers/Intrin.h (original)
>> +++ cfe/trunk/lib/Headers/Intrin.h (removed)
>> @@ -1,957 +0,0 @@
>> -/* === Intrin.h
>> ---===
>> - *
>> - * Permission is hereby granted, free of charge, to any person obtaining
>> a copy
>> - * of this software and associated documentation files (the "Software"),
>> to deal
>> - * in the Software without restriction, including without limitation the
>> rights
>> - * to use, copy, modify, merge, publish, distribute, sublicense, and/or
>> sell
>> - * copies of the Software, and to permit persons to whom the Software is
>> - * furnished to do so, subject to the following conditions:
>> - *
>> - * The above copyright notice and this permission notice shall be
>> included in
>> - * all copies or substantial portions of the Software.
>> - *
>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
>> SHALL THE
>> - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING FROM,
>> - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> DEALINGS IN
>> - * THE SOFTWARE.
>> - *
>> -
>> *===---===
>> - */
>> -
>> -/* Only include this if we're compiling for the windows platform. */
>> -#ifndef _MSC_VER
>> -#include_next 
>> -#else
>> -
>> -#ifndef __INTRIN_H
>> -#define __INTRIN_H
>> -
>> -/* First include the standard intrinsics. */
>> -#if defined(__i386__) || defined(__x86_64__)
>> -#include 
>> -#endif
>> -
>> -/* For the definition of jmp_buf. */
>> -#if __STDC_HOSTED__
>> -#include 
>> -#endif
>> -
>> -/* Define the default attributes for the functions in this file. */
>> -#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__,
>> __nodebug__))
>> -
>> -#ifdef __cplusplus
>> -extern "C" {
>> -#endif
>> -
>> -#if defined(__MMX__)
>> -/* And the random ones that aren't in those files. */
>> -__m64 _m_from_float(float);
>> -float _m_to_float(__m64);
>> -#endif
>> -
>> -/* Other assorted instruction intrinsics. */
>> -void __addfsbyte(unsigned long, unsigned char);
>> -void __addfsdword(unsigned long, unsigned long);
>> -void __addfsword(unsigned long, unsigned short);
>> -void __code_seg(const char *);
>> -static __inline__
>> -void __cpuid(int[4], int);
>> -static __inline__
>> -void __cpuidex(int[4], int, int);
>> -void __debugbreak(void);
>> -__int64 __emul(int, int);
>> -unsigned __int64 __emulu(unsigned int, unsigned int);
>> -void __cdecl __fastfail(unsigned int);
>> -unsigned int __getcallerseflags(void);
>> -static __inline__
>> -void __halt(void);
>> -unsigned char __inbyte(unsigned short);
>> -void __inbytestring(unsigned short, unsigned char *, unsigned long);
>> -void __incfsbyte(unsigned long);
>> -void __incfsdword(unsigned long);
>> -void __incfsword(unsigned long);
>> -unsigned long __indword(unsigned short);
>> -void __indwordstring(unsigned short, unsigned long *, unsigned long);
>> -void __int2c(void);
>> -void __invlpg(void *);
>> -unsigned short __inword(unsigned short);
>> -void __inwordstring(unsigned short, unsigned short *, unsigned long);
>> -void __lidt(void *);
>> -unsigned __int64 __ll_lshift(unsigned __int64, int);
>> -__int64 __ll_rshift(__int64, int);
>> -void __llwpcb(void *);
>> -unsigned char __lwpins32(unsigned int, unsigned int, unsigned int);
>> -void __lwpval3

Re: r272701 - Rename Intrin.h to intrin.h, that's how all the documentation calls it.

2016-06-14 Thread Rui Ueyama via cfe-commits
Hans seems to fix it in r272701.

On Tue, Jun 14, 2016 at 1:26 PM, Vitaly Buka via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Probably the bot was broken by this CL
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/9922
>
> On Tue, Jun 14, 2016 at 1:03 PM Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> This change was generated by running `svn mv -m "Rename Intrin.h to
>> intrin.h, that's how all the documentation calls it."
>> https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/Intrin.h
>> https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/intrin.h`
>> 
>> – I didn't manually do anything with that svn:mergeinfo chunk.
>>
>> On Tue, Jun 14, 2016 at 9:54 PM, Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: nico
>>> Date: Tue Jun 14 14:54:40 2016
>>> New Revision: 272701
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=272701&view=rev
>>> Log:
>>> Rename Intrin.h to intrin.h, that's how all the documentation calls it.
>>>
>>> Added:
>>> cfe/trunk/lib/Headers/intrin.h   (props changed)
>>>   - copied unchanged from r272700, cfe/trunk/lib/Headers/Intrin.h
>>> Removed:
>>> cfe/trunk/lib/Headers/Intrin.h
>>>
>>> Removed: cfe/trunk/lib/Headers/Intrin.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=272700&view=auto
>>>
>>> ==
>>> --- cfe/trunk/lib/Headers/Intrin.h (original)
>>> +++ cfe/trunk/lib/Headers/Intrin.h (removed)
>>> @@ -1,957 +0,0 @@
>>> -/* === Intrin.h
>>> ---===
>>> - *
>>> - * Permission is hereby granted, free of charge, to any person
>>> obtaining a copy
>>> - * of this software and associated documentation files (the
>>> "Software"), to deal
>>> - * in the Software without restriction, including without limitation
>>> the rights
>>> - * to use, copy, modify, merge, publish, distribute, sublicense, and/or
>>> sell
>>> - * copies of the Software, and to permit persons to whom the Software is
>>> - * furnished to do so, subject to the following conditions:
>>> - *
>>> - * The above copyright notice and this permission notice shall be
>>> included in
>>> - * all copies or substantial portions of the Software.
>>> - *
>>> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>>> EXPRESS OR
>>> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>>> MERCHANTABILITY,
>>> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
>>> SHALL THE
>>> - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>>> OTHER
>>> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>>> ARISING FROM,
>>> - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>>> DEALINGS IN
>>> - * THE SOFTWARE.
>>> - *
>>> -
>>> *===---===
>>> - */
>>> -
>>> -/* Only include this if we're compiling for the windows platform. */
>>> -#ifndef _MSC_VER
>>> -#include_next 
>>> -#else
>>> -
>>> -#ifndef __INTRIN_H
>>> -#define __INTRIN_H
>>> -
>>> -/* First include the standard intrinsics. */
>>> -#if defined(__i386__) || defined(__x86_64__)
>>> -#include 
>>> -#endif
>>> -
>>> -/* For the definition of jmp_buf. */
>>> -#if __STDC_HOSTED__
>>> -#include 
>>> -#endif
>>> -
>>> -/* Define the default attributes for the functions in this file. */
>>> -#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__,
>>> __nodebug__))
>>> -
>>> -#ifdef __cplusplus
>>> -extern "C" {
>>> -#endif
>>> -
>>> -#if defined(__MMX__)
>>> -/* And the random ones that aren't in those files. */
>>> -__m64 _m_from_float(float);
>>> -float _m_to_float(__m64);
>>> -#endif
>>> -
>>> -/* Other assorted instruction intrinsics. */
>>> -void __addfsbyte(unsigned long, unsigned char);
>>> -void __addfsdword(unsigned long, unsigned long);
>>> -void __addfsword(unsigned long, unsigned short);
>>> -void __code_seg(const char *);
>>> -static __inline__
>>> -void __cpuid(int[4], int);
>>> -static __inline__
>>> -void __cpuidex(int[4], int, int);
>>> -void __debugbreak(void);
>>> -__int64 __emul(int, int);
>>> -unsigned __int64 __emulu(unsigned int, unsigned int);
>>> -void __cdecl __fastfail(unsigned int);
>>> -unsigned int __getcallerseflags(void);
>>> -static __inline__
>>> -void __halt(void);
>>> -unsigned char __inbyte(unsigned short);
>>> -void __inbytestring(unsigned short, unsigned char *, unsigned long);
>>> -void __incfsbyte(unsigned long);
>>> -void __incfsdword(unsigned long);
>>> -void __incfsword(unsigned long);
>>> -unsigned long __indword(unsigned short);
>>> -void __indwordstring(unsigned short, unsigned long *, unsigned long);
>>> -void __int2c(void);
>>> -void __invlpg(void *);
>>> -unsigned short __inword(unsigned short);
>>> -void __inwordstring(unsigned short,

Re: r272701 - Rename Intrin.h to intrin.h, that's how all the documentation calls it.

2016-06-14 Thread Vitaly Buka via cfe-commits
thanks

On Tue, Jun 14, 2016 at 1:31 PM Rui Ueyama  wrote:

> Hans seems to fix it in r272701.
>
> On Tue, Jun 14, 2016 at 1:26 PM, Vitaly Buka via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Probably the bot was broken by this CL
>> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/9922
>>
>> On Tue, Jun 14, 2016 at 1:03 PM Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> This change was generated by running `svn mv -m "Rename Intrin.h to
>>> intrin.h, that's how all the documentation calls it."
>>> https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/Intrin.h
>>> https://n...@llvm.org/svn/llvm-project/cfe/trunk/lib/Headers/intrin.h`
>>> 
>>> – I didn't manually do anything with that svn:mergeinfo chunk.
>>>
>>> On Tue, Jun 14, 2016 at 9:54 PM, Nico Weber via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: nico
 Date: Tue Jun 14 14:54:40 2016
 New Revision: 272701

 URL: http://llvm.org/viewvc/llvm-project?rev=272701&view=rev
 Log:
 Rename Intrin.h to intrin.h, that's how all the documentation calls it.

 Added:
 cfe/trunk/lib/Headers/intrin.h   (props changed)
   - copied unchanged from r272700, cfe/trunk/lib/Headers/Intrin.h
 Removed:
 cfe/trunk/lib/Headers/Intrin.h

 Removed: cfe/trunk/lib/Headers/Intrin.h
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=272700&view=auto

 ==
 --- cfe/trunk/lib/Headers/Intrin.h (original)
 +++ cfe/trunk/lib/Headers/Intrin.h (removed)
 @@ -1,957 +0,0 @@
 -/* === Intrin.h
 ---===
 - *
 - * Permission is hereby granted, free of charge, to any person
 obtaining a copy
 - * of this software and associated documentation files (the
 "Software"), to deal
 - * in the Software without restriction, including without limitation
 the rights
 - * to use, copy, modify, merge, publish, distribute, sublicense,
 and/or sell
 - * copies of the Software, and to permit persons to whom the Software
 is
 - * furnished to do so, subject to the following conditions:
 - *
 - * The above copyright notice and this permission notice shall be
 included in
 - * all copies or substantial portions of the Software.
 - *
 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR
 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY,
 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
 SHALL THE
 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 OTHER
 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 ARISING FROM,
 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS IN
 - * THE SOFTWARE.
 - *
 -
 *===---===
 - */
 -
 -/* Only include this if we're compiling for the windows platform. */
 -#ifndef _MSC_VER
 -#include_next 
 -#else
 -
 -#ifndef __INTRIN_H
 -#define __INTRIN_H
 -
 -/* First include the standard intrinsics. */
 -#if defined(__i386__) || defined(__x86_64__)
 -#include 
 -#endif
 -
 -/* For the definition of jmp_buf. */
 -#if __STDC_HOSTED__
 -#include 
 -#endif
 -
 -/* Define the default attributes for the functions in this file. */
 -#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__,
 __nodebug__))
 -
 -#ifdef __cplusplus
 -extern "C" {
 -#endif
 -
 -#if defined(__MMX__)
 -/* And the random ones that aren't in those files. */
 -__m64 _m_from_float(float);
 -float _m_to_float(__m64);
 -#endif
 -
 -/* Other assorted instruction intrinsics. */
 -void __addfsbyte(unsigned long, unsigned char);
 -void __addfsdword(unsigned long, unsigned long);
 -void __addfsword(unsigned long, unsigned short);
 -void __code_seg(const char *);
 -static __inline__
 -void __cpuid(int[4], int);
 -static __inline__
 -void __cpuidex(int[4], int, int);
 -void __debugbreak(void);
 -__int64 __emul(int, int);
 -unsigned __int64 __emulu(unsigned int, unsigned int);
 -void __cdecl __fastfail(unsigned int);
 -unsigned int __getcallerseflags(void);
 -static __inline__
 -void __halt(void);
 -unsigned char __inbyte(unsigned short);
 -void __inbytestring(unsigned short, unsigned char *, unsigned long);
 -void __incfsbyte(unsigned long);
 -void __incfsdword(unsigned long);
 -void __incfsword(unsigned long);
 -unsigned long __indword(unsigned short);
 -void __

Re: [PATCH] D21320: Alternative to D1332

2016-06-14 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT resigned from this revision.
STL_MSFT removed a reviewer: STL_MSFT.
STL_MSFT added a comment.

My only concern is that the tests in test/std shouldn't exercise this bug in 
the standard, as MSVC's implementation doesn't special-case it. If you'd like 
to special-case it in your product code that seems fine; this is almost to the 
point where the standard is so obviously broken that it should just be 
disregarded.


http://reviews.llvm.org/D21320



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


Re: [PATCH] D21317: [sanitizer] Allow sanitize coverage w/o sanitizers.

2016-06-14 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

In http://reviews.llvm.org/D21317#457784, @kcc wrote:

> Can you at least add a compiler-rt test where we ensure that this flag can 
> not be used such that it wil compile but fail to link?
>
> E.g.
>
>   clang -fsanitize-coverage=edge x.c 
>
> should compile *and* link (and run)


http://reviews.llvm.org/D21339


Repository:
  rL LLVM

http://reviews.llvm.org/D21317



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


Re: [PATCH] D21094: [libcxx] [test] In test/support/test_allocator.h, fix construct() to avoid moving immovable types.

2016-06-14 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT updated this revision to Diff 60736.
STL_MSFT added a comment.

Inspect TEST_STD_VER and cast to void* as requested. I used a static_cast to 
avoid triggering any old-style cast warnings.

(I also just noticed that I deleted an empty line, but was too lazy to 
regenerate the diff. Oops.)


http://reviews.llvm.org/D21094

Files:
  test/support/test_allocator.h

Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -80,14 +80,14 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#if TEST_STD_VER < 11
 void construct(pointer p, const T& val)
-{::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+{::new(static_cast(p)) T(val);}
+#else
+template  void construct(pointer p, U&& val)
+{::new(static_cast(p)) T(std::forward(val));}
+#endif
 void destroy(pointer p) {p->~T();}
-
 friend bool operator==(const test_allocator& x, const test_allocator& y)
 {return x.data_ == y.data_;}
 friend bool operator!=(const test_allocator& x, const test_allocator& y)
@@ -140,12 +140,13 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#if TEST_STD_VER < 11
 void construct(pointer p, const T& val)
-{::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+{::new(static_cast(p)) T(val);}
+#else
+template  void construct(pointer p, U&& val)
+{::new(static_cast(p)) T(std::forward(val));}
+#endif
 void destroy(pointer p) {p->~T();}
 
 friend bool operator==(const non_default_test_allocator& x, const 
non_default_test_allocator& y)


Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -80,14 +80,14 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#if TEST_STD_VER < 11
 void construct(pointer p, const T& val)
-{::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+{::new(static_cast(p)) T(val);}
+#else
+template  void construct(pointer p, U&& val)
+{::new(static_cast(p)) T(std::forward(val));}
+#endif
 void destroy(pointer p) {p->~T();}
-
 friend bool operator==(const test_allocator& x, const test_allocator& y)
 {return x.data_ == y.data_;}
 friend bool operator!=(const test_allocator& x, const test_allocator& y)
@@ -140,12 +140,13 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#if TEST_STD_VER < 11
 void construct(pointer p, const T& val)
-{::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+{::new(static_cast(p)) T(val);}
+#else
+template  void construct(pointer p, U&& val)
+{::new(static_cast(p)) T(std::forward(val));}
+#endif
 void destroy(pointer p) {p->~T();}
 
 friend bool operator==(const non_default_test_allocator& x, const non_default_test_allocator& y)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21337: [CUDA] Give templated device functions internal linkage, templated kernels external linkage.

2016-06-14 Thread Justin Lebar via cfe-commits
jlebar added a comment.

tra makes the good point that maybe this should be done in ASTContext, where we 
already have a special case for __global__.  (I think I gravitated to doing it 
this way because the GVA* enums have zero documentation -- at least I have a 
vague idea of what the LLVM attributes do.  :)

Suggestions welcome, Richard, this patch is just a guess.


http://reviews.llvm.org/D21337



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


Re: [PATCH] D20339: Update clang for D20260

2016-06-14 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a reviewer: rsmith.
rsmith added a comment.
This revision is now accepted and ready to land.

Adding `-cl-opt-disable` to the tests seems fine as an alternative short-term 
approach; LGTM with that approach (either as part of this change or a separate 
change before/after). In the long term, I agree that it would be better if the 
driver specified the relevant -O flag here.


http://reviews.llvm.org/D20339



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


[PATCH] D21343: Implement `lcm` and `gcd` from library fundamentals V2

2016-06-14 Thread Marshall Clow via cfe-commits
mclow.lists created this revision.
mclow.lists added reviewers: EricWF, howard.hinnant.
mclow.lists added a subscriber: cfe-commits.

These are probably going to end up in C++17 as well.

This is a straight addition; no changes to existing code.

http://reviews.llvm.org/D21343

Files:
  include/experimental/numeric
  test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
  test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
  
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
  
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
  
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
  
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp

Index: test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
===
--- test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
+++ test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include 
+
+int main () {}
Index: test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
===
--- test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
+++ test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -0,0 +1,252 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// 
+
+// template
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include 
+#include 
+#include 
+
+template 
+void test0(Input1 in1, Input2 in2, Output out)
+{
+static_assert((std::is_same::value), "" );
+assert(out == std::experimental::lcm(in1, in2));
+}
+
+
+template 
+void test_same_signed()
+{
+static_assert(( std::is_signed::value), "" );
+
+//  Returns: zero when either m or n is zero.
+test0( 0,  0,  0);
+test0( 1,  0,  0);
+test0( 0,  1,  0);
+test0(-1,  0,  0);
+test0( 0, -1,  0);
+
+//  Otherwise, returns the least common multiple of |m| and |n|.
+test0(  1,   1,  1);
+test0(  2,   3,  6);
+test0(  2,   4,  4);
+test0(  3,  17, 51);
+test0( 36,  18, 36);
+
+test0( -1,   1,  1);
+test0( -2,   3,  6);
+test0( -2,   4,  4);
+test0( -3,  17, 51);
+test0(-36,  18, 36);
+
+test0(  1,  -1,  1);
+test0(  2,  -3,  6);
+test0(  2,  -4,  4);
+test0(  3, -17, 51);
+test0( 36, -18, 36);
+
+test0( -1,  -1,  1);
+test0( -2,  -3,  6);
+test0( -2,  -4,  4);
+test0( -3, -17, 51);
+test0(-36, -18, 36);
+}
+
+template 
+void test_same_unsigned()
+{
+static_assert((!std::is_signed::value), "" );
+
+//  Returns: zero when either m or n is zero.
+test0( 0,  0,  0);
+test0( 1,  0,  0);
+test0( 0,  1,  0);
+
+//  Otherwise, returns the least common multiple of |m| and |n|.
+test0(  1,   1,  1);
+test0(  2,   3,  6);
+test0(  2,   4,  4);
+test0(  3,  17, 51);
+test0( 36,  18, 36);
+}
+
+
+template 
+void test_different_signed()
+{
+static_assert(( std::is_signed::value), "" );
+static_assert(( std::is_signed::value), "" );
+
+//  Returns: zero when either m or n is zero.
+test0( 0,  0,  0);
+test0( 1,  0,  0);
+test0( 0,  1,  0);
+test0(-1,  0,  0);
+test0( 0, -1,  0);
+
+//  Otherwise, returns the least common multiple of |m| and |n|.
+test0(  1,   1,  1);
+test0(  2,   3,  6);
+test0(  2,   4,  4);
+test0(  3,  17, 51);
+test0( 36,  18, 36);
+
+test0( -1,   1,  1);
+test0( -2,   3,  6);
+test0( -2,   4,  4);
+test0( -3,  17, 51);
+test0(-36,  18, 36);
+
+test0(  1,  -1,  1);
+test0(  2,  -3,  6);
+test0(  2,  -4,  4);
+test0(  3, -17, 51);
+test0( 36, -18, 36);
+
+test0( -1,  -1,  1);
+test0( -2,  -3,  6);
+test0( -2,  -4,  4);
+test0( -3, -17, 51);
+test0(-36, -18, 36);
+}
+
+template 
+void test_different_unsigned()
+{
+static_assert((!std::is_signed::value), "" );
+static_assert((!std

r272710 - Update clang for D20348

2016-06-14 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Tue Jun 14 16:02:05 2016
New Revision: 272710

URL: http://llvm.org/viewvc/llvm-project?rev=272710&view=rev
Log:
Update clang for D20348

Differential Revision: http://reviews.llvm.org/D20339

Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGVTT.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGen/attr-func-def.c
cfe/trunk/test/CodeGen/mips-vector-arg.c
cfe/trunk/test/CodeGen/packed-arrays.c
cfe/trunk/test/CodeGen/x86_64-longdouble.c
cfe/trunk/test/CodeGenCXX/atomicinit.cpp
cfe/trunk/test/CodeGenCXX/virtual-base-ctor.cpp
cfe/trunk/test/CodeGenOpenCL/constant-addr-space-globals.cl
cfe/trunk/test/CodeGenOpenCL/shifts.cl
cfe/trunk/test/CodeGenOpenCL/str_literals.cl
cfe/trunk/test/SemaOpenCL/extern.cl

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=272710&r1=272709&r2=272710&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Jun 14 16:02:05 2016
@@ -1274,7 +1274,7 @@ void CodeGenFunction::EmitAutoVarInit(co
llvm::GlobalValue::PrivateLinkage,
constant, Name);
 GV->setAlignment(Loc.getAlignment().getQuantity());
-GV->setUnnamedAddr(true);
+GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 
 Address SrcPtr = Address(GV, Loc.getAlignment());
 if (SrcPtr.getType() != BP)

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=272710&r1=272709&r2=272710&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Jun 14 16:02:05 2016
@@ -2324,7 +2324,7 @@ llvm::Constant *CodeGenFunction::EmitChe
   auto *GV = new llvm::GlobalVariable(
   CGM.getModule(), Descriptor->getType(),
   /*isConstant=*/true, llvm::GlobalVariable::PrivateLinkage, Descriptor);
-  GV->setUnnamedAddr(true);
+  GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   CGM.getSanitizerMetadata()->disableSanitizerForGlobal(GV);
 
   // Remember the descriptor for this type.
@@ -2545,7 +2545,7 @@ void CodeGenFunction::EmitCheck(
 auto *InfoPtr =
 new llvm::GlobalVariable(CGM.getModule(), Info->getType(), false,
  llvm::GlobalVariable::PrivateLinkage, Info);
-InfoPtr->setUnnamedAddr(true);
+InfoPtr->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 CGM.getSanitizerMetadata()->disableSanitizerForGlobal(InfoPtr);
 Args.push_back(Builder.CreateBitCast(InfoPtr, Int8PtrTy));
 ArgTypes.push_back(Int8PtrTy);
@@ -2604,7 +2604,7 @@ void CodeGenFunction::EmitCfiSlowPathChe
 auto *InfoPtr =
 new llvm::GlobalVariable(CGM.getModule(), Info->getType(), false,
  llvm::GlobalVariable::PrivateLinkage, Info);
-InfoPtr->setUnnamedAddr(true);
+InfoPtr->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 CGM.getSanitizerMetadata()->disableSanitizerForGlobal(InfoPtr);
 
 llvm::Constant *SlowPathDiagFn = CGM.getModule().getOrInsertFunction(

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=272710&r1=272709&r2=272710&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Jun 14 16:02:05 2016
@@ -909,7 +909,7 @@ Address CGOpenMPRuntime::getOrCreateDefa
 auto DefaultOpenMPLocation = new llvm::GlobalVariable(
 CGM.getModule(), IdentTy, /*isConstant*/ true,
 llvm::GlobalValue::PrivateLinkage, /*Initializer*/ nullptr);
-DefaultOpenMPLocation->setUnnamedAddr(true);
+
DefaultOpenMPLocation->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 DefaultOpenMPLocation->setAlignment(Align.getQuantity());
 
 llvm::Constant *Zero = llvm::ConstantInt::get(CGM.Int32Ty, 0, true);
@@ -2840,7 +2840,7 @@ CGOpenMPRuntime::createOffloadingBinaryD
   M, DeviceImagesInitTy, /*isConstant=*/true,
   llvm::GlobalValue::InternalLinkage, DeviceImagesInit,
   ".omp_offloading.device_images");
-  DeviceImages->setUnnamedAddr(true);
+  DeviceImages->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 
   // This is a Zero array to be used in the creation of the constant 
expressions
   llvm::Constant *Index[] = {llvm::Constant::getNullValue(CGM.Int32Ty),
@@ -2903,7 +2903,7 @@ void CGOpenMPRunti

Re: [PATCH] D20339: Update clang for D20260

2016-06-14 Thread Peter Collingbourne via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272710: Update clang for D20348 (authored by pcc).

Changed prior to commit:
  http://reviews.llvm.org/D20339?vs=57527&id=60747#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20339

Files:
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  cfe/trunk/lib/CodeGen/CGExpr.cpp
  cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
  cfe/trunk/lib/CodeGen/CGVTT.cpp
  cfe/trunk/lib/CodeGen/CGVTables.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
  cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
  cfe/trunk/test/CodeGen/attr-func-def.c
  cfe/trunk/test/CodeGen/mips-vector-arg.c
  cfe/trunk/test/CodeGen/packed-arrays.c
  cfe/trunk/test/CodeGen/x86_64-longdouble.c
  cfe/trunk/test/CodeGenCXX/atomicinit.cpp
  cfe/trunk/test/CodeGenCXX/virtual-base-ctor.cpp
  cfe/trunk/test/CodeGenOpenCL/constant-addr-space-globals.cl
  cfe/trunk/test/CodeGenOpenCL/shifts.cl
  cfe/trunk/test/CodeGenOpenCL/str_literals.cl
  cfe/trunk/test/SemaOpenCL/extern.cl

Index: cfe/trunk/lib/CodeGen/CGVTables.cpp
===
--- cfe/trunk/lib/CodeGen/CGVTables.cpp
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp
@@ -606,7 +606,7 @@
   StringRef PureCallName = CGM.getCXXABI().GetPureVirtualCallName();
   PureVirtualFn = CGM.CreateRuntimeFunction(Ty, PureCallName);
   if (auto *F = dyn_cast(PureVirtualFn))
-F->setUnnamedAddr(true);
+F->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   PureVirtualFn = llvm::ConstantExpr::getBitCast(PureVirtualFn,
  CGM.Int8PtrTy);
 }
@@ -619,7 +619,7 @@
 CGM.getCXXABI().GetDeletedVirtualCallName();
   DeletedVirtualFn = CGM.CreateRuntimeFunction(Ty, DeletedCallName);
   if (auto *F = dyn_cast(DeletedVirtualFn))
-F->setUnnamedAddr(true);
+F->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   DeletedVirtualFn = llvm::ConstantExpr::getBitCast(DeletedVirtualFn,
  CGM.Int8PtrTy);
 }
@@ -698,7 +698,7 @@
   CGM.setGlobalVisibility(VTable, RD);
 
   // V-tables are always unnamed_addr.
-  VTable->setUnnamedAddr(true);
+  VTable->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 
   llvm::Constant *RTTI = CGM.GetAddrOfRTTIDescriptor(
   CGM.getContext().getTagDeclType(Base.getBase()));
Index: cfe/trunk/lib/CodeGen/CGVTT.cpp
===
--- cfe/trunk/lib/CodeGen/CGVTT.cpp
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp
@@ -121,7 +121,7 @@
   llvm::GlobalVariable *GV =
 CGM.CreateOrReplaceCXXRuntimeVariable(Name, ArrayType, 
   llvm::GlobalValue::ExternalLinkage);
-  GV->setUnnamedAddr(true);
+  GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   return GV;
 }
 
Index: cfe/trunk/lib/CodeGen/CGDecl.cpp
===
--- cfe/trunk/lib/CodeGen/CGDecl.cpp
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp
@@ -1274,7 +1274,7 @@
llvm::GlobalValue::PrivateLinkage,
constant, Name);
 GV->setAlignment(Loc.getAlignment().getQuantity());
-GV->setUnnamedAddr(true);
+GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 
 Address SrcPtr = Address(GV, Loc.getAlignment());
 if (SrcPtr.getType() != BP)
Index: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
===
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1575,7 +1575,7 @@
 
   VTable = CGM.CreateOrReplaceCXXRuntimeVariable(
   Name, ArrayType, llvm::GlobalValue::ExternalLinkage);
-  VTable->setUnnamedAddr(true);
+  VTable->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 
   if (RD->hasAttr())
 VTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
Index: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
===
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -1712,7 +1712,7 @@
   VTable = new llvm::GlobalVariable(CGM.getModule(), VTableType,
 /*isConstant=*/true, VTableLinkage,
 /*Initializer=*/nullptr, VTableName);
-  VTable->setUnnamedAddr(true);
+  VTable->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 
   llvm::Comdat *C = nullptr;
   if (!VFTableComesFromAnotherTU &&
@@ -1740,7 +1740,7 @@
 /*AddressSpace=*/0, VFTableLinkage,
 VFTableName.str(), VTableGEP,
 &CGM.getModule());
-VFTable->setUnnamedAddr(true);
+

  1   2   >