[PATCH] D151190: [clangd] Do not end inactiveRegions range at position 0 of line

2023-06-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

thanks, looks great.




Comment at: clang-tools-extra/clangd/SourceCode.h:76
+/// Get the last Position on a given line.
+llvm::Expected endOfLine(llvm::StringRef Code, int Line);
+

nit: no need to expose this API, it is only used in SemanticHighlighting.cpp.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151190/new/

https://reviews.llvm.org/D151190

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


[PATCH] D151785: [clangd] Desugar dependent type aliases for auto type hints

2023-06-05 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

Thanks, this is a nice improvement.

A couple of general comments:

- We have an existing heuristic here 
,
 should we move the logic into `maybeDesugar()` so it's all in one place?
- I don't think "dependent type" is the right terminology, "dependent type" 
means "depends on a template parameter //whose value is not yet known//", for 
example `vector::value_type` where we don't know the value of `T`. But here 
we are talking about things like `vector::value_type`. Maybe in place of 
"dependent type alias" we can say "alias for template parameter"?




Comment at: clang-tools-extra/clangd/InlayHints.cpp:198
+bool isDependentOrTrivialSugaredType(QualType QT) {
+  static auto PeelQualifier = [](QualType QT) {
+// Neither `PointerType` nor `ReferenceType` is considered as sugared

nit: it sounds like this name (`PeelQualifier`) is using "qualifier" to mean 
"pointer or reference", which is different from the meaning of the word in 
"QualType" (where it means "const or volatile")

maybe `PeelWrappers` would be a better name, since we can think of 
`PointerType` and `ReferenceType` as wrapping an underlying type?



Comment at: clang-tools-extra/clangd/InlayHints.cpp:201
+// type. Peel it.
+QualType Last = QT;
+for (QT = QT->getPointeeType(); !QT.isNull();

a possible reformulation:

```
QualType Next;
while (!(Next = QT->getPointeeType()).isNull()) {
  QT = Next;
}
return QT;
```

this seems slightly cleaner to me, but I'll leave it up to you



Comment at: clang-tools-extra/clangd/InlayHints.cpp:207
+  };
+  for (QualType Desugared =
+   PeelQualifier(QT->getLocallyUnqualifiedSingleStepDesugaredType());

this loop can also be reformulated to avoid repeating the update step:

```
while (true) {
  QualType Desugared = Peel(...);
  if (Desugared == QT)
break;
  if (Desugared->getAs<...>)
return true;
  QT = Desugared;
}
```



Comment at: clang-tools-extra/clangd/InlayHints.cpp:215
+  return true;
+if (Desugared->getAs())
+  return true;

The only test case that seems to rely on this `BuiltinType` heuristic is 
getting `int` instead of `size_type` for `array.size()`.

`size_type` doesn't seem so bad, maybe we can leave this out for now? Or do you 
have a more compelling motivating case for it?



Comment at: clang-tools-extra/clangd/InlayHints.cpp:235
+// parameter QT.
+QualType tryDesugar(ASTContext &AST, QualType QT) {
+  if (isDependentOrTrivialSugaredType(QT))

name suggestion: `maybeDesugar`

(`try` sounds like it might fail and return something that needs to be checked 
like `optional` or `Expected`)



Comment at: clang-tools-extra/clangd/InlayHints.cpp:267
 StructuredBindingPolicy = TypeHintPolicy;
 StructuredBindingPolicy.PrintCanonicalTypes = true;
   }

zyounan wrote:
> `PrintCanonicalTypes` turns on printing default template arguments, which 
> would prevent the patch from printing, e.g., `std::basic_string`, 
> within the default length limitation.
> 
> ```
> std::map Map;
> 
> for (auto &[Key, Value] : Map) // Key: basic_string, 
> allocator>, whose length exceeds the default threshold.
> 
> ```
> 
> Is it safe to drop it now? I believe this patch can handle the case the 
> comment mentioned.
Unfortunately, I don't think it works in general. I tried commenting out this 
line and 
`TypeHints.StructuredBindings_TupleLike` failed.

(Note, this was with the `BuiltinType` heuristic removed. If we keep the 
`BuilinType` heuristic, a modified version of the testcase (e.g. struct members 
are changed from `int` to a class type) still fails.)



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151785/new/

https://reviews.llvm.org/D151785

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


[PATCH] D148793: [clang-tidy] Implement an include-cleaner check.

2023-06-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D148793#4393386 , @mstorsjo wrote:

> In D148793#4393385 , @mgorny wrote:
>
>> My educated guess would be that `clangIncludeCleaner` is being linked via 
>> `clang_target_link_libraries` while it's not part of `libclang-cpp`, so it 
>> should go into regular `target_link_libraries`.
>
> Yes, that does seem to do the trick. LGTM from my PoV if you can push such a 
> fix, otherwise I can try to do it in a little while...

Looks like it is fixed in 
https://github.com/llvm/llvm-project/commit/ac0ea7555ee4ae872bcd153e04513ba0b88b8985,
 thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148793/new/

https://reviews.llvm.org/D148793

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


[clang-tools-extra] 8ec4498 - [clangd] Do not end inactiveRegions range at position 0 of line

2023-06-05 Thread Nathan Ridge via cfe-commits

Author: Nathan Ridge
Date: 2023-06-05T03:51:15-04:00
New Revision: 8ec44987e54b5366a03716237feb79e37ae0634a

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

LOG: [clangd] Do not end inactiveRegions range at position 0 of line

This carries over the fix previously made for semantic highlighting
https://reviews.llvm.org/D92148, to the new inactiveRegions
protocol as well.

In addition, the directives at the beginning and end of an
inactive region are now excluded from the region.

Fixes https://github.com/clangd/clangd/issues/1631
Fixes https://github.com/clangd/clangd/issues/773

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

Added: 


Modified: 
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang-tools-extra/clangd/SemanticHighlighting.h
clang-tools-extra/clangd/unittests/ClangdTests.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp 
b/clang-tools-extra/clangd/ClangdServer.cpp
index 7c5042b8414b4..cd3a52249dfb7 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -116,8 +116,8 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
 ServerCallbacks->onDiagnosticsReady(Path, AST.version(),
 std::move(Diagnostics));
 if (CollectInactiveRegions) {
-  ServerCallbacks->onInactiveRegionsReady(
-  Path, std::move(AST.getMacros().SkippedRanges));
+  ServerCallbacks->onInactiveRegionsReady(Path,
+  getInactiveRegions(AST));
 }
   });
   }

diff  --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index 34a0214b082bd..ec37476cf94ea 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -39,6 +39,17 @@ namespace clang {
 namespace clangd {
 namespace {
 
+/// Get the last Position on a given line.
+llvm::Expected endOfLine(llvm::StringRef Code, int Line) {
+  auto StartOfLine = positionToOffset(Code, Position{Line, 0});
+  if (!StartOfLine)
+return StartOfLine.takeError();
+  StringRef LineText = Code.drop_front(*StartOfLine).take_until([](char C) {
+return C == '\n';
+  });
+  return Position{Line, static_cast(lspLength(LineText))};
+}
+
 /// Some names are not written in the source code and cannot be highlighted,
 /// e.g. anonymous classes. This function detects those cases.
 bool canHighlightName(DeclarationName Name) {
@@ -516,38 +527,27 @@ class HighlightingsBuilder {
 
 // Merge token stream with "inactive line" markers.
 std::vector WithInactiveLines;
-auto SortedSkippedRanges = AST.getMacros().SkippedRanges;
-llvm::sort(SortedSkippedRanges);
+auto SortedInactiveRegions = getInactiveRegions(AST);
+llvm::sort(SortedInactiveRegions);
 auto It = NonConflicting.begin();
-for (const Range &R : SortedSkippedRanges) {
-  // Create one token for each line in the skipped range, so it works
+for (const Range &R : SortedInactiveRegions) {
+  // Create one token for each line in the inactive range, so it works
   // with line-based 
diff ing.
   assert(R.start.line <= R.end.line);
   for (int Line = R.start.line; Line <= R.end.line; ++Line) {
-// If the end of the inactive range is at the beginning
-// of a line, that line is not inactive.
-if (Line == R.end.line && R.end.character == 0)
-  continue;
 // Copy tokens before the inactive line
 for (; It != NonConflicting.end() && It->R.start.line < Line; ++It)
   WithInactiveLines.push_back(std::move(*It));
 // Add a token for the inactive line itself.
-auto StartOfLine = positionToOffset(MainCode, Position{Line, 0});
-if (StartOfLine) {
-  StringRef LineText =
-  MainCode.drop_front(*StartOfLine).take_until([](char C) {
-return C == '\n';
-  });
+auto EndOfLine = endOfLine(MainCode, Line);
+if (EndOfLine) {
   HighlightingToken HT;
   WithInactiveLines.emplace_back();
   WithInactiveLines.back().Kind = HighlightingKind::InactiveCode;
   WithInactiveLines.back().R.start.line = Line;
-  WithInactiveLines.back().R.end.line = Line;
-  WithInactiveLines.back().R.end.character =
-  static_cast(lspLength(LineText));
+  WithInactiveLines.back().R.end = *EndOfLine;
 } else {
-  elog("Failed to convert position to offset: {0}",
-   StartOfLine.takeError());
+  elo

[PATCH] D151190: [clangd] Do not end inactiveRegions range at position 0 of line

2023-06-05 Thread Nathan Ridge via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8ec44987e54b: [clangd] Do not end inactiveRegions range at 
position 0 of line (authored by nridge).

Changed prior to commit:
  https://reviews.llvm.org/D151190?vs=528190&id=528304#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151190/new/

https://reviews.llvm.org/D151190

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/SemanticHighlighting.h
  clang-tools-extra/clangd/unittests/ClangdTests.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -451,11 +451,11 @@
 
   #define $Macro_decl[[test]]
   #undef $Macro[[test]]
-$InactiveCode[[#ifdef test]]
-$InactiveCode[[#endif]]
+  #ifdef $Macro[[test]]
+  #endif
 
-$InactiveCode[[#if defined(test)]]
-$InactiveCode[[#endif]]
+  #if defined($Macro[[test]])
+  #endif
 )cpp",
   R"cpp(
   struct $Class_def[[S]] {
@@ -562,8 +562,9 @@
   R"cpp(
   // Code in the preamble.
   // Inactive lines get an empty InactiveCode token at the beginning.
-$InactiveCode[[#ifdef test]]
-$InactiveCode[[#endif]]
+  #ifdef $Macro[[test]]
+$InactiveCode[[int Inactive1;]]
+  #endif
 
   // A declaration to cause the preamble to end.
   int $Variable_def[[EndPreamble]];
@@ -572,21 +573,21 @@
   // Code inside inactive blocks does not get regular highlightings
   // because it's not part of the AST.
   #define $Macro_decl[[test2]]
-$InactiveCode[[#if defined(test)]]
+  #if defined($Macro[[test]])
 $InactiveCode[[int Inactive2;]]
-$InactiveCode[[#elif defined(test2)]]
+  #elif defined($Macro[[test2]])
   int $Variable_def[[Active1]];
-$InactiveCode[[#else]]
+  #else
 $InactiveCode[[int Inactive3;]]
-$InactiveCode[[#endif]]
+  #endif
 
   #ifndef $Macro[[test]]
   int $Variable_def[[Active2]];
   #endif
 
-$InactiveCode[[#ifdef test]]
+  #ifdef $Macro[[test]]
 $InactiveCode[[int Inactive4;]]
-$InactiveCode[[#else]]
+  #else
   int $Variable_def[[Active3]];
   #endif
 )cpp",
Index: clang-tools-extra/clangd/unittests/ClangdTests.cpp
===
--- clang-tools-extra/clangd/unittests/ClangdTests.cpp
+++ clang-tools-extra/clangd/unittests/ClangdTests.cpp
@@ -1332,26 +1332,31 @@
 #define PREAMBLEMACRO 42
 #if PREAMBLEMACRO > 40
   #define ACTIVE
-$inactive1[[#else
-  #define INACTIVE
-#endif]]
+#else
+$inactive1[[  #define INACTIVE]]
+#endif
 int endPreamble;
-$inactive2[[#ifndef CMDMACRO
-int inactiveInt;
-#endif]]
+#ifndef CMDMACRO
+$inactive2[[int inactiveInt;]]
+#endif
 #undef CMDMACRO
-$inactive3[[#ifdef CMDMACRO
-  int inactiveInt2;
-#else]]
-  int activeInt;
+#ifdef CMDMACRO
+$inactive3[[  int inactiveInt2;]]
+#elif PREAMBLEMACRO > 0
+  int activeInt1;
+  int activeInt2;
+#else
+$inactive4[[  int inactiveInt3;]]
 #endif
+#ifdef CMDMACRO
+#endif  // empty inactive range, gets dropped
   )cpp");
   Server.addDocument(testPath("foo.cpp"), Source.code());
   ASSERT_TRUE(Server.blockUntilIdleForTest());
   EXPECT_THAT(Callback.FoundInactiveRegions,
-  ElementsAre(ElementsAre(Source.range("inactive1"),
-  Source.range("inactive2"),
-  Source.range("inactive3";
+  ElementsAre(ElementsAre(
+  Source.range("inactive1"), Source.range("inactive2"),
+  Source.range("inactive3"), Source.range("inactive4";
 }
 
 } // namespace
Index: clang-tools-extra/clangd/SemanticHighlighting.h
===
--- clang-tools-extra/clangd/SemanticHighlighting.h
+++ clang-tools-extra/clangd/SemanticHighlighting.h
@@ -120,6 +120,11 @@
 std::vector diffTokens(llvm::ArrayRef Before,
llvm::ArrayRef After);
 
+// Returns ranges of the file that are inside an inactive preprocessor branch.
+// The preprocessor directives at the beginning and end of a branch themselves
+// are not included.
+std::vector getInactiveRegions(ParsedAST &AST);
+
 } // namespace clangd
 } // namespace clang
 
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -39,6 +39,17 @@
 namespace clangd {
 namespace {
 
+/// Get the last Position on a given line.
+llvm::Expected endOfLine(llvm::StringRef Code, int Line) {
+  auto StartOfLine = 

[clang] 225cf64 - fix failures caused by https://reviews.llvm.org/D148490

2023-06-05 Thread Chen Zheng via cfe-commits

Author: Chen Zheng
Date: 2023-06-05T04:00:26-04:00
New Revision: 225cf64e03b4e394c32e95fe1d6414e6e16be094

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

LOG: fix failures caused by https://reviews.llvm.org/D148490

buildbot: https://lab.llvm.org/buildbot/#/builders/214/builds/7823

Added: 
clang/test/Driver/compilation-dir.c

Modified: 
clang/test/Driver/as-version.s
clang/test/Driver/clang_f_opts.c
clang/test/Driver/compress-unavailable.s
clang/test/Driver/debug-options-as.c
clang/test/Driver/debug-prefix-map.S
clang/test/Driver/defsym.s
clang/test/Driver/embed-bitcode.c
clang/test/Driver/integrated-as.c
clang/test/Driver/relax.s

Removed: 




diff  --git a/clang/test/Driver/as-version.s b/clang/test/Driver/as-version.s
index a96b2b5762c65..5003819372be2 100644
--- a/clang/test/Driver/as-version.s
+++ b/clang/test/Driver/as-version.s
@@ -1,6 +1,6 @@
 // Test version information.
 
-// UNSUPPORTED: target={{.*}}-zos{{.*}}
+// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
 // RUN: %clang -Wa,--version -c -fintegrated-as %s -o /dev/null \
 // RUN:   | FileCheck --check-prefix=IAS %s
 // IAS: clang version

diff  --git a/clang/test/Driver/clang_f_opts.c 
b/clang/test/Driver/clang_f_opts.c
index 67ec82a09f852..8060e52d5e8fd 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -517,15 +517,6 @@
 // CHECK-CF-PROTECTION-BRANCH: -fcf-protection=branch
 // CHECK-NO-CF-PROTECTION-BRANCH-NOT: -fcf-protection=branch
 
-// RUN: %clang -### -S -fdebug-compilation-dir . %s 2>&1 | FileCheck 
-check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
-// RUN: %clang -### -S -fdebug-compilation-dir=. %s 2>&1 | FileCheck 
-check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
-// RUN: %clang -### -integrated-as -fdebug-compilation-dir . -x assembler %s 
2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
-// RUN: %clang -### -integrated-as -fdebug-compilation-dir=. -x assembler %s 
2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
-// RUN: %clang -### -S -ffile-compilation-dir=. %s 2>&1 | FileCheck 
-check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
-// RUN: %clang -### -integrated-as -ffile-compilation-dir=. -x assembler %s 
2>&1 | FileCheck -check-prefixes=CHECK-DEBUG-COMPILATION-DIR %s
-// CHECK-DEBUG-COMPILATION-DIR: "-fdebug-compilation-dir=."
-// CHECK-DEBUG-COMPILATION-DIR-NOT: "-ffile-compilation-dir=."
-
 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-compilation-dir=. 
%s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-COMPILATION-DIR %s
 // RUN: %clang -### -S -fprofile-instr-generate -ffile-compilation-dir=. %s 
2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-COMPILATION-DIR %s
 // CHECK-COVERAGE-COMPILATION-DIR: "-fcoverage-compilation-dir=."

diff  --git a/clang/test/Driver/compilation-dir.c 
b/clang/test/Driver/compilation-dir.c
new file mode 100644
index 0..dbe801c9f5fcb
--- /dev/null
+++ b/clang/test/Driver/compilation-dir.c
@@ -0,0 +1,10 @@
+// XFAIL: target={{.*}}-aix{{.*}}
+
+// RUN: %clang -### -S -fdebug-compilation-dir . %s 2>&1 | FileCheck 
-check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
+// RUN: %clang -### -S -fdebug-compilation-dir=. %s 2>&1 | FileCheck 
-check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
+// RUN: %clang -### -integrated-as -fdebug-compilation-dir . -x assembler %s 
2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
+// RUN: %clang -### -integrated-as -fdebug-compilation-dir=. -x assembler %s 
2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
+// RUN: %clang -### -S -ffile-compilation-dir=. %s 2>&1 | FileCheck 
-check-prefix=CHECK-DEBUG-COMPILATION-DIR %s
+// RUN: %clang -### -integrated-as -ffile-compilation-dir=. -x assembler %s 
2>&1 | FileCheck -check-prefixes=CHECK-DEBUG-COMPILATION-DIR %s
+// CHECK-DEBUG-COMPILATION-DIR: "-fdebug-compilation-dir=."
+// CHECK-DEBUG-COMPILATION-DIR-NOT: "-ffile-compilation-dir=."

diff  --git a/clang/test/Driver/compress-unavailable.s 
b/clang/test/Driver/compress-unavailable.s
index e44fcb4ce9d5e..2842c23725eb5 100644
--- a/clang/test/Driver/compress-unavailable.s
+++ b/clang/test/Driver/compress-unavailable.s
@@ -1,3 +1,5 @@
+; XFAIL: target={{.*}}-aix{{.*}}
+
 // RUN: %clang -### -fintegrated-as -gz=none -c %s 2>&1 | FileCheck %s 
--check-prefix=NOWARN
 // NOWARN-NOT: warning: cannot compress debug sections (zlib not enabled)
 

diff  --git a/clang/test/Driver/debug-options-as.c 
b/clang/test/Driver/debug-options-as.c
index 87268e8c5deaf..5bb67e93a1b62 100644
--- a/clang/test/Driver/debug-options-as.c
+++ b/clang/test/Driver/debug-options-as.c
@@ -1,3 +1,5 @@
+; XFAIL: target={{.*}}-aix{{.*}}
+
 // Check to make sure clang is somewhat picky about -g options.
 // (Delived from debug-options.c)
 // rdar:/

[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

thanks, looks good overall, a few more comments




Comment at: clang-tools-extra/clangd/Hover.cpp:1225
 
-  HI.Provider = spellHeader(AST, SM.getFileEntryForID(SM.getMainFileID()), H);
+  HI.Provider = include_cleaner::spellHeader(
+  {H, AST.getPreprocessor().getHeaderSearchInfo(),

we probably need to add a `IncludeSpeller.h` #include insertion for this file, 
and probably for `clangd/IncludeCleaner.cpp` as well



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h:28
+const Header &H;
+HeaderSearch &HS;
+const FileEntry *Main;

nit: we can use `const HeaderSearch&` now if you rebase the patch to main 
branch.



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h:35
+  /// include spelling (with angles/quotes) or an empty string to indicate no
+  /// customizations are needed.
+  virtual std::string operator()(const Input &Input) const = 0;

the doc is stale now, please update it accordingly,



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h:42
+/// strategies, if any. Otherwise, uses header search info to generate
+/// shortest spelling.
+std::string spellHeader(const IncludeSpeller::Input &Input);

and here as well



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h:45
+
+using IncludeSpellingStrategy = llvm::Registry;
+

nit: can you move this statement immediately right after the `IncludeSpeller` 
class? 



Comment at: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp:22
+// Fallback strategy to default spelling via header search.
+class DefaultIncludeSpeller : public IncludeSpeller {
+

nit: can you move this and the `mapHeader` to an anonymous namespace? these 
symbols are only used for the `spellHeader` implementation, we should keep it 
internal to avoid potential ODR violation.



Comment at: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp:33
+std::string mapHeader(const IncludeSpeller::Input &Input) {
+  auto Spellers = [] {
+llvm::SmallVector> Result;

we need a `static` key word before the auto -- this is to make sure we only 
initiate all spellers once (otherwise, we will create all spellers once per 
`spellHeader` call, this can be expensive).



Comment at: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp:59
+  case Header::Physical:
+llvm::errs() << "spelling physical header\n";
+// Spelling physical headers allows for various plug-in strategies.

nit: remove the debugging statement.



Comment at: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp:62
+std::string FinalSpelling = mapHeader(Input);
+if (!FinalSpelling.empty())
+  return FinalSpelling;

no need to check the empty here otherwise we will hit the unreachable statement 
below (it is fine to return empty string)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150185/new/

https://reviews.llvm.org/D150185

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


[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

2023-06-05 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/docs/ClangFormatStyleOptions.rst:790
+
+**AlignConsecutiveShortCaseLabels** (``AlignConsecutiveStyle``) 
:versionbadge:`clang-format 17` :ref:`¶ `
+  Style of aligning consecutive short case labels.

HazardyKnusperkeks wrote:
> MyDeveloperDay wrote:
> > galenelias wrote:
> > > MyDeveloperDay wrote:
> > > > Did you generate this by hand or run the dump_format_style.py function? 
> > > > Format.h and the rst look out of sync
> > > This was generated from dump_format_style.py.  What looks out of sync?  
> > > My guess is the confusing thing is all the styles which use 
> > > `AlignConsecutiveStyle` get the same documentation pasted for them which 
> > > specifically references `AlignConsecutiveMacros` and makes it look like 
> > > it's for the wrong option.
> > that doesn't feel right to me.. not saying its not dump_format_style.py but 
> > it shouldn't do that in my view
> What shouldn't it be doing?
> The struct is used for multiple options and the documentation is that ways 
> since we have the struct.
I understand why its there, I just don't like that the text is repeated and 
doesn't really reference the case statements, (it could be confusing).

for example what would `PadOperators` mean in this case




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151761/new/

https://reviews.llvm.org/D151761

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


[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

2023-06-05 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Apart from the documentation this looks fine.. thats probably outside the scope 
of this change


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151761/new/

https://reviews.llvm.org/D151761

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


[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

2023-06-05 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/docs/ClangFormatStyleOptions.rst:798
+
+case log::info: return "info:";
+case log::warning:  return "warning:";

Do you think the documentation should give examples of the the other cases?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151761/new/

https://reviews.llvm.org/D151761

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


[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

2023-06-05 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

did you consider a case where the case falls through? (i.e. no return)

  "case log::info :return \"info\";\n"
  "case log::warning :\n"
  "default :   return \"default\";\n"


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151761/new/

https://reviews.llvm.org/D151761

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


[PATCH] D152126: [WebAssembly] Add tests ensuring rotates persist

2023-06-05 Thread Paulo Matos via Phabricator via cfe-commits
pmatos created this revision.
pmatos added reviewers: dschuff, tlively.
Herald added subscribers: asb, wingo, sunfish, jgravelle-google, sbc100.
Herald added a project: All.
pmatos requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, aheejin.
Herald added projects: clang, LLVM.

Due to the nature of WebAssembly, it's always better to keep
rotates instead of trying to optimize it. Commit 9485d983 

disabled the generation of fsh for rotates, however these
tests ensure that future changes don't change the behaviour for
the Wasm backend that tends to have different optimization
requirements than other architectures. Also see:
https://github.com/llvm/llvm-project/issues/62703


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152126

Files:
  clang/test/CodeGen/WebAssembly/wasm-rotate.c
  llvm/test/CodeGen/WebAssembly/rotate-i3264.ll

Index: llvm/test/CodeGen/WebAssembly/rotate-i3264.ll
===
--- /dev/null
+++ llvm/test/CodeGen/WebAssembly/rotate-i3264.ll
@@ -0,0 +1,48 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: sed 's/iX/i32/g' %s | llc --mtriple=wasm32-unknown-unknown | FileCheck --check-prefix=I32 %s
+; RUN: sed 's/iX/i64/g' %s | llc --mtriple=wasm64-unknown-unknown | FileCheck --check-prefix=I64 %s
+
+declare iX @llvm.fshl.iX(iX, iX, iX)
+declare iX @llvm.fshr.iX(iX, iX, iX)
+
+; from https://github.com/llvm/llvm-project/issues/62703
+
+define iX @testLeft(iX noundef %0, iX noundef %1) {
+; I32-LABEL: testLeft:
+; I32: .functype testLeft (i32, i32) -> (i32)
+; I32-NEXT:  # %bb.0:
+; I32-NEXT:local.get 0
+; I32-NEXT:local.get 1
+; I32-NEXT:i32.rotl
+; I32-NEXT:# fallthrough-return
+;
+; I64-LABEL: testLeft:
+; I64: .functype testLeft (i64, i64) -> (i64)
+; I64-NEXT:  # %bb.0:
+; I64-NEXT:local.get 0
+; I64-NEXT:local.get 1
+; I64-NEXT:i64.rotl
+; I64-NEXT:# fallthrough-return
+  %3 = call iX @llvm.fshl.iX(iX %0, iX %0, iX %1)
+  ret iX %3
+}
+
+define iX @testRight(iX noundef %0, iX noundef %1) {
+; I32-LABEL: testRight:
+; I32: .functype testRight (i32, i32) -> (i32)
+; I32-NEXT:  # %bb.0:
+; I32-NEXT:local.get 0
+; I32-NEXT:local.get 1
+; I32-NEXT:i32.rotr
+; I32-NEXT:# fallthrough-return
+;
+; I64-LABEL: testRight:
+; I64: .functype testRight (i64, i64) -> (i64)
+; I64-NEXT:  # %bb.0:
+; I64-NEXT:local.get 0
+; I64-NEXT:local.get 1
+; I64-NEXT:i64.rotr
+; I64-NEXT:# fallthrough-return
+  %3 = call iX @llvm.fshr.iX(iX %0, iX %0, iX %1)
+  ret iX %3
+}
Index: clang/test/CodeGen/WebAssembly/wasm-rotate.c
===
--- /dev/null
+++ clang/test/CodeGen/WebAssembly/wasm-rotate.c
@@ -0,0 +1,53 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -o - -emit-llvm %s | FileCheck --check-prefix=WEBASSEMBLY32 %s
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -o - -emit-llvm %s | FileCheck --check-prefix=WEBASSEMBLY64 %s
+
+// WEBASSEMBLY32-LABEL: define i32 @test32
+// WEBASSEMBLY32-SAME: (i32 noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] {
+// WEBASSEMBLY32-NEXT:  entry:
+// WEBASSEMBLY32-NEXT:[[X_ADDR:%.*]] = alloca i32, align 4
+// WEBASSEMBLY32-NEXT:store i32 [[X]], ptr [[X_ADDR]], align 4
+// WEBASSEMBLY32-NEXT:[[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4
+// WEBASSEMBLY32-NEXT:[[AND:%.*]] = and i32 [[TMP0]], -16711936
+// WEBASSEMBLY32-NEXT:[[TMP1:%.*]] = call i32 @llvm.fshl.i32(i32 [[AND]], i32 [[AND]], i32 8)
+// WEBASSEMBLY32-NEXT:ret i32 [[TMP1]]
+//
+// WEBASSEMBLY64-LABEL: define i32 @test32
+// WEBASSEMBLY64-SAME: (i32 noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] {
+// WEBASSEMBLY64-NEXT:  entry:
+// WEBASSEMBLY64-NEXT:[[X_ADDR:%.*]] = alloca i32, align 4
+// WEBASSEMBLY64-NEXT:store i32 [[X]], ptr [[X_ADDR]], align 4
+// WEBASSEMBLY64-NEXT:[[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4
+// WEBASSEMBLY64-NEXT:[[AND:%.*]] = and i32 [[TMP0]], -16711936
+// WEBASSEMBLY64-NEXT:[[TMP1:%.*]] = call i32 @llvm.fshl.i32(i32 [[AND]], i32 [[AND]], i32 8)
+// WEBASSEMBLY64-NEXT:ret i32 [[TMP1]]
+//
+unsigned int test32(unsigned int x) {
+  return __builtin_rotateleft32((x & 0xFF00FF00), 8);
+}
+
+// WEBASSEMBLY32-LABEL: define i32 @test64
+// WEBASSEMBLY32-SAME: (i32 noundef [[X:%.*]]) #[[ATTR0]] {
+// WEBASSEMBLY32-NEXT:  entry:
+// WEBASSEMBLY32-NEXT:[[X_ADDR:%.*]] = alloca i32, align 4
+// WEBASSEMBLY32-NEXT:store i32 [[X]], ptr [[X_ADDR]], align 4
+// WEBASSEMBLY32-NEXT:[[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4
+// WEBASSEMBLY32-NEXT:[[CONV:%.*]] = zext i32 [[TMP0]] to i64
+// WEBASSEMBLY32-NEXT:[[AND:%.*]] = and i64 [[CONV]], -71777214294589696
+/

[PATCH] D151863: [x86][MC] Fix movdir64b addressing

2023-06-05 Thread Akshay Khadse via Phabricator via cfe-commits
akshaykhadse updated this revision to Diff 528311.
akshaykhadse added a comment.

Remove logic to set BaseReg to non-zero value


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151863/new/

https://reviews.llvm.org/D151863

Files:
  clang/test/CodeGen/ms-inline-asm-64.c
  clang/test/CodeGen/ms-inline-asm.c
  llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp


Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
===
--- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1776,10 +1776,6 @@
  BaseReg && IndexReg));
 return false;
   }
-  // Otherwise, we set the base register to a non-zero value
-  // if we don't know the actual value at this time.  This is necessary to
-  // get the matching correct in some cases.
-  BaseReg = BaseReg ? BaseReg : 1;
   Operands.push_back(X86Operand::CreateMem(
   getPointerWidth(), SegReg, Disp, BaseReg, IndexReg, Scale, Start, End,
   Size,
Index: clang/test/CodeGen/ms-inline-asm.c
===
--- clang/test/CodeGen/ms-inline-asm.c
+++ clang/test/CodeGen/ms-inline-asm.c
@@ -675,6 +675,13 @@
   // CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", 
"~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"()
 }
 
+void t47(void) {
+  // CHECK-LABEL: define{{.*}} void @t47
+  int arr[1000];
+  __asm movdir64b eax, zmmword ptr [arr]
+  // CHECK: call void asm sideeffect inteldialect "movdir64b eax, zmmword ptr 
$0", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+}
+
 void dot_operator(void){
   // CHECK-LABEL: define{{.*}} void @dot_operator
__asm { mov eax, 3[ebx]A.b}
Index: clang/test/CodeGen/ms-inline-asm-64.c
===
--- clang/test/CodeGen/ms-inline-asm-64.c
+++ clang/test/CodeGen/ms-inline-asm-64.c
@@ -72,3 +72,10 @@
   // CHECK-SAME: jmp ${1:P}
   // CHECK-SAME: "*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void 
(...)) @bar, ptr elementtype(void (...)) @bar)
 }
+
+void t47(void) {
+  // CHECK-LABEL: define{{.*}} void @t47
+  int arr[1000];
+  __asm movdir64b rax, zmmword ptr [arr]
+  // CHECK: call void asm sideeffect inteldialect "movdir64b rax, zmmword ptr 
$0", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+}


Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
===
--- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1776,10 +1776,6 @@
  BaseReg && IndexReg));
 return false;
   }
-  // Otherwise, we set the base register to a non-zero value
-  // if we don't know the actual value at this time.  This is necessary to
-  // get the matching correct in some cases.
-  BaseReg = BaseReg ? BaseReg : 1;
   Operands.push_back(X86Operand::CreateMem(
   getPointerWidth(), SegReg, Disp, BaseReg, IndexReg, Scale, Start, End,
   Size,
Index: clang/test/CodeGen/ms-inline-asm.c
===
--- clang/test/CodeGen/ms-inline-asm.c
+++ clang/test/CodeGen/ms-inline-asm.c
@@ -675,6 +675,13 @@
   // CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", "~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"()
 }
 
+void t47(void) {
+  // CHECK-LABEL: define{{.*}} void @t47
+  int arr[1000];
+  __asm movdir64b eax, zmmword ptr [arr]
+  // CHECK: call void asm sideeffect inteldialect "movdir64b eax, zmmword ptr $0", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+}
+
 void dot_operator(void){
   // CHECK-LABEL: define{{.*}} void @dot_operator
 	__asm { mov eax, 3[ebx]A.b}
Index: clang/test/CodeGen/ms-inline-asm-64.c
===
--- clang/test/CodeGen/ms-inline-asm-64.c
+++ clang/test/CodeGen/ms-inline-asm-64.c
@@ -72,3 +72,10 @@
   // CHECK-SAME: jmp ${1:P}
   // CHECK-SAME: "*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (...)) @bar, ptr elementtype(void (...)) @bar)
 }
+
+void t47(void) {
+  // CHECK-LABEL: define{{.*}} void @t47
+  int arr[1000];
+  __asm movdir64b rax, zmmword ptr [arr]
+  // CHECK: call void asm sideeffect inteldialect "movdir64b rax, zmmword ptr $0", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 528315.
VitaNuo marked 11 inline comments as done.
VitaNuo added a comment.
Herald added subscribers: PiotrZSL, carlosgalvezp.
Herald added a reviewer: njames93.

Address review comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150185/new/

https://reviews.llvm.org/D150185

Files:
  clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/IncludeCleaner.h
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
  
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h
  clang-tools-extra/include-cleaner/lib/Analysis.cpp
  clang-tools-extra/include-cleaner/lib/CMakeLists.txt
  clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
  clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
  clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp

Index: clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp
===
--- /dev/null
+++ clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp
@@ -0,0 +1,78 @@
+//===--- IncludeSpellerTest.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang-include-cleaner/IncludeSpeller.h"
+#include "clang-include-cleaner/Analysis.h"
+#include "clang-include-cleaner/Types.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Testing/TestAST.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+namespace clang::include_cleaner {
+namespace {
+
+const char *testRoot() {
+#ifdef _WIN32
+  return "C:\\include-cleaner-test";
+#else
+  return "/include-cleaner-test";
+#endif
+}
+
+std::string testPath(llvm::StringRef File) {
+  assert(llvm::sys::path::is_relative(File) && "FileName should be relative");
+
+  llvm::SmallString<32> NativeFile = File;
+  llvm::sys::path::native(NativeFile, llvm::sys::path::Style::native);
+  llvm::SmallString<32> Path;
+  llvm::sys::path::append(Path, llvm::sys::path::Style::native, testRoot(),
+  NativeFile);
+  return std::string(Path.str());
+}
+
+class DummyIncludeSpeller : public IncludeSpeller {
+public:
+  std::string operator()(const IncludeSpeller::Input &Input) const override {
+llvm::StringRef AbsolutePath = Input.H.physical()->tryGetRealPathName();
+std::string RootWithSeparator{testRoot()};
+RootWithSeparator += llvm::sys::path::get_separator();
+if (!AbsolutePath.consume_front(llvm::StringRef{RootWithSeparator}))
+  return "";
+return "\"" + AbsolutePath.str() + "\"";
+  }
+};
+
+TEST(IncludeSpeller, IsRelativeToTestRoot) {
+  TestInputs Inputs;
+
+  Inputs.ExtraArgs.push_back("-isystemdir");
+
+  Inputs.ExtraFiles[testPath("foo.h")] = "";
+  Inputs.ExtraFiles["dir/header.h"] = "";
+  TestAST AST{Inputs};
+
+  auto &FM = AST.fileManager();
+  auto &HS = AST.preprocessor().getHeaderSearchInfo();
+  const auto *MainFile = AST.sourceManager().getFileEntryForID(
+  AST.sourceManager().getMainFileID());
+
+  EXPECT_EQ("\"foo.h\"", spellHeader({Header{*FM.getFile(testPath("foo.h"))},
+  HS, MainFile}));
+  EXPECT_EQ("",
+spellHeader({Header{*FM.getFile("dir/header.h")}, HS, MainFile}));
+}
+
+IncludeSpellingStrategy::Add
+Speller("dummy", "Dummy Include Speller");
+
+} // namespace
+} // namespace clang::include_cleaner
Index: clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
===
--- clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
+++ clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
@@ -7,6 +7,7 @@
 add_unittest(ClangIncludeCleanerUnitTests ClangIncludeCleanerTests
   AnalysisTest.cpp
   FindHeadersTest.cpp
+  IncludeSpellerTest.cpp
   LocateSymbolTest.cpp
   RecordTest.cpp
   TypesTest.cpp
Index: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
===
--- /dev/null
+++ clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
@@ -0,0 +1,66 @@
+//===--- IncludeSpeller.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang-include

[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo added a comment.

Thanks for the comments!




Comment at: clang-tools-extra/clangd/Hover.cpp:1225
 
-  HI.Provider = spellHeader(AST, SM.getFileEntryForID(SM.getMainFileID()), H);
+  HI.Provider = include_cleaner::spellHeader(
+  {H, AST.getPreprocessor().getHeaderSearchInfo(),

hokein wrote:
> we probably need to add a `IncludeSpeller.h` #include insertion for this 
> file, and probably for `clangd/IncludeCleaner.cpp` as well
Yeah also to the `IncludeCleanerCheck.cpp` now that I've rebased to main.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150185/new/

https://reviews.llvm.org/D150185

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


[clang] b447dc5 - use // instad of ; in c file tests, NFC

2023-06-05 Thread Chen Zheng via cfe-commits

Author: Chen Zheng
Date: 2023-06-05T05:02:38-04:00
New Revision: b447dc5a4704bef8ced95495aa8d9ea477a26814

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

LOG: use // instad of ; in c file tests, NFC

Added: 


Modified: 
clang/test/Driver/compress-unavailable.s
clang/test/Driver/debug-options-as.c
clang/test/Driver/debug-prefix-map.S
clang/test/Driver/defsym.s
clang/test/Driver/integrated-as.c

Removed: 




diff  --git a/clang/test/Driver/compress-unavailable.s 
b/clang/test/Driver/compress-unavailable.s
index 2842c23725eb5..de422fb088b7d 100644
--- a/clang/test/Driver/compress-unavailable.s
+++ b/clang/test/Driver/compress-unavailable.s
@@ -1,4 +1,4 @@
-; XFAIL: target={{.*}}-aix{{.*}}
+// XFAIL: target={{.*}}-aix{{.*}}
 
 // RUN: %clang -### -fintegrated-as -gz=none -c %s 2>&1 | FileCheck %s 
--check-prefix=NOWARN
 // NOWARN-NOT: warning: cannot compress debug sections (zlib not enabled)

diff  --git a/clang/test/Driver/debug-options-as.c 
b/clang/test/Driver/debug-options-as.c
index 5bb67e93a1b62..259ad583edaa4 100644
--- a/clang/test/Driver/debug-options-as.c
+++ b/clang/test/Driver/debug-options-as.c
@@ -1,4 +1,4 @@
-; XFAIL: target={{.*}}-aix{{.*}}
+// XFAIL: target={{.*}}-aix{{.*}}
 
 // Check to make sure clang is somewhat picky about -g options.
 // (Delived from debug-options.c)

diff  --git a/clang/test/Driver/debug-prefix-map.S 
b/clang/test/Driver/debug-prefix-map.S
index ae526525f154c..febf608690420 100644
--- a/clang/test/Driver/debug-prefix-map.S
+++ b/clang/test/Driver/debug-prefix-map.S
@@ -1,4 +1,4 @@
-; XFAIL: target={{.*}}-aix{{.*}}
+// XFAIL: target={{.*}}-aix{{.*}}
 
 // RUN: %clang -### -g -fintegrated-as -fdebug-prefix-map=old=new %s 2>&1 | 
FileCheck %s
 // RUN: %clang -### -g -fintegrated-as -ffile-prefix-map=old=new %s 2>&1 | 
FileCheck %s

diff  --git a/clang/test/Driver/defsym.s b/clang/test/Driver/defsym.s
index ecd13a2e497f3..165c71b2eae97 100644
--- a/clang/test/Driver/defsym.s
+++ b/clang/test/Driver/defsym.s
@@ -1,4 +1,4 @@
-; XFAIL: target={{.*}}-aix{{.*}}
+// XFAIL: target={{.*}}-aix{{.*}}
 
 // RUN: %clang -### -c -integrated-as %s \
 // RUN: -Wa,-defsym,abc=5 -Wa,-defsym,xyz=0xa \

diff  --git a/clang/test/Driver/integrated-as.c 
b/clang/test/Driver/integrated-as.c
index aca0ba2d19d8d..d7658fdfd6337 100644
--- a/clang/test/Driver/integrated-as.c
+++ b/clang/test/Driver/integrated-as.c
@@ -1,4 +1,4 @@
-; XFAIL: target={{.*}}-aix{{.*}}
+// XFAIL: target={{.*}}-aix{{.*}}
 
 // RUN: %clang -### -c -save-temps -integrated-as %s 2>&1 | FileCheck %s
 



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


[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Thanks, looks great!




Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h:22
+
+class IncludeSpeller {
+

would be nice to add some documentation for this interface, something like

```
IncludeSpeller provides an extension point to allow clients implement custom 
include spelling strategies applications for physical headers.
```



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h:23
+class IncludeSpeller {
+
+public:

nit: remove the extra blank line.



Comment at: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp:24
+class DefaultIncludeSpeller : public IncludeSpeller {
+
+  std::string operator()(const Input &Input) const override {

add a `public:`.



Comment at: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp:33
+
+std::string mapHeader(const IncludeSpeller::Input &Input) {
+  static auto Spellers = [] {

nit: maybe name it `spellPhysicalHeader`( I'd avoid using `map`, it reminds me 
too much on the stdlib mapping).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150185/new/

https://reviews.llvm.org/D150185

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


[PATCH] D152132: [clang][Inter] Fix lifetime diagnostics for dead records

2023-06-05 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

  This used to crash the interpreter, either because we ran into the
  assertion in CheckMutable() or because we accessed a Descriptor* pointer
  preceding the field of a record. Those are preceded by an
  InlineDescriptor though.

Also, we forgot to handle the metadata when moving the `Block` over to a 
`DeadBlock`.

(Regarding the InlineDescriptor stuff from above... I didn't add it in this 
patch because the problem does not require it, but I'll do fix that later).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152132

Files:
  clang/lib/AST/Interp/Descriptor.cpp
  clang/lib/AST/Interp/Interp.cpp
  clang/lib/AST/Interp/InterpBlock.h
  clang/lib/AST/Interp/InterpState.cpp
  clang/test/AST/Interp/lifetimes.cpp


Index: clang/test/AST/Interp/lifetimes.cpp
===
--- /dev/null
+++ clang/test/AST/Interp/lifetimes.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s
+// RUN: %clang_cc1 -verify=ref %s
+
+struct Foo {
+  int a;
+};
+
+constexpr int dead1() { // expected-error {{never produces a constant 
expression}}
+
+  Foo *F2 = nullptr;
+  {
+Foo F{12}; // expected-note 2{{declared here}}
+F2 = &F;
+  } // Ends lifetime of F.
+
+  return F2->a; // expected-note 2{{read of variable whose lifetime has 
ended}} \
+// ref-note {{read of object outside its lifetime is not 
allowed in a constant expression}}
+}
+static_assert(dead1() == 1, ""); // expected-error {{not an integral constant 
expression}} \
+ // expected-note {{in call to}} \
+ // ref-error {{not an integral constant 
expression}} \
+ // ref-note {{in call to}} \
+
+
Index: clang/lib/AST/Interp/InterpState.cpp
===
--- clang/lib/AST/Interp/InterpState.cpp
+++ clang/lib/AST/Interp/InterpState.cpp
@@ -54,9 +54,13 @@
 char *Memory = reinterpret_cast(malloc(sizeof(DeadBlock) + Size));
 auto *D = new (Memory) DeadBlock(DeadBlocks, B);
 
-// Move data from one block to another.
-if (Desc->MoveFn)
+// Move data and metadata from the old block to the new (dead)block.
+if (Desc->MoveFn) {
   Desc->MoveFn(B, B->data(), D->data(), Desc);
+  if (Desc->getMetadataSize() > 0)
+std::memcpy(D->rawData(), B->rawData(), Desc->getMetadataSize());
+}
+
   } else {
 // Free storage, if necessary.
 if (Desc->DtorFn)
Index: clang/lib/AST/Interp/InterpBlock.h
===
--- clang/lib/AST/Interp/InterpBlock.h
+++ clang/lib/AST/Interp/InterpBlock.h
@@ -151,6 +151,7 @@
 
   /// Returns a pointer to the stored data.
   char *data() { return B.data(); }
+  char *rawData() { return B.rawData(); }
 
 private:
   friend class Block;
Index: clang/lib/AST/Interp/Interp.cpp
===
--- clang/lib/AST/Interp/Interp.cpp
+++ clang/lib/AST/Interp/Interp.cpp
@@ -238,7 +238,6 @@
 }
 
 bool CheckMutable(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
-  assert(Ptr.isLive() && "Pointer is not live");
   if (!Ptr.isMutable()) {
 return true;
   }
Index: clang/lib/AST/Interp/Descriptor.cpp
===
--- clang/lib/AST/Interp/Descriptor.cpp
+++ clang/lib/AST/Interp/Descriptor.cpp
@@ -165,9 +165,8 @@
 static void moveRecord(Block *B, char *Src, char *Dst, const Descriptor *D) {
   for (const auto &F : D->ElemRecord->fields()) {
 auto FieldOff = F.Offset;
-auto FieldDesc = F.Desc;
+auto *FieldDesc = F.Desc;
 
-*(reinterpret_cast(Dst + FieldOff) - 1) = FieldDesc;
 if (auto Fn = FieldDesc->MoveFn)
   Fn(B, Src + FieldOff, Dst + FieldOff, FieldDesc);
   }


Index: clang/test/AST/Interp/lifetimes.cpp
===
--- /dev/null
+++ clang/test/AST/Interp/lifetimes.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify %s
+// RUN: %clang_cc1 -verify=ref %s
+
+struct Foo {
+  int a;
+};
+
+constexpr int dead1() { // expected-error {{never produces a constant expression}}
+
+  Foo *F2 = nullptr;
+  {
+Foo F{12}; // expected-note 2{{declared here}}
+F2 = &F;
+  } // Ends lifetime of F.
+
+  return F2->a; // expected-note 2{{read of variable whose lifetime has ended}} \
+// ref-note {{read of object outside its lifetime is not allowed in a constant expression}}
+}
+static_assert(dead1() == 1, ""); // expected-error {{not an integral constant expression}} \
+ // expected-no

[PATCH] D151863: [x86][MC] Fix movdir64b addressing

2023-06-05 Thread Akshay Khadse via Phabricator via cfe-commits
akshaykhadse updated this revision to Diff 528339.
akshaykhadse added a comment.

Add more tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151863/new/

https://reviews.llvm.org/D151863

Files:
  clang/test/CodeGen/ms-inline-asm-64.c
  clang/test/CodeGen/ms-inline-asm.c
  llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  llvm/test/CodeGen/X86/movdir64b-inline-asm-x86_64.ll
  llvm/test/CodeGen/X86/movdir64b-inline-asm.ll


Index: llvm/test/CodeGen/X86/movdir64b-inline-asm.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/movdir64b-inline-asm.ll
@@ -0,0 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 2
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+movdir64b | FileCheck %s 
--check-prefix=X86
+
+define void @test_movdir64b() {
+; X86-LABEL: test_movdir64b:
+; X86:   # %bb.0: # %entry
+; X86-NEXT:subl $4000, %esp # imm = 0xFA0
+; X86-NEXT:.cfi_def_cfa_offset 4004
+; X86-NEXT:#APP
+; X86-EMPTY:
+; X86-NEXT:movdir64b (%esp), %eax
+; X86-EMPTY:
+; X86-NEXT:#NO_APP
+; X86-NEXT:addl $4000, %esp # imm = 0xFA0
+; X86-NEXT:.cfi_def_cfa_offset 4
+; X86-NEXT:retl
+entry:
+  %arr = alloca [1000 x i32], align 4
+  call void asm sideeffect inteldialect "movdir64b eax, zmmword ptr $0", 
"*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+  ret void
+}
Index: llvm/test/CodeGen/X86/movdir64b-inline-asm-x86_64.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/movdir64b-inline-asm-x86_64.ll
@@ -0,0 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 2
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+movdir64b | FileCheck 
%s --check-prefix=X64
+
+define void @test_movdir64b() {
+; X64-LABEL: test_movdir64b:
+; X64:   # %bb.0: # %entry
+; X64-NEXT:subq $3880, %rsp # imm = 0xF28
+; X64-NEXT:.cfi_def_cfa_offset 3888
+; X64-NEXT:#APP
+; X64-EMPTY:
+; X64-NEXT:movdir64b -{{[0-9]+}}(%rsp), %rax
+; X64-EMPTY:
+; X64-NEXT:#NO_APP
+; X64-NEXT:addq $3880, %rsp # imm = 0xF28
+; X64-NEXT:.cfi_def_cfa_offset 8
+; X64-NEXT:retq
+entry:
+  %arr = alloca [1000 x i32], align 16
+  call void asm sideeffect inteldialect "movdir64b rax, zmmword ptr $0", 
"*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+  ret void
+}
Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
===
--- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1776,10 +1776,6 @@
  BaseReg && IndexReg));
 return false;
   }
-  // Otherwise, we set the base register to a non-zero value
-  // if we don't know the actual value at this time.  This is necessary to
-  // get the matching correct in some cases.
-  BaseReg = BaseReg ? BaseReg : 1;
   Operands.push_back(X86Operand::CreateMem(
   getPointerWidth(), SegReg, Disp, BaseReg, IndexReg, Scale, Start, End,
   Size,
Index: clang/test/CodeGen/ms-inline-asm.c
===
--- clang/test/CodeGen/ms-inline-asm.c
+++ clang/test/CodeGen/ms-inline-asm.c
@@ -675,6 +675,13 @@
   // CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", 
"~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"()
 }
 
+void t47(void) {
+  // CHECK-LABEL: define{{.*}} void @t47
+  int arr[1000];
+  __asm movdir64b eax, zmmword ptr [arr]
+  // CHECK: call void asm sideeffect inteldialect "movdir64b eax, zmmword ptr 
$0", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+}
+
 void dot_operator(void){
   // CHECK-LABEL: define{{.*}} void @dot_operator
__asm { mov eax, 3[ebx]A.b}
Index: clang/test/CodeGen/ms-inline-asm-64.c
===
--- clang/test/CodeGen/ms-inline-asm-64.c
+++ clang/test/CodeGen/ms-inline-asm-64.c
@@ -72,3 +72,10 @@
   // CHECK-SAME: jmp ${1:P}
   // CHECK-SAME: "*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void 
(...)) @bar, ptr elementtype(void (...)) @bar)
 }
+
+void t47(void) {
+  // CHECK-LABEL: define{{.*}} void @t47
+  int arr[1000];
+  __asm movdir64b rax, zmmword ptr [arr]
+  // CHECK: call void asm sideeffect inteldialect "movdir64b rax, zmmword ptr 
$0", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype([1000 x i32]) %arr)
+}


Index: llvm/test/CodeGen/X86/movdir64b-inline-asm.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/movdir64b-inline-asm.ll
@@ -0,0 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+movdir64b | FileCheck %s --ch

[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 528341.
VitaNuo marked 4 inline comments as done.
VitaNuo added a comment.

Address the comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150185/new/

https://reviews.llvm.org/D150185

Files:
  clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/IncludeCleaner.h
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
  
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h
  clang-tools-extra/include-cleaner/lib/Analysis.cpp
  clang-tools-extra/include-cleaner/lib/CMakeLists.txt
  clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
  clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
  clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp

Index: clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp
===
--- /dev/null
+++ clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp
@@ -0,0 +1,78 @@
+//===--- IncludeSpellerTest.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang-include-cleaner/IncludeSpeller.h"
+#include "clang-include-cleaner/Analysis.h"
+#include "clang-include-cleaner/Types.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Testing/TestAST.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+namespace clang::include_cleaner {
+namespace {
+
+const char *testRoot() {
+#ifdef _WIN32
+  return "C:\\include-cleaner-test";
+#else
+  return "/include-cleaner-test";
+#endif
+}
+
+std::string testPath(llvm::StringRef File) {
+  assert(llvm::sys::path::is_relative(File) && "FileName should be relative");
+
+  llvm::SmallString<32> NativeFile = File;
+  llvm::sys::path::native(NativeFile, llvm::sys::path::Style::native);
+  llvm::SmallString<32> Path;
+  llvm::sys::path::append(Path, llvm::sys::path::Style::native, testRoot(),
+  NativeFile);
+  return std::string(Path.str());
+}
+
+class DummyIncludeSpeller : public IncludeSpeller {
+public:
+  std::string operator()(const IncludeSpeller::Input &Input) const override {
+llvm::StringRef AbsolutePath = Input.H.physical()->tryGetRealPathName();
+std::string RootWithSeparator{testRoot()};
+RootWithSeparator += llvm::sys::path::get_separator();
+if (!AbsolutePath.consume_front(llvm::StringRef{RootWithSeparator}))
+  return "";
+return "\"" + AbsolutePath.str() + "\"";
+  }
+};
+
+TEST(IncludeSpeller, IsRelativeToTestRoot) {
+  TestInputs Inputs;
+
+  Inputs.ExtraArgs.push_back("-isystemdir");
+
+  Inputs.ExtraFiles[testPath("foo.h")] = "";
+  Inputs.ExtraFiles["dir/header.h"] = "";
+  TestAST AST{Inputs};
+
+  auto &FM = AST.fileManager();
+  auto &HS = AST.preprocessor().getHeaderSearchInfo();
+  const auto *MainFile = AST.sourceManager().getFileEntryForID(
+  AST.sourceManager().getMainFileID());
+
+  EXPECT_EQ("\"foo.h\"", spellHeader({Header{*FM.getFile(testPath("foo.h"))},
+  HS, MainFile}));
+  EXPECT_EQ("",
+spellHeader({Header{*FM.getFile("dir/header.h")}, HS, MainFile}));
+}
+
+IncludeSpellingStrategy::Add
+Speller("dummy", "Dummy Include Speller");
+
+} // namespace
+} // namespace clang::include_cleaner
Index: clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
===
--- clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
+++ clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
@@ -7,6 +7,7 @@
 add_unittest(ClangIncludeCleanerUnitTests ClangIncludeCleanerTests
   AnalysisTest.cpp
   FindHeadersTest.cpp
+  IncludeSpellerTest.cpp
   LocateSymbolTest.cpp
   RecordTest.cpp
   TypesTest.cpp
Index: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
===
--- /dev/null
+++ clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
@@ -0,0 +1,66 @@
+//===--- IncludeSpeller.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang-include-cleaner/IncludeSpeller.h"
+#include "clang-include-cleaner/Types.h"
+#include "llvm/ADT/S

[clang-tools-extra] 90c5fe9 - [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Viktoriia Bakalova via cfe-commits

Author: Viktoriia Bakalova
Date: 2023-06-05T09:47:12Z
New Revision: 90c5fe982190b826aab90c93db9ce0f7e25d

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

LOG: [include-cleaner] Allow multiple strategies for spelling includes.

Summary:

Reviewers:

Subscribers:

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

Added: 

clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h
clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp

Modified: 
clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/IncludeCleaner.cpp
clang-tools-extra/clangd/IncludeCleaner.h
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
clang-tools-extra/include-cleaner/lib/Analysis.cpp
clang-tools-extra/include-cleaner/lib/CMakeLists.txt
clang-tools-extra/include-cleaner/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
index c7aca83f2ca8c..49e7581d801d9 100644
--- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
@@ -12,6 +12,7 @@
 #include "../ClangTidyOptions.h"
 #include "../utils/OptionsUtils.h"
 #include "clang-include-cleaner/Analysis.h"
+#include "clang-include-cleaner/IncludeSpeller.h"
 #include "clang-include-cleaner/Record.h"
 #include "clang-include-cleaner/Types.h"
 #include "clang/AST/ASTContext.h"
@@ -180,7 +181,7 @@ void IncludeCleanerCheck::check(const 
MatchFinder::MatchResult &Result) {
  FileStyle->IncludeStyle);
   for (const auto &Inc : Missing) {
 std::string Spelling =
-include_cleaner::spellHeader(Inc.Missing, *HS, MainFile);
+include_cleaner::spellHeader({Inc.Missing, *HS, MainFile});
 bool Angled = llvm::StringRef{Spelling}.starts_with("<");
 // We might suggest insertion of an existing include in edge cases, e.g.,
 // include is present in a PP-disabled region, or spelling of the header

diff  --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index d1f6f3a7b06c0..80303267b31a0 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -18,6 +18,7 @@
 #include "Selection.h"
 #include "SourceCode.h"
 #include "clang-include-cleaner/Analysis.h"
+#include "clang-include-cleaner/IncludeSpeller.h"
 #include "clang-include-cleaner/Types.h"
 #include "index/SymbolCollector.h"
 #include "support/Logger.h"
@@ -1222,7 +1223,9 @@ void maybeAddSymbolProviders(ParsedAST &AST, HoverInfo 
&HI,
 // on local variables, etc.
 return;
 
-  HI.Provider = spellHeader(AST, SM.getFileEntryForID(SM.getMainFileID()), H);
+  HI.Provider = include_cleaner::spellHeader(
+  {H, AST.getPreprocessor().getHeaderSearchInfo(),
+   SM.getFileEntryForID(SM.getMainFileID())});
 }
 
 // FIXME: similar functions are present in FindHeaders.cpp (symbolName)

diff  --git a/clang-tools-extra/clangd/IncludeCleaner.cpp 
b/clang-tools-extra/clangd/IncludeCleaner.cpp
index a3e08bc56b31d..c9d32a00fc15f 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -16,6 +16,7 @@
 #include "SourceCode.h"
 #include "URI.h"
 #include "clang-include-cleaner/Analysis.h"
+#include "clang-include-cleaner/IncludeSpeller.h"
 #include "clang-include-cleaner/Record.h"
 #include "clang-include-cleaner/Types.h"
 #include "support/Logger.h"
@@ -197,8 +198,9 @@ std::vector generateMissingIncludeDiagnostics(
   continue;
 }
 
-std::string Spelling =
-spellHeader(AST, MainFile, SymbolWithMissingInclude.Providers.front());
+std::string Spelling = include_cleaner::spellHeader(
+{SymbolWithMissingInclude.Providers.front(),
+ AST.getPreprocessor().getHeaderSearchInfo(), MainFile});
 llvm::StringRef HeaderRef{Spelling};
 bool Angled = HeaderRef.starts_with("<");
 // We might suggest insertion of an existing include in edge cases, e.g.,
@@ -332,21 +334,6 @@ convertIncludes(const SourceManager &SM,
   return ConvertedIncludes;
 }
 
-std::string spellHeader(ParsedAST &AST, const FileEntry *MainFile,
-include_cleaner::Header Provider) {
-  if (Provider.kind() == include_cleaner::Header::Physical) {
-if (auto CanonicalPath = 
getCanonicalPath(Provider.physical()->getLastRef(),
-  
AST.getSourceManager().getFileManager())) {
-  std::string SpelledHeader =
-  llvm::cantFail(URI::includeSpelling(URI::create(*Cano

[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-06-05 Thread Viktoriia Bakalova via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG90c5fe98: [include-cleaner] Allow multiple strategies 
for spelling includes. (authored by VitaNuo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150185/new/

https://reviews.llvm.org/D150185

Files:
  clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/IncludeCleaner.h
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
  
clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h
  clang-tools-extra/include-cleaner/lib/Analysis.cpp
  clang-tools-extra/include-cleaner/lib/CMakeLists.txt
  clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
  clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
  clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp

Index: clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp
===
--- /dev/null
+++ clang-tools-extra/include-cleaner/unittests/IncludeSpellerTest.cpp
@@ -0,0 +1,78 @@
+//===--- IncludeSpellerTest.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang-include-cleaner/IncludeSpeller.h"
+#include "clang-include-cleaner/Analysis.h"
+#include "clang-include-cleaner/Types.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Testing/TestAST.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Path.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+namespace clang::include_cleaner {
+namespace {
+
+const char *testRoot() {
+#ifdef _WIN32
+  return "C:\\include-cleaner-test";
+#else
+  return "/include-cleaner-test";
+#endif
+}
+
+std::string testPath(llvm::StringRef File) {
+  assert(llvm::sys::path::is_relative(File) && "FileName should be relative");
+
+  llvm::SmallString<32> NativeFile = File;
+  llvm::sys::path::native(NativeFile, llvm::sys::path::Style::native);
+  llvm::SmallString<32> Path;
+  llvm::sys::path::append(Path, llvm::sys::path::Style::native, testRoot(),
+  NativeFile);
+  return std::string(Path.str());
+}
+
+class DummyIncludeSpeller : public IncludeSpeller {
+public:
+  std::string operator()(const IncludeSpeller::Input &Input) const override {
+llvm::StringRef AbsolutePath = Input.H.physical()->tryGetRealPathName();
+std::string RootWithSeparator{testRoot()};
+RootWithSeparator += llvm::sys::path::get_separator();
+if (!AbsolutePath.consume_front(llvm::StringRef{RootWithSeparator}))
+  return "";
+return "\"" + AbsolutePath.str() + "\"";
+  }
+};
+
+TEST(IncludeSpeller, IsRelativeToTestRoot) {
+  TestInputs Inputs;
+
+  Inputs.ExtraArgs.push_back("-isystemdir");
+
+  Inputs.ExtraFiles[testPath("foo.h")] = "";
+  Inputs.ExtraFiles["dir/header.h"] = "";
+  TestAST AST{Inputs};
+
+  auto &FM = AST.fileManager();
+  auto &HS = AST.preprocessor().getHeaderSearchInfo();
+  const auto *MainFile = AST.sourceManager().getFileEntryForID(
+  AST.sourceManager().getMainFileID());
+
+  EXPECT_EQ("\"foo.h\"", spellHeader({Header{*FM.getFile(testPath("foo.h"))},
+  HS, MainFile}));
+  EXPECT_EQ("",
+spellHeader({Header{*FM.getFile("dir/header.h")}, HS, MainFile}));
+}
+
+IncludeSpellingStrategy::Add
+Speller("dummy", "Dummy Include Speller");
+
+} // namespace
+} // namespace clang::include_cleaner
Index: clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
===
--- clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
+++ clang-tools-extra/include-cleaner/unittests/CMakeLists.txt
@@ -7,6 +7,7 @@
 add_unittest(ClangIncludeCleanerUnitTests ClangIncludeCleanerTests
   AnalysisTest.cpp
   FindHeadersTest.cpp
+  IncludeSpellerTest.cpp
   LocateSymbolTest.cpp
   RecordTest.cpp
   TypesTest.cpp
Index: clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
===
--- /dev/null
+++ clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
@@ -0,0 +1,66 @@
+//===--- IncludeSpeller.cpp===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//

[PATCH] D152134: [1/6][Clang][RISCV] Replace unit-stride (fault-first) segment load with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: craig.topper, kito-cheng, rogfer01, frasercrmck.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, 
apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, 
brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D152079 .

This patch-set aims to replace the existing segment load/store
intrinsics with tuple-type segment load/store intrinsics. That is, we
are removing in the segment load/store intrinsics.

This is the 1st commit of the patch-set.

This patch makes the unit-stride segment load intrinsics and
unit-stride fault-first segment load intrinsics to use tuple
types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152134

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-polic

[PATCH] D152135: [2/6][Clang][RISCV] Replace unit-stride segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: craig.topper, kito-cheng, rogfer01, frasercrmck.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, 
apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, 
brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D152143.

This is the 2nd commit of the patch-set.

This patch makes the unit-stride segment store intrinsics to use tuple
types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152135

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/no

[PATCH] D152136: [3/6][Clang][RISCV] Replace strided segment load with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: craig.topper, kito-cheng, rogfer01, frasercrmck.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, 
apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, 
brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D152135 .

This is the 3rd commit of the patch-set.

This patch makes the strided segment load intrinsics to use tuple
types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152136

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloade

[PATCH] D152137: [4/6][Clang][RISCV] Replace strided segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: craig.topper, kito-cheng, rogfer01, frasercrmck.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, 
apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, 
brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D152136 .

This is the 4th commit of the patch-set.

This patch makes the strided segment store intrinsics to use tuple
types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152137

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overload

[PATCH] D152138: [5/6][Clang][RISCV] Replace indexed segment load with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: craig.topper, kito-cheng, rogfer01, frasercrmck.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, 
apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, arphaman, 
the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, 
niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D152137 .

This is the 5th commit of the patch-set.

This patch makes the indexed segment load intrinsics to use tuple
types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152138

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei8.c
  
clang/test/CodeGen/R

[PATCH] D152139: [6/6][Clang][RISCV] Replace indexed segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: craig.topper, kito-cheng, rogfer01, frasercrmck.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, luismarques, 
apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, arphaman, 
the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, 
niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

Depends on D152138 .

This is the 6th commit of the patch-set.

This patch makes the indexed segment store intrinsics to use tuple
types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152139

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei8.c
  
clang/test/CodeGen/

[PATCH] D152135: [2/6][Clang][RISCV] Replace unit-stride segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 528354.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152135/new/

https://reviews.llvm.org/D152135

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg6ei32.c
  
clang/test/CodeGen/RI

[PATCH] D152135: [2/6][Clang][RISCV] Replace unit-stride segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 528355.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152135/new/

https://reviews.llvm.org/D152135

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-po

[PATCH] D152136: [3/6][Clang][RISCV] Replace strided segment load with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 528356.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152136/new/

https://reviews.llvm.org/D152136

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg6e8.c
  
clang/test

[PATCH] D152137: [4/6][Clang][RISCV] Replace strided segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 528357.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152137/new/

https://reviews.llvm.org/D152137

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg6e8.c
  
clang/test

[PATCH] D152138: [5/6][Clang][RISCV] Replace indexed segment load with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 528358.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152138/new/

https://reviews.llvm.org/D152138

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg6ei32.c
  
clang/test/CodeGen/RI

[PATCH] D152139: [6/6][Clang][RISCV] Replace indexed segment store with tuple type interfaces

2023-06-05 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 528359.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152139/new/

https://reviews.llvm.org/D152139

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg6ei32.c
  
clang/test/CodeGen/RI

[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen created this revision.
sdesmalen added reviewers: erichkeane, aaron.ballman.
Herald added a project: All.
sdesmalen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In https://reviews.llvm.org/D127762#4102578 @erichkeane suggested to
limit size of this field to 16bits, such that the field that encodes the
SME attributes for a function fall within the alignment of the struct for
32bit platforms.

Standard implimits defines the minimum handlers per try block to 256,
which suggests that 16bits should be more than sufficient for most
programs. Erich also pointed out that exception specs are being
deprecated and are rarely used, so hopefully this change is safe to make.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152140

Files:
  clang/include/clang/AST/Type.h
  clang/lib/AST/Type.cpp


Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3371,7 +3371,7 @@
   // Fill in the exception type array if present.
   if (getExceptionSpecType() == EST_Dynamic) {
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+ExtraBits.setNumExceptionType(epi.ExceptionSpec.Exceptions.size());
 
 assert(hasExtraBitfields() && "missing trailing extra bitfields!");
 auto *exnSlot =
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -3949,11 +3949,20 @@
   /// A simple holder for various uncommon bits which do not fit in
   /// FunctionTypeBitfields. Aligned to alignof(void *) to maintain the
   /// alignment of subsequent objects in TrailingObjects.
-  struct alignas(void *) FunctionTypeExtraBitfields {
+  class alignas(void *) FunctionTypeExtraBitfields {
 /// The number of types in the exception specification.
 /// A whole unsigned is not needed here and according to
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+
+  public:
+FunctionTypeExtraBitfields() : NumExceptionType(0) {}
+
+void setNumExceptionType(unsigned N) {
+  assert(N < 65536 && "Not enough bits to encode exceptions");
+  NumExceptionType = N;
+}
+unsigned getNumExceptionType() const { return NumExceptionType; }
   };
 
 protected:
@@ -4329,7 +4338,7 @@
   unsigned getNumExceptions() const {
 return getExceptionSpecType() == EST_Dynamic
? getTrailingObjects()
- ->NumExceptionType
+ ->getNumExceptionType()
: 0;
   }
 


Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3371,7 +3371,7 @@
   // Fill in the exception type array if present.
   if (getExceptionSpecType() == EST_Dynamic) {
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+ExtraBits.setNumExceptionType(epi.ExceptionSpec.Exceptions.size());
 
 assert(hasExtraBitfields() && "missing trailing extra bitfields!");
 auto *exnSlot =
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -3949,11 +3949,20 @@
   /// A simple holder for various uncommon bits which do not fit in
   /// FunctionTypeBitfields. Aligned to alignof(void *) to maintain the
   /// alignment of subsequent objects in TrailingObjects.
-  struct alignas(void *) FunctionTypeExtraBitfields {
+  class alignas(void *) FunctionTypeExtraBitfields {
 /// The number of types in the exception specification.
 /// A whole unsigned is not needed here and according to
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+
+  public:
+FunctionTypeExtraBitfields() : NumExceptionType(0) {}
+
+void setNumExceptionType(unsigned N) {
+  assert(N < 65536 && "Not enough bits to encode exceptions");
+  NumExceptionType = N;
+}
+unsigned getNumExceptionType() const { return NumExceptionType; }
   };
 
 protected:
@@ -4329,7 +4338,7 @@
   unsigned getNumExceptions() const {
 return getExceptionSpecType() == EST_Dynamic
? getTrailingObjects()
- ->NumExceptionType
+ ->getNumExceptionType()
: 0;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152141: [Clang] Make __arm_streaming apply only to prototyped functions.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen created this revision.
sdesmalen added a reviewer: rsandifo-arm.
Herald added subscribers: jdoerfert, kristof.beyls.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
sdesmalen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also only allow __arm_streaming if the function is being compiled for SME.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152141

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/test/Parser/aarch64-sme-attrs-no-sme.c
  clang/test/Parser/c2x-attribute-keywords.c
  clang/test/Parser/c2x-attribute-keywords.m
  clang/test/Parser/cxx0x-keyword-attributes.cpp

Index: clang/test/Parser/cxx0x-keyword-attributes.cpp
===
--- clang/test/Parser/cxx0x-keyword-attributes.cpp
+++ clang/test/Parser/cxx0x-keyword-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fdeclspec -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions -triple aarch64-none-linux-gnu %s
+// RUN: %clang_cc1 -fcxx-exceptions -fdeclspec -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions -triple aarch64-none-linux-gnu -target-feature +sme %s
 
 // Need std::initializer_list
 namespace std {
@@ -48,10 +48,10 @@
 struct MemberFnOrder {
   virtual void f() const volatile && noexcept __arm_streaming final = 0;
 };
-struct __arm_streaming struct_attr; // expected-error {{'__arm_streaming' cannot be applied to a declaration}}
-class __arm_streaming class_attr {}; // expected-error {{'__arm_streaming' cannot be applied to a declaration}}
-union __arm_streaming union_attr; // expected-error {{'__arm_streaming' cannot be applied to a declaration}}
-enum __arm_streaming E { }; // expected-error {{'__arm_streaming' cannot be applied to a declaration}}
+struct __arm_streaming struct_attr; // expected-error {{'__arm_streaming' only applies to non-K&R-style functions}}
+class __arm_streaming class_attr {}; // expected-error {{'__arm_streaming' only applies to non-K&R-style functions}}
+union __arm_streaming union_attr; // expected-error {{'__arm_streaming' only applies to non-K&R-style functions}}
+enum __arm_streaming E { }; // expected-error {{'__arm_streaming' only applies to non-K&R-style functions}}
 namespace test_misplacement {
 __arm_streaming struct struct_attr2;  // expected-error {{misplaced '__arm_streaming'}}
 __arm_streaming class class_attr2; // expected-error {{misplaced '__arm_streaming'}}
@@ -60,28 +60,28 @@
 }
 
 // Checks attributes placed at wrong syntactic locations of class specifiers.
-class __arm_streaming __arm_streaming // expected-error 2 {{'__arm_streaming' cannot be applied to a declaration}}
+class __arm_streaming __arm_streaming // expected-error 2 {{'__arm_streaming' only applies to non-K&R-style functions}}
   attr_after_class_name_decl __arm_streaming __arm_streaming; // expected-error {{'__arm_streaming' cannot appear here}} \
- expected-error 2 {{'__arm_streaming' cannot be applied to a declaration}}
+ expected-error 2 {{'__arm_streaming' only applies to non-K&R-style functions}}
 
-class __arm_streaming __arm_streaming // expected-error 2 {{'__arm_streaming' cannot be applied to a declaration}}
+class __arm_streaming __arm_streaming // expected-error 2 {{'__arm_streaming' only applies to non-K&R-style functions}}
  attr_after_class_name_definition __arm_streaming __arm_streaming __arm_streaming{}; // expected-error {{'__arm_streaming' cannot appear here}} \
-expected-error 3 {{'__arm_streaming' cannot be applied to a declaration}}
+expected-error 3 {{'__arm_streaming' only applies to non-K&R-style functions}}
 
-class __arm_streaming c {}; // expected-error {{'__arm_streaming' cannot be applied to a declaration}}
+class __arm_streaming c {}; // expected-error {{'__arm_streaming' only applies to non-K&R-style functions}}
 class c __arm_streaming __arm_streaming x; // expected-error 2 {{'__arm_streaming' only applies to function types}}
 class c __arm_streaming __arm_streaming y __arm_streaming __arm_streaming; // expected-error 4 {{'__arm_streaming' only applies to function types}}
 class c final [(int){0}];
 
 class base {};
-class __arm_streaming __arm_streaming final_class // expected-error 2 {{'__arm_streaming' cannot be applied to a declaration}}
+class __arm_streaming __arm_streaming final_class // expected-error 2 {{'__arm_streaming' only applies to non-K&R-style functions}}
   __arm_streaming alignas(float) final // expected-error {{'__arm_streaming' cannot appear here}} \
-   

[PATCH] D152142: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen created this revision.
Herald added subscribers: jdoerfert, kristof.beyls.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
sdesmalen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds all the language-level function keywords defined in:

  https://github.com/ARM-software/acle/pull/188 (merged)
  https://github.com/ARM-software/acle/pull/261 (update after D148700 landed)

The keywords are used to control PSTATE.ZA and PSTATE.SM, which are
respectively used for enabling the use of the ZA matrix array and Streaming
mode. This information needs to be available on call sites, since the use
of ZA or streaming mode may have to be enabled or disabled around the
call-site (depending on the IR attributes set on the caller and the
callee). For calls to functions from a function pointer, there is no IR
declaration available, so the IR attributes must be added explicitly to the
call-site.

With the exception of '__arm_locally_streaming' and '__arm_new_za' the
information is part of the function's interface, not just the function
definition, and thus needs to be propagated through the
FunctionProtoType::ExtProtoInfo.

This patch adds the defintions of these keywords, as well as codegen and
semantic analysis to ensure conversions between function pointers are valid
and that no conflicting keywords are set. For example, '__arm_streaming'
and '__arm_streaming_compatible' are mutually exclusive.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152142

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/AST/ast-dump-sme-attributes.cpp
  clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
  clang/test/Modules/aarch64-sme-keywords.cppm
  clang/test/Sema/aarch64-sme-func-attrs.c

Index: clang/test/Sema/aarch64-sme-func-attrs.c
===
--- /dev/null
+++ clang/test/Sema/aarch64-sme-func-attrs.c
@@ -0,0 +1,229 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify=expected-cpp -x c++ %s
+
+// Valid attributes
+
+void sme_arm_streaming(void) __arm_streaming;
+void sme_arm_streaming_compatible(void) __arm_streaming_compatible;
+
+__arm_new_za void sme_arm_new_za(void) {}
+void sme_arm_shared_za(void) __arm_shared_za;
+void sme_arm_preserves_za(void) __arm_preserves_za;
+
+__arm_new_za void sme_arm_streaming_new_za(void) __arm_streaming {}
+void sme_arm_streaming_shared_za(void) __arm_streaming __arm_shared_za;
+void sme_arm_streaming_preserves_za(void) __arm_streaming __arm_preserves_za;
+
+__arm_new_za void sme_arm_sc_new_za(void) __arm_streaming_compatible {}
+void sme_arm_sc_shared_za(void) __arm_streaming_compatible __arm_shared_za;
+void sme_arm_sc_preserves_za(void) __arm_streaming_compatible __arm_preserves_za;
+
+void sme_arm_shared_preserves_za(void) __arm_shared_za __arm_preserves_za;
+
+__arm_locally_streaming void sme_arm_locally_streaming(void) { }
+__arm_locally_streaming void sme_arm_streaming_and_locally_streaming(void) __arm_streaming { }
+__arm_locally_streaming void sme_arm_streaming_and_streaming_compatible(void) __arm_streaming_compatible { }
+
+__arm_locally_streaming __arm_new_za void sme_arm_ls_new_za(void) { }
+__arm_locally_streaming void sme_arm_ls_shared_za(void) __arm_shared_za { }
+__arm_locally_streaming void sme_arm_ls_preserves_za(void) __arm_preserves_za { }
+
+// Valid attributes on function pointers
+
+void streaming_ptr(void) __arm_streaming;
+typedef  void (*fptrty1) (void) __arm_streaming;
+fptrty1 call_streaming_func() { return streaming_ptr; }
+
+void streaming_compatible_ptr(void) __arm_streaming_compatible;
+typedef void (*fptrty2) (void) __arm_streaming_compatible;
+fptrty2 call_sc_func() { return streaming_compatible_ptr; }
+
+void shared_za_ptr(void) __arm_shared_za;
+typedef void (*fptrty3) (void) __arm_shared_za;
+fptrty3 call_shared_za_func() { return shared_za_ptr; }
+
+void preserves_za_ptr(void) __arm_preserves_za;
+typedef void (*fptrty4) (void) __arm_preserves_za;
+fptrty4 call_preserve_za_func() { return preserves_za_ptr; }
+
+void shared_preserves_za_ptr(void) __arm_shared_za __arm_preserves_za;
+typedef void (*fptrty5) (void) __arm_shared_za __arm_preserves_za;
+fptrty5 call_shared_preserve_za_func() { return shared_preserves_za_ptr; }
+

[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 528366.
sdesmalen retitled this revision from "[Clang][AArch64] Add ACLE attributes for 
SME." to "[Clang][AArch64] Add/implement ACLE keywords for SME.".
sdesmalen edited the summary of this revision.
sdesmalen added a comment.

- Rebased patch after patch to add RegularKeyword attributes (D148702 
) landed
- Split off the request to reduce the size of FunctionTypeExtraBitfields (and 
use alignment of the struct to pointer type) to a new patch: D152140 

- Added test to ensure that the serialization of type attributes is 
exported/imported to/from modules, see 
clang/test/Modules/aarch64-sme-keywords.cppm
- Added some new tests for template instantiation and function overloading with 
SME attributes:

  void normal_func(void) {}
  void streaming_func(void) __arm_streaming {}
  
  template int test_templated_f(T);
  template<> constexpr int test_templated_f(void(*)(void)) { 
return 1; }
  template<> constexpr int 
test_templated_f(void(*)(void)__arm_streaming) { 
return 2; }
  
  static_assert(test_templated_f(&normal_func) == 1, "Instantiated to wrong 
function");
  static_assert(test_templated_f(&streaming_func) == 2, "Instantiated to wrong 
function");

and

  // expected-cpp-error@+2 {{'__arm_streaming' only applies to function types; 
type here is 'int'}}
  // expected-error@+1 {{'__arm_streaming' only applies to function types; type 
here is 'int'}}
  int invalid_type_for_attribute __arm_streaming;
  
  // Test overloads
  constexpr int overload(void f(void)) { return 1; }
  constexpr int overload(void f(void) __arm_streaming) { return 2; }
  static_assert(overload(&normal_func) == 1, "Overloaded to wrong function");
  static_assert(overload(&streaming_func) == 2, "Overloaded to wrong function");


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/AST/ast-dump-sme-attributes.cpp
  clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
  clang/test/Modules/aarch64-sme-keywords.cppm
  clang/test/Sema/aarch64-sme-func-attrs.c

Index: clang/test/Sema/aarch64-sme-func-attrs.c
===
--- /dev/null
+++ clang/test/Sema/aarch64-sme-func-attrs.c
@@ -0,0 +1,229 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify=expected-cpp -x c++ %s
+
+// Valid attributes
+
+void sme_arm_streaming(void) __arm_streaming;
+void sme_arm_streaming_compatible(void) __arm_streaming_compatible;
+
+__arm_new_za void sme_arm_new_za(void) {}
+void sme_arm_shared_za(void) __arm_shared_za;
+void sme_arm_preserves_za(void) __arm_preserves_za;
+
+__arm_new_za void sme_arm_streaming_new_za(void) __arm_streaming {}
+void sme_arm_streaming_shared_za(void) __arm_streaming __arm_shared_za;
+void sme_arm_streaming_preserves_za(void) __arm_streaming __arm_preserves_za;
+
+__arm_new_za void sme_arm_sc_new_za(void) __arm_streaming_compatible {}
+void sme_arm_sc_shared_za(void) __arm_streaming_compatible __arm_shared_za;
+void sme_arm_sc_preserves_za(void) __arm_streaming_compatible __arm_preserves_za;
+
+void sme_arm_shared_preserves_za(void) __arm_shared_za __arm_preserves_za;
+
+__arm_locally_streaming void sme_arm_locally_streaming(void) { }
+__arm_locally_streaming void sme_arm_streaming_and_locally_streaming(void) __arm_streaming { }
+__arm_locally_streaming void sme_arm_streaming_and_streaming_compatible(void) __arm_streaming_compatible { }
+
+__arm_locally_streaming __arm_new_za void sme_arm_ls_new_za(void) { }
+__arm_locally_streaming void sme_arm_ls_shared_za(void) __arm_shared_za { }
+__arm_locally_streaming void sme_arm_ls_preserves_za(void) __arm_preserves_za { }
+
+// Valid attributes on function pointers
+
+void streaming_ptr(void) __arm_streaming;
+typedef  void (*fptrty1) (void) __arm_streaming;
+fptrty1 call_streaming_func() { return streaming_ptr; }
+
+void streaming_compatible_ptr(void) __arm_streaming_compatible;
+typedef void (*fptrty2) (void) __arm_streaming_compatible;
+fptrty2 call_sc_func() { return streaming_compatible_ptr; }
+
+void shared_za_ptr(void) __arm_shared_za;
+typedef void (*fptrty3) (void) __arm_shared_za;
+fptrty3 call_shared_za_func() { return

[PATCH] D152142: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen abandoned this revision.
sdesmalen added a comment.

Accidentally created a duplicate, I was meant to update D127762 
, so abandoning this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152142/new/

https://reviews.llvm.org/D152142

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


[PATCH] D152090: [clang][Driver] Add -fcaret-diagnostics-max-lines as a driver option

2023-06-05 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Should there be a test?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152090/new/

https://reviews.llvm.org/D152090

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


[PATCH] D152003: [clang] Fix `static_cast` to array of unknown bound

2023-06-05 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added inline comments.



Comment at: clang/lib/Sema/SemaType.cpp:8824
+  if (auto *Cast = dyn_cast(E)) {
+if (auto *SubInit = dyn_cast(Cast->getSubExpr())) {
+  const Type *InnerType = SubInit->getType().getTypePtr();

erichkeane wrote:
> Fznamznon wrote:
> > erichkeane wrote:
> > > I am not really sure this is the right way about this.  You're supposed 
> > > to be testing `T`, but this looks like it is checking the type of `E`, 
> > > isn't it?  I think you just need to check `Cast->getType()`.
> > For the case I'm trying to fix, `T` is array of unknown bound, it is 
> > already checked before calling `completeExprArrayBound`. Right now when you 
> > write something like
> > ```
> > int (&&arr1)[1] = static_cast(42);
> > ```
> > Clang actually is able to realize that parenthesized initialization is 
> > made, so it actually generates `CXXParenListInitExpr` that has type int[1]. 
> > Here I'm just paranoidally double-checking that is the case before 
> > switching the type. Maybe I don't need this double-check at all then?
> > 
> That makes me wonder if this is the correct place for this?  Should when we 
> generate this type when we do the `CXXParenListInitExpr` fixup?
> 
> Either way, I think making this depend on that behavior (which would possibly 
> be fragile), we should just do it based on the type passed ot the 
> `static_cast`.
> 
> Another question: is this something that needs to be done for other cast 
> types?  Does similar behavior exist for the other casts?  Should it also 
> happen with 'clobber' casts (C-style) that are effectively static?
> That makes me wonder if this is the correct place for this? Should when we 
> generate this type when we do the CXXParenListInitExpr fixup?

The function called `completeExprArrayBound` seemed like an appropriate place 
for me.
Could you please elaborate what you mean under `CXXParenListInitExpr fixup`? 

> is this something that needs to be done for other cast types?

I'm not sure. 
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1975r0.html seems to 
be extending only static_casts. And this was the original purpose of this 
bugfix.
gcc and msvc don't agree on that matter https://godbolt.org/z/1M3ahhsYr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152003/new/

https://reviews.llvm.org/D152003

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


[PATCH] D147717: [C++20][NFC] Claim full support for consteval again

2023-06-05 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added a comment.

In D147717#4393019 , @cor3ntin wrote:

> I think we should make sure to land this for clang 17. The rate of consteval 
> bugs is no greater than that of any other feature at this point.

There is https://github.com/llvm/llvm-project/issues/62886 which seems quite 
ugly, but has a patch on review.
Otherwise I agree, I'm not seeing more consteval bugs than any others.
@aaron.ballman , @erichkeane wdyt about landing it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147717/new/

https://reviews.llvm.org/D147717

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


[clang] e69448b - [clang][Interp][NFC] Make Src parameter for move functions const

2023-06-05 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2023-06-05T13:20:18+02:00
New Revision: e69448b1ea96d83bd918fe162ce29b3dddcdf166

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

LOG: [clang][Interp][NFC] Make Src parameter for move functions const

Added: 


Modified: 
clang/lib/AST/Interp/Descriptor.cpp
clang/lib/AST/Interp/Descriptor.h

Removed: 




diff  --git a/clang/lib/AST/Interp/Descriptor.cpp 
b/clang/lib/AST/Interp/Descriptor.cpp
index 31554dddb30a0..a6bef77bf8c16 100644
--- a/clang/lib/AST/Interp/Descriptor.cpp
+++ b/clang/lib/AST/Interp/Descriptor.cpp
@@ -28,8 +28,8 @@ static void dtorTy(Block *, char *Ptr, const Descriptor *) {
 }
 
 template 
-static void moveTy(Block *, char *Src, char *Dst, const Descriptor *) {
-  auto *SrcPtr = reinterpret_cast(Src);
+static void moveTy(Block *, const char *Src, char *Dst, const Descriptor *) {
+  const auto *SrcPtr = reinterpret_cast(Src);
   auto *DstPtr = reinterpret_cast(Dst);
   new (DstPtr) T(std::move(*SrcPtr));
 }
@@ -55,9 +55,10 @@ static void dtorArrayTy(Block *, char *Ptr, const Descriptor 
*D) {
 }
 
 template 
-static void moveArrayTy(Block *, char *Src, char *Dst, const Descriptor *D) {
+static void moveArrayTy(Block *, const char *Src, char *Dst,
+const Descriptor *D) {
   for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
-auto *SrcPtr = &reinterpret_cast(Src)[I];
+const auto *SrcPtr = &reinterpret_cast(Src)[I];
 auto *DstPtr = &reinterpret_cast(Dst)[I];
 new (DstPtr) T(std::move(*SrcPtr));
   }
@@ -104,18 +105,19 @@ static void dtorArrayDesc(Block *B, char *Ptr, const 
Descriptor *D) {
   }
 }
 
-static void moveArrayDesc(Block *B, char *Src, char *Dst, const Descriptor *D) 
{
+static void moveArrayDesc(Block *B, const char *Src, char *Dst,
+  const Descriptor *D) {
   const unsigned NumElems = D->getNumElems();
   const unsigned ElemSize =
   D->ElemDesc->getAllocSize() + sizeof(InlineDescriptor);
 
   unsigned ElemOffset = 0;
   for (unsigned I = 0; I < NumElems; ++I, ElemOffset += ElemSize) {
-auto *SrcPtr = Src + ElemOffset;
+const auto *SrcPtr = Src + ElemOffset;
 auto *DstPtr = Dst + ElemOffset;
 
-auto *SrcDesc = reinterpret_cast(SrcPtr);
-auto *SrcElemLoc = reinterpret_cast(SrcDesc + 1);
+const auto *SrcDesc = reinterpret_cast(SrcPtr);
+const auto *SrcElemLoc = reinterpret_cast(SrcDesc + 1);
 auto *DstDesc = reinterpret_cast(DstPtr);
 auto *DstElemLoc = reinterpret_cast(DstDesc + 1);
 
@@ -162,7 +164,8 @@ static void dtorRecord(Block *B, char *Ptr, const 
Descriptor *D) {
 DtorSub(F.Offset, F.Desc);
 }
 
-static void moveRecord(Block *B, char *Src, char *Dst, const Descriptor *D) {
+static void moveRecord(Block *B, const char *Src, char *Dst,
+   const Descriptor *D) {
   for (const auto &F : D->ElemRecord->fields()) {
 auto FieldOff = F.Offset;
 auto FieldDesc = F.Desc;

diff  --git a/clang/lib/AST/Interp/Descriptor.h 
b/clang/lib/AST/Interp/Descriptor.h
index 5b86ffb7957a0..657dbafb23805 100644
--- a/clang/lib/AST/Interp/Descriptor.h
+++ b/clang/lib/AST/Interp/Descriptor.h
@@ -41,7 +41,7 @@ using BlockDtorFn = void (*)(Block *Storage, char *FieldPtr,
 /// blocks are persisted: the move function copies all inline descriptors and
 /// non-trivial fields, as existing pointers might need to reference those
 /// descriptors. Data is not copied since it cannot be legally read.
-using BlockMoveFn = void (*)(Block *Storage, char *SrcFieldPtr,
+using BlockMoveFn = void (*)(Block *Storage, const char *SrcFieldPtr,
  char *DstFieldPtr, const Descriptor *FieldDesc);
 
 /// Inline descriptor embedded in structures and arrays.



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


[PATCH] D152023: [UBSan] Consider zero input to __builtin_clz/ctz to be undefined independent of the target.

2023-06-05 Thread Tomas Matheson via Phabricator via cfe-commits
tmatheson added a comment.

I think this breaks the ACLE header, see 
https://github.com/llvm/llvm-project/issues/63113


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152023/new/

https://reviews.llvm.org/D152023

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


[PATCH] D152144: [clang][dataflow] Use a `PointerValue` for `value` property in optional checker.

2023-06-05 Thread Martin Böhme via Phabricator via cfe-commits
mboehme created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The `ReferenceValue` class will be eliminated as part of the ongoing migration
to strict handling of value categories (see https://discourse.llvm.org/t/70086
for details).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152144

Files:
  clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp


Index: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
===
--- clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -307,12 +307,12 @@
 Environment &Env) {
   // The "value" property represents a synthetic field. As such, it needs
   // `StorageLocation`, like normal fields (and other variables). So, we model
-  // it with a `ReferenceValue`, since that includes a storage location.  Once
+  // it with a `PointerValue`, since that includes a storage location.  Once
   // the property is set, it will be shared by all environments that access the
   // `Value` representing the optional (here, `OptionalVal`).
   if (auto *ValueProp = OptionalVal.getProperty("value")) {
-auto *ValueRef = clang::cast(ValueProp);
-auto &ValueLoc = ValueRef->getReferentLoc();
+auto *ValuePtr = clang::cast(ValueProp);
+auto &ValueLoc = ValuePtr->getPointeeLoc();
 if (Env.getValue(ValueLoc) == nullptr) {
   // The property was previously set, but the value has been lost. This can
   // happen, for example, because of an environment merge (where the two
@@ -339,8 +339,8 @@
 return nullptr;
   auto &ValueLoc = Env.createStorageLocation(Ty);
   Env.setValue(ValueLoc, *ValueVal);
-  auto &ValueRef = Env.create(ValueLoc);
-  OptionalVal.setProperty("value", ValueRef);
+  auto &ValuePtr = Env.create(ValueLoc);
+  OptionalVal.setProperty("value", ValuePtr);
   return &ValueLoc;
 }
 


Index: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
===
--- clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -307,12 +307,12 @@
 Environment &Env) {
   // The "value" property represents a synthetic field. As such, it needs
   // `StorageLocation`, like normal fields (and other variables). So, we model
-  // it with a `ReferenceValue`, since that includes a storage location.  Once
+  // it with a `PointerValue`, since that includes a storage location.  Once
   // the property is set, it will be shared by all environments that access the
   // `Value` representing the optional (here, `OptionalVal`).
   if (auto *ValueProp = OptionalVal.getProperty("value")) {
-auto *ValueRef = clang::cast(ValueProp);
-auto &ValueLoc = ValueRef->getReferentLoc();
+auto *ValuePtr = clang::cast(ValueProp);
+auto &ValueLoc = ValuePtr->getPointeeLoc();
 if (Env.getValue(ValueLoc) == nullptr) {
   // The property was previously set, but the value has been lost. This can
   // happen, for example, because of an environment merge (where the two
@@ -339,8 +339,8 @@
 return nullptr;
   auto &ValueLoc = Env.createStorageLocation(Ty);
   Env.setValue(ValueLoc, *ValueVal);
-  auto &ValueRef = Env.create(ValueLoc);
-  OptionalVal.setProperty("value", ValueRef);
+  auto &ValuePtr = Env.create(ValueLoc);
+  OptionalVal.setProperty("value", ValuePtr);
   return &ValueLoc;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 528376.
sdesmalen marked 15 inline comments as done.
sdesmalen added a comment.

- Use only 6 bits for AArch64SMEAttributes to reduce the size of ExtProtoInfo.
- Added test for implicit instantiation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/AST/ast-dump-sme-attributes.cpp
  clang/test/CodeGen/aarch64-sme-intrinsics/aarch64-sme-attrs.cpp
  clang/test/Modules/aarch64-sme-keywords.cppm
  clang/test/Sema/aarch64-sme-func-attrs.c

Index: clang/test/Sema/aarch64-sme-func-attrs.c
===
--- /dev/null
+++ clang/test/Sema/aarch64-sme-func-attrs.c
@@ -0,0 +1,238 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify=expected-cpp -x c++ %s
+
+// Valid attributes
+
+void sme_arm_streaming(void) __arm_streaming;
+void sme_arm_streaming_compatible(void) __arm_streaming_compatible;
+
+__arm_new_za void sme_arm_new_za(void) {}
+void sme_arm_shared_za(void) __arm_shared_za;
+void sme_arm_preserves_za(void) __arm_preserves_za;
+
+__arm_new_za void sme_arm_streaming_new_za(void) __arm_streaming {}
+void sme_arm_streaming_shared_za(void) __arm_streaming __arm_shared_za;
+void sme_arm_streaming_preserves_za(void) __arm_streaming __arm_preserves_za;
+
+__arm_new_za void sme_arm_sc_new_za(void) __arm_streaming_compatible {}
+void sme_arm_sc_shared_za(void) __arm_streaming_compatible __arm_shared_za;
+void sme_arm_sc_preserves_za(void) __arm_streaming_compatible __arm_preserves_za;
+
+void sme_arm_shared_preserves_za(void) __arm_shared_za __arm_preserves_za;
+
+__arm_locally_streaming void sme_arm_locally_streaming(void) { }
+__arm_locally_streaming void sme_arm_streaming_and_locally_streaming(void) __arm_streaming { }
+__arm_locally_streaming void sme_arm_streaming_and_streaming_compatible(void) __arm_streaming_compatible { }
+
+__arm_locally_streaming __arm_new_za void sme_arm_ls_new_za(void) { }
+__arm_locally_streaming void sme_arm_ls_shared_za(void) __arm_shared_za { }
+__arm_locally_streaming void sme_arm_ls_preserves_za(void) __arm_preserves_za { }
+
+// Valid attributes on function pointers
+
+void streaming_ptr(void) __arm_streaming;
+typedef  void (*fptrty1) (void) __arm_streaming;
+fptrty1 call_streaming_func() { return streaming_ptr; }
+
+void streaming_compatible_ptr(void) __arm_streaming_compatible;
+typedef void (*fptrty2) (void) __arm_streaming_compatible;
+fptrty2 call_sc_func() { return streaming_compatible_ptr; }
+
+void shared_za_ptr(void) __arm_shared_za;
+typedef void (*fptrty3) (void) __arm_shared_za;
+fptrty3 call_shared_za_func() { return shared_za_ptr; }
+
+void preserves_za_ptr(void) __arm_preserves_za;
+typedef void (*fptrty4) (void) __arm_preserves_za;
+fptrty4 call_preserve_za_func() { return preserves_za_ptr; }
+
+void shared_preserves_za_ptr(void) __arm_shared_za __arm_preserves_za;
+typedef void (*fptrty5) (void) __arm_shared_za __arm_preserves_za;
+fptrty5 call_shared_preserve_za_func() { return shared_preserves_za_ptr; }
+
+typedef void (*fptrty6) (void);
+fptrty6 cast_nza_func_to_normal() { return sme_arm_new_za; }
+fptrty6 cast_ls_func_to_normal() { return sme_arm_locally_streaming; }
+
+// FIXME: Add invalid function pointer assignments such as assigning:
+//   1. A streaming compatible function to a normal function pointer,
+//   2. A locally streaming function to a streaming function pointer,
+// etc.
+
+// Invalid attributes
+
+// expected-cpp-error@+4 {{'__arm_streaming_compatible' and '__arm_streaming' are not compatible}}
+// expected-cpp-note@+3 {{conflicting attribute is here}}
+// expected-error@+2 {{'__arm_streaming_compatible' and '__arm_streaming' are not compatible}}
+// expected-note@+1 {{conflicting attribute is here}}
+void streaming_mode(void) __arm_streaming __arm_streaming_compatible;
+
+// expected-cpp-error@+4 {{'__arm_streaming' and '__arm_streaming_compatible' are not compatible}}
+// expected-cpp-note@+3 {{conflicting attribute is here}}
+// expected-error@+2 {{'__arm_streaming' and '__arm_streaming_compatible' are not compatible}}
+// expected-note@+1 {{conflicting attribute is here}}
+void streaming_compatible(void) __arm_streaming_compatible __arm_streaming;
+
+// ex

[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen marked 4 inline comments as done.
sdesmalen added inline comments.



Comment at: clang/include/clang/AST/Type.h:3940
+/// on declarations and function pointers.
+unsigned AArch64SMEAttributes : 8;
+

erichkeane wrote:
> sdesmalen wrote:
> > erichkeane wrote:
> > > sdesmalen wrote:
> > > > erichkeane wrote:
> > > > > We seem to be missing all of the modules-storage code for these.  
> > > > > Since this is modifying the AST, we need to increment the 'breaking 
> > > > > change' AST code, plus add this to the ASTWriter/ASTReader interface.
> > > > > Since this is modifying the AST, we need to increment the 'breaking 
> > > > > change' AST code
> > > > Could you give me some pointers on what you expect to see changed here? 
> > > > I understand your point about adding this to the ASTWriter/Reader 
> > > > interfaces for module-storage, but it's not entirely clear what you 
> > > > mean by "increment the breaking change AST code". 
> > > > 
> > > > I see there is also an ASTImporter, I guess this different from the 
> > > > ASTReader?
> > > > 
> > > > Please apologise my ignorance here, I'm not as familiar with the Clang 
> > > > codebase.
> > > See VersionMajor here: 
> > > https://clang.llvm.org/doxygen/ASTBitCodes_8h_source.html
> > > 
> > > Yes, ASTReader/ASTWriter and ASTImporter are different unfortunately.  
> > > I'm not completely sure of the difference, but doing this patch changing 
> > > the type here without doing those will break modules.
> > So I tried to create some tests for this (see 
> > clang/test/AST/ast-dump-sme-attributes.cpp) and realised that the 
> > serialization/deserialization works out-of-the-box.
> > 
> > Does that mean all is needed is an increment of the VERSION_MAJOR or 
> > VERSION_MINOR number?
> So its not just ast-dump that matters, it is what happens when these 
> functions are exported from a module, and imported from another?  Unless you 
> make changes to those areas, this SME stuff will be lost, since you're making 
> it part of the type.
Hi @erichkeane I've added a test for module export/import and was surprised to 
see this work without any additional changes. Do you think the added test is 
correct/sufficient to show that this works?



Comment at: clang/include/clang/Basic/AttrDocs.td:6322
+
+Only when Clang defines __ARM_FEATURE_SME, the support for this feature is
+considered to be stable and complete.

aaron.ballman wrote:
> aaron.ballman wrote:
> > Double-checking: that macro is missing the trailing double underscore, is 
> > that expected?
> Still wondering on this.
Sorry I missed that comment earlier. This is indeed intentional, there is no 
trailing `__` after `__ARM_FEATURE_SME`.
The macro is defined here: 
https://github.com/ARM-software/acle/blob/main/main/acle.md#scalable-matrix-extension-sme



Comment at: clang/test/Sema/aarch64-sme-func-attrs.c:172
+// expected-cpp-note@-4 {{candidate template ignored: could not match 'short 
(short) __attribute__((arm_streaming))' against 'short (short)'}}
+template short templated(short);
+#endif

erichkeane wrote:
> What happens with implicit instantiations?  Can you make sure calling these 
> doesn't lose the attribute?  Our implicit instantiation mechanism has an 
> opt-in for a lot of attributes/etc.
> 
> Additionally, can these be overloaded on in C++?  I don't see any tests for 
> this.  Since they are part of the function type, is that deduced properly? 
> (that is, a function pointer passed as template argument, does it pick up the 
> right type, and does it end up as a separate template isntantiation?).
I've added a few tests for these cases!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

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


[clang-tools-extra] fc4a8bf - [clang-tidy] Move the misc system header dir to Inputs subdir, NFC.

2023-06-05 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2023-06-05T13:57:01+02:00
New Revision: fc4a8bf7da7d3837d371fda24d3f2c0f9ef54a5b

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

LOG: [clang-tidy] Move the misc system header dir to Inputs subdir, NFC.

Follows the existing patterns, and makes life easier for bazel build
system.

Added: 
clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/system/string.h
clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/system/vector.h

Modified: 
clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp

Removed: 
clang-tools-extra/test/clang-tidy/checkers/misc/system/string.h
clang-tools-extra/test/clang-tidy/checkers/misc/system/vector.h



diff  --git a/clang-tools-extra/test/clang-tidy/checkers/misc/system/string.h 
b/clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/system/string.h
similarity index 100%
rename from clang-tools-extra/test/clang-tidy/checkers/misc/system/string.h
rename to clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/system/string.h

diff  --git a/clang-tools-extra/test/clang-tidy/checkers/misc/system/vector.h 
b/clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/system/vector.h
similarity index 100%
rename from clang-tools-extra/test/clang-tidy/checkers/misc/system/vector.h
rename to clang-tools-extra/test/clang-tidy/checkers/misc/Inputs/system/vector.h

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp
index 0f4c7a8f4ad1c..ed12600d96911 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-include-cleaner %t -- -- -I%S/Inputs 
-isystem%S/system
+// RUN: %check_clang_tidy %s misc-include-cleaner %t -- -- -I%S/Inputs 
-isystem%S/Inputs/system
 #include "bar.h"
 // CHECK-FIXES: {{^}}#include "baz.h"{{$}}
 #include "foo.h"



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


[PATCH] D151349: [HIP] emit macro `__HIP_NO_IMAGE_SUPPORT`

2023-06-05 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

In D151349#4381569 , @yaxunl wrote:

> In D151349#4381471 , @arsenm wrote:
>
>> In D151349#4377792 , @yaxunl wrote:
>>
>>> using ISA version to determine whether image is supported
>>
>> That’s backward. You can track the feature in clang separately and just not 
>> emit it. We do that for a few other features. You just stop the TargetParser 
>> parts
>
> Sorry, I did not quite get it. Do you mean to add a feature to 
> https://github.com/llvm/llvm-project/blob/85670ac86813b170c9301aa477421c56a71a7e1e/llvm/lib/TargetParser/TargetParser.cpp#L107
>  ? should I add FEATURE_IMAGE or FEATURE_NO_IMAGE ?

It's expressed as positive image feature. I thought there was a feature where 
clang tracks it per-target, but doesn't emit it in the IR in "target-features" 
but I can't remember which one it is. Is there a way to track the image feature 
without emitting it?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151349/new/

https://reviews.llvm.org/D151349

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


[PATCH] D92797: APINotes: add initial stub of APINotesWriter

2023-06-05 Thread Egor Zhdan via Phabricator via cfe-commits
egorzhdan added a comment.

Apologies for pinging an old review. Would it be possible to land this to 
facilitate future work to upstream API notes support?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92797/new/

https://reviews.llvm.org/D92797

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


[PATCH] D152144: [clang][dataflow] Use a `PointerValue` for `value` property in optional checker.

2023-06-05 Thread Martin Böhme via Phabricator via cfe-commits
mboehme added a comment.

libcxx CI failure looks unrelated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152144/new/

https://reviews.llvm.org/D152144

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


[PATCH] D152083: [clang] Warning for uninitialized elements in fixed-size arrays

2023-06-05 Thread Louis Burda via Phabricator via cfe-commits
Sinitax updated this revision to Diff 528387.
Sinitax added a comment.

Apply git-clang-format.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152083/new/

https://reviews.llvm.org/D152083

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaInit.cpp


Index: clang/lib/Sema/SemaInit.cpp
===
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -980,6 +980,24 @@
 if (RequiresSecondPass && !hadError)
   FillInEmptyInitializations(Entity, FullyStructuredList,
  RequiresSecondPass, nullptr, 0);
+
+if (const ConstantArrayType *CAType = dyn_cast(T)) {
+  if (FullyStructuredList->getNumInits() <
+  CAType->getSize().getZExtValue()) {
+S.Diag(IL->getBeginLoc(), diag::warn_uninit_fixed_size_array)
+<< IL->getSourceRange();
+  } else {
+Expr **inits = FullyStructuredList->getInits();
+for (unsigned i = 0, e = FullyStructuredList->getNumInits(); i != e;
+ ++i) {
+  if (inits[i] == nullptr) {
+S.Diag(IL->getBeginLoc(), diag::warn_uninit_fixed_size_array)
+<< IL->getSourceRange();
+break;
+  }
+}
+  }
+}
   }
   if (hadError && FullyStructuredList)
 FullyStructuredList->markError();
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2214,6 +2214,9 @@
   "reference %0 is not yet bound to a value when used within its own"
   " initialization">,
   InGroup;
+def warn_uninit_fixed_size_array : Warning<
+  "fixed-size array contains uninitialized elements">,
+  InGroup, DefaultIgnore;
 def warn_uninit_var : Warning<
   "variable %0 is uninitialized when %select{used here|captured by block}1">,
   InGroup, DefaultIgnore;
Index: clang/include/clang/Basic/DiagnosticGroups.td
===
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -729,6 +729,7 @@
 def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">;
 def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
 def UninitializedConstReference : DiagGroup<"uninitialized-const-reference">;
+def UninitializedArrayElements : DiagGroup<"uninitialized-array-elements">;
 def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
  UninitializedStaticSelfInit,
  UninitializedConstReference]>;


Index: clang/lib/Sema/SemaInit.cpp
===
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -980,6 +980,24 @@
 if (RequiresSecondPass && !hadError)
   FillInEmptyInitializations(Entity, FullyStructuredList,
  RequiresSecondPass, nullptr, 0);
+
+if (const ConstantArrayType *CAType = dyn_cast(T)) {
+  if (FullyStructuredList->getNumInits() <
+  CAType->getSize().getZExtValue()) {
+S.Diag(IL->getBeginLoc(), diag::warn_uninit_fixed_size_array)
+<< IL->getSourceRange();
+  } else {
+Expr **inits = FullyStructuredList->getInits();
+for (unsigned i = 0, e = FullyStructuredList->getNumInits(); i != e;
+ ++i) {
+  if (inits[i] == nullptr) {
+S.Diag(IL->getBeginLoc(), diag::warn_uninit_fixed_size_array)
+<< IL->getSourceRange();
+break;
+  }
+}
+  }
+}
   }
   if (hadError && FullyStructuredList)
 FullyStructuredList->markError();
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2214,6 +2214,9 @@
   "reference %0 is not yet bound to a value when used within its own"
   " initialization">,
   InGroup;
+def warn_uninit_fixed_size_array : Warning<
+  "fixed-size array contains uninitialized elements">,
+  InGroup, DefaultIgnore;
 def warn_uninit_var : Warning<
   "variable %0 is uninitialized when %select{used here|captured by block}1">,
   InGroup, DefaultIgnore;
Index: clang/include/clang/Basic/DiagnosticGroups.td
===
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -729,6 +729,7 @@
 def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">;
 def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
 def UninitializedConstReference : DiagGroup<"uninitialized-const-reference">;
+de

[clang] af22be3 - [clang][dataflow] Use a `PointerValue` for `value` property in optional checker.

2023-06-05 Thread Martin Braenne via cfe-commits

Author: Martin Braenne
Date: 2023-06-05T12:52:51Z
New Revision: af22be39038a9c464474410c3a8b3cb428d8b25a

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

LOG: [clang][dataflow] Use a `PointerValue` for `value` property in optional 
checker.

The `ReferenceValue` class will be eliminated as part of the ongoing migration
to strict handling of value categories (see https://discourse.llvm.org/t/70086
for details).

Reviewed By: gribozavr2

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

Added: 


Modified: 
clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp

Removed: 




diff  --git 
a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp 
b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
index 7d30473ea5226..1095fd49e8600 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -307,12 +307,12 @@ StorageLocation 
*maybeInitializeOptionalValueMember(QualType Q,
 Environment &Env) {
   // The "value" property represents a synthetic field. As such, it needs
   // `StorageLocation`, like normal fields (and other variables). So, we model
-  // it with a `ReferenceValue`, since that includes a storage location.  Once
+  // it with a `PointerValue`, since that includes a storage location.  Once
   // the property is set, it will be shared by all environments that access the
   // `Value` representing the optional (here, `OptionalVal`).
   if (auto *ValueProp = OptionalVal.getProperty("value")) {
-auto *ValueRef = clang::cast(ValueProp);
-auto &ValueLoc = ValueRef->getReferentLoc();
+auto *ValuePtr = clang::cast(ValueProp);
+auto &ValueLoc = ValuePtr->getPointeeLoc();
 if (Env.getValue(ValueLoc) == nullptr) {
   // The property was previously set, but the value has been lost. This can
   // happen, for example, because of an environment merge (where the two
@@ -339,8 +339,8 @@ StorageLocation 
*maybeInitializeOptionalValueMember(QualType Q,
 return nullptr;
   auto &ValueLoc = Env.createStorageLocation(Ty);
   Env.setValue(ValueLoc, *ValueVal);
-  auto &ValueRef = Env.create(ValueLoc);
-  OptionalVal.setProperty("value", ValueRef);
+  auto &ValuePtr = Env.create(ValueLoc);
+  OptionalVal.setProperty("value", ValuePtr);
   return &ValueLoc;
 }
 



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


[PATCH] D152144: [clang][dataflow] Use a `PointerValue` for `value` property in optional checker.

2023-06-05 Thread Martin Böhme via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf22be39038a: [clang][dataflow] Use a `PointerValue` for 
`value` property in optional checker. (authored by mboehme).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152144/new/

https://reviews.llvm.org/D152144

Files:
  clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp


Index: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
===
--- clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -307,12 +307,12 @@
 Environment &Env) {
   // The "value" property represents a synthetic field. As such, it needs
   // `StorageLocation`, like normal fields (and other variables). So, we model
-  // it with a `ReferenceValue`, since that includes a storage location.  Once
+  // it with a `PointerValue`, since that includes a storage location.  Once
   // the property is set, it will be shared by all environments that access the
   // `Value` representing the optional (here, `OptionalVal`).
   if (auto *ValueProp = OptionalVal.getProperty("value")) {
-auto *ValueRef = clang::cast(ValueProp);
-auto &ValueLoc = ValueRef->getReferentLoc();
+auto *ValuePtr = clang::cast(ValueProp);
+auto &ValueLoc = ValuePtr->getPointeeLoc();
 if (Env.getValue(ValueLoc) == nullptr) {
   // The property was previously set, but the value has been lost. This can
   // happen, for example, because of an environment merge (where the two
@@ -339,8 +339,8 @@
 return nullptr;
   auto &ValueLoc = Env.createStorageLocation(Ty);
   Env.setValue(ValueLoc, *ValueVal);
-  auto &ValueRef = Env.create(ValueLoc);
-  OptionalVal.setProperty("value", ValueRef);
+  auto &ValuePtr = Env.create(ValueLoc);
+  OptionalVal.setProperty("value", ValuePtr);
   return &ValueLoc;
 }
 


Index: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
===
--- clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -307,12 +307,12 @@
 Environment &Env) {
   // The "value" property represents a synthetic field. As such, it needs
   // `StorageLocation`, like normal fields (and other variables). So, we model
-  // it with a `ReferenceValue`, since that includes a storage location.  Once
+  // it with a `PointerValue`, since that includes a storage location.  Once
   // the property is set, it will be shared by all environments that access the
   // `Value` representing the optional (here, `OptionalVal`).
   if (auto *ValueProp = OptionalVal.getProperty("value")) {
-auto *ValueRef = clang::cast(ValueProp);
-auto &ValueLoc = ValueRef->getReferentLoc();
+auto *ValuePtr = clang::cast(ValueProp);
+auto &ValueLoc = ValuePtr->getPointeeLoc();
 if (Env.getValue(ValueLoc) == nullptr) {
   // The property was previously set, but the value has been lost. This can
   // happen, for example, because of an environment merge (where the two
@@ -339,8 +339,8 @@
 return nullptr;
   auto &ValueLoc = Env.createStorageLocation(Ty);
   Env.setValue(ValueLoc, *ValueVal);
-  auto &ValueRef = Env.create(ValueLoc);
-  OptionalVal.setProperty("value", ValueRef);
+  auto &ValuePtr = Env.create(ValueLoc);
+  OptionalVal.setProperty("value", ValuePtr);
   return &ValueLoc;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 997c2f7 - [clang][Diagnostics] Split source ranges into line ranges before...

2023-06-05 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2023-06-05T14:56:58+02:00
New Revision: 997c2f70c1a29f911e559919f4799cd2b341796f

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

LOG: [clang][Diagnostics] Split source ranges into line ranges before...

... emitting them.

This makes later code easier to understand, since we emit the code
snippets line by line anyway.
It also fixes the weird underlinig of multi-line source ranges.

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

Added: 


Modified: 
clang/lib/Frontend/TextDiagnostic.cpp
clang/test/Misc/caret-diags-multiline.cpp
clang/test/Parser/brackets.c
clang/test/Parser/brackets.cpp

Removed: 




diff  --git a/clang/lib/Frontend/TextDiagnostic.cpp 
b/clang/lib/Frontend/TextDiagnostic.cpp
index 137001dc050d1..01d2b10479ade 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -945,87 +945,43 @@ maybeAddRange(std::pair A, 
std::pair B,
   return A;
 }
 
-/// Highlight a SourceRange (with ~'s) for any characters on LineNo.
-static void highlightRange(const CharSourceRange &R,
-   unsigned LineNo, FileID FID,
-   const SourceColumnMap &map,
-   std::string &CaretLine,
-   const SourceManager &SM,
-   const LangOptions &LangOpts) {
-  if (!R.isValid()) return;
-
-  SourceLocation Begin = R.getBegin();
-  SourceLocation End = R.getEnd();
-
-  unsigned StartLineNo = SM.getExpansionLineNumber(Begin);
-  if (StartLineNo > LineNo || SM.getFileID(Begin) != FID)
-return;  // No intersection.
-
-  unsigned EndLineNo = SM.getExpansionLineNumber(End);
-  if (EndLineNo < LineNo || SM.getFileID(End) != FID)
-return;  // No intersection.
-
-  // Compute the column number of the start.
-  unsigned StartColNo = 0;
-  if (StartLineNo == LineNo) {
-StartColNo = SM.getExpansionColumnNumber(Begin);
-if (StartColNo) --StartColNo;  // Zero base the col #.
-  }
-
-  // Compute the column number of the end.
-  unsigned EndColNo = map.getSourceLine().size();
-  if (EndLineNo == LineNo) {
-EndColNo = SM.getExpansionColumnNumber(End);
-if (EndColNo) {
-  --EndColNo;  // Zero base the col #.
-
-  // Add in the length of the token, so that we cover multi-char tokens if
-  // this is a token range.
-  if (R.isTokenRange())
-EndColNo += Lexer::MeasureTokenLength(End, SM, LangOpts);
-} else {
-  EndColNo = CaretLine.size();
-}
-  }
-
-  assert(StartColNo <= EndColNo && "Invalid range!");
-
-  // Check that a token range does not highlight only whitespace.
-  if (R.isTokenRange()) {
-// Pick the first non-whitespace column.
-while (StartColNo < map.getSourceLine().size() &&
-   (map.getSourceLine()[StartColNo] == ' ' ||
-map.getSourceLine()[StartColNo] == '\t'))
-  StartColNo = map.startOfNextColumn(StartColNo);
-
-// Pick the last non-whitespace column.
-if (EndColNo > map.getSourceLine().size())
-  EndColNo = map.getSourceLine().size();
-while (EndColNo &&
-   (map.getSourceLine()[EndColNo-1] == ' ' ||
-map.getSourceLine()[EndColNo-1] == '\t'))
-  EndColNo = map.startOfPreviousColumn(EndColNo);
-
-// If the start/end passed each other, then we are trying to highlight a
-// range that just exists in whitespace. That most likely means we have
-// a multi-line highlighting range that covers a blank line.
-if (StartColNo > EndColNo) {
-  assert(StartLineNo != EndLineNo && "trying to highlight whitespace");
-  StartColNo = EndColNo;
-}
-  }
+struct LineRange {
+  unsigned LineNo;
+  unsigned StartCol;
+  unsigned EndCol;
+};
 
-  assert(StartColNo <= map.getSourceLine().size() && "Invalid range!");
-  assert(EndColNo <= map.getSourceLine().size() && "Invalid range!");
+/// Highlight \p R (with ~'s) on the current source line.
+static void highlightRange(const LineRange &R, const SourceColumnMap &Map,
+   std::string &CaretLine) {
+  // Pick the first non-whitespace column.
+  unsigned StartColNo = R.StartCol;
+  while (StartColNo < Map.getSourceLine().size() &&
+ (Map.getSourceLine()[StartColNo] == ' ' ||
+  Map.getSourceLine()[StartColNo] == '\t'))
+StartColNo = Map.startOfNextColumn(StartColNo);
+
+  // Pick the last non-whitespace column.
+  unsigned EndColNo =
+  std::min(static_cast(R.EndCol), Map.getSourceLine().size());
+  while (EndColNo && (Map.getSourceLine()[EndColNo - 1] == ' ' ||
+  Map.getSourceLine()[EndColNo - 1] == '\t'))
+EndColNo = Map.startOfPreviousColumn(EndColNo);
+
+  // If the start/end passed each other, then we are trying to highlight a
+  // range t

[PATCH] D152003: [clang] Fix `static_cast` to array of unknown bound

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/lib/Sema/SemaType.cpp:8824
+  if (auto *Cast = dyn_cast(E)) {
+if (auto *SubInit = dyn_cast(Cast->getSubExpr())) {
+  const Type *InnerType = SubInit->getType().getTypePtr();

Fznamznon wrote:
> erichkeane wrote:
> > Fznamznon wrote:
> > > erichkeane wrote:
> > > > I am not really sure this is the right way about this.  You're supposed 
> > > > to be testing `T`, but this looks like it is checking the type of `E`, 
> > > > isn't it?  I think you just need to check `Cast->getType()`.
> > > For the case I'm trying to fix, `T` is array of unknown bound, it is 
> > > already checked before calling `completeExprArrayBound`. Right now when 
> > > you write something like
> > > ```
> > > int (&&arr1)[1] = static_cast(42);
> > > ```
> > > Clang actually is able to realize that parenthesized initialization is 
> > > made, so it actually generates `CXXParenListInitExpr` that has type 
> > > int[1]. Here I'm just paranoidally double-checking that is the case 
> > > before switching the type. Maybe I don't need this double-check at all 
> > > then?
> > > 
> > That makes me wonder if this is the correct place for this?  Should when we 
> > generate this type when we do the `CXXParenListInitExpr` fixup?
> > 
> > Either way, I think making this depend on that behavior (which would 
> > possibly be fragile), we should just do it based on the type passed ot the 
> > `static_cast`.
> > 
> > Another question: is this something that needs to be done for other cast 
> > types?  Does similar behavior exist for the other casts?  Should it also 
> > happen with 'clobber' casts (C-style) that are effectively static?
> > That makes me wonder if this is the correct place for this? Should when we 
> > generate this type when we do the CXXParenListInitExpr fixup?
> 
> The function called `completeExprArrayBound` seemed like an appropriate place 
> for me.
> Could you please elaborate what you mean under `CXXParenListInitExpr fixup`? 
> 
> > is this something that needs to be done for other cast types?
> 
> I'm not sure. 
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1975r0.html seems 
> to be extending only static_casts. And this was the original purpose of this 
> bugfix.
> gcc and msvc don't agree on that matter https://godbolt.org/z/1M3ahhsYr.
>>Could you please elaborate what you mean under CXXParenListInitExpr fixup?

You mentioned that at a different place we set the type of the 
`CXXParenListInitExpr` to be the 1-arity array.  I was saying that if there is 
logic THERE based on whether its an incomplete array type it would be for the 
same purpose, and perhaps be the correct place to do this.

>>I'm not sure. 
>>https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1975r0.html seems 
>>to be extending only static_casts. 

Yep, thats what I was hoping to see, thanks.

>>And this was the original purpose of this bugfix.

I was concerned that we increasing the inconsistency by only fixing 1 of the 
types of casts.  It might seem like 'feature creep', but it is very important 
that we make sure a patch is reasonably complete, so that it doesn't make the 
compiler less consistent.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152003/new/

https://reviews.llvm.org/D152003

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


[clang] 4a27ddd - Remove 3-byte characters causing clang-tblgen to get I/O error.

2023-06-05 Thread Zibi Sarbinowski via cfe-commits

Author: Zibi Sarbinowski
Date: 2023-06-05T07:58:16-05:00
New Revision: 4a27ddd423337bb1088bd997d33a1f0f49f1ead4

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

LOG: Remove 3-byte characters causing clang-tblgen to get I/O error.

[SystemZ} This revision fixes the following error caused by 
301eb6b68f30074ee3a90e2dfbd11dfd87076323.
LLVM ERROR: IO failure on output stream: EDC5122I Input/output error.

The characters seems to be 3-byte characters which cause the failure with auto 
conversion from EBCDIC to ASCII.
Credit to @Kai who found this issue.

Reviewed By: abhina.sreeskantharajan

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

Added: 


Modified: 
clang/include/clang/Basic/AttrDocs.td

Removed: 




diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index e3d83234b316a..1c4198cc8d547 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -6559,7 +6559,7 @@ def ArmStreamingDocs : Documentation {
 
 The ``__arm_streaming`` keyword is only available on AArch64 targets.
 It applies to function types and specifies that the function has a
-“streaming interface”.  This means that:
+"streaming interface".  This means that:
 
 * the function requires the Scalable Matrix Extension (SME)
 
@@ -6578,7 +6578,7 @@ function calls an ``__arm_streaming`` function, Clang 
generates code
 that switches into streaming mode before calling the function and
 switches back to non-streaming mode on return.
 
-``__arm_streaming`` can appear anywhere that a standard ``[[…]]`` type
+``__arm_streaming`` can appear anywhere that a standard ``[[...]]`` type
 attribute can appear.
 
 See `Arm C Language Extensions `_



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


[PATCH] D151730: [RISCV] Support target attribute for function

2023-06-05 Thread Piyou Chen via Phabricator via cfe-commits
BeMg updated this revision to Diff 528390.
BeMg added a comment.

1. Update testcase
2. Support -
3. Verfy extension version


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151730/new/

https://reviews.llvm.org/D151730

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/RISCV.h
  clang/test/CodeGen/RISCV/riscv-func-attr-target.c
  llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
  llvm/test/CodeGen/RISCV/riscv-func-attr-target.ll

Index: llvm/test/CodeGen/RISCV/riscv-func-attr-target.ll
===
--- /dev/null
+++ llvm/test/CodeGen/RISCV/riscv-func-attr-target.ll
@@ -0,0 +1,81 @@
+; RUN: llc -mtriple=riscv64 -mattr=+a,+d,+f,+m -verify-machineinstrs < %s | FileCheck %s
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +c, +v, +zifencei, +zve32f, +zve32x, +zve64d, +zve64f, +zve64x, +zvl128b, +zvl32b, +zvl64b
+define void @test1() #0 {
+; CHECK-LABEL: test1
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +c, +zifencei
+define void @test2() #1 {
+; CHECK-LABEL: test2
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +c, +zifencei
+define void @test3() #1 {
+; CHECK-LABEL: test3
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +v, +zifencei, +zve32f, +zve32x, +zve64d, +zve64f, +zve64x, +zvl128b, +zvl32b, +zvl64b
+define void @test4() #2 {
+; CHECK-LABEL: test4
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +experimental-zihintntl, +zifencei
+define void @test5() #3 {
+; CHECK-LABEL: test5
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +zifencei
+define void @test7() #4 {
+; CHECK-LABEL: test7
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +c, +zifencei
+define void @test9() #6 {
+; CHECK-LABEL: test9
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+; CHECK: .option push
+; CHECK-NEXT: .optionarch,   +c, +v, +zifencei, +zve32f, +zve32x, +zve64d, +zve64f, +zve64x, +zvl128b, +zvl32b, +zvl64b
+define void @test10() #7 {
+; CHECK-LABEL: test10
+; CHECL: .option pop
+entry:
+  ret void
+}
+
+attributes #0 = { noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic-rv64" "target-features"="+64bit,+a,+c,+d,+f,+m,+relax,+v,+zicsr,+zifencei,+zve32f,+zve32x,+zve64d,+zve64f,+zve64x,+zvl128b,+zvl32b,+zvl64b,-e,-experimental-smaia,-experimental-ssaia,-experimental-zca,-experimental-zcb,-experimental-zcd,-experimental-zcf,-experimental-zcmp,-experimental-zcmt,-experimental-zfa,-experimental-zfbfmin,-experimental-zicond,-experimental-zihintntl,-experimental-ztso,-experimental-zvbb,-experimental-zvbc,-experimental-zvfbfmin,-experimental-zvfbfwma,-experimental-zvfh,-experimental-zvkg,-experimental-zvkn,-experimental-zvkned,-experimental-zvkng,-experimental-zvknha,-experimental-zvknhb,-experimental-zvks,-experimental-zvksed,-experimental-zvksg,-experimental-zvksh,-experimental-zvkt,-h,-save-restore,-svinval,-svnapot,-svpbmt,-xsfvcp,-xtheadba,-xtheadbb,-xtheadbs,-xtheadcmo,-xtheadcondmov,-xtheadfmemidx,-xtheadmac,-xtheadmemidx,-xtheadmempair,-xtheadsync,-xtheadvdot,-xventanacondops,-zawrs,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zdinx,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zicbom,-zicbop,-zicboz,-zicntr,-zihintpause,-zihpm,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-zmmul,-zvl1024b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl4096b,-zvl512b,-zvl65536b,-zvl8192b" }
+attributes #1 = { noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic-rv64" "target-features"="+64bit,+a,+c,+d,+f,+m,+relax,+zicsr,+zifencei,-e,-experimental-smaia,-experimental-ssaia,-experimental-zca,-experimental-zcb,-experimental-zcd,-experimental-zcf,-experimental-zcmp,-experimental-zcmt,-experimental-zfa,-experimental-zfbfmin,-experimental-zicond,-experimental-zihintntl,-experimental-ztso,-experimental-zvbb,-experimental-zvbc,-experimental-zvfbfmin,-experimental-zvfbfwma,-experimental-zvfh,-experimental-zvkg,-experimental-zvkn,-experimental-zvkned,-experimental-zvkng,-experimental-zvknha,-experimental-zvknhb,-experimental-zvks,-experimental-zvksed,-experimental-zvksg,-experimental-zvksh,-experimental-zvkt,-h,-save-restore,-svinval,-svnapot,-svpbmt,-v,-xsfvcp,-xtheadba,-xtheadbb,-xtheadbs,-xtheadcmo,-xtheadcondmov,-xtheadfmemidx,-xtheadmac,-xtheadmemidx,-xtheadmempair,-xtheadsync,-xtheadvdot,-xventanacondops,-zawrs,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zdinx,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zicbom,-zicbop,-zicboz,-zicntr,-zihintpause,-zihpm,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-z

[PATCH] D152016: Remove 3-byte characters causing clang-tblgen to get I/O error.

2023-06-05 Thread Zibi Sarbino via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4a27ddd42333: Remove 3-byte characters causing clang-tblgen 
to get I/O error. (authored by zibi).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152016/new/

https://reviews.llvm.org/D152016

Files:
  clang/include/clang/Basic/AttrDocs.td


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -6559,7 +6559,7 @@
 
 The ``__arm_streaming`` keyword is only available on AArch64 targets.
 It applies to function types and specifies that the function has a
-“streaming interface”.  This means that:
+"streaming interface".  This means that:
 
 * the function requires the Scalable Matrix Extension (SME)
 
@@ -6578,7 +6578,7 @@
 that switches into streaming mode before calling the function and
 switches back to non-streaming mode on return.
 
-``__arm_streaming`` can appear anywhere that a standard ``[[…]]`` type
+``__arm_streaming`` can appear anywhere that a standard ``[[...]]`` type
 attribute can appear.
 
 See `Arm C Language Extensions `_


Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -6559,7 +6559,7 @@
 
 The ``__arm_streaming`` keyword is only available on AArch64 targets.
 It applies to function types and specifies that the function has a
-“streaming interface”.  This means that:
+"streaming interface".  This means that:
 
 * the function requires the Scalable Matrix Extension (SME)
 
@@ -6578,7 +6578,7 @@
 that switches into streaming mode before calling the function and
 switches back to non-streaming mode on return.
 
-``__arm_streaming`` can appear anywhere that a standard ``[[…]]`` type
+``__arm_streaming`` can appear anywhere that a standard ``[[...]]`` type
 attribute can appear.
 
 See `Arm C Language Extensions `_
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151128: [clangd] Show size, offset and padding for bit fields on hover

2023-06-05 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Sorry for the delay, I've been out on vacation.

Behavior looks great and isn't too complicated :-)
Let me know if you have commit access or I should land this for you (in which 
case: please provide a preferred name/email for attribution)




Comment at: clang-tools-extra/clangd/Hover.cpp:1467
 
-  if (Offset)
-Output.addParagraph().appendText(
-llvm::formatv("Offset: {0} byte{1}", *Offset, *Offset == 1 ? "" : "s")
-.str());
+  const auto FormatSize = [](uint64_t Bits) {
+uint64_t Value = Bits % 8 == 0 ? Bits / 8 : Bits;

can you make this a separate (static) function rather than a lambda?
and the same for `formatOffset()`

(This is a long function as it is)



Comment at: clang-tools-extra/clangd/Hover.cpp:1474
+
+  if (Offset) {
+const auto Bytes = *Offset / 8;

The distinction between bits+bytes for offsets vs bits OR bytes for size is 
worth calling out with a comment:

```
// Sizes (and padding) are shown in bytes if possible, otherwise in bits.
string formatSize(...) { ... }

// Offsets are shown in bytes + bits, so offsets of different fields
// can always be easily compared.
string formatOffset(...) { ... }
```



Comment at: clang-tools-extra/clangd/Hover.cpp:1478
+auto &P = Output.addParagraph().appendText("Offset: ");
+if (Bytes != 0 || Bits == 0)
+  P.appendText(FormatSize(Bytes * 8));

FWIW I think I slightly prefer printing bytes always, so that 4 prints as `0 
bytes and 4 bits`.

This makes a rare case slightly more regular (and the code is simpler). Up to 
you though.



Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:3292
   {
   [](HoverInfo &HI) {
 HI.Kind = index::SymbolKind::Field;

can you add a testcase for render() where the size/offset/padding are not whole 
bytes?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151128/new/

https://reviews.llvm.org/D151128

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


[PATCH] D151461: [Clang][SVE2.1] Add builtins and intrinsics for SVBFMLSLB/T

2023-06-05 Thread David Sherwood via Phabricator via cfe-commits
david-arm accepted this revision.
david-arm added a comment.
This revision is now accepted and ready to land.

LGTM! I left a nit, which you could just address before landing the patch?




Comment at: clang/test/CodeGen/aarch64-sve2p1-intrinsics/acle_sve2p1_bfmlsl.c:48
+//
+svfloat32_t test_bfmlslb_idx(svfloat32_t zda, svbfloat16_t zn, svbfloat16_t zm)
+{

nit: Just a minor issue, but perhaps worth calling this `test_bfmlslb_lane` to 
be consistent with the builtin?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151461/new/

https://reviews.llvm.org/D151461

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


[clang-tools-extra] f69110d - Check for a ‘buffer’ type instead of ‘buffer-live’.

2023-06-05 Thread Sam McCall via cfe-commits

Author: Philipp Stephani
Date: 2023-06-05T15:10:31+02:00
New Revision: f69110dcc9739f9449a77f6010f8c20759d4e0a6

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

LOG: Check for a ‘buffer’ type instead of ‘buffer-live’.

Reviewed By: sammccall

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

Added: 


Modified: 
clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el

Removed: 




diff  --git a/clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el 
b/clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
index c8e74d113ce91..272f282c47f5f 100644
--- a/clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
+++ b/clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
@@ -168,9 +168,9 @@ STDIN, STDOUT, and STDERR are buffers for the standard 
streams;
 only STDERR may be nil.  CALLBACK is called in the case of
 success; it is called with a single argument, STDOUT.  On
 failure, a buffer containing the error output is displayed."
-  (cl-check-type stdin buffer-live)
-  (cl-check-type stdout buffer-live)
-  (cl-check-type stderr (or null buffer-live))
+  (cl-check-type stdin buffer)
+  (cl-check-type stdout buffer)
+  (cl-check-type stderr (or null buffer))
   (cl-check-type callback function)
   (lambda (process event)
 (cl-check-type process process)
@@ -192,7 +192,7 @@ failure, a buffer containing the error output is displayed."
 
 (defun clang-include-fixer--replace-buffer (stdout)
   "Replace current buffer by content of STDOUT."
-  (cl-check-type stdout buffer-live)
+  (cl-check-type stdout buffer)
   (barf-if-buffer-read-only)
   (cond ((fboundp 'replace-buffer-contents) (replace-buffer-contents stdout))
 ((clang-include-fixer--insert-line stdout (current-buffer)))
@@ -207,8 +207,8 @@ equal, do nothing and return non-nil.  If FROM contains a 
single
 line missing from TO, insert that line into TO so that the buffer
 contents are equal and return non-nil.  Otherwise, do nothing and
 return nil.  Buffer restrictions are ignored."
-  (cl-check-type from buffer-live)
-  (cl-check-type to buffer-live)
+  (cl-check-type from buffer)
+  (cl-check-type to buffer)
   (with-current-buffer from
 (save-excursion
   (save-restriction



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


[PATCH] D148918: Check for a ‘buffer’ type instead of ‘buffer-live’.

2023-06-05 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf69110dcc973: Check for a ‘buffer’ type instead of 
‘buffer-live’. (authored by phst, committed by sammccall).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148918/new/

https://reviews.llvm.org/D148918

Files:
  clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el


Index: clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
===
--- clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
+++ clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
@@ -168,9 +168,9 @@
 only STDERR may be nil.  CALLBACK is called in the case of
 success; it is called with a single argument, STDOUT.  On
 failure, a buffer containing the error output is displayed."
-  (cl-check-type stdin buffer-live)
-  (cl-check-type stdout buffer-live)
-  (cl-check-type stderr (or null buffer-live))
+  (cl-check-type stdin buffer)
+  (cl-check-type stdout buffer)
+  (cl-check-type stderr (or null buffer))
   (cl-check-type callback function)
   (lambda (process event)
 (cl-check-type process process)
@@ -192,7 +192,7 @@
 
 (defun clang-include-fixer--replace-buffer (stdout)
   "Replace current buffer by content of STDOUT."
-  (cl-check-type stdout buffer-live)
+  (cl-check-type stdout buffer)
   (barf-if-buffer-read-only)
   (cond ((fboundp 'replace-buffer-contents) (replace-buffer-contents stdout))
 ((clang-include-fixer--insert-line stdout (current-buffer)))
@@ -207,8 +207,8 @@
 line missing from TO, insert that line into TO so that the buffer
 contents are equal and return non-nil.  Otherwise, do nothing and
 return nil.  Buffer restrictions are ignored."
-  (cl-check-type from buffer-live)
-  (cl-check-type to buffer-live)
+  (cl-check-type from buffer)
+  (cl-check-type to buffer)
   (with-current-buffer from
 (save-excursion
   (save-restriction


Index: clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
===
--- clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
+++ clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.el
@@ -168,9 +168,9 @@
 only STDERR may be nil.  CALLBACK is called in the case of
 success; it is called with a single argument, STDOUT.  On
 failure, a buffer containing the error output is displayed."
-  (cl-check-type stdin buffer-live)
-  (cl-check-type stdout buffer-live)
-  (cl-check-type stderr (or null buffer-live))
+  (cl-check-type stdin buffer)
+  (cl-check-type stdout buffer)
+  (cl-check-type stderr (or null buffer))
   (cl-check-type callback function)
   (lambda (process event)
 (cl-check-type process process)
@@ -192,7 +192,7 @@
 
 (defun clang-include-fixer--replace-buffer (stdout)
   "Replace current buffer by content of STDOUT."
-  (cl-check-type stdout buffer-live)
+  (cl-check-type stdout buffer)
   (barf-if-buffer-read-only)
   (cond ((fboundp 'replace-buffer-contents) (replace-buffer-contents stdout))
 ((clang-include-fixer--insert-line stdout (current-buffer)))
@@ -207,8 +207,8 @@
 line missing from TO, insert that line into TO so that the buffer
 contents are equal and return non-nil.  Otherwise, do nothing and
 return nil.  Buffer restrictions are ignored."
-  (cl-check-type from buffer-live)
-  (cl-check-type to buffer-live)
+  (cl-check-type from buffer)
+  (cl-check-type to buffer)
   (with-current-buffer from
 (save-excursion
   (save-restriction
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a subscriber: ChuanqiXu.
erichkeane added inline comments.



Comment at: clang/include/clang/AST/Type.h:3940
+/// on declarations and function pointers.
+unsigned AArch64SMEAttributes : 8;
+

sdesmalen wrote:
> erichkeane wrote:
> > sdesmalen wrote:
> > > erichkeane wrote:
> > > > sdesmalen wrote:
> > > > > erichkeane wrote:
> > > > > > We seem to be missing all of the modules-storage code for these.  
> > > > > > Since this is modifying the AST, we need to increment the 'breaking 
> > > > > > change' AST code, plus add this to the ASTWriter/ASTReader 
> > > > > > interface.
> > > > > > Since this is modifying the AST, we need to increment the 'breaking 
> > > > > > change' AST code
> > > > > Could you give me some pointers on what you expect to see changed 
> > > > > here? I understand your point about adding this to the 
> > > > > ASTWriter/Reader interfaces for module-storage, but it's not entirely 
> > > > > clear what you mean by "increment the breaking change AST code". 
> > > > > 
> > > > > I see there is also an ASTImporter, I guess this different from the 
> > > > > ASTReader?
> > > > > 
> > > > > Please apologise my ignorance here, I'm not as familiar with the 
> > > > > Clang codebase.
> > > > See VersionMajor here: 
> > > > https://clang.llvm.org/doxygen/ASTBitCodes_8h_source.html
> > > > 
> > > > Yes, ASTReader/ASTWriter and ASTImporter are different unfortunately.  
> > > > I'm not completely sure of the difference, but doing this patch 
> > > > changing the type here without doing those will break modules.
> > > So I tried to create some tests for this (see 
> > > clang/test/AST/ast-dump-sme-attributes.cpp) and realised that the 
> > > serialization/deserialization works out-of-the-box.
> > > 
> > > Does that mean all is needed is an increment of the VERSION_MAJOR or 
> > > VERSION_MINOR number?
> > So its not just ast-dump that matters, it is what happens when these 
> > functions are exported from a module, and imported from another?  Unless 
> > you make changes to those areas, this SME stuff will be lost, since you're 
> > making it part of the type.
> Hi @erichkeane I've added a test for module export/import and was surprised 
> to see this work without any additional changes. Do you think the added test 
> is correct/sufficient to show that this works?
I don't have a good idea of that, I know little about our modules 
implementation.  Perhaps @ChuanqiXu knows?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

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


[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

We ended up getting the regular-attribute-like-keywords patch in a different 
form.  Do we still want to do this as is?  Does it need rebasing?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments.



Comment at: clang/include/clang/AST/Type.h:3956
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+

Isn't using a `uint16_t` preferred over a bitfield?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/include/clang/AST/Type.h:3956
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+

tbaeder wrote:
> Isn't using a `uint16_t` preferred over a bitfield?
Ah, thats a great point, yes, I think that is probably better here!  I like the 
assert on setting it (particularly because we're shrinking it!), but that idea 
makes this patch much smaller.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen marked an inline comment as done.
sdesmalen added a comment.

In D127762#4395509 , @erichkeane 
wrote:

> We ended up getting the regular-attribute-like-keywords patch in a different 
> form.  Do we still want to do this as is?  Does it need rebasing?

I've rebased this patch on top of @rsandifo-arm's patches so that it uses the 
attribute-like-keywords now (note for example that the tests have been updated 
to use the new keywords).

D148700  and D148702 
 only addressed the parsing side of things, 
not the semantics. This patch adds the remaining attributes/keywords (D148700 
 only added `__arm_streaming`), integrates 
the type information into the AST and adds codegen to the LLVM IR function- and 
call-site attributes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

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


[clang] e4b9b78 - [clang][Interp][NFC] Make a single-line comment a doc comment

2023-06-05 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2023-06-05T15:30:28+02:00
New Revision: e4b9b78a84b09ab997ab60de456a3a9ada22e592

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

LOG: [clang][Interp][NFC] Make a single-line comment a doc comment

Added: 


Modified: 
clang/lib/AST/Interp/Pointer.h

Removed: 




diff  --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index 10d21a27167f0..863d8b3bae0d6 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -246,7 +246,7 @@ class Pointer {
 
   /// Returns the record descriptor of a class.
   Record *getRecord() const { return getFieldDesc()->ElemRecord; }
-  // Returns the element record type, if this is a non-primive array.
+  /// Returns the element record type, if this is a non-primive array.
   Record *getElemRecord() const { return getFieldDesc()->ElemDesc->ElemRecord; 
}
   /// Returns the field information.
   const FieldDecl *getField() const { return getFieldDesc()->asFieldDecl(); }



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


[PATCH] D151833: Respect "-fdiagnostics-absolute-paths" on emit include location

2023-06-05 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added subscribers: cjdb, aaron.ballman.
tbaeder added a comment.

LGTM, but maybe wait for a response from @aaron.ballman or @cjdb


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151833/new/

https://reviews.llvm.org/D151833

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


[PATCH] D150427: [AMDGPU] Non hostcall printf support for HIP

2023-06-05 Thread Vikram Hegde via Phabricator via cfe-commits
vikramRH updated this revision to Diff 528407.
vikramRH added a comment.

Handled few more review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150427/new/

https://reviews.llvm.org/D150427

Files:
  clang/include/clang/Basic/TargetOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGGPUBuiltin.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenHIP/default-attributes.hip
  clang/test/CodeGenHIP/printf-kind-module-flag.hip
  clang/test/CodeGenHIP/printf_nonhostcall.cpp
  clang/test/CodeGenHIP/sanitize-undefined-null.hip
  clang/test/Driver/hip-options.hip
  llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h
  llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp

Index: llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
===
--- llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
+++ llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
@@ -17,6 +17,9 @@
 #include "llvm/Transforms/Utils/AMDGPUEmitPrintf.h"
 #include "llvm/ADT/SparseBitVector.h"
 #include "llvm/Analysis/ValueTracking.h"
+#include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/MD5.h"
+#include "llvm/Support/MathExtras.h"
 
 using namespace llvm;
 
@@ -179,11 +182,7 @@
 
 // Scan the format string to locate all specifiers, and mark the ones that
 // specify a string, i.e, the "%s" specifier with optional '*' characters.
-static void locateCStrings(SparseBitVector<8> &BV, Value *Fmt) {
-  StringRef Str;
-  if (!getConstantStringInfo(Fmt, Str) || Str.empty())
-return;
-
+static void locateCStrings(SparseBitVector<8> &BV, StringRef Str) {
   static const char ConvSpecifiers[] = "diouxXfFeEgGaAcspn";
   size_t SpecPos = 0;
   // Skip the first argument, the format string.
@@ -207,14 +206,302 @@
   }
 }
 
-Value *llvm::emitAMDGPUPrintfCall(IRBuilder<> &Builder,
-  ArrayRef Args) {
+// helper struct to package the string related data
+struct StringData {
+  StringRef Str;
+  Value *RealSize = nullptr;
+  Value *AlignedSize = nullptr;
+  bool IsConst = true;
+
+  StringData(StringRef ST, Value *RS, Value *AS, bool IC)
+  : Str(ST), RealSize(RS), AlignedSize(AS), IsConst(IC) {}
+};
+
+// Calculates frame size required for current printf expansion and allocates
+// space on printf buffer. Printf frame includes following contents
+// [ ControlDWord , format string/Hash , Arguments (each aligned to 8 byte) ]
+static Value *callBufferedPrintfStart(
+IRBuilder<> &Builder, ArrayRef Args, Value *Fmt,
+bool isConstFmtStr, SparseBitVector<8> &SpecIsCString,
+SmallVectorImpl &StringContents, Value *&ArgSize) {
+  Module *M = Builder.GetInsertBlock()->getModule();
+  Value *NonConstStrLen = nullptr;
+  Value *LenWithNull = nullptr;
+  Value *LenWithNullAligned = nullptr;
+  Value *TempAdd = nullptr;
+
+  // First 4 bytes to be reserved for control dword
+  size_t BufSize = 4;
+  if (isConstFmtStr)
+// First 8 bytes of MD5 hash
+BufSize += 8;
+  else {
+LenWithNull = getStrlenWithNull(Builder, Fmt);
+
+// Align the computed length to next 8 byte boundary
+TempAdd = Builder.CreateAdd(LenWithNull,
+ConstantInt::get(LenWithNull->getType(), 7U));
+NonConstStrLen = Builder.CreateAnd(
+TempAdd, ConstantInt::get(LenWithNull->getType(), ~7U));
+
+StringContents.push_back(
+StringData(StringRef(), LenWithNull, NonConstStrLen, false));
+  }
+
+  for (size_t i = 1; i < Args.size(); i++) {
+if (SpecIsCString.test(i)) {
+  StringRef ArgStr;
+  if (getConstantStringInfo(Args[i], ArgStr)) {
+auto alignedLen = alignTo(ArgStr.size() + 1, 8);
+StringContents.push_back(StringData(
+ArgStr,
+/*RealSize*/ nullptr, /*AlignedSize*/ nullptr, /*IsConst*/ true));
+BufSize += alignedLen;
+  } else {
+LenWithNull = getStrlenWithNull(Builder, Args[i]);
+
+// Align the computed length to next 8 byte boundary
+TempAdd = Builder.CreateAdd(
+LenWithNull, ConstantInt::get(LenWithNull->getType(), 7U));
+LenWithNullAligned = Builder.CreateAnd(
+TempAdd, ConstantInt::get(LenWithNull->getType(), ~7U));
+
+if (NonConstStrLen) {
+  auto Val = Builder.CreateAdd(LenWithNullAligned, NonConstStrLen,
+   "cumulativeAdd");
+  NonConstStrLen = Val;
+} else
+  NonConstStrLen = LenWithNullAligned;
+
+StringContents.push_back(
+StringData("", LenWithNull, LenWithNullAligned, false));
+  }
+} else
+  // We end up expanding non string arguments to 8 bytes
+  BufSize += 8;
+  }
+
+  // calculate final size value to be passed to printf_alloc
+  Value *SizeToReserve = ConstantInt::get(Builder.getInt64Ty(), BufSize, false);
+  SmallVector Alloc_args;
+  if (NonConstStrLen)
+SizeToReser

[PATCH] D150427: [AMDGPU] Non hostcall printf support for HIP

2023-06-05 Thread Vikram Hegde via Phabricator via cfe-commits
vikramRH marked 4 inline comments as done.
vikramRH added inline comments.



Comment at: clang/test/CodeGenHIP/printf_nonhostcall.cpp:228
+  return printf(s, 10);
+}

arsenm wrote:
> vikramRH wrote:
> > arsenm wrote:
> > > Need some vector tests, especially 3 x vectors 
> > vectors are not yet supported as in the hostcall case since the code 
> > currently runs for HIP only. I plan to port the OpenCL lowering also here 
> > along with hostcall support . we would need to extend hostcall and this 
> > implementation to support vectors as part of the porting activity.
> Something still needs to happen for vectors, it can't just crash. The 
> different types of vectors may appear regardless of language 
I have forced "-Werror=format-invalid-specifier" with printf option which 
should be a sufficient condition for vectors I guess ? (this causes clang to 
break out earlier with an error)



Comment at: llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp:458
+auto CreateControlDWord = M->getOrInsertFunction(
+StringRef("__ockl_create_control_dword"), Builder.getInt32Ty(),
+Builder.getInt32Ty(), Int1Ty, Int1Ty);

arsenm wrote:
> vikramRH wrote:
> > arsenm wrote:
> > > sameerds wrote:
> > > > vikramRH wrote:
> > > > > arsenm wrote:
> > > > > > vikramRH wrote:
> > > > > > > arsenm wrote:
> > > > > > > > Do we really need another ockl control variable for this? Why 
> > > > > > > > isn't it a parameter? printf=stdout always 
> > > > > > > There are certain HIP API's such as "hip_assert" that output to 
> > > > > > > stderr. currently such API's are supported via hostcalls. 
> > > > > > > Although this implementation does not currently support the API's 
> > > > > > > ,its kept as an option. 
> > > > > > Right but the way to handle that would be a parameter for where to 
> > > > > > output, not an externally set global 
> > > > > I am not clear here, you expect additional inputs to device lib 
> > > > > function ?
> > > > @arsenm, this "control word" written into the buffer. In that sense, it 
> > > > is indeed a parameter passed from device to host as part of the printf 
> > > > packet. It is not yet another global variable.
> > > I'm not following why this part requires introducing another call into 
> > > device libs. It's expanding this not-really defined API. I'd expect this 
> > > to be a trivial function we can expand inline here and write directly 
> > > into the parameter buffer?
> > I started the implementation keeping in mind the device side asserts 
> > currenlty supported via hostcall. They use explicit calls to such device 
> > lib functions in their definitions. I could not support them now but these 
> > would be required if I ever decide to. also I never ended up inlining this 
> > call. do you think its really necessary ?
> But that implementation is in the library itself? What does the function 
> actually do?
> 
> I think we're better off the more defined/documented ABI we have in terms of 
> size-and-offset from base pointer than call into unstable library calls.
> 
> Can we get some documentation on the ABI in AMDGPUUsage?
The library function itself just handles creation of controlDWord via minor bit 
manipulations. nevertheless Inlining is pretty simple and im fine either way. 
Call has been expanded.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150427/new/

https://reviews.llvm.org/D150427

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


[PATCH] D134475: [Clang] Add support for [[msvc::constexpr]] C++11 attribute

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a subscriber: tbaeder.
erichkeane added a comment.

In D134475#4393035 , @RIscRIpt wrote:

> Added diagnostics for [[msvc::constexpr]] virtual
>
> Regarding [[msvc::constexpr]] constructors, unfortunatelly I cannot find a 
> reasonable way to support it.
>
> During development I found out about Clang's experimental Constant 
> Interpreter (`-fexperimental-new-constant-interpreter`),
> I suppose it would be much easier to implement complete support for 
> `[[msvc::constexpr]]` there.
> I am not aware about policy regarding constant evaulation/interpreter:
> do you approve new constant evaluation features in the current (AST-based) 
> approach without extending the experimental one?
> Because I'd rather tacke with experimental Constant Interpreter in a 
> follow-up (if I ever find time for this).

Currently the experimental evaluator isn't required to get patches committed.  
It is mostly the labor-of-love of @tbaeder and is still in the beginning stages 
of development.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134475/new/

https://reviews.llvm.org/D134475

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: clang/include/clang/AST/Type.h:3956
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+

erichkeane wrote:
> tbaeder wrote:
> > Isn't using a `uint16_t` preferred over a bitfield?
> Ah, thats a great point, yes, I think that is probably better here!  I like 
> the assert on setting it (particularly because we're shrinking it!), but that 
> idea makes this patch much smaller.
The reason for making this a bitfield rather than uint16_t is because D127762 
extends the struct with another (bit)field:

/// Any AArch64 SME ACLE type attributes that need to be propagated
/// on declarations and function pointers.
unsigned AArch64SMEAttributes : 6;

I thought having this all be bitfields made more sense, but I'm happy to change 
it to a uint16_t if that is preferred.

> that idea makes this patch much smaller
I suspect that the assert is still required to ensure that the value stored 
fits the value? Using `uint16_t` doesn't change that, or did I miss something? 
:)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/include/clang/AST/Type.h:3956
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+

sdesmalen wrote:
> erichkeane wrote:
> > tbaeder wrote:
> > > Isn't using a `uint16_t` preferred over a bitfield?
> > Ah, thats a great point, yes, I think that is probably better here!  I like 
> > the assert on setting it (particularly because we're shrinking it!), but 
> > that idea makes this patch much smaller.
> The reason for making this a bitfield rather than uint16_t is because D127762 
> extends the struct with another (bit)field:
> 
> /// Any AArch64 SME ACLE type attributes that need to be propagated
> /// on declarations and function pointers.
> unsigned AArch64SMEAttributes : 6;
> 
> I thought having this all be bitfields made more sense, but I'm happy to 
> change it to a uint16_t if that is preferred.
> 
> > that idea makes this patch much smaller
> I suspect that the assert is still required to ensure that the value stored 
> fits the value? Using `uint16_t` doesn't change that, or did I miss 
> something? :)
We don't need them all to be bitfields, they'll take up the same amount of 
space with out it, and save us a bit of oddity.

I like the assert still as well, but since this size is set in 1 place, an 
assert there would be fine as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 528431.
sdesmalen added a comment.

Use uint16_t instead of unsigned bitfield.
Also removed accessor methods in favour of assert at point of writing 
NumExceptionType.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

Files:
  clang/include/clang/AST/Type.h
  clang/lib/AST/Type.cpp


Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3371,7 +3371,10 @@
   // Fill in the exception type array if present.
   if (getExceptionSpecType() == EST_Dynamic) {
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+auto NumExceptions = epi.ExceptionSpec.Exceptions.size();
+assert(NumExceptions <= UINT16_MAX &&
+   "Not enough bits to encode exceptions");
+ExtraBits.NumExceptionType = NumExceptions;
 
 assert(hasExtraBitfields() && "missing trailing extra bitfields!");
 auto *exnSlot =
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -3953,7 +3953,7 @@
 /// The number of types in the exception specification.
 /// A whole unsigned is not needed here and according to
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+uint16_t NumExceptionType = 0;
   };
 
 protected:


Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3371,7 +3371,10 @@
   // Fill in the exception type array if present.
   if (getExceptionSpecType() == EST_Dynamic) {
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+auto NumExceptions = epi.ExceptionSpec.Exceptions.size();
+assert(NumExceptions <= UINT16_MAX &&
+   "Not enough bits to encode exceptions");
+ExtraBits.NumExceptionType = NumExceptions;
 
 assert(hasExtraBitfields() && "missing trailing extra bitfields!");
 auto *exnSlot =
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -3953,7 +3953,7 @@
 /// The number of types in the exception specification.
 /// A whole unsigned is not needed here and according to
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+uint16_t NumExceptionType = 0;
   };
 
 protected:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: clang/include/clang/AST/Type.h:3956
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+unsigned NumExceptionType : 16;
+

erichkeane wrote:
> sdesmalen wrote:
> > erichkeane wrote:
> > > tbaeder wrote:
> > > > Isn't using a `uint16_t` preferred over a bitfield?
> > > Ah, thats a great point, yes, I think that is probably better here!  I 
> > > like the assert on setting it (particularly because we're shrinking it!), 
> > > but that idea makes this patch much smaller.
> > The reason for making this a bitfield rather than uint16_t is because 
> > D127762 extends the struct with another (bit)field:
> > 
> > /// Any AArch64 SME ACLE type attributes that need to be propagated
> > /// on declarations and function pointers.
> > unsigned AArch64SMEAttributes : 6;
> > 
> > I thought having this all be bitfields made more sense, but I'm happy to 
> > change it to a uint16_t if that is preferred.
> > 
> > > that idea makes this patch much smaller
> > I suspect that the assert is still required to ensure that the value stored 
> > fits the value? Using `uint16_t` doesn't change that, or did I miss 
> > something? :)
> We don't need them all to be bitfields, they'll take up the same amount of 
> space with out it, and save us a bit of oddity.
> 
> I like the assert still as well, but since this size is set in 1 place, an 
> assert there would be fine as well.
Okay that makes sense, thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane requested changes to this revision.
erichkeane added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/AST/Type.cpp:3374
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+auto NumExceptions = epi.ExceptionSpec.Exceptions.size();
+assert(NumExceptions <= UINT16_MAX &&

So this isn't a place where we're allowed to use `auto`.  We can only use it if 
the type is listed on the RHS (like in the case of casts/etc).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 528433.
sdesmalen added a comment.

Use size_t instead of auto.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

Files:
  clang/include/clang/AST/Type.h
  clang/lib/AST/Type.cpp


Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3371,7 +3371,10 @@
   // Fill in the exception type array if present.
   if (getExceptionSpecType() == EST_Dynamic) {
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+size_t NumExceptions = epi.ExceptionSpec.Exceptions.size();
+assert(NumExceptions <= UINT16_MAX &&
+   "Not enough bits to encode exceptions");
+ExtraBits.NumExceptionType = NumExceptions;
 
 assert(hasExtraBitfields() && "missing trailing extra bitfields!");
 auto *exnSlot =
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -3953,7 +3953,7 @@
 /// The number of types in the exception specification.
 /// A whole unsigned is not needed here and according to
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+uint16_t NumExceptionType = 0;
   };
 
 protected:


Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3371,7 +3371,10 @@
   // Fill in the exception type array if present.
   if (getExceptionSpecType() == EST_Dynamic) {
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+size_t NumExceptions = epi.ExceptionSpec.Exceptions.size();
+assert(NumExceptions <= UINT16_MAX &&
+   "Not enough bits to encode exceptions");
+ExtraBits.NumExceptionType = NumExceptions;
 
 assert(hasExtraBitfields() && "missing trailing extra bitfields!");
 auto *exnSlot =
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -3953,7 +3953,7 @@
 /// The number of types in the exception specification.
 /// A whole unsigned is not needed here and according to
 /// [implimits] 8 bits would be enough here.
-unsigned NumExceptionType = 0;
+uint16_t NumExceptionType = 0;
   };
 
 protected:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152140: [Clang] Limit FunctionTypeExtraBitfields::NumExceptionType to 16 bits.

2023-06-05 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: clang/lib/AST/Type.cpp:3374
 auto &ExtraBits = *getTrailingObjects();
-ExtraBits.NumExceptionType = epi.ExceptionSpec.Exceptions.size();
+auto NumExceptions = epi.ExceptionSpec.Exceptions.size();
+assert(NumExceptions <= UINT16_MAX &&

erichkeane wrote:
> So this isn't a place where we're allowed to use `auto`.  We can only use it 
> if the type is listed on the RHS (like in the case of casts/etc).
You're absolutely right, sorry about that!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152140/new/

https://reviews.llvm.org/D152140

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


[PATCH] D152164: [CUDA][HIP] Externalize device var in anonymous namespace

2023-06-05 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a subscriber: mattd.
Herald added a project: All.
yaxunl requested review of this revision.

Device variables in an anonymous namespace may be
referenced by host code, therefore they need to
be externalized in a similar way as a static device
variables or kernels in an anonymous namespace.

Fixes: https://github.com/ROCm-Developer-Tools/HIP/issues/3246


https://reviews.llvm.org/D152164

Files:
  clang/lib/AST/ASTContext.cpp
  clang/test/CodeGenCUDA/anon-ns.cu
  clang/test/CodeGenCUDA/kernel-in-anon-ns.cu

Index: clang/test/CodeGenCUDA/anon-ns.cu
===
--- clang/test/CodeGenCUDA/anon-ns.cu
+++ clang/test/CodeGenCUDA/anon-ns.cu
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -cuid=abc \
-// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++11 -fgpu-rdc \
+// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++17 -fgpu-rdc \
 // RUN:   -emit-llvm -o - -x hip %s > %t.dev
 
 // RUN: %clang_cc1 -triple x86_64-gnu-linux -cuid=abc \
-// RUN:   -aux-triple amdgcn-amd-amdhsa -std=c++11 -fgpu-rdc \
+// RUN:   -aux-triple amdgcn-amd-amdhsa -std=c++17 -fgpu-rdc \
 // RUN:   -emit-llvm -o - -x hip %s > %t.host
 
 // RUN: cat %t.dev %t.host | FileCheck -check-prefixes=HIP,COMMON %s
@@ -11,11 +11,11 @@
 // RUN: echo "GPU binary" > %t.fatbin
 
 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device -cuid=abc \
-// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++11 -fgpu-rdc \
+// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++17 -fgpu-rdc \
 // RUN:   -emit-llvm -o - %s > %t.dev
 
 // RUN: %clang_cc1 -triple x86_64-gnu-linux -cuid=abc \
-// RUN:   -aux-triple nvptx -std=c++11 -fgpu-rdc -fcuda-include-gpubinary %t.fatbin \
+// RUN:   -aux-triple nvptx -std=c++17 -fgpu-rdc -fcuda-include-gpubinary %t.fatbin \
 // RUN:   -emit-llvm -o - %s > %t.host
 
 // RUN: cat %t.dev %t.host | FileCheck -check-prefixes=CUDA,COMMON %s
@@ -25,34 +25,62 @@
 // HIP-DAG: define weak_odr {{.*}}void @[[KERN1:_ZN12_GLOBAL__N_16kernelEv\.intern\.b04fd23c98500190]](
 // HIP-DAG: define weak_odr {{.*}}void @[[KERN2:_Z8tempKernIN12_GLOBAL__N_11XEEvT_\.intern\.b04fd23c98500190]](
 // HIP-DAG: define weak_odr {{.*}}void @[[KERN3:_Z8tempKernIN12_GLOBAL__N_1UlvE_EEvT_\.intern\.b04fd23c98500190]](
+// HIP-DAG: @[[VAR1:_ZN12_GLOBAL__N_11AE\.static\.b04fd23c98500190]] = addrspace(1) externally_initialized global
+// HIP-DAG: @[[VAR2:_ZN12_GLOBAL__N_11BE\.static\.b04fd23c98500190]] = addrspace(4) externally_initialized global
+// HIP-DAG: @[[VAR3:_Z7tempVarIN12_GLOBAL__N_11XEE\.static\.b04fd23c98500190]] = addrspace(1) externally_initialized global
 
 // CUDA-DAG: define weak_odr {{.*}}void @[[KERN1:_ZN12_GLOBAL__N_16kernelEv__intern__b04fd23c98500190]](
 // CUDA-DAG: define weak_odr {{.*}}void @[[KERN2:_Z8tempKernIN12_GLOBAL__N_11XEEvT___intern__b04fd23c98500190]](
 // CUDA-DAG: define weak_odr {{.*}}void @[[KERN3:_Z8tempKernIN12_GLOBAL__N_1UlvE_EEvT___intern__b04fd23c98500190]](
+// CUDA-DAG: @[[VAR2:_ZN12_GLOBAL__N_11BE__static__b04fd23c98500190]] = addrspace(4) externally_initialized global
+// CUDA-DAG: @[[VAR3:_Z7tempVarIN12_GLOBAL__N_11XEE__static__b04fd23c98500190]] = addrspace(1) externally_initialized global
+
+// HIP-DAG: @llvm.compiler.used = {{.*}}@[[VAR1]]{{.*}}@[[VAR3]]{{.*}}@[[VAR2]]
+// CUDA-DAG: @llvm.compiler.used = {{.*}}@[[VAR3]]{{.*}}@[[VAR2]]
 
 // COMMON-DAG: @[[STR1:.*]] = {{.*}} c"[[KERN1]]\00"
 // COMMON-DAG: @[[STR2:.*]] = {{.*}} c"[[KERN2]]\00"
 // COMMON-DAG: @[[STR3:.*]] = {{.*}} c"[[KERN3]]\00"
+// HIP-DAG: @[[STR4:.*]] = {{.*}} c"[[VAR1]]\00"
+// COMMON-DAG: @[[STR5:.*]] = {{.*}} c"[[VAR2]]\00"
+// COMMON-DAG: @[[STR6:.*]] = {{.*}} c"[[VAR3]]\00"
 
 // COMMON-DAG: call i32 @__{{.*}}RegisterFunction({{.*}}@[[STR1]]
 // COMMON-DAG: call i32 @__{{.*}}RegisterFunction({{.*}}@[[STR2]]
 // COMMON-DAG: call i32 @__{{.*}}RegisterFunction({{.*}}@[[STR3]]
-
+// HIP-DAG: call void @__{{.*}}RegisterManagedVar({{.*}}@[[STR4]]
+// COMMON-DAG: call void @__{{.*}}RegisterVar({{.*}}@[[STR5]]
+// COMMON-DAG: call void @__{{.*}}RegisterVar({{.*}}@[[STR6]]
 
 template 
 __global__ void tempKern(T x) {}
 
+template 
+__device__ T tempVar;
+
 namespace {
   __global__ void kernel() {}
   struct X {};
   X x;
   auto lambda = [](){};
+#if __HIP__
+  __managed__ int A = 1;
+#endif
+  __constant__ int B = 2;
 }
 
+template
+void getSymbol(T *x) {}
+
 void test() {
   kernel<<<1, 1>>>();
 
   tempKern<<<1, 1>>>(x);
 
   tempKern<<<1, 1>>>(lambda);
+#if __HIP__
+  getSymbol(&A);
+#endif
+  getSymbol(&B);
+  getSymbol(&tempVar);
 }
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -13602,16 +13602,17 @@
 }
 
 bool ASTContext::mayExternalize(const Decl *D) const {
-  bool IsStaticVar =
-  isa(D) && cast(D)->getStorageClass() == SC_Static;
+  bool IsInternalVar

[PATCH] D151437: [NFC][Driver] Change MultilibBuilder interface

2023-06-05 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham accepted this revision.
simon_tatham added a comment.
This revision is now accepted and ready to land.

LGTM: I agree that the new notation is easier to understand for anyone not 
already used to the old one.

However, please wait at least a day for other people and time zones to have a 
chance to respond.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151437/new/

https://reviews.llvm.org/D151437

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


[PATCH] D152090: [clang][Driver] Add -fcaret-diagnostics-max-lines as a driver option

2023-06-05 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

`def fcaret_diagnostics_max_lines` in `Options.td` has the `NoDriverOption` 
flag. Move it to other places with `BooleainFFlag` should work. 
Then in `Clang.cpp` you can just write `Args.AddLastArg(...)`

Can you add some description that this is related to D147875 
 ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152090/new/

https://reviews.llvm.org/D152090

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


[PATCH] D127762: [Clang][AArch64] Add/implement ACLE keywords for SME.

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

I think we need a few tests to ensure that these are properly propagated on 
function templates (both for Sema and codegen).  Also, a handful of nits (See 
my list).




Comment at: clang/include/clang/AST/Type.h:3958
+SME_PStateZAPreservedMask = 1 << 3,
+SME_AttributeMask = 63 // We only support maximum 6 bits because of the
+   // bitmask in FunctionTypeExtraBitfields.





Comment at: clang/include/clang/Basic/Attr.td:2459
+def ArmPreservesZA : TypeAttr, TargetSpecificAttr {
+  let Spellings = [RegularKeyword<"__arm_preserves_za">];
+  let Subjects = SubjectList<[HasFunctionProto], ErrorDiag>;

So, why are `__arm_shared_za` and `__arm_preserves_za` different tenses, 
despite being very similar sounding?  Should it be `__arm_shares_za` (or 
alternatively, `__arm_preserved_za`)?



Comment at: clang/include/clang/Basic/AttrDocs.td:6595
+
+* the function requires the Scalable Matrix Extension (SME)
+

I'm missing a touch of context that an additional word or two might help.  is 
this 'the function requires the 'target' processor has SME?  or the 'runtime' 
processor?

Also, the rest of the list ends in a '.', but this one doesnt.



Comment at: clang/include/clang/Basic/AttrDocs.td:6633
+It applies to function types and specifies that the function shares
+ZA state with its caller.  This means that:
+

"ZA" should be defined 1st time it is used in this doc, and the ones below.



Comment at: clang/include/clang/Basic/AttrDocs.td:6635
+
+* the function requires the Scalable Matrix Extension (SME)
+

Same comments as above.



Comment at: clang/include/clang/Basic/AttrDocs.td:6679
+
+* the function requires the Scalable Matrix Extension (SME)
+

Same here.



Comment at: clang/include/clang/Basic/AttrDocs.td:6707
+
+* the function requires the Scalable Matrix Extension (SME)
+

again.



Comment at: clang/lib/Sema/SemaDecl.cpp:3758
 
+  // It is not allowed to redeclare an SME function with different SME
+  // attributes.





Comment at: clang/lib/Sema/SemaDeclAttr.cpp:9444
+  case ParsedAttr::AT_ArmNewZA:
+if (auto *FPT = dyn_cast(D->getFunctionType())) {
+  if (FPT->getAArch64SMEAttributes() &

This switch should ONLY be 'handle' function calls.  Please break this off into 
its own function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127762/new/

https://reviews.llvm.org/D127762

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


[PATCH] D152169: [clang][analyzer] Add report of NULL stream to StreamChecker.

2023-06-05 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision.
Herald added subscribers: steakhal, manas, ASDenysPetrov, martong, gamesh411, 
dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, 
baloghadamsoftware, xazax.hun.
Herald added a reviewer: Szelethus.
Herald added a reviewer: NoQ.
Herald added a project: All.
balazske requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The report of NULL stream was removed in commit 570bf97 
.
The old reason is not actual any more because the checker dependencies are 
changed.
It is not good to eliminate a failure state (where the stream is NULL) without
generating a bug report because other checkers are not able to find it later.
The checker did this with the NULL stream pointer, and because this checker
runs now before other checkers that can detect NULL pointers, the null pointer
bug was not found at all.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152169

Files:
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  clang/test/Analysis/std-c-library-functions-arg-enabled-checkers.c
  clang/test/Analysis/std-c-library-functions-arg-weakdeps.c
  clang/test/Analysis/stream-note.c
  clang/test/Analysis/stream-stdlibraryfunctionargs.c
  clang/test/Analysis/stream.c

Index: clang/test/Analysis/stream.c
===
--- clang/test/Analysis/stream.c
+++ clang/test/Analysis/stream.c
@@ -2,6 +2,81 @@
 
 #include "Inputs/system-header-simulator.h"
 
+void check_fread(void) {
+  FILE *fp = tmpfile();
+  fread(0, 0, 0, fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_fwrite(void) {
+  FILE *fp = tmpfile();
+  fwrite(0, 0, 0, fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_fseek(void) {
+  FILE *fp = tmpfile();
+  fseek(fp, 0, 0); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_ftell(void) {
+  FILE *fp = tmpfile();
+  ftell(fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_rewind(void) {
+  FILE *fp = tmpfile();
+  rewind(fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_fgetpos(void) {
+  FILE *fp = tmpfile();
+  fpos_t pos;
+  fgetpos(fp, &pos); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_fsetpos(void) {
+  FILE *fp = tmpfile();
+  fpos_t pos;
+  fsetpos(fp, &pos); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_clearerr(void) {
+  FILE *fp = tmpfile();
+  clearerr(fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_feof(void) {
+  FILE *fp = tmpfile();
+  feof(fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_ferror(void) {
+  FILE *fp = tmpfile();
+  ferror(fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void check_fileno(void) {
+  FILE *fp = tmpfile();
+  fileno(fp); // expected-warning {{Stream pointer might be NULL}}
+  fclose(fp);
+}
+
+void f_open(void) {
+  FILE *p = fopen("foo", "r");
+  char buf[1024];
+  fread(buf, 1, 1, p); // expected-warning {{Stream pointer might be NULL}}
+  fclose(p);
+}
+
 void f_seek(void) {
   FILE *p = fopen("foo", "r");
   if (!p)
@@ -86,7 +161,7 @@
 }
 
 void check_freopen_1(void) {
-  FILE *f1 = freopen("foo.c", "r", (FILE *)0); // Not reported by the stream checker.
+  FILE *f1 = freopen("foo.c", "r", (FILE *)0); // expected-warning {{Stream pointer might be NULL}}
   f1 = freopen(0, "w", (FILE *)0x123456);  // Do not report this as error.
 }
 
Index: clang/test/Analysis/stream-stdlibraryfunctionargs.c
===
--- clang/test/Analysis/stream-stdlibraryfunctionargs.c
+++ clang/test/Analysis/stream-stdlibraryfunctionargs.c
@@ -1,11 +1,11 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream,alpha.unix.StdCLibraryFunctions,debug.ExprInspection \
-// RUN:   -analyzer-config alpha.unix.StdCLibraryFunctions:ModelPOSIX=true -verify=stdargs,any %s
+// RUN:   -analyzer-config alpha.unix.StdCLibraryFunctions:ModelPOSIX=true -verify=stream,any %s
 
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream,debug.ExprInspection \
-// RUN:   -analyzer-config alpha.unix.StdCLibraryFunctions:ModelPOSIX=true -verify=any %s
+// RUN:   -analyzer-config alpha.unix.StdCLibraryFunctions:ModelPOSIX=true -verify=stream,any %s
 
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.StdCLibraryFunctions,debug.ExprInspection \
-// RUN:   -analyzer-config alpha.unix.StdCLibraryFunctions:ModelPOSIX=true -verify=stdargs,any %s
+// RUN:   -analyzer-config alpha.unix.StdCLibraryFunctions:ModelPOSIX=true -verify=stdfunc,any %s
 
 #include "In

[PATCH] D151833: Respect "-fdiagnostics-absolute-paths" on emit include location

2023-06-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151833/new/

https://reviews.llvm.org/D151833

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


[PATCH] D151833: Respect "-fdiagnostics-absolute-paths" on emit include location

2023-06-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Do you need someone to commit on your behalf? If so, what name and email 
address would you like used for patch attribution?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151833/new/

https://reviews.llvm.org/D151833

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


[PATCH] D151833: Respect "-fdiagnostics-absolute-paths" on emit include location

2023-06-05 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment.

@charmitro do you have commit rights or do you need someone to push on your 
behalf?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151833/new/

https://reviews.llvm.org/D151833

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


[PATCH] D149573: [Clang][C++23] Implement core language changes from P1467R9 extended floating-point types and standard names

2023-06-05 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

This all LGTM, but I want @tahonermann to do a pass as well, he knows more 
about FP than I do, so I don't want to accept without his run-through.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149573/new/

https://reviews.llvm.org/D149573

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


[PATCH] D152164: [CUDA][HIP] Externalize device var in anonymous namespace

2023-06-05 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 528447.
yaxunl added a comment.

add a test to make sure device var in an anonymous namespace is not 
externalized if used by device code only.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152164/new/

https://reviews.llvm.org/D152164

Files:
  clang/lib/AST/ASTContext.cpp
  clang/test/CodeGenCUDA/anon-ns.cu
  clang/test/CodeGenCUDA/kernel-in-anon-ns.cu

Index: clang/test/CodeGenCUDA/kernel-in-anon-ns.cu
===
--- clang/test/CodeGenCUDA/kernel-in-anon-ns.cu
+++ /dev/null
@@ -1,58 +0,0 @@
-// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -cuid=abc \
-// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++11 -fgpu-rdc \
-// RUN:   -emit-llvm -o - -x hip %s > %t.dev
-
-// RUN: %clang_cc1 -triple x86_64-gnu-linux -cuid=abc \
-// RUN:   -aux-triple amdgcn-amd-amdhsa -std=c++11 -fgpu-rdc \
-// RUN:   -emit-llvm -o - -x hip %s > %t.host
-
-// RUN: cat %t.dev %t.host | FileCheck -check-prefixes=HIP,COMMON %s
-
-// RUN: echo "GPU binary" > %t.fatbin
-
-// RUN: %clang_cc1 -triple nvptx -fcuda-is-device -cuid=abc \
-// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++11 -fgpu-rdc \
-// RUN:   -emit-llvm -o - %s > %t.dev
-
-// RUN: %clang_cc1 -triple x86_64-gnu-linux -cuid=abc \
-// RUN:   -aux-triple nvptx -std=c++11 -fgpu-rdc -fcuda-include-gpubinary %t.fatbin \
-// RUN:   -emit-llvm -o - %s > %t.host
-
-// RUN: cat %t.dev %t.host | FileCheck -check-prefixes=CUDA,COMMON %s
-
-#include "Inputs/cuda.h"
-
-// HIP-DAG: define weak_odr {{.*}}void @[[KERN1:_ZN12_GLOBAL__N_16kernelEv\.intern\.b04fd23c98500190]](
-// HIP-DAG: define weak_odr {{.*}}void @[[KERN2:_Z8tempKernIN12_GLOBAL__N_11XEEvT_\.intern\.b04fd23c98500190]](
-// HIP-DAG: define weak_odr {{.*}}void @[[KERN3:_Z8tempKernIN12_GLOBAL__N_1UlvE_EEvT_\.intern\.b04fd23c98500190]](
-
-// CUDA-DAG: define weak_odr {{.*}}void @[[KERN1:_ZN12_GLOBAL__N_16kernelEv__intern__b04fd23c98500190]](
-// CUDA-DAG: define weak_odr {{.*}}void @[[KERN2:_Z8tempKernIN12_GLOBAL__N_11XEEvT___intern__b04fd23c98500190]](
-// CUDA-DAG: define weak_odr {{.*}}void @[[KERN3:_Z8tempKernIN12_GLOBAL__N_1UlvE_EEvT___intern__b04fd23c98500190]](
-
-// COMMON-DAG: @[[STR1:.*]] = {{.*}} c"[[KERN1]]\00"
-// COMMON-DAG: @[[STR2:.*]] = {{.*}} c"[[KERN2]]\00"
-// COMMON-DAG: @[[STR3:.*]] = {{.*}} c"[[KERN3]]\00"
-
-// COMMON-DAG: call i32 @__{{.*}}RegisterFunction({{.*}}@[[STR1]]
-// COMMON-DAG: call i32 @__{{.*}}RegisterFunction({{.*}}@[[STR2]]
-// COMMON-DAG: call i32 @__{{.*}}RegisterFunction({{.*}}@[[STR3]]
-
-
-template 
-__global__ void tempKern(T x) {}
-
-namespace {
-  __global__ void kernel() {}
-  struct X {};
-  X x;
-  auto lambda = [](){};
-}
-
-void test() {
-  kernel<<<1, 1>>>();
-
-  tempKern<<<1, 1>>>(x);
-
-  tempKern<<<1, 1>>>(lambda);
-}
Index: clang/test/CodeGenCUDA/anon-ns.cu
===
--- /dev/null
+++ clang/test/CodeGenCUDA/anon-ns.cu
@@ -0,0 +1,97 @@
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -cuid=abc \
+// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++17 -fgpu-rdc \
+// RUN:   -emit-llvm -o - -x hip %s > %t.dev
+
+// RUN: %clang_cc1 -triple x86_64-gnu-linux -cuid=abc \
+// RUN:   -aux-triple amdgcn-amd-amdhsa -std=c++17 -fgpu-rdc \
+// RUN:   -emit-llvm -o - -x hip %s > %t.host
+
+// RUN: cat %t.dev %t.host | FileCheck -check-prefixes=HIP,COMMON %s
+// RUN: cat %t.dev %t.host | FileCheck -check-prefixes=COMNEG %s
+
+// RUN: echo "GPU binary" > %t.fatbin
+
+// RUN: %clang_cc1 -triple nvptx -fcuda-is-device -cuid=abc \
+// RUN:   -aux-triple x86_64-unknown-linux-gnu -std=c++17 -fgpu-rdc \
+// RUN:   -emit-llvm -o - %s > %t.dev
+
+// RUN: %clang_cc1 -triple x86_64-gnu-linux -cuid=abc \
+// RUN:   -aux-triple nvptx -std=c++17 -fgpu-rdc -fcuda-include-gpubinary %t.fatbin \
+// RUN:   -emit-llvm -o - %s > %t.host
+
+// RUN: cat %t.dev %t.host | FileCheck -check-prefixes=CUDA,COMMON %s
+// RUN: cat %t.dev %t.host | FileCheck -check-prefixes=COMNEG %s
+
+#include "Inputs/cuda.h"
+
+// HIP-DAG: define weak_odr {{.*}}void @[[KERN1:_ZN12_GLOBAL__N_16kernelEv\.intern\.b04fd23c98500190]](
+// HIP-DAG: define weak_odr {{.*}}void @[[KERN2:_Z8tempKernIN12_GLOBAL__N_11XEEvT_\.intern\.b04fd23c98500190]](
+// HIP-DAG: define weak_odr {{.*}}void @[[KERN3:_Z8tempKernIN12_GLOBAL__N_1UlvE_EEvT_\.intern\.b04fd23c98500190]](
+// HIP-DAG: @[[VAR1:_ZN12_GLOBAL__N_11AE\.static\.b04fd23c98500190]] = addrspace(1) externally_initialized global
+// HIP-DAG: @[[VAR2:_ZN12_GLOBAL__N_11BE\.static\.b04fd23c98500190]] = addrspace(4) externally_initialized global
+// HIP-DAG: @[[VAR3:_Z7tempVarIN12_GLOBAL__N_11XEE\.static\.b04fd23c98500190]] = addrspace(1) externally_initialized global
+
+// CUDA-DAG: define weak_odr {{.*}}void @[[KERN1:_ZN12_GLOBAL__N_16kernelEv__intern__b04fd23c98500190]](
+// CUDA-DAG: define weak_odr {{.*}}void @[[KERN2:_Z8tempKernIN12_GLOBAL__N_11XEEvT___intern__b04fd23c98500190]](
+// CU

[PATCH] D152169: [clang][analyzer] Add report of NULL stream to StreamChecker.

2023-06-05 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision.
steakhal added a comment.
This revision is now accepted and ready to land.

Ah yes, finally this sorts itself out.
We also had to revert 570bf972f5adf05438c7e08d693bf4b96bfd510a 
 because 
we use the Stream checker but not the StdLibFunc checker, so in our case after 
a rebase suddenly some important reports "disappeared", thus we reverted the 
cause.
As more and more patches came to the stdlibfunc checker, I worried about 
maintaining that revert. Finally, this patch will resolve it, so we don't have 
to do it ourselves.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152169/new/

https://reviews.llvm.org/D152169

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


[clang] 12728e1 - [C] Support _Generic expressions with a type operand

2023-06-05 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2023-06-05T11:09:58-04:00
New Revision: 12728e144994efe84715f4e5dbb8c3104e9f0b5a

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

LOG: [C] Support _Generic expressions with a type operand

_Generic accepts an expression operand whose type is matched against a
list of associations. The expression operand is unevaluated, but the
type matched is the type after lvalue conversion. This conversion loses
type information, which makes it more difficult to match against
qualified or incomplete types.

This extension allows _Generic to accept a type operand instead of an
expression operand. The type operand form does not undergo any
conversions and is matched directly against the association list.

This extension is also supported in C++ as we already supported
_Generic selection expressions there.

The RFC for this extension can be found at:
https://discourse.llvm.org/t/rfc-generic-selection-expression-with-a-type-operand/70388

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

Added: 
clang/test/Parser/generic-selection-type-extension-pedantic.c
clang/test/Parser/generic-selection-type-extension.c
clang/test/Sema/generic-selection-type-extension.c

Modified: 
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/ASTNodeTraverser.h
clang/include/clang/AST/Expr.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/Features.def
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/ComputeDependence.cpp
clang/lib/AST/Expr.cpp
clang/lib/AST/StmtPrinter.cpp
clang/lib/Analysis/ExprMutationAnalyzer.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Parse/ParseTentative.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaPseudoObject.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/Lexer/has_extension.c
clang/test/SemaCXX/generic-selection.cpp

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index ae93bb99c3527..b36f2f8e3e45f 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1377,6 +1377,17 @@ In C, type compatibility is decided according to the 
rules given in the
 appropriate standard, but in C++, which lacks the type compatibility rules used
 in C, types are considered compatible only if they are equivalent.
 
+Clang also supports an extended form of ``_Generic`` with a controlling type
+rather than a controlling expression. Unlike with a controlling expression, a
+controlling type argument does not undergo any conversions and thus is suitable
+for use when trying to match qualified types, incomplete types, or function
+types. Variable-length array types lack the necessary compile-time information
+to resolve which association they match with and thus are not allowed as a
+controlling type argument.
+
+Use ``__has_extension(c_generic_selection_with_controlling_type)`` to determine
+if support for this extension is enabled.
+
 C11 ``_Static_assert()``
 
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 69ab645d49c23..f1ac1cb79fe23 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -143,6 +143,17 @@ C Language Changes
   from a null pointer constant.
 - Fixed a bug that prevented casting to an ``_Atomic``-qualified type.
   (`#39596 `_)
+- Added an extension to ``_Generic`` which allows the first operand to be a
+  type rather than an expression. The type does not undergo any conversions,
+  which makes this feature suitable for matching qualified types, incomplete
+  types, and function or array types.
+
+  .. code-block:: c
+
+const int i = 12;
+_Generic(i, int : 0, const int : 1); // Warns about unreachable code, the
+ // result is 0, not 1.
+_Generic(typeof(i), int : 0, const int : 1); // Result is 1, not 0.
 
 C2x Feature Support
 ^^^

diff  --git a/clang/include/clang/AST/ASTNodeTraverser.h 
b/clang/include/clang/AST/ASTNodeTraverser.h
index 86a896740e910..35efb81bb522e 100644
--- a/clang/include/clang/AST/ASTNodeTraverser.h
+++ b/clang/include/clang/AST/ASTNodeTraverser.h
@@ -732,8 +732,11 @@ class ASTNodeTraverser
   }
 
   void VisitGenericSelectionExpr(const GenericSelectionExpr *E) {
-Visit(E->getControllingExpr());
-Visit(E->getControllingExpr()->getType()); 

[PATCH] D149904: Generic selection expressions that accept a type operand

2023-06-05 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG12728e144994: [C] Support _Generic expressions with a type 
operand (authored by aaron.ballman).

Changed prior to commit:
  https://reviews.llvm.org/D149904?vs=520338&id=528450#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149904/new/

https://reviews.llvm.org/D149904

Files:
  clang/docs/LanguageExtensions.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTNodeTraverser.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/Features.def
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/Analysis/ExprMutationAnalyzer.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/Lexer/has_extension.c
  clang/test/Parser/generic-selection-type-extension-pedantic.c
  clang/test/Parser/generic-selection-type-extension.c
  clang/test/Sema/generic-selection-type-extension.c
  clang/test/SemaCXX/generic-selection.cpp

Index: clang/test/SemaCXX/generic-selection.cpp
===
--- clang/test/SemaCXX/generic-selection.cpp
+++ clang/test/SemaCXX/generic-selection.cpp
@@ -3,7 +3,7 @@
 template 
 struct A {
   enum {
-id = _Generic(T(), // expected-error {{controlling expression type 'char' not compatible with any generic association type}}
+id = _Generic(T{}, // expected-error {{controlling expression type 'char' not compatible with any generic association type}}
 int: 1, // expected-note {{compatible type 'int' specified here}}
 float: 2,
 U: 3) // expected-error {{type 'int' in generic association compatible with previously specified type 'int'}}
@@ -20,7 +20,7 @@
 template 
 struct B {
   enum {
-id = _Generic(T(),
+id = _Generic(T{},
 int: 1, // expected-note {{compatible type 'int' specified here}}
 int: 2, // expected-error {{type 'int' in generic association compatible with previously specified type 'int'}}
 U: 3)
@@ -37,7 +37,7 @@
 
 template  struct TypeMask {
   enum {
-   result = Or<_Generic(Args(), int: 1, long: 2, short: 4, float: 8)...>::result
+   result = Or<_Generic(Args{}, int: 1, long: 2, short: 4, float: 8)...>::result
   };
 };
 
Index: clang/test/Sema/generic-selection-type-extension.c
===
--- /dev/null
+++ clang/test/Sema/generic-selection-type-extension.c
@@ -0,0 +1,136 @@
+// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify -Wno-unused %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused -x c++ %s
+
+// Test that the semantic behavior of the extension allowing the user to pass a
+// type as the first argument to _Generic.
+
+// Test that we match on basic types.
+static_assert(_Generic(int, int : 1, default : 0) == 1);
+static_assert(_Generic(_BitInt(12), int : 1, _BitInt(10) : 2, _BitInt(12) : 3) == 3);
+
+// Test that we correctly fall back to the default association appropriately.
+static_assert(_Generic(int, long : 1, default : 0) == 0);
+
+// Ensure we correctly match constant arrays by their extent.
+static_assert(_Generic(int[12], int[0] : 0, int * : 0, int[12] : 1, default : 0) == 1);
+
+// Ensure we correctly match function types by their signature.
+static_assert(_Generic(int(int), void(void) : 0, int(void) : 0, void(int) : 0, int(int) : 1, default : 0) == 1);
+
+// Test that we still diagnose when no associations match and that the
+// diagnostic includes qualifiers.
+static_assert(_Generic(const int, long : 1)); // expected-error {{controlling expression type 'const int' not compatible with any generic association type}}
+
+// Test that qualifiers work as expected and do not issue a diagnostic when
+// using the type form.
+static_assert(_Generic(const int, int : 0, const int : 1) == 1);
+static_assert(_Generic(int volatile _Atomic const, int : 0, const int : 0, volatile int : 0, _Atomic int : 0, _Atomic const volatile int : 1) == 1);
+
+// Test that inferred qualifiers also work as expected.
+const int ci = 0;
+static_assert(_Generic(__typeof__(ci), int : 0, const int : 1) == 1);
+// And that the expression form still complains about qualified associations
+// and matches the correct association.
+static_assert(_Generic(ci, int : 1, const int : 0) == 1); // expected-warning {{due to lvalue conversion of the controlling expression, association of ty

[PATCH] D152107: [NFC][CLANG] Fix nullptr dereference issue in checkSizelessVectorShift()

2023-06-05 Thread Soumi Manna via Phabricator via cfe-commits
Manna added a comment.

Thank you @erichkeane for reviews!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152107/new/

https://reviews.llvm.org/D152107

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


[clang] 3581e6b - [NFC][CLANG] Fix nullptr dereference issue in checkSizelessVectorShift()

2023-06-05 Thread via cfe-commits

Author: Manna, Soumi
Date: 2023-06-05T08:12:33-07:00
New Revision: 3581e6b857f44e397f61ddb35cb420347653f3ff

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

LOG: [NFC][CLANG] Fix nullptr dereference issue in checkSizelessVectorShift()

This patch uses castAs instead of getAs which will assert if the type doesn't 
match in checkSizelessVectorShift(clang::Sema &, 
clang::ActionResult &, clang::ActionResult &, clang::SourceLocation, bool).

Reviewed By: erichkeane

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

Added: 


Modified: 
clang/lib/Sema/SemaExpr.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 772580674f34b..d2062786302ff 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -12098,14 +12098,14 @@ static QualType checkSizelessVectorShift(Sema &S, 
ExprResult &LHS,
 return QualType();
 
   QualType LHSType = LHS.get()->getType();
-  const BuiltinType *LHSBuiltinTy = LHSType->getAs();
+  const BuiltinType *LHSBuiltinTy = LHSType->castAs();
   QualType LHSEleType = LHSType->isVLSTBuiltinType()
 ? LHSBuiltinTy->getSveEltType(S.getASTContext())
 : LHSType;
 
   // Note that RHS might not be a vector
   QualType RHSType = RHS.get()->getType();
-  const BuiltinType *RHSBuiltinTy = RHSType->getAs();
+  const BuiltinType *RHSBuiltinTy = RHSType->castAs();
   QualType RHSEleType = RHSType->isVLSTBuiltinType()
 ? RHSBuiltinTy->getSveEltType(S.getASTContext())
 : RHSType;



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


[PATCH] D152107: [NFC][CLANG] Fix nullptr dereference issue in checkSizelessVectorShift()

2023-06-05 Thread Soumi Manna via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3581e6b857f4: [NFC][CLANG] Fix nullptr dereference issue in 
checkSizelessVectorShift() (authored by Manna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152107/new/

https://reviews.llvm.org/D152107

Files:
  clang/lib/Sema/SemaExpr.cpp


Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -12098,14 +12098,14 @@
 return QualType();
 
   QualType LHSType = LHS.get()->getType();
-  const BuiltinType *LHSBuiltinTy = LHSType->getAs();
+  const BuiltinType *LHSBuiltinTy = LHSType->castAs();
   QualType LHSEleType = LHSType->isVLSTBuiltinType()
 ? LHSBuiltinTy->getSveEltType(S.getASTContext())
 : LHSType;
 
   // Note that RHS might not be a vector
   QualType RHSType = RHS.get()->getType();
-  const BuiltinType *RHSBuiltinTy = RHSType->getAs();
+  const BuiltinType *RHSBuiltinTy = RHSType->castAs();
   QualType RHSEleType = RHSType->isVLSTBuiltinType()
 ? RHSBuiltinTy->getSveEltType(S.getASTContext())
 : RHSType;


Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -12098,14 +12098,14 @@
 return QualType();
 
   QualType LHSType = LHS.get()->getType();
-  const BuiltinType *LHSBuiltinTy = LHSType->getAs();
+  const BuiltinType *LHSBuiltinTy = LHSType->castAs();
   QualType LHSEleType = LHSType->isVLSTBuiltinType()
 ? LHSBuiltinTy->getSveEltType(S.getASTContext())
 : LHSType;
 
   // Note that RHS might not be a vector
   QualType RHSType = RHS.get()->getType();
-  const BuiltinType *RHSBuiltinTy = RHSType->getAs();
+  const BuiltinType *RHSBuiltinTy = RHSType->castAs();
   QualType RHSEleType = RHSType->isVLSTBuiltinType()
 ? RHSBuiltinTy->getSveEltType(S.getASTContext())
 : RHSType;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151833: Respect "-fdiagnostics-absolute-paths" on emit include location

2023-06-05 Thread Charalampos Mitrodimas via Phabricator via cfe-commits
charmitro marked an inline comment as done.
charmitro added a comment.

In D151833#4395956 , @aaron.ballman 
wrote:

> Do you need someone to commit on your behalf? If so, what name and email 
> address would you like used for patch attribution?



In D151833#4395957 , @tbaeder wrote:

> @charmitro do you have commit rights or do you need someone to push on your 
> behalf?

I do not have commit rights, since I'm planning to contribute more often, I'd 
like commit access at some point. I can request it ASAP if needed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151833/new/

https://reviews.llvm.org/D151833

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


[PATCH] D151523: [ASTStructuralEquivalence] Fix crash when ObjCCategoryDecl doesn't have corresponding ObjCInterfaceDecl.

2023-06-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

In D151523#4374808 , @vsapsai wrote:

> Kinda a follow-up to D121176 .
>
> One big alternative that I've considered is to store interface name in 
> `ObjCCategoryDecl` because when we parse `@interface 
> InterfaceName(CategoryName)` we know the interface name. The intention was to 
> allow
>
>   @interface A(X) @end
>
> and
>
>   @interface A @end
>   @interface A(X) @end
>
> as equivalent. But I'm not convinced it is the right call and that's why it 
> doesn't justify the extra effort.

Are there any cases you are aware of where this change would fix a bug? In any 
case, it sounds like that is something that can be done as a follow-up patch 
after fixing the crash.




Comment at: clang/lib/AST/ASTStructuralEquivalence.cpp:2062
+  *Intf2 = D2->getClassInterface();
+  if ((Intf1 != nullptr) != (Intf2 != nullptr))
+return false;

vsapsai wrote:
> shafik wrote:
> > I think this would be easier to read if you checked `Intf1 != Intf2` and 
> > then checked for `nullptr`
> I am totally up to the style that is more readable and consistent. I was just 
> trying to mimic the check for `Template1` and `Template2`. I agree that 1 
> (**one**) datapoint isn't representative, so I can check this file more 
> thoroughly for the prevalent style. Do you have any other places in mind that 
> are worth checking? I'll look for something more representative but it would 
> help if you have something in mind already.
`!Intf1 != !Intf2` should work too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151523/new/

https://reviews.llvm.org/D151523

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


[clang-tools-extra] cd5fcea - [clangd] Revert to older include spelling approach.

2023-06-05 Thread Viktoriia Bakalova via cfe-commits

Author: Viktoriia Bakalova
Date: 2023-06-05T15:18:28Z
New Revision: cd5fcea6d4c70a7328ca9538c9098d9f5af69682

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

LOG: [clangd] Revert to older include spelling approach.

Added: 


Modified: 
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/IncludeCleaner.cpp
clang-tools-extra/clangd/IncludeCleaner.h

Removed: 




diff  --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index 80303267b31a0..d1f6f3a7b06c0 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -18,7 +18,6 @@
 #include "Selection.h"
 #include "SourceCode.h"
 #include "clang-include-cleaner/Analysis.h"
-#include "clang-include-cleaner/IncludeSpeller.h"
 #include "clang-include-cleaner/Types.h"
 #include "index/SymbolCollector.h"
 #include "support/Logger.h"
@@ -1223,9 +1222,7 @@ void maybeAddSymbolProviders(ParsedAST &AST, HoverInfo 
&HI,
 // on local variables, etc.
 return;
 
-  HI.Provider = include_cleaner::spellHeader(
-  {H, AST.getPreprocessor().getHeaderSearchInfo(),
-   SM.getFileEntryForID(SM.getMainFileID())});
+  HI.Provider = spellHeader(AST, SM.getFileEntryForID(SM.getMainFileID()), H);
 }
 
 // FIXME: similar functions are present in FindHeaders.cpp (symbolName)

diff  --git a/clang-tools-extra/clangd/IncludeCleaner.cpp 
b/clang-tools-extra/clangd/IncludeCleaner.cpp
index c9d32a00fc15f..fa30592e75807 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -198,9 +198,9 @@ std::vector generateMissingIncludeDiagnostics(
   continue;
 }
 
-std::string Spelling = include_cleaner::spellHeader(
-{SymbolWithMissingInclude.Providers.front(),
- AST.getPreprocessor().getHeaderSearchInfo(), MainFile});
+std::string Spelling =
+spellHeader(AST, MainFile, SymbolWithMissingInclude.Providers.front());
+
 llvm::StringRef HeaderRef{Spelling};
 bool Angled = HeaderRef.starts_with("<");
 // We might suggest insertion of an existing include in edge cases, e.g.,
@@ -334,6 +334,22 @@ convertIncludes(const SourceManager &SM,
   return ConvertedIncludes;
 }
 
+std::string spellHeader(ParsedAST &AST, const FileEntry *MainFile,
+include_cleaner::Header Provider) {
+  if (Provider.kind() == include_cleaner::Header::Physical) {
+if (auto CanonicalPath =
+getCanonicalPath(Provider.physical()->getLastRef(),
+ AST.getSourceManager().getFileManager())) {
+  std::string SpelledHeader =
+  llvm::cantFail(URI::includeSpelling(URI::create(*CanonicalPath)));
+  if (!SpelledHeader.empty())
+return SpelledHeader;
+}
+  }
+  return include_cleaner::spellHeader(
+  {Provider, AST.getPreprocessor().getHeaderSearchInfo(), MainFile});
+}
+
 std::vector
 getUnused(ParsedAST &AST,
   const llvm::DenseSet &ReferencedFiles,

diff  --git a/clang-tools-extra/clangd/IncludeCleaner.h 
b/clang-tools-extra/clangd/IncludeCleaner.h
index c4051b30ca317..675c05a53d5f8 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.h
+++ b/clang-tools-extra/clangd/IncludeCleaner.h
@@ -74,6 +74,11 @@ include_cleaner::Includes
 convertIncludes(const SourceManager &SM,
 const llvm::ArrayRef Includes);
 
+/// Determines the header spelling of an include-cleaner header
+/// representation. The spelling contains the ""<> characters.
+std::string spellHeader(ParsedAST &AST, const FileEntry *MainFile,
+include_cleaner::Header Provider);
+
 std::vector
 collectMacroReferences(ParsedAST &AST);
 



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


[PATCH] D152169: [clang][analyzer] Add report of NULL stream to StreamChecker.

2023-06-05 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments.



Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:553
   HelpText<"Check stream handling functions">,
+  WeakDependencies<[NonNullParamChecker]>,
   Documentation;

What's the purpose of this hunk?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152169/new/

https://reviews.llvm.org/D152169

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


  1   2   3   >