[llvm-branch-commits] [clang] 699e2a6 - Prefer __vector over vector keyword for altivec

2020-02-11 Thread Hans Wennborg via llvm-branch-commits

Author: serge-sans-paille
Date: 2020-02-11T10:26:55+01:00
New Revision: 699e2a6c5551eacf10be7e64f579120954f55b10

URL: 
https://github.com/llvm/llvm-project/commit/699e2a6c5551eacf10be7e64f579120954f55b10
DIFF: 
https://github.com/llvm/llvm-project/commit/699e2a6c5551eacf10be7e64f579120954f55b10.diff

LOG: Prefer __vector over vector keyword for altivec

`vector' uses the keyword-and-predefine mode from gcc, while __vector is
reliably supported.

As a side effect, it also makes the code consistent in its usage of __vector.

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

(cherry picked from commit 3185c30c54d0af5bffbff3bcfd721668d086ff10)

Added: 


Modified: 
clang/lib/Lex/Lexer.cpp

Removed: 




diff  --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 648bda270578..98d03744 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -2552,8 +2552,8 @@ bool Lexer::SkipBlockComment(Token &Result, const char 
*CurPtr,
 '/', '/', '/', '/',  '/', '/', '/', '/',
 '/', '/', '/', '/',  '/', '/', '/', '/'
   };
-  while (CurPtr+16 <= BufferEnd &&
- !vec_any_eq(*(const vector unsigned char*)CurPtr, Slashes))
+  while (CurPtr + 16 <= BufferEnd &&
+ !vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes))
 CurPtr += 16;
 #else
   // Scan for '/' quickly.  Many block comments are very large.



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


[llvm-branch-commits] [llvm] 4e6ec0f - IR Linking: Support merging Warning+Max module metadata flags

2020-02-11 Thread Hans Wennborg via llvm-branch-commits

Author: David Blaikie
Date: 2020-02-11T10:36:46+01:00
New Revision: 4e6ec0fff658cbe29e70f46491917202baa061c0

URL: 
https://github.com/llvm/llvm-project/commit/4e6ec0fff658cbe29e70f46491917202baa061c0
DIFF: 
https://github.com/llvm/llvm-project/commit/4e6ec0fff658cbe29e70f46491917202baa061c0.diff

LOG: IR Linking: Support merging Warning+Max module metadata flags

Summary:
Debug Info Version was changed to use "Max" instead of "Warning" per the
original design intent - but this maxes old/new IR unlinkable, since
mismatched merge styles are a linking failure.

It seems possible/maybe reasonable to actually support the combination
of these two flags: Warn, but then use the maximum value rather than the
first value/earlier module's value.

Reviewers: tejohnson

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

(cherry picked from commit ba9cae58bbdd41451ee67773c9d0f90a01756f12)

Added: 
llvm/test/Linker/Inputs/module-max-warn.ll
llvm/test/Linker/module-max-warn.ll

Modified: 
llvm/docs/LangRef.rst
llvm/lib/Linker/IRMover.cpp

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index a64974c2d90f..0ae374de4b65 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -6114,7 +6114,9 @@ The following behaviors are supported:
* - 2
  - **Warning**
Emits a warning if two values disagree. The result value will be the
-   operand for the flag from the first module being linked.
+   operand for the flag from the first module being linked, or the max
+   if the other module uses **Max** (in which case the resulting flag
+   will be **Max**).
 
* - 3
  - **Require**

diff  --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e13656ed1c10..af934cc8b9be 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1277,11 +1277,17 @@ Error IRLinker::linkModuleFlagsMetadata() {
 }
 
 // Diagnose inconsistent merge behavior types.
-if (SrcBehaviorValue != DstBehaviorValue)
-  return stringErr("linking module flags '" + ID->getString() +
-   "': IDs have conflicting behaviors in '" +
-   SrcM->getModuleIdentifier() + "' and '" +
-   DstM.getModuleIdentifier() + "'");
+if (SrcBehaviorValue != DstBehaviorValue) {
+  bool MaxAndWarn = (SrcBehaviorValue == Module::Max &&
+ DstBehaviorValue == Module::Warning) ||
+(DstBehaviorValue == Module::Max &&
+ SrcBehaviorValue == Module::Warning);
+  if (!MaxAndWarn)
+return stringErr("linking module flags '" + ID->getString() +
+ "': IDs have conflicting behaviors in '" +
+ SrcM->getModuleIdentifier() + "' and '" +
+ DstM.getModuleIdentifier() + "'");
+}
 
 auto replaceDstValue = [&](MDNode *New) {
   Metadata *FlagOps[] = {DstOp->getOperand(0), ID, New};
@@ -1290,6 +1296,40 @@ Error IRLinker::linkModuleFlagsMetadata() {
   Flags[ID].first = Flag;
 };
 
+// Emit a warning if the values 
diff er and either source or destination
+// request Warning behavior.
+if ((DstBehaviorValue == Module::Warning ||
+ SrcBehaviorValue == Module::Warning) &&
+SrcOp->getOperand(2) != DstOp->getOperand(2)) {
+  std::string Str;
+  raw_string_ostream(Str)
+  << "linking module flags '" << ID->getString()
+  << "': IDs have conflicting values ('" << *SrcOp->getOperand(2)
+  << "' from " << SrcM->getModuleIdentifier() << " with '"
+  << *DstOp->getOperand(2) << "' from " << DstM.getModuleIdentifier()
+  << ')';
+  emitWarning(Str);
+}
+
+// Choose the maximum if either source or destination request Max behavior.
+if (DstBehaviorValue == Module::Max || SrcBehaviorValue == Module::Max) {
+  ConstantInt *DstValue =
+  mdconst::extract(DstOp->getOperand(2));
+  ConstantInt *SrcValue =
+  mdconst::extract(SrcOp->getOperand(2));
+
+  // The resulting flag should have a Max behavior, and contain the maximum
+  // value from between the source and destination values.
+  Metadata *FlagOps[] = {
+  (DstBehaviorValue != Module::Max ? SrcOp : DstOp)->getOperand(0), ID,
+  (SrcValue->getZExtValue() > DstValue->getZExtValue() ? SrcOp : DstOp)
+  ->getOperand(2)};
+  MDNode *Flag = MDNode::get(DstM.getContext(), FlagOps);
+  DstModFlags->setOperand(DstIndex, Flag);
+  Flags[ID].first = Flag;
+  continue;
+}
+
 // Perform the merge for standard behavior types.
 switch (SrcBehaviorValue) {
 case Module::Require:
@@ -1305,26 +1345,9 @@ Error IRLinker::linkModuleFlagsMetadata() {
   continue;
 }
 case Module::Warning: {
-  // Emit a warning i

[llvm-branch-commits] [llvm] dbe9c3a - [Support] Don't modify the current EH context during stack unwinding

2020-02-11 Thread Hans Wennborg via llvm-branch-commits

Author: Reid Kleckner
Date: 2020-02-11T11:03:58+01:00
New Revision: dbe9c3a82dd7db8e50acb008f21a273c55fa5c82

URL: 
https://github.com/llvm/llvm-project/commit/dbe9c3a82dd7db8e50acb008f21a273c55fa5c82
DIFF: 
https://github.com/llvm/llvm-project/commit/dbe9c3a82dd7db8e50acb008f21a273c55fa5c82.diff

LOG: [Support] Don't modify the current EH context during stack unwinding

Copy it instead. Otherwise, key registers (such as RBP) may get zeroed
out by the stack unwinder.

Fixes CrashRecoveryTest.DumpStackCleanup with MSVC in release builds.

Reviewed By: stella.stamenova

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

(cherry picked from commit b074acb82f7e75a189fa7933b09627241b166121)

Added: 


Modified: 
llvm/lib/Support/Windows/Signals.inc

Removed: 




diff  --git a/llvm/lib/Support/Windows/Signals.inc 
b/llvm/lib/Support/Windows/Signals.inc
index 8b525f1bd4ac..09e19ae41f1a 100644
--- a/llvm/lib/Support/Windows/Signals.inc
+++ b/llvm/lib/Support/Windows/Signals.inc
@@ -820,7 +820,13 @@ static LONG WINAPI 
LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
<< "\n";
   }
 
-  LocalPrintStackTrace(llvm::errs(), ep ? ep->ContextRecord : nullptr);
+  // Stack unwinding appears to modify the context. Copy it to preserve the
+  // caller's context.
+  CONTEXT ContextCopy;
+  if (ep)
+memcpy(&ContextCopy, ep->ContextRecord, sizeof(ContextCopy));
+
+  LocalPrintStackTrace(llvm::errs(), ep ? &ContextCopy : nullptr);
 
   return EXCEPTION_EXECUTE_HANDLER;
 }



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


[llvm-branch-commits] [llvm] aeba7ba - Add SystemZ release notes

2020-02-11 Thread Ulrich Weigand via llvm-branch-commits

Author: Ulrich Weigand
Date: 2020-02-11T12:52:45+01:00
New Revision: aeba7ba9f3dada09e196d174e7f13b82f01300db

URL: 
https://github.com/llvm/llvm-project/commit/aeba7ba9f3dada09e196d174e7f13b82f01300db
DIFF: 
https://github.com/llvm/llvm-project/commit/aeba7ba9f3dada09e196d174e7f13b82f01300db.diff

LOG: Add SystemZ release notes

Added: 


Modified: 
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 49fabc56c054..20e49b20f95d 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -168,6 +168,19 @@ Tools:
   *   llvm-objdump supports disassembling physical sections for XCOFF object 
files
 
 
+Changes to the SystemZ Target
+-
+
+* Added support for the ``-march=z15`` and ``-mtune=z15`` command line options
+  (as aliases to the existing ``-march=arch13`` and ``-mtune=arch13`` options).
+* Added support for the ``-march=native`` command line option.
+* Added support for the ``-mfentry``, ``-mnop-mcount``, and ``-mrecord-mcount``
+  command line options.
+* Added support for the GHC calling convention.
+* Miscellaneous codegen enhancements, in particular to enable better
+  reuse of condition code values and improved use of conditional
+  move instructions.
+
 Changes to the X86 Target
 -
 



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


[llvm-branch-commits] [llvm] c3d171f - [llvm][TextAPI] add simulators to output

2020-02-11 Thread Cyndy Ishida via llvm-branch-commits

Author: Cyndy Ishida
Date: 2020-02-11T10:32:48-08:00
New Revision: c3d171f8828eb4fe0a32df3119d7ac69af948285

URL: 
https://github.com/llvm/llvm-project/commit/c3d171f8828eb4fe0a32df3119d7ac69af948285
DIFF: 
https://github.com/llvm/llvm-project/commit/c3d171f8828eb4fe0a32df3119d7ac69af948285.diff

LOG: [llvm][TextAPI] add simulators to output

Summary:
* for <= tbd_v3, simulator platforms appear the same as the real
platform and we distinct the difference from the architecture.

fixes: rdar://problem/59161559

Reviewers: ributzka, steven_wu

Reviewed By: ributzka

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

Added: 


Modified: 
llvm/lib/TextAPI/MachO/TextStubCommon.cpp
llvm/unittests/TextAPI/TextStubV3Tests.cpp

Removed: 




diff  --git a/llvm/lib/TextAPI/MachO/TextStubCommon.cpp 
b/llvm/lib/TextAPI/MachO/TextStubCommon.cpp
index e4e58cd66f3f..21be654e130c 100644
--- a/llvm/lib/TextAPI/MachO/TextStubCommon.cpp
+++ b/llvm/lib/TextAPI/MachO/TextStubCommon.cpp
@@ -62,12 +62,18 @@ void ScalarTraits::output(const PlatformSet 
&Values, void *IO,
   case PlatformKind::macOS:
 OS << "macosx";
 break;
+  case PlatformKind::iOSSimulator:
+LLVM_FALLTHROUGH;
   case PlatformKind::iOS:
 OS << "ios";
 break;
+  case PlatformKind::watchOSSimulator:
+LLVM_FALLTHROUGH;
   case PlatformKind::watchOS:
 OS << "watchos";
 break;
+  case PlatformKind::tvOSSimulator:
+LLVM_FALLTHROUGH;
   case PlatformKind::tvOS:
 OS << "tvos";
 break;

diff  --git a/llvm/unittests/TextAPI/TextStubV3Tests.cpp 
b/llvm/unittests/TextAPI/TextStubV3Tests.cpp
index 0180989ff331..a9e54807cc85 100644
--- a/llvm/unittests/TextAPI/TextStubV3Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV3Tests.cpp
@@ -364,6 +364,78 @@ TEST(TBDv3, Platform_zippered) {
 stripWhitespace(Buffer.c_str()));
 }
 
+TEST(TBDv3, Platform_iOSSim) {
+  static const char tbd_v3_platform_iossim[] = "--- !tapi-tbd-v3\n"
+   "archs: [ x86_64 ]\n"
+   "platform: ios\n"
+   "install-name: Test.dylib\n"
+   "...\n";
+
+  auto Result =
+  TextAPIReader::get(MemoryBufferRef(tbd_v3_platform_iossim, "Test.tbd"));
+  EXPECT_TRUE(!!Result);
+  auto Platform = PlatformKind::iOSSimulator;
+  auto File = std::move(Result.get());
+  EXPECT_EQ(FileType::TBD_V3, File->getFileType());
+  EXPECT_EQ(File->getPlatforms().size(), 1U);
+  EXPECT_EQ(Platform, *File->getPlatforms().begin());
+
+  SmallString<4096> Buffer;
+  raw_svector_ostream OS(Buffer);
+  auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
+  EXPECT_TRUE(!WriteResult);
+  EXPECT_EQ(stripWhitespace(tbd_v3_platform_iossim),
+stripWhitespace(Buffer.c_str()));
+}
+
+TEST(TBDv3, Platform_watchOSSim) {
+  static const char tbd_v3_platform_watchossim[] = "--- !tapi-tbd-v3\n"
+   "archs: [ x86_64 ]\n"
+   "platform: watchos\n"
+   "install-name: Test.dylib\n"
+   "...\n";
+
+  auto Result = TextAPIReader::get(
+  MemoryBufferRef(tbd_v3_platform_watchossim, "Test.tbd"));
+  EXPECT_TRUE(!!Result);
+  auto Platform = PlatformKind::watchOSSimulator;
+  auto File = std::move(Result.get());
+  EXPECT_EQ(FileType::TBD_V3, File->getFileType());
+  EXPECT_EQ(File->getPlatforms().size(), 1U);
+  EXPECT_EQ(Platform, *File->getPlatforms().begin());
+
+  SmallString<4096> Buffer;
+  raw_svector_ostream OS(Buffer);
+  auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
+  EXPECT_TRUE(!WriteResult);
+  EXPECT_EQ(stripWhitespace(tbd_v3_platform_watchossim),
+stripWhitespace(Buffer.c_str()));
+}
+
+TEST(TBDv3, Platform_tvOSSim) {
+  static const char tbd_v3_platform_tvossim[] = "--- !tapi-tbd-v3\n"
+"archs: [ x86_64 ]\n"
+"platform: tvos\n"
+"install-name: Test.dylib\n"
+"...\n";
+
+  auto Result =
+  TextAPIReader::get(MemoryBufferRef(tbd_v3_platform_tvossim, "Test.tbd"));
+  EXPECT_TRUE(!!Result);
+  auto File = std::move(Result.get());
+  auto Platform = PlatformKind::tvOSSimulator;
+  EXPECT_EQ(FileType::TBD_V3, File->getFileType());
+  EXPECT_EQ(File->getPlatforms().size(), 1U);
+  EXPECT_EQ(Platform, *File->getPlatforms().begin());
+
+  SmallString<4096> Buffer;
+  raw_svector_ostream OS(Buffer);
+  auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
+  EXPECT_TRUE(!WriteResult);
+  EXPECT_EQ(stripWhitespace(tbd_v3_platform_