[llvm-branch-commits] [clang] 3733420 - When vector is found as a type or non-type id, check if it is really the

2021-04-21 Thread Jamie Schmeiser via llvm-branch-commits

Author: Jamie Schmeiser
Date: 2021-04-21T14:36:00-04:00
New Revision: 3733420a974201b8439f83441aaa8bcf3610fab6

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

LOG: When vector is found as a type or non-type id, check if it is really the
altivec vector token.

Call TryAltiVecVectorToken when an identifier is seen in the parser before
annotating the token.  This checks the next token where necessary to ensure
that vector is properly handled as the altivec token.

Added: 
clang/test/Parser/altivec-non-type-vector.c
clang/test/Parser/altivec-template-vector.cpp
clang/test/Parser/altivec-typedef-vector.c

Modified: 
clang/lib/Parse/Parser.cpp

Removed: 




diff  --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index b178b56e967c6..c4f5f5d3c49d0 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -1695,6 +1695,11 @@ Parser::TryAnnotateName(CorrectionCandidateCallback 
*CCC) {
 break;
 
   case Sema::NC_Type: {
+if (TryAltiVecVectorToken())
+  // vector has been found as a type id when altivec is enabled but
+  // this is followed by a declaration specifier so this is really the
+  // altivec vector token.  Leave it unannotated.
+  break;
 SourceLocation BeginLoc = NameLoc;
 if (SS.isNotEmpty())
   BeginLoc = SS.getBeginLoc();
@@ -1736,6 +1741,11 @@ Parser::TryAnnotateName(CorrectionCandidateCallback 
*CCC) {
 return ANK_Success;
 
   case Sema::NC_NonType:
+if (TryAltiVecVectorToken())
+  // vector has been found as a non-type id when altivec is enabled but
+  // this is followed by a declaration specifier so this is really the
+  // altivec vector token.  Leave it unannotated.
+  break;
 Tok.setKind(tok::annot_non_type);
 setNonTypeAnnotation(Tok, Classification.getNonTypeDecl());
 Tok.setLocation(NameLoc);

diff  --git a/clang/test/Parser/altivec-non-type-vector.c 
b/clang/test/Parser/altivec-non-type-vector.c
new file mode 100644
index 0..38e170da62a99
--- /dev/null
+++ b/clang/test/Parser/altivec-non-type-vector.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -target-feature +altivec -fsyntax-only %s
+
+int vector();
+
+void test() {
+  vector unsigned int v = {0};
+}

diff  --git a/clang/test/Parser/altivec-template-vector.cpp 
b/clang/test/Parser/altivec-template-vector.cpp
new file mode 100644
index 0..3b349e778e1ff
--- /dev/null
+++ b/clang/test/Parser/altivec-template-vector.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -target-feature +altivec %s
+
+template  class vector {
+public:
+  vector(int) {}
+};
+
+void f() {
+  vector int v = {0};
+  vector vi = {0};
+}

diff  --git a/clang/test/Parser/altivec-typedef-vector.c 
b/clang/test/Parser/altivec-typedef-vector.c
new file mode 100644
index 0..e94d332b5d79e
--- /dev/null
+++ b/clang/test/Parser/altivec-typedef-vector.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -target-feature +altivec -fsyntax-only %s
+
+typedef int vector;
+
+void test() {
+  vector unsigned int v = {0};
+}



___
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] 17d0fb7 - Set option default for enabling memory ssa for new pass manager loop sink pass to true.

2021-01-15 Thread Jamie Schmeiser via llvm-branch-commits

Author: Jamie Schmeiser
Date: 2021-01-15T09:56:44-05:00
New Revision: 17d0fb7f574ebc8a6449382983d91715b6977c32

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

LOG: Set option default for enabling memory ssa for new pass manager loop sink 
pass to true.
Summary:
Set the default for the option enabling memory ssa use in the loop sink
pass to true for the new pass manager.
Author: Jamie Schmeiser 
Reviewed By: asbirlea (Alina Sbirlea)
Differential Revision: https://reviews.llvm.org/D92486

Added: 


Modified: 
llvm/lib/Transforms/Scalar/LoopSink.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp 
b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index c20e5e0cbfb3..47698fdde69f 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -70,7 +70,7 @@ static cl::opt MaxNumberOfUseBBsForSinking(
 cl::desc("Do not sink instructions that have too many uses."));
 
 static cl::opt EnableMSSAInLoopSink(
-"enable-mssa-in-loop-sink", cl::Hidden, cl::init(false),
+"enable-mssa-in-loop-sink", cl::Hidden, cl::init(true),
 cl::desc("Enable MemorySSA for LoopSink in new pass manager"));
 
 static cl::opt EnableMSSAInLegacyLoopSink(



___
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] 43a830e - Introduce new quiet mode and new option handling for -print-changed.

2021-01-11 Thread Jamie Schmeiser via llvm-branch-commits

Author: Jamie Schmeiser
Date: 2021-01-11T14:15:18-05:00
New Revision: 43a830ed94180f72533263bb1c40af29510c017a

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

LOG: Introduce new quiet mode and new option handling for -print-changed.
Summary:
Introduce a new mode of operation for -print-changed that only reports
after a pass changes the IR with all of the other messages suppressed (ie,
no initial IR and no messages about ignored, filtered or non-modifying
passes).

The option processing for -print-changed is changed to take an optional
string indicating options for print-changed. Initially, the only option
supported is quiet (as described above). This new quiet mode is specified
with -print-changed=quiet while -print-changed will continue to function
in the same way. It is intended that there will be more options in the
future.

Author: Jamie Schmeiser 
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D92589

Added: 


Modified: 
llvm/include/llvm/Passes/StandardInstrumentations.h
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/test/Other/change-printer.ll

Removed: 




diff  --git a/llvm/include/llvm/Passes/StandardInstrumentations.h 
b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 42751beb0685..795a980878e2 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -152,7 +152,7 @@ class PreservedCFGCheckerInstrumentation {
 // 8.  To compare two IR representations (of type \p T).
 template  class ChangeReporter {
 protected:
-  ChangeReporter() {}
+  ChangeReporter(bool RunInVerboseMode) : VerboseMode(RunInVerboseMode) {}
 
 public:
   virtual ~ChangeReporter();
@@ -204,6 +204,9 @@ template  class ChangeReporter {
   std::vector BeforeStack;
   // Is this the first IR seen?
   bool InitialIR = true;
+
+  // Run in verbose mode, printing everything?
+  const bool VerboseMode;
 };
 
 // An abstract template base class that handles printing banners and
@@ -211,7 +214,7 @@ template  class ChangeReporter {
 template 
 class TextChangeReporter : public ChangeReporter {
 protected:
-  TextChangeReporter();
+  TextChangeReporter(bool Verbose);
 
   // Print a module dump of the first IR that is changed.
   void handleInitialIR(Any IR) override;
@@ -235,7 +238,8 @@ class TextChangeReporter : public ChangeReporter {
 // included in this representation but it is massaged before reporting.
 class IRChangedPrinter : public TextChangeReporter {
 public:
-  IRChangedPrinter() {}
+  IRChangedPrinter(bool VerboseMode)
+  : TextChangeReporter(VerboseMode) {}
   ~IRChangedPrinter() override;
   void registerCallbacks(PassInstrumentationCallbacks &PIC);
 
@@ -274,9 +278,7 @@ class StandardInstrumentations {
   bool VerifyEach;
 
 public:
-  StandardInstrumentations(bool DebugLogging, bool VerifyEach = false)
-  : PrintPass(DebugLogging), OptNone(DebugLogging), Verify(DebugLogging),
-VerifyEach(VerifyEach) {}
+  StandardInstrumentations(bool DebugLogging, bool VerifyEach = false);
 
   void registerCallbacks(PassInstrumentationCallbacks &PIC);
 

diff  --git a/llvm/lib/Passes/StandardInstrumentations.cpp 
b/llvm/lib/Passes/StandardInstrumentations.cpp
index d6351a01ef27..04ff0af2f804 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -64,10 +64,17 @@ static cl::opt
 // can be combined, allowing only changed IRs for certain passes on certain
 // functions to be reported in 
diff erent formats, with the rest being
 // reported as filtered out.  The -print-before-changed option will print
-// the IR as it was before each pass that changed it.
-static cl::opt PrintChanged("print-changed",
-  cl::desc("Print changed IRs"),
-  cl::init(false), cl::Hidden);
+// the IR as it was before each pass that changed it.  The optional
+// value of quiet will only report when the IR changes, suppressing
+// all other messages, including the initial IR.
+enum ChangePrinter { NoChangePrinter, PrintChangedVerbose, PrintChangedQuiet };
+static cl::opt PrintChanged(
+"print-changed", cl::desc("Print changed IRs"), cl::Hidden,
+cl::ValueOptional, cl::init(NoChangePrinter),
+cl::values(clEnumValN(PrintChangedQuiet, "quiet", "Run in quiet mode"),
+   // Sentinel value for unspecified option.
+   clEnumValN(PrintChangedVerbose, "", "")));
+
 // An option that supports the -print-changed option.  See
 // the description for -print-changed for an explanation of the use
 // of this option.  Note that this option has no effect without -print-changed.
@@ -287,7 +294,8 @@ void ChangeReporter::saveIRBeforePass(Any IR, 
StringRef