[PATCH] D51729: [Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files

2018-11-05 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In https://reviews.llvm.org/D51729#1287421, @Lekensteyn wrote:

> Before this patch, missing compilation database entries resulted in "Skipping 
>  Compile command not found." which is assumed by the tests in this 
> clang-query patch: https://reviews.llvm.org/D54109
>
> After this patch, a command is inferred, but this is not always desired.
>  Use case: find all function calls with a certain name using the compilation 
> database produced by CMake.
>  Example command:
>
>   clang-query -p=/tmp/wsbuild -c 'set output print' -c 'm 
> callExpr(callee(functionDecl(hasName("uat_new"' $(grep -rl uat_new 
> epan/dissectors/)
>
>
> Expected result for some template files which do not exist in the compilation 
> database:
>
>   Skipping .../epan/dissectors/asn1/x509af/packet-x509af-template.c. Compile 
> command not found.
>
>
> Actual result (clang-query tries to parse the contents which will fail since 
> it is not an actual C source file):
>
>   .../epan/dissectors/asn1/x509af/packet-x509af-template.c:18:10: fatal 
> error: 'packet-ber.h' file not found
>
>
> I'm not entirely sure what to do here. The old behavior works great in cases 
> where a complete database is available (produced by CMake). The new behavior 
> might work better for clangd (?), but it breaks a use case (see above).


For clangd, but also clang-tidy and clang-query when the user *does* want to 
use it on files not represented in the CDB. (e.g. stale or headers)
There's indeed a tension here, because the CDB discovery needs to have a 
default configuration.

That said, in this case the behavior looks appropriate to me: you've explicitly 
specified files on the command line, ignoring them and returning with status 0 
seems surprising.
For the case of "search over all TUs in CDB", the CDB does offer the ability to 
list TUs and iterate over compile commands, and ClangTool lets you run in this 
mode. We've discussed in the past adding a filename filter to `AllTUsExecutor`, 
which would be useful for this purpose and others. @ioeric


Repository:
  rC Clang

https://reviews.llvm.org/D51729



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


r346212 - Cast to uint64_t instead of to unsigned.

2018-11-05 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon Nov  5 23:12:28 2018
New Revision: 346212

URL: http://llvm.org/viewvc/llvm-project?rev=346212=rev
Log:
Cast to uint64_t instead of to unsigned.

This is a follow-up to r346211.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346212=346211=346212=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov  5 23:12:28 2018
@@ -1171,7 +1171,7 @@ RValue CodeGenFunction::emitBuiltinOSLog
 if (Item.getKind() == analyze_os_log::OSLogBufferItem::MaskKind) {
   uint64_t Val = 0;
   for (unsigned I = 0, E = Item.getMaskType().size(); I < E; ++I)
-Val |= ((unsigned )Item.getMaskType()[I]) << I * 8;
+Val |= ((uint64_t)Item.getMaskType()[I]) << I * 8;
   ArgVal = llvm::Constant::getIntegerValue(Int64Ty, llvm::APInt(64, Val));
 } else if (const Expr *TheExpr = Item.getExpr()) {
   ArgVal = EmitScalarExpr(TheExpr, /*Ignore*/ false);


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


r346211 - os_log: Allow specifying mask type in format string.

2018-11-05 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon Nov  5 23:05:14 2018
New Revision: 346211

URL: http://llvm.org/viewvc/llvm-project?rev=346211=rev
Log:
os_log: Allow specifying mask type in format string.

A mask type is a 1 to 8-byte string that follows the "mask." annotation
in the format string. This enables obfuscating data in the event the
provided privacy level isn't enabled.

rdar://problem/36756282

Modified:
cfe/trunk/include/clang/AST/FormatString.h
cfe/trunk/include/clang/AST/OSLog.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/OSLog.cpp
cfe/trunk/lib/AST/PrintfFormatString.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/builtins.c
cfe/trunk/test/SemaObjC/format-strings-oslog.m

Modified: cfe/trunk/include/clang/AST/FormatString.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/FormatString.h?rev=346211=346210=346211=diff
==
--- cfe/trunk/include/clang/AST/FormatString.h (original)
+++ cfe/trunk/include/clang/AST/FormatString.h Mon Nov  5 23:05:14 2018
@@ -477,6 +477,7 @@ class PrintfSpecifier : public analyze_f
   OptionalFlag IsPublic; // '{public}'
   OptionalFlag IsSensitive;  // '{sensitive}'
   OptionalAmount Precision;
+  StringRef MaskType;
 public:
   PrintfSpecifier()
   : FormatSpecifier(/* isPrintf = */ true), HasThousandsGrouping("'"),
@@ -559,6 +560,9 @@ public:
   const OptionalFlag () const { return IsSensitive; }
   bool usesPositionalArg() const { return UsesPositionalArg; }
 
+  StringRef getMaskType() const { return MaskType; }
+  void setMaskType(StringRef S) { MaskType = S; }
+
   /// Changes the specifier and length according to a QualType, retaining any
   /// flags or options. Returns true on success, or false when a conversion
   /// was not successful.
@@ -691,6 +695,9 @@ public:
 return true;
   }
 
+  /// Handle mask types whose sizes are not between one and eight bytes.
+  virtual void handleInvalidMaskType(StringRef MaskType) {}
+
 // Scanf-specific handlers.
 
   virtual bool HandleInvalidScanfConversionSpecifier(

Modified: cfe/trunk/include/clang/AST/OSLog.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OSLog.h?rev=346211=346210=346211=diff
==
--- cfe/trunk/include/clang/AST/OSLog.h (original)
+++ cfe/trunk/include/clang/AST/OSLog.h Mon Nov  5 23:05:14 2018
@@ -52,7 +52,10 @@ public:
 
 // The item is corresponding to the '%m' format specifier, no value is
 // populated in the buffer and the runtime is loading the errno value.
-ErrnoKind
+ErrnoKind,
+
+// The item is a mask type.
+MaskKind
   };
 
   enum {
@@ -72,10 +75,13 @@ private:
   CharUnits ConstValue;
   CharUnits Size; // size of the data, not including the header bytes
   unsigned Flags = 0;
+  StringRef MaskType;
 
 public:
-  OSLogBufferItem(Kind kind, const Expr *expr, CharUnits size, unsigned flags)
-  : TheKind(kind), TheExpr(expr), Size(size), Flags(flags) {
+  OSLogBufferItem(Kind kind, const Expr *expr, CharUnits size, unsigned flags,
+  StringRef maskType = StringRef())
+  : TheKind(kind), TheExpr(expr), Size(size), Flags(flags),
+MaskType(maskType) {
 assert(((Flags == 0) || (Flags == IsPrivate) || (Flags == IsPublic) ||
 (Flags == IsSensitive)) &&
"unexpected privacy flag");
@@ -99,6 +105,8 @@ public:
   const Expr *getExpr() const { return TheExpr; }
   CharUnits getConstValue() const { return ConstValue; }
   CharUnits size() const { return Size; }
+
+  StringRef getMaskType() const { return MaskType; }
 };
 
 class OSLogBufferLayout {
@@ -122,9 +130,10 @@ public:
 Items, [](const OSLogBufferItem ) { return Item.getIsPrivate(); 
});
   }
 
-  bool hasNonScalar() const {
+  bool hasNonScalarOrMask() const {
 return llvm::any_of(Items, [](const OSLogBufferItem ) {
-  return Item.getKind() != OSLogBufferItem::ScalarKind;
+  return Item.getKind() != OSLogBufferItem::ScalarKind ||
+ !Item.getMaskType().empty();
 });
   }
 
@@ -132,7 +141,7 @@ public:
 unsigned char result = 0;
 if (hasPrivateItems())
   result |= HasPrivateItems;
-if (hasNonScalar())
+if (hasNonScalarOrMask())
   result |= HasNonScalarItems;
 return result;
   }

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=346211=346210=346211=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Nov  5 23:05:14 
2018
@@ -7902,6 +7902,8 @@ def warn_format_non_standard: Warning<
 def 

r346210 - os_log: Add a new privacy annotation "sensitive".

2018-11-05 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon Nov  5 22:26:17 2018
New Revision: 346210

URL: http://llvm.org/viewvc/llvm-project?rev=346210=rev
Log:
os_log: Add a new privacy annotation "sensitive".

This is a stricter privacy annotation than "private", which will be used
for data that shouldn’t be logged to disk. For backward compatibility,
the "private" bit is set too.

rdar://problem/36755912

Modified:
cfe/trunk/include/clang/AST/FormatString.h
cfe/trunk/include/clang/AST/OSLog.h
cfe/trunk/lib/AST/OSLog.cpp
cfe/trunk/lib/AST/PrintfFormatString.cpp
cfe/trunk/test/CodeGen/builtins.c

Modified: cfe/trunk/include/clang/AST/FormatString.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/FormatString.h?rev=346210=346209=346210=diff
==
--- cfe/trunk/include/clang/AST/FormatString.h (original)
+++ cfe/trunk/include/clang/AST/FormatString.h Mon Nov  5 22:26:17 2018
@@ -475,13 +475,15 @@ class PrintfSpecifier : public analyze_f
   OptionalFlag HasObjCTechnicalTerm; // '[tt]'
   OptionalFlag IsPrivate;// '{private}'
   OptionalFlag IsPublic; // '{public}'
+  OptionalFlag IsSensitive;  // '{sensitive}'
   OptionalAmount Precision;
 public:
   PrintfSpecifier()
   : FormatSpecifier(/* isPrintf = */ true), HasThousandsGrouping("'"),
 IsLeftJustified("-"), HasPlusPrefix("+"), HasSpacePrefix(" "),
 HasAlternativeForm("#"), HasLeadingZeroes("0"),
-HasObjCTechnicalTerm("tt"), IsPrivate("private"), IsPublic("public") {}
+HasObjCTechnicalTerm("tt"), IsPrivate("private"), IsPublic("public"),
+IsSensitive("sensitive") {}
 
   static PrintfSpecifier Parse(const char *beg, const char *end);
 
@@ -512,6 +514,9 @@ public:
   }
   void setIsPrivate(const char *position) { IsPrivate.setPosition(position); }
   void setIsPublic(const char *position) { IsPublic.setPosition(position); }
+  void setIsSensitive(const char *position) {
+IsSensitive.setPosition(position);
+  }
   void setUsesPositionalArg() { UsesPositionalArg = true; }
 
 // Methods for querying the format specifier.
@@ -551,6 +556,7 @@ public:
   const OptionalFlag () const { return 
HasObjCTechnicalTerm; }
   const OptionalFlag () const { return IsPrivate; }
   const OptionalFlag () const { return IsPublic; }
+  const OptionalFlag () const { return IsSensitive; }
   bool usesPositionalArg() const { return UsesPositionalArg; }
 
   /// Changes the specifier and length according to a QualType, retaining any

Modified: cfe/trunk/include/clang/AST/OSLog.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OSLog.h?rev=346210=346209=346210=diff
==
--- cfe/trunk/include/clang/AST/OSLog.h (original)
+++ cfe/trunk/include/clang/AST/OSLog.h Mon Nov  5 22:26:17 2018
@@ -60,7 +60,10 @@ public:
 IsPrivate = 0x1,
 
 // The item is marked "public" in the format string.
-IsPublic = 0x2
+IsPublic = 0x2,
+
+// The item is marked "sensitive" in the format string.
+IsSensitive = 0x4 | IsPrivate
   };
 
 private:
@@ -73,7 +76,8 @@ private:
 public:
   OSLogBufferItem(Kind kind, const Expr *expr, CharUnits size, unsigned flags)
   : TheKind(kind), TheExpr(expr), Size(size), Flags(flags) {
-assert(((Flags == 0) || (Flags == IsPrivate) || (Flags == IsPublic)) &&
+assert(((Flags == 0) || (Flags == IsPrivate) || (Flags == IsPublic) ||
+(Flags == IsSensitive)) &&
"unexpected privacy flag");
   }
 

Modified: cfe/trunk/lib/AST/OSLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OSLog.cpp?rev=346210=346209=346210=diff
==
--- cfe/trunk/lib/AST/OSLog.cpp (original)
+++ cfe/trunk/lib/AST/OSLog.cpp Mon Nov  5 22:26:17 2018
@@ -120,7 +120,9 @@ public:
   ArgsData.back().FieldWidth = Args[FS.getFieldWidth().getArgIndex()];
 }
 
-if (FS.isPrivate())
+if (FS.isSensitive())
+  ArgsData.back().Flags |= OSLogBufferItem::IsSensitive;
+else if (FS.isPrivate())
   ArgsData.back().Flags |= OSLogBufferItem::IsPrivate;
 else if (FS.isPublic())
   ArgsData.back().Flags |= OSLogBufferItem::IsPublic;

Modified: cfe/trunk/lib/AST/PrintfFormatString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/PrintfFormatString.cpp?rev=346210=346209=346210=diff
==
--- cfe/trunk/lib/AST/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/AST/PrintfFormatString.cpp Mon Nov  5 22:26:17 2018
@@ -127,7 +127,8 @@ static PrintfSpecifierResult ParsePrintf
 
 do {
   StringRef Str(I, E - I);
-  std::string Match = "^[[:space:]]*(private|public)[[:space:]]*(,|})";
+  std::string Match = "^[[:space:]]*(private|public|sensitive)"
+  

[PATCH] D53738: [Fixed Point Arithmetic] Fixed Point Addition

2018-11-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D53738#1287123, @ebevhan wrote:

> In https://reviews.llvm.org/D53738#1284213, @rjmccall wrote:
>
> > Not out of line with other features that significantly break with what's 
> > expressible.  But the easy alternative to storing the intermediate "type" 
> > in the AST is to just provide a global function that can compute it on 
> > demand.
>
>
> Yeah, it might just be simpler to go the route of not storing the computation 
> semantic in the AST, at least for now. That's fairly similar to the solution 
> in the patch, so I feel a bit silly for just going around in a circle.
>
> To make that work I think the patch needs some changes, though. There should 
> be a function in FixedPointSemantics to find the common full-precision 
> semantic between two semantics, and the `getFixedPointSemantics` in 
> ASTContext should be amended to take integer types (or another method should 
> be provided for this, but that one already exists). I think that the 
> `FixedPointConversions` method should also be embedded into the rest of 
> `UsualArithmeticConversions` as there shouldn't be any need to have it 
> separate. You still want to do the rvalue conversion and other promotions, 
> and the rules for fixed-point still fit into the arithmetic conversions, even 
> in the spec.
>
> `EmitFixedPointConversion` should be changed to take FixedPointSemantics 
> rather than QualType. This has a couple of downsides:
>
> - It can no longer handle floating point conversions. They would have to be 
> handled in EmitScalarConversion.
> - Conversion from integer is fine, but conversion to integer cannot be 
> generalized away with the fixed-point semantics as they are currently, as 
> that kind of conversion must round towards zero. This requires a rounding 
> step for negative numbers before downscaling, which the current code does not 
> do. Is there a better way of generalizing this?


`FixedPointSemantics` is free to do whatever is convenient for the 
representation; if it helps to make it able to explicitly represent an integral 
type — and then just assert that it's never in that form when it's used in 
certain places, I think that works.  Although you might consider making a 
`FixedPointOrIntegralSemantics` class and then making `FixedPointSemantics` a 
subclass which adds nothing to the representation but semantically asserts that 
it's representing a fixed-point type.

> All `EmitFixedPointAdd` should have to do is get the semantics of the 
> operands and result type, get their full-precision semantic, call 
> `EmitFixedPointConversion` on both operands, do the addition, and call it 
> again to convert back to the result value. Move as much of the conversions as 
> possible out of the function.
> 
> Does all this sound reasonable?

Makes sense to me.


Repository:
  rC Clang

https://reviews.llvm.org/D53738



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


r346209 - os_log: Minor code cleanups. NFC.

2018-11-05 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon Nov  5 21:41:33 2018
New Revision: 346209

URL: http://llvm.org/viewvc/llvm-project?rev=346209=rev
Log:
os_log: Minor code cleanups. NFC.

Also, add a new test case and fix an incorrect comment.

Modified:
cfe/trunk/include/clang/AST/OSLog.h
cfe/trunk/lib/AST/OSLog.cpp
cfe/trunk/lib/AST/PrintfFormatString.cpp
cfe/trunk/test/CodeGen/builtins.c

Modified: cfe/trunk/include/clang/AST/OSLog.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OSLog.h?rev=346209=346208=346209=diff
==
--- cfe/trunk/include/clang/AST/OSLog.h (original)
+++ cfe/trunk/include/clang/AST/OSLog.h Mon Nov  5 21:41:33 2018
@@ -72,18 +72,17 @@ private:
 
 public:
   OSLogBufferItem(Kind kind, const Expr *expr, CharUnits size, unsigned flags)
-  : TheKind(kind), TheExpr(expr), Size(size), Flags(flags) {}
+  : TheKind(kind), TheExpr(expr), Size(size), Flags(flags) {
+assert(((Flags == 0) || (Flags == IsPrivate) || (Flags == IsPublic)) &&
+   "unexpected privacy flag");
+  }
 
   OSLogBufferItem(ASTContext , CharUnits value, unsigned flags)
   : TheKind(CountKind), ConstValue(value),
 Size(Ctx.getTypeSizeInChars(Ctx.IntTy)), Flags(flags) {}
 
   unsigned char getDescriptorByte() const {
-unsigned char result = 0;
-if (getIsPrivate())
-  result |= IsPrivate;
-if (getIsPublic())
-  result |= IsPublic;
+unsigned char result = Flags;
 result |= ((unsigned)getKind()) << 4;
 return result;
   }
@@ -92,7 +91,6 @@ public:
 
   Kind getKind() const { return TheKind; }
   bool getIsPrivate() const { return (Flags & IsPrivate) != 0; }
-  bool getIsPublic() const { return (Flags & IsPublic) != 0; }
 
   const Expr *getExpr() const { return TheExpr; }
   CharUnits getConstValue() const { return ConstValue; }
@@ -120,11 +118,6 @@ public:
 Items, [](const OSLogBufferItem ) { return Item.getIsPrivate(); 
});
   }
 
-  bool hasPublicItems() const {
-return llvm::any_of(
-Items, [](const OSLogBufferItem ) { return Item.getIsPublic(); });
-  }
-
   bool hasNonScalar() const {
 return llvm::any_of(Items, [](const OSLogBufferItem ) {
   return Item.getKind() != OSLogBufferItem::ScalarKind;

Modified: cfe/trunk/lib/AST/OSLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OSLog.cpp?rev=346209=346208=346209=diff
==
--- cfe/trunk/lib/AST/OSLog.cpp (original)
+++ cfe/trunk/lib/AST/OSLog.cpp Mon Nov  5 21:41:33 2018
@@ -120,12 +120,11 @@ public:
   ArgsData.back().FieldWidth = Args[FS.getFieldWidth().getArgIndex()];
 }
 
-if (FS.isPrivate()) {
+if (FS.isPrivate())
   ArgsData.back().Flags |= OSLogBufferItem::IsPrivate;
-}
-if (FS.isPublic()) {
+else if (FS.isPublic())
   ArgsData.back().Flags |= OSLogBufferItem::IsPublic;
-}
+
 return true;
   }
 

Modified: cfe/trunk/lib/AST/PrintfFormatString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/PrintfFormatString.cpp?rev=346209=346208=346209=diff
==
--- cfe/trunk/lib/AST/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/AST/PrintfFormatString.cpp Mon Nov  5 21:41:33 2018
@@ -127,7 +127,7 @@ static PrintfSpecifierResult ParsePrintf
 
 do {
   StringRef Str(I, E - I);
-  std::string Match = "^[\t\n\v\f\r ]*(private|public)[\t\n\v\f\r ]*(,|})";
+  std::string Match = "^[[:space:]]*(private|public)[[:space:]]*(,|})";
   llvm::Regex R(Match);
   SmallVector Matches;
 

Modified: cfe/trunk/test/CodeGen/builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=346209=346208=346209=diff
==
--- cfe/trunk/test/CodeGen/builtins.c (original)
+++ cfe/trunk/test/CodeGen/builtins.c Mon Nov  5 21:41:33 2018
@@ -440,7 +440,10 @@ void test_builtin_os_log(void *buf, int
   // CHECK: call void @__os_log_helper_1_2_1_8_34(
   __builtin_os_log_format(buf, "%{ xyz, public }s", "abc");
 
-  // The last privacy annotation in the string wins.
+  // CHECK: call void @__os_log_helper_1_3_1_8_33(
+  __builtin_os_log_format(buf, "%{ xyz, private }s", "abc");
+
+  // The strictest privacy annotation in the string wins.
 
   // CHECK: call void @__os_log_helper_1_3_1_8_33(
   __builtin_os_log_format(buf, "%{ private, public, private, public}s", "abc");


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


r346208 - [COFF, ARM64] Implement InterlockedDecrement*_* builtins

2018-11-05 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov  5 21:07:43 2018
New Revision: 346208

URL: http://llvm.org/viewvc/llvm-project?rev=346208=rev
Log:
[COFF, ARM64] Implement InterlockedDecrement*_* builtins

This is eight in a series of patches to move intrinsic definitions out of 
intrin.h.

Differential: https://reviews.llvm.org/D54068

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346208=346207=346208=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon Nov  5 21:07:43 2018
@@ -192,6 +192,16 @@ TARGET_HEADER_BUILTIN(_InterlockedIncrem
 TARGET_HEADER_BUILTIN(_InterlockedIncrement64_nf,  "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedDecrement16_acq, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement16_nf,  "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement16_rel, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_acq,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_nf,"LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_rel,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement64_acq, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement64_nf,  "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement64_rel, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
 TARGET_HEADER_BUILTIN(_ReadStatusReg,  "ii",  "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346208=346207=346208=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Mon Nov  5 21:07:43 2018
@@ -318,6 +318,16 @@ TARGET_HEADER_BUILTIN(_InterlockedIncrem
 TARGET_HEADER_BUILTIN(_InterlockedIncrement64_nf,  "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedDecrement16_acq, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement16_nf,  "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement16_rel, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_acq,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_nf,"LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_rel,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement64_acq, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement64_nf,  "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement64_rel, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346208=346207=346208=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov  5 21:07:43 2018
@@ -285,6 +285,19 @@ static Value *EmitAtomicIncrementValue(C
   return CGF.Builder.CreateAdd(Result, ConstantInt::get(IntTy, 1));
 }
 
+static Value *EmitAtomicDecrementValue(CodeGenFunction , const CallExpr *E,
+AtomicOrdering Ordering = AtomicOrdering::SequentiallyConsistent) {
+  assert(E->getArg(0)->getType()->isPointerType());
+
+  auto *IntTy = CGF.ConvertType(E->getType());
+  auto *Result = CGF.Builder.CreateAtomicRMW(
+   AtomicRMWInst::Sub,
+   CGF.EmitScalarExpr(E->getArg(0)),
+   

r346207 - [COFF, ARM64] Implement InterlockedIncrement*_* builtins

2018-11-05 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov  5 21:05:32 2018
New Revision: 346207

URL: http://llvm.org/viewvc/llvm-project?rev=346207=rev
Log:
[COFF, ARM64] Implement InterlockedIncrement*_* builtins

This is seventh in a series of patches to move intrinsic definitions out of 
intrin.h.

Differential: https://reviews.llvm.org/D54067

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346207=346206=346207=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon Nov  5 21:05:32 2018
@@ -182,6 +182,16 @@ TARGET_HEADER_BUILTIN(_InterlockedAnd64_
 TARGET_HEADER_BUILTIN(_InterlockedAnd64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedIncrement16_acq, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement16_nf,  "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement16_rel, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_acq,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_nf,"LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_rel,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement64_acq, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement64_nf,  "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
 TARGET_HEADER_BUILTIN(_ReadStatusReg,  "ii",  "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346207=346206=346207=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Mon Nov  5 21:05:32 2018
@@ -308,6 +308,16 @@ TARGET_HEADER_BUILTIN(_InterlockedAnd64_
 TARGET_HEADER_BUILTIN(_InterlockedAnd64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedIncrement16_acq, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement16_nf,  "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement16_rel, "ssD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_acq,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_nf,"LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_rel,   "LiLiD*",   "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement64_acq, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement64_nf,  "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346207=346206=346207=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov  5 21:05:32 2018
@@ -272,6 +272,19 @@ Value *EmitAtomicCmpXchgForMSIntrin(Code
   return CGF.Builder.CreateExtractValue(Result, 0);
 }
 
+static Value *EmitAtomicIncrementValue(CodeGenFunction , const CallExpr *E,
+AtomicOrdering Ordering = AtomicOrdering::SequentiallyConsistent) {
+  assert(E->getArg(0)->getType()->isPointerType());
+
+  auto *IntTy = CGF.ConvertType(E->getType());
+  auto *Result = CGF.Builder.CreateAtomicRMW(
+   AtomicRMWInst::Add,
+   CGF.EmitScalarExpr(E->getArg(0)),
+   

r346206 - [COFF, ARM64] Implement InterlockedAnd*_* builtins

2018-11-05 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov  5 21:03:13 2018
New Revision: 346206

URL: http://llvm.org/viewvc/llvm-project?rev=346206=rev
Log:
[COFF, ARM64] Implement InterlockedAnd*_* builtins

This is sixth in a series of patches to move intrinsic definitions out of 
intrin.h.

Differential: https://reviews.llvm.org/D54066

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346206=346205=346206=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon Nov  5 21:03:13 2018
@@ -169,6 +169,19 @@ TARGET_HEADER_BUILTIN(_InterlockedXor64_
 TARGET_HEADER_BUILTIN(_InterlockedXor64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedXor64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedAnd8_acq,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd8_nf,   "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd8_rel,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd16_acq, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd16_nf,  "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd16_rel, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_acq,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_nf,"LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_rel,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd64_acq, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
 TARGET_HEADER_BUILTIN(_ReadStatusReg,  "ii",  "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346206=346205=346206=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Mon Nov  5 21:03:13 2018
@@ -295,6 +295,19 @@ TARGET_HEADER_BUILTIN(_InterlockedXor64_
 TARGET_HEADER_BUILTIN(_InterlockedXor64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedXor64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedAnd8_acq,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd8_nf,   "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd8_rel,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd16_acq, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd16_nf,  "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd16_rel, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_acq,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_nf,"LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_rel,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd64_acq, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346206=346205=346206=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov  5 

r346205 - [COFF, ARM64] Implement InterlockedXor*_* builtins

2018-11-05 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov  5 20:55:20 2018
New Revision: 346205

URL: http://llvm.org/viewvc/llvm-project?rev=346205=rev
Log:
[COFF, ARM64] Implement InterlockedXor*_* builtins

This is fifth in a series of patches to move intrinsic definitions out of 
intrin.h.

Note: This was reviewed and approved in D54065 but somehow that diff was messed
up. Committing this again with the proper diff.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346205=346204=346205=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon Nov  5 20:55:20 2018
@@ -156,6 +156,19 @@ TARGET_HEADER_BUILTIN(_InterlockedOr64_a
 TARGET_HEADER_BUILTIN(_InterlockedOr64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedOr64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedXor8_acq,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor8_nf,   "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor8_rel,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor16_acq, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor16_nf,  "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor16_rel, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_acq,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_nf,"LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_rel,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor64_acq, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
 TARGET_HEADER_BUILTIN(_ReadStatusReg,  "ii",  "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346205=346204=346205=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Mon Nov  5 20:55:20 2018
@@ -282,6 +282,19 @@ TARGET_HEADER_BUILTIN(_InterlockedOr64_a
 TARGET_HEADER_BUILTIN(_InterlockedOr64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedOr64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedXor8_acq,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor8_nf,   "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor8_rel,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor16_acq, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor16_nf,  "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor16_rel, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_acq,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_nf,"LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_rel,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor64_acq, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346205=346204=346205=diff
==
--- 

[PATCH] D53675: [WebAssembly] Lower select for vectors

2018-11-05 Thread Thomas Lively via Phabricator via cfe-commits
tlively updated this revision to Diff 172708.
tlively added a dependency: D53630: [WebAssembly] Lower vselect.
tlively added a comment.

- Rebase onto SIMD reorganization


Repository:
  rL LLVM

https://reviews.llvm.org/D53675

Files:
  lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
  test/CodeGen/WebAssembly/simd-select.ll
  test/CodeGen/WebAssembly/simd-vselect.ll

Index: test/CodeGen/WebAssembly/simd-vselect.ll
===
--- test/CodeGen/WebAssembly/simd-vselect.ll
+++ /dev/null
@@ -1,90 +0,0 @@
-; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-unimplemented-simd -mattr=+simd128,+sign-ext | FileCheck %s
-
-; Test that lanewise vector selects lower correctly to bitselects
-
-target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
-target triple = "wasm32-unknown-unknown"
-
-; CHECK-LABEL: vselect_v16i8:
-; CHECK-NEXT: .param v128, v128, v128{{$}}
-; CHECK-NEXT: .result v128{{$}}
-; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 7{{$}}
-; CHECK-NEXT: i8x16.shl $push[[L1:[0-9]+]]=, $0, $pop[[L0]]{{$}}
-; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, 7{{$}}
-; CHECK-NEXT: i8x16.shr_s $push[[L3:[0-9]+]]=, $pop[[L1]], $pop[[L2]]{{$}}
-; CHECK-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $pop[[L3]]{{$}}
-; CHECK-NEXT: return $pop[[R]]{{$}}
-define <16 x i8> @vselect_v16i8(<16 x i1> %c, <16 x i8> %x, <16 x i8> %y) {
-  %res = select <16 x i1> %c, <16 x i8> %x, <16 x i8> %y
-  ret <16 x i8> %res
-}
-
-; CHECK-LABEL: vselect_v8i16:
-; CHECK-NEXT: .param v128, v128, v128{{$}}
-; CHECK-NEXT: .result v128{{$}}
-; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 15{{$}}
-; CHECK-NEXT: i16x8.shl $push[[L1:[0-9]+]]=, $0, $pop[[L0]]{{$}}
-; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, 15{{$}}
-; CHECK-NEXT: i16x8.shr_s $push[[L3:[0-9]+]]=, $pop[[L1]], $pop[[L2]]{{$}}
-; CHECK-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $pop[[L3]]{{$}}
-; CHECK-NEXT: return $pop[[R]]{{$}}
-define <8 x i16> @vselect_v8i16(<8 x i1> %c, <8 x i16> %x, <8 x i16> %y) {
-  %res = select <8 x i1> %c, <8 x i16> %x, <8 x i16> %y
-  ret <8 x i16> %res
-}
-
-; CHECK-LABEL: vselect_v4i32:
-; CHECK-NEXT: .param v128, v128, v128{{$}}
-; CHECK-NEXT: .result v128{{$}}
-; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 31{{$}}
-; CHECK-NEXT: i32x4.shl $push[[L1:[0-9]+]]=, $0, $pop[[L0]]{{$}}
-; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, 31{{$}}
-; CHECK-NEXT: i32x4.shr_s $push[[L3:[0-9]+]]=, $pop[[L1]], $pop[[L2]]{{$}}
-; CHECK-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $pop[[L3]]{{$}}
-; CHECK-NEXT: return $pop[[R]]{{$}}
-define <4 x i32> @vselect_v4i32(<4 x i1> %c, <4 x i32> %x, <4 x i32> %y) {
-  %res = select <4 x i1> %c, <4 x i32> %x, <4 x i32> %y
-  ret <4 x i32> %res
-}
-
-; CHECK-LABEL: vselect_v2i64:
-; CHECK-NEXT: .param v128, v128, v128{{$}}
-; CHECK-NEXT: .result v128{{$}}
-; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 63{{$}}
-; CHECK-NEXT: i64x2.shl $push[[L1:[0-9]+]]=, $0, $pop[[L0]]{{$}}
-; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, 63{{$}}
-; CHECK-NEXT: i64x2.shr_s $push[[L3:[0-9]+]]=, $pop[[L1]], $pop[[L2]]{{$}}
-; CHECK-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $pop[[L3]]{{$}}
-; CHECK-NEXT: return $pop[[R]]{{$}}
-define <2 x i64> @vselect_v2i64(<2 x i1> %c, <2 x i64> %x, <2 x i64> %y) {
-  %res = select <2 x i1> %c, <2 x i64> %x, <2 x i64> %y
-  ret <2 x i64> %res
-}
-
-; CHECK-LABEL: vselect_v4f32:
-; CHECK-NEXT: .param v128, v128, v128{{$}}
-; CHECK-NEXT: .result v128{{$}}
-; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 31{{$}}
-; CHECK-NEXT: i32x4.shl $push[[L1:[0-9]+]]=, $0, $pop[[L0]]{{$}}
-; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, 31{{$}}
-; CHECK-NEXT: i32x4.shr_s $push[[L3:[0-9]+]]=, $pop[[L1]], $pop[[L2]]{{$}}
-; CHECK-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $pop[[L3]]{{$}}
-; CHECK-NEXT: return $pop[[R]]{{$}}
-define <4 x float> @vselect_v4f32(<4 x i1> %c, <4 x float> %x, <4 x float> %y) {
-  %res = select <4 x i1> %c, <4 x float> %x, <4 x float> %y
-  ret <4 x float> %res
-}
-
-; CHECK-LABEL: vselect_v2f64:
-; CHECK-NEXT: .param v128, v128, v128{{$}}
-; CHECK-NEXT: .result v128{{$}}
-; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 63{{$}}
-; CHECK-NEXT: i64x2.shl $push[[L1:[0-9]+]]=, $0, $pop[[L0]]{{$}}
-; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, 63{{$}}
-; CHECK-NEXT: i64x2.shr_s $push[[L3:[0-9]+]]=, $pop[[L1]], $pop[[L2]]{{$}}
-; CHECK-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $pop[[L3]]{{$}}
-; CHECK-NEXT: return $pop[[R]]{{$}}
-define <2 x double> @vselect_v2f64(<2 x i1> %c, <2 x double> %x, <2 x double> %y) {
-  %res = select <2 x i1> %c, <2 x double> %x, <2 x double> %y
-  ret <2 x double> %res
-}
Index: test/CodeGen/WebAssembly/simd-select.ll
===
--- /dev/null
+++ test/CodeGen/WebAssembly/simd-select.ll
@@ -0,0 +1,427 @@
+; RUN: llc < %s 

[PATCH] D47687: [Sema] Missing -Wlogical-op-parentheses warnings in macros (PR18971)

2018-11-05 Thread Xing via Phabricator via cfe-commits
Higuoxing reclaimed this revision.
Higuoxing added a comment.

In https://reviews.llvm.org/D47687#1288272, @vsapsai wrote:

> Sorry, you've decided to abandon the patch, it took a lot of good work. Xing, 
> are you sure you don't want to see this change finished?


No, I am working on this :)

> I agree that delays in code review can be frustrating and I think it is 
> something we can improve.

Never mind :)

Thank you, I am still working on this :) I am afraid this open revision will 
take up your unnecessary reviewing time or waste your reviewing time, so I 
close this revision temporarily ... Now, reopen this revision :) Just give me 
some time :)


https://reviews.llvm.org/D47687



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


[PATCH] D53153: [OpenCL] Mark kernel functions with default visibility

2018-11-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Okay, that's interesting.  And that dynamic linking step includes fairly 
unrestricted linking of OpenCL code to other OpenCL code, rather than just e.g. 
loading a single block of OpenCL code that exports a small, fixed interface?  
If so, then I accept that you need symbol visibility.


https://reviews.llvm.org/D53153



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


[PATCH] D53153: [OpenCL] Mark kernel functions with default visibility

2018-11-05 Thread Tony Tye via Phabricator via cfe-commits
t-tye added a comment.

In https://reviews.llvm.org/D53153#1288127, @rjmccall wrote:

> In https://reviews.llvm.org/D53153#1288112, @rjmccall wrote:
>
> > But do you want to support *dynamically* linking object files?  Because 
> > that's what visibility is about.
>
>
> To be specific, if you don't have multiple levels of linking — doing a slower 
> and relatively more expensive link to form a self-contained unit of code 
> distribution, then doing a faster link to form a runnable program from 
> multiple independently-distributed such units — then visibility isn't really 
> doing anything for you.


Currently the AMDGPU code objects are fully linked dynamically loader shared 
libraries. They are not relocatable code objects. This allows fewer and cheaper 
relocations and a smaller (dynsym) symbol table for the runtime loader.


https://reviews.llvm.org/D53153



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


[PATCH] D47687: [Sema] Missing -Wlogical-op-parentheses warnings in macros (PR18971)

2018-11-05 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Sorry, you've decided to abandon the patch, it took a lot of good work. Xing, 
are you sure you don't want to see this change finished? I agree that delays in 
code review can be frustrating and I think it is something we can improve.


https://reviews.llvm.org/D47687



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


[PATCH] D53701: [Analyzer] Record and process comparison of symbols instead of iterator positions in interator checkers

2018-11-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D53701#1287007, @baloghadamsoftware wrote:

> ...on iterator-adapters inlining ensures that we handle the comparison of the 
> underlying iterator correctly. Without inlining, `evalCall()` only works on 
> the outermost iterator which is not always correct: it may happen that the 
> checker cannot conclude any useful relation between the two iterator-adapters 
> but there are some relations stored about the inner iterators. Based on my 
> experiments quite many of the false-positives are related to 
> iterator-adapters.  So I am afraid that we introduce even more 
> false-positives by losing inlining.


Mmm, is it possible to detect adapters and inline them as an exception from the 
rule? You can foresee a pretty complicated system of rules and exceptions if we 
go down this path, but i believe that it is still much easier and more reliable 
than the system that tries to synchronize two different models of iterators, so 
i really encourage you to at least give it a try somehow.

> I  wonder whether the current "mixed" approach introduces additional paths 
> because we do not do explicit state-splits and function `processComparison()` 
> removes contradicting branches.

I believe that the effect of eager state splits is going to be roughly similar 
to the actual -analyzer-eagerly-assume:

1. Split paths earlier than it is absolutely necessary, which may slow down the 
analysis and duplicate some work, but most of the time it'll be just a few 
nodes before the actual check in the code would have caused a split anyway.
2. Simplify constraint solving on each of the new paths, which will indeed help 
with refuting some invalid paths, especially those in which new constraints 
over the symbols are introduced after the check, but that's due to pecularities 
of our constraint solver, i.e. rather accidentally than intentionally.




Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:1197-1199
   while (const auto *CBOR = Cont->getAs()) {
 Cont = CBOR->getSuperRegion();
   }

Szelethus wrote:
> You will have to excuse me for commenting on something totally unrelated, but 
> I'm afraid this may cause a crash, if the region returned by `getSuperRegion` 
> is symbolic. I encountered this error when doing the exact same thing in my 
> checker: D50892. Can something like this occur with this checker?
Hmm, had a look at the crash you mention here. Your code crashed because you 
additionally did `getAs`, which would turn your pointer into 
a null when a symbolic region is encountered. So the final code ended up a bit 
weird: there's no need to check that it's a `TypedValueRegion` before you check 
that it's a `CXXBaseObjectRegion`; just check for the latter directly. This 
code looks correct in this sense.

Also, since this code keeps copied around, do we need a better helper function 
for this unwrap idiom? I.e., something like `MemRegion::StripCasts()` that only 
unwraps derived-to-base casts?



Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:2066
"Symbol comparison must be a comparison");
 return assumeNoOverflow(NewState, cast(CompSym)->getLHS(), 2);
   }

baloghadamsoftware wrote:
> NoQ wrote:
> > P.S. What was the idea here? Like, `CompSym` was just computed via `BO_EQ` 
> > and has type of a condition, i.e. `bool` because we are in C++. Is this 
> > code trying to say that the result of the comparison is bounded by `true/2`?
> There is also a `->getLHS()` which means that we enforce the bound on the 
> left-hand side of the rearranged comparison. Although both symbols are 
> bounded by `max/4`, constraint manager does not imply that the sum/diff is 
> the bounded by `max/2`. I have to enforce this manually to prevent `min` 
> negated to `min` when the constraint manager negates the difference.
Ouch, right, didn't notice `getLHS()`, sorry!


Repository:
  rC Clang

https://reviews.llvm.org/D53701



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


[PATCH] D53787: [Sema] Provide -fvisibility-global-new-delete-hidden option

2018-11-05 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

@rsmith does this look reasonable to you?


Repository:
  rC Clang

https://reviews.llvm.org/D53787



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


[PATCH] D53692: [analyzer] Evaluate all non-checker config options before analysis

2018-11-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: test/Analysis/analyzer-config.c:4-12
 void bar() {}
 void foo() {
   // Call bar 33 times so max-times-inline-large is met and
   // min-blocks-for-inline-large is checked
   for (int i = 0; i < 34; ++i) {
 bar();
   }

The code is no longer necessary, right? All options are now initialized eagerly 
and there's no need to analyze any code to get them initialized.



Comment at: test/Analysis/analyzer-config.cpp:1
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 %s -o /dev/null 
-analyzer-checker=core,osx.cocoa,debug.ConfigDumper -analyzer-max-loop 34 > %t 
2>&1
 // RUN: FileCheck --input-file=%t %s --match-full-lines

Aaand this test should probably be removed entirely.


https://reviews.llvm.org/D53692



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


[PATCH] D54132: [CodeGenCXX] XFAIL test for ASAN on Darwin.

2018-11-05 Thread Volodymyr Sapsai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346200: [CodeGenCXX] XFAIL test for ASAN on Darwin. 
(authored by vsapsai, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54132?vs=172692=172699#toc

Repository:
  rC Clang

https://reviews.llvm.org/D54132

Files:
  test/CodeGenCXX/castexpr-basepathsize-threshold.cpp


Index: test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
===
--- test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
+++ test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
@@ -3,6 +3,10 @@
 // https://bugs.llvm.org/show_bug.cgi?id=38356
 // We only check that we do not crash.
 
+// ASAN increases stack usage, so we are hitting stack overflow before reaching
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+
 template 
 struct d : d {};
 template 


Index: test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
===
--- test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
+++ test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
@@ -3,6 +3,10 @@
 // https://bugs.llvm.org/show_bug.cgi?id=38356
 // We only check that we do not crash.
 
+// ASAN increases stack usage, so we are hitting stack overflow before reaching
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+
 template 
 struct d : d {};
 template 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r346200 - [CodeGenCXX] XFAIL test for ASAN on Darwin.

2018-11-05 Thread Volodymyr Sapsai via cfe-commits
Author: vsapsai
Date: Mon Nov  5 18:16:28 2018
New Revision: 346200

URL: http://llvm.org/viewvc/llvm-project?rev=346200=rev
Log:
[CodeGenCXX] XFAIL test for ASAN on Darwin.

The test hits stack overflow trying to instantiate recursive templates.
It is observed with ASAN and not with a regular build because ASAN
increases stack frame size.

rdar://problem/45009892

Reviewers: george.karpenkov, lebedev.ri

Reviewed By: george.karpenkov

Subscribers: dexonsmith, rjmccall, cfe-commits

Differential Revision: https://reviews.llvm.org/D54132

Modified:
cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp

Modified: cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp?rev=346200=346199=346200=diff
==
--- cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp Mon Nov  5 
18:16:28 2018
@@ -3,6 +3,10 @@
 // https://bugs.llvm.org/show_bug.cgi?id=38356
 // We only check that we do not crash.
 
+// ASAN increases stack usage, so we are hitting stack overflow before reaching
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+
 template 
 struct d : d {};
 template 


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


[PATCH] D54132: [CodeGenCXX] XFAIL test for ASAN on Darwin.

2018-11-05 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision.
george.karpenkov added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp:8
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+

vsapsai wrote:
> george.karpenkov wrote:
> > Do we actually want UNSUPPORTED here? We don't want to fail if ASAN stack 
> > usage decreases?
> If ASAN stack usage decreases or template instantiation stack usage 
> decreases, I'd like to know that and to remove XFAIL. My reason to prefer 
> XFAIL over UNSUPPORTED is that currently the test fails due to specific 
> implementation of Clang and ASAN, not due to conceptual incompatibility. But 
> I don't have any evidence to show that my suggestion is actually better, so 
> if my argument doesn't look convincing, most likely UNSUPPORTED would be 
> better.
Either one works for me.


https://reviews.llvm.org/D54132



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


[PATCH] D54132: [CodeGenCXX] XFAIL test for ASAN on Darwin.

2018-11-05 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added inline comments.



Comment at: clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp:8
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+

george.karpenkov wrote:
> Do we actually want UNSUPPORTED here? We don't want to fail if ASAN stack 
> usage decreases?
If ASAN stack usage decreases or template instantiation stack usage decreases, 
I'd like to know that and to remove XFAIL. My reason to prefer XFAIL over 
UNSUPPORTED is that currently the test fails due to specific implementation of 
Clang and ASAN, not due to conceptual incompatibility. But I don't have any 
evidence to show that my suggestion is actually better, so if my argument 
doesn't look convincing, most likely UNSUPPORTED would be better.


https://reviews.llvm.org/D54132



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


[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-11-05 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 172695.
leonardchan marked 5 inline comments as done.

Repository:
  rC Clang

https://reviews.llvm.org/D49511

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprMember.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/Frontend/noderef.c
  clang/test/Frontend/noderef.cpp
  clang/test/Frontend/noderef_on_non_pointers.m
  clang/test/Frontend/noderef_templates.cpp

Index: clang/test/Frontend/noderef_templates.cpp
===
--- /dev/null
+++ clang/test/Frontend/noderef_templates.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -verify %s
+
+#define NODEREF __attribute__((noderef))
+
+template 
+int func(T NODEREF *a) { // expected-note 2 {{a declared here}}
+  return *a + 1; // expected-warning 2 {{dereferencing a; was declared with a 'noderef' type}}
+}
+
+void func() {
+  float NODEREF *f;
+  int NODEREF *i;
+  func(f); // expected-note{{in instantiation of function template specialization 'func' requested here}}
+  func(i); // expected-note{{in instantiation of function template specialization 'func' requested here}}
+}
Index: clang/test/Frontend/noderef_on_non_pointers.m
===
--- /dev/null
+++ clang/test/Frontend/noderef_on_non_pointers.m
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -verify %s
+
+#define NODEREF __attribute__((noderef))
+
+@interface NSObject
++ (id)new;
+@end
+
+void func() {
+  id NODEREF obj = [NSObject new]; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+}
Index: clang/test/Frontend/noderef.cpp
===
--- /dev/null
+++ clang/test/Frontend/noderef.cpp
@@ -0,0 +1,102 @@
+// RUN: %clang_cc1 -fblocks -verify %s
+
+/**
+ * Test 'noderef' attribute with c++ constructs.
+ */
+
+#define NODEREF __attribute__((noderef))
+
+void Normal() {
+  int NODEREF i;// expected-warning{{'noderef' can only be used on an array or pointer type}}
+  int NODEREF *i_ptr;   // expected-note 2 {{i_ptr declared here}}
+  int NODEREF **i_ptr2; // ok
+  int *NODEREF i_ptr3;  // expected-warning{{'noderef' can only be used on an array or pointer type}}
+  int *NODEREF *i_ptr4; // ok
+
+  auto NODEREF *auto_i_ptr = i_ptr;
+  auto NODEREF auto_i = i; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+
+  struct {
+int x;
+int y;
+  } NODEREF *s;
+
+  int __attribute__((noderef(10))) * no_args; // expected-error{{'noderef' attribute takes no arguments}}
+
+  int i2 = *i_ptr; // expected-warning{{dereferencing i_ptr; was declared with a 'noderef' type}}
+  int  = *i_ptr;// expected-warning{{dereferencing i_ptr; was declared with a 'noderef' type}}
+  int *i_ptr5 = i_ptr; // expected-warning{{casting to dereferenceable pointer removes 'noderef' attribute}}
+  int *i_ptr6(i_ptr);  // expected-warning{{casting to dereferenceable pointer removes 'noderef' attribute}}
+}
+
+const int NODEREF *const_i_ptr;
+static int NODEREF *static_i_ptr;
+
+void ParenTypes() {
+  int NODEREF(*i_ptr);// ok (same as `int NODEREF *`)
+  int NODEREF *(*i_ptr2); // ok (same as `int NODEREF **`)
+}
+
+// Function declarations
+int NODEREF func();   // expected-warning{{'noderef' can only be used on an array or pointer type}}
+int NODEREF *func2(); // ok (returning pointer)
+
+typedef int NODEREF (*func3)(int); // expected-warning{{'noderef' can only be used on an array or pointer type}}
+typedef int NODEREF *(*func4)(int);
+
+void Arrays() {
+  int NODEREF i_arr[10];  // ok
+  int NODEREF i_arr2[10][10]; // ok
+  int NODEREF *i_arr3[10];// ok
+  int NODEREF i_arr4[] = {1, 2};
+}
+
+void ParenArrays() {
+  int NODEREF(i_ptr[10]);
+  int NODEREF(i_ptr2[10])[10];
+}
+
+typedef int NODEREF *(*func5[10])(int);
+
+// Arguments
+void func6(int NODEREF x); // expected-warning{{'noderef' can only be used on an array or pointer type}}
+void func7(int NODEREF *x);
+void func8() NODEREF;
+
+void References() {
+  int x = 2;
+  int NODEREF  = x; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+  int *xp = 
+  int NODEREF * = xp; // ok (reference to a NODEREF *)
+  int *NODEREF  = xp; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+}
+
+void BlockPointers() {
+  typedef int NODEREF (^IntBlock)(); // expected-warning{{'noderef' can only be used on an array or pointer type}}
+}
+
+class A {
+public:
+  int member;
+  int NODEREF *member2;
+  int NODEREF member3; // expected-warning{{'noderef' can only be used on an array or pointer type}}
+};
+
+void MemberPointer() {
+  int NODEREF A::*var = ::member; // 

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-11-05 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments.



Comment at: lib/Parse/ParseStmt.cpp:102-104
+  Actions.PushExpressionEvaluationContext(
+  Actions.ExprEvalContexts.back().Context);
   ParenBraceBracketBalancer BalancerRAIIObj(*this);

leonardchan wrote:
> rsmith wrote:
> > Hmm, we call `ParseStatementOrDeclaration` rather a lot. Can we pull this 
> > up into its ultimate callers instead:
> > 
> >   * `Parser::ParseFunctionDefinition`
> >   * `Parser::ParseLateTemplatedFuncDef`
> >   * `Parser::ParseLexedMethodDef`
> >   * `Parser::ParseLexedObjCMethodDefs`
> > 
> > ? Actually, we can do better than that: those functions all call either 
> > `ActOnStartOfFunctionDef` or `ActOnStartOfObjCMethodDef` first, and 
> > `ActOnFinishFunctionBody` when they're done. We should put the 
> > `PushExpressionEvaluationContext` and `PopExpressionEvaluationContext` 
> > calls in those functions instead.
> > 
> > We're missing at least one other place: when parsing the initializer for a 
> > global variable, in C++ we call `Sema::ActOnCXXEnterDeclInitializer`, which 
> > pushes a potentially-evaluated context. But in C, the 
> > `InitializerScopeRAII` object (in 
> > `Parser::ParseDeclaratoinAfterDeclaratorAndAttributes`) doesn't call into 
> > `Sema` and we don't ever push a suitable expression evaluation context.
> > 
> > You can find if any other places are missing by removing `Sema`'s global 
> > `ExpressionEvaluationContext` and adding an assert that fires if we try to 
> > parse an expression with no `ExpressionEvaluationContext`, and then running 
> > the unit tests. (And we should check in that change to ensure this doesn't 
> > regress.)
> @rsmith Would it be simpler to instead push and pop at the start and end of 
> `Parser::ParseExternalDeclaration`? I'm currently working on your suggestion 
> of removing the Sema global `ExpressionEvaluationContext` and find that a lot 
> of accesses to the `ExprEvalContexts` stack stem from this method.
> 
> `ActOnStartOfFunctionDef` and `ActOnFinishFunctionBody` still work on 
> anything in a function body, but I keep running into many cases for 
> declarations declared globally that could be easily caught if instead I push 
> and pop contexts at the start and end of `Parser::ParseExternalDeclaration`. 
> Do you think this is a good idea or is there something that I may be missing 
> from pushing and popping here?
> 
> This still accomplishes the goal of not reusing the global Sema context and I 
> will still be able to check for `noderef` on every push and pop this way. 
Made a separate patch (https://reviews.llvm.org/D54014) that does the push and 
pop for `ActOnStartOfFunctionDef` and `ActOnFinishFunctionBody`.

I can continue doing this for the remaining places that depend on the global 
Sema context in other patches since I ran into a couple of issues running into 
fixing everything in one big patch and think fixing each individual place in 
smaller separate patches would be simpler.



Comment at: lib/Sema/SemaExpr.cpp:4289
+
+  if (TypeHasNoDeref(ResultTy)) {
+LastRecord.PossibleDerefs.insert(E);

rsmith wrote:
> leonardchan wrote:
> > rsmith wrote:
> > > Do you ensure that the `noderef` attribute will be on the innermost level 
> > > of the array type? I think you'll need to do so in order to warn on:
> > > 
> > > ```
> > > typedef int A[32];
> > > typedef A __attribute__((noderef)) *B;
> > > int f(B b) { return (*B)[1]; }
> > > ```
> > > 
> > > (Here, we have a pointer to a noderef annotated array of 
> > > non-noderef-annotated int. So I think we will not emit a warning from the 
> > > first dereference, because we have a pointer to an array, and we will not 
> > > emit a warning from the second dereference in the array indexing, because 
> > > the result type does not have the noderef attribute.)
> > H, so normally in order to check what's correct, I usually run these 
> > examples through `sparse` since that's the tool that actually checks 
> > `noderef` for gcc, but it seems that sparse instead diagnoses a warning on 
> > the array indexing instead and nothing for the first dereference.
> > 
> > This shouldn't be though since, as you pointed out, the array does not have 
> > `noderef` types. For a simple array,
> > 
> > ```
> > int __attribute__((noderef)) x[10];
> > x[0];
> > ```
> > 
> > `sparse` diagnoses the appropriate warning for the array index. Personally 
> > though, I would chalk this up to an edge case that wasn't thought of before 
> > in sparse, since something like this isn't handled on their existing 
> > validation tests.
> > 
> > Currently, this diagnoses a warning on the first dereference, but I can 
> > also understand why it shouldn't warn because accessing `noderef` structs 
> > shouldn't warn if the member accessed is an array. The only case though 
> > this applies in sparse's tests are with structs and they don't provide a 
> > test for dereferencing a pointer to an array.
> 

[PATCH] D54132: [CodeGenCXX] XFAIL test for ASAN on Darwin.

2018-11-05 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added inline comments.



Comment at: clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp:8
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+

Do we actually want UNSUPPORTED here? We don't want to fail if ASAN stack usage 
decreases?


https://reviews.llvm.org/D54132



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


[PATCH] D50050: [AST] CastExpr: BasePathSize is not large enough.

2018-11-05 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Disabling test in https://reviews.llvm.org/D54132.


Repository:
  rC Clang

https://reviews.llvm.org/D50050



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


[PATCH] D54132: [CodeGenCXX] XFAIL test for ASAN on Darwin.

2018-11-05 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai created this revision.
vsapsai added reviewers: george.karpenkov, lebedev.ri.
Herald added a subscriber: dexonsmith.

The test hits stack overflow trying to instantiate recursive templates.
It is observed with ASAN and not with a regular build because ASAN
increases stack frame size.

rdar://problem/45009892


https://reviews.llvm.org/D54132

Files:
  clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp


Index: clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
===
--- clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
+++ clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
@@ -3,6 +3,10 @@
 // https://bugs.llvm.org/show_bug.cgi?id=38356
 // We only check that we do not crash.
 
+// ASAN increases stack usage, so we are hitting stack overflow before reaching
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+
 template 
 struct d : d {};
 template 


Index: clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
===
--- clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
+++ clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
@@ -3,6 +3,10 @@
 // https://bugs.llvm.org/show_bug.cgi?id=38356
 // We only check that we do not crash.
 
+// ASAN increases stack usage, so we are hitting stack overflow before reaching
+// recursive template instantiation limit.
+// XFAIL: darwin && asan
+
 template 
 struct d : d {};
 template 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53153: [OpenCL] Mark kernel functions with default visibility

2018-11-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D53153#1288112, @rjmccall wrote:

> But do you want to support *dynamically* linking object files?  Because 
> that's what visibility is about.


To be specific, if you don't have multiple levels of linking — doing a slower 
and relatively more expensive link to form a self-contained unit of code 
distribution, then doing a faster link to form a runnable program from multiple 
independently-distributed such units — then visibility isn't really doing 
anything for you.


https://reviews.llvm.org/D53153



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


[PATCH] D53153: [OpenCL] Mark kernel functions with default visibility

2018-11-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D53153#1288083, @arsenm wrote:

> In https://reviews.llvm.org/D53153#1288059, @rjmccall wrote:
>
> > I agree with Richard that I'm not sure what the point of supporting 
> > frontend visibility settings in OpenCL is.  If you want the "everything is 
> > internal to the image" optimization, presumably you can just infer 
> > visibility on everything in a pass over the IR.
>
>
> Eventually we want to support linking object files, and setting the 
> visibility in the IR won't be aware of any user specified visibility


But do you want to support *dynamically* linking object files?  Because that's 
what visibility is about.


https://reviews.llvm.org/D53153



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


[PATCH] D54065: [COFF, ARM64] Implement InterlockedXor*_* builtins

2018-11-05 Thread Mandeep Singh Grang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346191: [COFF, ARM64] Implement InterlockedXor*_* builtins 
(authored by mgrang, committed by ).
Herald added subscribers: aheejin, dschuff.

Changed prior to commit:
  https://reviews.llvm.org/D54065?vs=172480=172686#toc

Repository:
  rC Clang

https://reviews.llvm.org/D54065

Files:
  CodeGen/CGBuiltin.cpp
  CodeGen/ms-intrinsics.c
  Headers/intrin.h
  clang/Basic/BuiltinsAArch64.def
  clang/Basic/BuiltinsARM.def
  include/clang/Basic/BuiltinsAArch64.def
  include/clang/Basic/BuiltinsARM.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c



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


r346190 - [COFF, ARM64] Implement InterlockedOr*_* builtins

2018-11-05 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov  5 17:11:25 2018
New Revision: 346190

URL: http://llvm.org/viewvc/llvm-project?rev=346190=rev
Log:
[COFF, ARM64] Implement InterlockedOr*_* builtins

This is fourth in a series of patches to move intrinsic definitions out of 
intrin.h.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346190=346189=346190=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon Nov  5 17:11:25 2018
@@ -143,6 +143,19 @@ TARGET_HEADER_BUILTIN(_InterlockedCompar
 TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedOr8_acq,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr8_nf,   "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr8_rel,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr16_acq, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr16_nf,  "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr16_rel, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_acq,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_nf,"LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_rel,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr64_acq, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
 TARGET_HEADER_BUILTIN(_ReadStatusReg,  "ii",  "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346190=346189=346190=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Mon Nov  5 17:11:25 2018
@@ -269,6 +269,19 @@ TARGET_HEADER_BUILTIN(_InterlockedCompar
 TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedOr8_acq,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr8_nf,   "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr8_rel,  "ccD*c",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr16_acq, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr16_nf,  "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr16_rel, "ssD*s",   "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_acq,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_nf,"LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_rel,   "LiLiD*Li","nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr64_acq, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr64_nf,  "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr64_rel, "LLiLLiD*LLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=346190=346189=346190=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov  5 17:11:25 2018
@@ 

[PATCH] D54063: [COFF, ARM64] Implement InterlockedOr*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D54063



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


[PATCH] D54065: [COFF, ARM64] Implement InterlockedXor*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D54065



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


[PATCH] D53153: [OpenCL] Mark kernel functions with default visibility

2018-11-05 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

In https://reviews.llvm.org/D53153#1288059, @rjmccall wrote:

> I agree with Richard that I'm not sure what the point of supporting frontend 
> visibility settings in OpenCL is.  If you want the "everything is internal to 
> the image" optimization, presumably you can just infer visibility on 
> everything in a pass over the IR.


Eventually we want to support linking object files, and setting the visibility 
in the IR won't be aware of any user specified visibility


https://reviews.llvm.org/D53153



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


[PATCH] D54066: [COFF, ARM64] Implement InterlockedAnd*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D54066



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


[PATCH] D54067: [COFF, ARM64] Implement InterlockedIncrement*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D54067



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


[PATCH] D54068: [COFF, ARM64] Implement InterlockedDecrement*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D54068



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


[PATCH] D54112: [Driver] Delete redundant -Bdynamic for libc++ on Fuchsia

2018-11-05 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr requested changes to this revision.
mcgrathr added a comment.
This revision now requires changes to proceed.

This breaks the semantics we want.  The `-Bdynamic` is there to apply to `-lm`, 
which is also what `--as-needed` is there for in this case (it appears earlier 
because of the conditional logic, since in the other case it applies to `-lc++` 
as well).  It's correct as is.


Repository:
  rC Clang

https://reviews.llvm.org/D54112



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


Buildbot numbers for the week of 10/28/2018 - 11/03/2018

2018-11-05 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 10/28/2018 -
11/03/2018.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername   |  was_red
-+--
 lld-perf-testsuite  | 110:29:14
 clang-sphinx-docs   | 76:27:53
 sanitizer-x86_64-linux  | 51:37:47
 sanitizer-x86_64-linux-bootstrap-ubsan  | 49:09:59
 sanitizer-x86_64-linux-fast | 47:42:46
 aosp-O3-polly-before-vectorizer-unprofitable| 47:41:33
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions   | 46:19:25
 openmp-clang-x86_64-linux-debian| 22:21:53
 openmp-clang-ppc64le-linux-rhel | 20:52:48
 lldb-amd64-ninja-netbsd8| 19:30:27
 sanitizer-ppc64le-linux | 18:17:42
 libcxx-libcxxabi-libunwind-x86_64-linux-debian  | 17:26:27
 llvm-clang-x86_64-expensive-checks-win  | 17:10:25
 libcxx-libcxxabi-x86_64-linux-debian| 16:33:40
 clang-ppc64le-linux-multistage  | 14:33:24
 clang-ppc64le-linux-lnt | 13:40:18
 clang-ppc64le-linux | 13:23:52
 clang-lld-x86_64-2stage | 12:07:19
 clang-cmake-armv7-selfhost-neon | 12:02:44
 sanitizer-x86_64-linux-autoconf | 10:47:27
 clang-cmake-armv8-lld   | 10:12:17
 clang-x86_64-linux-selfhost-modules | 08:13:09
 sanitizer-x86_64-linux-bootstrap| 07:42:27
 clang-with-lto-ubuntu   | 07:05:05
 clang-cmake-aarch64-full| 06:22:58
 clang-cmake-thumbv8-full-sh | 06:13:50
 clang-cmake-armv7-selfhost  | 06:02:30
 clang-x86_64-debian-fast| 05:53:23
 clang-atom-d525-fedora-rel  | 05:26:04
 clang-s390x-linux-lnt   | 05:23:22
 clang-cmake-armv7-full  | 05:16:58
 clang-cmake-armv8-full  | 04:52:10
 clang-bpf-build | 04:44:47
 clang-s390x-linux   | 04:27:39
 clang-with-thin-lto-ubuntu  | 04:06:43
 sanitizer-ppc64be-linux | 04:04:50
 clang-ppc64be-linux-multistage  | 03:56:45
 clang-ppc64be-linux-lnt | 03:32:33
 clang-ppc64be-linux | 03:29:37
 clang-s390x-linux-multistage| 03:21:41
 clang-x64-windows-msvc  | 03:10:45
 sanitizer-x86_64-linux-android  | 03:00:28
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast| 02:23:11
 clang-cmake-aarch64-quick   | 02:21:05
 clang-cmake-armv7-global-isel   | 02:12:57
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast  | 02:10:36
 clang-cmake-x86_64-avx2-linux   | 02:10:11
 clang-cmake-x86_64-avx2-linux-perf  | 02:04:37
 clang-cmake-armv8-selfhost-neon | 02:00:14
 sanitizer-x86_64-linux-bootstrap-msan   | 01:58:24
 sanitizer-windows   | 01:55:44
 lldb-x86_64-ubuntu-14.04-buildserver| 01:53:41
 clang-hexagon-elf   | 01:52:59
 clang-cuda-build| 01:45:50
 clang-cmake-armv8-global-isel   | 01:40:54
 clang-cmake-aarch64-global-isel | 01:34:14
 lld-x86_64-freebsd  | 01:23:46
 clang-cmake-thumbv7-full-sh | 01:23:12
 lld-x86_64-darwin13 | 01:18:39
 clang-cmake-armv8-lnt   | 01:17:55
 polly-arm-linux | 01:15:38
 llvm-hexagon-elf| 01:05:33
 

Buildbot numbers for the week of 10/21/2018 - 10/27/2018

2018-11-05 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 10/21/2018 - 10/27/2018.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
   buildername   |  was_red
-+--
 clang-cuda-build| 129:57:24
 clang-x86_64-debian-fast| 129:34:32
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11| 91:57:50
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11  | 61:18:38
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-latest-std | 26:37:24
 clang-cmake-armv8-lld   | 25:24:13
 clang-cmake-thumbv7-full-sh | 23:37:48
 clang-cmake-aarch64-quick   | 23:15:37
 clang-cmake-aarch64-global-isel | 23:15:12
 clang-hexagon-elf   | 23:09:38
 clang-cmake-thumbv8-full-sh | 23:09:23
 clang-cmake-armv7-quick | 23:09:18
 clang-cmake-armv8-global-isel   | 23:05:45
 llvm-hexagon-elf| 23:02:55
 clang-cmake-armv8-selfhost-neon | 22:56:20
 clang-cmake-armv7-full  | 22:56:16
 clang-cmake-armv8-full  | 22:48:41
 clang-cmake-armv8-quick | 22:44:24
 clang-cmake-armv7-global-isel   | 22:13:45
 clang-cmake-aarch64-full| 21:58:16
 clang-cmake-aarch64-lld | 21:14:00
 clang-cmake-armv7-selfhost  | 21:02:09
 clang-cmake-armv7-selfhost-neon | 21:02:06
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions   | 20:33:20
 libcxx-libcxxabi-libunwind-x86_64-linux-debian  | 20:32:49
 clang-cmake-x86_64-sde-avx512-linux | 19:30:57
 lldb-amd64-ninja-netbsd8| 19:09:45
 clang-x64-ninja-win7| 18:38:10
 clang-ppc64le-linux-multistage  | 17:51:39
 sanitizer-x86_64-linux-android  | 17:35:24
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast| 17:24:20
 clang-s390x-linux-multistage| 16:44:42
 clang-ppc64be-linux-lnt | 16:19:16
 clang-ppc64be-linux-multistage  | 16:05:12
 clang-s390x-linux-lnt   | 15:48:12
 clang-ppc64be-linux | 15:47:08
 clang-s390x-linux   | 15:44:15
 clang-ppc64le-linux | 15:31:09
 clang-ppc64le-linux-lnt | 15:30:25
 clang-with-thin-lto-ubuntu  | 10:57:56
 clang-bpf-build | 10:31:29
 clang-with-lto-ubuntu   | 09:13:29
 clang-x86_64-linux-selfhost-modules | 09:12:53
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan   | 08:24:03
 libcxx-libcxxabi-x86_64-linux-debian| 08:23:49
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan   | 08:19:37
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx17  | 08:06:58
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14  | 08:03:42
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx2a  | 07:40:10
 libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu  | 07:38:02
 libcxx-libcxxabi-x86_64-linux-ubuntu-32bit  | 07:10:44
 sanitizer-x86_64-linux  | 07:04:04
 sanitizer-ppc64be-linux | 06:54:16
 sanitizer-ppc64le-linux | 06:41:10
 clang-lld-x86_64-2stage | 06:39:43
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan  | 06:32:39
 sanitizer-x86_64-linux-bootstrap-ubsan  | 06:20:14
 lld-x86_64-darwin13 | 06:19:44
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan   | 05:55:25
 libcxx-libcxxabi-libunwind-armv8-linux  | 05:34:08
 clang-x64-windows-msvc  | 05:15:54
 clang-atom-d525-fedora-rel  | 05:08:33
 

[PATCH] D53153: [OpenCL] Mark kernel functions with default visibility

2018-11-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I agree with Richard that I'm not sure what the point of supporting frontend 
visibility settings in OpenCL is.  If you want the "everything is internal to 
the image" optimization, presumably you can just infer visibility on everything 
in a pass over the IR.




Comment at: lib/AST/Decl.cpp:565
+return FD->hasAttr();
+  return dyn_cast(D);
+}

arsenm wrote:
> isa
I think you should just check for the attribute here; it can't be present in 
non-OpenCL files, and it can't be present on non-functions, and it's probably 
cheaper to look for it than to check the language option anyway.


https://reviews.llvm.org/D53153



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


[PATCH] D53334: [Frontend/Modules] Show diagnostics on prebuilt module configuration mismatch too

2018-11-05 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In https://reviews.llvm.org/D53334#1273877, @whisperity wrote:

> @dblaikie I have created a test, but unfortunately `%clang_cpp` in LIT 
> invokes `clang --driver-mode=cpp` which is not the same as if `clang++` is 
> called. I'm trying to construct the following command-line
>
> `clang++ -fmodules-ts -fprebuilt-module-path=%t/mods --precompile -c 
> file.cppm -o file.pcm`
>
> However, using `%clang_cc1` I can't get it to accept `--precompile` as a 
> valid argument, and using `%clang_cpp` I get an "unused argument" warning for 
> `--precompile` and the output file is just a preprocessed output (like `-E`), 
> which will, of course, cause errors, but not the errors I am wanting to test 
> about.


Hey, sorry for the delay - you can use "clang -### " (or 
"clang++ -### " to get clang to print out the underlying -cc1 
command line that is used.

If you're changing the driver then we'd write a driver test (that tests that, 
given "clang -foo -###" it produces some "clang -cc1 -bar" command line to run 
the frontend.

But since you're changing the driver, it's not interesting to (re) test how 
--precompile is lowered from the driver to cc1. Instead we test the frontend 
(cc1) directly.


Repository:
  rC Clang

https://reviews.llvm.org/D53334



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


[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Mandeep Singh Grang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346189: [COFF, ARM64] Implement 
InterlockedCompareExchange*_* builtins (authored by mgrang, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D54062

Files:
  include/clang/Basic/BuiltinsAArch64.def
  include/clang/Basic/BuiltinsARM.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c

Index: lib/Headers/intrin.h
===
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -621,90 +621,30 @@
 |* Interlocked Compare Exchange
 \**/
 #if defined(__arm__) || defined(__aarch64__)
-static __inline__ char __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange8_acq(char volatile *_Destination,
- char _Exchange, char _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
-  return _Comparand;
-}
-static __inline__ char __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange8_nf(char volatile *_Destination,
- char _Exchange, char _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
-  return _Comparand;
-}
-static __inline__ char __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange8_rel(char volatile *_Destination,
- char _Exchange, char _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
-  return _Comparand;
-}
-static __inline__ short __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange16_acq(short volatile *_Destination,
-  short _Exchange, short _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
-  return _Comparand;
-}
-static __inline__ short __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange16_nf(short volatile *_Destination,
-  short _Exchange, short _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
-  return _Comparand;
-}
-static __inline__ short __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange16_rel(short volatile *_Destination,
-  short _Exchange, short _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
-  return _Comparand;
-}
-static __inline__ long __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange_acq(long volatile *_Destination,
-  long _Exchange, long _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
-  return _Comparand;
-}
-static __inline__ long __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange_nf(long volatile *_Destination,
-  long _Exchange, long _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
-  return _Comparand;
-}
-static __inline__ long __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange_rel(long volatile *_Destination,
-  long _Exchange, long _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
-  return _Comparand;
-}
-static __inline__ __int64 __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange64_acq(__int64 volatile *_Destination,
-  __int64 _Exchange, __int64 _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE);
-  return _Comparand;
-}
-static __inline__ __int64 __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange64_nf(__int64 volatile *_Destination,
-  __int64 _Exchange, __int64 _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
-  return _Comparand;
-}
-static __inline__ __int64 __DEFAULT_FN_ATTRS
-_InterlockedCompareExchange64_rel(__int64 volatile *_Destination,
-  __int64 _Exchange, __int64 _Comparand) {
-  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
-__ATOMIC_SEQ_CST, __ATOMIC_RELEASE);
-  return _Comparand;
-}
+char _InterlockedCompareExchange8_acq(char volatile *_Destination,
+ char _Exchange, char _Comparand);
+char _InterlockedCompareExchange8_nf(char volatile 

r346189 - [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Mandeep Singh Grang via cfe-commits
Author: mgrang
Date: Mon Nov  5 16:36:48 2018
New Revision: 346189

URL: http://llvm.org/viewvc/llvm-project?rev=346189=rev
Log:
[COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

Summary: This is third in a series of patches to move intrinsic definitions out 
of intrin.h.

Reviewers: rnk, efriedma, mstorsjo, TomTan

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

Differential Revision: https://reviews.llvm.org/D54062

Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=346189=346188=346189=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon Nov  5 16:36:48 2018
@@ -130,6 +130,19 @@ TARGET_HEADER_BUILTIN(_InterlockedExchan
 TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf,  "LLiLLiD*LLi", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_acq,  "ccD*cc", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_nf,   "ccD*cc", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_rel,  "ccD*cc", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_acq, "ssD*ss", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_nf,  "ssD*ss", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_rel, "ssD*ss", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_acq,   "LiLiD*LiLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_nf,"LiLiD*LiLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_rel,   "LiLiD*LiLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_acq, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__getReg, "ULLii", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
 TARGET_HEADER_BUILTIN(_ReadStatusReg,  "ii",  "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=346189=346188=346189=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Mon Nov  5 16:36:48 2018
@@ -256,6 +256,19 @@ TARGET_HEADER_BUILTIN(_InterlockedExchan
 TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf,  "LLiLLiD*LLi", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", 
"intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_acq,  "ccD*cc", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_nf,   "ccD*cc", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_rel,  "ccD*cc", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_acq, "ssD*ss", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_nf,  "ssD*ss", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_rel, "ssD*ss", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_acq,   "LiLiD*LiLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_nf,"LiLiD*LiLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_rel,   "LiLiD*LiLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_acq, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", 

[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D54062



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


[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang updated this revision to Diff 172675.

https://reviews.llvm.org/D54062

Files:
  include/clang/Basic/BuiltinsAArch64.def
  include/clang/Basic/BuiltinsARM.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c

Index: test/CodeGen/ms-intrinsics.c
===
--- test/CodeGen/ms-intrinsics.c
+++ test/CodeGen/ms-intrinsics.c
@@ -782,6 +782,114 @@
 // CHECK-ARM-ARM64:   [[RESULT:%[0-9]+]] = atomicrmw xchg i64* %value, i64 %mask monotonic
 // CHECK-ARM-ARM64:   ret i64 [[RESULT:%[0-9]+]]
 // CHECK-ARM-ARM64: }
+
+char test_InterlockedCompareExchange8_acq(char volatile *Destination, char Exchange, char Comperand) {
+  return _InterlockedCompareExchange8_acq(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedCompareExchange8_acq(i8*{{[a-z_ ]*}}%Destination, i8{{[a-z_ ]*}}%Exchange, i8{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i8* %Destination, i8 %Comperand, i8 %Exchange acquire acquire
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i8, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i8 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+char test_InterlockedCompareExchange8_rel(char volatile *Destination, char Exchange, char Comperand) {
+  return _InterlockedCompareExchange8_rel(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedCompareExchange8_rel(i8*{{[a-z_ ]*}}%Destination, i8{{[a-z_ ]*}}%Exchange, i8{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i8* %Destination, i8 %Comperand, i8 %Exchange release monotonic
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i8, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i8 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+char test_InterlockedCompareExchange8_nf(char volatile *Destination, char Exchange, char Comperand) {
+  return _InterlockedCompareExchange8_nf(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i8 @test_InterlockedCompareExchange8_nf(i8*{{[a-z_ ]*}}%Destination, i8{{[a-z_ ]*}}%Exchange, i8{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i8* %Destination, i8 %Comperand, i8 %Exchange monotonic monotonic
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i8, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i8 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+short test_InterlockedCompareExchange16_acq(short volatile *Destination, short Exchange, short Comperand) {
+  return _InterlockedCompareExchange16_acq(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedCompareExchange16_acq(i16*{{[a-z_ ]*}}%Destination, i16{{[a-z_ ]*}}%Exchange, i16{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i16* %Destination, i16 %Comperand, i16 %Exchange acquire acquire
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i16, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i16 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+short test_InterlockedCompareExchange16_rel(short volatile *Destination, short Exchange, short Comperand) {
+  return _InterlockedCompareExchange16_rel(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedCompareExchange16_rel(i16*{{[a-z_ ]*}}%Destination, i16{{[a-z_ ]*}}%Exchange, i16{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i16* %Destination, i16 %Comperand, i16 %Exchange release monotonic
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i16, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i16 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+short test_InterlockedCompareExchange16_nf(short volatile *Destination, short Exchange, short Comperand) {
+  return _InterlockedCompareExchange16_nf(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i16 @test_InterlockedCompareExchange16_nf(i16*{{[a-z_ ]*}}%Destination, i16{{[a-z_ ]*}}%Exchange, i16{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i16* %Destination, i16 %Comperand, i16 %Exchange monotonic monotonic
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i16, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i16 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+long test_InterlockedCompareExchange_acq(long volatile *Destination, long Exchange, long Comperand) {
+  return _InterlockedCompareExchange_acq(Destination, Exchange, Comperand);
+}
+// CHECK-ARM-ARM64: define{{.*}}i32 @test_InterlockedCompareExchange_acq(i32*{{[a-z_ ]*}}%Destination, i32{{[a-z_ ]*}}%Exchange, i32{{[a-z_ ]*}}%Comperand){{.*}}{
+// CHECK-ARM-ARM64: [[TMP:%[0-9]+]] = cmpxchg volatile i32* %Destination, i32 %Comperand, i32 %Exchange acquire acquire
+// CHECK-ARM-ARM64: [[RESULT:%[0-9]+]] = extractvalue { i32, i1 } [[TMP]], 0
+// CHECK-ARM-ARM64: ret i32 [[RESULT]]
+// CHECK-ARM-ARM64: }
+
+long test_InterlockedCompareExchange_rel(long volatile *Destination, long Exchange, long 

[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:233
 
+static Value *EmitAtomicCmpXchgValue(CodeGenFunction , const CallExpr *E,
+AtomicOrdering SuccessOrdering = AtomicOrdering::SequentiallyConsistent) {

Please rename this function; it's very confusing to have both 
EmitAtomicCmpXchgValue and MakeAtomicCmpXchgValue which do almost the same 
thing, but expect the arguments in the opposite order.



Comment at: lib/CodeGen/CGBuiltin.cpp:259-262
+  // For Release ordering, the failure ordering should be Monotonic.
+  auto FailureOrdering = SuccessOrdering == AtomicOrdering::Release ?
+ AtomicOrdering::Monotonic :
+ SuccessOrdering;

rnk wrote:
> I don't know enough about the memory model to really say if this is right, so 
> I'll pass the buck to @efriedma.
This is equivalent to what you'd get for the C++ `a.compare_exchange_strong(x, 
y, memory_­order​::​release)`, which should match general intuition about 
"release" operations.  (There are only three possible failure orderings: 
seq_cst, acquire, and monotonic.)


Repository:
  rC Clang

https://reviews.llvm.org/D54062



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


[PATCH] D53780: Fix bitcast to address space cast for coerced load/stores

2018-11-05 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Thanks!  LGTM.


Repository:
  rC Clang

https://reviews.llvm.org/D53780



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


[PATCH] D53780: Fix bitcast to address space cast for coerced load/stores

2018-11-05 Thread David Salinas via Phabricator via cfe-commits
david-salinas updated this revision to Diff 172673.
david-salinas added a comment.

fix missing ;


Repository:
  rC Clang

https://reviews.llvm.org/D53780

Files:
  lib/CodeGen/CGCall.cpp
  test/CodeGenCXX/address-space-cast-coerce.cpp


Index: test/CodeGenCXX/address-space-cast-coerce.cpp
===
--- /dev/null
+++ test/CodeGenCXX/address-space-cast-coerce.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s
+
+template struct my_vector_base;
+
+template
+struct my_vector_base {
+typedef T Native_vec_ __attribute__((ext_vector_type(1)));
+
+union {
+Native_vec_ data;
+struct {
+T x;
+};
+};
+};
+
+template
+struct my_vector_type : public my_vector_base {
+using my_vector_base::data;
+using typename my_vector_base::Native_vec_;
+
+template< typename U>
+my_vector_type(U x) noexcept
+{
+for (auto i = 0u; i != rank; ++i) data[i] = x;
+}
+my_vector_type& operator+=(const my_vector_type& x) noexcept
+{
+data += x.data;
+return *this;
+}
+};
+
+template
+inline
+my_vector_type operator+(
+const my_vector_type& x, const my_vector_type& y) noexcept
+{
+return my_vector_type{x} += y;
+}
+
+using char1 = my_vector_type;
+
+int mane() {
+
+char1 f1{1};
+char1 f2{1};
+
+// CHECK: %[[a:[^ ]+]] = addrspacecast i16 addrspace(5)* %{{[^ ]+}} to i16*
+// CHECK: %[[a:[^ ]+]] = addrspacecast %{{[^ ]+}} addrspace(5)* %{{[^ ]+}} to 
%{{[^ ]+}} 
+
+char1 f3 = f1 + f2;
+}
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1253,8 +1253,8 @@
 
   // Otherwise do coercion through memory. This is stupid, but simple.
   Address Tmp = CreateTempAllocaForCoercion(CGF, Ty, Src.getAlignment());
-  Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
-  Address SrcCasted = CGF.Builder.CreateBitCast(Src, CGF.AllocaInt8PtrTy);
+  Address Casted = CGF.Builder.CreateElementBitCast(Tmp,CGF.Int8Ty);
+  Address SrcCasted = CGF.Builder.CreateElementBitCast(Src,CGF.Int8Ty);
   CGF.Builder.CreateMemCpy(Casted, SrcCasted,
   llvm::ConstantInt::get(CGF.IntPtrTy, SrcSize),
   false);
@@ -1335,8 +1335,8 @@
 // to that information.
 Address Tmp = CreateTempAllocaForCoercion(CGF, SrcTy, Dst.getAlignment());
 CGF.Builder.CreateStore(Src, Tmp);
-Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
-Address DstCasted = CGF.Builder.CreateBitCast(Dst, CGF.AllocaInt8PtrTy);
+Address Casted = CGF.Builder.CreateElementBitCast(Tmp,CGF.Int8Ty);
+Address DstCasted = CGF.Builder.CreateElementBitCast(Dst,CGF.Int8Ty);
 CGF.Builder.CreateMemCpy(DstCasted, Casted,
 llvm::ConstantInt::get(CGF.IntPtrTy, DstSize),
 false);


Index: test/CodeGenCXX/address-space-cast-coerce.cpp
===
--- /dev/null
+++ test/CodeGenCXX/address-space-cast-coerce.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s
+
+template struct my_vector_base;
+
+template
+struct my_vector_base {
+typedef T Native_vec_ __attribute__((ext_vector_type(1)));
+
+union {
+Native_vec_ data;
+struct {
+T x;
+};
+};
+};
+
+template
+struct my_vector_type : public my_vector_base {
+using my_vector_base::data;
+using typename my_vector_base::Native_vec_;
+
+template< typename U>
+my_vector_type(U x) noexcept
+{
+for (auto i = 0u; i != rank; ++i) data[i] = x;
+}
+my_vector_type& operator+=(const my_vector_type& x) noexcept
+{
+data += x.data;
+return *this;
+}
+};
+
+template
+inline
+my_vector_type operator+(
+const my_vector_type& x, const my_vector_type& y) noexcept
+{
+return my_vector_type{x} += y;
+}
+
+using char1 = my_vector_type;
+
+int mane() {
+
+char1 f1{1};
+char1 f2{1};
+
+// CHECK: %[[a:[^ ]+]] = addrspacecast i16 addrspace(5)* %{{[^ ]+}} to i16*
+// CHECK: %[[a:[^ ]+]] = addrspacecast %{{[^ ]+}} addrspace(5)* %{{[^ ]+}} to %{{[^ ]+}} 
+
+char1 f3 = f1 + f2;
+}
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1253,8 +1253,8 @@
 
   // Otherwise do coercion through memory. This is stupid, but simple.
   Address Tmp = CreateTempAllocaForCoercion(CGF, Ty, Src.getAlignment());
-  Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
-  Address SrcCasted = 

[PATCH] D53780: Fix bitcast to address space cast for coerced load/stores

2018-11-05 Thread David Salinas via Phabricator via cfe-commits
david-salinas updated this revision to Diff 172671.
david-salinas added a comment.

using CreateElementBitCast instead


Repository:
  rC Clang

https://reviews.llvm.org/D53780

Files:
  lib/CodeGen/CGCall.cpp
  test/CodeGenCXX/address-space-cast-coerce.cpp


Index: test/CodeGenCXX/address-space-cast-coerce.cpp
===
--- /dev/null
+++ test/CodeGenCXX/address-space-cast-coerce.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s
+
+template struct my_vector_base;
+
+template
+struct my_vector_base {
+typedef T Native_vec_ __attribute__((ext_vector_type(1)));
+
+union {
+Native_vec_ data;
+struct {
+T x;
+};
+};
+};
+
+template
+struct my_vector_type : public my_vector_base {
+using my_vector_base::data;
+using typename my_vector_base::Native_vec_;
+
+template< typename U>
+my_vector_type(U x) noexcept
+{
+for (auto i = 0u; i != rank; ++i) data[i] = x;
+}
+my_vector_type& operator+=(const my_vector_type& x) noexcept
+{
+data += x.data;
+return *this;
+}
+};
+
+template
+inline
+my_vector_type operator+(
+const my_vector_type& x, const my_vector_type& y) noexcept
+{
+return my_vector_type{x} += y;
+}
+
+using char1 = my_vector_type;
+
+int mane() {
+
+char1 f1{1};
+char1 f2{1};
+
+// CHECK: %[[a:[^ ]+]] = addrspacecast i16 addrspace(5)* %{{[^ ]+}} to i16*
+// CHECK: %[[a:[^ ]+]] = addrspacecast %{{[^ ]+}} addrspace(5)* %{{[^ ]+}} to 
%{{[^ ]+}} 
+
+char1 f3 = f1 + f2;
+}
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1253,8 +1253,10 @@
 
   // Otherwise do coercion through memory. This is stupid, but simple.
   Address Tmp = CreateTempAllocaForCoercion(CGF, Ty, Src.getAlignment());
-  Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
-  Address SrcCasted = CGF.Builder.CreateBitCast(Src, CGF.AllocaInt8PtrTy);
+  // Address Casted = CGF.Builder.CreateBitCast(Tmp, 
CGF.Int8Ty->getPointerTo(Tmp.getAddressSpace()));
+  Address Casted = CGF.Builder.CreateElementBitCast(Tmp,CGF.Int8Ty)
+  // Address SrcCasted = CGF.Builder.CreateBitCast(Src, 
CGF.Int8Ty->getPointerTo(Src.getAddressSpace()));
+  Address SrcCasted = CGF.Builder.CreateElementBitCast(Src,CGF.Int8Ty)
   CGF.Builder.CreateMemCpy(Casted, SrcCasted,
   llvm::ConstantInt::get(CGF.IntPtrTy, SrcSize),
   false);
@@ -1335,8 +1337,10 @@
 // to that information.
 Address Tmp = CreateTempAllocaForCoercion(CGF, SrcTy, Dst.getAlignment());
 CGF.Builder.CreateStore(Src, Tmp);
-Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
-Address DstCasted = CGF.Builder.CreateBitCast(Dst, CGF.AllocaInt8PtrTy);
+// Address Casted = CGF.Builder.CreateBitCast(Tmp, 
CGF.Int8Ty->getPointerTo(Tmp.getAddressSpace()));
+Address Casted = CGF.Builder.CreateElementBitCast(Tmp,CGF.Int8Ty)
+// Address DstCasted = CGF.Builder.CreateBitCast(Dst, 
CGF.Int8Ty->getPointerTo(Dst.getAddressSpace()));
+Address DstCasted = CGF.Builder.CreateElementBitCast(Dst,CGF.Int8Ty)
 CGF.Builder.CreateMemCpy(DstCasted, Casted,
 llvm::ConstantInt::get(CGF.IntPtrTy, DstSize),
 false);


Index: test/CodeGenCXX/address-space-cast-coerce.cpp
===
--- /dev/null
+++ test/CodeGenCXX/address-space-cast-coerce.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s
+
+template struct my_vector_base;
+
+template
+struct my_vector_base {
+typedef T Native_vec_ __attribute__((ext_vector_type(1)));
+
+union {
+Native_vec_ data;
+struct {
+T x;
+};
+};
+};
+
+template
+struct my_vector_type : public my_vector_base {
+using my_vector_base::data;
+using typename my_vector_base::Native_vec_;
+
+template< typename U>
+my_vector_type(U x) noexcept
+{
+for (auto i = 0u; i != rank; ++i) data[i] = x;
+}
+my_vector_type& operator+=(const my_vector_type& x) noexcept
+{
+data += x.data;
+return *this;
+}
+};
+
+template
+inline
+my_vector_type operator+(
+const my_vector_type& x, const my_vector_type& y) noexcept
+{
+return my_vector_type{x} += y;
+}
+
+using char1 = my_vector_type;
+
+int mane() {
+
+char1 f1{1};
+char1 f2{1};
+
+// CHECK: %[[a:[^ ]+]] = addrspacecast i16 addrspace(5)* %{{[^ ]+}} to i16*
+// CHECK: %[[a:[^ ]+]] = addrspacecast %{{[^ ]+}} addrspace(5)* %{{[^ ]+}} to %{{[^ ]+}} 
+
+char1 f3 = f1 + f2;
+}

[PATCH] D53223: AMDGPU: Add sram-ecc feature options

2018-11-05 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346178: AMDGPU: Add sram-ecc feature options (authored by 
kzhuravl, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53223?vs=169499=172665#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53223

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/test/Driver/amdgpu-features.c


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2104,6 +2104,10 @@
   HelpText<"Enable XNACK (AMDGPU only)">;
 def mno_xnack : Flag<["-"], "mno-xnack">, Group,
   HelpText<"Disable XNACK (AMDGPU only)">;
+def msram_ecc : Flag<["-"], "msram-ecc">, Group,
+  HelpText<"Enable SRAM ECC (AMDGPU only)">;
+def mno_sram_ecc : Flag<["-"], "mno-sram-ecc">, Group,
+  HelpText<"Disable SRAM ECC (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, 
Flags<[DriverOption]>;
Index: cfe/trunk/test/Driver/amdgpu-features.c
===
--- cfe/trunk/test/Driver/amdgpu-features.c
+++ cfe/trunk/test/Driver/amdgpu-features.c
@@ -17,3 +17,9 @@
 
 // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck 
--check-prefix=NO-XNACK %s
 // NO-XNACK: "-target-feature" "-xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -msram-ecc %s 2>&1 | FileCheck 
--check-prefix=SRAM-ECC %s
+// SRAM-ECC: "-target-feature" "+sram-ecc"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-sram-ecc %s 2>&1 | 
FileCheck --check-prefix=NO-SRAM-ECC %s
+// NO-SRAM-ECC: "-target-feature" "-sram-ecc"


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2104,6 +2104,10 @@
   HelpText<"Enable XNACK (AMDGPU only)">;
 def mno_xnack : Flag<["-"], "mno-xnack">, Group,
   HelpText<"Disable XNACK (AMDGPU only)">;
+def msram_ecc : Flag<["-"], "msram-ecc">, Group,
+  HelpText<"Enable SRAM ECC (AMDGPU only)">;
+def mno_sram_ecc : Flag<["-"], "mno-sram-ecc">, Group,
+  HelpText<"Disable SRAM ECC (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>;
Index: cfe/trunk/test/Driver/amdgpu-features.c
===
--- cfe/trunk/test/Driver/amdgpu-features.c
+++ cfe/trunk/test/Driver/amdgpu-features.c
@@ -17,3 +17,9 @@
 
 // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s
 // NO-XNACK: "-target-feature" "-xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -msram-ecc %s 2>&1 | FileCheck --check-prefix=SRAM-ECC %s
+// SRAM-ECC: "-target-feature" "+sram-ecc"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-sram-ecc %s 2>&1 | FileCheck --check-prefix=NO-SRAM-ECC %s
+// NO-SRAM-ECC: "-target-feature" "-sram-ecc"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53223: AMDGPU: Add sram-ecc feature options

2018-11-05 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346178: AMDGPU: Add sram-ecc feature options (authored by 
kzhuravl, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D53223

Files:
  include/clang/Driver/Options.td
  test/Driver/amdgpu-features.c


Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -2104,6 +2104,10 @@
   HelpText<"Enable XNACK (AMDGPU only)">;
 def mno_xnack : Flag<["-"], "mno-xnack">, Group,
   HelpText<"Disable XNACK (AMDGPU only)">;
+def msram_ecc : Flag<["-"], "msram-ecc">, Group,
+  HelpText<"Enable SRAM ECC (AMDGPU only)">;
+def mno_sram_ecc : Flag<["-"], "mno-sram-ecc">, Group,
+  HelpText<"Disable SRAM ECC (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, 
Flags<[DriverOption]>;
Index: test/Driver/amdgpu-features.c
===
--- test/Driver/amdgpu-features.c
+++ test/Driver/amdgpu-features.c
@@ -17,3 +17,9 @@
 
 // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck 
--check-prefix=NO-XNACK %s
 // NO-XNACK: "-target-feature" "-xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -msram-ecc %s 2>&1 | FileCheck 
--check-prefix=SRAM-ECC %s
+// SRAM-ECC: "-target-feature" "+sram-ecc"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-sram-ecc %s 2>&1 | 
FileCheck --check-prefix=NO-SRAM-ECC %s
+// NO-SRAM-ECC: "-target-feature" "-sram-ecc"


Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -2104,6 +2104,10 @@
   HelpText<"Enable XNACK (AMDGPU only)">;
 def mno_xnack : Flag<["-"], "mno-xnack">, Group,
   HelpText<"Disable XNACK (AMDGPU only)">;
+def msram_ecc : Flag<["-"], "msram-ecc">, Group,
+  HelpText<"Enable SRAM ECC (AMDGPU only)">;
+def mno_sram_ecc : Flag<["-"], "mno-sram-ecc">, Group,
+  HelpText<"Disable SRAM ECC (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>;
Index: test/Driver/amdgpu-features.c
===
--- test/Driver/amdgpu-features.c
+++ test/Driver/amdgpu-features.c
@@ -17,3 +17,9 @@
 
 // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s
 // NO-XNACK: "-target-feature" "-xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -msram-ecc %s 2>&1 | FileCheck --check-prefix=SRAM-ECC %s
+// SRAM-ECC: "-target-feature" "+sram-ecc"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-sram-ecc %s 2>&1 | FileCheck --check-prefix=NO-SRAM-ECC %s
+// NO-SRAM-ECC: "-target-feature" "-sram-ecc"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r346178 - AMDGPU: Add sram-ecc feature options

2018-11-05 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Mon Nov  5 14:44:59 2018
New Revision: 346178

URL: http://llvm.org/viewvc/llvm-project?rev=346178=rev
Log:
AMDGPU: Add sram-ecc feature options

Differential Revision: https://reviews.llvm.org/D53223

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/amdgpu-features.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=346178=346177=346178=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Nov  5 14:44:59 2018
@@ -2104,6 +2104,10 @@ def mxnack : Flag<["-"], "mxnack">, Grou
   HelpText<"Enable XNACK (AMDGPU only)">;
 def mno_xnack : Flag<["-"], "mno-xnack">, Group,
   HelpText<"Disable XNACK (AMDGPU only)">;
+def msram_ecc : Flag<["-"], "msram-ecc">, Group,
+  HelpText<"Enable SRAM ECC (AMDGPU only)">;
+def mno_sram_ecc : Flag<["-"], "mno-sram-ecc">, Group,
+  HelpText<"Disable SRAM ECC (AMDGPU only)">;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[DriverOption]>;
 def fno_altivec : Flag<["-"], "fno-altivec">, Group, 
Flags<[DriverOption]>;

Modified: cfe/trunk/test/Driver/amdgpu-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-features.c?rev=346178=346177=346178=diff
==
--- cfe/trunk/test/Driver/amdgpu-features.c (original)
+++ cfe/trunk/test/Driver/amdgpu-features.c Mon Nov  5 14:44:59 2018
@@ -17,3 +17,9 @@
 
 // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck 
--check-prefix=NO-XNACK %s
 // NO-XNACK: "-target-feature" "-xnack"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -msram-ecc %s 2>&1 | FileCheck 
--check-prefix=SRAM-ECC %s
+// SRAM-ECC: "-target-feature" "+sram-ecc"
+
+// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-sram-ecc %s 2>&1 | 
FileCheck --check-prefix=NO-SRAM-ECC %s
+// NO-SRAM-ECC: "-target-feature" "-sram-ecc"


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


[clang-tools-extra] r346176 - [clang-tidy] fix example code-blocks indendation

2018-11-05 Thread Jonas Toth via cfe-commits
Author: jonastoth
Date: Mon Nov  5 14:30:17 2018
New Revision: 346176

URL: http://llvm.org/viewvc/llvm-project?rev=346176=rev
Log:
[clang-tidy] fix example code-blocks indendation

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst?rev=346176=346175=346176=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst
 Mon Nov  5 14:30:17 2018
@@ -28,7 +28,7 @@ Options
When set to `1` (default is `0`), this check doesn't flag classes with a 
sole, explicitly
defaulted destructor. An example for such a class is:

-.. code-block:: c++
+   .. code-block:: c++

  struct A {
virtual ~A() = default;
@@ -40,7 +40,7 @@ Options
operations at all. It still flags classes which define only one of either
move constructor or move assignment operator. With this option enabled, the 
following class won't be flagged:

-.. code-block:: c++
+   .. code-block:: c++

  struct A {
A(const A&);

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst?rev=346176=346175=346176=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst 
Mon Nov  5 14:30:17 2018
@@ -107,7 +107,7 @@ Options
 When non-zero, the check will ignore implicitly constructed arguments of
 ``push_back``, e.g.
 
-.. code-block:: c++
+.. code-block:: c++
 
 std::vector v;
 v.push_back("a"); // Ignored when IgnoreImplicitConstructors is ``1``.


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


[PATCH] D53522: [Frontend] Include module map header declaration in dependency file output

2018-11-05 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

Ping!


https://reviews.llvm.org/D53522



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments.



Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:10
+
+  .. code-block:: c++
+

Eugene.Zelenko wrote:
> JonasToth wrote:
> > ztamas wrote:
> > > JonasToth wrote:
> > > > the `.. code-block:: c++` is usually not indended, only the code itself.
> > > Hmm, I copied this from somewhere. It might be a good idea to make this 
> > > consistent across all the *.rst files. See 
> > > bugprone-suspicious-semicolon.rst or bugprone-use-after-move.rst for 
> > > example.
> > True, but nobody want's to do the documentation work :D
> I could try to fix, but I need to be pointed to proper example :-)
A nice little `sed` line i had to write 3 times fixed the thing :D


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[clang-tools-extra] r346173 - [clang-tidy] doc removew hitespace in front of code-block-line

2018-11-05 Thread Jonas Toth via cfe-commits
Author: jonastoth
Date: Mon Nov  5 14:21:27 2018
New Revision: 346173

URL: http://llvm.org/viewvc/llvm-project?rev=346173=rev
Log:
[clang-tidy] doc removew hitespace in front of code-block-line

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/boost-use-to-string.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-move-forwarding-reference.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-suspicious-semicolon.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-use-after-move.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-using-namespace.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-transparent-functors.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/boost-use-to-string.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/boost-use-to-string.rst?rev=346173=346172=346173=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/boost-use-to-string.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/boost-use-to-string.rst Mon 
Nov  5 14:21:27 2018
@@ -11,7 +11,7 @@ It doesn't replace conversion from float
 overloads, because it would change the behaviour.
 
 
-  .. code-block:: c++
+.. code-block:: c++
 
 auto str = boost::lexical_cast(42);
 auto wstr = boost::lexical_cast(2137LL);

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst?rev=346173=346172=346173=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst
 Mon Nov  5 14:21:27 2018
@@ -13,7 +13,7 @@ Item 26.
 
 Consider the following example:
 
-  .. code-block:: c++
+.. code-block:: c++
 
 class Person {
 public:

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-move-forwarding-reference.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-move-forwarding-reference.rst?rev=346173=346172=346173=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-move-forwarding-reference.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-move-forwarding-reference.rst
 Mon Nov  5 14:21:27 2018
@@ -5,7 +5,7 @@ bugprone-move-forwarding-reference
 
 Warns if ``std::move`` is called on a forwarding reference, for example:
 
-  .. code-block:: c++
+.. code-block:: c++
 
 template 
 void foo(T&& t) {
@@ -22,7 +22,7 @@ function template argument.)
 
 In this example, the suggested fix would be
 
-  .. code-block:: c++
+.. code-block:: c++
 
 bar(std::forward(t));
 
@@ -34,7 +34,7 @@ Code like the example above is sometimes
 deduced for ``T``, and that it is therefore not possible to pass an lvalue to
 ``foo()``. However, this is not true. Consider this example:
 
-  .. code-block:: c++
+.. code-block:: c++
 
 std::string s = "Hello, world";
 foo(s);

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-suspicious-semicolon.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-suspicious-semicolon.rst?rev=346173=346172=346173=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-suspicious-semicolon.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-suspicious-semicolon.rst
 Mon Nov  5 14:21:27 2018
@@ -9,7 +9,7 @@ the code. More specifically, it looks fo
 context of the code (e.g. indentation) in an attempt to determine whether that
 is intentional.
 
-  .. code-block:: c++
+.. code-block:: c++
 
 if (x < y);
 {
@@ -20,7 +20,7 @@ Here the body of the ``if`` statement co
 of the first line, and `x` will be incremented regardless of the condition.
 
 
-  .. code-block:: c++
+.. code-block:: c++
 
 while ((line = readLine(file)) != NULL);
   processLine(line);
@@ -30,7 +30,7 @@ As a result of this code, `processLine()
 the code indicates the intention of the programmer.
 
 
-  .. code-block:: c++
+.. 

[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: include/clang/Basic/BuiltinsARM.def:270
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+

mgrang wrote:
> rnk wrote:
> > Given how much duplication there is, I think we need to have some kind of 
> > BuiltinsMSVC.def that contains a list of all the interlocked builitin 
> > families, like this:
> > ```
> > INTERLOCKED_BUILTIN(_InterlockedCompareExchange)
> > INTERLOCKED_BUILTIN(_InterlockedOr)
> > INTERLOCKED_BUILTIN(_InterlockedAnd)
> > ```
> > We'd include this file here, with INTERLOCKED_BUILTIN defined as:
> > ```
> > #define INTERLOCKED_BUILTIN(Op) \
> >   TARGET_HEADER_BUILTIN(Op##8_acq, "ccD*cc", "nh", "intrin.h", 
> > ALL_MS_LANGUAGES, "") \
> >   TARGET_HEADER_BUILTIN(Op##8_nf, "ccD*cc", "nh", "intrin.h", 
> > ALL_MS_LANGUAGES, "") \
> > ...
> > ```
> > That'll stamp out the enums that we need, and then we can reuse the .def 
> > file to reduce duplication in the switch/case below.
> > 
> > Every op is basically 16 operations: {8, 16, 32, 64} X {seq_cst, rel, acq, 
> > nf}
> > 
> > I'm not sure what to do about the ones that overlap with x86.
> Thanks Reid. Yes, I think we can certainly cleanup further. That being said, 
> can we get these patches committed first and then cleanup in a follow-up 
> patch?
Fair enough. I think the approach you have in all of these patches is 
reasonable and not hard to clean up later. I don't have time to review each IR 
implementation right now, but it is important to get a second opinion, because 
as you've seen they have had bugs (missing fences) in the past.



Comment at: lib/CodeGen/CGBuiltin.cpp:259-262
+  // For Release ordering, the failure ordering should be Monotonic.
+  auto FailureOrdering = SuccessOrdering == AtomicOrdering::Release ?
+ AtomicOrdering::Monotonic :
+ SuccessOrdering;

I don't know enough about the memory model to really say if this is right, so 
I'll pass the buck to @efriedma.


Repository:
  rC Clang

https://reviews.llvm.org/D54062



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:10
+
+  .. code-block:: c++
+

JonasToth wrote:
> ztamas wrote:
> > JonasToth wrote:
> > > the `.. code-block:: c++` is usually not indended, only the code itself.
> > Hmm, I copied this from somewhere. It might be a good idea to make this 
> > consistent across all the *.rst files. See 
> > bugprone-suspicious-semicolon.rst or bugprone-use-after-move.rst for 
> > example.
> True, but nobody want's to do the documentation work :D
I could try to fix, but I need to be pointed to proper example :-)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

last nits from my side (for now :)).
If the other reviews could take a look at it as well, would be great.
I am uncertain about the english in some comments @aaron.ballman finds all 
these language bugs ;)




Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:123
+  return calcPositiveBits(Context, RHSEType);
+else
+  return std::max(calcPositiveBits(Context, LHSEType),

please no else after return



Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:126
+  calcPositiveBits(Context, RHSEType));
+  } else
+return calcPositiveBits(Context, CondExprType);

same



Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:142
+  if (LoopVar->getType() != LoopIncrement->getType())
+return; // We matched the loop variable incorrectly
+

ztamas wrote:
> ztamas wrote:
> > JonasToth wrote:
> > > Does this try to ensure a precondition? Then it should become an 
> > > assertion instead.
> > > Please adjust the comment like above (punctuation, position)
> > It's not an assumed precondition. This `if` handles the case when 
> > LoopVarMatcher is not fitted with the actual loop variable. That's why the 
> > IncrementMatcher is there so we can check whether we found the loop 
> > variable.
> > See voidForLoopReverseCond() test case which hits this `if` branch.
> > I did not find a solution to handle this check inside the matcher.
> voidForLoopReverseCond()  was renamed to voidForLoopCondImplicitCast() in the 
> mean time.
Ok, I can't think of a solution of head right now as well. It's fine to leave 
as is.



Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:10
+
+  .. code-block:: c++
+

ztamas wrote:
> JonasToth wrote:
> > the `.. code-block:: c++` is usually not indended, only the code itself.
> Hmm, I copied this from somewhere. It might be a good idea to make this 
> consistent across all the *.rst files. See bugprone-suspicious-semicolon.rst 
> or bugprone-use-after-move.rst for example.
True, but nobody want's to do the documentation work :D


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D54017: [analyzer] NullabilityChecker: Invariant violation should only be triggered for symbols.

2018-11-05 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

I have no other objections, looks great!




Comment at: test/Analysis/nullability.mm:3-4
 // RUN: %clang_analyze_cc1 -fblocks 
-analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced
 -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true 
-DNOSYSTEMHEADERS=1 -verify %s
+// RUN: %clang_analyze_cc1 -fblocks 
-analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced
 -DNOSYSTEMHEADERS=0 -verify %s -fobjc-arc
+// RUN: %clang_analyze_cc1 -fblocks 
-analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced
 -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true 
-DNOSYSTEMHEADERS=1 -verify %s -fobjc-arc
 

NoQ wrote:
> Szelethus wrote:
> > These too. Especially these :D
> These two are in fact a bit annoying because the space after `// RUN: ` is 
> part of the run-line, so you can't break a single long flag into multiple 
> lines without getting involved in an aesthetically unpleasant indentation.
Oh, this looks amazing now. :)


https://reviews.llvm.org/D54017



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


[PATCH] D53700: Support _Clang as a scoped attribute identifier

2018-11-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: mclow.lists, EricWF, ldionne.
aaron.ballman added a comment.

Another option that @rsmith and I discussed today is perhaps using `__clang` or 
`clang__` as the identifier, but perhaps this will cause more confusion about 
where to put underscores than `_Clang` would. If there are other ideas that are 
more palatable for the identifier, that'd be great -- I am not strongly tied to 
a spelling.

Adding some libc++ maintainers to see if they have opinions on the identifier 
picked.


https://reviews.llvm.org/D53700



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


[PATCH] D54017: [analyzer] NullabilityChecker: Invariant violation should only be triggered for symbols.

2018-11-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: test/Analysis/nullability.mm:3-4
 // RUN: %clang_analyze_cc1 -fblocks 
-analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced
 -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true 
-DNOSYSTEMHEADERS=1 -verify %s
+// RUN: %clang_analyze_cc1 -fblocks 
-analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced
 -DNOSYSTEMHEADERS=0 -verify %s -fobjc-arc
+// RUN: %clang_analyze_cc1 -fblocks 
-analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced
 -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true 
-DNOSYSTEMHEADERS=1 -verify %s -fobjc-arc
 

Szelethus wrote:
> These too. Especially these :D
These two are in fact a bit annoying because the space after `// RUN: ` is part 
of the run-line, so you can't break a single long flag into multiple lines 
without getting involved in an aesthetically unpleasant indentation.


https://reviews.llvm.org/D54017



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


[PATCH] D54017: [analyzer] NullabilityChecker: Invariant violation should only be triggered for symbols.

2018-11-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 172645.
NoQ marked 3 inline comments as done.
NoQ added a comment.

Fix comments, update comments.

Before i forget - also add invariant violation markers to the exploded graph, 
which helped me a lot with debugging this bug.


https://reviews.llvm.org/D54017

Files:
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  test/Analysis/nullability-arc.mm
  test/Analysis/nullability.mm

Index: test/Analysis/nullability.mm
===
--- test/Analysis/nullability.mm
+++ test/Analysis/nullability.mm
@@ -1,5 +1,36 @@
-// RUN: %clang_analyze_cc1 -fblocks -analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced -DNOSYSTEMHEADERS=0 -verify %s
-// RUN: %clang_analyze_cc1 -fblocks -analyzer-checker=core,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullableDereferenced -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true -DNOSYSTEMHEADERS=1 -verify %s
+// RUN: %clang_analyze_cc1 -fblocks -verify %s -analyzer-checker=core \
+// RUN:   -analyzer-checker=nullability.NullPassedToNonnull \
+// RUN:   -analyzer-checker=nullability.NullReturnedFromNonnull \
+// RUN:   -analyzer-checker=nullability.NullablePassedToNonnull \
+// RUN:   -analyzer-checker=nullability.NullableReturnedFromNonnull \
+// RUN:   -analyzer-checker=nullability.NullableDereferenced \
+// RUN:   -DNOSYSTEMHEADERS=0
+
+// RUN: %clang_analyze_cc1 -fblocks -verify %s -analyzer-checker=core \
+// RUN:   -analyzer-checker=nullability.NullPassedToNonnull \
+// RUN:   -analyzer-checker=nullability.NullReturnedFromNonnull \
+// RUN:   -analyzer-checker=nullability.NullablePassedToNonnull \
+// RUN:   -analyzer-checker=nullability.NullableReturnedFromNonnull \
+// RUN:   -analyzer-checker=nullability.NullableDereferenced \
+// RUN:   -DNOSYSTEMHEADERS=1 \
+// RUN:   -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true
+
+// RUN: %clang_analyze_cc1 -fblocks -verify %s -analyzer-checker=core\
+// RUN:   -analyzer-checker=nullability.NullPassedToNonnull\
+// RUN:   -analyzer-checker=nullability.NullReturnedFromNonnull\
+// RUN:   -analyzer-checker=nullability.NullablePassedToNonnull\
+// RUN:   -analyzer-checker=nullability.NullableReturnedFromNonnull\
+// RUN:   -analyzer-checker=nullability.NullableDereferenced\
+// RUN:   -DNOSYSTEMHEADERS=0 -fobjc-arc
+
+// RUN: %clang_analyze_cc1 -fblocks -verify %s -analyzer-checker=core\
+// RUN:   -analyzer-checker=nullability.NullPassedToNonnull\
+// RUN:   -analyzer-checker=nullability.NullReturnedFromNonnull\
+// RUN:   -analyzer-checker=nullability.NullablePassedToNonnull\
+// RUN:   -analyzer-checker=nullability.NullableReturnedFromNonnull\
+// RUN:   -analyzer-checker=nullability.NullableDereferenced\
+// RUN:   -DNOSYSTEMHEADERS=1 -fobjc-arc\
+// RUN:   -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=true
 
 #include "Inputs/system-header-simulator-for-nullability.h"
 
Index: test/Analysis/nullability-arc.mm
===
--- /dev/null
+++ test/Analysis/nullability-arc.mm
@@ -0,0 +1,39 @@
+// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,nullability\
+// RUN:   -analyzer-output=text -verify %s
+// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,nullability\
+// RUN:   -analyzer-output=text -verify %s -fobjc-arc
+
+#if !__has_feature(objc_arc)
+// expected-no-diagnostics
+#endif
+
+
+#define nil ((id)0)
+
+@interface Param
+@end
+
+@interface Base
+- (void)foo:(Param *_Nonnull)param;
+@end
+
+@interface Derived : Base
+@end
+
+@implementation Derived
+- (void)foo:(Param *)param {
+  // FIXME: Why do we not emit the warning under ARC?
+  [super foo:param];
+#if __has_feature(objc_arc)
+  // expected-warning@-2{{nil passed to a callee that requires a non-null 1st parameter}}
+  // expected-note@-3   {{nil passed to a callee that requires a non-null 1st parameter}}
+#endif
+
+  [self foo:nil];
+#if __has_feature(objc_arc)
+  // expected-note@-2{{Calling 'foo:'}}
+  // expected-note@-3{{Passing nil object reference via 1st parameter 'param'}}
+#endif
+}
+@end
+
Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -329,8 +329,8 @@
 nullptr);
 }
 
-/// Returns true when the value stored at the given location is null
-/// and the passed in type is nonnnull.
+/// Returns true when the value stored at the given location has been
+/// constrained to null after being passed through an object of nonnnull type.
 static bool 

[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added inline comments.



Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:142
+  if (LoopVar->getType() != LoopIncrement->getType())
+return; // We matched the loop variable incorrectly
+

ztamas wrote:
> JonasToth wrote:
> > Does this try to ensure a precondition? Then it should become an assertion 
> > instead.
> > Please adjust the comment like above (punctuation, position)
> It's not an assumed precondition. This `if` handles the case when 
> LoopVarMatcher is not fitted with the actual loop variable. That's why the 
> IncrementMatcher is there so we can check whether we found the loop variable.
> See voidForLoopReverseCond() test case which hits this `if` branch.
> I did not find a solution to handle this check inside the matcher.
voidForLoopReverseCond()  was renamed to voidForLoopCondImplicitCast() in the 
mean time.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D54013: [analyzer] NFC: MallocChecker: Avoid redundant transitions.

2018-11-05 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2369
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();

NoQ wrote:
> Szelethus wrote:
> > george.karpenkov wrote:
> > > Szelethus wrote:
> > > > We are acquiring an object of type `ImmutableMap`, modify it, and put 
> > > > it back into `state`? Can't we just modify it through `ProgramState`'s 
> > > > interface directly?
> > > state is immutable, I don't think we can put anything into it.
> > > We also can't modify ImmutableMap because, well, it's immutable.
> > Poor choice of words, I admit. What I actually meant is that maybe it would 
> > be more straighforward if we didnt create a local varable here. But I'm 
> > fine with being in the wrong :)
> Manipulating maps directly is slightly cheaper because for every operation 
> you only create a new map but not a new state. I have no indication that this 
> optimization is worth the effort, but i also have no indication that 
> pessimizing it back is worth the effort.
Okay, thanks :)


https://reviews.llvm.org/D54013



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


[PATCH] D53153: [OpenCL] Mark namespace scope variables and kernel functions with default visibility

2018-11-05 Thread Tony Tye via Phabricator via cfe-commits
t-tye accepted this revision.
t-tye added a comment.
This revision is now accepted and ready to land.

LGTM

Summary needs updating as now only being done for kernels and not namespace 
scope variables.


https://reviews.llvm.org/D53153



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


[PATCH] D53153: [OpenCL] Mark namespace scope variables and kernel functions with default visibility

2018-11-05 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment.

Ping


https://reviews.llvm.org/D53153



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


[PATCH] D53768: Add VerboseOutputStream to CompilerInstance

2018-11-05 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment.

Ping


Repository:
  rC Clang

https://reviews.llvm.org/D53768



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


[PATCH] D54120: [python] Support PathLike filenames and directories

2018-11-05 Thread Jakub Stasiak via Phabricator via cfe-commits
jstasiak created this revision.
jstasiak added reviewers: mgorny, jbcoe.
Herald added a subscriber: arphaman.

Python 3.6 introduced a file system path protocol (PEP 519[1]). The standard 
library APIs accepting file system paths now accept path objects too. It could 
be useful to add this here as well for convenience.

  

[1] https://www.python.org/dev/peps/pep-0519


Repository:
  rC Clang

https://reviews.llvm.org/D54120

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_cdb.py
  bindings/python/tests/cindex/test_code_completion.py
  bindings/python/tests/cindex/test_translation_unit.py
  bindings/python/tests/cindex/util.py

Index: bindings/python/tests/cindex/util.py
===
--- bindings/python/tests/cindex/util.py
+++ bindings/python/tests/cindex/util.py
@@ -1,5 +1,15 @@
 # This file provides common utility functions for the test suite.
 
+import os
+HAS_FSPATH = hasattr(os, 'fspath')
+
+try:
+import pathlib
+except ImportError:
+str_to_path = None
+else:
+str_to_path = pathlib.Path
+
 from clang.cindex import Cursor
 from clang.cindex import TranslationUnit
 
@@ -72,4 +82,6 @@
 'get_cursor',
 'get_cursors',
 'get_tu',
+'HAS_FSPATH',
+'str_to_path',
 ]
Index: bindings/python/tests/cindex/test_translation_unit.py
===
--- bindings/python/tests/cindex/test_translation_unit.py
+++ bindings/python/tests/cindex/test_translation_unit.py
@@ -20,6 +20,8 @@
 from clang.cindex import TranslationUnit
 from .util import get_cursor
 from .util import get_tu
+from .util import HAS_FSPATH
+from .util import str_to_path
 
 
 kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
@@ -36,6 +38,17 @@
 yield t.name
 
 
+@contextmanager
+def save_tu_pathlike(tu):
+"""Convenience API to save a TranslationUnit to a file.
+
+Returns the filename it was saved to.
+"""
+with tempfile.NamedTemporaryFile() as t:
+tu.save(str_to_path(t.name))
+yield t.name
+
+
 class TestTranslationUnit(unittest.TestCase):
 def test_spelling(self):
 path = os.path.join(kInputsDir, 'hello.cpp')
@@ -89,6 +102,22 @@
 spellings = [c.spelling for c in tu.cursor.get_children()]
 self.assertEqual(spellings[-1], 'x')
 
+if HAS_FSPATH:
+def test_from_source_accepts_pathlike(self):
+tu = TranslationUnit.from_source(str_to_path('fake.c'), ['-Iincludes'], unsaved_files = [
+(str_to_path('fake.c'), """
+#include "fake.h"
+int x;
+int SOME_DEFINE;
+"""),
+(str_to_path('includes/fake.h'), """
+#define SOME_DEFINE y
+""")
+])
+spellings = [c.spelling for c in tu.cursor.get_children()]
+self.assertEqual(spellings[-2], 'x')
+self.assertEqual(spellings[-1], 'y')
+
 def assert_normpaths_equal(self, path1, path2):
 """ Compares two paths for equality after normalizing them with
 os.path.normpath
@@ -135,6 +164,16 @@
 self.assertTrue(os.path.exists(path))
 self.assertGreater(os.path.getsize(path), 0)
 
+if HAS_FSPATH:
+def test_save_pathlike(self):
+"""Ensure TranslationUnit.save() works with PathLike filename."""
+
+tu = get_tu('int foo();')
+
+with save_tu_pathlike(tu) as path:
+self.assertTrue(os.path.exists(path))
+self.assertGreater(os.path.getsize(path), 0)
+
 def test_save_translation_errors(self):
 """Ensure that saving to an invalid directory raises."""
 
@@ -167,6 +206,17 @@
 # Just in case there is an open file descriptor somewhere.
 del tu2
 
+# We can also pass the filename as Path-like object
+if HAS_FSPATH:
+tu2 = TranslationUnit.from_ast_file(filename=str_to_path(path))
+self.assertEqual(len(tu2.diagnostics), 0)
+
+foo = get_cursor(tu2, 'foo')
+self.assertIsNotNone(foo)
+
+# Just in case there is an open file descriptor somewhere.
+del tu2
+
 def test_index_parse(self):
 path = os.path.join(kInputsDir, 'hello.cpp')
 index = Index.create()
@@ -185,6 +235,19 @@
 with self.assertRaises(Exception):
 f = tu.get_file('foobar.cpp')
 
+if HAS_FSPATH:
+def test_get_file_pathlike(self):
+"""Ensure tu.get_file() works appropriately with PathLike filenames."""
+
+tu = get_tu('int foo();')
+
+f = tu.get_file(str_to_path('t.c'))
+self.assertIsInstance(f, File)
+self.assertEqual(f.name, 't.c')
+
+with self.assertRaises(Exception):
+f = tu.get_file(str_to_path('foobar.cpp'))
+
 def test_get_source_location(self):
 """Ensure 

r346167 - [Driver] Reland again again: Default Android toolchains to libc++.

2018-11-05 Thread Dan Albert via cfe-commits
Author: danalbert
Date: Mon Nov  5 12:57:46 2018
New Revision: 346167

URL: http://llvm.org/viewvc/llvm-project?rev=346167=rev
Log:
[Driver] Reland again again: Default Android toolchains to libc++.

Landed more fixes to the compiler-rt Android tests.

Original review was https://reviews.llvm.org/D53109.

Added:

cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/sysroot/usr/include/c++/v1/.keep
Modified:
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.h
cfe/trunk/test/Driver/android-ndk-standalone.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=346167=346166=346167=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Mon Nov  5 12:57:46 2018
@@ -443,6 +443,12 @@ Linux::Linux(const Driver , const llvm
   addPathIfExists(D, SysRoot + "/usr/lib", Paths);
 }
 
+ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {
+  if (getTriple().isAndroid())
+return ToolChain::CST_Libcxx;
+  return ToolChain::CST_Libstdcxx;
+}
+
 bool Linux::HasNativeLLVMSupport() const { return true; }
 
 Tool *Linux::buildLinker() const { return new tools::gnutools::Linker(*this); }

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.h?rev=346167=346166=346167=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Linux.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.h Mon Nov  5 12:57:46 2018
@@ -37,6 +37,7 @@ public:
   llvm::opt::ArgStringList ) const override;
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList ,
llvm::opt::ArgStringList ) const override;
+  CXXStdlibType GetDefaultCXXStdlibType() const override;
   bool isPIEDefault() const override;
   bool IsMathErrnoDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;

Added: 
cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/sysroot/usr/include/c++/v1/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_android_ndk_tree/sysroot/usr/include/c%2B%2B/v1/.keep?rev=346167=auto
==
(empty)

Modified: cfe/trunk/test/Driver/android-ndk-standalone.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-ndk-standalone.cpp?rev=346167=346166=346167=diff
==
--- cfe/trunk/test/Driver/android-ndk-standalone.cpp (original)
+++ cfe/trunk/test/Driver/android-ndk-standalone.cpp Mon Nov  5 12:57:46 2018
@@ -2,21 +2,13 @@
 // toolchain.
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -target arm-linux-androideabi21 \
 // RUN: -B%S/Inputs/basic_android_ndk_tree \
 // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
 // RUN:   | FileCheck  %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9"
-// CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
-// CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
-// CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi"
-// CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb"
-// CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a"
-// CHECK-NOT: "-internal-isystem" 
"{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb"
-// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward"
+// CHECK: "-internal-isystem" "{{.*}}/include/c++/v1"
 // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
 // CHECK: "-internal-externc-isystem" 
"{{.*}}/sysroot/usr/include/arm-linux-androideabi"
@@ -49,21 +41,47 @@
 // CHECK-14: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target armv7a-none-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \
+// RUN: -B%S/Inputs/basic_android_ndk_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-STDCXX %s
+// CHECK-STDCXX: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9"
+// 

[PATCH] D50050: [AST] CastExpr: BasePathSize is not large enough.

2018-11-05 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a subscriber: vsapsai.
george.karpenkov added a comment.

@lebedev.ri yeah ASAN is making stack frame size larger.

It seems @vsapsai is working on disabling this test under ASAN.


Repository:
  rC Clang

https://reviews.llvm.org/D50050



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


[PATCH] D50050: [AST] CastExpr: BasePathSize is not large enough.

2018-11-05 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In https://reviews.llvm.org/D50050#1287780, @george.karpenkov wrote:

> @lebedev.ri @erichkeane The test fails for me on macOS whenever asan and 
> ubsan are both enabled.
>  The failure is stack overflow at stack frame 943




> (? maybe asan usage enforces lower stack size?)

Or higher stack usage.
But yes, sounds like it.


Repository:
  rC Clang

https://reviews.llvm.org/D50050



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


[PATCH] D53928: Enable builtins necessary for SLEEF [AArch64] vectorized trigonometry libm functions

2018-11-05 Thread Stefan Teleman via Phabricator via cfe-commits
steleman updated this revision to Diff 172638.
steleman added a comment.

- changed the -fveclib= argument value to 'sleefgnuabi'.
- added atan2 and pow.
- spreadsheet with comparison between libm and sleef is here:

https://docs.google.com/spreadsheets/d/1lcpESCnuzEoTl_XHBqE9FLL0tXJB_tZGR8yciCx1yjg/edit?usp=sharing

- comprehensive test case in C with timings is here:

https://drive.google.com/open?id=1PGKRUdL29_ANoYebOo3Q59syhKp_mNSj


https://reviews.llvm.org/D53928

Files:
  include/clang/Basic/Builtins.def
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Frontend/CompilerInvocation.cpp

Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ include/clang/Frontend/CodeGenOptions.h
@@ -54,7 +54,8 @@
   enum VectorLibrary {
 NoLibrary,  // Don't use any vector library.
 Accelerate, // Use the Accelerate framework.
-SVML// Intel short vector math library.
+SVML,   // Intel short vector math library.
+SLEEFGNUABI // SLEEF - SIMD Library for Evaluating Elementary Functions.
   };
 
 
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1388,7 +1388,7 @@
   Group, Flags<[CC1Option]>,
   HelpText<"Disables an experimental new pass manager in LLVM.">;
 def fveclib : Joined<["-"], "fveclib=">, Group, Flags<[CC1Option]>,
-HelpText<"Use the given vector functions library">, Values<"Accelerate,SVML,none">;
+HelpText<"Use the given vector functions library">, Values<"Accelerate,SVML,sleefgnuabi,none">;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group,
   HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">, Flags<[CC1Option]>;
 def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group,
Index: include/clang/Basic/Builtins.def
===
--- include/clang/Basic/Builtins.def
+++ include/clang/Basic/Builtins.def
@@ -196,6 +196,9 @@
 BUILTIN(__builtin_exp2 , "dd"  , "Fne")
 BUILTIN(__builtin_exp2f, "ff"  , "Fne")
 BUILTIN(__builtin_exp2l, "LdLd", "Fne")
+BUILTIN(__builtin_exp10 , "dd"  , "Fne")
+BUILTIN(__builtin_exp10f, "ff"  , "Fne")
+BUILTIN(__builtin_exp10l, "LdLd", "Fne")
 BUILTIN(__builtin_expm1 , "dd", "Fne")
 BUILTIN(__builtin_expm1f, "ff", "Fne")
 BUILTIN(__builtin_expm1l, "LdLd", "Fne")
@@ -1133,6 +1136,10 @@
 LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
 
+LIBBUILTIN(exp10, "dd", "fne", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(exp10f, "ff", "fne", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(exp10l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
+
 LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
@@ -1370,10 +1377,6 @@
 LIBBUILTIN(__tanpi, "dd", "fne", "math.h", ALL_LANGUAGES)
 LIBBUILTIN(__tanpif, "ff", "fne", "math.h", ALL_LANGUAGES)
 
-// Similarly, __exp10 is OS X only
-LIBBUILTIN(__exp10, "dd", "fne", "math.h", ALL_LANGUAGES)
-LIBBUILTIN(__exp10f, "ff", "fne", "math.h", ALL_LANGUAGES)
-
 // Blocks runtime Builtin math library functions
 LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES)
 LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES)
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -558,6 +558,8 @@
   Opts.setVecLib(CodeGenOptions::Accelerate);
 else if (Name == "SVML")
   Opts.setVecLib(CodeGenOptions::SVML);
+else if (Name == "sleefgnuabi")
+  Opts.setVecLib(CodeGenOptions::SLEEFGNUABI);
 else if (Name == "none")
   Opts.setVecLib(CodeGenOptions::NoLibrary);
 else
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -344,6 +344,9 @@
   case CodeGenOptions::SVML:
 TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML);
 break;
+  case CodeGenOptions::SLEEFGNUABI:
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SLEEFGNUABI);
+break;
   default:
 break;
   }
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -1333,14 +1333,78 @@
 case Builtin::BI__builtin_copysignf128:
   return RValue::get(emitBinaryBuiltin(*this, E, Intrinsic::copysign));
 
+case Builtin::BIacos:
+case 

[PATCH] D50050: [AST] CastExpr: BasePathSize is not large enough.

2018-11-05 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added a comment.

@lebedev.ri @erichkeane The test fails for me on macOS whenever asan and ubsan 
are both enabled.
The failure is stack overflow at stack frame 943 (? maybe asan usage enforces 
lower stack size?)


Repository:
  rC Clang

https://reviews.llvm.org/D50050



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 172635.
ztamas added a comment.

- Add a range-based loop test case
- Restructure test cases a bit
- Fix-up comments, position, punctuation


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974

Files:
  clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tidy/bugprone/CMakeLists.txt
  clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
  clang-tidy/bugprone/TooSmallLoopVariableCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/bugprone-too-small-loop-variable.cpp

Index: test/clang-tidy/bugprone-too-small-loop-variable.cpp
===
--- /dev/null
+++ test/clang-tidy/bugprone-too-small-loop-variable.cpp
@@ -0,0 +1,227 @@
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t
+
+long size() { return 294967296l; }
+
+
+/// Test cases caught by bugprone-too-small-loop-variable.
+
+void voidBadForLoop() {
+  for (int i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop2() {
+  for (int i = 0; i < size() + 10; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop3() {
+  for (int i = 0; i <= size() - 1; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop4() {
+  for (int i = 0; size() > i; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop5() {
+  for (int i = 0; size() - 1 >= i; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop6() {
+  int i = 0;
+  for (; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidForLoopUnsignedCond() {
+  unsigned size = 3147483647;
+  for (int i = 0; i < size; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'unsigned int' [bugprone-too-small-loop-variable]
+  }
+}
+
+// Loop's terminating condition has a template dependent value.
+template 
+void doSomething() {
+  for (short i = 0; i < size; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+// Loop's terminating condition has a template dependent type.
+template 
+void doSomething() {
+  for (T i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: loop variable has narrower type 'short' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidForLoopInstantiation() {
+  // This line does not trigger the warning.
+  doSomething();
+  // This one triggers the warning.
+  doSomething();
+}
+
+
+/// Test cases where we should not warn.
+
+// A simple use case when both expressions have the same type.
+void voidGoodForLoop() {
+  for (long i = 0; i < size(); ++i) { // no warning
+  }
+}
+
+// Other use case where both expressions have the same type,
+// but short expressions are converted to int by the compare operator.
+void voidGoodForLoop2() {
+  short loopCond = 10;
+  for (short i = 0; i < loopCond; ++i) { // no warning
+  }
+}
+
+// Because of the integer literal, the loop condition is int, but we suppress the warning here.
+void voidForLoopShortPlusLiteral() {
+  short size = 3;
+  for (short i = 0; i <= (size - 1); ++i) { // no warning
+  }
+}
+
+// Addition of two short variables results in an int value, but we suppress this to avoid false positives.
+void voidForLoopShortPlusShort() {
+  short size = 256;
+  short increment = 14;
+  for (short i = 0; i < size + increment; ++i) { // no warning
+  }
+}
+
+// In this test case we have different integer types, but here the loop variable has the bigger type.
+// The terminating condition is cast implicitly, not the loop variable.
+void voidForLoopCondImplicitCast() {
+  short start = 256;
+  short end = 14;
+  for (int i = start; i >= end; --i) { // no warning
+  }
+}
+
+// Range based loop and other iterator based loops are ignored by this check.
+void voidRangeBasedForLoop() {
+  int array[] = 

[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added inline comments.



Comment at: include/clang/Basic/BuiltinsARM.def:270
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+

rnk wrote:
> Given how much duplication there is, I think we need to have some kind of 
> BuiltinsMSVC.def that contains a list of all the interlocked builitin 
> families, like this:
> ```
> INTERLOCKED_BUILTIN(_InterlockedCompareExchange)
> INTERLOCKED_BUILTIN(_InterlockedOr)
> INTERLOCKED_BUILTIN(_InterlockedAnd)
> ```
> We'd include this file here, with INTERLOCKED_BUILTIN defined as:
> ```
> #define INTERLOCKED_BUILTIN(Op) \
>   TARGET_HEADER_BUILTIN(Op##8_acq, "ccD*cc", "nh", "intrin.h", 
> ALL_MS_LANGUAGES, "") \
>   TARGET_HEADER_BUILTIN(Op##8_nf, "ccD*cc", "nh", "intrin.h", 
> ALL_MS_LANGUAGES, "") \
> ...
> ```
> That'll stamp out the enums that we need, and then we can reuse the .def file 
> to reduce duplication in the switch/case below.
> 
> Every op is basically 16 operations: {8, 16, 32, 64} X {seq_cst, rel, acq, nf}
> 
> I'm not sure what to do about the ones that overlap with x86.
Thanks Reid. Yes, I think we can certainly cleanup further. That being said, 
can we get these patches committed first and then cleanup in a follow-up patch?


Repository:
  rC Clang

https://reviews.llvm.org/D54062



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added inline comments.



Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:142
+  if (LoopVar->getType() != LoopIncrement->getType())
+return; // We matched the loop variable incorrectly
+

JonasToth wrote:
> Does this try to ensure a precondition? Then it should become an assertion 
> instead.
> Please adjust the comment like above (punctuation, position)
It's not an assumed precondition. This `if` handles the case when 
LoopVarMatcher is not fitted with the actual loop variable. That's why the 
IncrementMatcher is there so we can check whether we found the loop variable.
See voidForLoopReverseCond() test case which hits this `if` branch.
I did not find a solution to handle this check inside the matcher.



Comment at: docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst:10
+
+  .. code-block:: c++
+

JonasToth wrote:
> the `.. code-block:: c++` is usually not indended, only the code itself.
Hmm, I copied this from somewhere. It might be a good idea to make this 
consistent across all the *.rst files. See bugprone-suspicious-semicolon.rst or 
bugprone-use-after-move.rst for example.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-05 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added inline comments.



Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:45
+
+  // We need to catch only those comparisons which contain any integer cast
+  StatementMatcher LoopVarConversionMatcher =

JonasToth wrote:
> missing full stop.
Sorry, I forgot the punctuation what you've already mentioned.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D54013: [analyzer] NFC: MallocChecker: Avoid redundant transitions.

2018-11-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2369
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();

Szelethus wrote:
> george.karpenkov wrote:
> > Szelethus wrote:
> > > We are acquiring an object of type `ImmutableMap`, modify it, and put it 
> > > back into `state`? Can't we just modify it through `ProgramState`'s 
> > > interface directly?
> > state is immutable, I don't think we can put anything into it.
> > We also can't modify ImmutableMap because, well, it's immutable.
> Poor choice of words, I admit. What I actually meant is that maybe it would 
> be more straighforward if we didnt create a local varable here. But I'm fine 
> with being in the wrong :)
Manipulating maps directly is slightly cheaper because for every operation you 
only create a new map but not a new state. I have no indication that this 
optimization is worth the effort, but i also have no indication that 
pessimizing it back is worth the effort.


https://reviews.llvm.org/D54013



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


[PATCH] D54013: [analyzer] MallocChecker: Avoid redundant transitions.

2018-11-05 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 172629.
NoQ added a comment.

Re-upload with context. Whoops.


https://reviews.llvm.org/D54013

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp


Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2366,20 +2366,23 @@
  CheckerContext ) const
 {
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();
 
+  RegionStateTy RS = OldRS;
   SmallVector Errors;
   for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
 if (SymReaper.isDead(I->first)) {
   if (I->second.isAllocated() || I->second.isAllocatedOfSizeZero())
 Errors.push_back(I->first);
   // Remove the dead symbol from the map.
   RS = F.remove(RS, I->first);
-
 }
   }
 
+  if (RS == OldRS)
+return;
+
   // Cleanup the Realloc Pairs Map.
   ReallocPairsTy RP = state->get();
   for (ReallocPairsTy::iterator I = RP.begin(), E = RP.end(); I != E; ++I) {


Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2366,20 +2366,23 @@
  CheckerContext ) const
 {
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();
 
+  RegionStateTy RS = OldRS;
   SmallVector Errors;
   for (RegionStateTy::iterator I = RS.begin(), E = RS.end(); I != E; ++I) {
 if (SymReaper.isDead(I->first)) {
   if (I->second.isAllocated() || I->second.isAllocatedOfSizeZero())
 Errors.push_back(I->first);
   // Remove the dead symbol from the map.
   RS = F.remove(RS, I->first);
-
 }
   }
 
+  if (RS == OldRS)
+return;
+
   // Cleanup the Realloc Pairs Map.
   ReallocPairsTy RP = state->get();
   for (ReallocPairsTy::iterator I = RP.begin(), E = RP.end(); I != E; ++I) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

2018-11-05 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: include/clang/Basic/BuiltinsARM.def:270
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", 
"nh", "intrin.h", ALL_MS_LANGUAGES, "")
+

Given how much duplication there is, I think we need to have some kind of 
BuiltinsMSVC.def that contains a list of all the interlocked builitin families, 
like this:
```
INTERLOCKED_BUILTIN(_InterlockedCompareExchange)
INTERLOCKED_BUILTIN(_InterlockedOr)
INTERLOCKED_BUILTIN(_InterlockedAnd)
```
We'd include this file here, with INTERLOCKED_BUILTIN defined as:
```
#define INTERLOCKED_BUILTIN(Op) \
  TARGET_HEADER_BUILTIN(Op##8_acq, "ccD*cc", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "") \
  TARGET_HEADER_BUILTIN(Op##8_nf, "ccD*cc", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"") \
...
```
That'll stamp out the enums that we need, and then we can reuse the .def file 
to reduce duplication in the switch/case below.

Every op is basically 16 operations: {8, 16, 32, 64} X {seq_cst, rel, acq, nf}

I'm not sure what to do about the ones that overlap with x86.


Repository:
  rC Clang

https://reviews.llvm.org/D54062



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


[PATCH] D52790: [analyzer][PlistMacroExpansion] New flag to convert macro expansions to events

2018-11-05 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

In https://reviews.llvm.org/D52790#1285039, @NoQ wrote:

> Looks great, let's land?


I'll probably land it after part 5, in order to ease on rebasing.

> Not sure if i already asked - am i understanding correctly that this is a 
> "poor-man's" support for macro expansions for tools that read plists but do 
> not support those new plist macro dictionaries yet?

Correct, same as `notes-as-events`.

> I wonder how expansions of huge macros will look as events.

Quite funny, actually :D Think about assert, it's quite a mouthful. I'll post 
screenshots when I have more time.


https://reviews.llvm.org/D52790



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


Re: r345591 - [CodeGen] Disable the machine verifier on a ThinLTO test

2018-11-05 Thread David Blaikie via cfe-commits
If ThinLTO doesn't pass the machine verifier - should it maybe be turned
off at the thinlto level in general, rather than for this specific test?

On Tue, Oct 30, 2018 at 5:20 AM Francis Visoiu Mistrih via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: thegameg
> Date: Tue Oct 30 05:18:33 2018
> New Revision: 345591
>
> URL: http://llvm.org/viewvc/llvm-project?rev=345591=rev
> Log:
> [CodeGen] Disable the machine verifier on a ThinLTO test
>
> This allows us to turn the machine verifier on by default on X86.
>
> Modified:
> cfe/trunk/test/CodeGen/thinlto-distributed-cfi-devirt.ll
>
> Modified: cfe/trunk/test/CodeGen/thinlto-distributed-cfi-devirt.ll
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-distributed-cfi-devirt.ll?rev=345591=345590=345591=diff
>
> ==
> --- cfe/trunk/test/CodeGen/thinlto-distributed-cfi-devirt.ll (original)
> +++ cfe/trunk/test/CodeGen/thinlto-distributed-cfi-devirt.ll Tue Oct 30
> 05:18:33 2018
> @@ -6,7 +6,9 @@
>
>  ; RUN: opt -thinlto-bc -o %t.o %s
>
> +; FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0.
> PR39436.
>  ; RUN: llvm-lto2 run -thinlto-distributed-indexes %t.o \
> +; RUN:   -verify-machineinstrs=0 \
>  ; RUN:   -o %t2.index \
>  ; RUN:   -r=%t.o,test,px \
>  ; RUN:   -r=%t.o,_ZN1A1nEi,p \
>
>
> ___
> 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: r345695 - Change "struct" to "class" to avoid warnings

2018-11-05 Thread David Blaikie via cfe-commits
Could you link to/quote the warnings - might be helpful to understanding
what's being addressed here

On Tue, Oct 30, 2018 at 10:00 PM Bill Wendling via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: void
> Date: Tue Oct 30 21:58:34 2018
> New Revision: 345695
>
> URL: http://llvm.org/viewvc/llvm-project?rev=345695=rev
> Log:
> Change "struct" to "class" to avoid warnings
>
> Modified:
> cfe/trunk/include/clang/AST/Expr.h
>
> Modified: cfe/trunk/include/clang/AST/Expr.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=345695=345694=345695=diff
>
> ==
> --- cfe/trunk/include/clang/AST/Expr.h (original)
> +++ cfe/trunk/include/clang/AST/Expr.h Tue Oct 30 21:58:34 2018
> @@ -900,7 +900,8 @@ public:
>  };
>
>  /// ConstantExpr - An expression that occurs in a constant context.
> -struct ConstantExpr : public FullExpr {
> +class ConstantExpr : public FullExpr {
> +public:
>ConstantExpr(Expr *subexpr)
>  : FullExpr(ConstantExprClass, subexpr) {}
>
>
>
> ___
> 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] D54013: [analyzer] MallocChecker: Avoid redundant transitions.

2018-11-05 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2369
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();

george.karpenkov wrote:
> Szelethus wrote:
> > We are acquiring an object of type `ImmutableMap`, modify it, and put it 
> > back into `state`? Can't we just modify it through `ProgramState`'s 
> > interface directly?
> state is immutable, I don't think we can put anything into it.
> We also can't modify ImmutableMap because, well, it's immutable.
Poor choice of words, I admit. What I actually meant is that maybe it would be 
more straighforward if we didnt create a local varable here. But I'm fine with 
being in the wrong :)


Repository:
  rC Clang

https://reviews.llvm.org/D54013



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


[PATCH] D54013: [analyzer] MallocChecker: Avoid redundant transitions.

2018-11-05 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2369
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();

Szelethus wrote:
> We are acquiring an object of type `ImmutableMap`, modify it, and put it back 
> into `state`? Can't we just modify it through `ProgramState`'s interface 
> directly?
state is immutable, I don't think we can put anything into it.
We also can't modify ImmutableMap because, well, it's immutable.


Repository:
  rC Clang

https://reviews.llvm.org/D54013



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


[PATCH] D53457: clang-cl: Add "/clang:" pass-through arg support.

2018-11-05 Thread Neeraj K. Singh via Phabricator via cfe-commits
neerajksingh updated this revision to Diff 172615.
neerajksingh added a comment.

Make it clear in the documentation that the /clang flags are added to the end.


https://reviews.llvm.org/D53457

Files:
  docs/UsersManual.rst
  include/clang/Driver/CLCompatOptions.td
  include/clang/Driver/Driver.h
  lib/Driver/Driver.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -614,5 +614,17 @@
 // RUN: --version \
 // RUN: -Werror /Zs -- %s 2>&1
 
+// Accept clang options under the /clang: flag.
+
+// RUN: %clang_cl -O2 -### -- %s 2>&1 | FileCheck -check-prefix=NOCLANG %s
+// NOCLANG: "--dependent-lib=libcmt"
+// NOCLANG-SAME: "-vectorize-slp"
+// NOCLANG-NOT: "--dependent-lib=msvcrt"
+
+// RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep -### -- %s 2>&1 | FileCheck -check-prefix=CLANG %s
+// CLANG: "--dependent-lib=msvcrt"
+// CLANG-SAME: "-dependency-file" "my_dependency_file.dep"
+// CLANG-NOT: "--dependent-lib=libcmt"
+// CLANG-NOT: "-vectorize-slp"
 
 void f() { }
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -166,14 +166,15 @@
 }
 
 InputArgList Driver::ParseArgStrings(ArrayRef ArgStrings,
+ bool IsClCompatMode,
  bool ) {
   llvm::PrettyStackTraceString CrashInfo("Command line argument parsing");
   ContainsError = false;
 
   unsigned IncludedFlagsBitmask;
   unsigned ExcludedFlagsBitmask;
   std::tie(IncludedFlagsBitmask, ExcludedFlagsBitmask) =
-  getIncludeExcludeOptionFlagMasks();
+  getIncludeExcludeOptionFlagMasks(IsClCompatMode);
 
   unsigned MissingArgIndex, MissingArgCount;
   InputArgList Args =
@@ -730,7 +731,7 @@
   ConfigFile = CfgFileName.str();
   bool ContainErrors;
   CfgOptions = llvm::make_unique(
-  ParseArgStrings(NewCfgArgs, ContainErrors));
+  ParseArgStrings(NewCfgArgs, IsCLMode(), ContainErrors));
   if (ContainErrors) {
 CfgOptions.reset();
 return true;
@@ -924,7 +925,7 @@
   // Arguments specified in command line.
   bool ContainsError;
   CLOptions = llvm::make_unique(
-  ParseArgStrings(ArgList.slice(1), ContainsError));
+  ParseArgStrings(ArgList.slice(1), IsCLMode(), ContainsError));
 
   // Try parsing configuration file.
   if (!ContainsError)
@@ -934,21 +935,47 @@
   // All arguments, from both config file and command line.
   InputArgList Args = std::move(HasConfigFile ? std::move(*CfgOptions)
   : std::move(*CLOptions));
-  if (HasConfigFile)
-for (auto *Opt : *CLOptions) {
-  if (Opt->getOption().matches(options::OPT_config))
-continue;
+
+  auto appendOneArg = [](const Arg *Opt, const Arg *BaseArg) {
   unsigned Index = Args.MakeIndex(Opt->getSpelling());
-  const Arg *BaseArg = >getBaseArg();
-  if (BaseArg == Opt)
-BaseArg = nullptr;
   Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Opt->getSpelling(),
  Index, BaseArg);
   Copy->getValues() = Opt->getValues();
   if (Opt->isClaimed())
 Copy->claim();
   Args.append(Copy);
+  };
+
+  if (HasConfigFile)
+for (auto *Opt : *CLOptions) {
+  if (Opt->getOption().matches(options::OPT_config))
+continue;
+  const Arg *BaseArg = >getBaseArg();
+  if (BaseArg == Opt)
+BaseArg = nullptr;
+  appendOneArg(Opt, BaseArg);
+}
+
+  // In CL mode, look for any pass-through arguments
+  if (IsCLMode() && !ContainsError) {
+SmallVector CLModePassThroughArgList;
+for (const auto *A : Args.filtered(options::OPT__SLASH_clang)) {
+  A->claim();
+  CLModePassThroughArgList.push_back(A->getValue());
+}
+
+if (!CLModePassThroughArgList.empty()) {
+  // Parse any pass through args using default clang processing rather
+  // than clang-cl processing.
+  auto CLModePassThroughOptions = llvm::make_unique(
+  ParseArgStrings(CLModePassThroughArgList, false, ContainsError));
+
+  if (!ContainsError)
+for (auto *Opt : *CLModePassThroughOptions) {
+  appendOneArg(Opt, nullptr);
+}
 }
+  }
 
   // FIXME: This stuff needs to go into the Compilation, not the driver.
   bool CCCPrintPhases;
@@ -1452,7 +1479,7 @@
   unsigned IncludedFlagsBitmask;
   unsigned ExcludedFlagsBitmask;
   std::tie(IncludedFlagsBitmask, ExcludedFlagsBitmask) =
-  getIncludeExcludeOptionFlagMasks();
+  getIncludeExcludeOptionFlagMasks(IsCLMode());
 
   ExcludedFlagsBitmask |= options::NoDriverOption;
   if (!ShowHidden)
@@ -4661,11 +4688,11 @@
   return false;
 }
 
-std::pair Driver::getIncludeExcludeOptionFlagMasks() const {
+std::pair Driver::getIncludeExcludeOptionFlagMasks(bool IsClCompatMode) const {
   

Re: [PATCH] D53919: [X86] Don't allow illegal vector types to return by direct value on x86-64.

2018-11-05 Thread Eric Christopher via cfe-commits
On Mon, Nov 5, 2018 at 9:45 AM H.J Lu via Phabricator <
revi...@reviews.llvm.org> wrote:

> hjl.tools added a comment.
>
> In https://reviews.llvm.org/D53919#1287510, @echristo wrote:
>
> > In https://reviews.llvm.org/D53919#1282994, @hjl.tools wrote:
> >
> > > In https://reviews.llvm.org/D53919#1282952, @efriedma wrote:
> > >
> > > > With both 3.3 and trunk (I don't have a 7.0 handy; I can build it if
> it would be helpful):
> > >
> > >
> > > Please try clang 2.6 on both testcases.
> >
> >
> > From the releases:
> >
> > 23 Oct 2009   2.6
> >
> > ... why would you care about a 9 year old version of clang?
>
>
> It is about ABI consistency.  When AVX isn't enabled, the old and
> compilers should
> use the same calling convention.
>

Seems like 3.3 to present should be sufficient.

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


[PATCH] D52296: [Clang] - Add -gsingle-file-split-dwarf option.

2018-11-05 Thread Eric Christopher via Phabricator via cfe-commits
echristo added a comment.

In https://reviews.llvm.org/D52296#1285328, @grimar wrote:

> In https://reviews.llvm.org/D52296#1284130, @probinson wrote:
>
> > In https://reviews.llvm.org/D52296#1283691, @grimar wrote:
> >
> > > Nice :) 
> > >  So seems the last unresolved question left is the naming of the new 
> > > option?
> > >  If we do not want to go with `-gsingle-file-split-dwarf` then what it 
> > > should be?
> > >
> > > What about `-fdebug-fission` as an alias for `-gsplit-dwarf`.
> > >  And `-fsingle-file-debug-fission` for the new option?
> > >
> > > Or, may be:
> > >
> > > `-fdebug-fission` for the new option and then
> > >  `-fdebug-fission -fdebug-split-dwo` would work together as 
> > > `-gsplit-dwarf`?
> >
> >
> > Only DWARF supports this, correct?
>
>
> I am not aware of any kind of debug information splitting except DWARF 
> splitting.
>
> > So I would suggest: `-fdwarf-fission[={split,single}]` where the parameter 
> > defaults to `split`. Is there any particular value in having two separate 
> > options?
>
> Probably not. `-fdwarf-fission[={split,single}]` sounds good for me.


Still not sure I understand the point, but this option and the alias sounds 
good to me.

Thanks.

-eric


https://reviews.llvm.org/D52296



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


[PATCH] D53919: [X86] Don't allow illegal vector types to return by direct value on x86-64.

2018-11-05 Thread H.J Lu via Phabricator via cfe-commits
hjl.tools added a comment.

In https://reviews.llvm.org/D53919#1287510, @echristo wrote:

> In https://reviews.llvm.org/D53919#1282994, @hjl.tools wrote:
>
> > In https://reviews.llvm.org/D53919#1282952, @efriedma wrote:
> >
> > > With both 3.3 and trunk (I don't have a 7.0 handy; I can build it if it 
> > > would be helpful):
> >
> >
> > Please try clang 2.6 on both testcases.
>
>
> From the releases:
>
> 23 Oct 2009   2.6
>
> ... why would you care about a 9 year old version of clang?


It is about ABI consistency.  When AVX isn't enabled, the old and compilers 
should
use the same calling convention.


Repository:
  rC Clang

https://reviews.llvm.org/D53919



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


[PATCH] D53919: [X86] Don't allow illegal vector types to return by direct value on x86-64.

2018-11-05 Thread Eric Christopher via Phabricator via cfe-commits
echristo added a comment.

In https://reviews.llvm.org/D53919#1282994, @hjl.tools wrote:

> In https://reviews.llvm.org/D53919#1282952, @efriedma wrote:
>
> > With both 3.3 and trunk (I don't have a 7.0 handy; I can build it if it 
> > would be helpful):
>
>
> Please try clang 2.6 on both testcases.


From the releases:

23 Oct 2009 2.6

... why would you care about a 9 year old version of clang?


Repository:
  rC Clang

https://reviews.llvm.org/D53919



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


[PATCH] D53212: inhereit LLVM_ENABLE_LIBXML2

2018-11-05 Thread Brian Gesiak via Phabricator via cfe-commits
modocache accepted this revision.
modocache added a comment.
This revision is now accepted and ready to land.

Sorry to have let this languish! LGTM.


Repository:
  rC Clang

https://reviews.llvm.org/D53212



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


[PATCH] D54048: [AST] Get aliased type info from an aliased TemplateSpecialization.

2018-11-05 Thread Matt Davis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346146: [AST] Get aliased type info from an aliased 
TemplateSpecialization. (authored by mattd, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D54048

Files:
  include/clang/AST/Type.h
  test/SemaCXX/alignof.cpp


Index: include/clang/AST/Type.h
===
--- include/clang/AST/Type.h
+++ include/clang/AST/Type.h
@@ -4901,7 +4901,9 @@
 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
   }
 
-  QualType desugar() const { return getCanonicalTypeInternal(); }
+  QualType desugar() const {
+return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
+  }
 
   void Profile(llvm::FoldingSetNodeID , const ASTContext ) {
 Profile(ID, Template, template_arguments(), Ctx);
Index: test/SemaCXX/alignof.cpp
===
--- test/SemaCXX/alignof.cpp
+++ test/SemaCXX/alignof.cpp
@@ -97,3 +97,8 @@
   typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error 
{{requested alignment is dependent but declaration is not dependent}}
 };
 }
+
+typedef int __attribute__((aligned(16))) aligned_int;
+template 
+using template_alias = aligned_int;
+static_assert(alignof(template_alias) == 16, "Expected alignment of 16" 
);


Index: include/clang/AST/Type.h
===
--- include/clang/AST/Type.h
+++ include/clang/AST/Type.h
@@ -4901,7 +4901,9 @@
 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
   }
 
-  QualType desugar() const { return getCanonicalTypeInternal(); }
+  QualType desugar() const {
+return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
+  }
 
   void Profile(llvm::FoldingSetNodeID , const ASTContext ) {
 Profile(ID, Template, template_arguments(), Ctx);
Index: test/SemaCXX/alignof.cpp
===
--- test/SemaCXX/alignof.cpp
+++ test/SemaCXX/alignof.cpp
@@ -97,3 +97,8 @@
   typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error {{requested alignment is dependent but declaration is not dependent}}
 };
 }
+
+typedef int __attribute__((aligned(16))) aligned_int;
+template 
+using template_alias = aligned_int;
+static_assert(alignof(template_alias) == 16, "Expected alignment of 16" );
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r346146 - [AST] Get aliased type info from an aliased TemplateSpecialization.

2018-11-05 Thread Matt Davis via cfe-commits
Author: mattd
Date: Mon Nov  5 09:25:26 2018
New Revision: 346146

URL: http://llvm.org/viewvc/llvm-project?rev=346146=rev
Log:
[AST] Get aliased type info from an aliased TemplateSpecialization.

Summary:
Previously the TemplateSpecialization instance for 'template_alias', in the 
example below, returned the type info of the  canonical type (int).  This 
ignored the type alias if the template type happen to be aliased. 

Before this patch, the assert would trigger with an  alignment of 4:
```
typedef int __attribute__(( aligned( 16 ) )) aligned_int;
template < typename >
using template_alias = aligned_int;
static_assert( alignof( template_alias) == 16, "" );
```

This patch checks if the TemplateSpecialization type has an alias, and if so 
will return the type information for the aliased type, else the canonical 
type's info is returned (original behavior).  I believe that this is the 
desired behavior.  

Reviewers: aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D54048

Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/test/SemaCXX/alignof.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=346146=346145=346146=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Nov  5 09:25:26 2018
@@ -4901,7 +4901,9 @@ public:
 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
   }
 
-  QualType desugar() const { return getCanonicalTypeInternal(); }
+  QualType desugar() const {
+return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
+  }
 
   void Profile(llvm::FoldingSetNodeID , const ASTContext ) {
 Profile(ID, Template, template_arguments(), Ctx);

Modified: cfe/trunk/test/SemaCXX/alignof.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/alignof.cpp?rev=346146=346145=346146=diff
==
--- cfe/trunk/test/SemaCXX/alignof.cpp (original)
+++ cfe/trunk/test/SemaCXX/alignof.cpp Mon Nov  5 09:25:26 2018
@@ -97,3 +97,8 @@ struct S {
   typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error 
{{requested alignment is dependent but declaration is not dependent}}
 };
 }
+
+typedef int __attribute__((aligned(16))) aligned_int;
+template 
+using template_alias = aligned_int;
+static_assert(alignof(template_alias) == 16, "Expected alignment of 16" 
);


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


[PATCH] D54111: [clang-format] Do not threat the asm clobber [ as ObjCExpr

2018-11-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision.
benhamilton added a comment.
This revision is now accepted and ready to land.

In the diff description, please fix the typo: `Do not threat the asm clobber` 
-> `Do not treat the asm clobber`




Comment at: unittests/Format/FormatTest.cpp:12756-12763
+TEST_F(FormatTest, GuessedLanguageWithInlineAsmClobbers) {
+  EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h",
+   "void f() {\n"
+   "  asm (\"mov %[e], %[d]\"\n"
+   " : [d] \"=rm\" (d)\n"
+   "   [e] \"rm\" (*e));\n"
+   "}"));

Worth a second test with `asm volatile (...)` ?



Repository:
  rC Clang

https://reviews.llvm.org/D54111



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


[PATCH] D54112: [Driver] Delete redundant -Bdynamic for libc++ on Fuchsia

2018-11-05 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

I'm unclear if you also want as-needed `-lm` or if you accept static `-lm`


Repository:
  rC Clang

https://reviews.llvm.org/D54112



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


[PATCH] D54013: [analyzer] MallocChecker: Avoid redundant transitions.

2018-11-05 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

Please reupload with full context.




Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2369
   ProgramStateRef state = C.getState();
-  RegionStateTy RS = state->get();
+  RegionStateTy OldRS = state->get();
   RegionStateTy::Factory  = state->get_context();

We are acquiring an object of type `ImmutableMap`, modify it, and put it back 
into `state`? Can't we just modify it through `ProgramState`'s interface 
directly?


Repository:
  rC Clang

https://reviews.llvm.org/D54013



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


[PATCH] D53223: AMDGPU: Add sram-ecc feature options

2018-11-05 Thread Tony Tye via Phabricator via cfe-commits
t-tye accepted this revision.
t-tye added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D53223



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


[PATCH] D54112: [Driver] Delete redundant -Bdynamic for libc++ on Fuchsia

2018-11-05 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay created this revision.
MaskRay added reviewers: phosek, EricWF, mcgrathr.
Herald added a subscriber: cfe-commits.

The surrounding --push-state saves the "-Bdynamic" state across ld.bfd, gold 
and lld.
lld saves the least states, but the intersection of these linkers is 
--as-needed -Bdynamic --whole-archive

ld/ldlang.h: lang_input_statement_flags::dynamic
gold/options.h: Position_dependent_options::copy_from_options
lld/ELF/Driver.cpp: Stack.emplace_back(Config->AsNeeded, Config->Static, 
InWholeArchive);


Repository:
  rC Clang

https://reviews.llvm.org/D54112

Files:
  lib/Driver/ToolChains/Fuchsia.cpp
  test/Driver/fuchsia.cpp


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -39,7 +39,6 @@
 // CHECK-STATIC: "--as-needed"
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
-// CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
Index: lib/Driver/ToolChains/Fuchsia.cpp
===
--- lib/Driver/ToolChains/Fuchsia.cpp
+++ lib/Driver/ToolChains/Fuchsia.cpp
@@ -127,8 +127,6 @@
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bdynamic");
 CmdArgs.push_back("-lm");
 CmdArgs.push_back("--pop-state");
   }


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -39,7 +39,6 @@
 // CHECK-STATIC: "--as-needed"
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
-// CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
Index: lib/Driver/ToolChains/Fuchsia.cpp
===
--- lib/Driver/ToolChains/Fuchsia.cpp
+++ lib/Driver/ToolChains/Fuchsia.cpp
@@ -127,8 +127,6 @@
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bdynamic");
 CmdArgs.push_back("-lm");
 CmdArgs.push_back("--pop-state");
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >