[PATCH] D93038: [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

2021-01-07 Thread Jeroen Dobbelaere via Phabricator via cfe-commits
jeroen.dobbelaere added a comment.

Thanks !


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93038

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


[clang] c102b96 - [X86] Correct the comments about comparison intrinsics. NFCI.

2021-01-07 Thread via cfe-commits

Author: Wang, Pengfei
Date: 2021-01-08T15:36:15+08:00
New Revision: c102b9697bd4ec2b12dab9865661bfb2facc97ec

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

LOG: [X86] Correct the comments about comparison intrinsics. NFCI.

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 1e0337ca7ac3..ea39d64e16f1 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -13955,8 +13955,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
 // Lowering vector comparisons to fcmp instructions, while
 // ignoring signalling behaviour requested
 // ignoring rounding mode requested
-// This is is only possible as long as FENV_ACCESS is not implemented.
-// See also: https://reviews.llvm.org/D45616
+// This is only possible if fp-model is not strict and FENV_ACCESS is off.
 
 // The third argument is the comparison condition, and integer in the
 // range [0, 31]



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


[PATCH] D94287: [clang-format] Fix include sorting bug

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

Seems to be a duplicate of D94206 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94287

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


[PATCH] D93591: [MLIR][SPIRV] Add (de-)serialization support for SpecConstantOpeation.

2021-01-07 Thread Kareem Ergawy via Phabricator via cfe-commits
ergawy added inline comments.



Comment at: mlir/lib/Target/SPIRV/Deserialization.cpp:1791
+
+  // Since the enclosed op is emitted in the current block, split it in a
+  // separate new block.

antiagainst wrote:
> What about first creating the spec op, set the insertion point to its body 
> (with proper guard), and then process the transient instruction? This can 
> avoid us from doing the block manipulation right? Following the above 
> comment, this is part of swapping the "context".
If we do this, since the transient instruction has operands that are constants, 
global vars, or spec constants, then the instructions to materialize these 
references will be emitted in the spec op's region. This is the main reason I 
think we need such manipulation here; we first need to materialize all 
references, if any, in the parent region and then isolate the spec op's 
enclosed op.

Let me know if what you are saying is going over my head :D.



Comment at: mlir/lib/Target/SPIRV/Deserialization.cpp:1738
+
+  // Instructions wrapped by OpSpecConstantOp need an ID for their
+  // Deserializer::processOp(...) to emit the corresponding spv 
dialect

antiagainst wrote:
> ergawy wrote:
> > mravishankar wrote:
> > > This works fine I guess, but what do you think about just "creating a new 
> > > stack"
> > > 
> > > Basically `valueMap` is the current defined values. You can create an new 
> > > map and use that to collect values from within the region
> > > 
> > > ```
> > > DenseMap newValueMap;
> > > std::swap(valueMap, newValueMap);
> > > 
> > > <... process the body ...>
> > > 
> > > std::swap(newValueMap, valueMap)
> > > ```
> > > 
> > > Sorry if this is totally off here. I might be missing some context (this 
> > > has been flushed from cache now)
> > Thanks for your comment and review.
> > 
> > I might have missed what you mean but the problem here is that 
> > auto-generated deserialization methods depend on the list of input operands 
> > having an ID for the corresponding value in SPIR-V input module. For 
> > `OpSpecConstantOp`, we have a special case: there no SPIR-V ID for the 
> > result of the wrapped/enclosed op. So what is represented as a single ID 
> > (SSA value) in the SPIR-V module needs to be represented using 2 MLIR SSA 
> > values in the `spv` one:
> > - The MLIR ID for the result of `spv.SpecConstantOperation`.
> > - The MLIR ID for the result of wrapped/enclosed op within its region.
> > 
> > Let me know if I misunderstood.
> You can still have the fake ID for the enclosed instruction. We are 
> constructing a transient instruction for the enclosed instruction and invoke 
> the normal instruction processing functionality for it. What Mahesh means is 
> swapping the "context" before processing the transient instruction. The 
> context includes the `valueMap` and insertion point. So before parsing the 
> transient instruction, if we swap the `valueMap` with a temporary 
> `specOpValueMap`, then we are still inserting the fake ID into the 
> `specOpValueMap`. It's just that the `specOpValueMap` will only ever contain 
> one fake ID and there is no chance we collide. The `specOpValueMap` can just 
> live in this particular function. :)
Ah, I see what Mahesh and you mean. I guess that works since `OpSpecConstantOp` 
takes operands whose instructions are materialized while the consuming 
instruction is being emitted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93591

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


[PATCH] D93591: [MLIR][SPIRV] Add (de-)serialization support for SpecConstantOpeation.

2021-01-07 Thread Kareem Ergawy via Phabricator via cfe-commits
ergawy updated this revision to Diff 315302.
ergawy marked 4 inline comments as done.
ergawy added a comment.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman.
Herald added a project: clang.

Handle review comments:

- Use different value map for emitting SpecConstOperation.
- Small change in testing code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93591

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/test/initialize-params.test
  mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
  mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
  mlir/lib/Target/SPIRV/Deserialization.cpp
  mlir/lib/Target/SPIRV/Serialization.cpp
  mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
  mlir/test/Target/SPIRV/spec-constant.mlir

Index: mlir/test/Target/SPIRV/spec-constant.mlir
===
--- mlir/test/Target/SPIRV/spec-constant.mlir
+++ mlir/test/Target/SPIRV/spec-constant.mlir
@@ -85,3 +85,34 @@
   // CHECK: spv.specConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3xf32>
   spv.specConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32>
 }
+
+// -
+
+spv.module Logical GLSL450 requires #spv.vce {
+
+  spv.specConstant @sc_i32_1 = 1 : i32
+
+  spv.func @use_composite() -> (i32) "None" {
+// CHECK: [[USE1:%.*]] = spv.mlir.referenceof @sc_i32_1 : i32
+// CHECK: [[USE2:%.*]] = spv.constant 0 : i32
+
+// CHECK: [[RES1:%.*]] = spv.SpecConstantOperation wraps "spv.ISub"([[USE1]], [[USE2]]) : (i32, i32) -> i32
+
+// CHECK: [[USE3:%.*]] = spv.mlir.referenceof @sc_i32_1 : i32
+// CHECK: [[USE4:%.*]] = spv.constant 0 : i32
+
+// CHECK: [[RES2:%.*]] = spv.SpecConstantOperation wraps "spv.ISub"([[USE3]], [[USE4]]) : (i32, i32) -> i32
+
+%0 = spv.mlir.referenceof @sc_i32_1 : i32
+%1 = spv.constant 0 : i32
+%2 = spv.SpecConstantOperation wraps "spv.ISub"(%0, %1) : (i32, i32) -> i32
+
+// CHECK: [[RES3:%.*]] = spv.SpecConstantOperation wraps "spv.IMul"([[RES1]], [[RES2]]) : (i32, i32) -> i32
+%3 = spv.SpecConstantOperation wraps "spv.IMul"(%2, %2) : (i32, i32) -> i32
+
+// Make sure deserialization continues from the right place after creating
+// the previous op.
+// CHECK: spv.ReturnValue [[RES3]]
+spv.ReturnValue %3 : i32
+  }
+}
Index: mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
===
--- mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
+++ mlir/test/Dialect/SPIRV/IR/structure-ops.mlir
@@ -780,6 +780,20 @@
 
 // -
 
+spv.module Logical GLSL450 {
+  spv.specConstant @sc = 42 : i32
+
+  spv.func @foo() -> i32 "None" {
+// CHECK: [[SC:%.*]] = spv.mlir.referenceof @sc
+%0 = spv.mlir.referenceof @sc : i32
+// CHECK: spv.SpecConstantOperation wraps "spv.ISub"([[SC]], [[SC]]) : (i32, i32) -> i32
+%1 = spv.SpecConstantOperation wraps "spv.ISub"(%0, %0) : (i32, i32) -> i32
+spv.ReturnValue %1 : i32
+  }
+}
+
+// -
+
 spv.module Logical GLSL450 {
   spv.func @foo() -> i32 "None" {
 %0 = spv.constant 1: i32
Index: mlir/lib/Target/SPIRV/Serialization.cpp
===
--- mlir/lib/Target/SPIRV/Serialization.cpp
+++ mlir/lib/Target/SPIRV/Serialization.cpp
@@ -204,6 +204,9 @@
   LogicalResult
   processSpecConstantCompositeOp(spirv::SpecConstantCompositeOp op);
 
+  LogicalResult
+  processSpecConstantOperationOp(spirv::SpecConstantOperationOp op);
+
   /// SPIR-V dialect supports OpUndef using spv.UndefOp that produces a SSA
   /// value to use with other operations. The SPIR-V spec recommends that
   /// OpUndef be generated at module level. The serialization generates an
@@ -711,6 +714,49 @@
   return processName(resultID, op.sym_name());
 }
 
+LogicalResult
+Serializer::processSpecConstantOperationOp(spirv::SpecConstantOperationOp op) {
+  uint32_t typeID = 0;
+  if (failed(processType(op.getLoc(), op.getType(), typeID))) {
+return failure();
+  }
+
+  auto resultID = getNextID();
+
+  SmallVector operands;
+  operands.push_back(typeID);
+  operands.push_back(resultID);
+
+  Block  = op.getRegion().getBlocks().front();
+  Operation  = block.getOperations().front();
+
+  std::string enclosedOpName;
+  llvm::raw_string_ostream rss(enclosedOpName);
+  rss << "Op" << enclosedOp.getName().stripDialect();
+  auto enclosedOpcode = spirv::symbolizeOpcode(rss.str());
+
+  if (!enclosedOpcode) {
+op.emitError("Couldn't find op code for op ")
+<< enclosedOp.getName().getStringRef();
+return failure();
+  }
+
+  operands.push_back(static_cast(enclosedOpcode.getValue()));
+
+  // Append operands to the enclosed op to the list of operands.
+  for (Value operand : enclosedOp.getOperands()) {
+uint32_t id = getValueID(operand);
+assert(id && "use before def!");
+operands.push_back(id);
+  }
+

[PATCH] D94287: [clang-format] Fix include sorting bug

2021-01-07 Thread Kent Sommer via Phabricator via cfe-commits
kentsommer created this revision.
kentsommer added a project: clang-format.
kentsommer requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- Fixes a bug that caused `// clang-format off` in a includes section to 
disabled include sorting even after a `// clang-format on` was found.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94287

Files:
  clang/lib/Format/Format.cpp
  clang/test/Format/line-disable-include-sorting.cpp


Index: clang/test/Format/line-disable-include-sorting.cpp
===
--- /dev/null
+++ clang/test/Format/line-disable-include-sorting.cpp
@@ -0,0 +1,13 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s \
+// RUN:   | clang-format -style="{BasedOnStyle: LLVM, SortIncludes: true}" \
+// RUN:   | FileCheck -strict-whitespace %s
+// CHECK: {{^//\ clang-format\ off$}}
+// CHECK-NEXT: {{^#include\ $}}
+// CHECK-NEXT: {{^//\ clang-format\ on$}}
+// CHECK-NEXT: {{^#include\ $}}
+// CHECK-NEXT: {{^#include\ $}}
+// clang-format off
+#include 
+// clang-format on
+#include 
+#include 
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2307,8 +2307,8 @@
 IncludesInBlock.clear();
 FirstIncludeBlock = false;
   }
-  Prev = Pos + 1;
 }
+Prev = Pos + 1;
 if (Pos == StringRef::npos || Pos + 1 == Code.size())
   break;
 SearchFrom = Pos + 1;


Index: clang/test/Format/line-disable-include-sorting.cpp
===
--- /dev/null
+++ clang/test/Format/line-disable-include-sorting.cpp
@@ -0,0 +1,13 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s \
+// RUN:   | clang-format -style="{BasedOnStyle: LLVM, SortIncludes: true}" \
+// RUN:   | FileCheck -strict-whitespace %s
+// CHECK: {{^//\ clang-format\ off$}}
+// CHECK-NEXT: {{^#include\ $}}
+// CHECK-NEXT: {{^//\ clang-format\ on$}}
+// CHECK-NEXT: {{^#include\ $}}
+// CHECK-NEXT: {{^#include\ $}}
+// clang-format off
+#include 
+// clang-format on
+#include 
+#include 
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2307,8 +2307,8 @@
 IncludesInBlock.clear();
 FirstIncludeBlock = false;
   }
-  Prev = Pos + 1;
 }
+Prev = Pos + 1;
 if (Pos == StringRef::npos || Pos + 1 == Code.size())
   break;
 SearchFrom = Pos + 1;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D92714: Make -fno-pic respect -fno-direct-access-external-data

2021-01-07 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

This is straightforward, too :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92714

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


[PATCH] D92270: [ConstantFold] Fold more operations to poison

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

In D92270#2483557 , @thakis wrote:

> It turned out to be UB in our code as far as I can tell, see 
> https://bugs.chromium.org/p/angleproject/issues/detail?id=5500#c36 and the 
> follow-on.
>
> (If this is known to trigger an existing bug more often, it might still be a 
> good idea to undo it until that existing bug is fixed? But we're not affected 
> by this existing bug as far as I can tell, so this is just a suggestion.)

I don't know the policy of LLVM in this case, but it sounds legit. LLVM 
branching date is also near. @nikic May I ask your opinion?
BTW, shift operation is continually causing this problem interestingly - I 
guess shift operation with large shift amount hasn't been treated as 'that bad' 
for some reason.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92270

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


[clang] 6b0ee02 - Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""""

2021-01-07 Thread Artem Dergachev via cfe-commits

Author: Artem Dergachev
Date: 2021-01-07T20:22:22-08:00
New Revision: 6b0ee02747ed22d41e175d15f27025183341e6f8

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

LOG: Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic 
consumer implementations to libAnalysis.

This reverts commit b12f26733a4259c90e5f387aceb9f23c35e003b8.

Fix dead include that looked like another missed circular dependency.

Added: 
clang/include/clang/Analysis/CrossTUAnalysisHelper.h
clang/include/clang/Analysis/PathDiagnosticConsumers.def
clang/include/clang/Analysis/PathDiagnosticConsumers.h
clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
clang/lib/Analysis/TextPathDiagnosticConsumer.cpp

Modified: 
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/include/clang/StaticAnalyzer/Core/Analyses.def
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
clang/include/clang/module.modulemap
clang/lib/Analysis/CMakeLists.txt
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/StaticAnalyzer/Core/CMakeLists.txt
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Removed: 
clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp



diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h 
b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
new file mode 100644
index ..500e78ddedcf
--- /dev/null
+++ b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
@@ -0,0 +1,41 @@
+//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ 
-*-===//
+//
+// 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
+//
+//===--===//
+#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
+#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
+
+#include "llvm/ADT/Optional.h"
+#include "clang/Basic/SourceManager.h"
+
+namespace clang {
+
+class ASTUnit;
+
+/// This class is an abstract interface acting as a bridge between
+/// an analysis that requires lookups across translation units (a user
+/// of that interface) and the facility that implements such lookups
+/// (an implementation of that interface). This is useful to break direct
+/// link-time dependencies between the (possibly shared) libraries in which
+/// the user and the implementation live.
+class CrossTUAnalysisHelper {
+public:
+  /// Determine the original source location in the original TU for an
+  /// imported source location.
+  /// \p ToLoc Source location in the imported-to AST.
+  /// \return Source location in the imported-from AST and the corresponding
+  /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit
+  /// object that is returned here).
+  /// If any error happens (ToLoc is a non-imported source location) empty is
+  /// returned.
+  virtual llvm::Optional>
+  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const = 
0;
+
+  virtual ~CrossTUAnalysisHelper() {}
+};
+} // namespace clang
+
+#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H

diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def 
b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
new file mode 100644
index ..33d2072fcf31
--- /dev/null
+++ b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
@@ -0,0 +1,50 @@
+//===-- PathDiagnosticConsumers.def - Visualizing warnings --*- C++ 
-*-===//
+//
+// 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
+//
+//===--===//
+//
+// This file defines the set of path diagnostic consumers - objects that
+// implement 
diff erent representations of static analysis results.
+//
+//===--===//
+
+#ifndef ANALYSIS_DIAGNOSTICS
+#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)
+#endif
+
+ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML",
+  

[PATCH] D94268: Allow _mm_empty() (via llvm.x86.mmx.emms) to be a no-op without MMX.

2021-01-07 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added a comment.

Is inline assembly the only case `emms` instruction will be needed? But inline 
assembly doesn't enable `mmx` attribute automatically, right? E.g. 
https://godbolt.org/z/43ases
Analyzing asm block and appending the `mmx` attribute if we see `mmx` 
instructions might be needed. But if we do the analysis, just adding an `emms` 
instruction at the end of the block seems better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94268

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


[PATCH] D87216: [NewPM] Support --print-before/after in NPM

2021-01-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added inline comments.



Comment at: llvm/lib/Passes/PassBuilder.cpp:462
+  if (!PIC->hasPassName(P))
+report_fatal_error("unrecognized pass name: " + P);
+}

hoy wrote:
> @aeubanks This seems not working with MIR passes under newpm. Would it make 
> sense to issue a warning instead to unblock that? Thanks.
That's a good point, I'll do that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87216

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


[PATCH] D92806: Single function compilation mode.

2021-01-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

WDYT about adding optnone to all functions except the ones you're interested 
in? Would that cut down the compile times?
We could reuse ForceFunctionAttrsPass rather than adding so much plumbing. This 
is too much plumbing for my liking.

And since this is a debug thing, instead of creating new Clang flags, we can 
just pass flags like -Xclang -mllvm?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92806

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


Re: [clang] d2ddc69 - Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""

2021-01-07 Thread David Blaikie via cfe-commits
I've reverted this in b12f26733a4259c90e5f387aceb9f23c35e003b8

On Thu, Jan 7, 2021 at 3:04 PM David Blaikie  wrote:
>
>
>
> On Thu, Jan 7, 2021 at 12:29 AM Artem Dergachev via cfe-commits 
>  wrote:
>>
>>
>> Author: Artem Dergachev
>> Date: 2021-01-07T00:28:22-08:00
>> New Revision: d2ddc694ff94743d9735aaf07edcaf6db8aaca04
>>
>> URL: 
>> https://github.com/llvm/llvm-project/commit/d2ddc694ff94743d9735aaf07edcaf6db8aaca04
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/d2ddc694ff94743d9735aaf07edcaf6db8aaca04.diff
>>
>> LOG: Revert "Revert "[analyzer] NFC: Move path diagnostic consumer 
>> implementations to libAnalysis.""
>>
>> This reverts commit 5663bf201f5c444d6fb56fb1bd471bc53c17d837.
>>
>> The cyclic dependency problem is addressed now.
>
>
> Looks like this still has a circular dependency, unfortunately:
>
> $ grep -r include.*Analysis clang/include/clang/CrossTU
>
> clang/include/clang/CrossTU/CrossTranslationUnit.h:#include 
> "clang/Analysis/CrossTUAnalysisHelper.h"
>
> $ grep -r include.*CrossTU clang/lib/Analysis
>
> clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp:#include 
> "clang/CrossTU/CrossTranslationUnit.h"
>
> clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp:#include 
> "clang/Analysis/CrossTUAnalysisHelper.h"
>
>
> Could you revert this if it's not fairly simple to fix forward?
>
>> This is the ~fifth attempt to land this change.
>>
>> Added:
>> clang/include/clang/Analysis/CrossTUAnalysisHelper.h
>> clang/include/clang/Analysis/PathDiagnosticConsumers.def
>> clang/include/clang/Analysis/PathDiagnosticConsumers.h
>> clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
>> clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
>> clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
>> clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
>> clang/lib/Analysis/TextPathDiagnosticConsumer.cpp
>>
>> Modified:
>> clang/include/clang/CrossTU/CrossTranslationUnit.h
>> clang/include/clang/StaticAnalyzer/Core/Analyses.def
>> clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
>> clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
>> clang/include/clang/module.modulemap
>> clang/lib/Analysis/CMakeLists.txt
>> clang/lib/CrossTU/CrossTranslationUnit.cpp
>> clang/lib/Frontend/CompilerInvocation.cpp
>> clang/lib/StaticAnalyzer/Core/CMakeLists.txt
>> clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
>>
>> Removed:
>> clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
>> clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
>> clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
>> clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
>> clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp
>>
>>
>> 
>> diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h 
>> b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
>> new file mode 100644
>> index ..500e78ddedcf
>> --- /dev/null
>> +++ b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
>> @@ -0,0 +1,41 @@
>> +//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ 
>> -*-===//
>> +//
>> +// 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
>> +//
>> +//===--===//
>> +#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
>> +#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
>> +
>> +#include "llvm/ADT/Optional.h"
>> +#include "clang/Basic/SourceManager.h"
>> +
>> +namespace clang {
>> +
>> +class ASTUnit;
>> +
>> +/// This class is an abstract interface acting as a bridge between
>> +/// an analysis that requires lookups across translation units (a user
>> +/// of that interface) and the facility that implements such lookups
>> +/// (an implementation of that interface). This is useful to break direct
>> +/// link-time dependencies between the (possibly shared) libraries in which
>> +/// the user and the implementation live.
>> +class CrossTUAnalysisHelper {
>> +public:
>> +  /// Determine the original source location in the original TU for an
>> +  /// imported source location.
>> +  /// \p ToLoc Source location in the imported-to AST.
>> +  /// \return Source location in the imported-from AST and the corresponding
>> +  /// ASTUnit object (the AST was loaded from a file using an internal 
>> ASTUnit
>> +  /// object that is returned here).
>> +  /// If any error happens (ToLoc is a non-imported source location) empty 
>> is
>> +  /// returned.
>> +  virtual llvm::Optional> *>>
>> +  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const 
>> = 0;
>> +
>> +  virtual ~CrossTUAnalysisHelper() {}
>> +};
>> +} // namespace clang
>> +
>> +#endif // 

[clang] b12f267 - Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""

2021-01-07 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2021-01-07T18:18:23-08:00
New Revision: b12f26733a4259c90e5f387aceb9f23c35e003b8

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

LOG: Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer 
implementations to libAnalysis."""

This reverts commit d2ddc694ff94743d9735aaf07edcaf6db8aaca04.

This still contains a circular dependency between Analysis and CrossTU:

$ grep -r include.*Analysis clang/include/clang/CrossTU
clang/include/clang/CrossTU/CrossTranslationUnit.h:
  #include "clang/Analysis/CrossTUAnalysisHelper.h"
$ grep -r include.*CrossTU clang/lib/Analysis
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp:
  #include "clang/CrossTU/CrossTranslationUnit.h"
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp:
  #include "clang/Analysis/CrossTUAnalysisHelper.h"

Added: 
clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp

Modified: 
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/include/clang/StaticAnalyzer/Core/Analyses.def
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
clang/include/clang/module.modulemap
clang/lib/Analysis/CMakeLists.txt
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/StaticAnalyzer/Core/CMakeLists.txt
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Removed: 
clang/include/clang/Analysis/CrossTUAnalysisHelper.h
clang/include/clang/Analysis/PathDiagnosticConsumers.def
clang/include/clang/Analysis/PathDiagnosticConsumers.h
clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
clang/lib/Analysis/TextPathDiagnosticConsumer.cpp



diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h 
b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
deleted file mode 100644
index 500e78ddedcf..
--- a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ 
-*-===//
-//
-// 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
-//
-//===--===//
-#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
-#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
-
-#include "llvm/ADT/Optional.h"
-#include "clang/Basic/SourceManager.h"
-
-namespace clang {
-
-class ASTUnit;
-
-/// This class is an abstract interface acting as a bridge between
-/// an analysis that requires lookups across translation units (a user
-/// of that interface) and the facility that implements such lookups
-/// (an implementation of that interface). This is useful to break direct
-/// link-time dependencies between the (possibly shared) libraries in which
-/// the user and the implementation live.
-class CrossTUAnalysisHelper {
-public:
-  /// Determine the original source location in the original TU for an
-  /// imported source location.
-  /// \p ToLoc Source location in the imported-to AST.
-  /// \return Source location in the imported-from AST and the corresponding
-  /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit
-  /// object that is returned here).
-  /// If any error happens (ToLoc is a non-imported source location) empty is
-  /// returned.
-  virtual llvm::Optional>
-  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const = 
0;
-
-  virtual ~CrossTUAnalysisHelper() {}
-};
-} // namespace clang
-
-#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H

diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def 
b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
deleted file mode 100644
index 33d2072fcf31..
--- a/clang/include/clang/Analysis/PathDiagnosticConsumers.def
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- PathDiagnosticConsumers.def - Visualizing warnings --*- C++ 
-*-===//
-//
-// 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] D92633: Add -f[no-]direct-access-external-data to deprecate -mpie-copy-relocations

2021-01-07 Thread Sriraman Tallam via Phabricator via cfe-commits
tmsriram accepted this revision.
tmsriram added a comment.
This revision is now accepted and ready to land.

In D92633#2485811 , @MaskRay wrote:

> In D92633#2434768 , @tmsriram wrote:
>
>> In D92633#2434766 , @MaskRay wrote:
>>
>>> In D92633#2434714 , @tmsriram 
>>> wrote:
>>>
 Correct me if I am wrong, but I do see that this behavior is touched.  
 Line 10 in -fdirect-access-external-data.c :

 // RUN: %clang -### -c -target aarch64 %s -fpic 
 -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DIRECT

 With -fpic, the variable access will go directly and not via GOT.
>>>
>>> `clang/test/Driver/fdirect-access-external-data.c` is a driver test which 
>>> tests how the driver passes options to CC1.
>>
>>
>>
>>> `clang/lib/CodeGen/CodeGenModule.cpp` says how the CC1 option affects the 
>>> dso_local specifier in the LLVM IR output. Currently it is a no op for 
>>> -fpic/-fPIC.
>>
>> Great! Sorry I didnt realize this,  this is fine with me now!
>>
>>> (I have made some tests. It looks like implementing 
>>> -fno-direct-access-external-data for -fno-pic is not an insurmountable 
>>> work: ~50 tests)
>
> May I get a formal LGTM?  I am happy to give GCC devs a few more days... 
> https://gcc.gnu.org/pipermail/gcc/2021-January/234639.html (the previous 
> feature request and gcc/ mailing list message has given them one month and 
> -f[no-]direct-access-external-data is still the best name so far)

Ok, I can approve this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92633

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


[PATCH] D87216: [NewPM] Support --print-before/after in NPM

2021-01-07 Thread Hongtao Yu via Phabricator via cfe-commits
hoy added inline comments.



Comment at: llvm/lib/Passes/PassBuilder.cpp:462
+  if (!PIC->hasPassName(P))
+report_fatal_error("unrecognized pass name: " + P);
+}

@aeubanks This seems not working with MIR passes under newpm. Would it make 
sense to issue a warning instead to unblock that? Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87216

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


[PATCH] D93743: [NewPM] Run ObjC ARC passes

2021-01-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D93743#2485876 , @ahatanak wrote:

> Is this change safe considering calls to `EP.get()` can add function 
> declarations to the module as you mentioned in 
> https://reviews.llvm.org/D86178?

It's definitely safe right now since we have no support for concurrency right 
now. Many existing function passes will create function definitions, e.g. 
replacing some snippet with an intrinsic.
Of course if we ever decide to figure out concurrency we'll have to solve this 
issue, but we would have to solve it anyway even without this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93743

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


[PATCH] D93743: [NewPM] Run ObjC ARC passes

2021-01-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Is this change safe considering calls to `EP.get()` can add function 
declarations to the module as you mentioned in https://reviews.llvm.org/D86178?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93743

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


[PATCH] D90507: [Driver] Add DWARF64 flag: -gdwarf64

2021-01-07 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90507

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


[PATCH] D94261: [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

2021-01-07 Thread Valentin Clement via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48baa7f5b11c: [clang] Add powerpc64le-none-linux-gnu to gnu 
toolchain for PPC64 (authored by clementval).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94261

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 48baa7f - [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

2021-01-07 Thread via cfe-commits

Author: clementval
Date: 2021-01-07T20:08:20-05:00
New Revision: 48baa7f5b11cbe6b00711864a19cd8b722f5940d

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

LOG: [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

While trying to compile clang and openmp with a freshly built clang with the 
gcc/7.4.0
toolchain on the Summit supercomputer I face some error because of the triple 
under which
the GCC toolchain is installed was not present in for PPC64LE triples.
This patch add the powerpc64le-none-linux-gnu used on system like Summit and 
Ascent.

Reviewed By: jdenny

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

Added: 


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

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 336ee13b2df5..164cf6e7 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@ void 
Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",



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


[PATCH] D92633: Add -f[no-]direct-access-external-data to deprecate -mpie-copy-relocations

2021-01-07 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D92633#2434768 , @tmsriram wrote:

> In D92633#2434766 , @MaskRay wrote:
>
>> In D92633#2434714 , @tmsriram wrote:
>>
>>> Correct me if I am wrong, but I do see that this behavior is touched.  Line 
>>> 10 in -fdirect-access-external-data.c :
>>>
>>> // RUN: %clang -### -c -target aarch64 %s -fpic 
>>> -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DIRECT
>>>
>>> With -fpic, the variable access will go directly and not via GOT.
>>
>> `clang/test/Driver/fdirect-access-external-data.c` is a driver test which 
>> tests how the driver passes options to CC1.
>
>
>
>> `clang/lib/CodeGen/CodeGenModule.cpp` says how the CC1 option affects the 
>> dso_local specifier in the LLVM IR output. Currently it is a no op for 
>> -fpic/-fPIC.
>
> Great! Sorry I didnt realize this,  this is fine with me now!
>
>> (I have made some tests. It looks like implementing 
>> -fno-direct-access-external-data for -fno-pic is not an insurmountable work: 
>> ~50 tests)

May I get a formal LGTM?  I am happy to give GCC devs a few more days... 
https://gcc.gnu.org/pipermail/gcc/2021-January/234639.html (the previous 
feature request and gcc/ mailing list message has given them one month and 
-f[no-]direct-access-external-data is still the best name so far)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92633

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


[PATCH] D93668: [clang] Add -ffuchsia-c++-abi flag to explicitly use the Fuchsia C++ ABI

2021-01-07 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr added a comment.

It's fine to have a target tuple translate to a default C++ ABI.
But the C++ ABI selection is fundamentally not a target flavor thing.  It's 
just a C++ ABI thing.
So using the target tuple as the sole mechanism to determine C++ ABI is 
fundamentally wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93668

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


[PATCH] D93743: [NewPM] Run ObjC ARC passes

2021-01-07 Thread Alina Sbirlea via Phabricator via cfe-commits
asbirlea added a comment.

The changes LGTM, but I'd rather defer final review to ahatanak@.
It would be good to have some testing but it could be addressed in a separate 
patch, potentially by folks more familiar with the ObjCARC passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93743

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


Re: [clang] d2ddc69 - Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""

2021-01-07 Thread David Blaikie via cfe-commits
On Thu, Jan 7, 2021 at 12:29 AM Artem Dergachev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Artem Dergachev
> Date: 2021-01-07T00:28:22-08:00
> New Revision: d2ddc694ff94743d9735aaf07edcaf6db8aaca04
>
> URL:
> https://github.com/llvm/llvm-project/commit/d2ddc694ff94743d9735aaf07edcaf6db8aaca04
> DIFF:
> https://github.com/llvm/llvm-project/commit/d2ddc694ff94743d9735aaf07edcaf6db8aaca04.diff
>
> LOG: Revert "Revert "[analyzer] NFC: Move path diagnostic consumer
> implementations to libAnalysis.""
>
> This reverts commit 5663bf201f5c444d6fb56fb1bd471bc53c17d837.
>
> The cyclic dependency problem is addressed now.
>

Looks like this still has a circular dependency, unfortunately:

$ grep -r include.*Analysis clang/include/clang/CrossTU

clang/include/clang/CrossTU/CrossTranslationUnit.h:#*include
"clang/Analysis/CrossTUAnalysis*Helper.h"

$ grep -r include.*CrossTU clang/lib/Analysis

clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp:#*include
"clang/CrossTU*/CrossTranslationUnit.h"

clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp:#*include
"clang/Analysis/CrossTU*AnalysisHelper.h"

Could you revert this if it's not fairly simple to fix forward?

This is the ~fifth attempt to land this change.
>
> Added:
> clang/include/clang/Analysis/CrossTUAnalysisHelper.h
> clang/include/clang/Analysis/PathDiagnosticConsumers.def
> clang/include/clang/Analysis/PathDiagnosticConsumers.h
> clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
> clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
> clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
> clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
> clang/lib/Analysis/TextPathDiagnosticConsumer.cpp
>
> Modified:
> clang/include/clang/CrossTU/CrossTranslationUnit.h
> clang/include/clang/StaticAnalyzer/Core/Analyses.def
> clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
> clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
> clang/include/clang/module.modulemap
> clang/lib/Analysis/CMakeLists.txt
> clang/lib/CrossTU/CrossTranslationUnit.cpp
> clang/lib/Frontend/CompilerInvocation.cpp
> clang/lib/StaticAnalyzer/Core/CMakeLists.txt
> clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
>
> Removed:
> clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
> clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
> clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
> clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
> clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp
>
>
>
> 
> diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
> b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
> new file mode 100644
> index ..500e78ddedcf
> --- /dev/null
> +++ b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
> @@ -0,0 +1,41 @@
> +//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++
> -*-===//
> +//
> +// 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
> +//
>
> +//===--===//
> +#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
> +#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
> +
> +#include "llvm/ADT/Optional.h"
> +#include "clang/Basic/SourceManager.h"
> +
> +namespace clang {
> +
> +class ASTUnit;
> +
> +/// This class is an abstract interface acting as a bridge between
> +/// an analysis that requires lookups across translation units (a user
> +/// of that interface) and the facility that implements such lookups
> +/// (an implementation of that interface). This is useful to break direct
> +/// link-time dependencies between the (possibly shared) libraries in
> which
> +/// the user and the implementation live.
> +class CrossTUAnalysisHelper {
> +public:
> +  /// Determine the original source location in the original TU for an
> +  /// imported source location.
> +  /// \p ToLoc Source location in the imported-to AST.
> +  /// \return Source location in the imported-from AST and the
> corresponding
> +  /// ASTUnit object (the AST was loaded from a file using an internal
> ASTUnit
> +  /// object that is returned here).
> +  /// If any error happens (ToLoc is a non-imported source location)
> empty is
> +  /// returned.
> +  virtual llvm::Optional Preprocessor *>>
> +  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc)
> const = 0;
> +
> +  virtual ~CrossTUAnalysisHelper() {}
> +};
> +} // namespace clang
> +
> +#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
>
> diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def
> b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
> new file mode 100644
> index ..33d2072fcf31
> --- 

[PATCH] D84467: Add support for Branch Coverage in LLVM Source-Based Code Coverage

2021-01-07 Thread Alan Phipps via Phabricator via cfe-commits
alanphipps marked an inline comment as done.
alanphipps added inline comments.



Comment at: llvm/test/tools/llvm-cov/branch-noShowBranch.test:3
+// RUN: llvm-profdata merge %S/Inputs/branch-c-general.proftext -o %t.profdata
+// RUN: llvm-cov show %S/Inputs/branch-c-general.o32l -instr-profile 
%t.profdata -path-equivalence=/tmp,%S %S/branch-c-general.c | FileCheck %s
+// RUN: llvm-cov report %S/Inputs/branch-c-general.o32l 
--show-branch-summary=false -instr-profile %t.profdata -show-functions 
-path-equivalence=/tmp,%S %S/branch-c-general.c | FileCheck %s 
-check-prefix=REPORT

dblaikie wrote:
> alanphipps wrote:
> > dblaikie wrote:
> > > This test depends on another test file as input which is generally not 
> > > done in the LLVM test suite - inputs to tests are placed in the "Inputs" 
> > > subdirectory, rather than in the test directory itself. I realize a few 
> > > other tests already here (demangle, hideUnexpectedSubviews, style, and 
> > > threads) already do this - but it'd be good to not add more cases (& fix 
> > > those existing cases where possible)
> > > 
> > > Could you fix this so this test (& possibly others, if you have the 
> > > opportunity/bandwidth) doesn't depend on other test files, but only on 
> > > files in the Inputs subdirectory?
> > Certainly I can do that -- I believe there are two other tests in which I 
> > did this other than this test: branch-export-json.txt and 
> > branch-export-lcov.test.  I will adjust those tests that I added within the 
> > next days but I don't think I have the bandwidth to change other tests that 
> > also do this.
> > 
> > 
> Sure thing, thanks a bunch!
> 
> At least having fewer instances of the unfavorable idioms means they're less 
> likely to be repeated in the future, even if there are some leftover 
> instances/anachronisms.
Changes have been committed here: https://reviews.llvm.org/rGebcc8dcb68aa
Thanks for pointing this out!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84467

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


[PATCH] D93638: [hip] Enable HIP compilation with ` on MSVC.

2021-01-07 Thread Michael Liao 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 rGf78d6af7319a: [hip] Enable HIP compilation with 
`complex` on MSVC. (authored by hliao).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93638

Files:
  clang/lib/Headers/__clang_hip_cmath.h


Index: clang/lib/Headers/__clang_hip_cmath.h
===
--- clang/lib/Headers/__clang_hip_cmath.h
+++ clang/lib/Headers/__clang_hip_cmath.h
@@ -624,6 +624,34 @@
 } // namespace std
 #endif
 
+// Define device-side math functions from  on MSVC.
+#if defined(_MSC_VER)
+#if defined(__cplusplus)
+extern "C" {
+#endif // defined(__cplusplus)
+__DEVICE__ __attribute__((overloadable)) double _Cosh(double x, double y) {
+  return cosh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FCosh(float x, float y) {
+  return coshf(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) short _Dtest(double *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) short _FDtest(float *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) double _Sinh(double x, double y) {
+  return sinh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
+  return sinhf(x) * y;
+}
+#if defined(__cplusplus)
+}
+#endif // defined(__cplusplus)
+#endif // defined(_MSC_VER)
+
 #pragma pop_macro("__DEVICE__")
 
 #endif // __CLANG_HIP_CMATH_H__


Index: clang/lib/Headers/__clang_hip_cmath.h
===
--- clang/lib/Headers/__clang_hip_cmath.h
+++ clang/lib/Headers/__clang_hip_cmath.h
@@ -624,6 +624,34 @@
 } // namespace std
 #endif
 
+// Define device-side math functions from  on MSVC.
+#if defined(_MSC_VER)
+#if defined(__cplusplus)
+extern "C" {
+#endif // defined(__cplusplus)
+__DEVICE__ __attribute__((overloadable)) double _Cosh(double x, double y) {
+  return cosh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FCosh(float x, float y) {
+  return coshf(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) short _Dtest(double *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) short _FDtest(float *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) double _Sinh(double x, double y) {
+  return sinh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
+  return sinhf(x) * y;
+}
+#if defined(__cplusplus)
+}
+#endif // defined(__cplusplus)
+#endif // defined(_MSC_VER)
+
 #pragma pop_macro("__DEVICE__")
 
 #endif // __CLANG_HIP_CMATH_H__
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f78d6af - [hip] Enable HIP compilation with ` on MSVC.

2021-01-07 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2021-01-07T17:41:28-05:00
New Revision: f78d6af7319aa676a0f9f6cbb982f21c96e9aac5

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

LOG: [hip] Enable HIP compilation with ` on MSVC.

- MSVC has different `` implementation which calls into functions
  declared in ``. Provide their device-side implementation to enable
  `` compilation on HIP Windows.

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

Added: 


Modified: 
clang/lib/Headers/__clang_hip_cmath.h

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_cmath.h 
b/clang/lib/Headers/__clang_hip_cmath.h
index 3a702587ee17..128d64e271b8 100644
--- a/clang/lib/Headers/__clang_hip_cmath.h
+++ b/clang/lib/Headers/__clang_hip_cmath.h
@@ -624,6 +624,34 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif
 
+// Define device-side math functions from  on MSVC.
+#if defined(_MSC_VER)
+#if defined(__cplusplus)
+extern "C" {
+#endif // defined(__cplusplus)
+__DEVICE__ __attribute__((overloadable)) double _Cosh(double x, double y) {
+  return cosh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FCosh(float x, float y) {
+  return coshf(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) short _Dtest(double *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) short _FDtest(float *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) double _Sinh(double x, double y) {
+  return sinh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
+  return sinhf(x) * y;
+}
+#if defined(__cplusplus)
+}
+#endif // defined(__cplusplus)
+#endif // defined(_MSC_VER)
+
 #pragma pop_macro("__DEVICE__")
 
 #endif // __CLANG_HIP_CMATH_H__



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


[PATCH] D94268: Allow _mm_empty() (via llvm.x86.mmx.emms) to be a no-op without MMX.

2021-01-07 Thread James Y Knight via Phabricator via cfe-commits
jyknight created this revision.
jyknight added reviewers: craig.topper, spatel, RKSimon.
Herald added subscribers: pengfei, hiraditya.
jyknight requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

In Clang, the other "MMX" intrinsic functions are being migrated to
SSE2, and will thus be usable even when compiling with -mno-mmx. These
SSE2 implementations don't require the use of _mm_empty(), but
existing (properly-written) code will still have calls to
_mm_empty(). It's therefore desirable to make the function a no-op in
this mode.

The function cannot be made a no-op universally, however, because MMX
may still be used by inline assembly. Therefore, have _mm_empty be
usable both with and without MMX -- and emit the LLVM intrinsic in
both cases, but cause the llvm intrinsic to generate an EMMS
instruction only if MMX is actually enabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94268

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/lib/Headers/mmintrin.h
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/mmx-emms.ll


Index: llvm/test/CodeGen/X86/mmx-emms.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/mmx-emms.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mcpu=i686 -mattr=+mmx < %s | FileCheck %s 
--check-prefixes=CHECK,CHECK-MMX
+; RUN: llc -mcpu=i686 -mattr=-mmx < %s | FileCheck %s --check-prefixes=CHECK
+; RUN: llc -mcpu=i686 -mattr=+sse2 < %s | FileCheck %s --check-prefixes=CHECK
+
+target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32"
+target triple = "i386-pc-linux-gnu"
+
+;; Verify that the llvm.x86.mmx.emms intrinsic works whether or not
+;; MMX is enabled, but that it doesn't emit any instructions if mmx is
+;; disabled.
+
+;; CHECK-LABEL: mmx_emms:
+;; CHECK: # %bb.0:
+;; CHECK-MMX-NEXT: emms
+;; CHECK-NEXT: retl
+define void @mmx_emms() {
+  tail call void @llvm.x86.mmx.emms() nounwind
+  ret void
+}
+
+declare void @llvm.x86.mmx.emms() nounwind
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -26170,6 +26170,14 @@
   return DAG.getNode(ISD::MERGE_VALUES, dl, Op->getVTList(), SetCC,
  Operation.getValue(1));
 }
+case Intrinsic::x86_mmx_emms: {
+  // Emit nothing for the EMMS intrinsic when MMX is disabled.
+  if (!Subtarget.hasMMX()) {
+SDValue Chain = Op.getOperand(0);
+return Chain;
+  }
+  return SDValue();
+}
 }
 return SDValue();
   }
Index: clang/lib/Headers/mmintrin.h
===
--- clang/lib/Headers/mmintrin.h
+++ clang/lib/Headers/mmintrin.h
@@ -41,14 +41,15 @@
 #define __anyext128(x) (__m128i)__builtin_shufflevector((__v2si)(x), 
__extension__ (__v2si){}, 0, 1, -1, -1)
 #define __extract2_32(a) (__m64)__builtin_shufflevector((__v4si)(a), 
__extension__ (__v4si){}, 0, 2);
 
-/// Clears the MMX state by setting the state of the x87 stack registers
-///to empty.
+/// Clears the MMX state by setting the state of the x87 stack registers to
+///empty. This intrinsic is accepted but emits no instructions if MMX is
+///disabled at compile-time (e.g. via -mno-mmx).
 ///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  EMMS  instruction.
 ///
-static __inline__ void  __attribute__((__always_inline__, __nodebug__, 
__target__("mmx")))
+static __inline__ void  __attribute__((__always_inline__, __nodebug__))
 _mm_empty(void)
 {
 __builtin_ia32_emms();
Index: clang/include/clang/Basic/BuiltinsX86.def
===
--- clang/include/clang/Basic/BuiltinsX86.def
+++ clang/include/clang/Basic/BuiltinsX86.def
@@ -83,7 +83,7 @@
 // MMX usage is no longer supported in Clang; all of the formerly "MMX"
 // intrinsic functions are now expanded into SSE2 code in the headers.
 
-TARGET_BUILTIN(__builtin_ia32_emms, "v", "n", "mmx")
+TARGET_BUILTIN(__builtin_ia32_emms, "v", "n", "")
 TARGET_BUILTIN(__builtin_ia32_vec_ext_v4hi, "sV4sIi", "ncV:64:", "sse")
 TARGET_BUILTIN(__builtin_ia32_vec_set_v4hi, "V4sV4ssIi", "ncV:64:", "sse")
 


Index: llvm/test/CodeGen/X86/mmx-emms.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/mmx-emms.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mcpu=i686 -mattr=+mmx < %s | FileCheck %s --check-prefixes=CHECK,CHECK-MMX
+; RUN: llc -mcpu=i686 -mattr=-mmx < %s | FileCheck %s --check-prefixes=CHECK
+; RUN: llc -mcpu=i686 -mattr=+sse2 < %s | FileCheck %s --check-prefixes=CHECK
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32"
+target triple = "i386-pc-linux-gnu"
+
+;; Verify that the llvm.x86.mmx.emms intrinsic works 

[PATCH] D94261: [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

2021-01-07 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny accepted this revision.
jdenny added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94261

___
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-07 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment.

In D92634#2484404 , @steakhal wrote:

> Here is a link for our results on a few more projects. It might be useful for 
> you.
> https://codechecker-demo.eastus.cloudapp.azure.com/Default/runs?run=D92634=50=name=false
> Note: use the diff to filter only for the new reports.

Thanks! Looks great.


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


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

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

> Typically in such cases bug visitors should be added/improved until it is 
> clear from the user-facing report why does the analyzer think so. They'd 
> highlight the important events, prevent path pruning, and potentially 
> suppress reports if the reason is discovered to not be valid.

Thanks! But in this case I do not think that my code works well.

I have reduced the test case:

  #include 
  
  #define LIBCERROR_MESSAGE_INCREMENT_SIZE64
  #define LIBCERROR_MESSAGE_MAXIMUM_SIZE  4096
  
  int get_print_count();
  
  void foo( )
  {
size_t message_size= 0;
size_t next_message_size   = 
LIBCERROR_MESSAGE_INCREMENT_SIZE;
int print_count= 0;
  
while (1)
{
if( next_message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE )
{
next_message_size = LIBCERROR_MESSAGE_MAXIMUM_SIZE;
}
  
message_size = next_message_size;
  
  
print_count = get_print_count();
  
if( print_count <= -1 )
{
next_message_size += LIBCERROR_MESSAGE_INCREMENT_SIZE;  
// <- Assigned value is garbage or undefined
}
else if( ( (size_t) print_count >= message_size ) )
{
next_message_size = (size_t) ( print_count + 1 );
print_count   = -1;
}
else
{
int error_string_size = (size_t) print_count + 1; // <- 
The result of the '+' expression is undefined
}
if( message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE )
{
break;
}
}
  }

I guess it's best that I rewrite my logic in a new check.

But well I have the feeling it could take a couple of days before I have 
something new..


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


[PATCH] D94265: [clangd] Search compiler in PATH for system include extraction If the compiler is specified by its name, search it in the system PATH instead of the command directory: this is what th

2021-01-07 Thread Quentin Chateau via Phabricator via cfe-commits
qchateau abandoned this revision.
qchateau added a comment.

Ah ! It's been done already !
https://reviews.llvm.org/D93600


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94265

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


[PATCH] D94257: [test] Move coro-retcon-unreachable.ll into llvm/test

2021-01-07 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd002cd4e0f10: [test] Move coro-retcon-unreachable.ll into 
llvm/test (authored by aeubanks).

Changed prior to commit:
  https://reviews.llvm.org/D94257?vs=315209=315240#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94257

Files:
  clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
  llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll




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


[clang] d002cd4 - [test] Move coro-retcon-unreachable.ll into llvm/test

2021-01-07 Thread Arthur Eubanks via cfe-commits

Author: Arthur Eubanks
Date: 2021-01-07T14:06:01-08:00
New Revision: d002cd4e0f10f20c4f8b419ffa23d782636e46d8

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

LOG: [test] Move coro-retcon-unreachable.ll into llvm/test

Reviewed By: rjmccall

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

Added: 
llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll

Modified: 


Removed: 
clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll



diff  --git a/clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll 
b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
similarity index 100%
rename from clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
rename to llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll



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


[PATCH] D94217: [clang-format] Find main include after block ended with #pragma hdrstop

2021-01-07 Thread Rafał Jelonek via Phabricator via cfe-commits
rjelonek updated this revision to Diff 315236.
rjelonek added a comment.

Use LF instead of CRLF for case with extended `#pragma hdrstop`


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

https://reviews.llvm.org/D94217

Files:
  clang/lib/Format/Format.cpp
  clang/unittests/Format/SortIncludesTest.cpp


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -879,6 +879,45 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, DoNotTreatPrecompiledHeadersAsFirstBlock) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+
+  Code = "#include \"d.h\"\n"
+ "#include \"b.h\"\n"
+ "#pragma hdrstop( \"c:\\projects\\include\\myinc.pch\" )\n"
+ "\n"
+ "#include \"c.h\"\n"
+ "#include \"a.h\"\n"
+ "#include \"e.h\"\n";
+
+  Expected = "#include \"b.h\"\n"
+ "#include \"d.h\"\n"
+ "#pragma hdrstop(\"c:\\projects\\include\\myinc.pch\")\n"
+ "\n"
+ "#include \"e.h\"\n"
+ "#include \"a.h\"\n"
+ "#include \"c.h\"\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2305,7 +2305,10 @@
 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code,
 Replaces, Cursor);
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;
+else
+  FirstIncludeBlock = false;
   }
   Prev = Pos + 1;
 }


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -879,6 +879,45 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, DoNotTreatPrecompiledHeadersAsFirstBlock) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+
+  Code = "#include \"d.h\"\n"
+ "#include \"b.h\"\n"
+ "#pragma hdrstop( \"c:\\projects\\include\\myinc.pch\" )\n"
+ "\n"
+ "#include \"c.h\"\n"
+ "#include \"a.h\"\n"
+ "#include \"e.h\"\n";
+
+  Expected = "#include \"b.h\"\n"
+ "#include \"d.h\"\n"
+ "#pragma hdrstop(\"c:\\projects\\include\\myinc.pch\")\n"
+ "\n"
+ "#include \"e.h\"\n"
+ "#include \"a.h\"\n"
+ "#include \"c.h\"\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2305,7 +2305,10 @@
 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code,
 Replaces, Cursor);
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;
+else
+  FirstIncludeBlock = false;
   }
   Prev = Pos + 1;
 }
___
cfe-commits mailing list

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

2021-01-07 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 315235.
njames93 marked an inline comment as done.
njames93 added a comment.

Address most comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93978

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/TUScheduler.h
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.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
@@ -74,7 +74,8 @@
   SelectionTree::createEach(AST.getASTContext(), AST.getTokens(), Range.first,
 Range.second, [&](SelectionTree ST) {
   Tweak::Selection S(Index, AST, Range.first,
- Range.second, std::move(ST));
+ Range.second, std::move(ST),
+ nullptr);
   if (auto T = prepareTweak(TweakID, S)) {
 Result = (*T)->apply(S);
 return true;
Index: clang-tools-extra/clangd/tool/Check.cpp
===
--- clang-tools-extra/clangd/tool/Check.cpp
+++ clang-tools-extra/clangd/tool/Check.cpp
@@ -202,7 +202,8 @@
   vlog("  {0} {1}", Pos, Tok.text(AST->getSourceManager()));
   auto Tree = SelectionTree::createRight(AST->getASTContext(),
  AST->getTokens(), Start, End);
-  Tweak::Selection Selection(, *AST, Start, End, std::move(Tree));
+  Tweak::Selection Selection(, *AST, Start, End, std::move(Tree),
+ nullptr);
   for (const auto  : prepareTweaks(Selection, Opts.TweakFilter)) {
 auto Result = T->apply(Selection);
 if (!Result) {
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
@@ -36,6 +36,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include 
 #include 
 
@@ -63,10 +64,9 @@
 }
 
 llvm::Optional getSourceFile(llvm::StringRef FileName,
-   const Tweak::Selection ) {
-  if (auto Source = getCorrespondingHeaderOrSource(
-  FileName,
-  >getSourceManager().getFileManager().getVirtualFileSystem()))
+   const Tweak::Selection ,
+   llvm::vfs::FileSystem *FS) {
+  if (auto Source = getCorrespondingHeaderOrSource(FileName, FS))
 return *Source;
   return getCorrespondingHeaderOrSource(FileName, *Sel.AST, Sel.Index);
 }
@@ -403,13 +403,14 @@
 if (!MainFileName)
   return error("Couldn't get absolute path for main file.");
 
-auto CCFile = getSourceFile(*MainFileName, Sel);
+auto *FS = Sel.FS;
+assert(FS && "FS Must be set in apply");
+
+auto CCFile = getSourceFile(*MainFileName, Sel, FS);
+
 if (!CCFile)
   return error("Couldn't find a suitable implementation file.");
-
-auto  =
-Sel.AST->getSourceManager().getFileManager().getVirtualFileSystem();
-auto Buffer = FS.getBufferForFile(*CCFile);
+auto Buffer = FS->getBufferForFile(*CCFile);
 // FIXME: Maybe we should consider creating the implementation file if it
 // doesn't exist?
 if (!Buffer)
Index: clang-tools-extra/clangd/refactor/Tweak.h
===
--- clang-tools-extra/clangd/refactor/Tweak.h
+++ clang-tools-extra/clangd/refactor/Tweak.h
@@ -30,6 +30,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include 
 
 namespace clang {
@@ -48,7 +49,8 @@
   /// Input to prepare and apply tweaks.
   struct Selection {
 Selection(const SymbolIndex *Index, ParsedAST , unsigned RangeBegin,
-  unsigned RangeEnd, SelectionTree ASTSelection);
+  unsigned RangeEnd, SelectionTree ASTSelection,
+  llvm::vfs::FileSystem *VFS);
 /// The text of the active document.
 llvm::StringRef Code;
 /// The Index for handling codebase related queries.
@@ -64,6 +66,11 @@
 unsigned SelectionEnd;
 /// The AST nodes that were selected.

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

2021-01-07 Thread Nathan James via Phabricator via cfe-commits
njames93 marked 9 inline comments as done.
njames93 added inline comments.



Comment at: clang-tools-extra/clangd/TUScheduler.h:248
+  /// ontop of \p Base.
+  llvm::IntrusiveRefCntPtr overlayFileContents(
+  llvm::IntrusiveRefCntPtr Base) const;

sammccall wrote:
> sammccall wrote:
> > nit: take const TFS& as arg, as this function is designed for caller 
> > convenience and that's always how it'll be used
> nit: return `unique_ptr` (which can implicitly convert)
I think the flexibility of passing a `Filesystem` is better than the 
`ThreadsafeFS`.



Comment at: clang-tools-extra/clangd/refactor/Tweak.h:53
+  unsigned RangeEnd, SelectionTree ASTSelection,
+  llvm::vfs::FileSystem *VFS);
 /// The text of the active document.

sammccall wrote:
> VFS is a public field, and optional, so we could omit it from the constructor 
> and assign it explicitly instead.
We could, but it would messy code elsewhere.



Comment at: clang-tools-extra/clangd/tool/Check.cpp:206
+  Tweak::Selection Selection(, *AST, Start, End, std::move(Tree),
+ nullptr);
   for (const auto  : prepareTweaks(Selection, Opts.TweakFilter)) {

sammccall wrote:
> hmm, I see.
> 
> What if we make the Selection constructor fill in the default FS from AST, 
> and then just overwrote the public field in ClangdServer::applyTweak?
> 
> Then we get the FS always being set (good for tweaks), simple usage here or 
> in tests, and the expensive copy is still explicit...
I've gone with an approach that the FS gets passed in the constructor, if 
nullptr is passed then we use the fallback, helpful for tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93978

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


[PATCH] D94265: [clangd] Search compiler in PATH for system include extraction If the compiler is specified by its name, search it in the system PATH instead of the command directory: this is what th

2021-01-07 Thread Quentin Chateau via Phabricator via cfe-commits
qchateau created this revision.
qchateau added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman.
qchateau requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94265

Files:
  clang-tools-extra/clangd/QueryDriverDatabase.cpp


Index: clang-tools-extra/clangd/QueryDriverDatabase.cpp
===
--- clang-tools-extra/clangd/QueryDriverDatabase.cpp
+++ clang-tools-extra/clangd/QueryDriverDatabase.cpp
@@ -136,24 +136,21 @@
 }
 
 llvm::Optional
-extractSystemIncludesAndTarget(PathRef Driver, llvm::StringRef Lang,
+extractSystemIncludesAndTarget(llvm::StringRef Driver, llvm::StringRef Lang,
llvm::ArrayRef CommandLine,
const llvm::Regex ) {
   trace::Span Tracer("Extract system includes and target");
   SPAN_ATTACH(Tracer, "driver", Driver);
   SPAN_ATTACH(Tracer, "lang", Lang);
 
-  if (!QueryDriverRegex.match(Driver)) {
-vlog("System include extraction: not allowed driver {0}", Driver);
+  auto DriverPath = llvm::sys::findProgramByName(Driver);
+  if (auto Error = DriverPath.getError()) {
+elog("System include extraction: {0} - {1}", Error.message(), Driver);
 return llvm::None;
   }
 
-  if (!llvm::sys::fs::exists(Driver)) {
-elog("System include extraction: {0} does not exist.", Driver);
-return llvm::None;
-  }
-  if (!llvm::sys::fs::can_execute(Driver)) {
-elog("System include extraction: {0} is not executable.", Driver);
+  if (!QueryDriverRegex.match(*DriverPath)) {
+vlog("System include extraction: not allowed driver {0}", *DriverPath);
 return llvm::None;
   }
 
@@ -171,8 +168,8 @@
   llvm::Optional Redirects[] = {
   {""}, {""}, llvm::StringRef(StdErrPath)};
 
-  llvm::SmallVector Args = {Driver, "-E", "-x",
- Lang,   "-",  "-v"};
+  llvm::SmallVector Args = {*DriverPath, "-E", "-x",
+ Lang,"-",  "-v"};
 
   // These flags will be preserved
   const llvm::StringRef FlagsToPreserve[] = {
@@ -203,8 +200,8 @@
 }
   }
 
-  if (int RC = llvm::sys::ExecuteAndWait(Driver, Args, /*Env=*/llvm::None,
- Redirects)) {
+  if (int RC = llvm::sys::ExecuteAndWait(*DriverPath, Args,
+ /*Env=*/llvm::None, Redirects)) {
 elog("System include extraction: driver execution failed with return code: 
"
  "{0}. Args: ['{1}']",
  llvm::to_string(RC), llvm::join(Args, "', '"));
@@ -224,7 +221,7 @@
 return llvm::None;
   log("System includes extractor: successfully executed {0}\n\tgot includes: "
   "\"{1}\"\n\tgot target: \"{2}\"",
-  Driver, llvm::join(Info->SystemIncludes, ", "), Info->Target);
+  *DriverPath, llvm::join(Info->SystemIncludes, ", "), Info->Target);
   return Info;
 }
 
@@ -332,7 +329,6 @@
 }
 
 llvm::SmallString<128> Driver(Cmd->CommandLine.front());
-llvm::sys::fs::make_absolute(Cmd->Directory, Driver);
 
 if (auto Info =
 QueriedDrivers.get(/*Key=*/(Driver + ":" + Lang).str(), [&] {


Index: clang-tools-extra/clangd/QueryDriverDatabase.cpp
===
--- clang-tools-extra/clangd/QueryDriverDatabase.cpp
+++ clang-tools-extra/clangd/QueryDriverDatabase.cpp
@@ -136,24 +136,21 @@
 }
 
 llvm::Optional
-extractSystemIncludesAndTarget(PathRef Driver, llvm::StringRef Lang,
+extractSystemIncludesAndTarget(llvm::StringRef Driver, llvm::StringRef Lang,
llvm::ArrayRef CommandLine,
const llvm::Regex ) {
   trace::Span Tracer("Extract system includes and target");
   SPAN_ATTACH(Tracer, "driver", Driver);
   SPAN_ATTACH(Tracer, "lang", Lang);
 
-  if (!QueryDriverRegex.match(Driver)) {
-vlog("System include extraction: not allowed driver {0}", Driver);
+  auto DriverPath = llvm::sys::findProgramByName(Driver);
+  if (auto Error = DriverPath.getError()) {
+elog("System include extraction: {0} - {1}", Error.message(), Driver);
 return llvm::None;
   }
 
-  if (!llvm::sys::fs::exists(Driver)) {
-elog("System include extraction: {0} does not exist.", Driver);
-return llvm::None;
-  }
-  if (!llvm::sys::fs::can_execute(Driver)) {
-elog("System include extraction: {0} is not executable.", Driver);
+  if (!QueryDriverRegex.match(*DriverPath)) {
+vlog("System include extraction: not allowed driver {0}", *DriverPath);
 return llvm::None;
   }
 
@@ -171,8 +168,8 @@
   llvm::Optional Redirects[] = {
   {""}, {""}, llvm::StringRef(StdErrPath)};
 
-  llvm::SmallVector Args = {Driver, "-E", "-x",
- Lang,   "-",  "-v"};
+  llvm::SmallVector Args = {*DriverPath, "-E", "-x",
+  

[PATCH] D94206: [clang-format] turn on formatting after "clang-format on" while sorting includes

2021-01-07 Thread Rafał Jelonek via Phabricator via cfe-commits
rjelonek added a comment.

I do not have commit access.


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

https://reviews.llvm.org/D94206

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


[PATCH] D94257: [test] Move coro-retcon-unreachable.ll into llvm/test

2021-01-07 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Yeah, that's definitely an LLVM test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94257

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


[PATCH] D94217: [clang-format] Find main include after block ended with #pragma hdrstop

2021-01-07 Thread Rafał Jelonek via Phabricator via cfe-commits
rjelonek added a comment.

In D94217#2485178 , @curdeius wrote:

> LGTM if you add a test for hdrstop(filename) and possibly with LF newline (as 
> the test you've already added tests CRLF).

You would like to 2 unit tests called 
`DoNotTreatPrecompiledHeadersAsFirstBlockCRLF` and 
'DoNotTreatPrecompiledHeadersAsFirstBlockLF`?


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

https://reviews.llvm.org/D94217

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


[PATCH] D93038: [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

2021-01-07 Thread Shilei Tian via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG63b42a051456: [NFC] clang/test/openMP/target_codegen.cpp 
should not depend on ssa name (authored by jeroen.dobbelaere, committed by 
tianshilei1992).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93038

Files:
  clang/test/OpenMP/target_codegen.cpp


Index: clang/test/OpenMP/target_codegen.cpp
===
--- clang/test/OpenMP/target_codegen.cpp
+++ clang/test/OpenMP/target_codegen.cpp
@@ -397,7 +397,7 @@
 // CHECK-DAG: [[RET:%.+]] = call i32 
@__tgt_target_nowait_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE:%.+]], i8* 
@{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i64* [[SIZE:%.+]], 
i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), 
i8** null, i8** null)
 // CHECK-DAG: [[DEVICE]] = sext i32 [[DEV:%.+]] to i64
 // CHECK-DAG: [[DEV]] = load i32, i32* [[DEVADDR:%.+]], align
-// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* 
%12, i32 0, i32 2
+// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* 
{{%.+}}, i32 0, i32 2
 // CHECK-DAG: [[BPR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* 
[[BPRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[PR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* 
[[PRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[SIZE]] = getelementptr inbounds [2 x i64], [2 x i64]* 
[[SIZEADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0


Index: clang/test/OpenMP/target_codegen.cpp
===
--- clang/test/OpenMP/target_codegen.cpp
+++ clang/test/OpenMP/target_codegen.cpp
@@ -397,7 +397,7 @@
 // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_nowait_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE:%.+]], i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i64* [[SIZE:%.+]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), i8** null, i8** null)
 // CHECK-DAG: [[DEVICE]] = sext i32 [[DEV:%.+]] to i64
 // CHECK-DAG: [[DEV]] = load i32, i32* [[DEVADDR:%.+]], align
-// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* %12, i32 0, i32 2
+// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* {{%.+}}, i32 0, i32 2
 // CHECK-DAG: [[BPR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BPRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[PR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[SIZE]] = getelementptr inbounds [2 x i64], [2 x i64]* [[SIZEADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 63b42a0 - [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

2021-01-07 Thread Shilei Tian via cfe-commits

Author: Jeroen Dobbelaere
Date: 2021-01-07T16:39:17-05:00
New Revision: 63b42a0514567d24df617e4587e80e4564ebf120

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

LOG: [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

This makes the test more robust to other changes.

Reviewed By: tianshilei1992

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

Added: 


Modified: 
clang/test/OpenMP/target_codegen.cpp

Removed: 




diff  --git a/clang/test/OpenMP/target_codegen.cpp 
b/clang/test/OpenMP/target_codegen.cpp
index c504ff6b7ac6..7dafa6ba13d4 100644
--- a/clang/test/OpenMP/target_codegen.cpp
+++ b/clang/test/OpenMP/target_codegen.cpp
@@ -397,7 +397,7 @@ int foo(int n) {
 // CHECK-DAG: [[RET:%.+]] = call i32 
@__tgt_target_nowait_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE:%.+]], i8* 
@{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i64* [[SIZE:%.+]], 
i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), 
i8** null, i8** null)
 // CHECK-DAG: [[DEVICE]] = sext i32 [[DEV:%.+]] to i64
 // CHECK-DAG: [[DEV]] = load i32, i32* [[DEVADDR:%.+]], align
-// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* 
%12, i32 0, i32 2
+// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* 
{{%.+}}, i32 0, i32 2
 // CHECK-DAG: [[BPR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* 
[[BPRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[PR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* 
[[PRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[SIZE]] = getelementptr inbounds [2 x i64], [2 x i64]* 
[[SIZEADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0



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


[PATCH] D94261: [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

2021-01-07 Thread Valentin Clement via Phabricator via cfe-commits
clementval created this revision.
clementval added reviewers: dlj, jdenny.
Herald added subscribers: steven.zhang, shchenz, nemanjai.
clementval requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

While trying to compile clang and openmp with a freshly built clang with the 
gcc/7.4.0
toolchain on the Summit supercomputer I face some error because of the triple 
under which
the GCC toolchain is installed was not present in for PPC64LE triples.
This patch add the powerpc64le-none-linux-gnu used on system like Summit and 
Ascent.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94261

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94217: [clang-format] Find main include after block ended with #pragma hdrstop

2021-01-07 Thread Rafał Jelonek via Phabricator via cfe-commits
rjelonek updated this revision to Diff 315223.
rjelonek added a comment.

Add test to check extended form of `#pragma hdrstop`


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

https://reviews.llvm.org/D94217

Files:
  clang/lib/Format/Format.cpp
  clang/unittests/Format/SortIncludesTest.cpp


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -879,6 +879,45 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, DoNotTreatPrecompiledHeadersAsFirstBlock) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+
+  Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop( \"c:\\projects\\include\\myinc.pch\" )\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop(\"c:\\projects\\include\\myinc.pch\")\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2305,7 +2305,10 @@
 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code,
 Replaces, Cursor);
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;
+else
+  FirstIncludeBlock = false;
   }
   Prev = Pos + 1;
 }


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -879,6 +879,45 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, DoNotTreatPrecompiledHeadersAsFirstBlock) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+
+  Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop( \"c:\\projects\\include\\myinc.pch\" )\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop(\"c:\\projects\\include\\myinc.pch\")\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2305,7 +2305,10 @@
 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code,
 Replaces, Cursor);
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;
+else
+  FirstIncludeBlock = false;
   }
   Prev = Pos + 1;
 }

[PATCH] D93668: [clang] Add -ffuchsia-c++-abi flag to explicitly use the Fuchsia C++ ABI

2021-01-07 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

In D93668#2482986 , @phosek wrote:

> I'd prefer to use the target triple rather than introducing a custom flag.
>
> With dedicated flags, you might eventually end up in a similar situation as 
> D85802 , that is in the extreme case you 
> might end up with `-f[no-]fuchsia-c++-abi`, `-f[no-]webassembly-c++-abi`, 
> etc. which is not any better than `-fc++-abi=`.
>
> With target triple, I can imagine using either 
> `-unknown-fuchsia-itanium` or `-unknown-fuchsia-gnu`, where the 
> former would mean targeting Fuchsia with Itanium C++ ABI while the latter 
> would mean using GCC compatible ABI (which would imply Itanium C++ ABI). Both 
> of these are already used by MinGW for the same purpose so there's a 
> precedent and we don't need to invent anything new.

@mcgrathr Would you be fine with using the triple instead of a new flag in this 
case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93668

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


[PATCH] D94169: [clang][driver] Restore the original help text for `-I`

2021-01-07 Thread Andrei Lebedev via Phabricator via cfe-commits
andreil99 added a comment.

Post commit review is a normal practice in the LLVM community. This is not an 
excuse to revert somebody's patch per se, unless there are other serious 
reasons for the revert.  The text does not describe “clang internals”, it 
describes the semantic of that flag with respect to other flags specifically to 
clang (I’m sure the text could be improved and open to suggestions).

At the time when the original patch was done this td file was not shared with 
flang and such plans weren’t announced, it was quite the opposite, one of the 
flang driver RFCs specifically mentioned a separate *.td file, if memory serves 
me well.  And I do apologize if I missed something, I didn’t follow flang 
discussions closely back in July/August of the last year.

Now since you have started sharing, we need to find a good way to have 
front-end specifics in the documentation, which happens to be auto-generated 
from a shared td file. Stripping it down to only matching subset of things 
between multiple different front-ends would hurt documentation quality. Let’s 
discuss here of what could be done about that, or feel free to move the 
discussion somewhere else.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94169

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


[PATCH] D94259: [clangd] Fix type printing in the presence of qualifiers

2021-01-07 Thread Adam Czachorowski via Phabricator via cfe-commits
adamcz created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman.
adamcz requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

When printing QualType with qualifiers like "const", or pointing to an
elaborated type, we would print garbage like:

  std::const std::vector&

with the initial std:: being calculated correctly, but inserted in the
wrong place and the second std:: not removed (due to elaborated type).

This affected, among others, ExtractFunction and ExpandAuto tweaks.

This change introduces a new callback to PrintingPolicy, which allows us
to influence the printing of namespace qualifiers. In the future, the
same callback can be used to improve handling of "using namespace"
directives as well.

Fixes:

  https://github.com/clangd/clangd/issues/640 (ExtractFunction)
  https://github.com/clangd/clangd/issues/264 (ExpandAuto)
  First point of https://github.com/clangd/clangd/issues/524


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94259

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/ExtractFunctionTests.cpp
  clang/include/clang/AST/PrettyPrinter.h
  clang/lib/AST/TypePrinter.cpp

Index: clang/lib/AST/TypePrinter.cpp
===
--- clang/lib/AST/TypePrinter.cpp
+++ clang/lib/AST/TypePrinter.cpp
@@ -1229,6 +1229,9 @@
 if (Policy.SuppressUnwrittenScope && NS->isAnonymousNamespace())
   return AppendScope(DC->getParent(), OS, NameInScope);
 
+if (Policy.Callbacks && Policy.Callbacks->isNamespaceVisible(NS))
+  return;
+
 // Only suppress an inline namespace if the name has the same lookup
 // results in the enclosing namespace.
 if (Policy.SuppressInlineNamespace && NS->isInline() && NameInScope &&
Index: clang/include/clang/AST/PrettyPrinter.h
===
--- clang/include/clang/AST/PrettyPrinter.h
+++ clang/include/clang/AST/PrettyPrinter.h
@@ -19,6 +19,7 @@
 namespace clang {
 
 class LangOptions;
+class NamespaceDecl;
 class SourceManager;
 class Stmt;
 class TagDecl;
@@ -39,6 +40,15 @@
   virtual std::string remapPath(StringRef Path) const {
 return std::string(Path);
   }
+
+  /// When printing type to be inserted into code in specific context, this
+  /// callback can be used to avoid printing the redundant part of the
+  /// qualifier. For example, when inserting code inside namespace foo, we
+  /// should print bar::SomeType instead of foo::bar::SomeType.
+  /// To do this, isNamespaceVisible should return true on "foo" NamespaceDecl.
+  virtual bool isNamespaceVisible(const NamespaceDecl *NS) const {
+return false;
+  }
 };
 
 /// Describes how types, statements, expressions, and declarations should be
Index: clang-tools-extra/clangd/unittests/tweaks/ExtractFunctionTests.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/ExtractFunctionTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/ExtractFunctionTests.cpp
@@ -97,6 +97,22 @@
 })cpp";
   EXPECT_EQ(apply(ConstCheckInput), ConstCheckOutput);
 
+  // Check const qualifier with namespace
+  std::string ConstNamespaceCheckInput = R"cpp(
+namespace X { struct Y { int z; }; }
+int f(const X::Y ) {
+  [[return y.z + y.z;]]
+})cpp";
+  std::string ConstNamespaceCheckOutput = R"cpp(
+namespace X { struct Y { int z; }; }
+int extracted(const X::Y ) {
+return y.z + y.z;
+}
+int f(const X::Y ) {
+  return extracted(y);
+})cpp";
+  EXPECT_EQ(apply(ConstNamespaceCheckInput), ConstNamespaceCheckOutput);
+
   // Don't extract when we need to make a function as a parameter.
   EXPECT_THAT(apply("void f() { [[int a; f();]] }"), StartsWith("fail"));
 
Index: clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
@@ -65,6 +65,9 @@
   EXPECT_EQ(apply(R"cpp(au^to x = "test";)cpp"),
 R"cpp(const char * x = "test";)cpp");
 
+  EXPECT_EQ(apply("ns::Class * foo() { au^to c = foo(); }"),
+"ns::Class * foo() { ns::Class * c = foo(); }");
+
   EXPECT_UNAVAILABLE("dec^ltype(au^to) x = 10;");
   // expanding types in structured bindings is syntactically invalid.
   EXPECT_UNAVAILABLE("const ^auto &[x,y] = (int[]){1,2};");
Index: clang-tools-extra/clangd/AST.cpp
===
--- clang-tools-extra/clangd/AST.cpp
+++ clang-tools-extra/clangd/AST.cpp
@@ -299,19 +299,27 @@
   return SymbolID(USR);
 }
 
-// FIXME: This should be handled while printing underlying decls instead.
 std::string printType(const QualType QT, const DeclContext ) {
   

[PATCH] D94185: [OpenMP][Docs] Mark finished features as done

2021-01-07 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e7101530dae: [OpenMP][Docs] Mark finished features as done 
(authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94185

Files:
  clang/docs/OpenMPSupport.rst


Index: clang/docs/OpenMPSupport.rst
===
--- clang/docs/OpenMPSupport.rst
+++ clang/docs/OpenMPSupport.rst
@@ -193,7 +193,7 @@
 
+--+--+--+---+
 | device extension | implicitly map 'this' (this[:1])  
   | :good:`done` | D55982  
  |
 
+--+--+--+---+
-| device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`worked on`|   
|
+| device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`done` |   
|
 
+--+--+--+---+
 | device extension | requires directive
   | :part:`partial`  | 
  |
 
+--+--+--+---+
@@ -215,7 +215,7 @@
 
+--+--+--+---+
 | device extension | support close modifier on map clause  
   | :good:`done` | D55719,D55892   
  |
 
+--+--+--+---+
-| device extension | teams construct on the host device
   | :part:`worked on`| Clang part is done, r371553.
  |
+| device extension | teams construct on the host device
   | :part:`done` | r371553 
  |
 
+--+--+--+---+
 | device extension | support non-contiguous array sections for 
target update  | :good:`done` | 
  |
 
+--+--+--+---+


Index: clang/docs/OpenMPSupport.rst
===
--- clang/docs/OpenMPSupport.rst
+++ clang/docs/OpenMPSupport.rst
@@ -193,7 +193,7 @@
 +--+--+--+---+
 | device extension | implicitly map 'this' (this[:1]) | :good:`done` | D55982|
 +--+--+--+---+
-| device extension | allow access to the reference count (omp_target_is_present)  | :part:`worked on`|   |
+| device extension | allow access to the reference count (omp_target_is_present)  | :part:`done` |   |
 

[clang] 6e71015 - [OpenMP][Docs] Mark finished features as done

2021-01-07 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2021-01-07T14:39:18-06:00
New Revision: 6e7101530dae78efd7b5cdffc1338790ed3e5705

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

LOG: [OpenMP][Docs] Mark finished features as done

Reviewed By: ABataev

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

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index afa357a4d873..f0d8e8741304 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -193,7 +193,7 @@ implementation.
 
+--+--+--+---+
 | device extension | implicitly map 'this' (this[:1])  
   | :good:`done` | D55982  
  |
 
+--+--+--+---+
-| device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`worked on`|   
|
+| device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`done` |   
|
 
+--+--+--+---+
 | device extension | requires directive
   | :part:`partial`  | 
  |
 
+--+--+--+---+
@@ -215,7 +215,7 @@ implementation.
 
+--+--+--+---+
 | device extension | support close modifier on map clause  
   | :good:`done` | D55719,D55892   
  |
 
+--+--+--+---+
-| device extension | teams construct on the host device
   | :part:`worked on`| Clang part is done, r371553.
  |
+| device extension | teams construct on the host device
   | :part:`done` | r371553 
  |
 
+--+--+--+---+
 | device extension | support non-contiguous array sections for 
target update  | :good:`done` | 
  |
 
+--+--+--+---+



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


[PATCH] D92892: [clang] Change builtin object size to be compatible with GCC when sub-object is invalid

2021-01-07 Thread George Burgess IV via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG275f30df8ad6: [clang] Change builtin object size when 
subobject is invalid (authored by jtmott-intel, committed by george.burgess.iv).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92892

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/CodeGen/object-size.c


Index: clang/test/CodeGen/object-size.c
===
--- clang/test/CodeGen/object-size.c
+++ clang/test/CodeGen/object-size.c
@@ -310,7 +310,7 @@
 void test25() {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 2);
@@ -321,7 +321,7 @@
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 2);
@@ -337,7 +337,7 @@
 
   // CHECK: store i32 316
   gi = OBJECT_SIZE_BUILTIN([1].v[11], 0);
-  // CHECK: store i32 312
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([1].v[12], 1);
   // CHECK: store i32 308
   gi = OBJECT_SIZE_BUILTIN([1].v[13], 2);
@@ -433,7 +433,7 @@
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 true, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 2);
@@ -518,7 +518,7 @@
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN([9].snd[0], 1);
 
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([9].snd[0], 1);
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -11408,9 +11408,9 @@
   return false;
   }
 
-  // If we point to before the start of the object, there are no accessible
-  // bytes.
-  if (LVal.getLValueOffset().isNegative()) {
+  // If we point outside of the object, there are no accessible bytes.
+  if (LVal.getLValueOffset().isNegative() ||
+  ((Type & 1) && !LVal.Designator.isValidSubobject())) {
 Size = 0;
 return true;
   }


Index: clang/test/CodeGen/object-size.c
===
--- clang/test/CodeGen/object-size.c
+++ clang/test/CodeGen/object-size.c
@@ -310,7 +310,7 @@
 void test25() {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 2);
@@ -321,7 +321,7 @@
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 2);
@@ -337,7 +337,7 @@
 
   // CHECK: store i32 316
   gi = OBJECT_SIZE_BUILTIN([1].v[11], 0);
-  // CHECK: store i32 312
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([1].v[12], 1);
   // CHECK: store i32 308
   gi = OBJECT_SIZE_BUILTIN([1].v[13], 2);
@@ -433,7 +433,7 @@
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 2);
@@ -518,7 +518,7 @@
   // CHECK: call i64 

[clang] 275f30d - [clang] Change builtin object size when subobject is invalid

2021-01-07 Thread George Burgess IV via cfe-commits

Author: Jeffrey T Mott
Date: 2021-01-07T12:34:07-08:00
New Revision: 275f30df8ad6de75e1f29e4b33eaeb67686caf0d

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

LOG: [clang] Change builtin object size when subobject is invalid

Motivating example:

```
  struct { int v[10]; } t[10];

  __builtin_object_size(
  [0].v[11], // access past end of subobject
  1// request remaining bytes of closest surrounding
   // subobject
  );
```

In GCC, this returns 0. https://godbolt.org/z/7TeGs7

In current clang, however, this returns 356, the number of bytes
remaining in the whole variable, as if the `type` was 0 instead of 1.
https://godbolt.org/z/6Kffox

This patch checks for the specific case where we're requesting a
subobject's size (type 1) but the subobject is invalid.

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

Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp
clang/test/CodeGen/object-size.c

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 56181bbe1166..b153e22259f7 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -11408,9 +11408,9 @@ static bool tryEvaluateBuiltinObjectSize(const Expr *E, 
unsigned Type,
   return false;
   }
 
-  // If we point to before the start of the object, there are no accessible
-  // bytes.
-  if (LVal.getLValueOffset().isNegative()) {
+  // If we point outside of the object, there are no accessible bytes.
+  if (LVal.getLValueOffset().isNegative() ||
+  ((Type & 1) && !LVal.Designator.isValidSubobject())) {
 Size = 0;
 return true;
   }

diff  --git a/clang/test/CodeGen/object-size.c 
b/clang/test/CodeGen/object-size.c
index ff54b11a0f04..dbf286138454 100644
--- a/clang/test/CodeGen/object-size.c
+++ b/clang/test/CodeGen/object-size.c
@@ -310,7 +310,7 @@ void test24() {
 void test25() {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 2);
@@ -321,7 +321,7 @@ void test25() {
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 2);
@@ -337,7 +337,7 @@ void test26() {
 
   // CHECK: store i32 316
   gi = OBJECT_SIZE_BUILTIN([1].v[11], 0);
-  // CHECK: store i32 312
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([1].v[12], 1);
   // CHECK: store i32 308
   gi = OBJECT_SIZE_BUILTIN([1].v[13], 2);
@@ -433,7 +433,7 @@ void test29(struct DynStructVar *dv, struct DynStruct0 *d0,
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 true, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 2);
@@ -518,7 +518,7 @@ void test31() {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN([9].snd[0], 1);
 
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([9].snd[0], 1);
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1



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


[PATCH] D94257: [test] Move coro-retcon-unreachable.ll into llvm/test

2021-01-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added a subscriber: lxfind.
aeubanks requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94257

Files:
  clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
  llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll


Index: clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
===
--- /dev/null
+++ clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
@@ -1,46 +0,0 @@
-; RUN: opt < %s -coro-early -coro-split -S | FileCheck %s
-target datalayout = "E-p:64:64"
-
-%swift.type = type { i64 }
-%swift.opaque = type opaque
-%T4red215EmptyCollectionV = type opaque
-%TSi = type <{ i64 }>
-
-define hidden swiftcc { i8*, %swift.opaque* } @no_suspends(i8* %buffer, i64 
%arg) #1 {
-  %id = call token @llvm.coro.id.retcon.once(i32 32, i32 8, i8* %buffer, i8* 
bitcast (void (i8*, i1)* @prototype to i8*), i8* bitcast (i8* (i64)* @malloc to 
i8*), i8* bitcast (void (i8*)* @free to i8*))
-  %begin = call i8* @llvm.coro.begin(token %id, i8* null)
-  call void @print(i64 %arg)
-  call void @llvm.trap()
-  unreachable
-
-bb1:
-  call void @print(i64 %arg)
-  call i1 @llvm.coro.end(i8* %begin, i1 false)
-  unreachable
-}
-; CHECK-LABEL: define hidden swiftcc { i8*, %swift.opaque* } @no_suspends(
-; CHECK: call token @llvm.coro.id.retcon.once
-; CHECK-NEXT:call void @print(i64 %arg)
-; CHECK-NEXT:call void @llvm.trap()
-; CHECK-NEXT:unreachable
-
-declare swiftcc void @prototype(i8* noalias dereferenceable(32), i1)
-declare void @print(i64)
-
-declare noalias i8* @malloc(i64) #5
-declare void @free(i8* nocapture) #5
-
-declare token @llvm.coro.id.retcon.once(i32, i32, i8*, i8*, i8*, i8*) #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #5
-declare token @llvm.coro.alloca.alloc.i64(i64, i32) #5
-declare i8* @llvm.coro.alloca.get(token) #5
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #6
-declare i1 @llvm.coro.suspend.retcon.i1(...) #5
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #6
-declare void @llvm.coro.alloca.free(token) #5
-declare i1 @llvm.coro.end(i8*, i1) #5
-
-declare void @llvm.trap()
-
-attributes #1 = { noreturn nounwind }
-attributes #5 = { nounwind }


Index: clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
===
--- /dev/null
+++ clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
@@ -1,46 +0,0 @@
-; RUN: opt < %s -coro-early -coro-split -S | FileCheck %s
-target datalayout = "E-p:64:64"
-
-%swift.type = type { i64 }
-%swift.opaque = type opaque
-%T4red215EmptyCollectionV = type opaque
-%TSi = type <{ i64 }>
-
-define hidden swiftcc { i8*, %swift.opaque* } @no_suspends(i8* %buffer, i64 %arg) #1 {
-  %id = call token @llvm.coro.id.retcon.once(i32 32, i32 8, i8* %buffer, i8* bitcast (void (i8*, i1)* @prototype to i8*), i8* bitcast (i8* (i64)* @malloc to i8*), i8* bitcast (void (i8*)* @free to i8*))
-  %begin = call i8* @llvm.coro.begin(token %id, i8* null)
-  call void @print(i64 %arg)
-  call void @llvm.trap()
-  unreachable
-
-bb1:
-  call void @print(i64 %arg)
-  call i1 @llvm.coro.end(i8* %begin, i1 false)
-  unreachable
-}
-; CHECK-LABEL: define hidden swiftcc { i8*, %swift.opaque* } @no_suspends(
-; CHECK: call token @llvm.coro.id.retcon.once
-; CHECK-NEXT:call void @print(i64 %arg)
-; CHECK-NEXT:call void @llvm.trap()
-; CHECK-NEXT:unreachable
-
-declare swiftcc void @prototype(i8* noalias dereferenceable(32), i1)
-declare void @print(i64)
-
-declare noalias i8* @malloc(i64) #5
-declare void @free(i8* nocapture) #5
-
-declare token @llvm.coro.id.retcon.once(i32, i32, i8*, i8*, i8*, i8*) #5
-declare i8* @llvm.coro.begin(token, i8* writeonly) #5
-declare token @llvm.coro.alloca.alloc.i64(i64, i32) #5
-declare i8* @llvm.coro.alloca.get(token) #5
-declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #6
-declare i1 @llvm.coro.suspend.retcon.i1(...) #5
-declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #6
-declare void @llvm.coro.alloca.free(token) #5
-declare i1 @llvm.coro.end(i8*, i1) #5
-
-declare void @llvm.trap()
-
-attributes #1 = { noreturn nounwind }
-attributes #5 = { nounwind }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93785: [OpenMP][FIX] Ensure the isa trait is evaluated last

2021-01-07 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG36c4dc9b42fe: [OpenMP][FIX] Ensure the isa trait is 
evaluated last (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93785

Files:
  clang/test/OpenMP/begin_declare_variant_messages.c
  clang/test/OpenMP/declare_variant_messages.c
  clang/test/OpenMP/declare_variant_messages.cpp
  clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -1017,14 +1017,6 @@
 __OMP_TRAIT_PROPERTY(device, kind, fpga)
 __OMP_TRAIT_PROPERTY(device, kind, any)
 
-__OMP_TRAIT_SELECTOR(device, isa, true)
-
-// We use "__ANY" as a placeholder in the isa property to denote the
-// conceptual "any", not the literal `any` used in kind. The string we
-// we use is not important except that it will show up in diagnostics.
-OMP_TRAIT_PROPERTY(device_isa___ANY, device, device_isa,
-   "")
-
 __OMP_TRAIT_SELECTOR(device, arch, true)
 
 __OMP_TRAIT_PROPERTY(device, arch, arm)
@@ -1074,6 +1066,18 @@
 __OMP_TRAIT_PROPERTY(user, condition, false)
 __OMP_TRAIT_PROPERTY(user, condition, unknown)
 
+
+// Note that we put isa last so that the other conditions are checked first.
+// This allows us to issue warnings wrt. isa only if we match otherwise.
+__OMP_TRAIT_SELECTOR(device, isa, true)
+
+// We use "__ANY" as a placeholder in the isa property to denote the
+// conceptual "any", not the literal `any` used in kind. The string we
+// we use is not important except that it will show up in diagnostics.
+OMP_TRAIT_PROPERTY(device_isa___ANY, device, device_isa,
+   "")
+
+
 #undef OMP_TRAIT_SET
 #undef __OMP_TRAIT_SET
 ///}
Index: clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
===
--- clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
+++ clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
@@ -6,10 +6,10 @@
 
 // CHECK-DAG: @_Z3barv
 // CHECK-DAG: @_Z3bazv
-// CHECK-DAG: @"_Z54bar$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_anyv"
-// CHECK-DAG: @"_Z54baz$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_anyv"
-// CHECK-DAG: call i32 @"_Z54bar$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_anyv"()
-// CHECK-DAG: call i32 @"_Z54baz$ompvariant$S2$s8$Pnvptx$Pnvptx64$S3$s10$Pmatch_anyv"()
+// CHECK-DAG: @"_Z53bar$ompvariant$S2$s7$Pnvptx$Pnvptx64$S3$s9$Pmatch_anyv"
+// CHECK-DAG: @"_Z53baz$ompvariant$S2$s7$Pnvptx$Pnvptx64$S3$s9$Pmatch_anyv"
+// CHECK-DAG: call i32 @"_Z53bar$ompvariant$S2$s7$Pnvptx$Pnvptx64$S3$s9$Pmatch_anyv"()
+// CHECK-DAG: call i32 @"_Z53baz$ompvariant$S2$s7$Pnvptx$Pnvptx64$S3$s9$Pmatch_anyv"()
 
 #ifndef HEADER
 #define HEADER
@@ -38,4 +38,4 @@
   return res;
 }
 
-#endif
\ No newline at end of file
+#endif
Index: clang/test/OpenMP/declare_variant_messages.cpp
===
--- clang/test/OpenMP/declare_variant_messages.cpp
+++ clang/test/OpenMP/declare_variant_messages.cpp
@@ -39,7 +39,7 @@
 #pragma omp declare variant(foofoo ) match(implementation={vendor(score(foofoo ()) ibm)}) // expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{score expressions in the OpenMP context selector need to be constant; foofoo() is not and will be ignored}}
 #pragma omp declare variant(foofoo ) match(implementation={vendor(score(5): ibm), vendor(llvm)}) // expected-warning {{the context selector 'vendor' was used already in the same 'omp declare variant' directive; selector ignored}} expected-note {{the previous context selector 'vendor' used here}} expected-note {{the ignored selector spans until here}}
 #pragma omp declare variant(foofoo ) match(implementation={vendor(score(5): ibm), kind(cpu)}) // expected-warning {{the context selector 'kind' is not valid for the context set 'implementation'; selector ignored}} expected-note {{the context selector 'kind' can be nested in the context set 'device'; try 'match(device={kind(property)})'}} expected-note {{the ignored selector spans until here}}
-#pragma omp declare variant(foofoo ) match(device={xxx}) // expected-warning {{'xxx' is not a valid context selector for the context set 'device'; selector ignored}} expected-note {{context selector options are: 'kind' 'isa' 'arch'}} expected-note {{the ignored selector spans until here}}
+#pragma omp declare variant(foofoo ) match(device={xxx}) // expected-warning {{'xxx' is not a valid context selector for the context set 'device'; selector ignored}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}}
 

[clang] 36c4dc9 - [OpenMP][FIX] Ensure the isa trait is evaluated last

2021-01-07 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2021-01-07T14:31:20-06:00
New Revision: 36c4dc9b42fe2e6af4ab488b7c4013d5082b67f6

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

LOG: [OpenMP][FIX] Ensure the isa trait is evaluated last

Since isa can cause diagnostics we want it to be evaluated last to avoid
the "unknown isa" warning if the rest of the selector wouldn't match
anyway. That allows us to guard isa with arch properly.

Reviewed By: jhuber6

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

Added: 


Modified: 
clang/test/OpenMP/begin_declare_variant_messages.c
clang/test/OpenMP/declare_variant_messages.c
clang/test/OpenMP/declare_variant_messages.cpp
clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Removed: 




diff  --git a/clang/test/OpenMP/begin_declare_variant_messages.c 
b/clang/test/OpenMP/begin_declare_variant_messages.c
index a6ed043de1023..5922153b24457 100644
--- a/clang/test/OpenMP/begin_declare_variant_messages.c
+++ b/clang/test/OpenMP/begin_declare_variant_messages.c
@@ -70,7 +70,7 @@ const int var;
 #pragma omp end declare variant
 #pragma omp begin declare variant match(implementation={vendor(score(5): ibm), 
kind(cpu)}) // expected-warning {{the context selector 'kind' is not valid for 
the context set 'implementation'; selector ignored}} expected-note {{the 
context selector 'kind' can be nested in the context set 'device'; try 
'match(device={kind(property)})'}} expected-note {{the ignored selector spans 
until here}}
 #pragma omp end declare variant
-#pragma omp begin declare variant match(device={xxx}) // expected-warning 
{{'xxx' is not a valid context selector for the context set 'device'; selector 
ignored}} expected-note {{context selector options are: 'kind' 'isa' 'arch'}} 
expected-note {{the ignored selector spans until here}}
+#pragma omp begin declare variant match(device={xxx}) // expected-warning 
{{'xxx' is not a valid context selector for the context set 'device'; selector 
ignored}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} 
expected-note {{the ignored selector spans until here}}
 #pragma omp end declare variant
 #pragma omp begin declare variant match(device={kind}) // expected-warning 
{{the context selector 'kind' in context set 'device' requires a context 
property defined in parentheses; selector ignored}} expected-note {{the ignored 
selector spans until here}}
 #pragma omp end declare variant

diff  --git a/clang/test/OpenMP/declare_variant_messages.c 
b/clang/test/OpenMP/declare_variant_messages.c
index 18bb7e331f27c..1fad74b12d1ed 100644
--- a/clang/test/OpenMP/declare_variant_messages.c
+++ b/clang/test/OpenMP/declare_variant_messages.c
@@ -36,7 +36,7 @@ int foo(void);
 #pragma omp declare variant(foo) match(implementation={vendor(score(foo()) 
ibm)}) // expected-warning {{expected '':'' after the score expression; '':'' 
assumed}} expected-warning {{score expressions in the OpenMP context selector 
need to be constant; foo() is not and will be ignored}}
 #pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm), 
vendor(llvm)}) // expected-warning {{the context selector 'vendor' was used 
already in the same 'omp declare variant' directive; selector ignored}} 
expected-note {{the previous context selector 'vendor' used here}} 
expected-note {{the ignored selector spans until here}}
 #pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm), 
kind(cpu)}) // expected-warning {{the context selector 'kind' is not valid for 
the context set 'implementation'; selector ignored}} expected-note {{the 
context selector 'kind' can be nested in the context set 'device'; try 
'match(device={kind(property)})'}} expected-note {{the ignored selector spans 
until here}}
-#pragma omp declare variant(foo) match(device={xxx}) // expected-warning 
{{'xxx' is not a valid context selector for the context set 'device'; selector 
ignored}} expected-note {{context selector options are: 'kind' 'isa' 'arch'}} 
expected-note {{the ignored selector spans until here}}
+#pragma omp declare variant(foo) match(device={xxx}) // expected-warning 
{{'xxx' is not a valid context selector for the context set 'device'; selector 
ignored}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} 
expected-note {{the ignored selector spans until here}}
 #pragma omp declare variant(foo) match(device={kind}) // expected-warning 
{{the context selector 'kind' in context set 'device' requires a context 
property defined in parentheses; selector ignored}} expected-note {{the ignored 
selector spans until here}}
 #pragma omp declare variant(foo) match(device={kind(}) // expected-error 
{{expected ')'}} expected-warning 

[PATCH] D93786: [OpenMP][Fix] Make the arch selector for x86_64 work

2021-01-07 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd970a285b856: [OpenMP][Fix] Make the arch selector for 
x86_64 work (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93786

Files:
  clang/test/OpenMP/declare_variant_ast_x86_64.c
  llvm/lib/Frontend/OpenMP/OMPContext.cpp


Index: llvm/lib/Frontend/OpenMP/OMPContext.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -14,7 +14,9 @@
 
 #include "llvm/Frontend/OpenMP/OMPContext.h"
 #include "llvm/ADT/SetOperations.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -58,9 +60,12 @@
 
   // Add the appropriate device architecture trait based on the triple.
 #define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str) 
\
-  if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch)  
\
+  if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) {
\
 if (TargetTriple.getArch() == TargetTriple.getArchTypeForLLVMName(Str))
\
-  ActiveTraits.set(unsigned(TraitProperty::Enum));
+  ActiveTraits.set(unsigned(TraitProperty::Enum)); 
\
+if (Str == "x86_64" && TargetTriple.getArch() == Triple::x86_64)   
\
+  ActiveTraits.set(unsigned(TraitProperty::Enum)); 
\
+  }
 #include "llvm/Frontend/OpenMP/OMPKinds.def"
 
   // TODO: What exactly do we want to see as device ISA trait?
Index: clang/test/OpenMP/declare_variant_ast_x86_64.c
===
--- /dev/null
+++ clang/test/OpenMP/declare_variant_ast_x86_64.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-unknown %s 
-ast-dump | FileCheck %s
+// expected-no-diagnostics
+
+#pragma omp begin declare variant match(device={arch(x86_64)})
+
+void bar() {}
+
+// CHECK: FunctionDecl {{.*}} bar[device={arch(x86_64)}] 'void ()'
+
+#pragma omp end declare variant


Index: llvm/lib/Frontend/OpenMP/OMPContext.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -14,7 +14,9 @@
 
 #include "llvm/Frontend/OpenMP/OMPContext.h"
 #include "llvm/ADT/SetOperations.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -58,9 +60,12 @@
 
   // Add the appropriate device architecture trait based on the triple.
 #define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str) \
-  if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch)  \
+  if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) {\
 if (TargetTriple.getArch() == TargetTriple.getArchTypeForLLVMName(Str))\
-  ActiveTraits.set(unsigned(TraitProperty::Enum));
+  ActiveTraits.set(unsigned(TraitProperty::Enum)); \
+if (Str == "x86_64" && TargetTriple.getArch() == Triple::x86_64)   \
+  ActiveTraits.set(unsigned(TraitProperty::Enum)); \
+  }
 #include "llvm/Frontend/OpenMP/OMPKinds.def"
 
   // TODO: What exactly do we want to see as device ISA trait?
Index: clang/test/OpenMP/declare_variant_ast_x86_64.c
===
--- /dev/null
+++ clang/test/OpenMP/declare_variant_ast_x86_64.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-unknown %s -ast-dump | FileCheck %s
+// expected-no-diagnostics
+
+#pragma omp begin declare variant match(device={arch(x86_64)})
+
+void bar() {}
+
+// CHECK: FunctionDecl {{.*}} bar[device={arch(x86_64)}] 'void ()'
+
+#pragma omp end declare variant
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] d970a28 - [OpenMP][Fix] Make the arch selector for x86_64 work

2021-01-07 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2021-01-07T14:31:18-06:00
New Revision: d970a285b8567b93aea39e7e4d10965fe8b7340c

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

LOG: [OpenMP][Fix] Make the arch selector for x86_64 work

The triple uses a bar "x86-64" instead of an underscore. Since we
have troubles accepting x86-64 as an identifier, we stick with
x86_64 in the frontend and translate it explicitly.

Reviewed By: tianshilei1992

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

Added: 
clang/test/OpenMP/declare_variant_ast_x86_64.c

Modified: 
llvm/lib/Frontend/OpenMP/OMPContext.cpp

Removed: 




diff  --git a/clang/test/OpenMP/declare_variant_ast_x86_64.c 
b/clang/test/OpenMP/declare_variant_ast_x86_64.c
new file mode 100644
index 0..c0be89a1c6127
--- /dev/null
+++ b/clang/test/OpenMP/declare_variant_ast_x86_64.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-unknown %s 
-ast-dump | FileCheck %s
+// expected-no-diagnostics
+
+#pragma omp begin declare variant match(device={arch(x86_64)})
+
+void bar() {}
+
+// CHECK: FunctionDecl {{.*}} bar[device={arch(x86_64)}] 'void ()'
+
+#pragma omp end declare variant

diff  --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp 
b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
index e252c964e647c..39f047015d192 100644
--- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -14,7 +14,9 @@
 
 #include "llvm/Frontend/OpenMP/OMPContext.h"
 #include "llvm/ADT/SetOperations.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -58,9 +60,12 @@ OMPContext::OMPContext(bool IsDeviceCompilation, Triple 
TargetTriple) {
 
   // Add the appropriate device architecture trait based on the triple.
 #define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str) 
\
-  if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch)  
\
+  if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) {
\
 if (TargetTriple.getArch() == TargetTriple.getArchTypeForLLVMName(Str))
\
-  ActiveTraits.set(unsigned(TraitProperty::Enum));
+  ActiveTraits.set(unsigned(TraitProperty::Enum)); 
\
+if (Str == "x86_64" && TargetTriple.getArch() == Triple::x86_64)   
\
+  ActiveTraits.set(unsigned(TraitProperty::Enum)); 
\
+  }
 #include "llvm/Frontend/OpenMP/OMPKinds.def"
 
   // TODO: What exactly do we want to see as device ISA trait?



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


[PATCH] D94217: [clang-format] Find main include after block ended with #pragma hdrstop

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

LGTM if you add a test for hdrstop(filename) and possibly with LF newline (as 
the test you've already added tests CRLF).


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

https://reviews.llvm.org/D94217

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


[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2021-01-07 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D86844#2484679 , @xbolva00 wrote:

> In D86844#2484639 , @atmnpatel wrote:
>
>> In D86844#2484568 , @fhahn wrote:
>>
>>> In D86844#2481922 , @xbolva00 
>>> wrote:
>>>
   int a, b;
   
   int f(void) {
   while (1) {
   if (a != b) return 1;
   }
   return 0;
   }
   
   int g(int a, int b) {
   while (1) {
   if (a != b) return 1;
   }
   return 0;
   }

 LLVM does not catch these cases; gcc does.

 https://godbolt.org/z/jW7son
>>>
>>> Looks like `must progress` does not get added? If it gets added to the IR 
>>> the loops get removed: https://godbolt.org/z/77v17P
>>
>> I might be misunderstanding the standard here but since 1 is a non-zero 
>> constant expression, it can't be assumed to terminate by the implementation 
>> right? The relevant section from C11 at least is "An iteration statement 
>> whose controlling expression is not a constant expression that performs 
>> [explanation of what it deems as progress] may be assumed by the 
>> implementation to terminate" (C11 6.8.5 p6). I think these cases fall 
>> outside of the scope of this particular change ...
>
> For C yes, but are there such rules for C++? GCC in c++ mode does not check 
> for non-zero constant expr and happily performs this optimization.

@xbolva00 want to provide a follow up patch then :) ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86844

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


[PATCH] D91944: OpenMP 5.0 metadirective

2021-01-07 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

Are the test all passing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91944

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


[PATCH] D94206: [clang-format] turn on formatting after "clang-format on" while sorting includes

2021-01-07 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision.
curdeius added a comment.

LGTM from my perspective.


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

https://reviews.llvm.org/D94206

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


[PATCH] D94206: [clang-format] turn on formatting after "clang-format on" while sorting includes

2021-01-07 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.
This revision is now accepted and ready to land.

This LGTM, thank you for the patch


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

https://reviews.llvm.org/D94206

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


[PATCH] D94217: [clang-format] Find main include after block ended with #pragma hdrstop

2021-01-07 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/lib/Format/Format.cpp:2308
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;

would you now please add a unit test that handles the new case


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

https://reviews.llvm.org/D94217

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


[PATCH] D93772: [Clang][Driver] Fix read-after-free when using /clang:

2021-01-07 Thread Alexandre Ganea 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 rG3854b81b0fd2: [Clang][Driver] Fix read-after-free when using 
/clang: (authored by aganea).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93772

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/cl-options.c


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -686,6 +686,11 @@
 // CLANG-NOT: "--dependent-lib=libcmt"
 // CLANG-NOT: "-vectorize-slp"
 
+// Cover PR42501: clang-cl /clang: pass-through causes read-after-free with 
aliased options.
+// RUN: %clang_cl /clang:-save-temps /clang:-Wl,test1,test2 -### -- %s 2>&1 | 
FileCheck -check-prefix=SAVETEMPS %s
+// SAVETEMPS: "-save-temps=cwd"
+// SAVETEMPS: "test1" "test2"
+
 // Validate that the default triple is used when run an empty tools dir is 
specified
 // RUN: %clang_cl -vctoolsdir "" -### -- %s 2>&1 | FileCheck %s --check-prefix 
VCTOOLSDIR
 // VCTOOLSDIR: "-triple" "{{[a-zA-Z0-9_-]*}}-pc-windows-msvc19.11.0"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1009,13 +1009,15 @@
   // objects than Args. This copies an Arg from one of those other 
InputArgLists
   // to the ownership of Args.
   auto appendOneArg = [](const Arg *Opt, const Arg *BaseArg) {
-  unsigned Index = Args.MakeIndex(Opt->getSpelling());
-  Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Opt->getSpelling(),
- Index, BaseArg);
-  Copy->getValues() = Opt->getValues();
-  if (Opt->isClaimed())
-Copy->claim();
-  Args.append(Copy);
+unsigned Index = Args.MakeIndex(Opt->getSpelling());
+Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Args.getArgString(Index),
+   Index, BaseArg);
+Copy->getValues() = Opt->getValues();
+if (Opt->isClaimed())
+  Copy->claim();
+Copy->setOwnsValues(Opt->getOwnsValues());
+Opt->setOwnsValues(false);
+Args.append(Copy);
   };
 
   if (HasConfigFile)


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -686,6 +686,11 @@
 // CLANG-NOT: "--dependent-lib=libcmt"
 // CLANG-NOT: "-vectorize-slp"
 
+// Cover PR42501: clang-cl /clang: pass-through causes read-after-free with aliased options.
+// RUN: %clang_cl /clang:-save-temps /clang:-Wl,test1,test2 -### -- %s 2>&1 | FileCheck -check-prefix=SAVETEMPS %s
+// SAVETEMPS: "-save-temps=cwd"
+// SAVETEMPS: "test1" "test2"
+
 // Validate that the default triple is used when run an empty tools dir is specified
 // RUN: %clang_cl -vctoolsdir "" -### -- %s 2>&1 | FileCheck %s --check-prefix VCTOOLSDIR
 // VCTOOLSDIR: "-triple" "{{[a-zA-Z0-9_-]*}}-pc-windows-msvc19.11.0"
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1009,13 +1009,15 @@
   // objects than Args. This copies an Arg from one of those other InputArgLists
   // to the ownership of Args.
   auto appendOneArg = [](const Arg *Opt, const Arg *BaseArg) {
-  unsigned Index = Args.MakeIndex(Opt->getSpelling());
-  Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Opt->getSpelling(),
- Index, BaseArg);
-  Copy->getValues() = Opt->getValues();
-  if (Opt->isClaimed())
-Copy->claim();
-  Args.append(Copy);
+unsigned Index = Args.MakeIndex(Opt->getSpelling());
+Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Args.getArgString(Index),
+   Index, BaseArg);
+Copy->getValues() = Opt->getValues();
+if (Opt->isClaimed())
+  Copy->claim();
+Copy->setOwnsValues(Opt->getOwnsValues());
+Opt->setOwnsValues(false);
+Args.append(Copy);
   };
 
   if (HasConfigFile)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 3854b81 - [Clang][Driver] Fix read-after-free when using /clang:

2021-01-07 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2021-01-07T15:15:13-05:00
New Revision: 3854b81b0fd23adc9bab91bf68918d102dc31f51

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

LOG: [Clang][Driver] Fix read-after-free when using /clang:

Fixes PR42501.

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

Added: 


Modified: 
clang/lib/Driver/Driver.cpp
clang/test/Driver/cl-options.c

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5c3ce478053a..418e1d3e8ec9 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1009,13 +1009,15 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   // objects than Args. This copies an Arg from one of those other 
InputArgLists
   // to the ownership of Args.
   auto appendOneArg = [](const Arg *Opt, const Arg *BaseArg) {
-  unsigned Index = Args.MakeIndex(Opt->getSpelling());
-  Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Opt->getSpelling(),
- Index, BaseArg);
-  Copy->getValues() = Opt->getValues();
-  if (Opt->isClaimed())
-Copy->claim();
-  Args.append(Copy);
+unsigned Index = Args.MakeIndex(Opt->getSpelling());
+Arg *Copy = new llvm::opt::Arg(Opt->getOption(), Args.getArgString(Index),
+   Index, BaseArg);
+Copy->getValues() = Opt->getValues();
+if (Opt->isClaimed())
+  Copy->claim();
+Copy->setOwnsValues(Opt->getOwnsValues());
+Opt->setOwnsValues(false);
+Args.append(Copy);
   };
 
   if (HasConfigFile)

diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index db70fca5222c..4b6d71ed7b6d 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -686,6 +686,11 @@
 // CLANG-NOT: "--dependent-lib=libcmt"
 // CLANG-NOT: "-vectorize-slp"
 
+// Cover PR42501: clang-cl /clang: pass-through causes read-after-free with 
aliased options.
+// RUN: %clang_cl /clang:-save-temps /clang:-Wl,test1,test2 -### -- %s 2>&1 | 
FileCheck -check-prefix=SAVETEMPS %s
+// SAVETEMPS: "-save-temps=cwd"
+// SAVETEMPS: "test1" "test2"
+
 // Validate that the default triple is used when run an empty tools dir is 
specified
 // RUN: %clang_cl -vctoolsdir "" -### -- %s 2>&1 | FileCheck %s --check-prefix 
VCTOOLSDIR
 // VCTOOLSDIR: "-triple" "{{[a-zA-Z0-9_-]*}}-pc-windows-msvc19.11.0"



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


[PATCH] D91054: [Clang][OpenMP] Frontend work for sections - D89671

2021-01-07 Thread Fady Ghanim via Phabricator via cfe-commits
fghanim added a comment.

Ping. Please add the Lit test for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91054

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


[PATCH] D94169: [clang][driver] Restore the original help text for `-I`

2021-01-07 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

In D94169#2484968 , @andreil99 wrote:

> I'm fine with having this text in the ClangCommandLineReference.rst only, and 
> removing it from `clang -help`.
>
> However, reverting the patch would not do, as ClangCommandLineReference.rst 
> is auto-generated from `clang/include/clang/Driver/Options.td`. Please feel 
> free to propose a patch for this.
>
> The rationale for the change was multiple requests from our users, since this 
> is important for them and is what they have to discover by experiments.

Thank you for providing the context, that's much appreciated. As the original 
patch already contained changes in `ClangCommandLineReference.rst `, I assumed 
that it was completely separate from `Options.td`. My bad for not 
double-checking.

To the best of my knowledge, there is no mechanism to tweak the help message 
for an option (i.e. what's specified in `Options.td` cannot be tweaked 
elsewhere). So the only alternative for Flang would be to introduce a 
completely new option to represent `-I`, e.g.:

  def I_for_Flang JoinedOrSeparate<["-"], "I">, Group, 
Flags<[FC1Option, FlangOption]>, MetaVarName<"">,
  HelpText<"Add directory to include search path>;

However, as Flang and Clang are meant to share `libclangDriver` [1], and 
`Options.td ` is part of `libclangDriver`, I feel that these drivers should 
also share as many option definitions as possible. To me `OPT_I` is a good 
example of an option that should be shared.

I'm keen to resolve this in a way that's satisfactory for everyone. Personally 
I feel that adding `def I_for_Flang` would be detrimental to `libclangDriver`. 
Bearing in mind that the original change was introduced without a review, I 
would appreciate if more people could chime in.  Any thoughts 
@richard.barton.arm ?

[1] https://lists.llvm.org/pipermail/cfe-dev/2020-July/066393.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94169

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


[PATCH] D84673: [clang][cli] Port DiagnosticOpts to new option parsing system

2021-01-07 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84673

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


[PATCH] D94252: Delete (most) of the MMX builtin functions from Clang.

2021-01-07 Thread James Y Knight via Phabricator via cfe-commits
jyknight created this revision.
jyknight added reviewers: craig.topper, spatel, RKSimon.
jyknight requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

After switching the headers to implement the intrinsics using SSE2
(see https://reviews.llvm.org/D86855), these builtins are now unused.

Only 3 remain -- __builtin_ia32_emms, still used by _mm_empty(), and
__builtin_ia32_vec_{ext,set}_v4si, used by _mm_insert_pi16 and
_mm_extract_pi16, which lower to generic non-MMX IR.

Also update the clang/www/builtins.py with mappings for the
newly-removed builtins to their corresponding intrinsic functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94252

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-x86.c
  clang/test/CodeGen/palignr.c
  clang/test/CodeGen/pr26099.c
  clang/www/builtins.py
  llvm/include/llvm/IR/IntrinsicsX86.td

Index: llvm/include/llvm/IR/IntrinsicsX86.td
===
--- llvm/include/llvm/IR/IntrinsicsX86.td
+++ llvm/include/llvm/IR/IntrinsicsX86.td
@@ -259,11 +259,11 @@
   def int_x86_sse_cvttss2si64 : GCCBuiltin<"__builtin_ia32_cvttss2si64">,
   Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
 
-  def int_x86_sse_cvtps2pi : GCCBuiltin<"__builtin_ia32_cvtps2pi">,
+  def int_x86_sse_cvtps2pi :
   Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
-  def int_x86_sse_cvttps2pi: GCCBuiltin<"__builtin_ia32_cvttps2pi">,
+  def int_x86_sse_cvttps2pi:
   Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
-  def int_x86_sse_cvtpi2ps : GCCBuiltin<"__builtin_ia32_cvtpi2ps">,
+  def int_x86_sse_cvtpi2ps :
   Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
  llvm_x86mmx_ty], [IntrNoMem]>;
 }
@@ -461,11 +461,11 @@
   def int_x86_sse2_cvtsd2ss : GCCBuiltin<"__builtin_ia32_cvtsd2ss">,
   Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
  llvm_v2f64_ty], [IntrNoMem]>;
-  def int_x86_sse_cvtpd2pi : GCCBuiltin<"__builtin_ia32_cvtpd2pi">,
+  def int_x86_sse_cvtpd2pi :
   Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
-  def int_x86_sse_cvttpd2pi: GCCBuiltin<"__builtin_ia32_cvttpd2pi">,
+  def int_x86_sse_cvttpd2pi:
   Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
-  def int_x86_sse_cvtpi2pd : GCCBuiltin<"__builtin_ia32_cvtpi2pd">,
+  def int_x86_sse_cvtpi2pd :
   Intrinsic<[llvm_v2f64_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
 }
 
@@ -547,49 +547,49 @@
 
 // Horizontal arithmetic ops
 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
-  def int_x86_ssse3_phadd_w : GCCBuiltin<"__builtin_ia32_phaddw">,
+  def int_x86_ssse3_phadd_w :
   Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
  llvm_x86mmx_ty], [IntrNoMem]>;
   def int_x86_ssse3_phadd_w_128 : GCCBuiltin<"__builtin_ia32_phaddw128">,
   Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
  llvm_v8i16_ty], [IntrNoMem]>;
 
-  def int_x86_ssse3_phadd_d : GCCBuiltin<"__builtin_ia32_phaddd">,
+  def int_x86_ssse3_phadd_d :
   Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
  llvm_x86mmx_ty], [IntrNoMem]>;
   def int_x86_ssse3_phadd_d_128 : GCCBuiltin<"__builtin_ia32_phaddd128">,
   Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
  llvm_v4i32_ty], [IntrNoMem]>;
 
-  def int_x86_ssse3_phadd_sw: GCCBuiltin<"__builtin_ia32_phaddsw">,
+  def int_x86_ssse3_phadd_sw:
   Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
  llvm_x86mmx_ty], [IntrNoMem]>;
   def int_x86_ssse3_phadd_sw_128: GCCBuiltin<"__builtin_ia32_phaddsw128">,
   Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
  llvm_v8i16_ty], [IntrNoMem]>;
 
-  def int_x86_ssse3_phsub_w : GCCBuiltin<"__builtin_ia32_phsubw">,
+  def int_x86_ssse3_phsub_w :
   Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
  llvm_x86mmx_ty], [IntrNoMem]>;
   def int_x86_ssse3_phsub_w_128 : GCCBuiltin<"__builtin_ia32_phsubw128">,
   Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
  llvm_v8i16_ty], [IntrNoMem]>;
 
-  def int_x86_ssse3_phsub_d : GCCBuiltin<"__builtin_ia32_phsubd">,
+  def int_x86_ssse3_phsub_d :
   Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
  llvm_x86mmx_ty], [IntrNoMem]>;
   def int_x86_ssse3_phsub_d_128 : GCCBuiltin<"__builtin_ia32_phsubd128">,
   Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
  llvm_v4i32_ty], [IntrNoMem]>;
 
-  def int_x86_ssse3_phsub_sw: 

[clang] ad55d5c - Simplify vectorcall argument classification of HVAs, NFC

2021-01-07 Thread Reid Kleckner via cfe-commits

Author: Reid Kleckner
Date: 2021-01-07T11:14:18-08:00
New Revision: ad55d5c3f32f6598f8ac30b68f4961d82cdb1fed

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

LOG: Simplify vectorcall argument classification of HVAs, NFC

This reduces the number of `WinX86_64ABIInfo::classify` call sites from
3 to 1. The call sites were similar, but passed different values for
FreeSSERegs. Use variables instead of `if`s to manage that argument.

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index c6d8942208e8..d36c7344e284 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -1089,11 +1089,6 @@ struct CCState {
   unsigned FreeSSERegs = 0;
 };
 
-enum {
-  // Vectorcall only allows the first 6 parameters to be passed in registers.
-  VectorcallMaxParamNumAsReg = 6
-};
-
 /// X86_32ABIInfo - The X86-32 ABI information.
 class X86_32ABIInfo : public SwiftABIInfo {
   enum Class {
@@ -2405,10 +2400,8 @@ class WinX86_64ABIInfo : public SwiftABIInfo {
 private:
   ABIArgInfo classify(QualType Ty, unsigned , bool IsReturnType,
   bool IsVectorCall, bool IsRegCall) const;
-  ABIArgInfo reclassifyHvaArgType(QualType Ty, unsigned ,
-  const ABIArgInfo ) const;
-  void computeVectorCallArgs(CGFunctionInfo , unsigned FreeSSERegs,
- bool IsVectorCall, bool IsRegCall) const;
+  ABIArgInfo reclassifyHvaArgForVectorCall(QualType Ty, unsigned ,
+   const ABIArgInfo ) const;
 
   X86AVXABILevel AVXLevel;
 
@@ -4163,10 +4156,8 @@ Address X86_64ABIInfo::EmitMSVAArg(CodeGenFunction , 
Address VAListAddr,
   /*allowHigherAlign*/ false);
 }
 
-ABIArgInfo
-WinX86_64ABIInfo::reclassifyHvaArgType(QualType Ty, unsigned ,
-const ABIArgInfo ) const {
-  // Assumes vectorCall calling convention.
+ABIArgInfo WinX86_64ABIInfo::reclassifyHvaArgForVectorCall(
+QualType Ty, unsigned , const ABIArgInfo ) const {
   const Type *Base = nullptr;
   uint64_t NumElts = 0;
 
@@ -4299,31 +4290,6 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, 
unsigned ,
   return ABIArgInfo::getDirect();
 }
 
-void WinX86_64ABIInfo::computeVectorCallArgs(CGFunctionInfo ,
- unsigned FreeSSERegs,
- bool IsVectorCall,
- bool IsRegCall) const {
-  unsigned Count = 0;
-  for (auto  : FI.arguments()) {
-// Vectorcall in x64 only permits the first 6 arguments to be passed
-// as XMM/YMM registers.
-if (Count < VectorcallMaxParamNumAsReg)
-  I.info = classify(I.type, FreeSSERegs, false, IsVectorCall, IsRegCall);
-else {
-  // Since these cannot be passed in registers, pretend no registers
-  // are left.
-  unsigned ZeroSSERegsAvail = 0;
-  I.info = classify(I.type, /*FreeSSERegs=*/ZeroSSERegsAvail, false,
-IsVectorCall, IsRegCall);
-}
-++Count;
-  }
-
-  for (auto  : FI.arguments()) {
-I.info = reclassifyHvaArgType(I.type, FreeSSERegs, I.info);
-  }
-}
-
 void WinX86_64ABIInfo::computeInfo(CGFunctionInfo ) const {
   const unsigned CC = FI.getCallingConvention();
   bool IsVectorCall = CC == llvm::CallingConv::X86_VectorCall;
@@ -4358,13 +4324,25 @@ void WinX86_64ABIInfo::computeInfo(CGFunctionInfo ) 
const {
 FreeSSERegs = 16;
   }
 
+  unsigned ArgNum = 0;
+  unsigned ZeroSSERegs = 0;
+  for (auto  : FI.arguments()) {
+// Vectorcall in x64 only permits the first 6 arguments to be passed as
+// XMM/YMM registers. After the sixth argument, pretend no vector
+// registers are left.
+unsigned *MaybeFreeSSERegs =
+(IsVectorCall && ArgNum >= 6) ?  : 
+I.info =
+classify(I.type, *MaybeFreeSSERegs, false, IsVectorCall, IsRegCall);
+++ArgNum;
+  }
+
   if (IsVectorCall) {
-computeVectorCallArgs(FI, FreeSSERegs, IsVectorCall, IsRegCall);
-  } else {
+// For vectorcall, assign aggregate HVAs to any free vector registers in a
+// second pass.
 for (auto  : FI.arguments())
-  I.info = classify(I.type, FreeSSERegs, false, IsVectorCall, IsRegCall);
+  I.info = reclassifyHvaArgForVectorCall(I.type, FreeSSERegs, I.info);
   }
-
 }
 
 Address WinX86_64ABIInfo::EmitVAArg(CodeGenFunction , Address VAListAddr,



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


[PATCH] D94169: [clang][driver] Restore the original help text for `-I`

2021-01-07 Thread Andrei Lebedev via Phabricator via cfe-commits
andreil99 requested changes to this revision.
andreil99 added a comment.
This revision now requires changes to proceed.

I'm fine with having this text in the ClangCommandLineReference.rst only, and 
removing it from `clang -help`.

However, reverting the patch would not do, as ClangCommandLineReference.rst is 
auto-generated from `clang/include/clang/Driver/Options.td`. Please feel free 
to propose a patch for this.

The rationale for the change was multiple requests from our users, since this 
is important for them and is what they have to discover by experiments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94169

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


[PATCH] D94233: [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute id changes

2021-01-07 Thread Jeroen Dobbelaere via Phabricator via cfe-commits
jeroen.dobbelaere added a comment.

Thanks !


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94233

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


[PATCH] D93638: [hip] Enable HIP compilation with ` on MSVC.

2021-01-07 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.

LGTM. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93638

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


[PATCH] D94239: [SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests

2021-01-07 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan updated this revision to Diff 315182.
abhina.sreeskantharajan added a comment.

There was an extra ^M carriage return at the end of two lines in 
lld/test/COFF/pdb-type-server-invalid-signature.yaml CHECK lines. This update 
removes them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94239

Files:
  clang/test/CodeGen/basic-block-sections.c
  clang/test/CodeGen/ubsan-blacklist-vfs.c
  clang/test/Frontend/stats-file.c
  lld/test/COFF/driver.test
  lld/test/COFF/manifestinput-error.test
  lld/test/COFF/nodefaultlib.test
  lld/test/COFF/pdb-type-server-invalid-signature.yaml
  lld/test/ELF/archive-thin-missing-member.s
  lld/test/ELF/basic.s
  lld/test/ELF/symbol-ordering-file.s
  llvm/test/DebugInfo/symbolize-missing-file.test
  llvm/test/tools/dsymutil/X86/papertrail-warnings.test
  llvm/test/tools/llvm-ar/missing-thin-archive-member.test
  llvm/test/tools/llvm-ar/replace.test
  llvm/test/tools/llvm-ar/response.test
  llvm/test/tools/llvm-cxxdump/trivial.test
  llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
  llvm/test/tools/llvm-mc/basic.test
  llvm/test/tools/llvm-mca/invalid_input_file_name.test
  llvm/test/tools/llvm-ml/basic.test
  llvm/test/tools/llvm-objcopy/COFF/add-section.test
  llvm/test/tools/llvm-objcopy/ELF/add-section.test
  llvm/test/tools/llvm-objcopy/ELF/error-format.test
  llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
  llvm/test/tools/llvm-objcopy/redefine-symbols.test
  llvm/test/tools/llvm-profdata/weight-instr.test
  llvm/test/tools/llvm-profdata/weight-sample.test
  llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
  llvm/test/tools/llvm-readobj/basic.test
  llvm/test/tools/llvm-readobj/thin-archive.test
  llvm/test/tools/llvm-size/no-input.test
  llvm/test/tools/llvm-xray/X86/no-such-file.txt
  llvm/test/tools/obj2yaml/invalid_input_file.test
  llvm/test/tools/yaml2obj/output-file.yaml

Index: llvm/test/tools/yaml2obj/output-file.yaml
===
--- llvm/test/tools/yaml2obj/output-file.yaml
+++ llvm/test/tools/yaml2obj/output-file.yaml
@@ -9,7 +9,7 @@
 
 # RUN: not yaml2obj -o %p/path/does/not/exist 2>&1 | FileCheck %s
 
-# CHECK: yaml2obj: error: failed to open '{{.*}}/path/does/not/exist': {{[Nn]}}o such file or directory
+# CHECK: yaml2obj: error: failed to open '{{.*}}/path/does/not/exist': {{.*}}{{[Nn]}}o such file or directory
 
 !ELF
 FileHeader:
Index: llvm/test/tools/obj2yaml/invalid_input_file.test
===
--- llvm/test/tools/obj2yaml/invalid_input_file.test
+++ llvm/test/tools/obj2yaml/invalid_input_file.test
@@ -1,3 +1,3 @@
 # RUN: not obj2yaml  %p/path/does/not/exist 2>&1 | FileCheck %s
 
-# CHECK: Error reading file: {{.*}}/path/does/not/exist: {{[Nn]}}o such file or directory
+# CHECK: Error reading file: {{.*}}/path/does/not/exist: {{.*}}{{[Nn]}}o such file or directory
Index: llvm/test/tools/llvm-xray/X86/no-such-file.txt
===
--- llvm/test/tools/llvm-xray/X86/no-such-file.txt
+++ llvm/test/tools/llvm-xray/X86/no-such-file.txt
@@ -1,4 +1,4 @@
 ; RUN: not llvm-xray extract no-such-file 2>&1 | FileCheck %s
 
 ; CHECK: llvm-xray: Cannot extract instrumentation map from 'no-such-file'.
-; CHECK-NEXT: {{[Nn]}}o such file or directory
+; CHECK-NEXT: {{.*}}{{[Nn]}}o such file or directory
Index: llvm/test/tools/llvm-size/no-input.test
===
--- llvm/test/tools/llvm-size/no-input.test
+++ llvm/test/tools/llvm-size/no-input.test
@@ -1,7 +1,7 @@
 ## Show that llvm-size emits an error if passed in a non-existent file.
 
 # RUN: not llvm-size %t.blah 2>&1 | FileCheck %s -DFILE=%t.blah --check-prefix=ENOENT
-# ENOENT: {{.*}}llvm-size{{.*}}: error: '[[FILE]]': {{[Nn]}}o such file or directory
+# ENOENT: {{.*}}llvm-size{{.*}}: error: '[[FILE]]': {{.*}}{{[Nn]}}o such file or directory
 
 ## Show that llvm-size reads a.out if not passed any file.
 
Index: llvm/test/tools/llvm-readobj/thin-archive.test
===
--- llvm/test/tools/llvm-readobj/thin-archive.test
+++ llvm/test/tools/llvm-readobj/thin-archive.test
@@ -60,7 +60,7 @@
 # MISSING: File: {{.*}}1.o
 # MISSING: Format: elf64-x86-64
 # MISSING-NOT: File: {{.*}}3.o
-# ERR: error: '{{.*}}.a': '{{.*}}2.o': {{[Nn]}}o such file or directory
+# ERR: error: '{{.*}}.a': '{{.*}}2.o': {{.*}}{{[Nn]}}o such file or directory
 
 --- !ELF
 FileHeader:
Index: llvm/test/tools/llvm-readobj/basic.test
===
--- llvm/test/tools/llvm-readobj/basic.test
+++ llvm/test/tools/llvm-readobj/basic.test
@@ -2,7 +2,7 @@
 RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj %s
 RUN: not llvm-readelf %t.blah 2>&1 | FileCheck 

[PATCH] D93638: [hip] Enable HIP compilation with ` on MSVC.

2021-01-07 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

In D93638#2483913 , @hliao wrote:

> Forget that C function could be overloaded on Clang with overloadable
> extension. With that, we don't need to mark functions from `` as HD.
> Instead, we could provide their device-side implementation directly.

Ah. It was the "C" part that I was missing. I was only thinking of 
C++/HIP/CUDA. I think we're on the same page now. LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93638

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


[PATCH] D94039: [WebAssembly] Update WasmEHPrepare for the new spec

2021-01-07 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: llvm/lib/CodeGen/WasmEHPrepare.cpp:374-375
+  // be lowered to wasm 'catch' instruction. We do this mainly because
+  // instruction selection cannot handle wasm.get.exception intrinsic's token
+  // argument.
+  Instruction *CatchCI =

dschuff wrote:
> tlively wrote:
> > What is the token argument used for? Could clang generate `llvm.wasm.catch` 
> > directly?
> Token arguments (https://llvm.org/docs/ExceptionHandling.html#wineh) are used 
> to preserve the original scoping structure in mid-level optimization passes. 
> I haven't looked at this intrinsic recently but I'd guess that maybe the 
> token keeps it from getting moved out of its containing scope?
Ah, that makes sense, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94039

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


[PATCH] D94188: [OpenCL] Documentation for experimental C++ libraries support

2021-01-07 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia marked 6 inline comments as done.
Anastasia added inline comments.



Comment at: clang/docs/OpenCLSupport.rst:134
+  #pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable
+  #include "type_traits"
+  #pragma OPENCL EXTENSION __cl_clang_function_pointers : disable

mantognini wrote:
> I'd use < and > instead of ". It should work too, right? It would be closer 
> to standard C++ usage.
Yes it does work. I was only thinking to use " to highlight that it is not 
standard in OpenCL but it doesn't matter too much. I guess it makes sense to 
align with C++.


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

https://reviews.llvm.org/D94188

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


[PATCH] D94188: [OpenCL] Documentation for experimental C++ libraries support

2021-01-07 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 315173.
Anastasia added a comment.

Addressed review comments


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

https://reviews.llvm.org/D94188

Files:
  clang/docs/OpenCLSupport.rst


Index: clang/docs/OpenCLSupport.rst
===
--- clang/docs/OpenCLSupport.rst
+++ clang/docs/OpenCLSupport.rst
@@ -96,3 +96,57 @@
 
+--+--+--+---+
 | New functionality| Atomic mem scopes: subgroup, all devices 
including functions | :part:`worked on`| https://reviews.llvm.org/D92004 
(functions only)  |
 
+--+--+--+---+
+
+Experimental features
+=
+
+Clang provides the following new WIP features for the developers to experiment
+and provide early feedback or contribute with further improvements.
+Feel free to contact us on `cfe-dev
+`_ or via `Bugzilla
+`_.
+
+C++ libraries for OpenCL
+
+
+There is ongoing work to support C++ standard libraries from `LLVM's libcxx
+`_ in OpenCL kernel code using C++ for OpenCL mode.
+
+It is currently possible to include `type_traits` from C++17 in the kernel
+sources when the following clang extensions are enabled
+``__cl_clang_function_pointers`` and ``__cl_clang_variadic_functions``,
+see :doc:`LanguageExtensions` for more details. The use of non-conformant
+features enabled by the extensions does not expose non-conformant behavior
+beyond the compilation i.e. does not get generated in IR or binary.
+The extension only appear in metaprogramming
+mechanism to identify or verify the properties of types. This allows to provide
+the full C++ functionality without a loss of portability. To avoid unsafe use
+of the extensions it is recommended that the extensions are disabled directly
+after the header include.
+
+**Example of Use**:
+
+The example of kernel code with `type_traits` is illustrated here.
+
+.. code-block:: c++
+
+  #pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
+  #pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable
+  #include 
+  #pragma OPENCL EXTENSION __cl_clang_function_pointers : disable
+  #pragma OPENCL EXTENSION __cl_clang_variadic_functions : disable
+ 
+  using sint_type = std::make_signed::type;
+
+  __kernel void foo() {
+static_assert(!std::is_same::value);
+  }
+
+The possible clang invocation to compile the example is as follows:
+
+   .. code-block:: console
+
+ $ clang -cl-std=clc++  -I/include test.cl
+
+Note that `type_traits` is a header only library and therefore no extra
+linking step against the standard libraries is required.


Index: clang/docs/OpenCLSupport.rst
===
--- clang/docs/OpenCLSupport.rst
+++ clang/docs/OpenCLSupport.rst
@@ -96,3 +96,57 @@
 +--+--+--+---+
 | New functionality| Atomic mem scopes: subgroup, all devices including functions | :part:`worked on`| https://reviews.llvm.org/D92004 (functions only)  |
 +--+--+--+---+
+
+Experimental features
+=
+
+Clang provides the following new WIP features for the developers to experiment
+and provide early feedback or contribute with further improvements.
+Feel free to contact us on `cfe-dev
+`_ or via `Bugzilla
+`_.
+
+C++ libraries for OpenCL
+
+
+There is ongoing work to support C++ standard libraries from `LLVM's libcxx
+`_ in OpenCL kernel code using C++ for OpenCL mode.
+
+It is currently possible to include `type_traits` from C++17 in the kernel
+sources when the following clang extensions are enabled
+``__cl_clang_function_pointers`` and ``__cl_clang_variadic_functions``,
+see :doc:`LanguageExtensions` for more details. The use of non-conformant
+features enabled by the extensions does not expose non-conformant behavior
+beyond the compilation i.e. does not get generated in IR or binary.
+The extension only appear in metaprogramming
+mechanism to identify or verify the properties of types. This allows to 

[clang] d015445 - Silence warning: comparison of integers of different signs: 'const unsigned int' and 'const long' [-Wsign-compare]

2021-01-07 Thread Alexandre Ganea via cfe-commits

Author: Alexandre Ganea
Date: 2021-01-07T13:01:06-05:00
New Revision: d0154456e61c5ab79e25fc9b8bb684ebdca3a7c2

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

LOG: Silence warning: comparison of integers of different signs: 'const 
unsigned int' and 'const long' [-Wsign-compare]

(off_t being a signed type)

Added: 


Modified: 
clang/unittests/Basic/FileEntryTest.cpp

Removed: 




diff  --git a/clang/unittests/Basic/FileEntryTest.cpp 
b/clang/unittests/Basic/FileEntryTest.cpp
index a3e03e6c7c29..16c8e57d9a17 100644
--- a/clang/unittests/Basic/FileEntryTest.cpp
+++ b/clang/unittests/Basic/FileEntryTest.cpp
@@ -57,7 +57,7 @@ struct RefMaps {
 
 TEST(FileEntryTest, Constructor) {
   FileEntry FE;
-  EXPECT_EQ(0U, FE.getSize());
+  EXPECT_EQ(0, FE.getSize());
   EXPECT_EQ(0, FE.getModificationTime());
   EXPECT_EQ(nullptr, FE.getDir());
   EXPECT_EQ(0U, FE.getUniqueID().getDevice());



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


[PATCH] D92751: [clang][aarch64] Precondition isHomogeneousAggregate on isCXX14Aggregate

2021-01-07 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: clang/lib/CodeGen/CGCXXABI.h:143
   /// Returns how an argument of the given record type should be passed.
   virtual RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const = 0;
 

nit: I would group the new virtual method declaration after these two, since it 
also has to do with argument classification.



Comment at: clang/lib/CodeGen/MicrosoftCXXABI.cpp:4370
+  // AAPCS64, but is defacto spec on that platform.
+  return isTrivialForAArch64MSVC(CXXRD);
+}

I think x64 vectorcall supports HVAs, so this could change behavior there, 
unless you check the triple for aarch64.

Following the principle of limiting the scope of the change, this seems like 
the right condition:
  return !CGM.getTarget().getTriple().isAArch64() || 
isTrivialForAArch64MSVC(CXXRD);

We can follow up with more x64 vectorcall tests later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92751

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


[PATCH] D92892: [clang] Change builtin object size to be compatible with GCC when sub-object is invalid

2021-01-07 Thread Mott, Jeffrey T via Phabricator via cfe-commits
jtmott-intel added a comment.

Seems I don't have commit access. I'll look into it. For now, could someone 
push this commit? Thanks.


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

https://reviews.llvm.org/D92892

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


[PATCH] D94217: [clang-format] Find main include after block ended with #pragma hdrstop

2021-01-07 Thread Rafał Jelonek via Phabricator via cfe-commits
rjelonek updated this revision to Diff 315169.
rjelonek added a comment.

Add support to `#pragma hdrstop( "c:\\projects\\include\\myinc.pch" )'


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

https://reviews.llvm.org/D94217

Files:
  clang/lib/Format/Format.cpp
  clang/unittests/Format/SortIncludesTest.cpp


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -879,6 +879,27 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, DoNotTreatPrecompiledHeadersAsFirstBlock) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2305,7 +2305,10 @@
 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code,
 Replaces, Cursor);
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;
+else
+  FirstIncludeBlock = false;
   }
   Prev = Pos + 1;
 }


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -879,6 +879,27 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, DoNotTreatPrecompiledHeadersAsFirstBlock) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "#include \"b.h\"\r\n"
+ "#include \"d.h\"\r\n"
+ "#pragma hdrstop\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 2));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2305,7 +2305,10 @@
 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code,
 Replaces, Cursor);
 IncludesInBlock.clear();
-FirstIncludeBlock = false;
+if (Trimmed.startswith("#pragma hdrstop")) // precompiled headers
+  FirstIncludeBlock = true;
+else
+  FirstIncludeBlock = false;
   }
   Prev = Pos + 1;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94206: [clang-format] turn on formatting after "clang-format on" while sorting includes

2021-01-07 Thread Rafał Jelonek via Phabricator via cfe-commits
rjelonek updated this revision to Diff 315166.

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

https://reviews.llvm.org/D94206

Files:
  clang/lib/Format/Format.cpp
  clang/unittests/Format/SortIncludesTest.cpp


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -207,6 +207,27 @@
  "#include \n"
  "#include \n"
  "// clang-format on\n"));
+
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "// clang-format off\r\n"
+ "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "// clang-format on\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "// clang-format off\r\n"
+ "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "// clang-format on\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 1));
 }
 
 TEST_F(SortIncludesTest, SupportClangFormatOffCStyle) {
@@ -879,6 +900,21 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, MergeLines) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"c.h\"\r\n"
+ "#include \"b\\\r\n"
+ ".h\"\r\n"
+ "#include \"a.h\"\r\n";
+
+  std::string Expected = "#include \"a.h\"\r\n"
+ "#include \"b\\\r\n"
+ ".h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "a.cpp", 1));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2289,7 +2289,8 @@
  Style.IncludeStyle.IncludeBlocks ==
  tooling::IncludeStyle::IBS_Regroup);
 
-if (!FormattingOff && !Line.endswith("\\")) {
+bool MergeWithNextLine = Trimmed.endswith("\\");
+if (!FormattingOff && !MergeWithNextLine) {
   if (IncludeRegex.match(Line, )) {
 StringRef IncludeName = Matches[2];
 int Category = Categories.getIncludePriority(
@@ -2307,10 +2308,12 @@
 IncludesInBlock.clear();
 FirstIncludeBlock = false;
   }
-  Prev = Pos + 1;
 }
 if (Pos == StringRef::npos || Pos + 1 == Code.size())
   break;
+
+if (!MergeWithNextLine)
+  Prev = Pos + 1;
 SearchFrom = Pos + 1;
   }
   if (!IncludesInBlock.empty()) {


Index: clang/unittests/Format/SortIncludesTest.cpp
===
--- clang/unittests/Format/SortIncludesTest.cpp
+++ clang/unittests/Format/SortIncludesTest.cpp
@@ -207,6 +207,27 @@
  "#include \n"
  "#include \n"
  "// clang-format on\n"));
+
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "// clang-format off\r\n"
+ "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "// clang-format on\r\n"
+ "\r\n"
+ "#include \"c.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"e.h\"\r\n";
+
+  std::string Expected = "// clang-format off\r\n"
+ "#include \"d.h\"\r\n"
+ "#include \"b.h\"\r\n"
+ "// clang-format on\r\n"
+ "\r\n"
+ "#include \"e.h\"\r\n"
+ "#include \"a.h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "e.cpp", 1));
 }
 
 TEST_F(SortIncludesTest, SupportClangFormatOffCStyle) {
@@ -879,6 +900,21 @@
  "#include \"a.h\""));
 }
 
+TEST_F(SortIncludesTest, MergeLines) {
+  Style.IncludeBlocks = Style.IBS_Merge;
+  std::string Code = "#include \"c.h\"\r\n"
+ "#include \"b\\\r\n"
+ ".h\"\r\n"
+ "#include \"a.h\"\r\n";
+
+  std::string Expected = "#include \"a.h\"\r\n"
+ "#include \"b\\\r\n"
+ ".h\"\r\n"
+ "#include \"c.h\"\r\n";
+
+  EXPECT_EQ(Expected, sort(Code, "a.cpp", 1));
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/Format.cpp
===
--- 

[PATCH] D86841: [clang] Add mustprogress and llvm.loop.mustprogress attribute deduction

2021-01-07 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel added a comment.

I'm happy to add a patch amending this, the reason it wasn't done that way was 
because at the time and even now, out of icc/clang/msvc/gcc, gcc seems to be 
the only one that happily removed such loops in C++ 
(https://godbolt.org/z/W9vj99), and I didn't have a particularly strong opinion 
on which way we should lean at the time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86841

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


[PATCH] D93483: Add element-type to the Vector TypeLoc types.

2021-01-07 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG43043adcfbc6: Add element-type to the Vector TypeLoc types. 
(authored by erichkeane).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D93483?vs=312582=315164#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93483

Files:
  clang/include/clang/AST/TypeLoc.h
  clang/lib/Sema/SemaType.cpp
  clang/lib/Sema/TreeTransform.h
  clang/test/SemaCXX/vector.cpp

Index: clang/test/SemaCXX/vector.cpp
===
--- clang/test/SemaCXX/vector.cpp
+++ clang/test/SemaCXX/vector.cpp
@@ -513,3 +513,20 @@
 }
 
 } // namespace PR45780
+
+namespace PR48540 {
+// The below used to cause an OOM error, or an assert, make sure it is still
+//  valid.
+int (__attribute__((vector_size(16))) a);
+
+template 
+struct S {
+  T (__attribute__((vector_size(16))) a);
+  int (__attribute__((vector_size(I))) b);
+  T (__attribute__((vector_size(I))) c);
+};
+
+void use() {
+  S s;
+}
+} // namespace PR48540
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -5178,7 +5178,7 @@
 QualType TreeTransform::TransformDependentVectorType(
 TypeLocBuilder , DependentVectorTypeLoc TL) {
   const DependentVectorType *T = TL.getTypePtr();
-  QualType ElementType = getDerived().TransformType(T->getElementType());
+  QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
   if (ElementType.isNull())
 return QualType();
 
@@ -5219,7 +5219,7 @@
   const DependentSizedExtVectorType *T = TL.getTypePtr();
 
   // FIXME: ext vector locs should be nested
-  QualType ElementType = getDerived().TransformType(T->getElementType());
+  QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
   if (ElementType.isNull())
 return QualType();
 
@@ -5386,7 +5386,7 @@
 QualType TreeTransform::TransformVectorType(TypeLocBuilder ,
  VectorTypeLoc TL) {
   const VectorType *T = TL.getTypePtr();
-  QualType ElementType = getDerived().TransformType(T->getElementType());
+  QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
   if (ElementType.isNull())
 return QualType();
 
@@ -5409,7 +5409,7 @@
 QualType TreeTransform::TransformExtVectorType(TypeLocBuilder ,
 ExtVectorTypeLoc TL) {
   const VectorType *T = TL.getTypePtr();
-  QualType ElementType = getDerived().TransformType(T->getElementType());
+  QualType ElementType = getDerived().TransformType(TLB, TL.getElementLoc());
   if (ElementType.isNull())
 return QualType();
 
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -6135,6 +6135,17 @@
 void VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
   TL.setExpansionLoc(Chunk.Loc);
 }
+void VisitVectorTypeLoc(VectorTypeLoc TL) { TL.setNameLoc(Chunk.Loc); }
+void VisitDependentVectorTypeLoc(DependentVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void
+VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
 
 void VisitTypeLoc(TypeLoc TL) {
   llvm_unreachable("unsupported TypeLoc kind in declarator!");
Index: clang/include/clang/AST/TypeLoc.h
===
--- clang/include/clang/AST/TypeLoc.h
+++ clang/include/clang/AST/TypeLoc.h
@@ -1749,30 +1749,79 @@
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
-class VectorTypeLoc : public InheritingConcreteTypeLoc {
+struct VectorTypeLocInfo {
+  SourceLocation NameLoc;
+};
+
+class VectorTypeLoc : public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); }
 };
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
 class DependentVectorTypeLoc
-: public InheritingConcreteTypeLoc {};
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return 

[clang] 43043ad - Add element-type to the Vector TypeLoc types.

2021-01-07 Thread Erich Keane via cfe-commits

Author: Erich Keane
Date: 2021-01-07T09:14:36-08:00
New Revision: 43043adcfbc60945646b791d7162e5a1307a5318

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

LOG: Add element-type to the Vector TypeLoc types.

As shown by bug 48540, GCC vector types would cause a crash when the
declaration hada ParenType. This was because the walking of the
declaration would try to expand the 'inner' type, but there was no
ability to get it from the vector type.  This patch adds that element
type access to the vector type loc objects.

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

Added: 


Modified: 
clang/include/clang/AST/TypeLoc.h
clang/lib/Sema/SemaType.cpp
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/vector.cpp

Removed: 




diff  --git a/clang/include/clang/AST/TypeLoc.h 
b/clang/include/clang/AST/TypeLoc.h
index 4c320ce26e4f..65e95d52c303 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -1749,30 +1749,79 @@ class DependentAddressSpaceTypeLoc
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
-class VectorTypeLoc : public InheritingConcreteTypeLoc {
+struct VectorTypeLocInfo {
+  SourceLocation NameLoc;
+};
+
+class VectorTypeLoc : public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
 class DependentVectorTypeLoc
-: public InheritingConcreteTypeLoc {};
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
 
-// FIXME: size expression and attribute locations.
-class ExtVectorTypeLoc : public InheritingConcreteTypeLoc {
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
+// FIXME: size expression and attribute locations.
+class ExtVectorTypeLoc
+: public InheritingConcreteTypeLoc {};
+
 // FIXME: attribute locations.
 // For some reason, this isn't a subtype of VectorType.
-class DependentSizedExtVectorTypeLoc :
-public InheritingConcreteTypeLoc {
+class DependentSizedExtVectorTypeLoc
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
 struct MatrixTypeLocInfo {

diff  --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index f51c616169f5..fe775b82a1d6 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -6135,6 +6135,17 @@ namespace {
 void VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
   TL.setExpansionLoc(Chunk.Loc);
 }
+void VisitVectorTypeLoc(VectorTypeLoc TL) { TL.setNameLoc(Chunk.Loc); }
+void VisitDependentVectorTypeLoc(DependentVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void
+VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
 
 void VisitTypeLoc(TypeLoc TL) {
   llvm_unreachable("unsupported TypeLoc kind in declarator!");

diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 2cc8b9c8324f..0a596e50658b 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -5178,7 +5178,7 @@ template 
 QualType TreeTransform::TransformDependentVectorType(
 TypeLocBuilder , DependentVectorTypeLoc TL) {
   const 

[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2021-01-07 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGacbb3652931a: [AST][NFC] Silence GCC warning about multiline 
comments (authored by thopre).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92409

Files:
  clang/include/clang/AST/DeclOpenMP.h


Index: clang/include/clang/AST/DeclOpenMP.h
===
--- clang/include/clang/AST/DeclOpenMP.h
+++ clang/include/clang/AST/DeclOpenMP.h
@@ -163,7 +163,7 @@
 /// 'float':
 ///
 /// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in)
 /// initializer (omp_priv = 0)
 /// \endcode
 ///


Index: clang/include/clang/AST/DeclOpenMP.h
===
--- clang/include/clang/AST/DeclOpenMP.h
+++ clang/include/clang/AST/DeclOpenMP.h
@@ -163,7 +163,7 @@
 /// 'float':
 ///
 /// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in)
 /// initializer (omp_priv = 0)
 /// \endcode
 ///
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] acbb365 - [AST][NFC] Silence GCC warning about multiline comments

2021-01-07 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2021-01-07T17:11:49Z
New Revision: acbb3652931a735a861b756075b1cc86fd041761

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

LOG: [AST][NFC] Silence GCC warning about multiline comments

Remove continuation line in code snippet to prevent GCC warning about
multiline comments (-Wcomment) when building a project using libclang
with GCC.

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/include/clang/AST/DeclOpenMP.h

Removed: 




diff  --git a/clang/include/clang/AST/DeclOpenMP.h 
b/clang/include/clang/AST/DeclOpenMP.h
index e595ec98d914c..4aa5bde92e123 100644
--- a/clang/include/clang/AST/DeclOpenMP.h
+++ b/clang/include/clang/AST/DeclOpenMP.h
@@ -163,7 +163,7 @@ class OMPThreadPrivateDecl final : public 
OMPDeclarativeDirective {
 /// 'float':
 ///
 /// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in)
 /// initializer (omp_priv = 0)
 /// \endcode
 ///



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


[PATCH] D94233: [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute id changes

2021-01-07 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas added a comment.

No problem! I've pushed the commit on your behalf.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94233

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


[PATCH] D94233: [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute id changes

2021-01-07 Thread Lucas Prates via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG59fce6b06616: [NFC] make 
clang/test/CodeGen/arm_neon_intrinsics.c resistent to function… (authored by 
jeroen.dobbelaere, committed by pratlucas).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94233

Files:
  clang/test/CodeGen/arm_neon_intrinsics.c

Index: clang/test/CodeGen/arm_neon_intrinsics.c
===
--- clang/test/CodeGen/arm_neon_intrinsics.c
+++ clang/test/CodeGen/arm_neon_intrinsics.c
@@ -7114,7 +7114,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> [[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[ADD]]
 int32x4_t test_vmlal_lane_s16(int32x4_t a, int16x4_t b, int16x4_t c) {
@@ -7127,7 +7127,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[ADD]]
 int64x2_t test_vmlal_lane_s32(int64x2_t a, int32x2_t b, int32x2_t c) {
@@ -7140,7 +7140,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> [[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[ADD]]
 uint32x4_t test_vmlal_lane_u16(uint32x4_t a, uint16x4_t b, uint16x4_t c) {
@@ -7153,7 +7153,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmullu.v2i64(<2 x i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmullu.v2i64(<2 x i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[ADD]]
 uint64x2_t test_vmlal_lane_u32(uint64x2_t a, uint32x2_t b, uint32x2_t c) {
@@ -7618,7 +7618,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> [[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[SUB:%.*]] = sub <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[SUB]]
 int32x4_t test_vmlsl_lane_s16(int32x4_t a, int16x4_t b, int16x4_t c) {
@@ -7631,7 +7631,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[SUB:%.*]] = sub <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[SUB]]
 int64x2_t test_vmlsl_lane_s32(int64x2_t a, int32x2_t b, int32x2_t c) {
@@ -7644,7 +7644,7 @@
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> [[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   

[clang] 59fce6b - [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute id changes

2021-01-07 Thread Lucas Prates via cfe-commits

Author: Jeroen Dobbelaere
Date: 2021-01-07T17:08:15Z
New Revision: 59fce6b0661647062918a47bdb1874950d3938d5

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

LOG: [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function 
attribute id changes

When introducing support for @llvm.experimental.noalias.scope.decl, this tests 
started failing because it checks
(for no good reason) for a function attribute id of '#8' which now becomes '#9'

Reviewed By: pratlucas

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

Added: 


Modified: 
clang/test/CodeGen/arm_neon_intrinsics.c

Removed: 




diff  --git a/clang/test/CodeGen/arm_neon_intrinsics.c 
b/clang/test/CodeGen/arm_neon_intrinsics.c
index 9d3f35f48bb7..56e105a41962 100644
--- a/clang/test/CodeGen/arm_neon_intrinsics.c
+++ b/clang/test/CodeGen/arm_neon_intrinsics.c
@@ -7114,7 +7114,7 @@ uint64x2_t test_vmlal_u32(uint64x2_t a, uint32x2_t b, 
uint32x2_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> 
[[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[ADD]]
 int32x4_t test_vmlal_lane_s16(int32x4_t a, int16x4_t b, int16x4_t c) {
@@ -7127,7 +7127,7 @@ int32x4_t test_vmlal_lane_s16(int32x4_t a, int16x4_t b, 
int16x4_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> 
[[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[ADD]]
 int64x2_t test_vmlal_lane_s32(int64x2_t a, int32x2_t b, int32x2_t c) {
@@ -7140,7 +7140,7 @@ int64x2_t test_vmlal_lane_s32(int64x2_t a, int32x2_t b, 
int32x2_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> 
[[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[ADD]]
 uint32x4_t test_vmlal_lane_u16(uint32x4_t a, uint16x4_t b, uint16x4_t c) {
@@ -7153,7 +7153,7 @@ uint32x4_t test_vmlal_lane_u16(uint32x4_t a, uint16x4_t 
b, uint16x4_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> 
[[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmullu.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmullu.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[ADD]]
 uint64x2_t test_vmlal_lane_u32(uint64x2_t a, uint32x2_t b, uint32x2_t c) {
@@ -7618,7 +7618,7 @@ uint64x2_t test_vmlsl_u32(uint64x2_t a, uint32x2_t b, 
uint32x2_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> 
[[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[SUB:%.*]] = sub <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[SUB]]
 int32x4_t test_vmlsl_lane_s16(int32x4_t a, int16x4_t b, int16x4_t c) {
@@ -7631,7 +7631,7 @@ int32x4_t test_vmlsl_lane_s16(int32x4_t a, int16x4_t b, 
int16x4_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> 
[[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = 

[PATCH] D94169: [clang][driver] Restore the original help text for `-I`

2021-01-07 Thread Richard Barton via Phabricator via cfe-commits
richard.barton.arm accepted this revision.
richard.barton.arm added a comment.
This revision is now accepted and ready to land.

The rationale for this revert looks good to me.

I don't see the rationale behind the original change as it was committed 
without review. If @andrei99 gets back to us then we can consider reinstating 
it, perhaps in an adjusted form.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94169

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


[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2021-01-07 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

In D86844#2484639 , @atmnpatel wrote:

> In D86844#2484568 , @fhahn wrote:
>
>> In D86844#2481922 , @xbolva00 wrote:
>>
>>>   int a, b;
>>>   
>>>   int f(void) {
>>>   while (1) {
>>>   if (a != b) return 1;
>>>   }
>>>   return 0;
>>>   }
>>>   
>>>   int g(int a, int b) {
>>>   while (1) {
>>>   if (a != b) return 1;
>>>   }
>>>   return 0;
>>>   }
>>>
>>> LLVM does not catch these cases; gcc does.
>>>
>>> https://godbolt.org/z/jW7son
>>
>> Looks like `must progress` does not get added? If it gets added to the IR 
>> the loops get removed: https://godbolt.org/z/77v17P
>
> I might be misunderstanding the standard here but since 1 is a non-zero 
> constant expression, it can't be assumed to terminate by the implementation 
> right? The relevant section from C11 at least is "An iteration statement 
> whose controlling expression is not a constant expression that performs 
> [explanation of what it deems as progress] may be assumed by the 
> implementation to terminate" (C11 6.8.5 p6). I think these cases fall outside 
> of the scope of this particular change ...

For C yes, but are there such rules for C++? GCC in c++ mode does not check for 
non-zero constant expr and happily performs this optimization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86844

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


[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2021-01-07 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D86844#2484639 , @atmnpatel wrote:

> I might be misunderstanding the standard here but since 1 is a non-zero 
> constant expression, it can't be assumed to terminate by the implementation 
> right? The relevant section from C11 at least is "An iteration statement 
> whose controlling expression is not a constant expression that performs 
> [explanation of what it deems as progress] may be assumed by the 
> implementation to terminate" (C11 6.8.5 p6). I think these cases fall outside 
> of the scope of this particular change ...

The source is C++, so the C11 standard should be irrelevant. I left a comment 
at D86841 , this seems more appropriate to 
discuss the issue, as it is unrelated to `-loop-deletion`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86844

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


[PATCH] D86841: [clang] Add mustprogress and llvm.loop.mustprogress attribute deduction

2021-01-07 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added subscribers: xbolva00, fhahn.
fhahn added inline comments.



Comment at: clang/lib/CodeGen/CGStmt.cpp:799
   EmitBoolCondBranch = false;
+  FnIsMustProgress = false;
+}

Shouldn't this only apply for C? http://eel.is/c++draft/intro.progress#1 does 
not seem to have this escape hatch?

See the example by @xbolva00 for which we fail to eliminate the loops from a 
C++ source https://godbolt.org/z/jW7son


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86841

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


[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2021-01-07 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel added a comment.

In D86844#2484568 , @fhahn wrote:

> In D86844#2481922 , @xbolva00 wrote:
>
>>   int a, b;
>>   
>>   int f(void) {
>>   while (1) {
>>   if (a != b) return 1;
>>   }
>>   return 0;
>>   }
>>   
>>   int g(int a, int b) {
>>   while (1) {
>>   if (a != b) return 1;
>>   }
>>   return 0;
>>   }
>>
>> LLVM does not catch these cases; gcc does.
>>
>> https://godbolt.org/z/jW7son
>
> Looks like `must progress` does not get added? If it gets added to the IR the 
> loops get removed: https://godbolt.org/z/77v17P

I might be misunderstanding the standard here but since 1 is a non-zero 
constant expression, it can't be assumed to terminate by the implementation 
right? The relevant section from C11 at least is "An iteration statement whose 
controlling expression is not a constant expression that performs [explanation 
of what it deems as progress] may be assumed by the implementation to 
terminate" (C11 6.8.5 p6).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86844

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


[PATCH] D92409: [AST][NFC] Silence GCC warning about multiline comments

2021-01-07 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Okay, LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92409

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


[PATCH] D94239: [SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests

2021-01-07 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan created this revision.
abhina.sreeskantharajan added reviewers: Kai, fanbo-meng, muiez, zibi, 
hubert.reinterpretcast.
Herald added subscribers: wenlei, rupprecht, steven_wu, gbedwell, hiraditya, 
emaste.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: espindola.
Herald added a reviewer: andreadb.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
abhina.sreeskantharajan requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

On z/OS, the following error message is not matched correctly in lit tests. 
This patch updates the CHECK expression to match successfully.

  EDC5129I No such file or directory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94239

Files:
  clang/test/CodeGen/basic-block-sections.c
  clang/test/CodeGen/ubsan-blacklist-vfs.c
  clang/test/Frontend/stats-file.c
  lld/test/COFF/driver.test
  lld/test/COFF/manifestinput-error.test
  lld/test/COFF/nodefaultlib.test
  lld/test/COFF/pdb-type-server-invalid-signature.yaml
  lld/test/ELF/archive-thin-missing-member.s
  lld/test/ELF/basic.s
  lld/test/ELF/symbol-ordering-file.s
  llvm/test/DebugInfo/symbolize-missing-file.test
  llvm/test/tools/dsymutil/X86/papertrail-warnings.test
  llvm/test/tools/llvm-ar/missing-thin-archive-member.test
  llvm/test/tools/llvm-ar/replace.test
  llvm/test/tools/llvm-ar/response.test
  llvm/test/tools/llvm-cxxdump/trivial.test
  llvm/test/tools/llvm-lto2/X86/stats-file-option.ll
  llvm/test/tools/llvm-mc/basic.test
  llvm/test/tools/llvm-mca/invalid_input_file_name.test
  llvm/test/tools/llvm-ml/basic.test
  llvm/test/tools/llvm-objcopy/COFF/add-section.test
  llvm/test/tools/llvm-objcopy/ELF/add-section.test
  llvm/test/tools/llvm-objcopy/ELF/error-format.test
  llvm/test/tools/llvm-objcopy/MachO/add-section-error.test
  llvm/test/tools/llvm-objcopy/redefine-symbols.test
  llvm/test/tools/llvm-profdata/weight-instr.test
  llvm/test/tools/llvm-profdata/weight-sample.test
  llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test
  llvm/test/tools/llvm-readobj/basic.test
  llvm/test/tools/llvm-readobj/thin-archive.test
  llvm/test/tools/llvm-size/no-input.test
  llvm/test/tools/llvm-xray/X86/no-such-file.txt
  llvm/test/tools/obj2yaml/invalid_input_file.test
  llvm/test/tools/yaml2obj/output-file.yaml

Index: llvm/test/tools/yaml2obj/output-file.yaml
===
--- llvm/test/tools/yaml2obj/output-file.yaml
+++ llvm/test/tools/yaml2obj/output-file.yaml
@@ -9,7 +9,7 @@
 
 # RUN: not yaml2obj -o %p/path/does/not/exist 2>&1 | FileCheck %s
 
-# CHECK: yaml2obj: error: failed to open '{{.*}}/path/does/not/exist': {{[Nn]}}o such file or directory
+# CHECK: yaml2obj: error: failed to open '{{.*}}/path/does/not/exist': {{.*}}{{[Nn]}}o such file or directory
 
 !ELF
 FileHeader:
Index: llvm/test/tools/obj2yaml/invalid_input_file.test
===
--- llvm/test/tools/obj2yaml/invalid_input_file.test
+++ llvm/test/tools/obj2yaml/invalid_input_file.test
@@ -1,3 +1,3 @@
 # RUN: not obj2yaml  %p/path/does/not/exist 2>&1 | FileCheck %s
 
-# CHECK: Error reading file: {{.*}}/path/does/not/exist: {{[Nn]}}o such file or directory
+# CHECK: Error reading file: {{.*}}/path/does/not/exist: {{.*}}{{[Nn]}}o such file or directory
Index: llvm/test/tools/llvm-xray/X86/no-such-file.txt
===
--- llvm/test/tools/llvm-xray/X86/no-such-file.txt
+++ llvm/test/tools/llvm-xray/X86/no-such-file.txt
@@ -1,4 +1,4 @@
 ; RUN: not llvm-xray extract no-such-file 2>&1 | FileCheck %s
 
 ; CHECK: llvm-xray: Cannot extract instrumentation map from 'no-such-file'.
-; CHECK-NEXT: {{[Nn]}}o such file or directory
+; CHECK-NEXT: {{.*}}{{[Nn]}}o such file or directory
Index: llvm/test/tools/llvm-size/no-input.test
===
--- llvm/test/tools/llvm-size/no-input.test
+++ llvm/test/tools/llvm-size/no-input.test
@@ -1,7 +1,7 @@
 ## Show that llvm-size emits an error if passed in a non-existent file.
 
 # RUN: not llvm-size %t.blah 2>&1 | FileCheck %s -DFILE=%t.blah --check-prefix=ENOENT
-# ENOENT: {{.*}}llvm-size{{.*}}: error: '[[FILE]]': {{[Nn]}}o such file or directory
+# ENOENT: {{.*}}llvm-size{{.*}}: error: '[[FILE]]': {{.*}}{{[Nn]}}o such file or directory
 
 ## Show that llvm-size reads a.out if not passed any file.
 
Index: llvm/test/tools/llvm-readobj/thin-archive.test
===
--- llvm/test/tools/llvm-readobj/thin-archive.test
+++ llvm/test/tools/llvm-readobj/thin-archive.test
@@ -60,7 +60,7 @@
 # MISSING: File: {{.*}}1.o
 # MISSING: Format: elf64-x86-64
 # MISSING-NOT: File: {{.*}}3.o
-# ERR: error: '{{.*}}.a': '{{.*}}2.o': {{[Nn]}}o such file or directory
+# ERR: 

[PATCH] D94237: [clang] Use SourceLocations in unions

2021-01-07 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: dexonsmith, aprantl, rsmith.
Herald added a subscriber: jfb.
miyuki requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Currently, there are many instances where `SourceLocation` objects are
converted to raw representation to be stored in structs that are
used as fields of tagged unions.

This is done to make the corresponding structs trivial.
Triviality allows avoiding undefined behavior when implicitly changing
the active member of the union.

However, in most cases, we can explicitly construct an active member
using placement new. This patch adds the required active member
selections and replaces `SourceLocation`-s represented as
`unsigned int` with proper `SourceLocation`-s.

One notable exception is `DeclarationNameLoc`: the objects of this class
are often not properly initialized (so the code currently relies on
its default constructor which uses memset). This class will be fixed
in a separate patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94237

Files:
  clang/include/clang/AST/DependentDiagnostic.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Designator.h
  clang/include/clang/Sema/Initialization.h
  clang/lib/AST/Expr.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaType.cpp

Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -3125,11 +3125,11 @@
   diag::warn_qual_return_type,
   PTI.TypeQuals,
   SourceLocation(),
-  SourceLocation::getFromRawEncoding(PTI.ConstQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.VolatileQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.RestrictQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.AtomicQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.UnalignedQualLoc));
+  PTI.ConstQualLoc,
+  PTI.VolatileQualLoc,
+  PTI.RestrictQualLoc,
+  PTI.AtomicQualLoc,
+  PTI.UnalignedQualLoc);
   return;
 }
 
@@ -6086,7 +6086,7 @@
   }
 
   // Finally fill in MemberPointerLocInfo fields.
-  TL.setStarLoc(SourceLocation::getFromRawEncoding(Chunk.Mem.StarLoc));
+  TL.setStarLoc(Chunk.Mem.StarLoc);
   TL.setClassTInfo(ClsTInfo);
 }
 void VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
@@ -6152,7 +6152,7 @@
 llvm_unreachable("cannot be _Atomic qualified");
 
   case DeclaratorChunk::Pointer:
-Loc = SourceLocation::getFromRawEncoding(Chunk.Ptr.AtomicQualLoc);
+Loc = Chunk.Ptr.AtomicQualLoc;
 break;
 
   case DeclaratorChunk::BlockPointer:
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -2851,8 +2851,7 @@
   // turn this into Self->ivar, just return a BareIVarExpr or something.
   IdentifierInfo  = Context.Idents.get("self");
   UnqualifiedId SelfName;
-  SelfName.setIdentifier(, SourceLocation());
-  SelfName.setKind(UnqualifiedIdKind::IK_ImplicitSelfParam);
+  SelfName.setImplcitSelfParam();
   CXXScopeSpec SelfScopeSpec;
   SourceLocation TemplateKWLoc;
   ExprResult SelfExpr =
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5342,8 +5342,8 @@
   case UnqualifiedIdKind::IK_OperatorFunctionId:
 NameInfo.setName(Context.DeclarationNames.getCXXOperatorName(
Name.OperatorFunctionId.Operator));
-NameInfo.getInfo().CXXOperatorName.BeginOpNameLoc
-  = Name.OperatorFunctionId.SymbolLocations[0];
+NameInfo.getInfo().CXXOperatorName.BeginOpNameLoc =
+Name.OperatorFunctionId.SymbolLocations[0].getRawEncoding();
 NameInfo.getInfo().CXXOperatorName.EndOpNameLoc
   = Name.EndLocation.getRawEncoding();
 return NameInfo;
Index: clang/lib/Sema/DeclSpec.cpp
===
--- clang/lib/Sema/DeclSpec.cpp
+++ clang/lib/Sema/DeclSpec.cpp
@@ -191,28 +191,29 @@
   I.Kind= Function;
   I.Loc = LocalRangeBegin;
   I.EndLoc  = LocalRangeEnd;
+  new () FunctionTypeInfo;
   I.Fun.hasPrototype= hasProto;
   I.Fun.isVariadic  = EllipsisLoc.isValid();
   I.Fun.isAmbiguous = isAmbiguous;
-  I.Fun.LParenLoc   = LParenLoc.getRawEncoding();
-  I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding();
-  I.Fun.RParenLoc   = RParenLoc.getRawEncoding();
+  I.Fun.LParenLoc   

  1   2   >