Re: [PATCH] D10305: [Clang Static Analyzer] Bug identification

2015-09-21 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

Even if the analzyer no longer generates new hashes it should be easy to 
maintain old hash algorithms out of tree.


http://reviews.llvm.org/D10305



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


[PATCH] D13004: Create a new attribute set when the definition is parsed after a declaration of a function

2015-09-21 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.

An assert is triggered when the test case program is compiled with -Oz:

Assertion failed: (!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) && 
"OptimizeNone and OptimizeForSize on same function!"), function 
SetLLVMFunctionAttributesForDefinition, file 
/Users/ahatanaka/projects/llvm/git/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp,
 line 831.

This patch fixes the assert by clearing the attribute set attached to IR 
function foo1 and creating it again when the function's definition is parsed.

http://reviews.llvm.org/D13004

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGen/attr-func-def.c

Index: test/CodeGen/attr-func-def.c
===
--- /dev/null
+++ test/CodeGen/attr-func-def.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o - %s | 
FileCheck %s
+
+// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
+// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
+
+int foo1(int);
+
+int foo2(int a) {
+  return foo1(a + 2);
+}
+
+__attribute__((optnone))
+int foo1(int a) {
+return a + 1;
+}
+
+// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
+// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2643,6 +2643,11 @@
 
   maybeSetTrivialComdat(*D, *Fn);
 
+  // Create the attribute set of the function definition because it might 
differ
+  // from that of the function declaration. SetLLVMFunctionAttributes cannot be
+  // called after GenerateCode is called as it might remove the parameter
+  // attributes attached by GenerateCode.
+  SetLLVMFunctionAttributes(D, FI, Fn);
   CodeGenFunction(*this).GenerateCode(D, Fn, FI);
 
   setFunctionDefinitionAttributes(D, Fn);


Index: test/CodeGen/attr-func-def.c
===
--- /dev/null
+++ test/CodeGen/attr-func-def.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o - %s | FileCheck %s
+
+// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
+// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
+
+int foo1(int);
+
+int foo2(int a) {
+  return foo1(a + 2);
+}
+
+__attribute__((optnone))
+int foo1(int a) {
+return a + 1;
+}
+
+// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
+// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2643,6 +2643,11 @@
 
   maybeSetTrivialComdat(*D, *Fn);
 
+  // Create the attribute set of the function definition because it might differ
+  // from that of the function declaration. SetLLVMFunctionAttributes cannot be
+  // called after GenerateCode is called as it might remove the parameter
+  // attributes attached by GenerateCode.
+  SetLLVMFunctionAttributes(D, FI, Fn);
   CodeGenFunction(*this).GenerateCode(D, Fn, FI);
 
   setFunctionDefinitionAttributes(D, Fn);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r248144 - Refactor LoopConvertCheck.

2015-09-21 Thread Angel Garcia Gomez via cfe-commits
Author: angelgarcia
Date: Mon Sep 21 04:32:59 2015
New Revision: 248144

URL: http://llvm.org/viewvc/llvm-project?rev=248144&view=rev
Log:
Refactor LoopConvertCheck.

Summary: Reorder the code in a more logical and understandable way.

Reviewers: klimek

Subscribers: cfe-commits, alexfh

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

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.h
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=248144&r1=248143&r2=248144&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Mon Sep 
21 04:32:59 2015
@@ -396,6 +396,10 @@ static bool containerIsConst(const Expr
   return false;
 }
 
+LoopConvertCheck::RangeDescriptor::RangeDescriptor()
+: ContainerNeedsDereference(false), DerefByConstRef(false),
+  DerefByValue(false), IsTriviallyCopyable(false) {}
+
 LoopConvertCheck::LoopConvertCheck(StringRef Name, ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context), TUInfo(new TUTrackingInfo),
   MinConfidence(StringSwitch(
@@ -409,19 +413,25 @@ void LoopConvertCheck::storeOptions(Clan
   Options.store(Opts, "MinConfidence", Confs[static_cast(MinConfidence)]);
 }
 
+void LoopConvertCheck::registerMatchers(MatchFinder *Finder) {
+  // Only register the matchers for C++. Because this checker is used for
+  // modernization, it is reasonable to run it on any C++ standard with the
+  // assumption the user is trying to modernize their codebase.
+  if (!getLangOpts().CPlusPlus)
+return;
+
+  Finder->addMatcher(makeArrayLoopMatcher(), this);
+  Finder->addMatcher(makeIteratorLoopMatcher(), this);
+  Finder->addMatcher(makePseudoArrayLoopMatcher(), this);
+}
+
 /// \brief Computes the changes needed to convert a given for loop, and
-/// applies it.
+/// applies them.
 void LoopConvertCheck::doConversion(
 ASTContext *Context, const VarDecl *IndexVar, const VarDecl 
*MaybeContainer,
-StringRef ContainerString, const UsageResult &Usages,
-const DeclStmt *AliasDecl, bool AliasUseRequired, bool AliasFromForInit,
-const ForStmt *TheLoop, RangeDescriptor Descriptor) {
-  // If there aren't any usages, converting the loop would generate an unused
-  // variable warning.
-  if (Usages.size() == 0)
-return;
-
-  auto Diag = diag(TheLoop->getForLoc(), "use range-based for loop instead");
+const UsageResult &Usages, const DeclStmt *AliasDecl, bool 
AliasUseRequired,
+bool AliasFromForInit, const ForStmt *Loop, RangeDescriptor Descriptor) {
+  auto Diag = diag(Loop->getForLoc(), "use range-based for loop instead");
 
   std::string VarName;
   bool VarNameFromAlias = (Usages.size() == 1) && AliasDecl;
@@ -452,7 +462,7 @@ void LoopConvertCheck::doConversion(
   } else {
 VariableNamer Namer(&TUInfo->getGeneratedDecls(),
 &TUInfo->getParentFinder().getStmtToParentStmtMap(),
-TheLoop, IndexVar, MaybeContainer, Context);
+Loop, IndexVar, MaybeContainer, Context);
 VarName = Namer.createIndexName();
 // First, replace all usages of the array subscript expression with our new
 // variable.
@@ -470,70 +480,46 @@ void LoopConvertCheck::doConversion(
 ReplaceText =
 Usage.Kind == Usage::UK_CaptureByCopy ? "&" + VarName : VarName;
   }
-  TUInfo->getReplacedVars().insert(std::make_pair(TheLoop, IndexVar));
+  TUInfo->getReplacedVars().insert(std::make_pair(Loop, IndexVar));
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(Usage.Range), ReplaceText);
 }
   }
 
   // Now, we need to construct the new range expression.
-  SourceRange ParenRange(TheLoop->getLParenLoc(), TheLoop->getRParenLoc());
+  SourceRange ParenRange(Loop->getLParenLoc(), Loop->getRParenLoc());
 
-  QualType AutoRefType = Context->getAutoDeductType();
+  QualType AutoType = Context->getAutoDeductType();
 
   // If the new variable name is from the aliased variable, then the reference
   // type for the new variable should only be used if the aliased variable was
   // declared as a reference.
   if (!VarNameFromAlias || AliasVarIsRef) {
-// If an iterator's operator*() returns a 'T&' we can bind that to 'auto&'.
-// If operator*() returns 'T' we can bind that to 'auto&&' which will 
deduce
-// to 'T&&&'.
-if (Descriptor.DerefByValue) {
+if (Descriptor.DerefByConstRef) {
+  AutoType =
+  Context->getLValueReferenceType(Context->getConstType(AutoType));
+} else if (Descriptor.DerefByValue) {
   i

[PATCH] D13006: Replace references to "transform" with references to "check" where neccessary in the documentation.

2015-09-21 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: alexfh.
angelgarcia added subscribers: klimek, cfe-commits.

Replace references to "transform" with references to "check" where neccessary 
in the documentation.

http://reviews.llvm.org/D13006

Files:
  docs/clang-tidy/checks/modernize-loop-convert.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/modernize-use-auto.rst
  docs/clang-tidy/checks/modernize-use-nullptr.rst

Index: docs/clang-tidy/checks/modernize-use-nullptr.rst
===
--- docs/clang-tidy/checks/modernize-use-nullptr.rst
+++ docs/clang-tidy/checks/modernize-use-nullptr.rst
@@ -38,7 +38,7 @@
 User defined macros
 ===
 
-By default this transform will only replace the ``NULL`` macro and will skip any
+By default this check will only replace the ``NULL`` macro and will skip any
 user-defined macros that behaves like ``NULL``. The user can use the
 :option:``UserNullMacros`` option to specify a comma-separated list of macro
 names that will be transformed along with ``NULL``.
Index: docs/clang-tidy/checks/modernize-use-auto.rst
===
--- docs/clang-tidy/checks/modernize-use-auto.rst
+++ docs/clang-tidy/checks/modernize-use-auto.rst
@@ -53,7 +53,7 @@
   for (auto I = my_container.begin(), E = my_container.end(); I != E; ++I) {
   }
 
-The transform will only replace iterator type-specifiers when all of the
+The check will only replace iterator type-specifiers when all of the
 following conditions are satisfied:
 * The iterator is for one of the standard container in ``std`` namespace:
 
@@ -128,7 +128,7 @@
 
 Known Limitations
 =
-* If the initializer is an explicit conversion constructor, the transform will
+* If the initializer is an explicit conversion constructor, the check will
   not replace the type specifier even though it would be safe to do so.
 * User-defined iterators are not handled at this time.
 
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -26,13 +26,13 @@
}
 
 Since `std::move()` is a library function declared in `` it may be
-necessary to add this include. The transform will add the include directive when
+necessary to add this include. The check will add the include directive when
 necessary.
 
 Known Limitations
 =
 * If headers modification is not activated or if a header is not allowed to be
-  changed this transform will produce broken code (compilation error), where the
+  changed this check will produce broken code (compilation error), where the
   the headers' code will stay unchanged while the code using them will be
   changed.
 
Index: docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -4,7 +4,7 @@
 With move semantics added to the language and the standard library updated with
 move constructors added for many types it is now interesting to take an argument
 directly by value, instead of by const-reference, and then copy. This
-transformation allows the compiler to take care of choosing the best way to
+check allows the compiler to take care of choosing the best way to
 construct the copy.
 
 The transformation is usually beneficial when the calling code passes an
@@ -34,7 +34,7 @@
 into class fields. The parameter is then moved with `std::move()`.
 
 Since `std::move()` is a library function declared in `` it may be
-necessary to add this include. The transform will add the include directive when
+necessary to add this include. The check will add the include directive when
 necessary.
 
   .. code-block:: c++
Index: docs/clang-tidy/checks/modernize-loop-convert.rst
===
--- docs/clang-tidy/checks/modernize-loop-convert.rst
+++ docs/clang-tidy/checks/modernize-loop-convert.rst
@@ -81,19 +81,19 @@
   v.push_back(2);
   v.push_back(3);
 
-  // safe transform
+  // safe conversion
   for (int i = 0; i < N; ++i)
 cout << arr[i];
 
-  // reasonable transform
+  // reasonable conversion
   for (vector::iterator it = v.begin(); it != v.end(); ++it)
 cout << *it;*
 
-  // reasonable transform
+  // reasonable conversion
   for (int i = 0; i < v.size(); ++i)
 cout << v[i];
 
-After transformation with confidence level set to ``reasonable`` (default):
+After applying the check with minimum confidence level set to ``reasonable`` (default):
 
 .. code-block:: c++
 
@@ -104,24 +104,24 @@
   v.push_back(2);
   v.push_back(3);
 
-  // safe transform
+  // safe

r248145 - clang-format: Fix merging short case labels with comments.

2015-09-21 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Sep 21 04:50:01 2015
New Revision: 248145

URL: http://llvm.org/viewvc/llvm-project?rev=248145&view=rev
Log:
clang-format: Fix merging short case labels with comments.

This fixes llvm.org/PR24877.

Patch by Benjamin Daly, thank you!

Modified:
cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp?rev=248145&r1=248144&r2=248145&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineFormatter.cpp Mon Sep 21 04:50:01 2015
@@ -305,7 +305,8 @@ private:
   if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace))
 break;
   if (Line->First->isOneOf(tok::kw_if, tok::kw_for, tok::kw_switch,
-   tok::kw_while, tok::comment))
+   tok::kw_while, tok::comment) ||
+  Line->Last->is(tok::comment))
 return 0;
   Length += I[1 + NumStmts]->Last->TotalLength + 1; // 1 for the space.
 }

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=248145&r1=248144&r2=248145&view=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Sep 21 04:50:01 2015
@@ -756,6 +756,9 @@ TEST_F(FormatTest, ShortCaseLabels) {
"case 7:\n"
"  // comment\n"
"  return;\n"
+   "case 8:\n"
+   "  x = 8; // comment\n"
+   "  break;\n"
"default: y = 1; break;\n"
"}",
Style);


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


Re: [PATCH] D12358: [Analyzer] Handling constant bound loops

2015-09-21 Thread Sean Eveson via cfe-commits
seaneveson updated this revision to Diff 35216.
seaneveson added a comment.

The TK_EntireMemSpace trait is now used when invalidating. The trait was added 
in http://reviews.llvm.org/D12993, thank you Devin for that patch.
Updated to the latest trunk.


http://reviews.llvm.org/D12358

Files:
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  lib/StaticAnalyzer/Core/CMakeLists.txt
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/LoopWidening.cpp
  test/Analysis/analyzer-config.c
  test/Analysis/analyzer-config.cpp
  test/Analysis/constant-bound-loops.c

Index: test/Analysis/constant-bound-loops.c
===
--- test/Analysis/constant-bound-loops.c
+++ test/Analysis/constant-bound-loops.c
@@ -0,0 +1,178 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-store=region -analyzer-max-loop 4 -analyzer-config widen-constant-bound-loops=true -verify %s
+
+extern void clang_analyzer_eval(_Bool);
+
+typedef __typeof(sizeof(int)) size_t;
+void *malloc(size_t);
+
+void incr_for_loop() {
+int i;
+for (i = 0; i < 10; ++i) {}
+clang_analyzer_eval(i == 10); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void decr_for_loop() {
+int i;
+for (i = 10; i > 0; --i) {}
+clang_analyzer_eval(i == 0); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void incr_while_loop() {
+int i = 0;
+while (i < 10) {++i;}
+clang_analyzer_eval(i == 10); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void decr_while_loop() {
+int i = 10;
+while (i > 0) {--i;}
+clang_analyzer_eval(i == 0); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void incr_do_while_loop() {
+int i = 0;
+do {++i;} while (i < 10);
+clang_analyzer_eval(i == 10); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void decr_do_while_loop() {
+int i = 10;
+do {--i;} while (i > 0);
+clang_analyzer_eval(i == 0); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void negative_incr_for_loop() {
+int i;
+for (i = -10; i < 5 - 10; ++i) {}
+clang_analyzer_eval(i == -5); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void negative_decr_for_loop() {
+int i;
+for (i = 5 - 10; i > -20; --i) {}
+clang_analyzer_eval(i == -20); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void larger_incr_for_loop() {
+int i;
+for (i = 0; i < 20; i += 3) {}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void larger_decr_for_loop() {
+int i;
+for (i = 20; i > 0; i -= 3) {}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void unsigned_incr_for_loop() {
+unsigned i;
+for (i = 0; i < 10; ++i) {}
+clang_analyzer_eval(i == 10); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void unsigned_decr_for_loop() {
+unsigned i;
+for (i = 10; i > 0; --i) {}
+clang_analyzer_eval(i == 0); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void short_for_loop() {
+short i;
+for (i = 0; i < 10; ++i) {}
+clang_analyzer_eval(i == 10); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void lte_for_loop() {
+int i;
+for (i = 0; i <= 10; ++i) {}
+clang_analyzer_eval(i == 11); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void gte_for_loop() {
+int i;
+for (i = 10; i >= 0; --i) {}
+clang_analyzer_eval(i == -1); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+void incr_ne_for_loop() {
+int i;
+for (i = 0; i != 10; ++i) {}
+clang_analyzer_eval(i == 10); // expected-warning {{TRUE}}
+char *m = (char*)malloc(12);
+} // expected-warning {{Potential leak of memory pointed to by 'm'}}
+
+vo

Re: [PATCH] D12993: [analyzer] Add TK_EntireMemSpace invalidation trait.

2015-09-21 Thread Sean Eveson via cfe-commits
seaneveson added a comment.

Thank you for working on this! I have updated my patch 
(http://reviews.llvm.org/D12358) to depend on this one.


http://reviews.llvm.org/D12993



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


Re: [PATCH] D12955: Fix assertion in inline assembler IR gen

2015-09-21 Thread Alexander Musman via cfe-commits
amusman added inline comments.


Comment at: lib/Sema/SemaStmtAsm.cpp:447
@@ +446,3 @@
+// Make sure no more than one input constraint matches each output.
+if (InputMatchedToOutput[TiedTo] != ~0U) {
+  Diag(NS->getInputExpr(i)->getLocStart(),

aaron.ballman wrote:
> Is it possible for InputConstraintsInfos.size() to be greater than 
> OutputConstrainInfos.size()? Basically, I'm worried about buffer overflow 
> here with TiedTo.
The check above (which emits error err_asm_invalid_input_constraint) seems to 
capture this case so I always get correct TiedTo value here.
What if I add an assertion that TiedTo>=0 && TiedTo 
http://reviews.llvm.org/D12955



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


Re: [PATCH] D12955: Fix assertion in inline assembler IR gen

2015-09-21 Thread Alexander Musman via cfe-commits
amusman updated this revision to Diff 35222.
amusman added a comment.

Added an assertion for TiedTo value.


http://reviews.llvm.org/D12955

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaStmtAsm.cpp
  test/Sema/asm.c

Index: lib/Sema/SemaStmtAsm.cpp
===
--- lib/Sema/SemaStmtAsm.cpp
+++ lib/Sema/SemaStmtAsm.cpp
@@ -420,6 +420,8 @@
 diag::err_asm_unexpected_constraint_alternatives)
<< NumAlternatives << AltCount);
   }
+  SmallVector InputMatchedToOutput(OutputConstraintInfos.size(),
+  ~0U);
   for (unsigned i = 0, e = InputConstraintInfos.size(); i != e; ++i) {
 TargetInfo::ConstraintInfo &Info = InputConstraintInfos[i];
 StringRef ConstraintStr = Info.getConstraintStr();
@@ -441,6 +443,19 @@
 Expr *OutputExpr = Exprs[TiedTo];
 Expr *InputExpr = Exprs[InputOpNo];
 
+// Make sure no more than one input constraint matches each output.
+assert(TiedTo >= 0 && TiedTo < InputMatchedToOutput.size());
+if (InputMatchedToOutput[TiedTo] != ~0U) {
+  Diag(NS->getInputExpr(i)->getLocStart(),
+   diag::err_asm_input_duplicate_match)
+  << TiedTo;
+  Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getLocStart(),
+   diag::note_asm_input_duplicate_first)
+  << TiedTo;
+  return StmtError();
+}
+InputMatchedToOutput[TiedTo] = i;
+
 if (OutputExpr->isTypeDependent() || InputExpr->isTypeDependent())
   continue;
 
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -6418,6 +6418,8 @@
   def err_asm_non_addr_value_in_memory_constraint : Error <
 "reference to a %select{bit-field|vector element|global register 
variable}0"
 " in asm %select{input|output}1 with a memory constraint '%2'">;
+  def err_asm_input_duplicate_match : Error<
+"more than one input constraint matches the same output '%0'">;
 
   def warn_asm_label_on_auto_decl : Warning<
 "ignored asm label '%0' on automatic variable">;
@@ -6432,6 +6434,8 @@
 
   def note_asm_missing_constraint_modifier : Note<
 "use constraint modifier \"%0\"">;
+  def note_asm_input_duplicate_first : Note<
+"constraint '%0' is already present here">;
 }
 
 let CategoryName = "Semantic Issue" in {
Index: test/Sema/asm.c
===
--- test/Sema/asm.c
+++ test/Sema/asm.c
@@ -236,3 +236,15 @@
   : "m" (test16_baz)); // expected-error {{reference to a global 
register variable in asm output with a memory constraint 'm'}}
 }
 
+int test17(int t0)
+{
+  int r0, r1;
+  __asm ("addl %2, %2\n\t"
+ "movl $123, %0"
+ : "=a" (r0),
+   "=&r" (r1)
+ : "1" (t0),   // expected-note {{constraint '1' is already present 
here}}
+   "1" (t0));  // expected-error {{more than one input constraint 
matches the same output '1'}}
+  return r0 + r1;
+}
+


Index: lib/Sema/SemaStmtAsm.cpp
===
--- lib/Sema/SemaStmtAsm.cpp
+++ lib/Sema/SemaStmtAsm.cpp
@@ -420,6 +420,8 @@
 diag::err_asm_unexpected_constraint_alternatives)
<< NumAlternatives << AltCount);
   }
+  SmallVector InputMatchedToOutput(OutputConstraintInfos.size(),
+  ~0U);
   for (unsigned i = 0, e = InputConstraintInfos.size(); i != e; ++i) {
 TargetInfo::ConstraintInfo &Info = InputConstraintInfos[i];
 StringRef ConstraintStr = Info.getConstraintStr();
@@ -441,6 +443,19 @@
 Expr *OutputExpr = Exprs[TiedTo];
 Expr *InputExpr = Exprs[InputOpNo];
 
+// Make sure no more than one input constraint matches each output.
+assert(TiedTo >= 0 && TiedTo < InputMatchedToOutput.size());
+if (InputMatchedToOutput[TiedTo] != ~0U) {
+  Diag(NS->getInputExpr(i)->getLocStart(),
+   diag::err_asm_input_duplicate_match)
+  << TiedTo;
+  Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getLocStart(),
+   diag::note_asm_input_duplicate_first)
+  << TiedTo;
+  return StmtError();
+}
+InputMatchedToOutput[TiedTo] = i;
+
 if (OutputExpr->isTypeDependent() || InputExpr->isTypeDependent())
   continue;
 
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -6418,6 +6418,8 @@
   def err_asm_non_addr_value_in_memory_constraint : Error <
 "reference to a %select{bit-field|vector element|global register variable}0"
 " in asm %select{input|output}1 with a memory constraint '%2'">;
+  def err_asm_input_duplicate_ma

Re: [PATCH] D12633: Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets

2015-09-21 Thread Alexandros Lamprineas via cfe-commits
labrinea updated this revision to Diff 35223.
labrinea added a comment.

Patch updated.


http://reviews.llvm.org/D12633

Files:
  lib/Basic/Targets.cpp
  test/Preprocessor/aarch64-target-features.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -32,6 +32,7 @@
 // CHECK-V8-BAREHF: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK-V8-BAREHF: __ARM_FEATURE_NUMERIC_MAXMIN 1
 // CHECK-V8-BAREHF: __ARM_NEON__ 1
+// CHECK-V8-BAREHF: __ARM_PCS_VFP 1
 // CHECK-V8-BAREHF: __VFP_FP__ 1
 
 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | 
FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s
@@ -85,9 +86,13 @@
 // THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
 
 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
--check-prefix=CHECK-DEFS %s
+// CHECK-DEFS:#define __ARM_PCS 1
 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
 
+// RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-FASTMATH %s
+// CHECK-FASTMATH: __ARM_FP_FAST 1
+
 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-SHORTWCHAR %s
 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
 
Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -34,6 +34,8 @@
 // CHECK: __ARM_NEON 1
 // CHECK: __ARM_NEON_FP 0xE
 // CHECK: __ARM_PCS_AAPCS64 1
+// CHECK-NOT: __ARM_PCS 1
+// CHECK-NOT: __ARM_PCS_VFP 1
 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
 
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4762,6 +4762,10 @@
 // ACLE 6.4.6 Q (saturation) flag
 if (hasDSP || hasSAT)
   Builder.defineMacro("__ARM_FEATURE_QBIT", "1");
+
+// ACLE 6.6 Floating-point model
+if (Opts.FastMath || Opts.FiniteMathOnly)
+  Builder.defineMacro("__ARM_FP_FAST", "1");
   }
 
   void getTargetBuiltins(const Builtin::Info *&Records,
@@ -5215,7 +5219,7 @@
 Builder.defineMacro("__ARM_ARCH_PROFILE", "'A'");
 
 Builder.defineMacro("__ARM_64BIT_STATE", "1");
-Builder.defineMacro("__ARM_PCS_AAPCS64");
+Builder.defineMacro("__ARM_PCS_AAPCS64", "1");
 Builder.defineMacro("__ARM_ARCH_ISA_A64", "1");
 
 Builder.defineMacro("__ARM_FEATURE_CLZ", "1");
@@ -5237,7 +5241,7 @@
 Builder.defineMacro("__ARM_FP16_ARGS", "1");
 
 if (Opts.FastMath || Opts.FiniteMathOnly)
-  Builder.defineMacro("__ARM_FP_FAST");
+  Builder.defineMacro("__ARM_FP_FAST", "1");
 
 if (Opts.C99 && !Opts.Freestanding)
   Builder.defineMacro("__ARM_FP_FENV_ROUNDING");


Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -32,6 +32,7 @@
 // CHECK-V8-BAREHF: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK-V8-BAREHF: __ARM_FEATURE_NUMERIC_MAXMIN 1
 // CHECK-V8-BAREHF: __ARM_NEON__ 1
+// CHECK-V8-BAREHF: __ARM_PCS_VFP 1
 // CHECK-V8-BAREHF: __VFP_FP__ 1
 
 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s
@@ -85,9 +86,13 @@
 // THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
 
 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-DEFS %s
+// CHECK-DEFS:#define __ARM_PCS 1
 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
 
+// RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FASTMATH %s
+// CHECK-FASTMATH: __ARM_FP_FAST 1
+
 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTWCHAR %s
 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
 
Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -34,6 +34,8 @@
 // CHECK: __ARM_NEON 1
 // CHECK: __ARM_NEON_FP 0xE
 // CHECK: __ARM_PCS_AAPCS64 1
+// CHECK-NOT: __ARM_PCS 1
+// CHECK-NOT: __ARM_PCS_VFP 1
 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
 
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4762,6 +4762,10 @@
 // ACLE 6.4.6 Q (saturation) flag
 if (hasDSP || hasSAT)
   Builder.defineMacro("__ARM_F

[PATCH] D13009: [X86] Fix some non-reserved parameter names in intrinsic headers

2015-09-21 Thread Michael Kuperstein via cfe-commits
mkuper created this revision.
mkuper added a reviewer: AsafBadouh.
mkuper added a subscriber: cfe-commits.

http://reviews.llvm.org/D13009

Files:
  lib/Headers/avx512fintrin.h
  lib/Headers/emmintrin.h

Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -872,18 +872,18 @@
 }
 
 static  __inline__ __m512d __DEFAULT_FN_ATTRS
-_mm512_sqrt_pd(__m512d a)
+_mm512_sqrt_pd(__m512d __a)
 {
-  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)a,
+  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)__a,
 (__v8df) _mm512_setzero_pd (),
 (__mmask8) -1,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 static  __inline__ __m512 __DEFAULT_FN_ATTRS
-_mm512_sqrt_ps(__m512 a)
+_mm512_sqrt_ps(__m512 __a)
 {
-  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)a,
+  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)__a,
(__v16sf) _mm512_setzero_ps (),
(__mmask16) -1,
_MM_FROUND_CUR_DIRECTION);
@@ -2477,18 +2477,18 @@
 }
 
 static __inline __m512i __DEFAULT_FN_ATTRS
-_mm512_cvttps_epi32(__m512 a)
+_mm512_cvttps_epi32(__m512 __a)
 {
   return (__m512i)
-__builtin_ia32_cvttps2dq512_mask((__v16sf) a,
+__builtin_ia32_cvttps2dq512_mask((__v16sf) __a,
  (__v16si) _mm512_setzero_si512 (),
  (__mmask16) -1, _MM_FROUND_CUR_DIRECTION);
 }
 
 static __inline __m256i __DEFAULT_FN_ATTRS
-_mm512_cvttpd_epi32(__m512d a)
+_mm512_cvttpd_epi32(__m512d __a)
 {
-  return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) a,
+  return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) __a,
(__v8si)_mm256_setzero_si256(),
(__mmask8) -1,
 _MM_FROUND_CUR_DIRECTION);
Index: lib/Headers/emmintrin.h
===
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -1128,33 +1128,33 @@
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi64x(long long q1, long long q0)
+_mm_set_epi64x(long long __q1, long long __q0)
 {
-  return (__m128i){ q0, q1 };
+  return (__m128i){ __q0, __q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi64(__m64 q1, __m64 q0)
+_mm_set_epi64(__m64 __q1, __m64 __q0)
 {
-  return (__m128i){ (long long)q0, (long long)q1 };
+  return (__m128i){ (long long)__q0, (long long)__q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi32(int i3, int i2, int i1, int i0)
+_mm_set_epi32(int __i3, int __i2, int __i1, int __i0)
 {
-  return (__m128i)(__v4si){ i0, i1, i2, i3};
+  return (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, short w1, short w0)
+_mm_set_epi16(short __w7, short __w6, short __w5, short __w4, short __w3, short __w2, short __w1, short __w0)
 {
-  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
+  return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0)
+_mm_set_epi8(char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b9, char __b8, char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0)
 {
-  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
+  return (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
@@ -1188,27 +1188,27 @@
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi64(__m64 q0, __m64 q1)
+_mm_setr_epi64(__m64 __q0, __m64 __q1)
 {
-  return (__m128i){ (long long)q0, (long long)q1 };
+  return (__m128i){ (long long)__q0, (long long)__q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi32(int i0, int i1, int i2, int i3)
+_mm_setr_epi32(int __i0, int __i1, int __i2, int __i3)
 {
-  return (__m128i)(__v4si){ i0, i1, i2, i3};
+  return (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi16(short w0, short w1, short w2, short w3, short w4, short w5, short w6, short w7)
+_mm_setr_epi16(short __w0, short __w1, short __w2, short __w3, short __w4, short __w5, short __w6, short __w7)
 {
-  return (__m128i)(__v8hi){ w0, w1

Re: [PATCH] D13009: [X86] Fix some non-reserved parameter names in intrinsic headers

2015-09-21 Thread Asaf Badouh via cfe-commits
AsafBadouh accepted this revision.
AsafBadouh added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D13009



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


r248150 - [X86] Fix some non-reserved parameter names in intrinsic headers

2015-09-21 Thread Michael Kuperstein via cfe-commits
Author: mkuper
Date: Mon Sep 21 06:45:27 2015
New Revision: 248150

URL: http://llvm.org/viewvc/llvm-project?rev=248150&view=rev
Log:
[X86] Fix some non-reserved parameter names in intrinsic headers

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

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/emmintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=248150&r1=248149&r2=248150&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon Sep 21 06:45:27 2015
@@ -872,18 +872,18 @@ _mm512_mask_mullo_epi32 (__m512i __W, __
 }
 
 static  __inline__ __m512d __DEFAULT_FN_ATTRS
-_mm512_sqrt_pd(__m512d a)
+_mm512_sqrt_pd(__m512d __a)
 {
-  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)a,
+  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)__a,
 (__v8df) _mm512_setzero_pd (),
 (__mmask8) -1,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 static  __inline__ __m512 __DEFAULT_FN_ATTRS
-_mm512_sqrt_ps(__m512 a)
+_mm512_sqrt_ps(__m512 __a)
 {
-  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)a,
+  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)__a,
(__v16sf) _mm512_setzero_ps (),
(__mmask16) -1,
_MM_FROUND_CUR_DIRECTION);
@@ -2477,18 +2477,18 @@ _mm512_cvtph_ps(__m256i __A)
 }
 
 static __inline __m512i __DEFAULT_FN_ATTRS
-_mm512_cvttps_epi32(__m512 a)
+_mm512_cvttps_epi32(__m512 __a)
 {
   return (__m512i)
-__builtin_ia32_cvttps2dq512_mask((__v16sf) a,
+__builtin_ia32_cvttps2dq512_mask((__v16sf) __a,
  (__v16si) _mm512_setzero_si512 (),
  (__mmask16) -1, _MM_FROUND_CUR_DIRECTION);
 }
 
 static __inline __m256i __DEFAULT_FN_ATTRS
-_mm512_cvttpd_epi32(__m512d a)
+_mm512_cvttpd_epi32(__m512d __a)
 {
-  return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) a,
+  return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) __a,

(__v8si)_mm256_setzero_si256(),
(__mmask8) -1,
 _MM_FROUND_CUR_DIRECTION);

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=248150&r1=248149&r2=248150&view=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Mon Sep 21 06:45:27 2015
@@ -1128,33 +1128,33 @@ _mm_undefined_si128()
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi64x(long long q1, long long q0)
+_mm_set_epi64x(long long __q1, long long __q0)
 {
-  return (__m128i){ q0, q1 };
+  return (__m128i){ __q0, __q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi64(__m64 q1, __m64 q0)
+_mm_set_epi64(__m64 __q1, __m64 __q0)
 {
-  return (__m128i){ (long long)q0, (long long)q1 };
+  return (__m128i){ (long long)__q0, (long long)__q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi32(int i3, int i2, int i1, int i0)
+_mm_set_epi32(int __i3, int __i2, int __i1, int __i0)
 {
-  return (__m128i)(__v4si){ i0, i1, i2, i3};
+  return (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, 
short w1, short w0)
+_mm_set_epi16(short __w7, short __w6, short __w5, short __w4, short __w3, 
short __w2, short __w1, short __w0)
 {
-  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
+  return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char 
b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, 
char b0)
+_mm_set_epi8(char __b15, char __b14, char __b13, char __b12, char __b11, char 
__b10, char __b9, char __b8, char __b7, char __b6, char __b5, char __b4, char 
__b3, char __b2, char __b1, char __b0)
 {
-  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, 
b12, b13, b14, b15 };
+  return (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, 
__b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
@@ -1188,27 +1188,27 @@ _mm_set1_epi8(char __b)
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi64(__m64 q0, __m64 q1)
+_mm_setr_epi64(__m64 __q0, __m64 __q1)
 {

Re: [PATCH] D13009: [X86] Fix some non-reserved parameter names in intrinsic headers

2015-09-21 Thread Michael Kuperstein via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248150: [X86] Fix some non-reserved parameter names in 
intrinsic headers (authored by mkuper).

Changed prior to commit:
  http://reviews.llvm.org/D13009?vs=35225&id=35230#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13009

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/lib/Headers/emmintrin.h

Index: cfe/trunk/lib/Headers/emmintrin.h
===
--- cfe/trunk/lib/Headers/emmintrin.h
+++ cfe/trunk/lib/Headers/emmintrin.h
@@ -1128,33 +1128,33 @@
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi64x(long long q1, long long q0)
+_mm_set_epi64x(long long __q1, long long __q0)
 {
-  return (__m128i){ q0, q1 };
+  return (__m128i){ __q0, __q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi64(__m64 q1, __m64 q0)
+_mm_set_epi64(__m64 __q1, __m64 __q0)
 {
-  return (__m128i){ (long long)q0, (long long)q1 };
+  return (__m128i){ (long long)__q0, (long long)__q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi32(int i3, int i2, int i1, int i0)
+_mm_set_epi32(int __i3, int __i2, int __i1, int __i0)
 {
-  return (__m128i)(__v4si){ i0, i1, i2, i3};
+  return (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, short w1, short w0)
+_mm_set_epi16(short __w7, short __w6, short __w5, short __w4, short __w3, short __w2, short __w1, short __w0)
 {
-  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
+  return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0)
+_mm_set_epi8(char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b9, char __b8, char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0)
 {
-  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
+  return (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
@@ -1188,27 +1188,27 @@
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi64(__m64 q0, __m64 q1)
+_mm_setr_epi64(__m64 __q0, __m64 __q1)
 {
-  return (__m128i){ (long long)q0, (long long)q1 };
+  return (__m128i){ (long long)__q0, (long long)__q1 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi32(int i0, int i1, int i2, int i3)
+_mm_setr_epi32(int __i0, int __i1, int __i2, int __i3)
 {
-  return (__m128i)(__v4si){ i0, i1, i2, i3};
+  return (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi16(short w0, short w1, short w2, short w3, short w4, short w5, short w6, short w7)
+_mm_setr_epi16(short __w0, short __w1, short __w2, short __w3, short __w4, short __w5, short __w6, short __w7)
 {
-  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
+  return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_setr_epi8(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15)
+_mm_setr_epi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5, char __b6, char __b7, char __b8, char __b9, char __b10, char __b11, char __b12, char __b13, char __b14, char __b15)
 {
-  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
+  return (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 };
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -872,18 +872,18 @@
 }
 
 static  __inline__ __m512d __DEFAULT_FN_ATTRS
-_mm512_sqrt_pd(__m512d a)
+_mm512_sqrt_pd(__m512d __a)
 {
-  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)a,
+  return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)__a,
 (__v8df) _mm512_setzero_pd (),
 (__mmask8) -1,
 _MM_FROUND_CUR_DIRECTION);
 }
 
 static  __inline__ __m512 __DEFAULT_FN_ATTRS
-_mm512_sqrt_ps(__m512 a)
+_mm512_sqrt_ps(__m512 __a)
 {
-  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)a,
+  return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)__a,

Re: [PATCH] D13006: Replace references to "transform" with references to "check" where neccessary in the documentation.

2015-09-21 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Thanks! LG with a couple of nits.



Comment at: docs/clang-tidy/checks/modernize-pass-by-value.rst:6
@@ -5,2 +5,3 @@
 move constructors added for many types it is now interesting to take an 
argument
 directly by value, instead of by const-reference, and then copy. This
+check allows the compiler to take care of choosing the best way to

2gqj


Comment at: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst:35
@@ -34,3 +34,3 @@
 * If headers modification is not activated or if a header is not allowed to be
-  changed this transform will produce broken code (compilation error), where 
the
+  changed this check will produce broken code (compilation error), where the
   the headers' code will stay unchanged while the code using them will be

One "the" too much. Also 2gqj


Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:56
@@ -55,3 +55,3 @@
 
-The transform will only replace iterator type-specifiers when all of the
+The check will only replace iterator type-specifiers when all of the
 following conditions are satisfied:

gqj


Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:58
@@ -57,3 +57,3 @@
 following conditions are satisfied:
 * The iterator is for one of the standard container in ``std`` namespace:
 

Add an empty line above, otherwise this line doesn't get recognized as a list 
item.


Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:60
@@ -59,3 +59,3 @@
 
   * ``array``
 

Please try removing the empty lines between these list items to make it easier 
to see the whole list.


Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:131
@@ -130,3 +130,3 @@
 =
-* If the initializer is an explicit conversion constructor, the transform will
+* If the initializer is an explicit conversion constructor, the check will
   not replace the type specifier even though it would be safe to do so.

gqj


http://reviews.llvm.org/D13006



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


[clang-tools-extra] r248151 - [clang-tidy] Fixed formatting of headings in the docs.

2015-09-21 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Mon Sep 21 07:13:27 2015
New Revision: 248151

URL: http://llvm.org/viewvc/llvm-project?rev=248151&view=rev
Log:
[clang-tidy] Fixed formatting of headings in the docs.

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst

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

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst?rev=248151&r1=248150&r2=248151&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst 
Mon Sep 21 07:13:27 2015
@@ -11,10 +11,10 @@ Three kinds of loops can be converted:
 -  Loops over array-like containers, using ``operator[]`` and ``at()``.
 
 MinConfidence option
-
+
 
 risky
--
+^
 
 In loops where the container expression is more complex than just a
 reference to a declared expression (a variable, function, enum, etc.),
@@ -40,7 +40,7 @@ for an example of an incorrect transform
 level is set to `risky`.
 
 reasonable (Default)
-
+
 
 If a loop calls ``.end()`` or ``.size()`` after each iteration, the
 transformation for that loop is marked as `reasonable`, and thus will
@@ -54,7 +54,7 @@ be converted if the required confidence
 cout << container[i];
 
 safe
-
+
 
 Any other loops that do not match the above criteria to be marked as
 `risky` or `reasonable` are marked `safe`, and thus will be converted
@@ -68,7 +68,7 @@ if the required confidence level is set
 cout << arr[i];
 
 Example
-===
+---
 
 Original:
 
@@ -117,7 +117,7 @@ After transformation with confidence lev
 cout << elem;
 
 Limitations
-===
+---
 
 There are certain situations where the tool may erroneously perform
 transformations that remove information and change semantics. Users of the tool
@@ -125,7 +125,7 @@ should be aware of the behaviour and lim
 the cases below.
 
 Comments inside loop headers
-
+
 
 Comments inside the original loop header are ignored and deleted when
 transformed.
@@ -135,7 +135,7 @@ transformed.
   for (int i = 0; i < N; /* This will be deleted */ ++i) { }
 
 Range-based loops evaluate end() only once
---
+^^
 
 The C++11 range-based for loop calls ``.end()`` only once during the
 initialization of the loop. If in the original loop ``.end()`` is called after
@@ -201,7 +201,7 @@ transformed loop if ``.end()`` was origi
   }
 
 Overloaded operator->() with side effects
--
+^
 
 Similarly, if ``operator->()`` was overloaded to have side effects, such as
 logging, the semantics will change. If the iterator's ``operator->()`` was used
@@ -221,7 +221,7 @@ performed.
   }
 
 Pointers and references to containers
--
+^
 
 While most of the transform's risk analysis is dedicated to determining whether
 the iterator or container was modified within the loop, it is possible to

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst?rev=248151&r1=248150&r2=248151&view=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst 
(original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst 
Mon Sep 21 07:13:27 2015
@@ -25,12 +25,12 @@ Migration example:
   +  take_ownership_fn(std::move(b));
}
 
-Since `std::move()` is a library function declared in `` it may be
+Since ``std::move()`` is a library function declared in  it may be
 necessary to add this include. The transform will add the include directive 
when
 necessary.
 
 Known Limitations
-=
+-
 * If headers modification is not activated or if a header is not allowed to be
   changed this transform will produce broken code (compilation error), where 
the
   the headers' code will stay unchanged while the code using them will be

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst?rev=248151&r

Re: [PATCH] D13006: Replace references to "transform" with references to "check" where neccessary in the documentation.

2015-09-21 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 35232.
angelgarcia added a comment.

Done.


http://reviews.llvm.org/D13006

Files:
  docs/clang-tidy/checks/modernize-loop-convert.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/modernize-use-auto.rst
  docs/clang-tidy/checks/modernize-use-nullptr.rst

Index: docs/clang-tidy/checks/modernize-use-nullptr.rst
===
--- docs/clang-tidy/checks/modernize-use-nullptr.rst
+++ docs/clang-tidy/checks/modernize-use-nullptr.rst
@@ -38,7 +38,7 @@
 User defined macros
 ===
 
-By default this transform will only replace the ``NULL`` macro and will skip any
+By default this check will only replace the ``NULL`` macro and will skip any
 user-defined macros that behaves like ``NULL``. The user can use the
 :option:``UserNullMacros`` option to specify a comma-separated list of macro
 names that will be transformed along with ``NULL``.
Index: docs/clang-tidy/checks/modernize-use-auto.rst
===
--- docs/clang-tidy/checks/modernize-use-auto.rst
+++ docs/clang-tidy/checks/modernize-use-auto.rst
@@ -1,9 +1,8 @@
 modernize-use-auto
 ==
 
-This check is responsible for using the ``auto`` type specifier for
-variable declarations to *improve code readability and maintainability*.
-For example:
+This check is responsible for using the ``auto`` type specifier for variable
+declarations to *improve code readability and maintainability*.  For example:
 
 .. code-block:: c++
 
@@ -38,7 +37,7 @@
 
 Iterator type specifiers tend to be long and used frequently, especially in
 loop constructs. Since the functions generating iterators have a common format,
-the type specifier can be replaced without obscuring the meaning of code while 
+the type specifier can be replaced without obscuring the meaning of code while
 improving readability and maintainability.
 
 .. code-block:: c++
@@ -53,50 +52,33 @@
   for (auto I = my_container.begin(), E = my_container.end(); I != E; ++I) {
   }
 
-The transform will only replace iterator type-specifiers when all of the
-following conditions are satisfied:
+The check will only replace iterator type-specifiers when all of the following
+conditions are satisfied:
+
 * The iterator is for one of the standard container in ``std`` namespace:
 
   * ``array``
-
   * ``deque``
-
   * ``forward_list``
-
   * ``list``
-
   * ``vector``
-
   * ``map``
-
   * ``multimap``
-
   * ``set``
-
   * ``multiset``
-
   * ``unordered_map``
-
   * ``unordered_multimap``
-
   * ``unordered_set``
-
   * ``unordered_multiset``
-
   * ``queue``
-
   * ``priority_queue``
-
   * ``stack``
 
 * The iterator is one of the possible iterator types for standard containers:
 
   * ``iterator``
-
   * ``reverse_iterator``
-
   * ``const_iterator``
-
   * ``const_reverse_iterator``
 
 * In addition to using iterator types directly, typedefs or other ways of
@@ -128,7 +110,8 @@
 
 Known Limitations
 =
-* If the initializer is an explicit conversion constructor, the transform will
-  not replace the type specifier even though it would be safe to do so.
+* If the initializer is an explicit conversion constructor, the check will not
+  replace the type specifier even though it would be safe to do so.
+
 * User-defined iterators are not handled at this time.
 
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -26,24 +26,23 @@
}
 
 Since `std::move()` is a library function declared in `` it may be
-necessary to add this include. The transform will add the include directive when
+necessary to add this include. The check will add the include directive when
 necessary.
 
 Known Limitations
 =
 * If headers modification is not activated or if a header is not allowed to be
-  changed this transform will produce broken code (compilation error), where the
-  the headers' code will stay unchanged while the code using them will be
-  changed.
-
-* Client code that declares a reference to an ``std::auto_ptr`` coming from code
-  that can't be migrated (such as a header coming from a 3\ :sup:`rd` party
-  library) will produce a compilation error after migration. This is because the
-  type of the reference will be changed to ``std::unique_ptr`` but the type
-  returned by the library won't change, binding a reference to
+  changed this check will produce broken code (compilation error), where the
+  headers' code will stay unchanged while the code using them will be changed.
+
+* Client code that declares a reference to an ``std::auto_ptr`` coming from
+  code that can't be migrated (such as a header coming from a 3\ :sup:`rd`
+  party library

[PATCH] D13013: Fix crash "-target arm -mcpu=generic", without "-march="

2015-09-21 Thread Vladimir Sukharev via cfe-commits
vsukharev created this revision.
vsukharev added a reviewer: rengolin.
vsukharev added a subscriber: cfe-commits.
vsukharev set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

Follow-up to http://reviews.llvm.org/rL245445
Added more tests for "-mcpu=generic", a crash fixed.


Repository:
  rL LLVM

http://reviews.llvm.org/D13013

Files:
  lib/Driver/ToolChain.cpp
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/aarch64-cpus.c
  test/Driver/arm-cortex-cpus.c

Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -1,4 +1,16 @@
 // == Check default CPU on each major architecture
+// RUN: %clang -target arm -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-GENERIC %s
+// CHECK-GENERIC: "-cc1"{{.*}} "-triple" "armv4t-{{.*}} "-target-cpu" "generic"
+
+// RUN: %clang -target armeb -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-GENERIC %s
+// CHECK-BE-GENERIC: "-cc1"{{.*}} "-triple" "armebv4t-{{.*}} "-target-cpu" "generic"
+
+// RUN: %clang -target arm -mthumb -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-GENERIC-THUMB %s
+// CHECK-GENERIC-THUMB: "-cc1"{{.*}} "-triple" "thumbv4t-{{.*}} "-target-cpu" "generic"
+
+// RUN: %clang -target armeb -mthumb -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-GENERIC-THUMB %s
+// CHECK-BE-GENERIC-THUMB: "-cc1"{{.*}} "-triple" "thumbebv4t-{{.*}} "-target-cpu" "generic"
+
 // RUN: %clang -target armv4t -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V4T %s
 // RUN: %clang -target arm -march=armv4t -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V4T %s
 // CHECK-V4T: "-cc1"{{.*}} "-triple" "armv4t-{{.*}} "-target-cpu" "arm7tdmi"
Index: test/Driver/aarch64-cpus.c
===
--- test/Driver/aarch64-cpus.c
+++ test/Driver/aarch64-cpus.c
@@ -1,12 +1,17 @@
 // Check target CPUs are correctly passed.
 
 // RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
+// RUN: %clang -target aarch64 -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
 // RUN: %clang -target aarch64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
+// RUN: %clang -target aarch64 -mlittle-endian -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
 // RUN: %clang -target aarch64_be -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
 // GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
 
 // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s
+// RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s
 // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s
+// RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s
 
 // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"
 
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -246,7 +246,8 @@
 const std::string getARMArch(StringRef Arch,
  const llvm::Triple &Triple);
 StringRef getARMCPUForMArch(StringRef Arch, const llvm::Triple &Triple);
-StringRef getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch);
+StringRef getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch,
+  const llvm::Triple &Triple);
 
 void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs,
const llvm::Triple &Triple);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -560,8 +560,7 @@
 llvm::StringRef CPUName, llvm::StringRef ArchName,
 const llvm::Triple &Triple) {
   std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
-  std::string Arch = arm::getARMArch(ArchName, Triple);
-  if (arm::getLLVMArchSuffixForARM(CPU, Arch).empty())
+  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty())
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
@@ -6081,7 +6080,7 @@
 std::string CPU = llvm::sys::getHostCPUName();
 if (CPU != "generic") {
   // Translate the native cpu into the architecture suffix for that CPU.
-  StringRef Suffix = arm::getLLVMArchSuffixForARM(CPU, MArch);
+  StringRef Suffix = arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
   // If there is no valid architecture suffix for this CPU we don't know how
   // to handle it, so 

[PATCH] D13014: [X86] Add XSAVE intrinsics (Clang part)

2015-09-21 Thread Amjad Aboud via cfe-commits
aaboud created this revision.
aaboud added reviewers: mkuper, delena, craig.topper.
aaboud added a subscriber: cfe-commits.
aaboud set the repository for this revision to rL LLVM.

Add intrinsics for the XSAVE instructions:
XSAVE, XSAVE64
XRSTOR, XRSTOR64
XSAVEOPT, XSAVEOPT64
XRSTORS, XRSTORS64
XSAVEC, XSAVEC64
XSAVES, XSAVES64

These were previously declared in Intrin.h for MSVC compatibility, but now
that we have them implemented, these declarations can be removed.

Repository:
  rL LLVM

http://reviews.llvm.org/D13014

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/Intrin.h
  lib/Headers/immintrin.h
  lib/Headers/xsavecintrin.h
  lib/Headers/xsaveintrin.h
  lib/Headers/xsaveoptintrin.h
  lib/Headers/xsavesintrin.h
  test/CodeGen/builtins-x86.c

Index: lib/Headers/xsaveintrin.h
===
--- lib/Headers/xsaveintrin.h
+++ lib/Headers/xsaveintrin.h
@@ -0,0 +1,58 @@
+/*=== xsaveintrin.h - XSAVE intrinsic ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef __XSAVEINTRIN_H
+#define __XSAVEINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("xsave")))
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_xsave(void *__p, unsigned long long __m) {
+  return __builtin_ia32_xsave(__p, __m);
+}
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_xrstor(void *__p, unsigned long long __m) {
+  return __builtin_ia32_xrstor(__p, __m);
+}
+
+#ifdef __x86_64__
+static __inline__ void __DEFAULT_FN_ATTRS
+_xsave64(void *__p, unsigned long long __m) {
+  return __builtin_ia32_xsave64(__p, __m);
+}
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_xrstor64(void *__p, unsigned long long __m) {
+  return __builtin_ia32_xrstor64(__p, __m);
+}
+#endif
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif
Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -66,6 +66,10 @@
   x86intrin.h
   xmmintrin.h
   xopintrin.h
+  xsaveintrin.h
+  xsaveoptintrin.h
+  xsavecintrin.h
+  xsavesintrin.h
   xtestintrin.h
   )
 
Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -144,6 +144,14 @@
 
 #include 
 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
 /* Some intrinsics inside adxintrin.h are available only on processors with ADX,
  * whereas others are also available at all times. */
 #include 
Index: lib/Headers/xsavesintrin.h
===
--- lib/Headers/xsavesintrin.h
+++ lib/Headers/xsavesintrin.h
@@ -0,0 +1,58 @@
+/*=== xsavesintrin.h - XSAVES intrinsic ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO E

[clang-tools-extra] r248153 - Replace references to "transform" with references to "check" where neccessary in the documentation.

2015-09-21 Thread Angel Garcia Gomez via cfe-commits
Author: angelgarcia
Date: Mon Sep 21 07:53:30 2015
New Revision: 248153

URL: http://llvm.org/viewvc/llvm-project?rev=248153&view=rev
Log:
Replace references to "transform" with references to "check" where neccessary 
in the documentation.

Summary: Replace references to "transform" with references to "check" where 
neccessary in the documentation.

Reviewers: alexfh

Subscribers: cfe-commits, klimek

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

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.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-auto.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst?rev=248153&r1=248152&r2=248153&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst 
Mon Sep 21 07:53:30 2015
@@ -81,19 +81,19 @@ Original:
   v.push_back(2);
   v.push_back(3);
 
-  // safe transform
+  // safe conversion
   for (int i = 0; i < N; ++i)
 cout << arr[i];
 
-  // reasonable transform
+  // reasonable conversion
   for (vector::iterator it = v.begin(); it != v.end(); ++it)
 cout << *it;*
 
-  // reasonable transform
+  // reasonable conversion
   for (int i = 0; i < v.size(); ++i)
 cout << v[i];
 
-After transformation with confidence level set to ``reasonable`` (default):
+After applying the check with minimum confidence level set to ``reasonable`` 
(default):
 
 .. code-block:: c++
 
@@ -104,15 +104,15 @@ After transformation with confidence lev
   v.push_back(2);
   v.push_back(3);
 
-  // safe transform
+  // safe conversion
   for (auto & elem : arr)
 cout << elem;
 
-  // reasonable transform
+  // reasonable conversion
   for (auto & elem : v)
 cout << elem;
 
-  // reasonable transform
+  // reasonable conversion
   for (auto & elem : v)
 cout << elem;
 
@@ -121,7 +121,7 @@ Limitations
 
 There are certain situations where the tool may erroneously perform
 transformations that remove information and change semantics. Users of the tool
-should be aware of the behaviour and limitations of the transform outlined by
+should be aware of the behaviour and limitations of the check outlined by
 the cases below.
 
 Comments inside loop headers
@@ -223,7 +223,7 @@ performed.
 Pointers and references to containers
 ^
 
-While most of the transform's risk analysis is dedicated to determining whether
+While most of the check's risk analysis is dedicated to determining whether
 the iterator or container was modified within the loop, it is possible to
 circumvent the analysis by accessing and modifying the container through a
 pointer or reference.
@@ -231,7 +231,7 @@ pointer or reference.
 If the container were directly used instead of using the pointer or reference
 the following transformation would have only been applied at the ``risky``
 level since calling a member function of the container is considered `risky`.
-The transform cannot identify expressions associated with the container that 
are
+The check cannot identify expressions associated with the container that are
 different than the one used in the loop header, therefore the transformation
 below ends up being performed at the ``safe`` level.
 

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst?rev=248153&r1=248152&r2=248153&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst 
Mon Sep 21 07:53:30 2015
@@ -2,10 +2,10 @@ modernize-pass-by-value
 ===
 
 With move semantics added to the language and the standard library updated with
-move constructors added for many types it is now interesting to take an 
argument
-directly by value, instead of by const-reference, and then copy. This
-transformation allows the compiler to take care of choosing the best way to
-construct the copy.
+move constructors added for many types it is now interesting to take an
+argument directly by value, instead of by const-reference, and then copy. This
+check allows the compiler to take care of choosing the best way to construct
+the copy.
 
 The transformation is usually beneficial when 

Re: [PATCH] D13006: Replace references to "transform" with references to "check" where neccessary in the documentation.

2015-09-21 Thread Angel Garcia via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248153: Replace references to "transform" with references to 
"check" where neccessary… (authored by angelgarcia).

Changed prior to commit:
  http://reviews.llvm.org/D13006?vs=35232&id=35238#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13006

Files:
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.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-auto.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst

Index: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst
@@ -38,7 +38,7 @@
 User defined macros
 ---
 
-By default this transform will only replace the ``NULL`` macro and will skip any
+By default this check will only replace the ``NULL`` macro and will skip any
 user-defined macros that behaves like ``NULL``. The user can use the
 :option:``UserNullMacros`` option to specify a comma-separated list of macro
 names that will be transformed along with ``NULL``.
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -2,10 +2,10 @@
 ===
 
 With move semantics added to the language and the standard library updated with
-move constructors added for many types it is now interesting to take an argument
-directly by value, instead of by const-reference, and then copy. This
-transformation allows the compiler to take care of choosing the best way to
-construct the copy.
+move constructors added for many types it is now interesting to take an
+argument directly by value, instead of by const-reference, and then copy. This
+check allows the compiler to take care of choosing the best way to construct
+the copy.
 
 The transformation is usually beneficial when the calling code passes an
 *rvalue* and assumes the move construction is a cheap operation. This short
@@ -34,7 +34,7 @@
 into class fields. The parameter is then moved with `std::move()`.
 
 Since `std::move()` is a library function declared in `` it may be
-necessary to add this include. The transform will add the include directive when
+necessary to add this include. The check will add the include directive when
 necessary.
 
   .. code-block:: c++
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
@@ -1,9 +1,8 @@
 modernize-use-auto
 ==
 
-This check is responsible for using the ``auto`` type specifier for
-variable declarations to *improve code readability and maintainability*.
-For example:
+This check is responsible for using the ``auto`` type specifier for variable
+declarations to *improve code readability and maintainability*.  For example:
 
 .. code-block:: c++
 
@@ -38,7 +37,7 @@
 
 Iterator type specifiers tend to be long and used frequently, especially in
 loop constructs. Since the functions generating iterators have a common format,
-the type specifier can be replaced without obscuring the meaning of code while 
+the type specifier can be replaced without obscuring the meaning of code while
 improving readability and maintainability.
 
 .. code-block:: c++
@@ -53,50 +52,33 @@
   for (auto I = my_container.begin(), E = my_container.end(); I != E; ++I) {
   }
 
-The transform will only replace iterator type-specifiers when all of the
-following conditions are satisfied:
+The check will only replace iterator type-specifiers when all of the following
+conditions are satisfied:
+
 * The iterator is for one of the standard container in ``std`` namespace:
 
   * ``array``
-
   * ``deque``
-
   * ``forward_list``
-
   * ``list``
-
   * ``vector``
-
   * ``map``
-
   * ``multimap``
-
   * ``set``
-
   * ``multiset``
-
   * ``unordered_map``
-
   * ``unordered_multimap``
-
   * ``unordered_set``
-
   * ``unordered_multiset``
-
   * ``queue``
-
   * ``priority_queue``
-
   * ``stack``
 
 * The iterator is one of the possible iterator types for standard containers:
 
   * ``iterator``
-
   * ``reverse_iterator``
-
   * ``const_iterator``
-
   * ``const_reverse_iterator``
 
 * In addition to using iterator types directly, typedefs or other ways of
@@ -128,7 +110

Re: [PATCH] D12955: Fix assertion in inline assembler IR gen

2015-09-21 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

With one minor change, LGTM! Thank you for working on this.

~Aaron



Comment at: lib/Sema/SemaStmtAsm.cpp:447
@@ +446,3 @@
+// Make sure no more than one input constraint matches each output.
+assert(TiedTo >= 0 && TiedTo < InputMatchedToOutput.size());
+if (InputMatchedToOutput[TiedTo] != ~0U) {

No need for the TiedTo >= 0 since it's an unsigned value anyway. Our usual way 
of writing this sort of assert is:


```
assert(TiedTo < InputMatchedToOutput.size() && "TiedTo value out of range");
```


http://reviews.llvm.org/D12955



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


[PATCH] D13015: [X86] Make f16c intrinsics accessible through emmintrin.h, per Intel docs

2015-09-21 Thread Michael Kuperstein via cfe-commits
mkuper created this revision.
mkuper added a reviewer: AsafBadouh.
mkuper added a subscriber: cfe-commits.

http://reviews.llvm.org/D13015

Files:
  lib/Headers/emmintrin.h
  lib/Headers/f16cintrin.h

Index: lib/Headers/emmintrin.h
===
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -35,6 +35,8 @@
 typedef short __v8hi __attribute__((__vector_size__(16)));
 typedef char __v16qi __attribute__((__vector_size__(16)));
 
+#include 
+
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("sse2")))
 
Index: lib/Headers/f16cintrin.h
===
--- lib/Headers/f16cintrin.h
+++ lib/Headers/f16cintrin.h
@@ -21,8 +21,8 @@
  *===---===
  */
 
-#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
-#error "Never use  directly; include  instead."
+#if !defined __X86INTRIN_H && !defined __EMMINTRIN_H && !defined __IMMINTRIN_H
+#error "Never use  directly; include  instead."
 #endif
 
 #ifndef __F16CINTRIN_H


Index: lib/Headers/emmintrin.h
===
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -35,6 +35,8 @@
 typedef short __v8hi __attribute__((__vector_size__(16)));
 typedef char __v16qi __attribute__((__vector_size__(16)));
 
+#include 
+
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
 
Index: lib/Headers/f16cintrin.h
===
--- lib/Headers/f16cintrin.h
+++ lib/Headers/f16cintrin.h
@@ -21,8 +21,8 @@
  *===---===
  */
 
-#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
-#error "Never use  directly; include  instead."
+#if !defined __X86INTRIN_H && !defined __EMMINTRIN_H && !defined __IMMINTRIN_H
+#error "Never use  directly; include  instead."
 #endif
 
 #ifndef __F16CINTRIN_H
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r248154 - [ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def

2015-09-21 Thread Artyom Skrobov via cfe-commits
Author: askrobov
Date: Mon Sep 21 08:19:25 2015
New Revision: 248154

URL: http://llvm.org/viewvc/llvm-project?rev=248154&view=rev
Log:
[ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def

Currently, the availability of DSP instructions (ACLE 6.4.7) is handled in
a hand-rolled tricky condition block in lib/Basic/Targets.cpp, with a FIXME:
attached.

http://reviews.llvm.org/D12937 moved the handling of +t2dsp over to
ARMTargetParser.def in LLVM, to be in line with other architecture extensions.

This is the corresponding patch to clang, to clear the FIXME: and update
the tests.

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


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=248154&r1=248153&r2=248154&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Sep 21 08:19:25 2015
@@ -4121,6 +4121,7 @@ class ARMTargetInfo : public TargetInfo
 
   unsigned CRC : 1;
   unsigned Crypto : 1;
+  unsigned T2DSP : 1;
   unsigned Unaligned : 1;
 
   enum {
@@ -4472,6 +4473,7 @@ public:
 FPU = 0;
 CRC = 0;
 Crypto = 0;
+T2DSP = 0;
 Unaligned = 1;
 SoftFloat = SoftFloatABI = false;
 HWDiv = 0;
@@ -4507,6 +4509,8 @@ public:
 CRC = 1;
   } else if (Feature == "+crypto") {
 Crypto = 1;
+  } else if (Feature == "+t2dsp") {
+T2DSP = 1;
   } else if (Feature == "+fp-only-sp") {
 HW_FP_remove |= HW_FP_DP | HW_FP_HP;
   } else if (Feature == "+strict-align") {
@@ -4743,11 +4747,7 @@ public:
 
 // ACLE 6.4.7 DSP instructions
 bool hasDSP = false;
-bool is5EOrAbove = (ArchVersion >= 6 ||
-   (ArchVersion == 5 && CPUAttr.count('E')));
-// FIXME: We are not getting all 32-bit ARM architectures
-bool is32Bit = (!isThumb() || supportsThumb2());
-if (is5EOrAbove && is32Bit && (CPUProfile != "M" || CPUAttr  == "7EM")) {
+if (T2DSP) {
   Builder.defineMacro("__ARM_FEATURE_DSP", "1");
   hasDSP = true;
 }

Modified: cfe/trunk/test/CodeGen/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=248154&r1=248153&r2=248154&view=diff
==
--- cfe/trunk/test/CodeGen/arm-target-features.c (original)
+++ cfe/trunk/test/CodeGen/arm-target-features.c Mon Sep 21 08:19:25 2015
@@ -1,15 +1,15 @@
 // REQUIRES: arm-registered-target
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
-// CHECK-VFP3: "target-features"="+neon,+vfp3"
+// CHECK-VFP3: "target-features"="+neon,+t2dsp,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a9 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-FP16
-// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+vfp3"
+// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+t2dsp,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
-// CHECK-VFP4: "target-features"="+neon,+vfp4"
+// CHECK-VFP4: "target-features"="+neon,+t2dsp,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
@@ -18,39 +18,41 @@
 // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm 
-o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+vfp4"
+// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+t2dsp,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
-// CHECK-BASIC-V8: 
"target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon"
+// CHECK-BASIC-V8: 
"target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon,+t2dsp"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r5 
-emit-llvm -o - 

Re: [PATCH] D12938: [ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def

2015-09-21 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248154: [ARM] Handle +t2dsp feature as an ArchExtKind in 
ARMTargetParser.def (authored by askrobov).

Changed prior to commit:
  http://reviews.llvm.org/D12938?vs=35001&id=35244#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12938

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/CodeGen/arm-target-features.c

Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -4121,6 +4121,7 @@
 
   unsigned CRC : 1;
   unsigned Crypto : 1;
+  unsigned T2DSP : 1;
   unsigned Unaligned : 1;
 
   enum {
@@ -4472,6 +4473,7 @@
 FPU = 0;
 CRC = 0;
 Crypto = 0;
+T2DSP = 0;
 Unaligned = 1;
 SoftFloat = SoftFloatABI = false;
 HWDiv = 0;
@@ -4507,6 +4509,8 @@
 CRC = 1;
   } else if (Feature == "+crypto") {
 Crypto = 1;
+  } else if (Feature == "+t2dsp") {
+T2DSP = 1;
   } else if (Feature == "+fp-only-sp") {
 HW_FP_remove |= HW_FP_DP | HW_FP_HP;
   } else if (Feature == "+strict-align") {
@@ -4743,11 +4747,7 @@
 
 // ACLE 6.4.7 DSP instructions
 bool hasDSP = false;
-bool is5EOrAbove = (ArchVersion >= 6 ||
-   (ArchVersion == 5 && CPUAttr.count('E')));
-// FIXME: We are not getting all 32-bit ARM architectures
-bool is32Bit = (!isThumb() || supportsThumb2());
-if (is5EOrAbove && is32Bit && (CPUProfile != "M" || CPUAttr  == "7EM")) {
+if (T2DSP) {
   Builder.defineMacro("__ARM_FEATURE_DSP", "1");
   hasDSP = true;
 }
Index: cfe/trunk/test/CodeGen/arm-target-features.c
===
--- cfe/trunk/test/CodeGen/arm-target-features.c
+++ cfe/trunk/test/CodeGen/arm-target-features.c
@@ -1,56 +1,58 @@
 // REQUIRES: arm-registered-target
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
-// CHECK-VFP3: "target-features"="+neon,+vfp3"
+// CHECK-VFP3: "target-features"="+neon,+t2dsp,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a9 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-FP16
-// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+vfp3"
+// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+t2dsp,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
-// CHECK-VFP4: "target-features"="+neon,+vfp4"
+// CHECK-VFP4: "target-features"="+neon,+t2dsp,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a12 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a15 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+vfp4"
+// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+t2dsp,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
-// CHECK-BASIC-V8: "target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon"
+// CHECK-BASIC-V8: "target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon,+t2dsp"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-DIV
-// CHECK-VFP3-D16-DIV: "target-features"="+d16,+hwdiv,+hwdiv-arm,+vfp3"
+// CHECK-VFP3-D16-DIV: "target-features"="+d16,+hwdiv,+hwdiv-arm,+t2dsp,+vfp3"
 
 
 // RUN: %clang_cc1 -triple armv7-linux-gnueabi -target-cpu cortex-r4f -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-THUMB-DIV
-// CHECK-VFP3-D16-THUMB-DIV: "target-features"="+d16,+hwdiv,+vfp3"
+// CHECK-VFP3-D16-THUMB-DIV: "target-features"="+d16,+hwdiv,+t2dsp,+vfp3"
 
 

Re: [PATCH] D13015: [X86] Make f16c intrinsics accessible through emmintrin.h, per Intel docs

2015-09-21 Thread Asaf Badouh via cfe-commits
AsafBadouh accepted this revision.
AsafBadouh added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D13015



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


Re: [PATCH] D12839: Extend MoveConstructorInitCheck to also flag constructor arguments passed by value and can be moved assigned to fields.

2015-09-21 Thread Aaron Ballman via cfe-commits
On Sun, Sep 20, 2015 at 1:44 PM, Felix Berger  wrote:
> flx added inline comments.
>
> 
> Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:38
> @@ +37,3 @@
> +  Node.isTriviallyCopyableType(Finder->getASTContext()) ||
> +  classHasTrivialCopyAndDestroy(Node)) {
> +return false;
> 
> aaron.ballman wrote:
>> Why do you need classHasTrivialCopyAndDestroy() when you're already checking 
>> if it's a trivially copyable type?
> We also want to catch types that have non-trivial destructors which would be 
> executed when the temporary copy goes out of scope.

Yes, but why the requirement to check the triviality of the copy
twice? It seems to me that classHasTrivialCopyAndDestroy isn't really
a type trait that we want to expose the way you have. It should be a
private implementation detail of isExpensiveToCopy(), at which point
you can pull out the duplicated check for the triviality of the copy
constructor.

>
> 
> Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:44
> @@ +43,3 @@
> +
> +int parmVarDeclRefExprOccurences(const ParmVarDecl &MovableParam,
> + const CXXConstructorDecl &ConstructorDecl,
> 
> aaron.ballman wrote:
>> Should return unsigned, please.
> Done. Is this an llvm convention?

I don't think it's an official one, but it resolves some type mismatch
issues with your code, which simplifies things.

>
> 
> Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:120
> @@ +119,3 @@
> +  }
> +  diag(InitArg->getLocStart(), "value parameter can be moved to avoid 
> copy.");
> +}
> 
> alexfh wrote:
>> alexfh wrote:
>> > aaron.ballman wrote:
>> > > Perhaps: "argument can be moved to avoid a copy" instead?
>> > nit: Please remove the trailing period.
>> Does anything stop us from suggesting fixes here (inserting "std::move()" 
>> around the argument and #include , if it's no there yet)?
> How would I tread in the IncludeOrder style (i.e. Google vs LLVM)? Should 
> this be a flag shared by all of ClangTidy or specific to this check?
>
> 
> Comment at: test/clang-tidy/misc-move-constructor-init.cpp:85
> @@ +84,3 @@
> +  Movable& operator =(const Movable&) = default;
> +  ~Movable() {}
> +};
> 
> aaron.ballman wrote:
>> Why not = default?
> We need to make the type non-trivially copyable by our definition above.

Oh, derp. I was expecting that to be on the copy operations, not on
the destructor. Sorry for the noise. :-)

~Aaron

>
> 
> Comment at: test/clang-tidy/misc-move-constructor-init.cpp:113
> @@ +112,3 @@
> +
> +struct NegativeParamTriviallyCopyable {
> +  NegativeParamTriviallyCopyable(TriviallyCopyable T) : T_(T) {}
> 
> aaron.ballman wrote:
>> Should also have a test for scalars
> Added.
>
>
> http://reviews.llvm.org/D12839
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13015: [X86] Make f16c intrinsics accessible through emmintrin.h, per Intel docs

2015-09-21 Thread Michael Kuperstein via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248156: [X86] Make f16c intrinsics accessible through 
emmintrin.h, per Intel docs (authored by mkuper).

Changed prior to commit:
  http://reviews.llvm.org/D13015?vs=35237&id=35250#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13015

Files:
  cfe/trunk/lib/Headers/emmintrin.h
  cfe/trunk/lib/Headers/f16cintrin.h

Index: cfe/trunk/lib/Headers/f16cintrin.h
===
--- cfe/trunk/lib/Headers/f16cintrin.h
+++ cfe/trunk/lib/Headers/f16cintrin.h
@@ -21,8 +21,8 @@
  *===---===
  */
 
-#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
-#error "Never use  directly; include  instead."
+#if !defined __X86INTRIN_H && !defined __EMMINTRIN_H && !defined __IMMINTRIN_H
+#error "Never use  directly; include  instead."
 #endif
 
 #ifndef __F16CINTRIN_H
Index: cfe/trunk/lib/Headers/emmintrin.h
===
--- cfe/trunk/lib/Headers/emmintrin.h
+++ cfe/trunk/lib/Headers/emmintrin.h
@@ -35,6 +35,8 @@
 typedef short __v8hi __attribute__((__vector_size__(16)));
 typedef char __v16qi __attribute__((__vector_size__(16)));
 
+#include 
+
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("sse2")))
 


Index: cfe/trunk/lib/Headers/f16cintrin.h
===
--- cfe/trunk/lib/Headers/f16cintrin.h
+++ cfe/trunk/lib/Headers/f16cintrin.h
@@ -21,8 +21,8 @@
  *===---===
  */
 
-#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
-#error "Never use  directly; include  instead."
+#if !defined __X86INTRIN_H && !defined __EMMINTRIN_H && !defined __IMMINTRIN_H
+#error "Never use  directly; include  instead."
 #endif
 
 #ifndef __F16CINTRIN_H
Index: cfe/trunk/lib/Headers/emmintrin.h
===
--- cfe/trunk/lib/Headers/emmintrin.h
+++ cfe/trunk/lib/Headers/emmintrin.h
@@ -35,6 +35,8 @@
 typedef short __v8hi __attribute__((__vector_size__(16)));
 typedef char __v16qi __attribute__((__vector_size__(16)));
 
+#include 
+
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r248156 - [X86] Make f16c intrinsics accessible through emmintrin.h, per Intel docs

2015-09-21 Thread Michael Kuperstein via cfe-commits
Author: mkuper
Date: Mon Sep 21 08:34:47 2015
New Revision: 248156

URL: http://llvm.org/viewvc/llvm-project?rev=248156&view=rev
Log:
[X86] Make f16c intrinsics accessible through emmintrin.h, per Intel docs

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

Modified:
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/lib/Headers/f16cintrin.h

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=248156&r1=248155&r2=248156&view=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Mon Sep 21 08:34:47 2015
@@ -35,6 +35,8 @@ typedef long long __v2di __attribute__ (
 typedef short __v8hi __attribute__((__vector_size__(16)));
 typedef char __v16qi __attribute__((__vector_size__(16)));
 
+#include 
+
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("sse2")))
 

Modified: cfe/trunk/lib/Headers/f16cintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/f16cintrin.h?rev=248156&r1=248155&r2=248156&view=diff
==
--- cfe/trunk/lib/Headers/f16cintrin.h (original)
+++ cfe/trunk/lib/Headers/f16cintrin.h Mon Sep 21 08:34:47 2015
@@ -21,8 +21,8 @@
  *===---===
  */
 
-#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
-#error "Never use  directly; include  instead."
+#if !defined __X86INTRIN_H && !defined __EMMINTRIN_H && !defined __IMMINTRIN_H
+#error "Never use  directly; include  instead."
 #endif
 
 #ifndef __F16CINTRIN_H


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


Re: [PATCH] D12839: Extend MoveConstructorInitCheck to also flag constructor arguments passed by value and can be moved assigned to fields.

2015-09-21 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:11
@@ -10,2 +10,3 @@
 #include "MoveConstructorInitCheck.h"
+#include "../utils/Matchers.h"
 #include "clang/AST/ASTContext.h"

Errr, I'm not certain that we typically use relative paths for this sort of 
thing. I see we do use relative paths for other things in clang-tidy, but this 
is definitely an uncommon thing in the rest of the code base (outside of test 
or example code).

Not saying you should change anything here, but we may want to consider 
changing the paths at some point so we are more in line with the rest of the 
LLVM projects in not using relative include paths.


Comment at: clang-tidy/utils/Matchers.h:1
@@ +1,2 @@
+//===--- Matchers.h - 
clang-tidy---===//
+//

You are missing header include guards.


Comment at: clang-tidy/utils/TypeTraits.cpp:29
@@ +28,3 @@
+  // excessive copying, we'll warn on them.
+  if (Type->isDependentType())
+return false;

This isn't needed because Type.isTriviallyCopyableType() already returns false 
for this case.


Comment at: clang-tidy/utils/TypeTraits.cpp:32
@@ +31,3 @@
+  // Ignore trivially copyable types.
+  return !(Type->isScalarType() || Type.isTriviallyCopyableType(Context) ||
+   classHasTrivialCopyAndDestroy(Type));

No need to check for isScalarType() because isTriviallyCopyableType() already 
does that correctly.


Comment at: clang-tidy/utils/TypeTraits.h:22
@@ +21,3 @@
+/// destructor.
+bool classHasTrivialCopyAndDestroy(QualType Type);
+

I think this is an implementation detail more than a trait we want to expose.


Comment at: test/clang-tidy/misc-move-constructor-init.cpp:114
@@ +113,3 @@
+  TriviallyCopyable T_;
+  int I_;
+};

Sorry to have not caught this earlier, but can you also add a test case for 
dependent types to make sure they remain negative?


http://reviews.llvm.org/D12839



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


Re: [PATCH] D12938: [ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def

2015-09-21 Thread James Molloy via cfe-commits
Hi Artyom,

This, too, looks to be unreviewed. Could you please explain what's going on
here?


James
On Mon, 21 Sep 2015 at 06:21, Phabricator via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL248154: [ARM] Handle +t2dsp feature as an ArchExtKind
> in ARMTargetParser.def (authored by askrobov).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D12938?vs=35001&id=35244#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D12938
>
> Files:
>   cfe/trunk/lib/Basic/Targets.cpp
>   cfe/trunk/test/CodeGen/arm-target-features.c
>
> ___
> 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


r248158 - Fix assertion in inline assembler IR gen

2015-09-21 Thread Alexander Musman via cfe-commits
Author: amusman
Date: Mon Sep 21 09:41:00 2015
New Revision: 248158

URL: http://llvm.org/viewvc/llvm-project?rev=248158&view=rev
Log:
Fix assertion in inline assembler IR gen
Several inputs may not refer to one output constraint in inline assembler
insertions, clang was failing on assertion on such test case.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/test/Sema/asm.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=248158&r1=248157&r2=248158&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Sep 21 09:41:00 
2015
@@ -6418,6 +6418,8 @@ let CategoryName = "Inline Assembly Issu
   def err_asm_non_addr_value_in_memory_constraint : Error <
 "reference to a %select{bit-field|vector element|global register 
variable}0"
 " in asm %select{input|output}1 with a memory constraint '%2'">;
+  def err_asm_input_duplicate_match : Error<
+"more than one input constraint matches the same output '%0'">;
 
   def warn_asm_label_on_auto_decl : Warning<
 "ignored asm label '%0' on automatic variable">;
@@ -6432,6 +6434,8 @@ let CategoryName = "Inline Assembly Issu
 
   def note_asm_missing_constraint_modifier : Note<
 "use constraint modifier \"%0\"">;
+  def note_asm_input_duplicate_first : Note<
+"constraint '%0' is already present here">;
 }
 
 let CategoryName = "Semantic Issue" in {

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=248158&r1=248157&r2=248158&view=diff
==
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Sep 21 09:41:00 2015
@@ -420,6 +420,8 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL
 diag::err_asm_unexpected_constraint_alternatives)
<< NumAlternatives << AltCount);
   }
+  SmallVector InputMatchedToOutput(OutputConstraintInfos.size(),
+  ~0U);
   for (unsigned i = 0, e = InputConstraintInfos.size(); i != e; ++i) {
 TargetInfo::ConstraintInfo &Info = InputConstraintInfos[i];
 StringRef ConstraintStr = Info.getConstraintStr();
@@ -441,6 +443,19 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL
 Expr *OutputExpr = Exprs[TiedTo];
 Expr *InputExpr = Exprs[InputOpNo];
 
+// Make sure no more than one input constraint matches each output.
+assert(TiedTo < InputMatchedToOutput.size() && "TiedTo value out of 
range");
+if (InputMatchedToOutput[TiedTo] != ~0U) {
+  Diag(NS->getInputExpr(i)->getLocStart(),
+   diag::err_asm_input_duplicate_match)
+  << TiedTo;
+  Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getLocStart(),
+   diag::note_asm_input_duplicate_first)
+  << TiedTo;
+  return StmtError();
+}
+InputMatchedToOutput[TiedTo] = i;
+
 if (OutputExpr->isTypeDependent() || InputExpr->isTypeDependent())
   continue;
 

Modified: cfe/trunk/test/Sema/asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=248158&r1=248157&r2=248158&view=diff
==
--- cfe/trunk/test/Sema/asm.c (original)
+++ cfe/trunk/test/Sema/asm.c Mon Sep 21 09:41:00 2015
@@ -236,3 +236,15 @@ void test16()
   : "m" (test16_baz)); // expected-error {{reference to a global 
register variable in asm output with a memory constraint 'm'}}
 }
 
+int test17(int t0)
+{
+  int r0, r1;
+  __asm ("addl %2, %2\n\t"
+ "movl $123, %0"
+ : "=a" (r0),
+   "=&r" (r1)
+ : "1" (t0),   // expected-note {{constraint '1' is already present 
here}}
+   "1" (t0));  // expected-error {{more than one input constraint 
matches the same output '1'}}
+  return r0 + r1;
+}
+


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


Re: [PATCH] D13004: Create a new attribute set when the definition is parsed after a declaration of a function

2015-09-21 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk.
vsk added a comment.

Thanks, LGTM.


http://reviews.llvm.org/D13004



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


[libclc] r248159 - Add image attribute getter builtins

2015-09-21 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Sep 21 09:47:53 2015
New Revision: 248159

URL: http://llvm.org/viewvc/llvm-project?rev=248159&view=rev
Log:
Add image attribute getter builtins

Added get_image_* OpenCL builtins to the headers.
Added implementation to the r600 target.

Patch by: Zoltan Gilian

Added:
libclc/trunk/generic/include/clc/image/
libclc/trunk/generic/include/clc/image/image.h
libclc/trunk/generic/lib/image/
libclc/trunk/generic/lib/image/get_image_dim.cl
libclc/trunk/r600/lib/image/
libclc/trunk/r600/lib/image/get_image_attributes_impl.ll
libclc/trunk/r600/lib/image/get_image_channel_data_type.cl
libclc/trunk/r600/lib/image/get_image_channel_order.cl
libclc/trunk/r600/lib/image/get_image_depth.cl
libclc/trunk/r600/lib/image/get_image_height.cl
libclc/trunk/r600/lib/image/get_image_width.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
libclc/trunk/r600/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=248159&r1=248158&r2=248159&view=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon Sep 21 09:47:53 2015
@@ -210,6 +210,10 @@
 #include 
 #include 
 
+/* 6.11.13 Image Read and Write Functions */
+
+#include 
+
 /* libclc internal defintions */
 #ifdef __CLC_INTERNAL
 #include 

Added: libclc/trunk/generic/include/clc/image/image.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/image/image.h?rev=248159&view=auto
==
--- libclc/trunk/generic/include/clc/image/image.h (added)
+++ libclc/trunk/generic/include/clc/image/image.h Mon Sep 21 09:47:53 2015
@@ -0,0 +1,16 @@
+_CLC_OVERLOAD _CLC_DECL int get_image_width (image2d_t image);
+_CLC_OVERLOAD _CLC_DECL int get_image_width (image3d_t image);
+
+_CLC_OVERLOAD _CLC_DECL int get_image_height (image2d_t image);
+_CLC_OVERLOAD _CLC_DECL int get_image_height (image3d_t image);
+
+_CLC_OVERLOAD _CLC_DECL int get_image_depth (image3d_t image);
+
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image2d_t image);
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image3d_t image);
+
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image2d_t image);
+_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image3d_t image);
+
+_CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image);
+_CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=248159&r1=248158&r2=248159&view=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon Sep 21 09:47:53 2015
@@ -133,3 +133,4 @@ shared/vload.cl
 shared/vstore.cl
 workitem/get_global_id.cl
 workitem/get_global_size.cl
+image/get_image_dim.cl

Added: libclc/trunk/generic/lib/image/get_image_dim.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/image/get_image_dim.cl?rev=248159&view=auto
==
--- libclc/trunk/generic/lib/image/get_image_dim.cl (added)
+++ libclc/trunk/generic/lib/image/get_image_dim.cl Mon Sep 21 09:47:53 2015
@@ -0,0 +1,9 @@
+#include 
+
+_CLC_OVERLOAD _CLC_DEF int2 get_image_dim (image2d_t image) {
+  return (int2)(get_image_width(image), get_image_height(image));
+}
+_CLC_OVERLOAD _CLC_DEF int4 get_image_dim (image3d_t image) {
+  return (int4)(get_image_width(image), get_image_height(image),
+get_image_depth(image), 0);
+}

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=248159&r1=248158&r2=248159&view=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Mon Sep 21 09:47:53 2015
@@ -10,3 +10,9 @@ workitem/get_global_size.ll
 workitem/get_work_dim.ll
 synchronization/barrier.cl
 synchronization/barrier_impl.ll
+image/get_image_width.cl
+image/get_image_height.cl
+image/get_image_depth.cl
+image/get_image_channel_data_type.cl
+image/get_image_channel_order.cl
+image/get_image_attributes_impl.ll

Added: libclc/trunk/r600/lib/image/get_image_attributes_impl.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/image/get_image_attributes_impl.ll?rev=248159&view=auto
==
--- libclc/trunk/r600/lib/image/get_image_attributes_impl.ll (added)
+++ libclc/trunk/r600/lib/image/get_image_attributes_impl.ll Mon Sep 21 
09:47:53 2015
@@ -0,0 +1,87 @@
+%opencl.image2d_t = type opa

[libclc] r248161 - r600: Add image writing builtins.

2015-09-21 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Sep 21 09:59:56 2015
New Revision: 248161

URL: http://llvm.org/viewvc/llvm-project?rev=248161&view=rev
Log:
r600: Add image writing builtins.

Patch by: Zoltan Gilian

Added:
libclc/trunk/r600/lib/image/write_image_impl.ll
libclc/trunk/r600/lib/image/write_imagef.cl
libclc/trunk/r600/lib/image/write_imagei.cl
libclc/trunk/r600/lib/image/write_imageui.cl
Modified:
libclc/trunk/generic/include/clc/image/image.h
libclc/trunk/r600/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/image/image.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/image/image.h?rev=248161&r1=248160&r2=248161&view=diff
==
--- libclc/trunk/generic/include/clc/image/image.h (original)
+++ libclc/trunk/generic/include/clc/image/image.h Mon Sep 21 09:59:56 2015
@@ -15,6 +15,13 @@ _CLC_OVERLOAD _CLC_DECL int get_image_ch
 _CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image);
 _CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image);
 
+_CLC_OVERLOAD _CLC_DECL void
+write_imagef(image2d_t image, int2 coord, float4 color);
+_CLC_OVERLOAD _CLC_DECL void
+write_imagei(image2d_t image, int2 coord, int4 color);
+_CLC_OVERLOAD _CLC_DECL void
+write_imageui(image2d_t image, int2 coord, uint4 color);
+
 _CLC_OVERLOAD _CLC_DECL float4
 read_imagef(image2d_t image, sampler_t sampler, int2 coord);
 _CLC_OVERLOAD _CLC_DECL float4

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=248161&r1=248160&r2=248161&view=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Mon Sep 21 09:59:56 2015
@@ -20,3 +20,7 @@ image/read_imagef.cl
 image/read_imagei.cl
 image/read_imageui.cl
 image/read_image_impl.ll
+image/write_imagef.cl
+image/write_imagei.cl
+image/write_imageui.cl
+image/write_image_impl.ll

Added: libclc/trunk/r600/lib/image/write_image_impl.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/image/write_image_impl.ll?rev=248161&view=auto
==
--- libclc/trunk/r600/lib/image/write_image_impl.ll (added)
+++ libclc/trunk/r600/lib/image/write_image_impl.ll Mon Sep 21 09:59:56 2015
@@ -0,0 +1,52 @@
+%opencl.image2d_t = type opaque
+%opencl.image3d_t = type opaque
+
+declare i32 @llvm.OpenCL.image.get.resource.id.2d(
+  %opencl.image2d_t addrspace(1)*) nounwind readnone
+declare i32 @llvm.OpenCL.image.get.resource.id.3d(
+  %opencl.image3d_t addrspace(1)*) nounwind readnone
+
+declare void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord, 
i32 %rat_id)
+
+define void @__clc_write_imageui_2d(
+%opencl.image2d_t addrspace(1)* nocapture %img,
+<2 x i32> %coord, <4 x i32> %color) #0 {
+
+  ; Coordinate int2 -> int4.
+  %e0 = extractelement <2 x i32> %coord, i32 0
+  %e1 = extractelement <2 x i32> %coord, i32 1
+  %coord.0 = insertelement <4 x i32> undef,i32 %e0, i32 0
+  %coord.1 = insertelement <4 x i32> %coord.0, i32 %e1, i32 1
+  %coord.2 = insertelement <4 x i32> %coord.1, i32 0,  i32 2
+  %coord.3 = insertelement <4 x i32> %coord.2, i32 0,  i32 3
+
+  ; Get RAT ID.
+  %img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d(
+  %opencl.image2d_t addrspace(1)* %img)
+  %rat_id = add i32 %img_id, 1
+
+  ; Call store intrinsic.
+  call void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord.3, 
i32 %rat_id)
+  ret void
+}
+
+define void @__clc_write_imagei_2d(
+%opencl.image2d_t addrspace(1)* nocapture %img,
+<2 x i32> %coord, <4 x i32> %color) #0 {
+  call void @__clc_write_imageui_2d(
+  %opencl.image2d_t addrspace(1)* nocapture %img,
+  <2 x i32> %coord, <4 x i32> %color)
+  ret void
+}
+
+define void @__clc_write_imagef_2d(
+%opencl.image2d_t addrspace(1)* nocapture %img,
+<2 x i32> %coord, <4 x float> %color) #0 {
+  %color.i32 = bitcast <4 x float> %color to <4 x i32>
+  call void @__clc_write_imageui_2d(
+  %opencl.image2d_t addrspace(1)* nocapture %img,
+  <2 x i32> %coord, <4 x i32> %color.i32)
+  ret void
+}
+
+attributes #0 = { alwaysinline }

Added: libclc/trunk/r600/lib/image/write_imagef.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/image/write_imagef.cl?rev=248161&view=auto
==
--- libclc/trunk/r600/lib/image/write_imagef.cl (added)
+++ libclc/trunk/r600/lib/image/write_imagef.cl Mon Sep 21 09:59:56 2015
@@ -0,0 +1,9 @@
+#include 
+
+_CLC_DECL void __clc_write_imagef_2d(image2d_t image, int2 coord, float4 
color);
+
+_CLC_OVERLOAD _CLC_DEF void
+write_imagef(image2d_t image, int2 coord, float4 color)
+{
+  __clc_write_imagef_2d(image, coord, color);
+}

Added: libclc/trunk/r600/lib/image/write_imagei.cl
URL: 
http://llvm.org/viewvc/llvm-project/libc

[libclc] r248160 - r600: Add image reading builtins.

2015-09-21 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Sep 21 09:59:54 2015
New Revision: 248160

URL: http://llvm.org/viewvc/llvm-project?rev=248160&view=rev
Log:
r600: Add image reading builtins.

Patch by: Zoltan Gilian

Added:
libclc/trunk/r600/lib/image/read_image_impl.ll
libclc/trunk/r600/lib/image/read_imagef.cl
libclc/trunk/r600/lib/image/read_imagei.cl
libclc/trunk/r600/lib/image/read_imageui.cl
Modified:
libclc/trunk/generic/include/clc/image/image.h
libclc/trunk/r600/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/image/image.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/image/image.h?rev=248160&r1=248159&r2=248160&view=diff
==
--- libclc/trunk/generic/include/clc/image/image.h (original)
+++ libclc/trunk/generic/include/clc/image/image.h Mon Sep 21 09:59:54 2015
@@ -14,3 +14,16 @@ _CLC_OVERLOAD _CLC_DECL int get_image_ch
 
 _CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image);
 _CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image);
+
+_CLC_OVERLOAD _CLC_DECL float4
+read_imagef(image2d_t image, sampler_t sampler, int2 coord);
+_CLC_OVERLOAD _CLC_DECL float4
+read_imagef(image2d_t image, sampler_t sampler, float2 coord);
+_CLC_OVERLOAD _CLC_DECL int4
+read_imagei(image2d_t image, sampler_t sampler, int2 coord);
+_CLC_OVERLOAD _CLC_DECL int4
+read_imagei(image2d_t image, sampler_t sampler, float2 coord);
+_CLC_OVERLOAD _CLC_DECL uint4
+read_imageui(image2d_t image, sampler_t sampler, int2 coord);
+_CLC_OVERLOAD _CLC_DECL uint4
+read_imageui(image2d_t image, sampler_t sampler, float2 coord);

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=248160&r1=248159&r2=248160&view=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Mon Sep 21 09:59:54 2015
@@ -16,3 +16,7 @@ image/get_image_depth.cl
 image/get_image_channel_data_type.cl
 image/get_image_channel_order.cl
 image/get_image_attributes_impl.ll
+image/read_imagef.cl
+image/read_imagei.cl
+image/read_imageui.cl
+image/read_image_impl.ll

Added: libclc/trunk/r600/lib/image/read_image_impl.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/image/read_image_impl.ll?rev=248160&view=auto
==
--- libclc/trunk/r600/lib/image/read_image_impl.ll (added)
+++ libclc/trunk/r600/lib/image/read_image_impl.ll Mon Sep 21 09:59:54 2015
@@ -0,0 +1,46 @@
+%opencl.image2d_t = type opaque
+
+declare <4 x float> @llvm.R600.tex(<4 x float>, i32, i32, i32, i32, i32, i32,
+   i32, i32, i32) readnone
+declare i32 @llvm.OpenCL.image.get.resource.id.2d(
+  %opencl.image2d_t addrspace(1)*) nounwind readnone
+declare i32 @llvm.OpenCL.sampler.get.resource.id(i32) readnone
+
+define <4 x float> @__clc_v4f_from_v2f(<2 x float> %v) alwaysinline {
+  %e0 = extractelement <2 x float> %v, i32 0
+  %e1 = extractelement <2 x float> %v, i32 1
+  %res.0 = insertelement <4 x float> undef,  float %e0, i32 0
+  %res.1 = insertelement <4 x float> %res.0, float %e1, i32 1
+  %res.2 = insertelement <4 x float> %res.1, float 0.0, i32 2
+  %res.3 = insertelement <4 x float> %res.2, float 0.0, i32 3
+  ret <4 x float> %res.3
+}
+
+define <4 x float> @__clc_read_imagef_tex(
+%opencl.image2d_t addrspace(1)* nocapture %img,
+i32 %sampler, <2 x float> %coord) alwaysinline {
+entry:
+  %coord_v4 = call <4 x float> @__clc_v4f_from_v2f(<2 x float> %coord)
+  %smp_id = call i32 @llvm.OpenCL.sampler.get.resource.id(i32 %sampler)
+  %img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d(
+  %opencl.image2d_t addrspace(1)* %img)
+  %tex_id = add i32 %img_id, 2; First 2 IDs are reserved.
+
+  %coord_norm = and i32 %sampler, 1
+  %is_norm = icmp eq i32 %coord_norm, 1
+  br i1 %is_norm, label %NormCoord, label %UnnormCoord
+NormCoord:
+  %data.norm = call <4 x float> @llvm.R600.tex(
+  <4 x float> %coord_v4,
+  i32 0, i32 0, i32 0,; Offset.
+  i32 2, i32 %smp_id,
+  i32 1, i32 1, i32 1, i32 1) ; Normalized coords.
+  ret <4 x float> %data.norm
+UnnormCoord:
+  %data.unnorm = call <4 x float> @llvm.R600.tex(
+  <4 x float> %coord_v4,
+  i32 0, i32 0, i32 0,; Offset.
+  i32 %tex_id, i32 %smp_id,
+  i32 0, i32 0, i32 0, i32 0) ; Unnormalized coords.
+  ret <4 x float> %data.unnorm
+}

Added: libclc/trunk/r600/lib/image/read_imagef.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/image/read_imagef.cl?rev=248160&view=auto
==
--- libclc/trunk/r600/lib/image/read_imagef.cl (added)
+++ libclc/trunk/r600/lib/image/read_imagef.cl Mon Sep 21 09:59:54 2015
@@ -0,0 +1,14 @@
+#include 
+
+_CLC_DECL float4 __clc_read_imagef_tex(image2d_t, sampler_t,

[libclc] r248162 - Add image attribute defines.

2015-09-21 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Sep 21 09:59:57 2015
New Revision: 248162

URL: http://llvm.org/viewvc/llvm-project?rev=248162&view=rev
Log:
Add image attribute defines.

Patch by: Zoltan Gilian

Added:
libclc/trunk/generic/include/clc/image/image_defines.h
Modified:
libclc/trunk/generic/include/clc/clc.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=248162&r1=248161&r2=248162&view=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon Sep 21 09:59:57 2015
@@ -212,6 +212,7 @@
 
 /* 6.11.13 Image Read and Write Functions */
 
+#include 
 #include 
 
 /* libclc internal defintions */

Added: libclc/trunk/generic/include/clc/image/image_defines.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/image/image_defines.h?rev=248162&view=auto
==
--- libclc/trunk/generic/include/clc/image/image_defines.h (added)
+++ libclc/trunk/generic/include/clc/image/image_defines.h Mon Sep 21 09:59:57 
2015
@@ -0,0 +1,31 @@
+/* get_image_channel_data_type flags */
+#define CLK_SNORM_INT8   0x10D0
+#define CLK_SNORM_INT16  0x10D1
+#define CLK_UNORM_INT8   0x10D2
+#define CLK_UNORM_INT16  0x10D3
+#define CLK_UNORM_SHORT_565  0x10D4
+#define CLK_UNORM_SHORT_555  0x10D5
+#define CLK_UNORM_SHORT_101010   0x10D6
+#define CLK_SIGNED_INT8  0x10D7
+#define CLK_SIGNED_INT16 0x10D8
+#define CLK_SIGNED_INT32 0x10D9
+#define CLK_UNSIGNED_INT80x10DA
+#define CLK_UNSIGNED_INT16   0x10DB
+#define CLK_UNSIGNED_INT32   0x10DC
+#define CLK_HALF_FLOAT   0x10DD
+#define CLK_FLOAT0x10DE
+
+/* get_image_channel_order flags */
+#define CLK_R0x10B0
+#define CLK_A0x10B1
+#define CLK_RG   0x10B2
+#define CLK_RA   0x10B3
+#define CLK_RGB  0x10B4
+#define CLK_RGBA 0x10B5
+#define CLK_BGRA 0x10B6
+#define CLK_ARGB 0x10B7
+#define CLK_INTENSITY0x10B8
+#define CLK_LUMINANCE0x10B9
+#define CLK_Rx   0x10BA
+#define CLK_RGx  0x10BB
+#define CLK_RGBx 0x10BC


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


[libclc] r248163 - Add sampler defines.

2015-09-21 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Sep 21 09:59:58 2015
New Revision: 248163

URL: http://llvm.org/viewvc/llvm-project?rev=248163&view=rev
Log:
Add sampler defines.

Patch by: Zoltan Gilian

Modified:
libclc/trunk/generic/include/clc/image/image_defines.h

Modified: libclc/trunk/generic/include/clc/image/image_defines.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/image/image_defines.h?rev=248163&r1=248162&r2=248163&view=diff
==
--- libclc/trunk/generic/include/clc/image/image_defines.h (original)
+++ libclc/trunk/generic/include/clc/image/image_defines.h Mon Sep 21 09:59:58 
2015
@@ -29,3 +29,21 @@
 #define CLK_Rx   0x10BA
 #define CLK_RGx  0x10BB
 #define CLK_RGBx 0x10BC
+
+/* sampler normalized coords */
+#define CLK_NORMALIZED_COORDS_FALSE  0x
+#define CLK_NORMALIZED_COORDS_TRUE   0x0001
+#define __CLC_NORMALIZED_COORDS_MASK 0x0001
+
+/* sampler addressing mode */
+#define CLK_ADDRESS_NONE 0x
+#define CLK_ADDRESS_CLAMP_TO_EDGE0x0002
+#define CLK_ADDRESS_CLAMP0x0004
+#define CLK_ADDRESS_REPEAT   0x0006
+#define CLK_ADDRESS_MIRRORED_REPEAT  0x0008
+#define __CLC_ADDRESS_MASK   0x000E
+
+/* sampler filter mode */
+#define CLK_FILTER_NEAREST   0x
+#define CLK_FILTER_LINEAR0x0010
+#define __CLC_FILTER_MASK0x0010


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


Re: [PATCH] D12482: Analyzer: Teach analyzer how to handle TypeTraitExpr

2015-09-21 Thread Ismail Pazarbasi via cfe-commits
ismailp added a comment.

Ping!


http://reviews.llvm.org/D12482



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


Re: r248142 - clang/test/Modules/DebugInfoSubmodules.c REQUIRES asserts due to -debug-only.

2015-09-21 Thread Adrian Prantl via cfe-commits
Thanks for fixing this!

-- adrian
> On Sep 20, 2015, at 11:57 PM, NAKAMURA Takumi via cfe-commits 
>  wrote:
> 
> Author: chapuni
> Date: Mon Sep 21 01:57:36 2015
> New Revision: 248142
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=248142&view=rev
> Log:
> clang/test/Modules/DebugInfoSubmodules.c REQUIRES asserts due to -debug-only.
> 
> Modified:
>cfe/trunk/test/Modules/DebugInfoSubmodules.c
> 
> Modified: cfe/trunk/test/Modules/DebugInfoSubmodules.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoSubmodules.c?rev=248142&r1=248141&r2=248142&view=diff
> ==
> --- cfe/trunk/test/Modules/DebugInfoSubmodules.c (original)
> +++ cfe/trunk/test/Modules/DebugInfoSubmodules.c Mon Sep 21 01:57:36 2015
> @@ -2,6 +2,7 @@
> // RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
> // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \
> // RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
> +// REQUIRES: asserts
> #include "DebugSubmoduleA.h"
> 
> // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A",
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] D12633: Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets

2015-09-21 Thread Alexandros Lamprineas via cfe-commits
labrinea added a comment.

@rsmith @t.p.northover could you please give us some feedback on this? Thanks.


http://reviews.llvm.org/D12633



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


Re: [PATCH] D12689: [libc++][static linking] std streams are not initialized prior to their use in static object constructors

2015-09-21 Thread Evgeny Astigeevich via cfe-commits
eastig added a comment.

Ping.


http://reviews.llvm.org/D12689



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


Re: [PATCH] D12192: Add clang support for AAP

2015-09-21 Thread Edward Jones via cfe-commits
edward-jones updated this revision to Diff 35263.
edward-jones added a comment.

This rolls the clang patch for AAP forwards to top of tree.


http://reviews.llvm.org/D12192

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  lib/Headers/float.h

Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -74,7 +74,14 @@
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#define FLT_ROUNDS (__builtin_flt_rounds())
+
+/* __builtin_flt_rounds is not supported by AAP, and the rounding mode cannot
+   be changed anyway so we just default to 'to nearest' */
+#ifdef __AAP__
+  #define FLT_ROUNDS 1
+#else
+  #define FLT_ROUNDS (__builtin_flt_rounds())
+#endif
 #define FLT_RADIX __FLT_RADIX__
 
 #define FLT_MANT_DIG __FLT_MANT_DIG__
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -57,6 +57,8 @@
const InputInfo &Output,
const InputInfoList &Inputs) const;
 
+  void AddAAPTargetArgs(const llvm::opt::ArgList &Args,
+llvm::opt::ArgStringList &CmdArgs) const;
   void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
 llvm::opt::ArgStringList &CmdArgs) const;
   void AddARMTargetArgs(const llvm::Triple &Triple,
@@ -826,6 +828,34 @@
 };
 } // end namespace Myriad
 
+namespace AAP {
+  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
+  public:
+Assemble(const ToolChain &TC) : Tool("AAP::Assemble", "aap-as", TC)
+{}
+
+bool hasIntegratedCPP() const override { return false; }
+void ConstructJob(Compilation &C, const JobAction &JA,
+  const InputInfo &Output,
+  const InputInfoList &Inputs,
+  const llvm::opt::ArgList &TCArgs,
+  const char *LinkingOutput) const override;
+  };
+  class LLVM_LIBRARY_VISIBILITY Link : public Tool {
+  public:
+Link(const ToolChain &TC) : Tool("AAP::Link", "aap-ld", TC)
+{}
+
+bool hasIntegratedCPP() const override { return false; }
+bool isLinkJob() const override { return true; }
+void ConstructJob(Compilation &C, const JobAction &JA,
+  const InputInfo &Output,
+  const InputInfoList &Inputs,
+  const llvm::opt::ArgList &TCArgs,
+  const char *LinkingOutput) const override;
+  };
+} // end namespace AAP
+
 } // end namespace tools
 } // end namespace driver
 } // end namespace clang
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1930,6 +1930,11 @@
   CmdArgs.push_back("-machine-sink-split=0");
 }
 
+void Clang::AddAAPTargetArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+  return;
+}
+
 // Decode AArch64 features from string like +[no]featureA+[no]featureB+...
 static bool DecodeAArch64Features(const Driver &D, StringRef text,
   std::vector &Features) {
@@ -2636,8 +2641,10 @@
   case llvm::Triple::xcore:
   case llvm::Triple::wasm32:
   case llvm::Triple::wasm64:
+  case llvm::Triple::aap:
 // XCore never wants frame pointers, regardless of OS.
 // WebAssembly never wants frame pointers.
+// AAP never wants frame pointers
 return false;
   default:
 break;
@@ -3671,6 +3678,10 @@
   default:
 break;
 
+  case llvm::Triple::aap:
+AddAAPTargetArgs(Args, CmdArgs);
+break;
+
   case llvm::Triple::arm:
   case llvm::Triple::armeb:
   case llvm::Triple::thumb:
@@ -9815,3 +9826,71 @@
   C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Exec),
   CmdArgs, Inputs));
 }
+
+void AAP::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+  ArgStringList CmdArgs;
+
+  // Add input assembly files to command line
+  for (InputInfoList::const_iterator it = Inputs.begin(), ie = Inputs.end();
+   it != ie;
+   ++it) {
+const InputInfo &II = *it;
+CmdArgs.push_back(II.getFilename());
+  }
+
+  const char *Exec =
+Args.MakeArgString(getToolChain().GetProgramPath("aap-as"));
+
+  C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
+}
+
+void AAP::Link::ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+

Re: [PATCH] D12832: [Driver] Add support for Windows 10 SDK

2015-09-21 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

Ping...


http://reviews.llvm.org/D12832



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


Re: [PATCH] D12689: [libc++][static linking] std streams are not initialized prior to their use in static object constructors

2015-09-21 Thread Reid Kleckner via cfe-commits
I think you need to address the feedback about avoiding dynamic
initialization on stock non-Mac systems.

Sent from phone
On Sep 21, 2015 8:33 AM, "Evgeny Astigeevich" 
wrote:

> eastig added a comment.
>
> Ping.
>
>
> http://reviews.llvm.org/D12689
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12689: [libc++][static linking] std streams are not initialized prior to their use in static object constructors

2015-09-21 Thread Evgeny Astigeevich via cfe-commits
eastig added a comment.

In http://reviews.llvm.org/D12689#249899, @rnk wrote:

> I think you need to address the feedback about avoiding dynamic
>  initialization on stock non-Mac systems.
>
> Sent from phone


In my comment above I proposed a special macro to distinguish between dynamic 
and static linking:

> In the patch the `__APPLE__` macro is used to have the old behaviour. Maybe 
> instead of it another macro, e.g. `__STATIC_BUILD__`, can be use when we want 
> to build a static library.


Is it good to have such a macro?


http://reviews.llvm.org/D12689



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


Re: [PATCH] D13013: [ARM] Fix crash "-target arm -mcpu=generic", without "-march="

2015-09-21 Thread Renato Golin via cfe-commits
rengolin added a comment.

Hi Vladmir,

Can you explain what the crash was?

cheers,
--renato


Repository:
  rL LLVM

http://reviews.llvm.org/D13013



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


r248173 - Revert "[ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def"

2015-09-21 Thread James Molloy via cfe-commits
Author: jamesm
Date: Mon Sep 21 11:34:58 2015
New Revision: 248173

URL: http://llvm.org/viewvc/llvm-project?rev=248173&view=rev
Log:
Revert "[ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def"

This was committed without the code review (http://reviews.llvm.org/D12938) 
being approved.

This reverts commit r248154.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=248173&r1=248172&r2=248173&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Sep 21 11:34:58 2015
@@ -4121,7 +4121,6 @@ class ARMTargetInfo : public TargetInfo
 
   unsigned CRC : 1;
   unsigned Crypto : 1;
-  unsigned T2DSP : 1;
   unsigned Unaligned : 1;
 
   enum {
@@ -4473,7 +4472,6 @@ public:
 FPU = 0;
 CRC = 0;
 Crypto = 0;
-T2DSP = 0;
 Unaligned = 1;
 SoftFloat = SoftFloatABI = false;
 HWDiv = 0;
@@ -4509,8 +4507,6 @@ public:
 CRC = 1;
   } else if (Feature == "+crypto") {
 Crypto = 1;
-  } else if (Feature == "+t2dsp") {
-T2DSP = 1;
   } else if (Feature == "+fp-only-sp") {
 HW_FP_remove |= HW_FP_DP | HW_FP_HP;
   } else if (Feature == "+strict-align") {
@@ -4747,7 +4743,11 @@ public:
 
 // ACLE 6.4.7 DSP instructions
 bool hasDSP = false;
-if (T2DSP) {
+bool is5EOrAbove = (ArchVersion >= 6 ||
+   (ArchVersion == 5 && CPUAttr.count('E')));
+// FIXME: We are not getting all 32-bit ARM architectures
+bool is32Bit = (!isThumb() || supportsThumb2());
+if (is5EOrAbove && is32Bit && (CPUProfile != "M" || CPUAttr  == "7EM")) {
   Builder.defineMacro("__ARM_FEATURE_DSP", "1");
   hasDSP = true;
 }

Modified: cfe/trunk/test/CodeGen/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=248173&r1=248172&r2=248173&view=diff
==
--- cfe/trunk/test/CodeGen/arm-target-features.c (original)
+++ cfe/trunk/test/CodeGen/arm-target-features.c Mon Sep 21 11:34:58 2015
@@ -1,15 +1,15 @@
 // REQUIRES: arm-registered-target
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
-// CHECK-VFP3: "target-features"="+neon,+t2dsp,+vfp3"
+// CHECK-VFP3: "target-features"="+neon,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a9 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-FP16
-// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+t2dsp,+vfp3"
+// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+vfp3"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
-// CHECK-VFP4: "target-features"="+neon,+t2dsp,+vfp4"
+// CHECK-VFP4: "target-features"="+neon,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
@@ -18,41 +18,39 @@
 // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm 
-o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
-// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+t2dsp,+vfp4"
+// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+vfp4"
 
 
 // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
-// CHECK-BASIC-V8: 
"target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon,+t2dsp"
+// CHECK-BASIC-V8: 
"target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon"
 
 
 // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r5 
-emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-DIV
-// CHECK-VFP3-D16-DIV: "target-features"="+d16,+hwdiv,+hwdiv-arm,+t2dsp,+vfp3"
+// CHECK-VFP3-D16-DIV: "target-features"="+d16,+hwdiv,+hwdiv-arm,+vfp3"
 
 
 // RUN: %clang_cc1 -triple armv7-linux-gnueabi -target-cpu cortex-r4f 
-emit-llvm -o - %s | FileCheck %s --chec

Re: [PATCH] D10370: clang-format: Implement AlwaysBreakAfterDeclarationReturnType.

2015-09-21 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Maintenance is not about writing 7 lines of code correctly, but ensuring that 
all these options work correctly and in combination with all other options and 
that options remain discoverable and well documented. So, please change this to 
using the one enum with 5 configuration values.


http://reviews.llvm.org/D10370



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


Re: r248154 - [ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def

2015-09-21 Thread James Molloy via cfe-commits
Hi Artyom,

I have reverted this in r248173 because the pre-commmit review was not
completed.

Cheers,

James

On Mon, 21 Sep 2015 at 06:20 Artyom Skrobov via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: askrobov
> Date: Mon Sep 21 08:19:25 2015
> New Revision: 248154
>
> URL: http://llvm.org/viewvc/llvm-project?rev=248154&view=rev
> Log:
> [ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def
>
> Currently, the availability of DSP instructions (ACLE 6.4.7) is handled in
> a hand-rolled tricky condition block in lib/Basic/Targets.cpp, with a
> FIXME:
> attached.
>
> http://reviews.llvm.org/D12937 moved the handling of +t2dsp over to
> ARMTargetParser.def in LLVM, to be in line with other architecture
> extensions.
>
> This is the corresponding patch to clang, to clear the FIXME: and update
> the tests.
>
> Differential Revision: http://reviews.llvm.org/D12938
>
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/CodeGen/arm-target-features.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=248154&r1=248153&r2=248154&view=diff
>
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Mon Sep 21 08:19:25 2015
> @@ -4121,6 +4121,7 @@ class ARMTargetInfo : public TargetInfo
>
>unsigned CRC : 1;
>unsigned Crypto : 1;
> +  unsigned T2DSP : 1;
>unsigned Unaligned : 1;
>
>enum {
> @@ -4472,6 +4473,7 @@ public:
>  FPU = 0;
>  CRC = 0;
>  Crypto = 0;
> +T2DSP = 0;
>  Unaligned = 1;
>  SoftFloat = SoftFloatABI = false;
>  HWDiv = 0;
> @@ -4507,6 +4509,8 @@ public:
>  CRC = 1;
>} else if (Feature == "+crypto") {
>  Crypto = 1;
> +  } else if (Feature == "+t2dsp") {
> +T2DSP = 1;
>} else if (Feature == "+fp-only-sp") {
>  HW_FP_remove |= HW_FP_DP | HW_FP_HP;
>} else if (Feature == "+strict-align") {
> @@ -4743,11 +4747,7 @@ public:
>
>  // ACLE 6.4.7 DSP instructions
>  bool hasDSP = false;
> -bool is5EOrAbove = (ArchVersion >= 6 ||
> -   (ArchVersion == 5 && CPUAttr.count('E')));
> -// FIXME: We are not getting all 32-bit ARM architectures
> -bool is32Bit = (!isThumb() || supportsThumb2());
> -if (is5EOrAbove && is32Bit && (CPUProfile != "M" || CPUAttr  ==
> "7EM")) {
> +if (T2DSP) {
>Builder.defineMacro("__ARM_FEATURE_DSP", "1");
>hasDSP = true;
>  }
>
> Modified: cfe/trunk/test/CodeGen/arm-target-features.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=248154&r1=248153&r2=248154&view=diff
>
> ==
> --- cfe/trunk/test/CodeGen/arm-target-features.c (original)
> +++ cfe/trunk/test/CodeGen/arm-target-features.c Mon Sep 21 08:19:25 2015
> @@ -1,15 +1,15 @@
>  // REQUIRES: arm-registered-target
>
>  // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
> -// CHECK-VFP3: "target-features"="+neon,+vfp3"
> +// CHECK-VFP3: "target-features"="+neon,+t2dsp,+vfp3"
>
>
>  // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a9
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-FP16
> -// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+vfp3"
> +// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+t2dsp,+vfp3"
>
>
>  // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
> -// CHECK-VFP4: "target-features"="+neon,+vfp4"
> +// CHECK-VFP4: "target-features"="+neon,+t2dsp,+vfp4"
>
>
>  // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
> @@ -18,39 +18,41 @@
>  // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
>  // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
>  // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
> -// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+vfp4"
> +// CHECK-VFP4-DIV:
> "target-features"="+hwdiv,+hwdiv-arm,+neon,+t2dsp,+vfp4"
>
>
>  // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
>  // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
>  // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57
> -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
>  // RU

Re: [PATCH] D12633: Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets

2015-09-21 Thread Renato Golin via cfe-commits
rengolin added a comment.

Richard,

The original patch was following a lot from the AArch64, so I suspect we should 
first fix the AArch64 side, so that we can follow in a similar way. I don't 
want to have two different behaviour for ARM and AArch64 regarding macros and 
ACLE support. But I also don't think we should include AArch64 code with this 
patch.

cheers,
--renato


http://reviews.llvm.org/D12633



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


Re: [PATCH] D13013: [ARM] Fix crash "-target arm -mcpu=generic", without "-march="

2015-09-21 Thread Vladimir Sukharev via cfe-commits
vsukharev added a comment.

Yes, trying to pass new tests in test/Driver/arm-cortex-cpus.c, without code 
patch, it crashes

  $ clang --target=arm-linux-gnueabi -mcpu=generic hello.c
  /work/oss_llvm/llvm/include/llvm/ADT/StringRef.h:84: 
llvm::StringRef::StringRef(const char*, size_t): Assertion `(data || length == 
0) && "StringRef cannot be built from a NULL argument with non-null length"' 
failed.
  ...
  #9 0x2b22f25 (anonymous namespace)::._115::getSubArch() const 
lib/Support/TargetParser.cpp:74:0
  #10 0x2b27147 llvm::ARM::getSubArch(unsigned int) 
lib/Support/TargetParser.cpp:309:0
  #11 0x31871a1 
clang::driver::tools::arm::getLLVMArchSuffixForARM(llvm::StringRef, 
llvm::StringRef) tools/clang/lib/Driver/Tools.cpp:6374:0
  #12 0x3125da8 clang::driver::ToolChain::ComputeLLVMTriple(llvm::opt::ArgList 
const&, clang::driver::types::ID) const 
tools/clang/lib/Driver/ToolChain.cpp:321:0
  #13 0x312656c 
clang::driver::ToolChain::ComputeEffectiveClangTriple(llvm::opt::ArgList 
const&, clang::driver::types::ID) const 
tools/clang/lib/Driver/ToolChain.cpp:353:0
  #14 0x31726b1 
clang::driver::tools::Clang::ConstructJob(clang::driver::Compilation&, 
clang::driver::JobAction const&, clang::driver::InputInfo const&, 
llvm::SmallVector const&, llvm::opt::ArgList 
const&, char const*) const tools/clang/lib/Driver/Tools.cpp:3363:0


Repository:
  rL LLVM

http://reviews.llvm.org/D13013



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


Re: [PATCH] D12761: MPI-Checker patch for Clang Static Analyzer

2015-09-21 Thread Alexander Droste via cfe-commits
Alexander_Droste added inline comments.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp:137
@@ +136,3 @@
+
+  // This is never reached...
+  llvm::outs() << ""

Alexander_Droste wrote:
> I figured out what the problem about the request retrieval is:
> `REGISTER_MAP_WITH_PROGRAMSTATE(RequestMap, const 
> clang::ento::clang::mpi::Request)`
> The documentation states: "The macro should not be used inside namespaces, or 
> for traits that must
> be accessible from more than one translation unit." I think I need some 
> advice here, how to make the  
> same RequestMap accessible in multiple translation units.
How about this: 
We could capture the `PathDiagnosticLocation` of the LastUser in each 
`mpi::Request` as a member. The `RequestMap` could then be local to 
`MPICheckerPathSensitive.cpp` and no visitors would be needed. The bug reporter 
class would then not need to know anything about the request map. The only 
function I can't find to realise this concept would be something like: 
`Report->addPathDiagnosticLocation()`.


http://reviews.llvm.org/D12761



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


Re: [PATCH] D12633: Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets

2015-09-21 Thread Richard Barton via cfe-commits
richard.barton.arm added a comment.

Yes - I would be interested in knowing the rationale behind the original 
AArch64 setting of __ARM_FP_FPENV_ROUNDING.

I also question whether our pre-conditions for __ARM_FP_FAST are sufficient. 
There are many -f... options relating to maths operations, are these two the 
only ones that might not preserve the order of operations? I think clang ought 
to take a conservative stance when setting these flags.


http://reviews.llvm.org/D12633



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


Re: [PATCH] D12633: Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets

2015-09-21 Thread Renato Golin via cfe-commits
rengolin added a comment.

In http://reviews.llvm.org/D12633#249966, @richard.barton.arm wrote:

> I think clang ought to take a conservative stance when setting these flags.


Exactly my point. This is one of the few examples where being pragmatic may 
lead to big headaches in the future. :)


http://reviews.llvm.org/D12633



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


Re: r248154 - [ARM] Handle +t2dsp feature as an ArchExtKind in ARMTargetParser.def

2015-09-21 Thread Renato Golin via cfe-commits
On 21 September 2015 at 09:37, James Molloy via cfe-commits
 wrote:
> I have reverted this in r248173 because the pre-commmit review was not
> completed.

Thanks James!

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


Re: [PATCH] __attribute__((enable_if)) and non-overloaded member functions

2015-09-21 Thread Ettore Speziale via cfe-commits
Hello,

sorry for the late reply, I did not note this email …


> Sure. :)  Review is based off the attachment I grabbed from here: 
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150824/136904.html

That’s correct.

> A few nits:
> - test/Sema/enable_if.cpp line 24: Please use __attribute__(( instead of 
> __attribute((
> - Can we have a similar test for a function that returns an Incomplete? 

Sure. Also in that case, only the error about Incomplete is reported. Please 
check the attached patch.



enable_if.diff
Description: Binary data


Thank you very much,
Ettore Speziale___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

2015-09-21 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Sep 21 12:48:37 2015
New Revision: 248184

URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev
Log:
Debug Info: When building a module, emit skeleton CUs for imported modules.

Added:
cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
@@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
 
 llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
   ExternalASTSource::ASTSourceDescriptor Info;
-  if (ClangModuleMap) {
+  if (DebugTypeExtRefs && D->isFromASTFile()) {
+// Record a reference to an imported clang module or precompiled header.
+auto *Reader = CGM.getContext().getExternalSource();
+auto Idx = D->getOwningModuleID();
+auto Info = Reader->getSourceDescriptor(Idx);
+if (Info)
+  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
+  } else if (ClangModuleMap) {
 // We are building a clang module or a precompiled header.
 //
 // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
@@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
 }
   }
 
-  if (DebugTypeExtRefs && D->isFromASTFile()) {
-// Record a reference to an imported clang module or precompiled header.
-auto *Reader = CGM.getContext().getExternalSource();
-auto Idx = D->getOwningModuleID();
-auto Info = Reader->getSourceDescriptor(Idx);
-if (Info)
-  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
-  }
   return nullptr;
 }
 

Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
==
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21 
12:48:37 2015
@@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
   return !Ty->isDependentType() && !Ty->isUndeducedType();
 }
 
+bool VisitImportDecl(ImportDecl *D) {
+  auto *Import = cast(D);
+  if (!Import->getImportedOwningModule())
+DI.EmitImportDecl(*Import);
+  return true;
+}
+
 bool VisitTypeDecl(TypeDecl *D) {
   QualType QualTy = Ctx.getTypeDeclType(D);
   if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))

Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto
==
--- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)
+++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21 12:48:37 2015
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
+// RUN: -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
+// RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
+// REQUIRES: asserts
+
+@import diamond_left;
+
+// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top
+// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left
+// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,
+// CHECK-SAME:  entity: ![[MODULE:.*]], line: 3)
+// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"
+// CHECK: ![[TOP_SKEL_CU:.*]] = distinct 
!DICompileUnit({{.*}}diamond_top{{.*}}dwoId:
+


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


r248185 - Add a belated testcase for the skeleton CU behavior in r248062.

2015-09-21 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Sep 21 12:48:42 2015
New Revision: 248185

URL: http://llvm.org/viewvc/llvm-project?rev=248185&view=rev
Log:
Add a belated testcase for the skeleton CU behavior in r248062.

Modified:
cfe/trunk/test/Modules/debug-info-moduleimport.m

Modified: cfe/trunk/test/Modules/debug-info-moduleimport.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/debug-info-moduleimport.m?rev=248185&r1=248184&r2=248185&view=diff
==
--- cfe/trunk/test/Modules/debug-info-moduleimport.m (original)
+++ cfe/trunk/test/Modules/debug-info-moduleimport.m Mon Sep 21 12:48:42 2015
@@ -3,5 +3,23 @@
 
 // CHECK: ![[CU:.*]] = distinct !DICompileUnit
 @import DebugObjC;
-// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]], 
entity: ![[MODULE:.*]], line: 5)
-// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC", 
configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22", includePath: 
"{{.*}}test{{.*}}Modules{{.*}}Inputs", isysroot: "/tmp/..")
+// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]],
+// CHECK-SAME:  entity: ![[MODULE:.*]], line: 5)
+// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC",
+// CHECK-SAME:  configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22",
+// CHECK-SAME:  includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs",
+// CHECK-SAME:  isysroot: "/tmp/..")
+
+
+// RUN: %clang_cc1 -g -fmodules -fimplicit-module-maps -fmodules-cache-path=%t 
\
+// RUN:   %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \
+// RUN: | FileCheck %s --check-prefix=NO-SKEL-CHECK
+// NO-SKEL-CHECK: distinct !DICompileUnit
+// NO-SKEL-CHECK-NOT: distinct !DICompileUnit
+
+// RUN: %clang_cc1 -g -fmodules -fimplicit-module-maps -fmodules-cache-path=%t 
\
+// RUN:   -fmodule-format=obj -dwarf-ext-refs \
+// RUN:   %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \
+// RUN: | FileCheck %s --check-prefix=SKEL-CHECK
+// SKEL-CHECK: distinct !DICompileUnit
+// SKEL-CHECK: distinct !DICompileUnit{{.*}}dwoId


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


Re: r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

2015-09-21 Thread David Blaikie via cfe-commits
On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: adrian
> Date: Mon Sep 21 12:48:37 2015
> New Revision: 248184
>
> URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev
> Log:
> Debug Info: When building a module, emit skeleton CUs for imported modules.
>

This seems like it might add a reasonable amount more debug info - is it
necessary? Or could the debugger use the list of modules from the
referencing/original compilation unit as the dependency set to search?


>
> Added:
> cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
> @@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
>
>  llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
>ExternalASTSource::ASTSourceDescriptor Info;
> -  if (ClangModuleMap) {
> +  if (DebugTypeExtRefs && D->isFromASTFile()) {
> +// Record a reference to an imported clang module or precompiled
> header.
> +auto *Reader = CGM.getContext().getExternalSource();
> +auto Idx = D->getOwningModuleID();
> +auto Info = Reader->getSourceDescriptor(Idx);
> +if (Info)
> +  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
> +  } else if (ClangModuleMap) {
>  // We are building a clang module or a precompiled header.
>  //
>  // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
> @@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
>  }
>}
>
> -  if (DebugTypeExtRefs && D->isFromASTFile()) {
> -// Record a reference to an imported clang module or precompiled
> header.
> -auto *Reader = CGM.getContext().getExternalSource();
> -auto Idx = D->getOwningModuleID();
> -auto Info = Reader->getSourceDescriptor(Idx);
> -if (Info)
> -  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
> -  }
>return nullptr;
>  }
>
>
> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21
> 12:48:37 2015
> @@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
>return !Ty->isDependentType() && !Ty->isUndeducedType();
>  }
>
> +bool VisitImportDecl(ImportDecl *D) {
> +  auto *Import = cast(D);
> +  if (!Import->getImportedOwningModule())
> +DI.EmitImportDecl(*Import);
> +  return true;
> +}
> +
>  bool VisitTypeDecl(TypeDecl *D) {
>QualType QualTy = Ctx.getTypeDeclType(D);
>if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
>
> Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto
>
> ==
> --- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)
> +++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21 12:48:37
> 2015
> @@ -0,0 +1,15 @@
> +// RUN: rm -rf %t
> +// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
> +// RUN: -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
> +// RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
> +// REQUIRES: asserts
> +
> +@import diamond_left;
> +
> +// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top
> +// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left
> +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,
> +// CHECK-SAME:  entity: ![[MODULE:.*]], line: 3)
> +// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"
> +// CHECK: ![[TOP_SKEL_CU:.*]] = distinct
> !DICompileUnit({{.*}}diamond_top{{.*}}dwoId:
> +
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13004: Create a new attribute set when the definition is parsed after a declaration of a function

2015-09-21 Thread Duncan P. N. Exon Smith via cfe-commits

> On 2015-Sep-21, at 01:42, Akira Hatanaka via cfe-commits 
>  wrote:
> 
> ahatanak created this revision.
> ahatanak added a subscriber: cfe-commits.
> 
> An assert is triggered when the test case program is compiled with -Oz:
> 
> Assertion failed: (!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) && 
> "OptimizeNone and OptimizeForSize on same function!"), function 
> SetLLVMFunctionAttributesForDefinition, file 
> /Users/ahatanaka/projects/llvm/git/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp,
>  line 831.
> 
> This patch fixes the assert by clearing the attribute set attached to IR 
> function foo1 and creating it again when the function's definition is parsed.
> 
> http://reviews.llvm.org/D13004
> 
> Files:
>  lib/CodeGen/CodeGenModule.cpp
>  test/CodeGen/attr-func-def.c
> 
> Index: test/CodeGen/attr-func-def.c
> ===
> --- /dev/null
> +++ test/CodeGen/attr-func-def.c
> @@ -0,0 +1,18 @@
> +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o - %s 
> | FileCheck %s
> +
> +// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
> +// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
> +
> +int foo1(int);
> +
> +int foo2(int a) {
> +  return foo1(a + 2);
> +}
> +
> +__attribute__((optnone))
> +int foo1(int a) {
> +return a + 1;
> +}
> +
> +// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
> +// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }
> Index: lib/CodeGen/CodeGenModule.cpp
> ===
> --- lib/CodeGen/CodeGenModule.cpp
> +++ lib/CodeGen/CodeGenModule.cpp
> @@ -2643,6 +2643,11 @@
> 
>   maybeSetTrivialComdat(*D, *Fn);
> 
> +  // Create the attribute set of the function definition because it might 
> differ
> +  // from that of the function declaration. SetLLVMFunctionAttributes cannot 
> be
> +  // called after GenerateCode is called as it might remove the parameter
> +  // attributes attached by GenerateCode.
> +  SetLLVMFunctionAttributes(D, FI, Fn);

I'm a bit worried this could have a compile-time impact, since it will
regenerate all the attributes.  Why don't you just remove optsize if it's
attached to the function?

(All this attribute-setting is pretty horrible; one of us should fix it
soon.)

>   CodeGenFunction(*this).GenerateCode(D, Fn, FI);
> 
>   setFunctionDefinitionAttributes(D, Fn);
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] __attribute__((enable_if)) and non-overloaded member functions

2015-09-21 Thread George Burgess via cfe-commits
> sorry for the late reply, I did not note this email …

No problem! :)

It looks like the attached patch is the same as the original one?

George

On Mon, Sep 21, 2015 at 10:31 AM, Ettore Speziale  wrote:

> Hello,
>
> sorry for the late reply, I did not note this email …
>
>
> > Sure. :)  Review is based off the attachment I grabbed from here:
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150824/136904.html
>
> That’s correct.
>
> > A few nits:
> > - test/Sema/enable_if.cpp line 24: Please use __attribute__(( instead of
> __attribute((
> > - Can we have a similar test for a function that returns an Incomplete?
>
> Sure. Also in that case, only the error about Incomplete is reported.
> Please check the attached patch.
>
>
>
>
> Thank you very much,
> Ettore Speziale
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

2015-09-21 Thread Adrian Prantl via cfe-commits

> On Sep 21, 2015, at 10:59 AM, David Blaikie  wrote:
> 
> 
> 
> On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: adrian
> Date: Mon Sep 21 12:48:37 2015
> New Revision: 248184
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev 
> 
> Log:
> Debug Info: When building a module, emit skeleton CUs for imported modules.
> 
> This seems like it might add a reasonable amount more debug info - is it 
> necessary? Or could the debugger use the list of modules from the 
> referencing/original compilation unit as the dependency set to search?

The advantage of having this info in the modules is that it makes 
llvm-dsymutil’s life much easier because the dependency graph is explicit. The 
size of a skeleton CU is 11 bytes + the length of the name + 8 bytes of dwo_id, 
(the producer string is shared with the main CU) so I’m not sure if the savings 
are worth the extra complexity.

-- adrian

>  
> 
> Added:
> cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
>  
> 
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
> @@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
> 
>  llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
>ExternalASTSource::ASTSourceDescriptor Info;
> -  if (ClangModuleMap) {
> +  if (DebugTypeExtRefs && D->isFromASTFile()) {
> +// Record a reference to an imported clang module or precompiled header.
> +auto *Reader = CGM.getContext().getExternalSource();
> +auto Idx = D->getOwningModuleID();
> +auto Info = Reader->getSourceDescriptor(Idx);
> +if (Info)
> +  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
> +  } else if (ClangModuleMap) {
>  // We are building a clang module or a precompiled header.
>  //
>  // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
> @@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
>  }
>}
> 
> -  if (DebugTypeExtRefs && D->isFromASTFile()) {
> -// Record a reference to an imported clang module or precompiled header.
> -auto *Reader = CGM.getContext().getExternalSource();
> -auto Idx = D->getOwningModuleID();
> -auto Info = Reader->getSourceDescriptor(Idx);
> -if (Info)
> -  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
> -  }
>return nullptr;
>  }
> 
> 
> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
>  
> 
> ==
> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21 
> 12:48:37 2015
> @@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
>return !Ty->isDependentType() && !Ty->isUndeducedType();
>  }
> 
> +bool VisitImportDecl(ImportDecl *D) {
> +  auto *Import = cast(D);
> +  if (!Import->getImportedOwningModule())
> +DI.EmitImportDecl(*Import);
> +  return true;
> +}
> +
>  bool VisitTypeDecl(TypeDecl *D) {
>QualType QualTy = Ctx.getTypeDeclType(D);
>if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
> 
> Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto
>  
> 
> ==
> --- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)
> +++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21 12:48:37 
> 2015
> @@ -0,0 +1,15 @@
> +// RUN: rm -rf %t
> +// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
> +// RUN: -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
> +// RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
> +// REQUIRES: asserts
> +
> +@import diamond_left;
> +
> +// CHECK: ![[TOP_DEF:.*]] = distinct !DIC

Re: r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

2015-09-21 Thread David Blaikie via cfe-commits
On Mon, Sep 21, 2015 at 11:18 AM, Adrian Prantl  wrote:

>
> On Sep 21, 2015, at 10:59 AM, David Blaikie  wrote:
>
>
>
> On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: adrian
>> Date: Mon Sep 21 12:48:37 2015
>> New Revision: 248184
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev
>> Log:
>> Debug Info: When building a module, emit skeleton CUs for imported
>> modules.
>>
>
> This seems like it might add a reasonable amount more debug info - is it
> necessary? Or could the debugger use the list of modules from the
> referencing/original compilation unit as the dependency set to search?
>
>
> The advantage of having this info in the modules is that it makes
> llvm-dsymutil’s life much easier because the dependency graph is explicit.
>

Why is the graph particularly helpful to dsymutil?


> The size of a skeleton CU is 11 bytes + the length of the name + 8 bytes
> of dwo_id, (the producer string is shared with the main CU) so I’m not sure
> if the savings are worth the extra complexity.
>

Depends how many modules you have, I guess...

- Dave


>
> -- adrian
>
>
>
>>
>> Added:
>> cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>> Modified:
>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
>> @@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
>>
>>  llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
>>ExternalASTSource::ASTSourceDescriptor Info;
>> -  if (ClangModuleMap) {
>> +  if (DebugTypeExtRefs && D->isFromASTFile()) {
>> +// Record a reference to an imported clang module or precompiled
>> header.
>> +auto *Reader = CGM.getContext().getExternalSource();
>> +auto Idx = D->getOwningModuleID();
>> +auto Info = Reader->getSourceDescriptor(Idx);
>> +if (Info)
>> +  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>> +  } else if (ClangModuleMap) {
>>  // We are building a clang module or a precompiled header.
>>  //
>>  // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
>> @@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
>>  }
>>}
>>
>> -  if (DebugTypeExtRefs && D->isFromASTFile()) {
>> -// Record a reference to an imported clang module or precompiled
>> header.
>> -auto *Reader = CGM.getContext().getExternalSource();
>> -auto Idx = D->getOwningModuleID();
>> -auto Info = Reader->getSourceDescriptor(Idx);
>> -if (Info)
>> -  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>> -  }
>>return nullptr;
>>  }
>>
>>
>> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21
>> 12:48:37 2015
>> @@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
>>return !Ty->isDependentType() && !Ty->isUndeducedType();
>>  }
>>
>> +bool VisitImportDecl(ImportDecl *D) {
>> +  auto *Import = cast(D);
>> +  if (!Import->getImportedOwningModule())
>> +DI.EmitImportDecl(*Import);
>> +  return true;
>> +}
>> +
>>  bool VisitTypeDecl(TypeDecl *D) {
>>QualType QualTy = Ctx.getTypeDeclType(D);
>>if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
>>
>> Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto
>>
>> ==
>> --- cfe/trunk/test/Modules/DebugInfoTransitiveImport.m (added)
>> +++ cfe/trunk/test/Modules/DebugInfoTransitiveImport.m Mon Sep 21
>> 12:48:37 2015
>> @@ -0,0 +1,15 @@
>> +// RUN: rm -rf %t
>> +// RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \
>> +// RUN: -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs \
>> +// RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s
>> +// REQUIRES: asserts
>> +
>> +@import diamond_left;
>> +
>> +// CHECK: ![[TOP_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_top
>> +// CHECK: ![[LEFT_DEF:.*]] = distinct !DICompileUnit({{.*}}diamond_left
>> +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,

Re: [PATCH] D12482: Analyzer: Teach analyzer how to handle TypeTraitExpr

2015-09-21 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Ismail, is 24710 the right bug? It is "clang-tidy segfaults with relative 
include paths". https://llvm.org/bugs/show_bug.cgi?id=24710


http://reviews.llvm.org/D12482



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


Re: [PATCH] D13004: Create a new attribute set when the definition is parsed after a declaration of a function

2015-09-21 Thread Akira Hatanaka via cfe-commits
On Mon, Sep 21, 2015 at 11:03 AM, Duncan P. N. Exon Smith <
dexonsm...@apple.com> wrote:

>
> > On 2015-Sep-21, at 01:42, Akira Hatanaka via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > ahatanak created this revision.
> > ahatanak added a subscriber: cfe-commits.
> >
> > An assert is triggered when the test case program is compiled with -Oz:
> >
> > Assertion failed: (!F->hasFnAttribute(llvm::Attribute::OptimizeForSize)
> && "OptimizeNone and OptimizeForSize on same function!"), function
> SetLLVMFunctionAttributesForDefinition, file
> /Users/ahatanaka/projects/llvm/git/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp,
> line 831.
> >
> > This patch fixes the assert by clearing the attribute set attached to IR
> function foo1 and creating it again when the function's definition is
> parsed.
> >
> > http://reviews.llvm.org/D13004
> >
> > Files:
> >  lib/CodeGen/CodeGenModule.cpp
> >  test/CodeGen/attr-func-def.c
> >
> > Index: test/CodeGen/attr-func-def.c
> > ===
> > --- /dev/null
> > +++ test/CodeGen/attr-func-def.c
> > @@ -0,0 +1,18 @@
> > +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o
> - %s | FileCheck %s
> > +
> > +// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
> > +// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
> > +
> > +int foo1(int);
> > +
> > +int foo2(int a) {
> > +  return foo1(a + 2);
> > +}
> > +
> > +__attribute__((optnone))
> > +int foo1(int a) {
> > +return a + 1;
> > +}
> > +
> > +// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
> > +// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }
> > Index: lib/CodeGen/CodeGenModule.cpp
> > ===
> > --- lib/CodeGen/CodeGenModule.cpp
> > +++ lib/CodeGen/CodeGenModule.cpp
> > @@ -2643,6 +2643,11 @@
> >
> >   maybeSetTrivialComdat(*D, *Fn);
> >
> > +  // Create the attribute set of the function definition because it
> might differ
> > +  // from that of the function declaration. SetLLVMFunctionAttributes
> cannot be
> > +  // called after GenerateCode is called as it might remove the
> parameter
> > +  // attributes attached by GenerateCode.
> > +  SetLLVMFunctionAttributes(D, FI, Fn);
>
> I'm a bit worried this could have a compile-time impact, since it will
> regenerate all the attributes.  Why don't you just remove optsize if it's
> attached to the function?
>
> (All this attribute-setting is pretty horrible; one of us should fix it
> soon.)
>
>
Removing the conflicting attributes should fix the crash too. I'll come up
with a patch and commit it shortly.


> >   CodeGenFunction(*this).GenerateCode(D, Fn, FI);
> >
> >   setFunctionDefinitionAttributes(D, Fn);
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12482: Analyzer: Teach analyzer how to handle TypeTraitExpr

2015-09-21 Thread Ismail Pazarbasi via cfe-commits
ismailp added a comment.

Sorry, that's a typo. It is 24170.


http://reviews.llvm.org/D12482



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


r248191 - Remove attributes minsize and optsize, which conflict with optnone.

2015-09-21 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon Sep 21 13:52:24 2015
New Revision: 248191

URL: http://llvm.org/viewvc/llvm-project?rev=248191&view=rev
Log:
Remove attributes minsize and optsize, which conflict with optnone.

This commit fixes an assert that is triggered when optnone is being
added to an IR function that is already marked with minsize and optsize.

rdar://problem/22723716

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

Added:
cfe/trunk/test/CodeGen/attr-func-def.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=248191&r1=248190&r2=248191&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Sep 21 13:52:24 2015
@@ -827,10 +827,8 @@ void CodeGenModule::SetLLVMFunctionAttri
 F->addFnAttr(llvm::Attribute::NoInline);
 
 // OptimizeNone wins over OptimizeForSize, MinSize, AlwaysInline.
-assert(!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) &&
-   "OptimizeNone and OptimizeForSize on same function!");
-assert(!F->hasFnAttribute(llvm::Attribute::MinSize) &&
-   "OptimizeNone and MinSize on same function!");
+F->removeFnAttr(llvm::Attribute::OptimizeForSize);
+F->removeFnAttr(llvm::Attribute::MinSize);
 assert(!F->hasFnAttribute(llvm::Attribute::AlwaysInline) &&
"OptimizeNone and AlwaysInline on same function!");
 

Added: cfe/trunk/test/CodeGen/attr-func-def.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-func-def.c?rev=248191&view=auto
==
--- cfe/trunk/test/CodeGen/attr-func-def.c (added)
+++ cfe/trunk/test/CodeGen/attr-func-def.c Mon Sep 21 13:52:24 2015
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o - %s | 
FileCheck %s
+
+// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
+// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
+
+int foo1(int);
+
+int foo2(int a) {
+  return foo1(a + 2);
+}
+
+__attribute__((optnone))
+int foo1(int a) {
+return a + 1;
+}
+
+// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
+// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }


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


Re: [PATCH] D13004: Create a new attribute set when the definition is parsed after a declaration of a function

2015-09-21 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248191: Remove attributes minsize and optsize, which 
conflict with optnone. (authored by ahatanak).

Changed prior to commit:
  http://reviews.llvm.org/D13004?vs=35214&id=35288#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13004

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/test/CodeGen/attr-func-def.c

Index: cfe/trunk/test/CodeGen/attr-func-def.c
===
--- cfe/trunk/test/CodeGen/attr-func-def.c
+++ cfe/trunk/test/CodeGen/attr-func-def.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o - %s | 
FileCheck %s
+
+// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
+// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
+
+int foo1(int);
+
+int foo2(int a) {
+  return foo1(a + 2);
+}
+
+__attribute__((optnone))
+int foo1(int a) {
+return a + 1;
+}
+
+// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
+// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -827,10 +827,8 @@
 F->addFnAttr(llvm::Attribute::NoInline);
 
 // OptimizeNone wins over OptimizeForSize, MinSize, AlwaysInline.
-assert(!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) &&
-   "OptimizeNone and OptimizeForSize on same function!");
-assert(!F->hasFnAttribute(llvm::Attribute::MinSize) &&
-   "OptimizeNone and MinSize on same function!");
+F->removeFnAttr(llvm::Attribute::OptimizeForSize);
+F->removeFnAttr(llvm::Attribute::MinSize);
 assert(!F->hasFnAttribute(llvm::Attribute::AlwaysInline) &&
"OptimizeNone and AlwaysInline on same function!");
 


Index: cfe/trunk/test/CodeGen/attr-func-def.c
===
--- cfe/trunk/test/CodeGen/attr-func-def.c
+++ cfe/trunk/test/CodeGen/attr-func-def.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -Oz -o - %s | FileCheck %s
+
+// CHECK: define i32 @foo2(i32 %a) [[ATTRS2:#[0-9]+]] {
+// CHECK: define i32 @foo1(i32 %a) [[ATTRS1:#[0-9]+]] {
+
+int foo1(int);
+
+int foo2(int a) {
+  return foo1(a + 2);
+}
+
+__attribute__((optnone))
+int foo1(int a) {
+return a + 1;
+}
+
+// CHECK: attributes [[ATTRS2]] = { {{.*}}optsize{{.*}} }
+// CHECK: attributes [[ATTRS1]] = { {{.*}}optnone{{.*}} }
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -827,10 +827,8 @@
 F->addFnAttr(llvm::Attribute::NoInline);
 
 // OptimizeNone wins over OptimizeForSize, MinSize, AlwaysInline.
-assert(!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) &&
-   "OptimizeNone and OptimizeForSize on same function!");
-assert(!F->hasFnAttribute(llvm::Attribute::MinSize) &&
-   "OptimizeNone and MinSize on same function!");
+F->removeFnAttr(llvm::Attribute::OptimizeForSize);
+F->removeFnAttr(llvm::Attribute::MinSize);
 assert(!F->hasFnAttribute(llvm::Attribute::AlwaysInline) &&
"OptimizeNone and AlwaysInline on same function!");
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

2015-09-21 Thread Adrian Prantl via cfe-commits

> On Sep 21, 2015, at 11:25 AM, David Blaikie  wrote:
> 
> 
> 
> On Mon, Sep 21, 2015 at 11:18 AM, Adrian Prantl  > wrote:
> 
>> On Sep 21, 2015, at 10:59 AM, David Blaikie > > wrote:
>> 
>> 
>> 
>> On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits 
>> mailto:cfe-commits@lists.llvm.org>> wrote:
>> Author: adrian
>> Date: Mon Sep 21 12:48:37 2015
>> New Revision: 248184
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev 
>> 
>> Log:
>> Debug Info: When building a module, emit skeleton CUs for imported modules.
>> 
>> This seems like it might add a reasonable amount more debug info - is it 
>> necessary? Or could the debugger use the list of modules from the 
>> referencing/original compilation unit as the dependency set to search?
> 
> The advantage of having this info in the modules is that it makes 
> llvm-dsymutil’s life much easier because the dependency graph is explicit.
> 
> Why is the graph particularly helpful to dsymutil?

dsymutil does a single pass over the debug info. To support module debugging 
(I’ll post a patch implementing this for review very soon), we can hijack the 
existing ODR type-uniquing code to resolve references to module type forward 
declarations to point to the type's definition in the module, but only if we 
visited the module where the type is defined before.

>  
> The size of a skeleton CU is 11 bytes + the length of the name + 8 bytes of 
> dwo_id, (the producer string is shared with the main CU) so I’m not sure if 
> the savings are worth the extra complexity.
> 
> Depends how many modules you have, I guess... 

Sure :-)
> 
> - Dave
>  
> 
> -- adrian
> 
>>  
>> 
>> Added:
>> cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>> Modified:
>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>  
>> 
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
>> @@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
>> 
>>  llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
>>ExternalASTSource::ASTSourceDescriptor Info;
>> -  if (ClangModuleMap) {
>> +  if (DebugTypeExtRefs && D->isFromASTFile()) {
>> +// Record a reference to an imported clang module or precompiled header.
>> +auto *Reader = CGM.getContext().getExternalSource();
>> +auto Idx = D->getOwningModuleID();
>> +auto Info = Reader->getSourceDescriptor(Idx);
>> +if (Info)
>> +  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>> +  } else if (ClangModuleMap) {
>>  // We are building a clang module or a precompiled header.
>>  //
>>  // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
>> @@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
>>  }
>>}
>> 
>> -  if (DebugTypeExtRefs && D->isFromASTFile()) {
>> -// Record a reference to an imported clang module or precompiled header.
>> -auto *Reader = CGM.getContext().getExternalSource();
>> -auto Idx = D->getOwningModuleID();
>> -auto Info = Reader->getSourceDescriptor(Idx);
>> -if (Info)
>> -  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>> -  }
>>return nullptr;
>>  }
>> 
>> 
>> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>  
>> 
>> ==
>> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep 21 
>> 12:48:37 2015
>> @@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
>>return !Ty->isDependentType() && !Ty->isUndeducedType();
>>  }
>> 
>> +bool VisitImportDecl(ImportDecl *D) {
>> +  auto *Import = cast(D);
>> +  if (!Import->getImportedOwningModule())
>> +DI.EmitImportDecl(*Import);
>> +  return true;
>> +}
>> +
>>  bool VisitTypeDecl(TypeDecl *D) {
>>QualType QualTy = Ctx.getTypeDeclType(D);
>>if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
>> 
>> Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>> URL: 
>> http://llvm.org/vi

r248205 - clang-format: Remove ChromiumStyle.MacroBlockBegin.

2015-09-21 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Sep 21 15:06:42 2015
New Revision: 248205

URL: http://llvm.org/viewvc/llvm-project?rev=248205&view=rev
Log:
clang-format: Remove ChromiumStyle.MacroBlockBegin.

We prefer setting these in our .clang-format file as the macros change over
time.  (Also, the code was setting MacroBlockBegin twice and didn't set
MacroBlockEnd, so it wasn't doing what it tried to do anyways.)

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=248205&r1=248204&r2=248205&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Mon Sep 21 15:06:42 2015
@@ -473,8 +473,6 @@ FormatStyle getChromiumStyle(FormatStyle
 ChromiumStyle.BinPackParameters = false;
 ChromiumStyle.DerivePointerAlignment = false;
   }
-  ChromiumStyle.MacroBlockBegin = "^IPC_BEGIN_MESSAGE_MAP$";
-  ChromiumStyle.MacroBlockBegin = "^IPC_END_MESSAGE_MAP$";
   return ChromiumStyle;
 }
 


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


Re: r248184 - Debug Info: When building a module, emit skeleton CUs for imported modules.

2015-09-21 Thread David Blaikie via cfe-commits
On Mon, Sep 21, 2015 at 12:25 PM, Adrian Prantl  wrote:

>
> On Sep 21, 2015, at 11:25 AM, David Blaikie  wrote:
>
>
>
> On Mon, Sep 21, 2015 at 11:18 AM, Adrian Prantl  wrote:
>
>>
>> On Sep 21, 2015, at 10:59 AM, David Blaikie  wrote:
>>
>>
>>
>> On Mon, Sep 21, 2015 at 10:48 AM, Adrian Prantl via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: adrian
>>> Date: Mon Sep 21 12:48:37 2015
>>> New Revision: 248184
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=248184&view=rev
>>> Log:
>>> Debug Info: When building a module, emit skeleton CUs for imported
>>> modules.
>>>
>>
>> This seems like it might add a reasonable amount more debug info - is it
>> necessary? Or could the debugger use the list of modules from the
>> referencing/original compilation unit as the dependency set to search?
>>
>>
>> The advantage of having this info in the modules is that it makes
>> llvm-dsymutil’s life much easier because the dependency graph is explicit.
>>
>
> Why is the graph particularly helpful to dsymutil?
>
>
> dsymutil does a single pass over the debug info. To support module
> debugging (I’ll post a patch implementing this for review very soon), we
> can hijack the existing ODR type-uniquing code to resolve references to
> module type forward declarations to point to the type's definition in the
> module, but only if we visited the module where the type is defined before.
>

Ah, rightio, thanks for the explanation.


>
>
>
>> The size of a skeleton CU is 11 bytes + the length of the name + 8 bytes
>> of dwo_id, (the producer string is shared with the main CU) so I’m not sure
>> if the savings are worth the extra complexity.
>>
>
> Depends how many modules you have, I guess...
>
>
> Sure :-)
>
>
> - Dave
>
>
>>
>> -- adrian
>>
>>
>>
>>>
>>> Added:
>>> cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>>> Modified:
>>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Sep 21 12:48:37 2015
>>> @@ -2161,7 +2161,14 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI
>>>
>>>  llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
>>>ExternalASTSource::ASTSourceDescriptor Info;
>>> -  if (ClangModuleMap) {
>>> +  if (DebugTypeExtRefs && D->isFromASTFile()) {
>>> +// Record a reference to an imported clang module or precompiled
>>> header.
>>> +auto *Reader = CGM.getContext().getExternalSource();
>>> +auto Idx = D->getOwningModuleID();
>>> +auto Info = Reader->getSourceDescriptor(Idx);
>>> +if (Info)
>>> +  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>>> +  } else if (ClangModuleMap) {
>>>  // We are building a clang module or a precompiled header.
>>>  //
>>>  // TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies
>>> @@ -2179,14 +2186,6 @@ llvm::DIModule *CGDebugInfo::getParentMo
>>>  }
>>>}
>>>
>>> -  if (DebugTypeExtRefs && D->isFromASTFile()) {
>>> -// Record a reference to an imported clang module or precompiled
>>> header.
>>> -auto *Reader = CGM.getContext().getExternalSource();
>>> -auto Idx = D->getOwningModuleID();
>>> -auto Info = Reader->getSourceDescriptor(Idx);
>>> -if (Info)
>>> -  return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true);
>>> -  }
>>>return nullptr;
>>>  }
>>>
>>>
>>> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248184&r1=248183&r2=248184&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Sep
>>> 21 12:48:37 2015
>>> @@ -67,6 +67,13 @@ class PCHContainerGenerator : public AST
>>>return !Ty->isDependentType() && !Ty->isUndeducedType();
>>>  }
>>>
>>> +bool VisitImportDecl(ImportDecl *D) {
>>> +  auto *Import = cast(D);
>>> +  if (!Import->getImportedOwningModule())
>>> +DI.EmitImportDecl(*Import);
>>> +  return true;
>>> +}
>>> +
>>>  bool VisitTypeDecl(TypeDecl *D) {
>>>QualType QualTy = Ctx.getTypeDeclType(D);
>>>if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
>>>
>>> Added: cfe/trunk/test/Modules/DebugInfoTransitiveImport.m
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoTransitiveImport.m?rev=248184&view=auto
>>>
>>> ==
>>> ---

Re: [PATCH] D12982: Move routines for guessing mode/target from driver to ToolChain

2015-09-21 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Looks like a straight move? If so, LGTM, if not can you explain what changed?


Repository:
  rL LLVM

http://reviews.llvm.org/D12982



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


Re: [PATCH] D12996: Driver: support ARM/HF on a single toolchain

2015-09-21 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

You'll also need a corresponding patch for compiler-rt to make it use the new 
name appropriately.


http://reviews.llvm.org/D12996



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


Re: [PATCH] D12982: Move routines for guessing mode/target from driver to ToolChain

2015-09-21 Thread Luke Zarko via cfe-commits
zarko added a comment.

This should be a straight move, unless there is something I don't understand 
about the semantics of `llvm::InitializeAllTargets();` that would make moving 
it earlier in `main` a bad idea.


Repository:
  rL LLVM

http://reviews.llvm.org/D12982



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


Re: [PATCH] D12774: createUniqueFile() is documented to create the file in the temporary directory unless it's supplied an absolute path.Make sure the output filepath supplied to createUniqueFile() in

2015-09-21 Thread Cameron Esfahani via cfe-commits
dirty added a comment.

Are you suggesting I change the code to something like the following:

  if (std::error_code EC =
  llvm::sys::fs::make_absolute(Model)) {
  llvm::errs() << "warning: could not make '" << Model
   << "' absolute: " << EC.message() << '\n';
return;
  }


http://reviews.llvm.org/D12774



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


Re: [PATCH] D12982: Move routines for guessing mode/target from driver to ToolChain

2015-09-21 Thread Eric Christopher via cfe-commits
echristo added a comment.

Nothing comes to mind.

Thanks!

-eric


Repository:
  rL LLVM

http://reviews.llvm.org/D12982



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


Re: r247618 - C11 _Bool bitfield diagnostic

2015-09-21 Thread Alexey Samsonov via cfe-commits
Do you plan to fix diagnostic emission for cases like "bool b : 4" in the
near future, or it makes sense to revert this change until we reach
consensus on the rules, and implementation?

On Fri, Sep 18, 2015 at 11:17 PM, Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Fri, Sep 18, 2015 at 10:19 PM, Richard Smith 
> wrote:
>
>> On Fri, Sep 18, 2015 at 8:49 PM, Nico Weber  wrote:
>>
>>> On Fri, Sep 18, 2015 at 5:06 PM, Richard Smith 
>>> wrote:
>>>
 On Wed, Sep 16, 2015 at 5:33 PM, Richard Smith 
 wrote:

> On Wed, Sep 16, 2015 at 5:27 PM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> On Tue, Sep 15, 2015 at 5:50 PM, Richard Smith > > wrote:
>>
>>> On Tue, Sep 15, 2015 at 12:38 PM, Nico Weber 
>>> wrote:
>>>
 With this patch, we warn on `bool a : 4;`, yet we don't warn on
 `bool b` (which has 8 bits storage, 1 bit value). Warning on `bool b` 
 is
 silly of course, but why is warning on `bool a : 4` useful? That's 
 like 50%
 more storage efficient than `bool b` ;-)

 It's possible that this is a good warning for some reason, but I
 don't quite see why yet.

>>>
>>> Why would we warn on "unsigned n : 57;"? The bit-field is wider than
>>> necessary, and we have no idea what the programmer was trying to do
>>>
>>
>> Warning on this kind of makes sense to me, as the field is wider than
>> the default width of int. (Not warning on that doesn't seem terrible to 
>> me
>> either though.)
>>
>> I'm only confused about the bool case with bitfield sizes < 8 I
>> think. We warn that the bitfield is wider than the value size, even 
>> though
>> it's smaller than the default storage size, and we don't warn on regular
>> bools.
>>
>> To get an idea how often this warning fires, I ran it on a large-ish
>> open source codebase I had flying around. The only place it fired on is 
>> one
>> header in protobuf (extension_set.h). I looked at the history of that 
>> file,
>> and it had a struct that used to look like
>>
>>   struct Extension {
>> SomeEnum e;
>> bool a;
>> bool b;
>> bool c;
>> int d;
>> // ...some more stuff...
>>   };
>>
>> Someone then added another field to this and for some reason decided
>> to do it like so:
>>
>>   struct Extension {
>> SomeEnum e;
>> bool a;
>> bool b1 : 4;
>> bool b2 : 4;
>> bool c;
>> int d;
>> // ...some more stuff...
>>   };
>>
>> Neither the commit message nor the review discussion mention the
>> bitfield at all as far as I can tell. Now, given that this isn't a small
>> struct and it has a bunch of normal bools, I don't know why they added 
>> the
>> new field as bitfield while this wasn't deemed necessary for the existing
>> bools. My best guess is that that they didn't want to add 3 bytes of
>> padding (due to the int field), which seems like a decent reason.
>>
>> Had the warning been in place when this code got written, I suppose
>> they had used ": 1" instead. Does this make this code much better? It
>> doesn't seem like it to me. So after doing a warning quality eval, I'd
>> suggest to not emit the warning for bool bitfields if the bitfield size 
>> is
>> < 8. (But since the warning fires only very rarely, I don't feel very
>> strongly about this.)
>>
>
> I agree it doesn't make the code /much/ better. But if I were reading
> that, I would certainly pause for a few moments wondering what the author
> was thinking. I also don't feel especially strongly about this, but I 
> don't
> see a good rationale for warning on 'bool : 9' but not on 'bool : 5'.
>

 I'm coming around to the opinion that we shouldn't give this warning on
 bool at all -- the point of the warning is to point out that an 'unsigned :
 40;' bitfield can't hold 2**40 - 1, and values of that size will be
 truncated. There is no corresponding problematic case for bool, so we have
 a much weaker justification for warning in this case -- we have no idea
 what the user was trying to achieve, but we do not have a signal that their
 code is wrong.

 Thoughts?

>>>
>>> Makes sense to me :-) What about `bool : 16`?
>>>
>>
>> I don't think it makes sense to treat bool : 3 and bool : 16 differently.
>> The fact that an unadorned bool would occupy 8 bits doesn't seem relevant
>> to whether we should warn. Either we warn that there are padding bits, or
>> we don't.
>>
>
> Yup, makes sense.
>
>
>>
>>
>>> , but it doesn't seem likely they got that effect. Would you be more
>>> convinced if we amended the diagnostic to provide a fixit suggesting 
>>> using
>>> an anonymous bit-field to 

r248221 - Add msbuild-bin/cl to CLANG_LINKS_TO_CREATE

2015-09-21 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Mon Sep 21 17:44:57 2015
New Revision: 248221

URL: http://llvm.org/viewvc/llvm-project?rev=248221&view=rev
Log:
Add msbuild-bin/cl to CLANG_LINKS_TO_CREATE

This got lost in r248043 which refactored the symlink creation.

Modified:
cfe/trunk/tools/driver/CMakeLists.txt

Modified: cfe/trunk/tools/driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=248221&r1=248220&r2=248221&view=diff
==
--- cfe/trunk/tools/driver/CMakeLists.txt (original)
+++ cfe/trunk/tools/driver/CMakeLists.txt Mon Sep 21 17:44:57 2015
@@ -62,6 +62,10 @@ add_custom_target(install-clang
 
 if(NOT CLANG_LINKS_TO_CREATE)
   set(CLANG_LINKS_TO_CREATE clang++ clang-cl)
+
+  if (WIN32)
+list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl)
+  endif()
 endif()
 
 foreach(link ${CLANG_LINKS_TO_CREATE})


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


Re: [PATCH] D12906: [RFC] Bug identification("issue_hash") change for CmpRuns.py

2015-09-21 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

I agree with Gabor and do not think we should have 2 entries in the plist file 
for bug identification. This is confusing and I do not see a need for this.

Any comparison script can check for 2 fields in a plist file and concatenate 
them. We've already discussed this during the patch review for the other patch. 
For example, the latest version does not include the file name.


http://reviews.llvm.org/D12906



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


Re: [PATCH] D10305: [Clang Static Analyzer] Bug identification

2015-09-21 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Hi Babati,

As far as I can see, the following comments from June 15th have not been 
addressed. It would be good if you could address them in the latest revision.

"I would be interested in either replacing "issue_hash" or adding 
"issue_hash_bug_line_content" (or something like it) instead of adding another 
completely differently named field with very similar information. I see no 
reason for having both. I am not sure if we have any users of "issue_hash" 
right now, who will suffer from the change. Maybe we could have "issue_hash", 
"issue_hash_1"(offset based), and "issue_hash_2"(content of line) and add 
another field "issue_hash_version" that describes the version "issue_hash" is 
using?

This needs tests!!!"


http://reviews.llvm.org/D10305



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


Re: [PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

2015-09-21 Thread Антон Ярцев via cfe-commits
ayartsev added a comment.

Ping.


http://reviews.llvm.org/D9040



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


Re: [PATCH] D12989: [CUDA] Added CUDA installation detector class.

2015-09-21 Thread Eric Christopher via cfe-commits
echristo added a comment.

Make one of those big input directory sets of tests and run with/without that 
option on it?

-eric


http://reviews.llvm.org/D12989



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


Re: [PATCH] D12989: [CUDA] Added CUDA installation detector class.

2015-09-21 Thread Artem Belevich via cfe-commits
tra added a comment.

I'll add tests for install dir detection. As for detection of bitcode files, 
perhaps I should remove it from this patch and commit it along with the code 
that's going to use it and where I can test it.


http://reviews.llvm.org/D12989



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


Re: [PATCH] D12989: [CUDA] Added CUDA installation detector class.

2015-09-21 Thread Eric Christopher via cfe-commits
echristo added a comment.

In http://reviews.llvm.org/D12989#250247, @tra wrote:

> I'll add tests for install dir detection. As for detection of bitcode files, 
> perhaps I should remove it from this patch and commit it along with the code 
> that's going to use it and where I can test it.


Seems reasonable.

Thanks!

-eric


http://reviews.llvm.org/D12989



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


Re: [PATCH] D12761: MPI-Checker patch for Clang Static Analyzer

2015-09-21 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

> Sorry, I should have been more precise. The check tests if a request is in 
> use by a nonblocking 

>  call at the end of a function. But the request can still be alive after 
> return. You can think of it as

>  a pointer for which the memory must be freed in the function it was 
> allocated. But the pointer 

>  can exist in global space outside a function. Multiple functions can use the 
> same request.

>  So the symbol is not necessarily dead at the end of a function.


Is it the API requirement that the wait is performed in the same function?



Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp:137
@@ +136,3 @@
+
+  // This is never reached...
+  llvm::outs() << ""

Alexander_Droste wrote:
> Alexander_Droste wrote:
> > I figured out what the problem about the request retrieval is:
> > `REGISTER_MAP_WITH_PROGRAMSTATE(RequestMap, const 
> > clang::ento::clang::mpi::Request)`
> > The documentation states: "The macro should not be used inside namespaces, 
> > or for traits that must
> > be accessible from more than one translation unit." I think I need some 
> > advice here, how to make the  
> > same RequestMap accessible in multiple translation units.
> How about this: 
> We could capture the `PathDiagnosticLocation` of the LastUser in each 
> `mpi::Request` as a member. The `RequestMap` could then be local to 
> `MPICheckerPathSensitive.cpp` and no visitors would be needed. The bug 
> reporter class would then not need to know anything about the request map. 
> The only function I can't find to realise this concept would be something 
> like: `Report->addPathDiagnosticLocation()`.
Almost all other checkers occupy a single file per checker. This is not much 
more complicated than the others so you could do the same. This would probably 
be better for consistency, but I do not have such a strong opinion about it and 
see why you might want to have separate files. 

See TaintManager.h for the example of how to share the program state maps 
across translation units.


Comment at: tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h:66
@@ +65,3 @@
+// Register data structure for path-sensitive analysis. The map stores MPI
+// requests which are identified by their memory region. Requests are used in
+// MPI to complete nonblocking operations with wait operations. Requests can be

Look at the ways the other checkers reference a node that occurred earlier 
along the symbolic execution path. For example, malloc checker tracks the state 
of each pointer, which could be "Allocated", "Freed"... When we report a leak, 
for example, the state would be "Allocated" and the symbol would be dead. The 
BugReporterVisitor walks up the symbolic path on which the issue occurred and 
prints an extra note at the place where the node is allocated. It knows at 
which node the pointer is allocated because that is where the state of the 
pointer changes from untracked to "Allocated".



http://reviews.llvm.org/D12761



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


r248234 - ms Intrin.h: Fix __movsw's and __stosw's inline asm.

2015-09-21 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Sep 21 19:46:21 2015
New Revision: 248234

URL: http://llvm.org/viewvc/llvm-project?rev=248234&view=rev
Log:
ms Intrin.h: Fix __movsw's and __stosw's inline asm.

Before, clang's internal assembler would reject the inline asm in clang's
Intrin.h.  To make sure this doesn't happen for other Intrin.h functions using
__asm__ blocks, add 32-bit and 64-bit codegen tests for Intrin.h.

Sadly, these tests discovered that __readcr3 and __writecr3 have bad
implementations in 64-bit builds.  This will have to be fixed in a follow-up.

Modified:
cfe/trunk/lib/Headers/Intrin.h
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/lib/Headers/Intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=248234&r1=248233&r2=248234&view=diff
==
--- cfe/trunk/lib/Headers/Intrin.h (original)
+++ cfe/trunk/lib/Headers/Intrin.h Mon Sep 21 19:46:21 2015
@@ -846,7 +846,7 @@ __movsd(unsigned long *__dst, unsigned l
 }
 static __inline__ void __DEFAULT_FN_ATTRS
 __movsw(unsigned short *__dst, unsigned short const *__src, size_t __n) {
-  __asm__("rep movsh" : : "D"(__dst), "S"(__src), "c"(__n)
+  __asm__("rep movsw" : : "D"(__dst), "S"(__src), "c"(__n)
 : "%edi", "%esi", "%ecx");
 }
 static __inline__ void __DEFAULT_FN_ATTRS
@@ -861,7 +861,7 @@ __stosd(unsigned long *__dst, unsigned l
 }
 static __inline__ void __DEFAULT_FN_ATTRS
 __stosw(unsigned short *__dst, unsigned short __x, size_t __n) {
-  __asm__("rep stosh" : : "D"(__dst), "a"(__x), "c"(__n)
+  __asm__("rep stosw" : : "D"(__dst), "a"(__x), "c"(__n)
 : "%edi", "%ecx");
 }
 #endif

Modified: cfe/trunk/test/Headers/ms-intrin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=248234&r1=248233&r2=248234&view=diff
==
--- cfe/trunk/test/Headers/ms-intrin.cpp (original)
+++ cfe/trunk/test/Headers/ms-intrin.cpp Mon Sep 21 19:46:21 2015
@@ -5,12 +5,12 @@
 
 // RUN: %clang_cc1 -triple i386-pc-win32 -target-cpu broadwell \
 // RUN: -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
-// RUN: -ffreestanding -fsyntax-only -Werror \
+// RUN: -ffreestanding -emit-obj -o /dev/null -Werror \
 // RUN: -isystem %S/Inputs/include %s
 
 // RUN: %clang_cc1 -triple x86_64-pc-win32  \
 // RUN: -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
-// RUN: -ffreestanding -fsyntax-only -Werror \
+// RUN: -ffreestanding -emit-obj -o /dev/null -Werror \
 // RUN: -isystem %S/Inputs/include %s
 
 // RUN: %clang_cc1 -triple thumbv7--windows \
@@ -27,3 +27,35 @@ typedef __SIZE_TYPE__ size_t;
 // Use some C++ to make sure we closed the extern "C" brackets.
 template 
 void foo(T V) {}
+
+// __asm__ blocks are only checked for inline functions that end up being
+// emitted, so call functions with __asm__ blocks to make sure their inline
+// assembly parses.
+void f() {
+  __movsb(0, 0, 0);
+  __movsd(0, 0, 0);
+  __movsw(0, 0, 0);
+
+  __stosb(0, 0, 0);
+  __stosd(0, 0, 0);
+  __stosw(0, 0, 0);
+
+#ifdef _M_X64
+  __movsq(0, 0, 0);
+  __stosq(0, 0, 0);
+#endif
+
+  int info[4];
+  __cpuid(info, 0);
+  __cpuidex(info, 0, 0);
+  _xgetbv(0);
+  __halt();
+  __readmsr(0);
+
+  // FIXME: Call these in 64-bit too once the intrinsics have been fixed to
+  // work there.
+#ifndef _M_X64
+  __readcr3();
+  __writecr3(0);
+#endif
+}


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


Re: [PATCH] D12989: [CUDA] Added CUDA installation detector class.

2015-09-21 Thread Artem Belevich via cfe-commits
tra updated the summary for this revision.
tra updated this revision to Diff 35333.
tra added a comment.

Added test case for CUDA detection.
Removed libdevice file detection for now.


http://reviews.llvm.org/D12989

Files:
  include/clang/Driver/Options.td
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  test/Driver/Inputs/CUDA/usr/local/cuda/include/.keep
  test/Driver/Inputs/CUDA/usr/local/cuda/lib/.keep
  test/Driver/Inputs/CUDA/usr/local/cuda/lib64/.keep
  test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/.keep
  test/Driver/cuda-detect.cu

Index: test/Driver/cuda-detect.cu
===
--- /dev/null
+++ test/Driver/cuda-detect.cu
@@ -0,0 +1,6 @@
+// RUN: %clang -v --sysroot=/tmp/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA
+// RUN: %clang -v --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s
+// RUN: %clang -v --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s
+
+// CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda
+// NOCUDA-NOT: Found CUDA installation:
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -157,6 +157,38 @@
 protected:
   GCCInstallationDetector GCCInstallation;
 
+  // \brief A class to find a viable CUDA installation
+
+  class CudaInstallationDetector {
+bool IsValid;
+std::string CudaInstallPath;
+std::string CudaLibPath;
+std::string CudaLibDevicePath;
+std::string CudaIncludePath;
+
+  public:
+CudaInstallationDetector() : IsValid(false) {}
+void init(const Driver &D, const llvm::Triple &TargetTriple,
+  const llvm::opt::ArgList &Args);
+
+/// \brief Check whether we detected a valid Cuda install.
+bool isValid() const { return IsValid; }
+/// \brief Print information about the detected CUDA installation.
+void print(raw_ostream &OS) const;
+
+/// \brief Get the detected Cuda installation path.
+StringRef getInstallPath() const { return CudaInstallPath; }
+/// \brief Get the detected Cuda Include path.
+StringRef getIncludePath() const { return CudaIncludePath; }
+/// \brief Get the detected Cuda library path.
+StringRef getLibPath() const { return CudaLibPath; }
+/// \brief Get the detected Cuda device library path.
+StringRef getLibDevicePath() const { return CudaLibDevicePath; }
+/// \brief Get libdevice file for given architecture
+  };
+
+  CudaInstallationDetector CudaInstallation;
+
 public:
   Generic_GCC(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1482,6 +1482,49 @@
 BiarchTripleAliases.push_back(BiarchTriple.str());
 }
 
+// \brief -- try common CUDA installation paths looking for files we need for
+// CUDA compilation.
+
+void
+Generic_GCC::CudaInstallationDetector::init(const Driver &D,
+const llvm::Triple &TargetTriple,
+const llvm::opt::ArgList &Args) {
+  SmallVector CudaPathCandidates;
+
+  if (Args.hasArg(options::OPT_cuda_path_EQ))
+CudaPathCandidates.push_back(
+Args.getLastArgValue(options::OPT_cuda_path_EQ));
+  else {
+std::string Prefix = D.SysRoot.empty() ? "" : D.SysRoot;
+CudaPathCandidates.push_back(Prefix + "/usr/local/cuda");
+CudaPathCandidates.push_back(Prefix + "/usr/local/cuda-7.0");
+  }
+
+  for (const auto CudaPath : CudaPathCandidates) {
+if (CudaPath.empty() || !llvm::sys::fs::exists(CudaPath))
+  continue;
+
+CudaInstallPath = CudaPath;
+CudaIncludePath = CudaInstallPath + "/include";
+CudaLibDevicePath = CudaInstallPath + "/nvvm/libdevice";
+CudaLibPath =
+CudaInstallPath + (TargetTriple.isArch64Bit() ? "/lib64" : "/lib");
+
+if (!(llvm::sys::fs::exists(CudaIncludePath) &&
+  llvm::sys::fs::exists(CudaLibPath) &&
+  llvm::sys::fs::exists(CudaLibDevicePath)))
+  continue;
+
+IsValid = true;
+break;
+  }
+}
+
+void Generic_GCC::CudaInstallationDetector::print(raw_ostream &OS) const {
+  if (isValid())
+OS << "Found CUDA installation: " << CudaInstallPath << "\n";
+}
+
 namespace {
 // Filter to remove Multilibs that don't exist as a suffix to Path
 class FilterNonExistent {
@@ -2053,7 +2096,7 @@
 
 Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple &Triple,
  const ArgList &Args)
-: ToolChain(D, Triple, Args), GCCInstallation() {
+: ToolChain(D, Triple, Args), GCCInstallation(), CudaInstallation() {
   getProgramPaths().push_back(getDriver().getInstalledDir());
   if (getDriver().getInstalledDir() != getDriver().Dir)
 getProgramPaths().push_back(getDriver().Dir);
@@ -2085,6 +2128,7 @@
 void Generic_GCC::printVerbos

r248235 - Add bug number to FIXME comment.

2015-09-21 Thread Nico Weber via cfe-commits
Author: nico
Date: Mon Sep 21 19:51:10 2015
New Revision: 248235

URL: http://llvm.org/viewvc/llvm-project?rev=248235&view=rev
Log:
Add bug number to FIXME comment.

Modified:
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/test/Headers/ms-intrin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=248235&r1=248234&r2=248235&view=diff
==
--- cfe/trunk/test/Headers/ms-intrin.cpp (original)
+++ cfe/trunk/test/Headers/ms-intrin.cpp Mon Sep 21 19:51:10 2015
@@ -53,7 +53,7 @@ void f() {
   __readmsr(0);
 
   // FIXME: Call these in 64-bit too once the intrinsics have been fixed to
-  // work there.
+  // work there, PR19301
 #ifndef _M_X64
   __readcr3();
   __writecr3(0);


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


Re: [PATCH] D12482: Analyzer: Teach analyzer how to handle TypeTraitExpr

2015-09-21 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

You should add a test covering the added logic in SValBuilder. For example:

  clang_analyzer_eval(__is_trivial(NonTrivial)); // expected-warning {{FALSE}}

And while we're at it, it would be good to add a test for 
UnaryExprOrTypeTraitExpr as well:

  clang_analyzer_eval(__alignof(NonTrivial) > 0); // expected-warning {{TRUE}}

Other than that, looks good to me. Thanks Ismail!



Comment at: lib/StaticAnalyzer/Core/SValBuilder.cpp:264
@@ +263,3 @@
+const TypeTraitExpr *TE = cast(E);
+return makeTruthVal(TE->getValue(), TE->getType());;
+  }

Extra semi-colon here.


http://reviews.llvm.org/D12482



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


Re: [PATCH] D12358: [Analyzer] Handling constant bound loops

2015-09-21 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

nit: Please, use proper punctuation in the comments.



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1616
@@ +1615,3 @@
+builder.isFeasible(false) && !StFalse && 
+BldCtx.blockCount() == AMgr.options.maxBlockVisitOnPath - 1) {
+

Do we loose precision for loops that need to be executed exactly 
maxBlockVisitOnPath times?


Comment at: lib/StaticAnalyzer/Core/LoopWidening.cpp:10
@@ +9,3 @@
+///
+/// This file contains functions which are used to widen constant bound loops.
+/// A loop may be widened to approximate the exit state(s), without analysing

This would allow to widen not just the constant bound loops!
I think we should widen any loop that we know we did not fully execute.


Comment at: lib/StaticAnalyzer/Core/LoopWidening.cpp:171
@@ +170,3 @@
+
+// Set the approximate value of the loop variable in the last itteration
+Loc LVLoc = State->getLValue(LoopVariable, LCtx);

iteration -> iteration

What do you mean by "approximate"? Note that people rely on the analyzer to 
track the exact values of variables. They expect it to know what the value is. 
It can be very confusing if the analyzer states that it knows the value of the 
variable and it is the wrong value.

I am concerned with changing the value of a single variable of the loop based 
on a syntactic check. Also, I am not sure there is a strong need for preserving 
the value of the index variable either.


Comment at: test/Analysis/constant-bound-loops.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -analyze 
-analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-store=region 
-analyzer-max-loop 4 -analyzer-config widen-constant-bound-loops=true -verify %s
+

Should we test that the loop is still executed n times before it is widened?


Comment at: test/Analysis/constant-bound-loops.c:174
@@ +173,3 @@
+
+clang_analyzer_eval(g_global); // expected-warning {{UNKNOWN}}
+clang_analyzer_eval(s_arg); // expected-warning {{UNKNOWN}}

I think we should extend this test case.
Ex: what about heap, what about variables touched by the loop variables 
declared in the loop's scope?


http://reviews.llvm.org/D12358



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


Re: [PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

2015-09-21 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

See the suggestion for an improved comment. Otherwise, LGTM!

Thanks!
Anna.



Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:902
@@ +901,3 @@
+} else {
+  // Case of zero-size realloc. Historically 'realloc(ptr, 0)' is treated 
as
+  // 'free(ptr)' and the returned value from 'realloc(ptr, 0)' is not

"Historically 'realloc(ptr, 0)' is treated as 'free(ptr)' and the returned 
value from 'realloc(ptr, 0)' is not tracked." -> "The value returned from 
'realloc(ptr, 0)' is not tracked since historically 'realloc(ptr, 0)' is 
treated as 'free(ptr)' and the analyzer supports that model. However, we want 
to report uses of zero-allocated memory that get returned by realloc."


http://reviews.llvm.org/D9040



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


Re: [PATCH] D12793: Three new security overflow builtins with generic argument types

2015-09-21 Thread John McCall via cfe-commits
rjmccall added a comment.

Thanks for doing this; this is a great start.



Comment at: docs/LanguageExtensions.rst:1720
@@ -1712,1 +1719,3 @@
+being stored there, and the function returns 1.  The behavior of these builtins
+is well-defined for all argument values.
 

Hmm.  It's not necessarily truncation; you could meaningfully use these 
intrinsics to add two small signed numbers and store the result in an unsigned 
number.  It's the unique representative value modulo 2^n, where n is the 
bit-width of the result.


Comment at: lib/CodeGen/CGBuiltin.cpp:289
@@ +288,3 @@
+static std::pair
+EncompassingIntegerType(std::vector> Types) {
+  assert(Types.size() > 0 && "Empty list of types.");

This should just take an ArrayRef.  Also, please at least introduce a typedef 
for your pair type, and consider just making a little struct for it.


Comment at: lib/CodeGen/CGBuiltin.cpp:314
@@ +313,3 @@
+static std::pair
+IntegerWidthAndSignedness(const clang::ASTContext &context,
+  const clang::QualType Type) {

getIntegerWidthAndSignedness, please.


Comment at: lib/CodeGen/CGBuiltin.cpp:1601
@@ +1600,3 @@
+auto RITy = IntegerWidthAndSignedness(CGM.getContext(), RQTy);
+auto EITy = EncompassingIntegerType({XITy, YITy, RITy});
+

These are not the most evocative names you could have chosen. :)

Also, this strategy is correct, but it produces horrible code when the operands 
have the same signedness and the result is different, where the result would 
otherwise be an ordinary operation and a compare.  You really want to just 
merge the two operands and then max with the width of the result type.


Comment at: lib/CodeGen/CGBuiltin.cpp:1610
@@ +1609,3 @@
+default:
+  llvm_unreachable("Unknown security overflow builtin id.");
+case Builtin::BI__builtin_add_overflow:

These aren't really security-specific; they're just arbitrary-precision.


Comment at: lib/CodeGen/CGBuiltin.cpp:1630
@@ +1629,3 @@
+// Extend each operand to the encompassing type.
+if (XQTy->isSignedIntegerType()) {
+  X = Builder.CreateSExt(X, ELTy);

This is Builder.CreateIntegerCast(X, ELTy, XITy.second).


Comment at: lib/CodeGen/CGBuiltin.cpp:1667
@@ +1666,3 @@
+// we have to extend them before storing.
+Q = Builder.CreateZExt(Q, OutPtr.getElementType());
+

EmitToMemory.


Repository:
  rL LLVM

http://reviews.llvm.org/D12793



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


[libcxx] r248240 - Fix with -pedantic-errors

2015-09-21 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Sep 21 22:15:35 2015
New Revision: 248240

URL: http://llvm.org/viewvc/llvm-project?rev=248240&view=rev
Log:
Fix  with -pedantic-errors

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=248240&r1=248239&r2=248240&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Sep 21 22:15:35 2015
@@ -786,7 +786,7 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 #endif
 
-#if __has_extension(c_atomic)
+#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
 #define _LIBCPP_HAS_C_ATOMIC_IMP
 #elif _GNUC_VER > 407
 #define _LIBCPP_HAS_GCC_ATOMIC_IMP


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


Re: [PATCH] D12906: [RFC] Bug identification("issue_hash") change for CmpRuns.py

2015-09-21 Thread Honggyu Kim via cfe-commits
honggyu.kim added a comment.

In http://reviews.llvm.org/D12906#250237, @zaks.anna wrote:

> I agree with Gabor and do not think we should have 2 entries in the plist 
> file for bug identification. This is confusing and I do not see a need for 
> this.
>
> Any comparison script can check for 2 fields in a plist file and concatenate 
> them. We've already discussed this during the patch review for the other 
> patch. For example, the latest version does not include the file name.


I didn't put 2 entries in plist, I made issue_hash as it was while adding bugid 
to html report only.
So this patch makes issue_hash based on Babati's patch after removing redundent 
fields. And it also makes BugID that contains all the information so that it 
doesn't require post processing.
BugId is for HTML report comparison.

issue_hash is a subset of BugId and CmpRuns.py script will collect more fields 
with issue_hash so that it contains all information just like BugId here.

Thanks.


http://reviews.llvm.org/D12906



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


Re: [PATCH] D12358: [Analyzer] Handling constant bound loops

2015-09-21 Thread Devin Coughlin via cfe-commits
dcoughlin added inline comments.


Comment at: lib/StaticAnalyzer/Core/LoopWidening.cpp:149
@@ +148,3 @@
+  break;
+}
+

This doesn't seem quite right. Consider:

```
int i;
for (i = 0; i < 21; i += 3) {}
clang_analyzer_eval(i == 23);
```
The value of `i` should be 21 after the loop, but this code sets it to 23. And 
what happens if `i` starts at 1 instead of 0?

Another (ridiculous) case to consider:

```
for (i = 0; i < 21; i += 3) {
  if (random() % 2 == 1) {
 i = i * i;
  } else {
i--;
  }
}
```
What are the possible values of `i` after the loop?


http://reviews.llvm.org/D12358



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