[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2021-01-02 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

Turns out the `true/true` bug goes quite deep. I've managed to resolve the 
first bit of it with a hack that I'm sure will warrant some criticism, but I 
haven't familiarised myself with this codebase enough to write a cleaner 
version.

The second issue I'm still resolving. I'll expand on what's going on with this 
bug once I push a revision.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D93817: Update transformations to use poison for insertelement/shufflevector's placeholder value

2021-01-02 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added a comment.

I'll split this patch into smaller pieces, so they're able to get reviewed more 
easily.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93817

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2021-01-02 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

After writing a unit test, I've found that a combination of `AfterEnum: true` 
and `AllowShortEnumsOnASingleLine: true` doesn't function properly. My next 
revision will include a fix for that alongside the unit test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D92936: [Sema] Fix deleted function problem in implicitly movable test

2021-01-02 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added a comment.

Something is not initialized 
tihttp://lab.llvm.org:8011/#/builders/74/builds/1834/steps/9/logs/stdio


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92936

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


[PATCH] D93979: [clang-tidy] Fix windows tests

2021-01-02 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

I don't have a (reliable) windows machine to test so can you take a look please


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93979

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


[PATCH] D93979: [clang-tidy] Fix windows tests

2021-01-02 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added a reviewer: thakis.
Herald added subscribers: kbarton, xazax.hun, nemanjai.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Attempt to fix the 2 failing tests identifier in 48646.
Appears that python3 doesn't like nested double quotes in single quoted 
strings, hopefully nested single quotes in double quoted strings is a-ok.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93979

Files:
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
@@ -1,15 +1,12 @@
-// FIXME: PR48646
-// UNSUPPORTED: system-windows
-
 // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
-// RUN:   -config='{CheckOptions: [ \
+// RUN:   -config="{CheckOptions: [ \
 // RUN: {key: readability-identifier-naming.ParameterCase, value: 
CamelCase}, \
-// RUN: {key: readability-identifier-naming.ParameterIgnoredRegexp, value: 
"^[a-z]{1,2}$"}, \
+// RUN: {key: readability-identifier-naming.ParameterIgnoredRegexp, value: 
'^[a-z]{1,2}$'}, \
 // RUN: {key: readability-identifier-naming.ClassCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ClassIgnoredRegexp, value: 
"^fo$|^fooo$"}, \
+// RUN: {key: readability-identifier-naming.ClassIgnoredRegexp, value: 
'^fo$|^fooo$'}, \
 // RUN: {key: readability-identifier-naming.StructCase, value: CamelCase}, 
\
-// RUN: {key: readability-identifier-naming.StructIgnoredRegexp, value: 
"sooo|so|soo|$invalidregex["} \
-// RUN:  ]}'
+// RUN: {key: readability-identifier-naming.StructIgnoredRegexp, value: 
'sooo|so|soo|$invalidregex['} \
+// RUN:  ]}"
 
 int testFunc(int a, char **b);
 int testFunc(int ab, char **ba);
Index: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
@@ -1,9 +1,6 @@
-// FIXME: PR48646
-// UNSUPPORTED: system-windows
-
 // RUN: %check_clang_tidy %s cppcoreguidelines-macro-usage %t \
-// RUN: -config='{CheckOptions: \
-// RUN:  [{key: cppcoreguidelines-macro-usage.AllowedRegexp, value: 
"DEBUG_*|TEST_*"}]}' --
+// RUN: -config="{CheckOptions: \
+// RUN:  [{key: cppcoreguidelines-macro-usage.AllowedRegexp, value: 
'DEBUG_*|TEST_*'}]}" --
 
 #ifndef INCLUDE_GUARD
 #define INCLUDE_GUARD


Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
@@ -1,15 +1,12 @@
-// FIXME: PR48646
-// UNSUPPORTED: system-windows
-
 // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
-// RUN:   -config='{CheckOptions: [ \
+// RUN:   -config="{CheckOptions: [ \
 // RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ParameterIgnoredRegexp, value: "^[a-z]{1,2}$"}, \
+// RUN: {key: readability-identifier-naming.ParameterIgnoredRegexp, value: '^[a-z]{1,2}$'}, \
 // RUN: {key: readability-identifier-naming.ClassCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ClassIgnoredRegexp, value: "^fo$|^fooo$"}, \
+// RUN: {key: readability-identifier-naming.ClassIgnoredRegexp, value: '^fo$|^fooo$'}, \
 // RUN: {key: readability-identifier-naming.StructCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.StructIgnoredRegexp, value: "sooo|so|soo|$invalidregex["} \
-// RUN:  ]}'
+// RUN: {key: readability-identifier-naming.StructIgnoredRegexp, value: 'sooo|so|soo|$invalidregex['} \
+// RUN:  ]}"
 
 int testFunc(int a, char **b);
 int testFunc(int ab, char **ba);
Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
@@ -1,9 +1,6 @@
-// FIXME: PR48646
-// UNSUPPORTED: system-windows
-
 // RUN: %check_clang_tidy %s 

[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2021-01-02 Thread Hongtao Yu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG01f0d162d672: Moving UniqueInternalLinkageNamesPass to the 
start of IR pipelines. (authored by hoy).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93656

Files:
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/test/Other/new-pm-pseudo-probe.ll
  llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -134,6 +134,13 @@
 static cl::opt DebugInfoForProfiling(
 "new-pm-debug-info-for-profiling", cl::init(false), cl::Hidden,
 cl::desc("Emit special debug info to enable PGO profile generation."));
+static cl::opt PseudoProbeForProfiling(
+"new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
+cl::desc("Emit pseudo probes to enable PGO profile generation."));
+static cl::opt UniqueInternalLinkageNames(
+"new-pm-unique-internal-linkage-names", cl::init(false), cl::Hidden,
+cl::desc("Uniqueify Internal Linkage Symbol Names by appending the MD5 "
+ "hash of the module path."));
 /// @}}
 
 template 
@@ -247,6 +254,9 @@
 if (DebugInfoForProfiling)
   P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
  true);
+else if (PseudoProbeForProfiling)
+  P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
+ false, true);
 else
   P = None;
   }
@@ -282,6 +292,7 @@
   // option has been enabled.
   PTO.LoopUnrolling = !DisableLoopUnrolling;
   PTO.Coroutines = Coroutines;
+  PTO.UniqueLinkageNames = UniqueInternalLinkageNames;
   PassBuilder PB(DebugPM, TM, PTO, P, );
   registerEPCallbacks(PB);
 
Index: llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
===
--- /dev/null
+++ llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
@@ -0,0 +1,24 @@
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O0 --check-prefix=UNIQUE
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+
+define internal i32 @foo() {
+entry:
+  ret i32 0
+}
+
+define dso_local i32 (...)* @bar() {
+entry:
+  ret i32 (...)* bitcast (i32 ()* @foo to i32 (...)*)
+}
+
+; O0: Running pass: UniqueInternalLinkageNamesPass
+
+;; Check UniqueInternalLinkageNamesPass is scheduled before SampleProfileProbePass.
+; O2: Running pass: UniqueInternalLinkageNamesPass
+; O2: Running pass: SampleProfileProbePass
+
+; UNIQUE: define internal i32 @foo.__uniq.{{[0-9a-f]+}}()
+; UNIQUE: ret {{.*}} @foo.__uniq.{{[0-9a-f]+}} {{.*}}
Index: llvm/test/Other/new-pm-pseudo-probe.ll
===
--- /dev/null
+++ llvm/test/Other/new-pm-pseudo-probe.ll
@@ -0,0 +1,12 @@
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+
+define void @foo() {
+  ret void
+}
+
+;; Check the SampleProfileProbePass is enabled under the -new-pm-pseudo-probe-for-profiling switch.
+;; The switch can be used to test a specific pass order in a particular setup, e.g, in unique-internal-linkage-names.ll
+; CHECK: Running pass: SampleProfileProbePass
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -285,6 +285,7 @@
   LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
   CallGraphProfile = 

[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2021-01-02 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

> This seems to be that in "Attach" mode, then 
> AllowShortEnumsOnASingleLine=false doesn't attach the brace.

That is correct, but the main issue is that `AfterEnum: false`, which Attach 
mode implies, doesn't function correctly.

> Said all that, it *seems* to me that the fix is correct apart from the 
> strangely looking if (!Style.isCpp()) { change that I don't really 
> understand. Why should C++ be handled differently in this regard? What am I 
> missing?

That code was there before. Here is the code currently in release:

  case tok::kw_enum:
// Ignore if this is part of "template is(tok::less)) {
  nextToken();
  break;
}
  
// parseEnum falls through and does not yet add an unwrapped line as an
// enum definition can start a structural element.
if (!parseEnum())
  break;
// This only applies for C++.
if (!Style.isCpp()) {
  addUnwrappedLine();
  return;
}
break;

I modified this code in an attempt to fix this bug, but that broke styling in 
other languages. It turns out this section required no modification. The only 
changes my revisions at present introduce is the change for the unit test and 
the modification of the following function:

  static bool ShouldBreakBeforeBrace(const FormatStyle ,
 const FormatToken ) {
if (InitialToken.isOneOf(tok::kw_namespace, TT_NamespaceMacro))
  return Style.BraceWrapping.AfterNamespace;
if (InitialToken.is(tok::kw_class))
  return Style.BraceWrapping.AfterClass;
if (InitialToken.is(tok::kw_union))
  return Style.BraceWrapping.AfterUnion;
if (InitialToken.is(tok::kw_struct))// NEW
  return Style.BraceWrapping.AfterStruct;   // NEW
return false;
  }

I can add some unit tests for the variations of `AllowShortEnumsOnASingleLine` 
and `AfterEnum`.

If there's anything I can explain better please let me know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D93747: Rename debug linkage name with -funique-internal-linkage-names

2021-01-02 Thread Hongtao Yu via Phabricator via cfe-commits
hoy added a comment.

In D93747#2475852 , @dblaikie wrote:

> In D93747#2470504 , @hoy wrote:
>
>> In D93747#2470387 , @dblaikie wrote:
>>
>>> Please remove the clang test change - if this is an LLVM change with LLVM 
>>> test coverage, that's enough. (we don't generally test every LLVM change 
>>> from both LLVM and Clang)
>>
>> Sounds good.
>>
>>> I'd still be curious if you could look around to see whether there are 
>>> other cases of function splitting/cloning/etc to see how they deal with 
>>> updating the DISubprograms, to see if there's some prior art that should be 
>>> used here.
>>
>> To the best of my knowledge, existing code does not change the linkage name 
>> field of a DISubprogram once created. You can create a new DISubprogram 
>> record with any linkage name you want but bear in mind how the debugger will 
>> consume the record. Looks like we are the first one to change existing 
>> record which will confuse the debugger.
>
> Sure enough - do any other transforms have similar requirements (of creating 
> a record for something that looks like the same function but isn't quite) but 
> take a different approach? Be good to know if other approaches were 
> chosen/how/why they are applicable there but not here, etc. (conversely 
> perhaps other passes worked around the issue in less than ideal ways and 
> could benefit from using this new approach).
>
> Looks like some places that could use this functionality aren't quite there 
> yet - 
> The Attributor has an internalizing feature (added in 
> 87a85f3d57f55f5652ec44f77816c7c9457545fa 
>  ) that 
> produces invalid IR (ends up with two !dbg attachments of the same 
> DISubprogram) if the function it's internalizing has a DISubprogram - but if 
> it succeeded it'd have the same problem that the linkage name on the 
> DISubprogram wouldn't match the actual symbol/function name. (@jdoerfert 
> @bbn).
> The IR Outliner (@AndrewLitteken ) seems to be only a few months old and 
> appears to have no debug info handling - probably results in the same problem.
> The Partial Inliner does clone a function into a new name & so would have an 
> invalid DISubprogram, though it only uses the clone for inlining (this 
> probably then goes on to produce the desired debug info, where the inlining 
> appears to come from the original function)
> ThinLTO does some function cloning within a module for aliases, but it then 
> renames the clone to the aliasees name so I think the name works out to match 
> again.
>
> If this is an invariant, that the linkage name on the DISubprogram should 
> match the actual llvm::Function name (@aprantl @JDevlieghere - verifier 
> check, perhaps?) - it'd be nice to make that more reliable, either by 
> removing the name and relying on the llvm::Function name (perhaps with a 
> boolean on the DISubprogram as to whether the linkage name should be emitted 
> or not - I think currently Clang's IRGen makes choices about which 
> DISubprograms will get linkage names) or a verifier and utilities to keep 
> them in sync.
>
> But I'll leave that alone for now/for this review, unless someone else wants 
> to chime in on it.
>
> In D93747#2470178 , @tmsriram wrote:
>
>> In D93747#2469556 , @hoy wrote:
>>
 In D93656 , @dblaikie wrote:
 Though the C case is interesting - it means you'll end up with C functions 
 with the same DWARF 'name' but different linkage name. I don't know what 
 that'll do to DWARF consumers - I guess they'll probably be OK-ish with 
 it, as much as they are with C++ overloading. I think there are some cases 
 of C name mangling so it's probably supported/OK-ish with DWARF Consumers. 
 Wouldn't hurt for you to take a look/see what happens in that case with a 
 debugger like gdb/check other cases of C name mangling to see what DWARF 
 they end up creating (with both GCC and Clang).
>>>
>>> I did a quick experiment with C name managing with GCC and -flto. It turns 
>>> out the `DW_AT_linkage_name` field of `DW_TAG_subprogram` is never set for 
>>> C programs. If set, the gdb debugger will use that field to match the user 
>>> input and set breakpoints. Therefore, giving `DW_AT_linkage_name` a 
>>> uniquefied name prevents the debugger from setting a breakpoint based on 
>>> source names unless the user specifies a decorated name.
>>>
>>> Hence, this approach sounds like a workaround for us when the profile 
>>> quality matters more than debugging experience. I'm inclined to have it 
>>> under a switch. What do you think?
>>
>> Just a thought, we could always check if rawLinkageName is set and only set 
>> it when it is not null.  That seems safe without needing the option. Not a 

[PATCH] D93747: Rename debug linkage name with -funique-internal-linkage-names

2021-01-02 Thread Hongtao Yu via Phabricator via cfe-commits
hoy updated this revision to Diff 314259.
hoy added a comment.

Adding a switch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93747

Files:
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
  llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll

Index: llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
===
--- llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
+++ llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
@@ -3,8 +3,10 @@
 ; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
 ; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
 ; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes=unique-internal-linkage-names -unqiue-debug-linkage-names=0 < %s -o - | FileCheck %s --check-prefix=NODBG
+; RUN: opt -S -passes=unique-internal-linkage-names < %s -o - | FileCheck %s --check-prefix=DBG
 
-define internal i32 @foo() {
+define internal i32 @foo() !dbg !15 {
 entry:
   ret i32 0
 }
@@ -14,6 +16,25 @@
   ret i32 (...)* bitcast (i32 ()* @foo to i32 (...)*)
 }
 
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, enums: !2)
+!1 = !DIFile(filename: "test.c", directory: "")
+!2 = !{}
+!3 = !{i32 7, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!8 = !DISubroutineType(types: !9)
+!9 = !{!10}
+!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
+!11 = !DISubroutineType(types: !12)
+!12 = !{!13, null}
+!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!15 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !16, scopeLine: 5, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!16 = !DISubroutineType(types: !17)
+!17 = !{!13}
+
 ; O0: Running pass: UniqueInternalLinkageNamesPass
 
 ;; Check UniqueInternalLinkageNamesPass is scheduled before SampleProfileProbePass.
@@ -22,3 +43,6 @@
 
 ; UNIQUE: define internal i32 @foo.__uniq.{{[0-9a-f]+}}()
 ; UNIQUE: ret {{.*}} @foo.__uniq.{{[0-9a-f]+}} {{.*}}
+
+; NODBG: distinct !DISubprogram(name: "foo", scope: ![[#]]
+; DBG: distinct !DISubprogram(name: "foo", linkageName: "foo.__uniq.{{[0-9a-f]+}}", scope: ![[#]]
Index: llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
===
--- llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
+++ llvm/lib/Transforms/Utils/UniqueInternalLinkageNames.cpp
@@ -13,13 +13,21 @@
 
 #include "llvm/Transforms/Utils/UniqueInternalLinkageNames.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/IR/DebugInfoMetadata.h"
+#include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 
 using namespace llvm;
 
+static cl::opt
+UniqueDebugLinakgeNames("unqiue-debug-linkage-names", cl::init(true),
+cl::Hidden,
+cl::desc("Uniqueify debug linkage Names"));
+
 static bool uniqueifyInternalLinkageNames(Module ) {
   llvm::MD5 Md5;
   Md5.update(M.getSourceFileName());
@@ -31,11 +39,18 @@
   // this symbol is of internal linkage type.
   std::string ModuleNameHash = (Twine(".__uniq.") + Twine(Str)).str();
   bool Changed = false;
+  MDBuilder MDB(M.getContext());
 
   // Append the module hash to all internal linkage functions.
   for (auto  : M) {
 if (F.hasInternalLinkage()) {
   F.setName(F.getName() + ModuleNameHash);
+  if (UniqueDebugLinakgeNames) {
+if (DISubprogram *SP = F.getSubprogram()) {
+  auto *Name = MDB.createString(F.getName());
+  SP->replaceRawLinkageName(Name);
+}
+  }
   Changed = true;
 }
   }
Index: llvm/include/llvm/IR/DebugInfoMetadata.h
===
--- llvm/include/llvm/IR/DebugInfoMetadata.h
+++ llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -2053,6 +2053,10 @@
 return getNumOperands() > 10 ? getOperandAs(10) : nullptr;
   }
 
+  void replaceRawLinkageName(MDString *LinkageName) {
+replaceOperandWith(3, LinkageName);
+  }
+
   /// Check if this subprogram describes the given function.
   

[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2021-01-02 Thread Hongtao Yu via Phabricator via cfe-commits
hoy updated this revision to Diff 314257.
hoy added a comment.

Addressing comments from dblaikie.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93656

Files:
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/test/Other/new-pm-pseudo-probe.ll
  llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -134,6 +134,13 @@
 static cl::opt DebugInfoForProfiling(
 "new-pm-debug-info-for-profiling", cl::init(false), cl::Hidden,
 cl::desc("Emit special debug info to enable PGO profile generation."));
+static cl::opt PseudoProbeForProfiling(
+"new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
+cl::desc("Emit pseudo probes to enable PGO profile generation."));
+static cl::opt UniqueInternalLinkageNames(
+"new-pm-unique-internal-linkage-names", cl::init(false), cl::Hidden,
+cl::desc("Uniqueify Internal Linkage Symbol Names by appending the MD5 "
+ "hash of the module path."));
 /// @}}
 
 template 
@@ -247,6 +254,9 @@
 if (DebugInfoForProfiling)
   P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
  true);
+else if (PseudoProbeForProfiling)
+  P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
+ false, true);
 else
   P = None;
   }
@@ -282,6 +292,7 @@
   // option has been enabled.
   PTO.LoopUnrolling = !DisableLoopUnrolling;
   PTO.Coroutines = Coroutines;
+  PTO.UniqueLinkageNames = UniqueInternalLinkageNames;
   PassBuilder PB(DebugPM, TM, PTO, P, );
   registerEPCallbacks(PB);
 
Index: llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
===
--- /dev/null
+++ llvm/test/Transforms/UniqueLinkageNames/unique-internal-linkage-names.ll
@@ -0,0 +1,24 @@
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O0 --check-prefix=UNIQUE
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -new-pm-unique-internal-linkage-names -debug-pass-manager < %s 2>&1 | FileCheck %s --check-prefix=O2 --check-prefix=UNIQUE
+
+define internal i32 @foo() {
+entry:
+  ret i32 0
+}
+
+define dso_local i32 (...)* @bar() {
+entry:
+  ret i32 (...)* bitcast (i32 ()* @foo to i32 (...)*)
+}
+
+; O0: Running pass: UniqueInternalLinkageNamesPass
+
+;; Check UniqueInternalLinkageNamesPass is scheduled before SampleProfileProbePass.
+; O2: Running pass: UniqueInternalLinkageNamesPass
+; O2: Running pass: SampleProfileProbePass
+
+; UNIQUE: define internal i32 @foo.__uniq.{{[0-9a-f]+}}()
+; UNIQUE: ret {{.*}} @foo.__uniq.{{[0-9a-f]+}} {{.*}}
Index: llvm/test/Other/new-pm-pseudo-probe.ll
===
--- /dev/null
+++ llvm/test/Other/new-pm-pseudo-probe.ll
@@ -0,0 +1,12 @@
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='default' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+; RUN: opt -S -passes='thinlto-pre-link' -new-pm-pseudo-probe-for-profiling -debug-pass-manager < %s 2>&1 | FileCheck %s
+
+define void @foo() {
+  ret void
+}
+
+;; Check the SampleProfileProbePass is enabled under the -new-pm-pseudo-probe-for-profiling switch.
+;; The switch can be used to test a specific pass order in a particular setup, e.g, in unique-internal-linkage-names.ll
+; CHECK: Running pass: SampleProfileProbePass
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -285,6 +285,7 @@
   LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
   CallGraphProfile = true;
   MergeFunctions = false;
+  UniqueLinkageNames = false;
 }
 
 extern cl::opt 

[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2021-01-02 Thread Hongtao Yu via Phabricator via cfe-commits
hoy added a comment.

In D93656#2475856 , @dblaikie wrote:

> Looks good - test cases might benefit from some descriptive comments 
> (explaining why the pseudo probe pass needs to be enabled to test the unique 
> linkage name pass - I guess to check that it appears in just the right place 
> in the pass pipeline?)

Comments added. Thanks for reviewing the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93656

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


[clang-tools-extra] 7af6a13 - [NFC] Switch up some dyn_cast calls

2021-01-02 Thread Nathan James via cfe-commits

Author: Nathan James
Date: 2021-01-02T19:56:27Z
New Revision: 7af6a134508cd1c7f75c6e3441ce436f220f30a4

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

LOG: [NFC] Switch up some dyn_cast calls

Added: 


Modified: 
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/DumpAST.cpp
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/AST.cpp 
b/clang-tools-extra/clangd/AST.cpp
index c5f87af86319..39ab48843b28 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -367,7 +367,7 @@ class DeducedTypeVisitor : public 
RecursiveASTVisitor {
 // Loc of auto in return type (c++14).
 auto CurLoc = D->getReturnTypeSourceRange().getBegin();
 // Loc of "auto" in operator auto()
-if (CurLoc.isInvalid() && dyn_cast(D))
+if (CurLoc.isInvalid() && isa(D))
   CurLoc = D->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
 // Loc of "auto" in function with trailing return type (c++11).
 if (CurLoc.isInvalid())

diff  --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 12698b42ef3e..588bcfcf2424 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -242,9 +242,8 @@ class DumpVisitor : public RecursiveASTVisitor 
{
 return "const";
   return "";
 }
-if (isa(S) || isa(S) ||
-isa(S) || isa(S) ||
-isa(S) || isa(S))
+if (isa(S))
   return toString([&](raw_ostream ) {
 S->printPretty(OS, nullptr, Ctx.getPrintingPolicy());
   });

diff  --git a/clang-tools-extra/clangd/FindTarget.cpp 
b/clang-tools-extra/clangd/FindTarget.cpp
index 3afd65522680..9a502a84e36f 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -843,7 +843,7 @@ llvm::SmallVector refInStmt(const Stmt *S) {
 void VisitMemberExpr(const MemberExpr *E) {
   // Skip destructor calls to avoid duplication: TypeLoc within will be
   // visited separately.
-  if (llvm::dyn_cast(E->getFoundDecl().getDecl()))
+  if (llvm::isa(E->getFoundDecl().getDecl()))
 return;
   Refs.push_back(ReferenceLoc{E->getQualifierLoc(),
   E->getMemberNameInfo().getLoc(),

diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp 
b/clang-tools-extra/clangd/refactor/Rename.cpp
index 8ed5811c88b2..d3c7da96a441 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -119,7 +119,7 @@ const NamedDecl *canonicalRenameDecl(const NamedDecl *D) {
 // declaration.
 while (Method->isVirtual() && Method->size_overridden_methods())
   Method = *Method->overridden_methods().begin();
-return dyn_cast(Method->getCanonicalDecl());
+return Method->getCanonicalDecl();
   }
   if (const auto *Function = dyn_cast(D))
 if (const FunctionTemplateDecl *Template = Function->getPrimaryTemplate())

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
index c214695c5f07..cb87cc764bc3 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
@@ -111,7 +111,7 @@ Expected ExpandAutoType::apply(const 
Selection& Inputs) {
 
   // if it's a lambda expression, return an error message
   if (isa(*DeducedType) &&
-  dyn_cast(*DeducedType)->getDecl()->isLambda()) {
+  cast(*DeducedType)->getDecl()->isLambda()) {
 return error("Could not expand type of lambda expression");
   }
 

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
index bcf9bbe00f7c..c603861c3d69 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
@@ -79,7 +79,7 @@ computeReferencedDecls(const clang::Expr *Expr) {
 }
   };
   FindDeclRefsVisitor Visitor;
-  Visitor.TraverseStmt(const_cast(dyn_cast(Expr)));
+  Visitor.TraverseStmt(const_cast(cast(Expr)));
   return Visitor.ReferencedDecls;
 }
 

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
index 25fab244e30c..35d8605d 100644
--- 

[clang] 4c77a0f - [PowerPC] NFC: Apply minor clang-format fix

2021-01-02 Thread Brandon Bergren via cfe-commits

Author: Brandon Bergren
Date: 2021-01-02T12:21:28-06:00
New Revision: 4c77a0f1ce6f950805f567ff6505f7c18e62e288

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

LOG: [PowerPC] NFC: Apply minor clang-format fix

Added: 


Modified: 
clang/lib/Driver/ToolChains/Linux.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Linux.cpp 
b/clang/lib/Driver/ToolChains/Linux.cpp
index 74d4c245aa74..9663a7390ada 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -198,8 +198,7 @@ static StringRef getOSLibDir(const llvm::Triple , 
const ArgList ) {
   // FIXME: This is a bit of a hack. We should really unify this code for
   // reasoning about oslibdir spellings with the lib dir spellings in the
   // GCCInstallationDetector, but that is a more significant refactoring.
-  if (Triple.getArch() == llvm::Triple::x86 ||
-  Triple.isPPC32() ||
+  if (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() ||
   Triple.getArch() == llvm::Triple::sparc)
 return "lib32";
 



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


[PATCH] D93919: [PowerPC] Support powerpcle target in Clang [3/5]

2021-01-02 Thread Brandon Bergren 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 rG6cee9d0cf896: [PowerPC] Support powerpcle target in Clang 
[3/5] (authored by Bdragon28).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93919

Files:
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/altivec.c
  clang/test/CodeGen/builtins-ppc-altivec.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/target-data.c
  clang/test/Driver/linux-header-search.cpp
  clang/test/Driver/ppc-endian.c
  clang/test/Driver/ppc-features.cpp

Index: clang/test/Driver/ppc-features.cpp
===
--- clang/test/Driver/ppc-features.cpp
+++ clang/test/Driver/ppc-features.cpp
@@ -1,9 +1,15 @@
 /// Check default CC1 and linker options for ppc32.
-// RUN: %clang -### -target powerpc-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefix=PPC32 %s
+// RUN: %clang -### -target powerpcle-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32LELNX %s
+// RUN: %clang -### -target powerpc-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32BELNX %s
+// RUN: %clang -### -target powerpcle-unknown-freebsd13.0 %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32LEFBSD %s
+// RUN: %clang -### -target powerpc-unknown-freebsd13.0 %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32BEFBSD %s
 // PPC32:  "-munwind-tables"
 // PPC32-SAME: "-mfloat-abi" "hard"
 
-// PPC32: "-m" "elf32ppclinux"
+// PPC32LELNX-NEXT: "-m" "elf32lppclinux"
+// PPC32BELNX-NEXT: "-m" "elf32ppclinux"
+// PPC32LEFBSD-NEXT: "-m" "elf32lppc"
+// PPC32BEFBSD-NEXT: "-m" "elf32ppc_fbsd"
 
 // check -msoft-float option for ppc32
 // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s
Index: clang/test/Driver/ppc-endian.c
===
--- clang/test/Driver/ppc-endian.c
+++ clang/test/Driver/ppc-endian.c
@@ -1,9 +1,19 @@
-// RUN: %clang -target powerpc64le -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s
-// RUN: %clang -target powerpc64le -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s
-// RUN: %clang -target powerpc64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s
-// CHECK-LE: "-cc1"{{.*}} "-triple" "powerpc64le{{.*}}"
+// RUN: %clang -target powerpc-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE32 %s
+// RUN: %clang -target powerpc-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE32 %s
+// RUN: %clang -target powerpcle-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE32 %s
+// CHECK-BE32: "-cc1"{{.*}} "-triple" "powerpc-{{.*}}"
 
-// RUN: %clang -target powerpc64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s
-// RUN: %clang -target powerpc64 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s
-// RUN: %clang -target powerpc64le -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s
-// CHECK-BE: "-cc1"{{.*}} "-triple" "powerpc64{{.*}}"
+// RUN: %clang -target powerpcle-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE32 %s
+// RUN: %clang -target powerpcle-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE32 %s
+// RUN: %clang -target powerpc-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE32 %s
+// CHECK-LE32: "-cc1"{{.*}} "-triple" "powerpcle-{{.*}}"
+
+// RUN: %clang -target powerpc64-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE64 %s
+// RUN: %clang -target powerpc64-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE64 %s
+// RUN: %clang -target powerpc64le-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE64 %s
+// CHECK-BE64: "-cc1"{{.*}} "-triple" "powerpc64-{{.*}}"
+
+// RUN: %clang -target powerpc64le-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE64 %s
+// RUN: %clang -target powerpc64le-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE64 %s
+// RUN: %clang -target powerpc64-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE64 %s
+// CHECK-LE64: "-cc1"{{.*}} "-triple" "powerpc64le-{{.*}}"
Index: clang/test/Driver/linux-header-search.cpp

[clang] 2288319 - [PowerPC] Enable OpenMP for powerpcle target. [5/5]

2021-01-02 Thread Brandon Bergren via cfe-commits

Author: Brandon Bergren
Date: 2021-01-02T12:18:07-06:00
New Revision: 2288319733cd5f525bf7e24dece08bfcf9d0ff9e

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

LOG: [PowerPC] Enable OpenMP for powerpcle target. [5/5]

Enable OpenMP for powerpcle to match the rest of powerpc*.

Update tests.

Reviewed By: MaskRay

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

Added: 


Modified: 
clang/test/Driver/ppc-features.cpp
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPContext.cpp

Removed: 




diff  --git a/clang/test/Driver/ppc-features.cpp 
b/clang/test/Driver/ppc-features.cpp
index df0b6c6ddc13..05d71b95dba7 100644
--- a/clang/test/Driver/ppc-features.cpp
+++ b/clang/test/Driver/ppc-features.cpp
@@ -167,6 +167,7 @@
 
 // OpenMP features
 // RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
+// RUN: %clang -target powerpcle-unknown-linux-gnu %s -### -fopenmp=libomp -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -fopenmp=libomp 
-o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
 // CHECK_OPENMP_TLS-NOT: "-fnoopenmp-use-tls"

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def 
b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
index 6d0db8f5f57f..0cb29b245c97 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -1033,6 +1033,7 @@ __OMP_TRAIT_PROPERTY(device, arch, aarch64)
 __OMP_TRAIT_PROPERTY(device, arch, aarch64_be)
 __OMP_TRAIT_PROPERTY(device, arch, aarch64_32)
 __OMP_TRAIT_PROPERTY(device, arch, ppc)
+__OMP_TRAIT_PROPERTY(device, arch, ppcle)
 __OMP_TRAIT_PROPERTY(device, arch, ppc64)
 __OMP_TRAIT_PROPERTY(device, arch, ppc64le)
 __OMP_TRAIT_PROPERTY(device, arch, x86)

diff  --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp 
b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
index 56a6e2b08bd9..e252c964e647 100644
--- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -40,6 +40,7 @@ OMPContext::OMPContext(bool IsDeviceCompilation, Triple 
TargetTriple) {
   case Triple::mips64:
   case Triple::mips64el:
   case Triple::ppc:
+  case Triple::ppcle:
   case Triple::ppc64:
   case Triple::ppc64le:
   case Triple::x86:



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


[clang] 6cee9d0 - [PowerPC] Support powerpcle target in Clang [3/5]

2021-01-02 Thread Brandon Bergren via cfe-commits

Author: Brandon Bergren
Date: 2021-01-02T12:17:58-06:00
New Revision: 6cee9d0cf896d83fa8f87b7f8d67ae2dfdbc1bf9

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

LOG: [PowerPC] Support powerpcle target in Clang [3/5]

Add powerpcle support to clang.

For FreeBSD, assume a freestanding environment for now, as we only need it in 
the first place to build loader, which runs in the OpenFirmware environment 
instead of the FreeBSD environment.

For Linux, recognize glibc and musl environments to match current usage in Void 
Linux PPC.

Adjust driver to match current binutils behavior regarding machine naming.

Adjust and expand tests.

Reviewed By: MaskRay

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

Added: 


Modified: 
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/PPC.cpp
clang/lib/Basic/Targets/PPC.h
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/FreeBSD.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/altivec.c
clang/test/CodeGen/builtins-ppc-altivec.c
clang/test/CodeGen/ppc32-and-aix-struct-return.c
clang/test/CodeGen/target-data.c
clang/test/Driver/linux-header-search.cpp
clang/test/Driver/ppc-endian.c
clang/test/Driver/ppc-features.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 1126b647e37b..e88d90a98395 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -334,6 +334,16 @@ TargetInfo *AllocateTarget(const llvm::Triple ,
   return new PPC32TargetInfo(Triple, Opts);
 }
 
+  case llvm::Triple::ppcle:
+switch (os) {
+case llvm::Triple::Linux:
+  return new LinuxTargetInfo(Triple, Opts);
+case llvm::Triple::FreeBSD:
+  return new FreeBSDTargetInfo(Triple, Opts);
+default:
+  return new PPC32TargetInfo(Triple, Opts);
+}
+
   case llvm::Triple::ppc64:
 if (Triple.isOSDarwin())
   return new DarwinPPC64TargetInfo(Triple, Opts);

diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index 0d5d6f553093..67fa1a537fea 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -253,6 +253,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public 
OSTargetInfo {
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
 case llvm::Triple::ppc:
+case llvm::Triple::ppcle:
 case llvm::Triple::ppc64:
 case llvm::Triple::ppc64le:
   this->MCountName = "_mcount";
@@ -413,6 +414,7 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public 
OSTargetInfo {
 case llvm::Triple::mips64:
 case llvm::Triple::mips64el:
 case llvm::Triple::ppc:
+case llvm::Triple::ppcle:
 case llvm::Triple::ppc64:
 case llvm::Triple::ppc64le:
   this->MCountName = "_mcount";

diff  --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index a6997324acf9..2be7555102f8 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -92,7 +92,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions ,
   }
 
   // Target properties.
-  if (getTriple().getArch() == llvm::Triple::ppc64le) {
+  if (getTriple().getArch() == llvm::Triple::ppc64le ||
+  getTriple().getArch() == llvm::Triple::ppcle) {
 Builder.defineMacro("_LITTLE_ENDIAN");
   } else {
 if (!getTriple().isOSNetBSD() &&

diff  --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index a4677cd067f7..56c8f33ef221 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -355,6 +355,8 @@ class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public 
PPCTargetInfo {
   : PPCTargetInfo(Triple, Opts) {
 if (Triple.isOSAIX())
   resetDataLayout("E-m:a-p:32:32-i64:64-n32");
+else if (Triple.getArch() == llvm::Triple::ppcle)
+  resetDataLayout("e-m:e-p:32:32-i64:64-n32");
 else
   resetDataLayout("E-m:e-p:32:32-i64:64-n32");
 

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 6e4c31be84c1..6e98af407a9a 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5041,6 +5041,7 @@ static Value *EmitTargetArchBuiltinExpr(CodeGenFunction 
*CGF,
   case llvm::Triple::x86_64:
 return CGF->EmitX86BuiltinExpr(BuiltinID, E);
   case llvm::Triple::ppc:
+  case llvm::Triple::ppcle:
   case llvm::Triple::ppc64:
   case 

[PATCH] D93978: [clangd] DefineOutline doesn't require implementation file being saved

2021-01-02 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: sammccall, kadircet.
Herald added subscribers: usaxena95, arphaman.
njames93 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

The DefineOutline tweak can now apply even if the target file is unsaved.
Depends on D93977 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93978

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp


Index: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "AST.h"
+#include "DraftStore.h"
 #include "FindTarget.h"
 #include "HeaderSourceSwitch.h"
 #include "ParsedAST.h"
@@ -36,6 +37,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include 
 #include 
 
@@ -397,7 +399,8 @@
 return true;
   }
 
-  Expected apply(const Selection , const DraftStore &) override {
+  Expected apply(const Selection ,
+ const DraftStore ) override {
 const SourceManager  = Sel.AST->getSourceManager();
 auto MainFileName =
 getCanonicalPath(SM.getFileEntryForID(SM.getMainFileID()), SM);
@@ -408,14 +411,24 @@
 if (!CCFile)
   return error("Couldn't find a suitable implementation file.");
 
-auto  =
-Sel.AST->getSourceManager().getFileManager().getVirtualFileSystem();
-auto Buffer = FS.getBufferForFile(*CCFile);
-// FIXME: Maybe we should consider creating the implementation file if it
-// doesn't exist?
-if (!Buffer)
-  return llvm::errorCodeToError(Buffer.getError());
-auto Contents = Buffer->get()->getBuffer();
+StringRef Contents;
+// We need to keep both these alive as Contents can reference the storage
+// contained in either of them.
+auto Draft = DraftMgr.getDraft(*CCFile);
+std::unique_ptr Buffer;
+if (Draft) {
+  Contents = Draft->Contents;
+} else {
+  auto  =
+  Sel.AST->getSourceManager().getFileManager().getVirtualFileSystem();
+  auto BufferOr = FS.getBufferForFile(*CCFile);
+  // FIXME: Maybe we should consider creating the implementation file if it
+  // doesn't exist?
+  if (!BufferOr)
+return llvm::errorCodeToError(BufferOr.getError());
+  Buffer = std::move(*BufferOr);
+  Contents = Buffer->getBuffer();
+}
 auto InsertionPoint = getInsertionPoint(
 Contents, Source->getQualifiedNameAsString(), Sel.AST->getLangOpts());
 if (!InsertionPoint)


Index: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "AST.h"
+#include "DraftStore.h"
 #include "FindTarget.h"
 #include "HeaderSourceSwitch.h"
 #include "ParsedAST.h"
@@ -36,6 +37,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include 
 #include 
 
@@ -397,7 +399,8 @@
 return true;
   }
 
-  Expected apply(const Selection , const DraftStore &) override {
+  Expected apply(const Selection ,
+ const DraftStore ) override {
 const SourceManager  = Sel.AST->getSourceManager();
 auto MainFileName =
 getCanonicalPath(SM.getFileEntryForID(SM.getMainFileID()), SM);
@@ -408,14 +411,24 @@
 if (!CCFile)
   return error("Couldn't find a suitable implementation file.");
 
-auto  =
-Sel.AST->getSourceManager().getFileManager().getVirtualFileSystem();
-auto Buffer = FS.getBufferForFile(*CCFile);
-// FIXME: Maybe we should consider creating the implementation file if it
-// doesn't exist?
-if (!Buffer)
-  return llvm::errorCodeToError(Buffer.getError());
-auto Contents = Buffer->get()->getBuffer();
+StringRef Contents;
+// We need to keep both these alive as Contents can reference the storage
+// contained in either of them.
+auto Draft = DraftMgr.getDraft(*CCFile);
+std::unique_ptr Buffer;
+if (Draft) {
+  Contents = Draft->Contents;
+} else {
+  auto  =
+  Sel.AST->getSourceManager().getFileManager().getVirtualFileSystem();
+  auto BufferOr = FS.getBufferForFile(*CCFile);
+  // FIXME: Maybe we should consider creating the implementation file if it
+  // doesn't exist?
+  if (!BufferOr)
+return 

[PATCH] D93977: [clangd] Pass DraftStore to Tweak Apply and Prepare.

2021-01-02 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: sammccall, kadircet.
Herald added subscribers: usaxena95, arphaman.
njames93 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

This enables multi file edit tweaks to take effect even if files are unsaved.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93977

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
  clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
  clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp
  clang-tools-extra/clangd/refactor/tweaks/PopulateSwitch.cpp
  clang-tools-extra/clangd/refactor/tweaks/RawStringLiteral.cpp
  clang-tools-extra/clangd/refactor/tweaks/RemoveUsingNamespace.cpp
  clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp

Index: clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
@@ -9,6 +9,7 @@
 #include "TweakTesting.h"
 
 #include "Annotations.h"
+#include "DraftStore.h"
 #include "SourceCode.h"
 #include "TestFS.h"
 #include "refactor/Tweak.h"
@@ -70,13 +71,15 @@
 applyTweak(ParsedAST , const Annotations , StringRef TweakID,
const SymbolIndex *Index) {
   auto Range = rangeOrPoint(Input);
+  DraftStore EmptyDrafts;
   llvm::Optional> Result;
   SelectionTree::createEach(AST.getASTContext(), AST.getTokens(), Range.first,
 Range.second, [&](SelectionTree ST) {
   Tweak::Selection S(Index, AST, Range.first,
  Range.second, std::move(ST));
-  if (auto T = prepareTweak(TweakID, S)) {
-Result = (*T)->apply(S);
+  if (auto T =
+  prepareTweak(TweakID, S, EmptyDrafts)) {
+Result = (*T)->apply(S, EmptyDrafts);
 return true;
   } else {
 llvm::consumeError(T.takeError());
Index: clang-tools-extra/clangd/tool/Check.cpp
===
--- clang-tools-extra/clangd/tool/Check.cpp
+++ clang-tools-extra/clangd/tool/Check.cpp
@@ -193,6 +193,8 @@
 log("Testing features at each token (may be slow in large files)");
 auto SpelledTokens =
 AST->getTokens().spelledTokens(AST->getSourceManager().getMainFileID());
+
+DraftStore EmptyDrafts;
 for (const auto  : SpelledTokens) {
   unsigned Start = AST->getSourceManager().getFileOffset(Tok.location());
   unsigned End = Start + Tok.length();
@@ -203,8 +205,9 @@
   auto Tree = SelectionTree::createRight(AST->getASTContext(),
  AST->getTokens(), Start, End);
   Tweak::Selection Selection(, *AST, Start, End, std::move(Tree));
-  for (const auto  : prepareTweaks(Selection, Opts.TweakFilter)) {
-auto Result = T->apply(Selection);
+  for (const auto  :
+   prepareTweaks(Selection, EmptyDrafts, Opts.TweakFilter)) {
+auto Result = T->apply(Selection, EmptyDrafts);
 if (!Result) {
   elog("tweak: {0} ==> FAIL: {1}", T->id(), Result.takeError());
   ++ErrCount;
Index: clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
@@ -36,8 +36,8 @@
 public:
   const char *id() const override final;
 
-  bool prepare(const Selection ) override;
-  Expected apply(const Selection ) override;
+  bool prepare(const Selection , const DraftStore &) override;
+  Expected apply(const Selection , const DraftStore &) override;
   std::string title() const override { return "Swap if branches"; }
   llvm::StringLiteral kind() const override {
 return CodeAction::REFACTOR_KIND;
@@ 

[PATCH] D93919: [PowerPC] Support powerpcle target in Clang [3/5]

2021-01-02 Thread Brandon Bergren via Phabricator via cfe-commits
Bdragon28 updated this revision to Diff 314246.
Bdragon28 added a comment.

Update altivec changes after fd739804e0591468762eb87488a497a3f7d4afb0 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93919

Files:
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/altivec.c
  clang/test/CodeGen/builtins-ppc-altivec.c
  clang/test/CodeGen/ppc32-and-aix-struct-return.c
  clang/test/CodeGen/target-data.c
  clang/test/Driver/linux-header-search.cpp
  clang/test/Driver/ppc-endian.c
  clang/test/Driver/ppc-features.cpp

Index: clang/test/Driver/ppc-features.cpp
===
--- clang/test/Driver/ppc-features.cpp
+++ clang/test/Driver/ppc-features.cpp
@@ -1,9 +1,15 @@
 /// Check default CC1 and linker options for ppc32.
-// RUN: %clang -### -target powerpc-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefix=PPC32 %s
+// RUN: %clang -### -target powerpcle-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32LELNX %s
+// RUN: %clang -### -target powerpc-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32BELNX %s
+// RUN: %clang -### -target powerpcle-unknown-freebsd13.0 %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32LEFBSD %s
+// RUN: %clang -### -target powerpc-unknown-freebsd13.0 %s 2>&1 | FileCheck --check-prefixes=PPC32,PPC32BEFBSD %s
 // PPC32:  "-munwind-tables"
 // PPC32-SAME: "-mfloat-abi" "hard"
 
-// PPC32: "-m" "elf32ppclinux"
+// PPC32LELNX-NEXT: "-m" "elf32lppclinux"
+// PPC32BELNX-NEXT: "-m" "elf32ppclinux"
+// PPC32LEFBSD-NEXT: "-m" "elf32lppc"
+// PPC32BEFBSD-NEXT: "-m" "elf32ppc_fbsd"
 
 // check -msoft-float option for ppc32
 // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s
Index: clang/test/Driver/ppc-endian.c
===
--- clang/test/Driver/ppc-endian.c
+++ clang/test/Driver/ppc-endian.c
@@ -1,9 +1,19 @@
-// RUN: %clang -target powerpc64le -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s
-// RUN: %clang -target powerpc64le -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s
-// RUN: %clang -target powerpc64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s
-// CHECK-LE: "-cc1"{{.*}} "-triple" "powerpc64le{{.*}}"
+// RUN: %clang -target powerpc-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE32 %s
+// RUN: %clang -target powerpc-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE32 %s
+// RUN: %clang -target powerpcle-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE32 %s
+// CHECK-BE32: "-cc1"{{.*}} "-triple" "powerpc-{{.*}}"
 
-// RUN: %clang -target powerpc64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s
-// RUN: %clang -target powerpc64 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s
-// RUN: %clang -target powerpc64le -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s
-// CHECK-BE: "-cc1"{{.*}} "-triple" "powerpc64{{.*}}"
+// RUN: %clang -target powerpcle-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE32 %s
+// RUN: %clang -target powerpcle-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE32 %s
+// RUN: %clang -target powerpc-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE32 %s
+// CHECK-LE32: "-cc1"{{.*}} "-triple" "powerpcle-{{.*}}"
+
+// RUN: %clang -target powerpc64-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE64 %s
+// RUN: %clang -target powerpc64-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE64 %s
+// RUN: %clang -target powerpc64le-unknown -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE64 %s
+// CHECK-BE64: "-cc1"{{.*}} "-triple" "powerpc64-{{.*}}"
+
+// RUN: %clang -target powerpc64le-unknown -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE64 %s
+// RUN: %clang -target powerpc64le-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE64 %s
+// RUN: %clang -target powerpc64-unknown -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE64 %s
+// CHECK-LE64: "-cc1"{{.*}} "-triple" "powerpc64le-{{.*}}"
Index: clang/test/Driver/linux-header-search.cpp
===
--- 

[PATCH] D87188: [InstCombine] Canonicalize SPF to abs intrinc

2021-01-02 Thread Nuno Lopes via Phabricator via cfe-commits
nlopes added a comment.

In D87188#2476230 , @thakis wrote:

> In D87188#2470401 , @lebedev.ri 
> wrote:
>
>> In D87188#2470392 , @thakis wrote:
>>
>>> Heads up: Breaks a test for us: 
>>> https://bugs.chromium.org/p/chromium/issues/detail?id=1161542
>>>
>>> (No reduced repro yet, might be UB, just fyi at this point.)
>>
>> Thanks for headsup. For now i'll deal with the problem @nlopes pointed out 
>> above in a bit..
>
> Just to follow up, this ended up being UB on our end (fix: 
> https://android-review.googlesource.com/c/platform/external/perfetto/+/1535483)

Nice!   Thanks for the update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87188

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


[PATCH] D87188: [InstCombine] Canonicalize SPF to abs intrinc

2021-01-02 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D87188#2470401 , @lebedev.ri wrote:

> In D87188#2470392 , @thakis wrote:
>
>> Heads up: Breaks a test for us: 
>> https://bugs.chromium.org/p/chromium/issues/detail?id=1161542
>>
>> (No reduced repro yet, might be UB, just fyi at this point.)
>
> Thanks for headsup. For now i'll deal with the problem @nlopes pointed out 
> above in a bit..

Just to follow up, this ended up being UB on our end (fix: 
https://android-review.googlesource.com/c/platform/external/perfetto/+/1535483)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87188

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


[PATCH] D72281: [Matrix] Add matrix type to Clang.

2021-01-02 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: clang/lib/Sema/SemaType.cpp:7855
+  return;
+RowsExpr = Columns.get();
+  } else {

@fhahn Should this be ColsExpr?
```
ColsExpr = Columns.get();
```
Noticed when looking at 
https://llvm.org/reports/scan-build/report-SemaType.cpp-BuildMatrixType-11-1.html#EndPath


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72281

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2021-01-02 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment.

In D93938#2476186 , @MyDeveloperDay 
wrote:

> I think we are missing some clarity in this bug as to what the actual problem 
> is, I do agree the test looks wrong,

I agree on this. If like to see a more exhaustive test suite for all the 
combinations of AfterEnum and AllowShortEnumsOnASingleLine, not only fixing the 
single wrong test.

> This seems to be that in "Attach" mode, then 
> AllowShortEnumsOnASingleLine=false doesn't attach the brace.

That's my understanding as well.

> I'm somewhat struggling to understand how the code change fixes that.. given 
> that Style.BraceWrapping.AfterEnum should be true correct?

In Attach mode, AfterEnum is false. Cf. `expandPresets` 
https://github.com/llvm/llvm-project/blob/47877c9079c27f19a954b660201ea47717c82fec/clang/lib/Format/Format.cpp#L752.

Said all that, it *seems* to me that the fix is correct apart from the 
strangely looking `if (!Style.isCpp()) {` change that I don't really 
understand. Why should C++ be handled differently in this regard? What am I 
missing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2021-01-02 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I think we are missing some clarity in this bug as to what the actual problem 
is, I do agree the test looks wrong,

This seems to be that in "Attach" mode, then AllowShortEnumsOnASingleLine=false 
doesn't attach the brace.

I'm somewhat struggling to understand how the code change fixes that.. given 
that Style.BraceWrapping.AfterEnum should be true correct?




Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1305
+  if (!Style.isCpp()) {
 addUnwrappedLine();
 return;

surely this means always add a newline? but that isn't what is wanted from what 
I can tell.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D92634: [Analyzer] Diagnose signed integer overflow

2021-01-02 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment.

> Besides, the return value should be the exact value computed from the two 
> integers, even unknown, rather than undefined. As the developers may overflow 
> an integer on purpose.

I am not sure what you mean. If there is undefined behavior then the value 
should be undefined and nothing else.. right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92634

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