[PATCH] D108320: Add semantic token modifier for non-const reference parameter

2021-08-18 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

Thanks -- this patch is looking great so far!




Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:314
 //   (these tend to be vague, like Type or Unknown)
+// - Resolved tokens (i.e. without the "dependent-name" modifier) with kind
+//   "Unknown" are less reliable than resolved tokens with other kinds

We should consider the case where a dependent name is passed by non-const 
reference, for example:

```
void increment_counter(int&);

template 
void bar() {
   increment_counter(T::static_counter);
}
```

This case does not work yet with the current patch (the dependent name is a 
`DependentScopeDeclRefExpr` rather than a `DeclRefExpr`), but we'll want to 
make it work in the future.

With the conflict resolution logic in this patch, the `Unknown` token kind from 
`highlightPassedByNonConstReference()` will be chosen over the dependent token 
kind.

As it happens, the dependent token kind for expressions is also `Unknown` so it 
doesn't matter, but perhaps we shouldn't be relying on this. Perhaps the 
following would make more sense:

1. a token with `Unknown` as the kind has the lowest priority
2. then a token with the `DependentName` modifier (next lowest)
3. then everything else?



Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:515
+// Highlighting parameters passed by non-const reference does not really
+// make sence for these
+if (isa(E) || isa(E))

nit: sense



Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:530
+  const FunctionDecl *FD,
+  llvm::function_ref GetArgExprAtIndex) {
+if (!FD)

We can avoid the callback by constructing an ArrayRef of the arguments, see a 
similar case here:

https://searchfox.org/llvm/source/clang-tools-extra/clangd/InlayHints.cpp#56
https://searchfox.org/llvm/source/clang-tools-extra/clangd/InlayHints.cpp#79



Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:542
+// Is this parameter passed by non-const reference?
+if (T->isLValueReferenceType() && !isConst(T)) {
+  if (auto *Arg = GetArgExprAtIndex(I)) {

I think there are some edge cases where `isConst()` doesn't do what we want.

For example, I think for a parameter of type `const int*&`, it will return 
`true` (and thus we will **not** highlight the corresponding argument), even 
thus this is actually a non-const reference.

So, we may want to use a dedicated function that specifically handles 
reference-related logic only.

(This probably also makes a good test case.)



Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:547
+if (isa(Arg)) {
+  Location = Arg->getBeginLoc();
+} else if (auto *M = dyn_cast(Arg)) {

For a qualified name (e.g. `A::B`), I think this is going to return the 
beginning of the qualifier, whereas we only want to highlight the last name 
(otherwise there won't be a matching token from the first pass).

So I think we want `getLocation()` instead.

(Also makes a good test case.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108320

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


[clang] f5d5f17 - Revert "[HIP] Allow target addr space in target builtins"

2021-08-18 Thread Anshil Gandhi via cfe-commits

Author: Anshil Gandhi
Date: 2021-08-18T21:38:42-06:00
New Revision: f5d5f17d3ad455de2fbb9448acea66cbc09561c5

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

LOG: Revert "[HIP] Allow target addr space in target builtins"

This reverts commit a35008955fa606487f79a050f5cc80fc7ee84dda.

Added: 


Modified: 
clang/include/clang/AST/Type.h
clang/lib/Basic/Targets/AMDGPU.h
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGenCUDA/builtins-amdgcn.cu

Removed: 




diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index fc83c895afa2e..09e9705bd86b8 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -495,12 +495,7 @@ class Qualifiers {
(A == LangAS::Default &&
 (B == LangAS::sycl_private || B == LangAS::sycl_local ||
  B == LangAS::sycl_global || B == LangAS::sycl_global_device ||
- B == LangAS::sycl_global_host)) ||
-   // In HIP device compilation, any cuda address space is allowed
-   // to implicitly cast into the default address space.
-   (A == LangAS::Default &&
-(B == LangAS::cuda_constant || B == LangAS::cuda_device ||
- B == LangAS::cuda_shared));
+ B == LangAS::sycl_global_host));
   }
 
   /// Returns true if the address space in these qualifiers is equal to or

diff  --git a/clang/lib/Basic/Targets/AMDGPU.h 
b/clang/lib/Basic/Targets/AMDGPU.h
index f8772cbe244f0..2e580ecf24259 100644
--- a/clang/lib/Basic/Targets/AMDGPU.h
+++ b/clang/lib/Basic/Targets/AMDGPU.h
@@ -352,16 +352,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : 
public TargetInfo {
   }
 
   LangAS getCUDABuiltinAddressSpace(unsigned AS) const override {
-switch (AS) {
-case 1:
-  return LangAS::cuda_device;
-case 3:
-  return LangAS::cuda_shared;
-case 4:
-  return LangAS::cuda_constant;
-default:
-  return getLangASFromTargetAS(AS);
-}
+return LangAS::Default;
   }
 
   llvm::Optional getConstantAddressSpace() const override {

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5bde87d02877e..8ef4a9d96320b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6572,53 +6572,6 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, 
SourceLocation LParenLoc,
   return ExprError();
 
 checkDirectCallValidity(*this, Fn, FD, ArgExprs);
-
-// If this expression is a call to a builtin function in HIP device
-// compilation, allow a pointer-type argument to default address space to 
be
-// passed as a pointer-type parameter to a non-default address space.
-// If Arg is declared in the default address space and Param is declared
-// in a non-default address space, perform an implicit address space cast 
to
-// the parameter type.
-if (getLangOpts().HIP && getLangOpts().CUDAIsDevice && FD &&
-FD->getBuiltinID()) {
-  for (unsigned Idx = 0; Idx < FD->param_size(); ++Idx) {
-ParmVarDecl *Param = FD->getParamDecl(Idx);
-if (!ArgExprs[Idx] || !Param || !Param->getType()->isPointerType() ||
-!ArgExprs[Idx]->getType()->isPointerType())
-  continue;
-
-auto ParamAS = Param->getType()->getPointeeType().getAddressSpace();
-auto ArgTy = ArgExprs[Idx]->getType();
-auto ArgPtTy = ArgTy->getPointeeType();
-auto ArgAS = ArgPtTy.getAddressSpace();
-
-// Only allow implicit casting from a non-default address space pointee
-// type to a default address space pointee type
-if (ArgAS != LangAS::Default || ParamAS == LangAS::Default)
-  continue;
-
-// First, ensure that the Arg is an RValue.
-if (ArgExprs[Idx]->isGLValue()) {
-  ArgExprs[Idx] = ImplicitCastExpr::Create(
-  Context, ArgExprs[Idx]->getType(), CK_NoOp, ArgExprs[Idx],
-  nullptr, VK_PRValue, FPOptionsOverride());
-}
-
-// Construct a new arg type with address space of Param
-Qualifiers ArgPtQuals = ArgPtTy.getQualifiers();
-ArgPtQuals.setAddressSpace(ParamAS);
-auto NewArgPtTy =
-Context.getQualifiedType(ArgPtTy.getUnqualifiedType(), ArgPtQuals);
-auto NewArgTy =
-Context.getQualifiedType(Context.getPointerType(NewArgPtTy),
- ArgTy.getQualifiers());
-
-// Finally perform an implicit address space cast
-ArgExprs[Idx] = ImpCastExprToType(ArgExprs[Idx], NewArgTy,
-  CK_AddressSpaceConversion)
-.get();
-  }
-}
   }
 
   if (Context.isDependenceAllowed() &&

diff  --git 

[PATCH] D105168: [RISCV] Unify the arch string parsing logic to RISCVISAInfo.

2021-08-18 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng added a comment.

ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105168

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


[PATCH] D105267: [X86] AVX512FP16 instructions enabling 4/6

2021-08-18 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added inline comments.



Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:1920
+  setOperationAction(ISD::STRICT_FTRUNC,  VT, Legal);
+  setOperationAction(ISD::FRINT,  VT, Legal);
+  setOperationAction(ISD::STRICT_FRINT,   VT, Legal);

craig.topper wrote:
> LuoYuanke wrote:
> > Does this node means "round to int"? What's the difference to "FNEARBYINT"?
> rint and nearbyint are both C math library functions. rint raises an 
> exception if the rounding isn't exact, nearbyint doesn't.
Got it. Thanks. :)



Comment at: llvm/lib/Target/X86/X86InstrFoldTables.cpp:3037
   { X86::VSQRTSDr_Int, X86::VSQRTSDm_Int, 
TB_NO_REVERSE },
+  { X86::VSQRTSHZr,X86::VSQRTSHZm,0 },
+  { X86::VSQRTSHZr_Int,X86::VSQRTSHZm_Int,
TB_NO_REVERSE },

craig.topper wrote:
> LuoYuanke wrote:
> > Why no TB_NO_REVERSE for it?
> Only the _Int need TB_NO_REVERSE because the memory type is 16 bits but the 
> register class is VR128X so the sizes are different. The unfolding code would 
> use the size of the register class to do the unfold and create a 
> vmovaps/vmovups which would increase the size of the load.
> 
> For VSQRTZr, the register class is FR16X and the memory size is 16 bits so 
> they match.
Got it. Thanks. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105267

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


[PATCH] D108021: [dllexport] Instantiate default ctor default args

2021-08-18 Thread Peter Jiachen via Phabricator via cfe-commits
peterjc123 added a comment.

Sure, please do that.




Comment at: clang/lib/Sema/SemaDeclCXX.cpp:6012
+auto *CD = dyn_cast(MD);
+if (CD && CD->isDefaultConstructor() && TSK == TSK_Undeclared) {
+  S.InstantiateDefaultCtorDefaultArgs(CD);

rnk wrote:
> This should probably happen when explicit instantiation definitions are 
> exported, so the `TSK_ExplicitInstantiationDefinition` case. However, I don't 
> consider it a blocking issue.
Well, I cannot constuct one code example that includes explicit instantiation 
definitions which triggers this problem. If you could provide one, then I may 
look into it.


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

https://reviews.llvm.org/D108021

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


[PATCH] D107878: [SampleFDO] Flow Sensitive Sample FDO (FSAFDO) profile loader

2021-08-18 Thread Rong Xu 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 rG5fdaaf7fd8f3: [SampleFDO] Flow Sensitive Sample FDO (FSAFDO) 
profile loader (authored by xur).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D107878?vs=367321=367381#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107878

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/CodeGen/MIRSampleProfile.h
  llvm/include/llvm/CodeGen/MachineDominators.h
  llvm/include/llvm/CodeGen/MachineOptimizationRemarkEmitter.h
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Support/PGOOptions.h
  llvm/include/llvm/Target/TargetMachine.h
  llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
  llvm/lib/CodeGen/CMakeLists.txt
  llvm/lib/CodeGen/MIRSampleProfile.cpp
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/CodeGen/X86/Inputs/fsloader.afdo
  llvm/test/CodeGen/X86/fsafdo_test2.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -284,6 +284,9 @@
   P->CSAction = PGOOptions::CSIRUse;
 }
   }
+  if (TM)
+TM->setPGOOption(P);
+
   LoopAnalysisManager LAM;
   FunctionAnalysisManager FAM;
   CGSCCAnalysisManager CGAM;
Index: llvm/test/CodeGen/X86/fsafdo_test2.ll
===
--- llvm/test/CodeGen/X86/fsafdo_test2.ll
+++ llvm/test/CodeGen/X86/fsafdo_test2.ll
@@ -1,4 +1,7 @@
 ; RUN: llc -enable-fs-discriminator < %s | FileCheck %s
+; RUN: llvm-profdata merge --sample -profile-isfs -o %t.afdo %S/Inputs/fsloader.afdo
+; RUN: llc -enable-fs-discriminator -fs-profile-file=%t.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefix=LOADER
+;
 ;;
 ;; C source code for the test (compiler at -O3):
 ;; // A test case for loop unroll.
@@ -50,6 +53,25 @@
 ; CHECK: .byte   1
 ; CHECK: .size   __llvm_fs_discriminator__, 1
 
+;; Check that new branch probs are generated.
+; LOADER: Set branch fs prob: MBB (1 -> 3): unroll.c:22:11-->unroll.c:24:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x7aca7894 / 0x8000 = 95.93%
+; LOADER: Set branch fs prob: MBB (1 -> 2): unroll.c:22:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x0535876c / 0x8000 = 4.07%
+; LOADER: Set branch fs prob: MBB (3 -> 5): unroll.c:24:11-->unroll.c:22:11 W=283590  0x3000 / 0x8000 = 37.50% --> 0x7aca7894 / 0x8000 = 95.93%
+; LOADER: Set branch fs prob: MBB (3 -> 4): unroll.c:24:11 W=283590  0x5000 / 0x8000 = 62.50% --> 0x0535876c / 0x8000 = 4.07%
+; LOADER: Set branch fs prob: MBB (5 -> 8): unroll.c:22:11-->unroll.c:24:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x021c112e / 0x8000 = 1.65%
+; LOADER: Set branch fs prob: MBB (5 -> 7): unroll.c:22:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x7de3eed2 / 0x8000 = 98.35%
+; LOADER: Set branch fs prob: MBB (8 -> 10): unroll.c:24:11-->unroll.c:22:11 W=283590  0x3000 / 0x8000 = 37.50% --> 0x / 0x8000 = 0.00%
+; LOADER: Set branch fs prob: MBB (8 -> 9): unroll.c:24:11 W=283590  0x5000 / 0x8000 = 62.50% --> 0x8000 / 0x8000 = 100.00%
+; LOADER: Set branch fs prob: MBB (10 -> 12): unroll.c:22:11-->unroll.c:24:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x7aca7894 / 0x8000 = 95.93%
+; LOADER: Set branch fs prob: MBB (10 -> 11): unroll.c:22:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x0535876c / 0x8000 = 4.07%
+; LOADER: Set branch fs prob: MBB (12 -> 14): unroll.c:24:11-->unroll.c:22:11 W=283590  0x3000 / 0x8000 = 37.50% --> 0x02012507 / 0x8000 = 1.57%
+; LOADER: Set branch fs prob: MBB (12 -> 13): unroll.c:24:11 W=283590  0x5000 / 0x8000 = 62.50% --> 0x7dfedaf9 / 0x8000 = 98.43%
+; LOADER: Set branch fs prob: MBB (14 -> 16): unroll.c:22:11-->unroll.c:24:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x0a5856e1 / 0x8000 = 8.08%
+; LOADER: Set branch fs prob: MBB (14 -> 15): unroll.c:22:11 W=283590  0x4000 / 0x8000 = 50.00% --> 0x75a7a91f / 0x8000 = 91.92%
+; LOADER: Set branch fs prob: MBB (16 -> 18): unroll.c:24:11-->unroll.c:19:3 W=283590  0x3000 / 0x8000 = 37.50% --> 0x16588166 / 0x8000 = 17.46%
+; LOADER: Set branch fs prob: MBB (16 -> 17): unroll.c:24:11 W=283590  0x5000 / 0x8000 = 62.50% --> 0x69a77e9a / 0x8000 = 82.54%
+
+
 target triple = "x86_64-unknown-linux-gnu"
 
 @sum = dso_local local_unnamed_addr 

[clang] 5fdaaf7 - [SampleFDO] Flow Sensitive Sample FDO (FSAFDO) profile loader

2021-08-18 Thread Rong Xu via cfe-commits

Author: Rong Xu
Date: 2021-08-18T18:37:35-07:00
New Revision: 5fdaaf7fd8f35ac9c9de50a45b09e29c7b0d48c4

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

LOG: [SampleFDO] Flow Sensitive Sample FDO (FSAFDO) profile loader

This patch implements Flow Sensitive Sample FDO (FSAFDO) profile
loader. We have two profile loaders for FS profile,
one before RegAlloc and one before BlockPlacement.

To enable it, when -fprofile-sample-use= is specified,
add "-enable-fs-discriminator=true \
 -disable-ra-fsprofile-loader=false \
 -disable-layout-fsprofile-loader=false"
to turn on the FS profile loaders.

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

Added: 
llvm/include/llvm/CodeGen/MIRSampleProfile.h
llvm/include/llvm/Support/PGOOptions.h
llvm/lib/CodeGen/MIRSampleProfile.cpp
llvm/test/CodeGen/X86/Inputs/fsloader.afdo

Modified: 
clang/lib/CodeGen/BackendUtil.cpp
llvm/include/llvm/CodeGen/MachineDominators.h
llvm/include/llvm/CodeGen/MachineOptimizationRemarkEmitter.h
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Passes/PassBuilder.h
llvm/include/llvm/Target/TargetMachine.h
llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/CodeGen/X86/fsafdo_test2.ll
llvm/tools/opt/NewPMDriver.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 9e4e40a36e056..404d2680fac35 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1261,6 +1261,8 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
   "", PGOOptions::NoAction, PGOOptions::CSIRInstr,
   CodeGenOpts.DebugInfoForProfiling);
   }
+  if (TM)
+TM->setPGOOption(PGOOpt);
 
   PipelineTuningOptions PTO;
   PTO.LoopUnrolling = CodeGenOpts.UnrollLoops;

diff  --git a/llvm/include/llvm/CodeGen/MIRSampleProfile.h 
b/llvm/include/llvm/CodeGen/MIRSampleProfile.h
new file mode 100644
index 0..7872daf3a54c6
--- /dev/null
+++ b/llvm/include/llvm/CodeGen/MIRSampleProfile.h
@@ -0,0 +1,81 @@
+//===- MIRSampleProfile.h: SampleFDO Support in MIR ---*- 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 contains the supoorting functions for machine level Sample FDO
+// loader. This is used in Flow Sensitive SampelFDO.
+//
+//===--===//
+
+#ifndef LLVM_CODEGEN_MIRSAMPLEPROFILE_H
+#define LLVM_CODEGEN_MIRSAMPLEPROFILE_H
+
+#include "llvm/Analysis/ProfileSummaryInfo.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
+#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
+#include "llvm/CodeGen/MachineDominators.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
+#include "llvm/CodeGen/MachinePostDominators.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/IR/DebugInfoMetadata.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Module.h"
+#include "llvm/InitializePasses.h"
+#include "llvm/ProfileData/InstrProf.h"
+#include "llvm/ProfileData/SampleProf.h"
+#include "llvm/ProfileData/SampleProfReader.h"
+
+#include 
+
+namespace llvm {
+
+using namespace sampleprof;
+
+class MIRProfileLoader;
+class MIRProfileLoaderPass : public MachineFunctionPass {
+  MachineFunction *MF;
+  std::string ProfileFileName;
+  FSDiscriminatorPass P;
+  unsigned LowBit;
+  unsigned HighBit;
+
+public:
+  static char ID;
+  /// FS bits will only use the '1' bits in the Mask.
+  MIRProfileLoaderPass(std::string FileName = "",
+   std::string RemappingFileName = "",
+   FSDiscriminatorPass P = FSDiscriminatorPass::Pass1)
+  : MachineFunctionPass(ID), ProfileFileName(FileName), P(P),
+MIRSampleLoader(
+std::make_unique(FileName, RemappingFileName)) {
+LowBit = getFSPassBitBegin(P);
+HighBit = getFSPassBitEnd(P);
+assert(LowBit < HighBit && "HighBit needs to be greater than Lowbit");
+  }
+
+  /// getMachineFunction - Return the last machine function 

[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-18 Thread Jon Chesterfield 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 rGdbd7bad9ad9b: [openmp] Annotate tmp variables with 
omp_thread_mem_alloc (authored by JonChesterfield).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/Inputs/include/omp.h

Index: clang/test/Headers/Inputs/include/omp.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/omp.h
@@ -0,0 +1,21 @@
+#ifndef __OMP_H
+#define __OMP_H
+
+#if _OPENMP
+// Follows the pattern in interface.h
+// Clang sema checks this type carefully, needs to closely match that from omp.h
+typedef enum omp_allocator_handle_t {
+  omp_null_allocator = 0,
+  omp_default_mem_alloc = 1,
+  omp_large_cap_mem_alloc = 2,
+  omp_const_mem_alloc = 3,
+  omp_high_bw_mem_alloc = 4,
+  omp_low_lat_mem_alloc = 5,
+  omp_cgroup_mem_alloc = 6,
+  omp_pteam_mem_alloc = 7,
+  omp_thread_mem_alloc = 8,
+  KMP_ALLOCATOR_MAX_HANDLE = ~(0U)
+} omp_allocator_handle_t;
+#endif
+
+#endif
Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -19,6 +19,9 @@
 #endif
 #include 
 #include 
+#ifdef __OPENMP_AMDGCN__
+#include 
+#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -258,6 +261,9 @@
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -343,6 +349,9 @@
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -423,6 +432,9 @@
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -479,6 +491,9 @@
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -487,6 +502,9 @@
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -799,6 +817,9 @@
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -883,6 +904,9 @@
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -971,6 +995,9 @@
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1029,6 +1056,9 @@
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ -1037,6 +1067,9 @@
 __DEVICE__
 void sincospi(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] dbd7bad - [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-18 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-08-19T02:22:11+01:00
New Revision: dbd7bad9ad9bc32538e324417c23387bf4ac7747

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

LOG: [openmp] Annotate tmp variables with omp_thread_mem_alloc

Fixes miscompile of calls into ocml. Bug 51445.

The stack variable `double __tmp` is moved to dynamically allocated shared
memory by CGOpenMPRuntimeGPU. This is usually fine, but when the variable
is passed to a function that is explicitly annotated address_space(5) then
allocating the variable off-stack leads to a miscompile in the back end,
which cannot decide to move the variable back to the stack from shared.

This could be fixed by removing the AS(5) annotation from the math library
or by explicitly marking the variables as thread_mem_alloc. The cast to
AS(5) is still a no-op once IR is reached.

Reviewed By: jdoerfert

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

Added: 
clang/test/Headers/Inputs/include/omp.h

Modified: 
clang/lib/Headers/__clang_hip_math.h

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_math.h 
b/clang/lib/Headers/__clang_hip_math.h
index 9effaa18d3e8c..ef7e087b832ca 100644
--- a/clang/lib/Headers/__clang_hip_math.h
+++ b/clang/lib/Headers/__clang_hip_math.h
@@ -19,6 +19,9 @@
 #endif
 #include 
 #include 
+#ifdef __OPENMP_AMDGCN__
+#include 
+#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -258,6 +261,9 @@ float fmodf(float __x, float __y) { return 
__ocml_fmod_f32(__x, __y); }
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -343,6 +349,9 @@ long int lroundf(float __x) { return __ocml_round_f32(__x); 
}
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -423,6 +432,9 @@ float remainderf(float __x, float __y) {
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -479,6 +491,9 @@ __RETURN_TYPE __signbitf(float __x) { return 
__ocml_signbit_f32(__x); }
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float 
*)&__tmp);
   *__cosptr = __tmp;
@@ -487,6 +502,9 @@ void sincosf(float __x, float *__sinptr, float *__cosptr) {
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -799,6 +817,9 @@ double fmod(double __x, double __y) { return 
__ocml_fmod_f64(__x, __y); }
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -883,6 +904,9 @@ long int lround(double __x) { return __ocml_round_f64(__x); 
}
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -971,6 +995,9 @@ double remainder(double __x, double __y) {
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1029,6 +1056,9 @@ double sin(double __x) { return __ocml_sin_f64(__x); }
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ 

[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 367374.
JonChesterfield added a comment.

- add minimal omp.h to clang test inputs


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

Files:
  clang/lib/Headers/__clang_hip_math.h
  clang/test/Headers/Inputs/include/omp.h

Index: clang/test/Headers/Inputs/include/omp.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/omp.h
@@ -0,0 +1,21 @@
+#ifndef __OMP_H
+#define __OMP_H
+
+#if _OPENMP
+// Follows the pattern in interface.h
+// Clang sema checks this type carefully, needs to closely match that from omp.h
+typedef enum omp_allocator_handle_t {
+  omp_null_allocator = 0,
+  omp_default_mem_alloc = 1,
+  omp_large_cap_mem_alloc = 2,
+  omp_const_mem_alloc = 3,
+  omp_high_bw_mem_alloc = 4,
+  omp_low_lat_mem_alloc = 5,
+  omp_cgroup_mem_alloc = 6,
+  omp_pteam_mem_alloc = 7,
+  omp_thread_mem_alloc = 8,
+  KMP_ALLOCATOR_MAX_HANDLE = ~(0U)
+} omp_allocator_handle_t;
+#endif
+
+#endif
Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -19,6 +19,9 @@
 #endif
 #include 
 #include 
+#ifdef __OPENMP_AMDGCN__
+#include 
+#endif
 #endif // !defined(__HIPCC_RTC__)
 
 #pragma push_macro("__DEVICE__")
@@ -258,6 +261,9 @@
 __DEVICE__
 float frexpf(float __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -343,6 +349,9 @@
 __DEVICE__
 float modff(float __x, float *__iptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r =
   __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__iptr = __tmp;
@@ -423,6 +432,9 @@
 __DEVICE__
 float remquof(float __x, float __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   float __r = __ocml_remquo_f32(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -479,6 +491,9 @@
 __DEVICE__
 void sincosf(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr =
   __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -487,6 +502,9 @@
 __DEVICE__
 void sincospif(float __x, float *__sinptr, float *__cosptr) {
   float __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f32(
   __x, (__attribute__((address_space(5))) float *)&__tmp);
   *__cosptr = __tmp;
@@ -799,6 +817,9 @@
 __DEVICE__
 double frexp(double __x, int *__nptr) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
   *__nptr = __tmp;
@@ -883,6 +904,9 @@
 __DEVICE__
 double modf(double __x, double *__iptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r =
   __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
   *__iptr = __tmp;
@@ -971,6 +995,9 @@
 __DEVICE__
 double remquo(double __x, double __y, int *__quo) {
   int __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   double __r = __ocml_remquo_f64(
   __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
   *__quo = __tmp;
@@ -1029,6 +1056,9 @@
 __DEVICE__
 void sincos(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincos_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
@@ -1037,6 +1067,9 @@
 __DEVICE__
 void sincospi(double __x, double *__sinptr, double *__cosptr) {
   double __tmp;
+#ifdef __OPENMP_AMDGCN__
+#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
+#endif
   *__sinptr = __ocml_sincospi_f64(
   __x, (__attribute__((address_space(5))) double *)&__tmp);
   *__cosptr = __tmp;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108286: [clang][Driver][Linux] fix regression issue when define LIBCXX_LIBDIR_SUFFIX=64

2021-08-18 Thread lin.sun via Phabricator via cfe-commits
sunlin added inline comments.



Comment at: clang/lib/Driver/ToolChains/Linux.cpp:307
+  if (StringRef(D.Dir).startswith(SysRoot)) {
 addPathIfExists(D, D.Dir + "/../lib", Paths);
+addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);

MaskRay wrote:
> Is `D.Dir + "/../lib"` still needed?
Yes, it's still usefull. When running the clang from compiled folder (eg: 
`.../build.debug/bin/clang`), it will try to access the 
`.../build.debug/bin/../lib`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108286

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


[PATCH] D108286: [clang][Driver][Linux] fix regression issue when define LIBCXX_LIBDIR_SUFFIX=64

2021-08-18 Thread lin.sun via Phabricator via cfe-commits
sunlin added a comment.

In D108286#2952511 , @MaskRay wrote:

> Please provide more information: the platform name and the output of `g++ 
> empty.cc '-###' |& sed -E 's/ "?-[LiIr]/\n&/g'`
>
> Note that there is a FIXME. It's unclear why your platform needs the specific 
> rule.

The root cause is clang13 lost the ".../lib64" in  LIBRARY_PATH conparing to 
clang12 source code.
This patch is try to add the line back from clang 12 
https://github.com/llvm/llvm-project/blob/fed41342a82f5a3a9201819a82bf7a48313e296b/clang/lib/Driver/ToolChains/Linux.cpp#L309.

Anyway, the g++ output are list as below.
$ g++ empty.cc '-###' |& sed -E 's/ "?-[LiIr]/\n&/g'
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla 
--enable-bootstrap --enable-shared --enable-threads=posix 
--enable-checking=release --with-system-zlib --enable-__cxa_atexit 
--disable-libunwind-exceptions --enable-gnu-unique-object 
--enable-linker-build-id --with-linker-hash-style=gnu 
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin 
--enable-initfini-array --disable-libgcj 
--with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install
 
--with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install
 --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
COLLECT_GCC_OPTIONS='-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1plus -quiet -D_GNU_SOURCE 
empty.cc -quiet -dumpbase empty.cc "-mtune=generic" "-march=x86-64" -auxbase 
empty -o /tmp/ccaC9lqH.s
COLLECT_GCC_OPTIONS='-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as --64 -o /tmp/cctILs46.o /tmp/ccaC9lqH.s
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.5/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 --build-id --no-add-needed 
--eh-frame-hdr "--hash-style=gnu" -m elf_x86_64 -dynamic-linker 
/lib64/ld-linux-x86-64.so.2 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crti.o 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o
 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5
 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64
 -L/lib/../lib64
 -L/usr/lib/../lib64
 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../.. /tmp/cctILs46.o "-lstdc++" 
-lm -lgcc_s -lgcc -lc -lgcc_s -lgcc 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crtn.o


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108286

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


[PATCH] D108265: .clang-tidy: Push variable related readability-identifier-naming options down to projects

2021-08-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Raised https://lists.llvm.org/pipermail/llvm-dev/2021-August/152210.html 
("Top-level .clang-tidy options and VariableName suggestion on CodingStandards")


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108265

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


[PATCH] D107971: [openmp] Annotate tmp variables with omp_thread_mem_alloc

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

intended content for the new omp.h is

  #ifndef __OMP_H
  #define __OMP_H
  
  #if _OPENMP
  // Follows the pattern in interface.h
  // Clang sema checks this type carefully, needs to closely match that from 
omp.h
  typedef enum omp_allocator_handle_t {
omp_null_allocator = 0,
omp_default_mem_alloc = 1,
omp_large_cap_mem_alloc = 2,
omp_const_mem_alloc = 3,
omp_high_bw_mem_alloc = 4,
omp_low_lat_mem_alloc = 5,
omp_cgroup_mem_alloc = 6,
omp_pteam_mem_alloc = 7,
omp_thread_mem_alloc = 8,
KMP_ALLOCATOR_MAX_HANDLE = ~(0U)
  } omp_allocator_handle_t;
  #endif
  
  #endif

trying to reproduce the failure locally first to verify that the fix works


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107971

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


[PATCH] D108265: .clang-tidy: Push variable related readability-identifier-naming options down to projects

2021-08-18 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

The current state of the root `.clang-tidy` accurately reflects the LLVM Coding 
Conventions as documented, which applies to LLVM and its subprojects (some 
subprojects have diverged from this standard).

The place for a discussion to change the naming convention is not here. It is 
on llvm-dev, like the original discussion that spawned the (not-yet-accepted, 
as it says in its opening sentence) linked proposal around variable naming.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108265

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


[PATCH] D108339: [openmp][nfc] Replace OMPGridValues array with struct

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, dpalermo, gregrodgers, ronlieb, 
tianshilei1992, grokos.
Herald added subscribers: kerbowa, guansong, tpr, yaxunl, nhaehnle, jvesely, 
jholewinski.
JonChesterfield requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, sstefan1.
Herald added projects: clang, OpenMP, LLVM.

[nfc] Replaces enum indices into an array with a struct. Named the
fields to match the enum, leaves memory layout and initialization unchanged.

Motivation is to later safely remove dead fields and replace redundant ones
with (compile time) computation. It should also be possible to factor some
common fields into a base and introduce a gfx10 amdgpu instance with less
duplication than the arrays of integers require.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108339

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/NVPTX.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeAMDGCN.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h
  openmp/libomptarget/plugins/amdgpu/src/rtl.cpp

Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -501,14 +501,11 @@
   static const unsigned HardTeamLimit =
   (1 << 16) - 1; // 64K needed to fit in uint16
   static const int DefaultNumTeams = 128;
-  static const int Max_Teams =
-  llvm::omp::AMDGPUGpuGridValues[llvm::omp::GVIDX::GV_Max_Teams];
-  static const int Warp_Size =
-  llvm::omp::AMDGPUGpuGridValues[llvm::omp::GVIDX::GV_Warp_Size];
-  static const int Max_WG_Size =
-  llvm::omp::AMDGPUGpuGridValues[llvm::omp::GVIDX::GV_Max_WG_Size];
+  static const int Max_Teams = llvm::omp::AMDGPUGridValues.GV_Max_Teams;
+  static const int Warp_Size = llvm::omp::AMDGPUGridValues.GV_Warp_Size;
+  static const int Max_WG_Size = llvm::omp::AMDGPUGridValues.GV_Max_WG_Size;
   static const int Default_WG_Size =
-  llvm::omp::AMDGPUGpuGridValues[llvm::omp::GVIDX::GV_Default_WG_Size];
+  llvm::omp::AMDGPUGridValues.GV_Default_WG_Size;
 
   using MemcpyFunc = hsa_status_t (*)(hsa_signal_t, void *, const void *,
   size_t size, hsa_agent_t);
@@ -1058,9 +1055,8 @@
 DeviceInfo.WarpSize[device_id] = wavefront_size;
   } else {
 DP("Default wavefront size: %d\n",
-   llvm::omp::AMDGPUGpuGridValues[llvm::omp::GVIDX::GV_Warp_Size]);
-DeviceInfo.WarpSize[device_id] =
-llvm::omp::AMDGPUGpuGridValues[llvm::omp::GVIDX::GV_Warp_Size];
+   llvm::omp::AMDGPUGridValues.GV_Warp_Size);
+DeviceInfo.WarpSize[device_id] = llvm::omp::AMDGPUGridValues.GV_Warp_Size;
   }
 
   // Adjust teams to the env variables
Index: llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h
===
--- llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h
+++ llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h
@@ -29,68 +29,69 @@
 ///
 /// Example usage in clang:
 ///   const unsigned slot_size =
-///   ctx.GetTargetInfo().getGridValue(llvm::omp::GVIDX::GV_Warp_Size);
+///   ctx.GetTargetInfo().getGridValue().GV_Warp_Size;
 ///
 /// Example usage in libomptarget/deviceRTLs:
 ///   #include "llvm/Frontend/OpenMP/OMPGridValues.h"
 ///   #ifdef __AMDGPU__
-/// #define GRIDVAL AMDGPUGpuGridValues
+/// #define GRIDVAL AMDGPUGridValues
 ///   #else
-/// #define GRIDVAL NVPTXGpuGridValues
+/// #define GRIDVAL NVPTXGridValues
 ///   #endif
 ///   ... Then use this reference for GV_Warp_Size in the deviceRTL source.
-///   llvm::omp::GRIDVAL[llvm::omp::GVIDX::GV_Warp_Size]
+///   llvm::omp::GRIDVAL().GV_Warp_Size
 ///
 /// Example usage in libomptarget hsa plugin:
 ///   #include "llvm/Frontend/OpenMP/OMPGridValues.h"
-///   #define GRIDVAL AMDGPUGpuGridValues
+///   #define GRIDVAL AMDGPUGridValues
 ///   ... Then use this reference to access GV_Warp_Size in the hsa plugin.
-///   llvm::omp::GRIDVAL[llvm::omp::GVIDX::GV_Warp_Size]
+///   llvm::omp::GRIDVAL().GV_Warp_Size
 ///
 /// Example usage in libomptarget cuda plugin:
 ///#include "llvm/Frontend/OpenMP/OMPGridValues.h"
-///#define GRIDVAL NVPTXGpuGridValues
+///#define GRIDVAL NVPTXGridValues
 ///   ... Then use this reference to access GV_Warp_Size in the cuda plugin.
-///llvm::omp::GRIDVAL[llvm::omp::GVIDX::GV_Warp_Size]
+///llvm::omp::GRIDVAL().GV_Warp_Size
 ///
-enum GVIDX {
+
+struct GV {
   /// The maximum number of workers in a kernel.
   /// (THREAD_ABSOLUTE_LIMIT) - (GV_Warp_Size), might be issue for blockDim.z
-  GV_Threads,
+  const uint32_t GV_Threads;
   /// The size reserved for data in a shared memory slot.
-  GV_Slot_Size,
+  const uint32_t GV_Slot_Size;
   /// The 

[PATCH] D108094: [clang-format] Improve detection of parameter declarations in K C

2021-08-18 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment.

In D108094#2951973 , @MyDeveloperDay 
wrote:

> @owenpan Can we push all these commits to 13 RC2 via  
> https://bugs.llvm.org/show_bug.cgi?id=51470
>
> We need to mark the commits we want to cherry pick I think.

Thanks! Updated 51470. Let me know if there is anything else for me to do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108094

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


[PATCH] D108323: [asan] Added -inline-small-callbacks LLVM flag, which would force inline code for 8 and 16 byte data types when otherwise a callback would have been used.

2021-08-18 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc added a comment.

What's the code size implications?




Comment at: clang/test/CodeGen/asan-use-callbacks.cpp:15
 
-int deref(int *p) {
+long deref(long *p) {
   return *p;

As we introduce a difference in behavior for small and large accesses, 
I would extend this test to have 1, 2, 4, and 16-byte accesses. 



Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:310
+static cl::opt ClInlineSmallCallbacks(
+"asan-inline-small-callbacks",
+cl::desc("Inline callbacks for 8 and 16 byte types."), cl::Hidden,

The flag semantics are weird. We first say "use callbacks", then we say "but 
not for small callbacks". 
Perhaps, instead, introduce a flag 
asan-short-instrumentation-with-call-threshold
and when present use this flag for 8/16 instead of the 
asan-instrumentation-with-call-threshold?



Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1749
 
+  if (ClInlineSmallCallbacks && AccessSizeIndex > 2) {
+UseCalls = false;

perhaps move this logic to where UseCalls is computed initially?
(see my other comment too)



Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1751
+UseCalls = false;
+  }
+

for single-statement if bodies this code base does not use {}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108323

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


[PATCH] D108094: [clang-format] Improve detection of parameter declarations in K C

2021-08-18 Thread Owen Pan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG643f2be7b6af: [clang-format] Improve detection of parameter 
declarations in KR C (authored by owenpan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108094

Files:
  clang/lib/Format/UnwrappedLineParser.cpp


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1008,14 +1008,26 @@
 //   {
 //  return a + b;
 //   }
-static bool isC78ParameterDecl(const FormatToken *Tok) {
-  if (!Tok)
+static bool isC78ParameterDecl(const FormatToken *Tok, const FormatToken *Next,
+   const FormatToken *FuncName) {
+  assert(Tok);
+  assert(Next);
+  assert(FuncName);
+
+  if (FuncName->isNot(tok::identifier))
+return false;
+
+  const FormatToken *Prev = FuncName->Previous;
+  if (!Prev || (Prev->isNot(tok::star) && !isC78Type(*Prev)))
 return false;
 
   if (!isC78Type(*Tok) &&
   !Tok->isOneOf(tok::kw_register, tok::kw_struct, tok::kw_union))
 return false;
 
+  if (Next->isNot(tok::star) && !Next->Tok.getIdentifierInfo())
+return false;
+
   Tok = Tok->Previous;
   if (!Tok || Tok->isNot(tok::r_paren))
 return false;
@@ -1378,21 +1390,11 @@
   parseParens();
   // Break the unwrapped line if a K C function definition has a 
parameter
   // declaration.
-  if (!IsTopLevel || !Style.isCpp())
-break;
-  if (!Previous || Previous->isNot(tok::identifier))
-break;
-  const FormatToken *PrevPrev = Previous->Previous;
-  if (!PrevPrev || (!isC78Type(*PrevPrev) && PrevPrev->isNot(tok::star)))
+  if (!IsTopLevel || !Style.isCpp() || !Previous || 
FormatTok->is(tok::eof))
 break;
   const unsigned Position = Tokens->getPosition() + 1;
-  if (Position == AllTokens.size())
-break;
   assert(Position < AllTokens.size());
-  const FormatToken *Next = AllTokens[Position];
-  if (Next && Next->isOneOf(tok::l_paren, tok::semi))
-break;
-  if (isC78ParameterDecl(FormatTok)) {
+  if (isC78ParameterDecl(FormatTok, AllTokens[Position], Previous)) {
 addUnwrappedLine();
 return;
   }


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1008,14 +1008,26 @@
 //   {
 //  return a + b;
 //   }
-static bool isC78ParameterDecl(const FormatToken *Tok) {
-  if (!Tok)
+static bool isC78ParameterDecl(const FormatToken *Tok, const FormatToken *Next,
+   const FormatToken *FuncName) {
+  assert(Tok);
+  assert(Next);
+  assert(FuncName);
+
+  if (FuncName->isNot(tok::identifier))
+return false;
+
+  const FormatToken *Prev = FuncName->Previous;
+  if (!Prev || (Prev->isNot(tok::star) && !isC78Type(*Prev)))
 return false;
 
   if (!isC78Type(*Tok) &&
   !Tok->isOneOf(tok::kw_register, tok::kw_struct, tok::kw_union))
 return false;
 
+  if (Next->isNot(tok::star) && !Next->Tok.getIdentifierInfo())
+return false;
+
   Tok = Tok->Previous;
   if (!Tok || Tok->isNot(tok::r_paren))
 return false;
@@ -1378,21 +1390,11 @@
   parseParens();
   // Break the unwrapped line if a K C function definition has a parameter
   // declaration.
-  if (!IsTopLevel || !Style.isCpp())
-break;
-  if (!Previous || Previous->isNot(tok::identifier))
-break;
-  const FormatToken *PrevPrev = Previous->Previous;
-  if (!PrevPrev || (!isC78Type(*PrevPrev) && PrevPrev->isNot(tok::star)))
+  if (!IsTopLevel || !Style.isCpp() || !Previous || FormatTok->is(tok::eof))
 break;
   const unsigned Position = Tokens->getPosition() + 1;
-  if (Position == AllTokens.size())
-break;
   assert(Position < AllTokens.size());
-  const FormatToken *Next = AllTokens[Position];
-  if (Next && Next->isOneOf(tok::l_paren, tok::semi))
-break;
-  if (isC78ParameterDecl(FormatTok)) {
+  if (isC78ParameterDecl(FormatTok, AllTokens[Position], Previous)) {
 addUnwrappedLine();
 return;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 643f2be - [clang-format] Improve detection of parameter declarations in K C

2021-08-18 Thread via cfe-commits

Author: owenca
Date: 2021-08-18T15:21:48-07:00
New Revision: 643f2be7b6afd91d9f0d6df89cd3391835763112

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

LOG: [clang-format] Improve detection of parameter declarations in K C

Clean up the detection of parameter declarations in K C function
definitions. Also make it more precise by requiring the second
token after the r_paren to be either a star or keyword/identifier.

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

Added: 


Modified: 
clang/lib/Format/UnwrappedLineParser.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index fae77ab48612e..8487875064aa8 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1008,14 +1008,26 @@ static bool isC78Type(const FormatToken ) {
 //   {
 //  return a + b;
 //   }
-static bool isC78ParameterDecl(const FormatToken *Tok) {
-  if (!Tok)
+static bool isC78ParameterDecl(const FormatToken *Tok, const FormatToken *Next,
+   const FormatToken *FuncName) {
+  assert(Tok);
+  assert(Next);
+  assert(FuncName);
+
+  if (FuncName->isNot(tok::identifier))
+return false;
+
+  const FormatToken *Prev = FuncName->Previous;
+  if (!Prev || (Prev->isNot(tok::star) && !isC78Type(*Prev)))
 return false;
 
   if (!isC78Type(*Tok) &&
   !Tok->isOneOf(tok::kw_register, tok::kw_struct, tok::kw_union))
 return false;
 
+  if (Next->isNot(tok::star) && !Next->Tok.getIdentifierInfo())
+return false;
+
   Tok = Tok->Previous;
   if (!Tok || Tok->isNot(tok::r_paren))
 return false;
@@ -1378,21 +1390,11 @@ void UnwrappedLineParser::parseStructuralElement(bool 
IsTopLevel) {
   parseParens();
   // Break the unwrapped line if a K C function definition has a 
parameter
   // declaration.
-  if (!IsTopLevel || !Style.isCpp())
-break;
-  if (!Previous || Previous->isNot(tok::identifier))
-break;
-  const FormatToken *PrevPrev = Previous->Previous;
-  if (!PrevPrev || (!isC78Type(*PrevPrev) && PrevPrev->isNot(tok::star)))
+  if (!IsTopLevel || !Style.isCpp() || !Previous || 
FormatTok->is(tok::eof))
 break;
   const unsigned Position = Tokens->getPosition() + 1;
-  if (Position == AllTokens.size())
-break;
   assert(Position < AllTokens.size());
-  const FormatToken *Next = AllTokens[Position];
-  if (Next && Next->isOneOf(tok::l_paren, tok::semi))
-break;
-  if (isC78ParameterDecl(FormatTok)) {
+  if (isC78ParameterDecl(FormatTok, AllTokens[Position], Previous)) {
 addUnwrappedLine();
 return;
   }



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


[PATCH] D107323: [clang-tidy] Add skip-headers; use skipLocation and setTraversalScope

2021-08-18 Thread Chih-Hung Hsieh via Phabricator via cfe-commits
chh updated this revision to Diff 367331.
chh added a comment.

fix windows test failure


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

https://reviews.llvm.org/D107323

Files:
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang-tools-extra/clang-tidy/ClangTidyCheck.h
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/clang-tidy/ClangTidyModule.cpp
  clang-tools-extra/clang-tidy/ClangTidyModule.h
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/ClangTidyOptions.h
  clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
  clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
  clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
  clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/bugprone-forward-declaration-namespace/a.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/bugprone-forward-declaration-namespace/b.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-pass-by-value/header.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/a.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/b.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/c.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/c1.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/my_header1.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/my_header2.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/unused-using-decls.h
  clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp
  
clang-tools-extra/test/clang-tidy/checkers/abseil-upgrade-duration-conversions.cpp
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-forward-declaration-namespace-header.cpp
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-forward-declaration-namespace.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-include.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-interfaces-global-init.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-command-line-macros.cpp
  clang-tools-extra/test/clang-tidy/checkers/google-namespaces.cpp
  clang-tools-extra/test/clang-tidy/checkers/google-objc-function-naming.m
  clang-tools-extra/test/clang-tidy/checkers/google-upgrade-googletest-case.cpp
  clang-tools-extra/test/clang-tidy/checkers/llvm-include-order.cpp
  
clang-tools-extra/test/clang-tidy/checkers/llvm-prefer-register-over-unsigned.cpp
  
clang-tools-extra/test/clang-tidy/checkers/llvmlibc-implementation-in-namespace.cpp
  
clang-tools-extra/test/clang-tidy/checkers/llvmlibc-restrict-system-libc-headers.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-no-recursion.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-unused-using-decls.cpp
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-cxx03.cpp
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-cxx11.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-pass-by-value-header.cpp
  
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
  
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-chained-conditional-assignment.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-chained-conditional-return.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-members.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-1.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-2.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-3.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-4.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/file-filter-symlinks.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/file-filter.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/line-filter.cpp
  clang/include/clang/ASTMatchers/ASTMatchFinder.h
  clang/include/clang/Frontend/MultiplexConsumer.h
  clang/lib/ASTMatchers/ASTMatchFinder.cpp

Index: clang/lib/ASTMatchers/ASTMatchFinder.cpp
===
--- clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -1202,6 +1202,8 @@
   if (!DeclNode) {
 return true;
   }
+  if (Options.Filter && Options.Filter->skipLocation(DeclNode->getLocation()))
+return true;
 
   bool ScopedTraversal =

[PATCH] D108265: .clang-tidy: Push variable related readability-identifier-naming options down to projects

2021-08-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D108265#2953305 , @dblaikie wrote:

> In D108265#2952555 , @MaskRay wrote:
>
>> The number of top-level projects using `VariableName` is smaller than the 
>> number of projects not using the style.
>> The top-level variable style just provoked projects to either override the 
>> options (flang/, lld/, mlir/) or disable the check.
>> `VariableName` is not even a suitable suggestion for new projects.
>>
>> So the  `VariableName` setting does not belong to the top-level. llvm/ and 
>> clang-tools-extra/ should set it by themselves.
>>
>>> CodingStandards.rst: "Variable names should be nouns (as they represent 
>>> state). The name should be camel case, and start with an upper case letter 
>>> (e.g. Leader or Boats)."
>>
>> This applies to llvm/, clang/, clang-tools-extra/ (and perhaps something I 
>> missed), but is not true for many other projects 
>> (flang,lld,lldb,mlir,libcxx,libcxxabi,libunwind,compiler-rt,...)
>
> I think it applies to the LLVM umbrella/project as a whole - and should apply 
> to any new projects. (I think it's a mistake that projects started that did 
> not adhere to this naming convention (the same as if they didn't adhere to 
> other aspects of the LLVM coding standard) and created divergence where the 
> coding standards are meant to avoid that/promote consistency)

I think it only applies to code which is currently using `VariableName`.

In https://llvm.org/docs/Proposals/VariableNames.html related discussions, 
people all agree that `VariableName` was a mistake.
(Some people took the stance that "renaming variables would cause churn and 
downstream maintenance burden, so don't do")

But new code doesn't need to use the (inferior) style.

> I think it's appropriate for the top level default to match what's described 
> in the LLVM Coding Standards document & to change that document should be an 
> llvm-dev discussion. (I thought there was one a while back, though I don't 
> recall any specific conclusions coming out of that)




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108265

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


[PATCH] D98709: [clang-tidy] New feature --skip-headers, part 1, LocationFilter

2021-08-18 Thread Chih-Hung Hsieh via Phabricator via cfe-commits
chh updated this revision to Diff 367330.
chh added a comment.

fix windows test failure


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

https://reviews.llvm.org/D98709

Files:
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang-tools-extra/clang-tidy/ClangTidyCheck.h
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/clang-tidy/ClangTidyModule.cpp
  clang-tools-extra/clang-tidy/ClangTidyModule.h
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/ClangTidyOptions.h
  clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
  clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
  clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
  clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/bugprone-forward-declaration-namespace/a.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/bugprone-forward-declaration-namespace/b.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-pass-by-value/header.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/a.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/b.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/c.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/c1.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/my_header1.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/skip-headers/my_header2.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/unused-using-decls.h
  clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp
  
clang-tools-extra/test/clang-tidy/checkers/abseil-upgrade-duration-conversions.cpp
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-forward-declaration-namespace-header.cpp
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-forward-declaration-namespace.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-include.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-interfaces-global-init.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-command-line-macros.cpp
  clang-tools-extra/test/clang-tidy/checkers/google-namespaces.cpp
  clang-tools-extra/test/clang-tidy/checkers/google-objc-function-naming.m
  clang-tools-extra/test/clang-tidy/checkers/google-upgrade-googletest-case.cpp
  clang-tools-extra/test/clang-tidy/checkers/llvm-include-order.cpp
  
clang-tools-extra/test/clang-tidy/checkers/llvm-prefer-register-over-unsigned.cpp
  
clang-tools-extra/test/clang-tidy/checkers/llvmlibc-implementation-in-namespace.cpp
  
clang-tools-extra/test/clang-tidy/checkers/llvmlibc-restrict-system-libc-headers.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-no-recursion.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-unused-using-decls.cpp
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-cxx03.cpp
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-cxx11.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-pass-by-value-header.cpp
  
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
  
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-chained-conditional-assignment.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-chained-conditional-return.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-members.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-1.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-2.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-3.cpp
  clang-tools-extra/test/clang-tidy/checkers/skip-headers-4.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/file-filter-symlinks.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/file-filter.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/line-filter.cpp
  clang/include/clang/ASTMatchers/ASTMatchFinder.h
  clang/lib/ASTMatchers/ASTMatchFinder.cpp

Index: clang/lib/ASTMatchers/ASTMatchFinder.cpp
===
--- clang/lib/ASTMatchers/ASTMatchFinder.cpp
+++ clang/lib/ASTMatchers/ASTMatchFinder.cpp
@@ -1202,6 +1202,8 @@
   if (!DeclNode) {
 return true;
   }
+  if (Options.Filter && Options.Filter->skipLocation(DeclNode->getLocation()))
+return true;
 
   bool ScopedTraversal =
   TraversingASTNodeNotSpelledInSource || 

[PATCH] D108308: [WIP] Cleanup identifier parsing.

2021-08-18 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

@aaron.ballman Let me know what you think.
The PR does not contain new behavior, only renames and refactor the function 
lexing identifiers. I ran the build a few times and did not measure performance 
differences on my system. The code should behave exactly the same except with 
one loop instead of 3.
I also moved the 2 identifier lexing functions near one another to make it 
easier to understand.

This makes it apparent that some places in tools, maybe header names or module 
parsing too only check for ASCII identifiers when they may want to check for 
Unicode, This is not addressed here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108308

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


[PATCH] D108265: .clang-tidy: Push variable related readability-identifier-naming options down to projects

2021-08-18 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D108265#2952555 , @MaskRay wrote:

> The number of top-level projects using `VariableName` is smaller than the 
> number of projects not using the style.
> The top-level variable style just provoked projects to either override the 
> options (flang/, lld/, mlir/) or disable the check.
> `VariableName` is not even a suitable suggestion for new projects.
>
> So the  `VariableName` setting does not belong to the top-level. llvm/ and 
> clang-tools-extra/ should set it by themselves.
>
>> CodingStandards.rst: "Variable names should be nouns (as they represent 
>> state). The name should be camel case, and start with an upper case letter 
>> (e.g. Leader or Boats)."
>
> This applies to llvm/, clang/, clang-tools-extra/ (and perhaps something I 
> missed), but is not true for many other projects 
> (flang,lld,lldb,mlir,libcxx,libcxxabi,libunwind,compiler-rt,...)

I think it applies to the LLVM umbrella/project as a whole - and should apply 
to any new projects. (I think it's a mistake that projects started that did not 
adhere to this naming convention (the same as if they didn't adhere to other 
aspects of the LLVM coding standard) and created divergence where the coding 
standards are meant to avoid that/promote consistency)

I think it's appropriate for the top level default to match what's described in 
the LLVM Coding Standards document & to change that document should be an 
llvm-dev discussion. (I thought there was one a while back, though I don't 
recall any specific conclusions coming out of that)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108265

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


[PATCH] D108308: [WIP] Cleanup identifier parsing.

2021-08-18 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 367326.
cor3ntin added a comment.

Remove file committed accidentally


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108308

Files:
  clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
  clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/SourceCode.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang/include/clang/Basic/CharInfo.h
  clang/include/clang/Lex/Lexer.h
  clang/lib/ARCMigrate/ObjCMT.cpp
  clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/Basic/Module.cpp
  clang/lib/Edit/EditedSource.cpp
  clang/lib/Frontend/LayoutOverrideSource.cpp
  clang/lib/Frontend/Rewrite/FrontendActions.cpp
  clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaAvailability.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Tooling/Transformer/Parsing.cpp
  clang/unittests/Basic/CharInfoTest.cpp

Index: clang/unittests/Basic/CharInfoTest.cpp
===
--- clang/unittests/Basic/CharInfoTest.cpp
+++ clang/unittests/Basic/CharInfoTest.cpp
@@ -50,44 +50,44 @@
   EXPECT_FALSE(isASCII('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierHead) {
-  EXPECT_TRUE(isIdentifierHead('a'));
-  EXPECT_TRUE(isIdentifierHead('A'));
-  EXPECT_TRUE(isIdentifierHead('z'));
-  EXPECT_TRUE(isIdentifierHead('Z'));
-  EXPECT_TRUE(isIdentifierHead('_'));
-
-  EXPECT_FALSE(isIdentifierHead('0'));
-  EXPECT_FALSE(isIdentifierHead('.'));
-  EXPECT_FALSE(isIdentifierHead('`'));
-  EXPECT_FALSE(isIdentifierHead('\0'));
-
-  EXPECT_FALSE(isIdentifierHead('$'));
-  EXPECT_TRUE(isIdentifierHead('$', /*AllowDollar=*/true));
-
-  EXPECT_FALSE(isIdentifierHead('\x80'));
-  EXPECT_FALSE(isIdentifierHead('\xc2'));
-  EXPECT_FALSE(isIdentifierHead('\xff'));
+TEST(CharInfoTest, isAsciiIdentifierStart) {
+  EXPECT_TRUE(isAsciiIdentifierStart('a'));
+  EXPECT_TRUE(isAsciiIdentifierStart('A'));
+  EXPECT_TRUE(isAsciiIdentifierStart('z'));
+  EXPECT_TRUE(isAsciiIdentifierStart('Z'));
+  EXPECT_TRUE(isAsciiIdentifierStart('_'));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('0'));
+  EXPECT_FALSE(isAsciiIdentifierStart('.'));
+  EXPECT_FALSE(isAsciiIdentifierStart('`'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\0'));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('$'));
+  EXPECT_TRUE(isAsciiIdentifierStart('$', /*AllowDollar=*/true));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('\x80'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\xc2'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierBody) {
-  EXPECT_TRUE(isIdentifierBody('a'));
-  EXPECT_TRUE(isIdentifierBody('A'));
-  EXPECT_TRUE(isIdentifierBody('z'));
-  EXPECT_TRUE(isIdentifierBody('Z'));
-  EXPECT_TRUE(isIdentifierBody('_'));
+TEST(CharInfoTest, isAsciiIdentifierContinue) {
+  EXPECT_TRUE(isAsciiIdentifierContinue('a'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('A'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('z'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('Z'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('_'));
 
-  EXPECT_TRUE(isIdentifierBody('0'));
-  EXPECT_FALSE(isIdentifierBody('.'));
-  EXPECT_FALSE(isIdentifierBody('`'));
-  EXPECT_FALSE(isIdentifierBody('\0'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('0'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('.'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('`'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\0'));
 
-  EXPECT_FALSE(isIdentifierBody('$'));
-  EXPECT_TRUE(isIdentifierBody('$', /*AllowDollar=*/true));
+  EXPECT_FALSE(isAsciiIdentifierContinue('$'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('$', /*AllowDollar=*/true));
 
-  EXPECT_FALSE(isIdentifierBody('\x80'));
-  EXPECT_FALSE(isIdentifierBody('\xc2'));
-  EXPECT_FALSE(isIdentifierBody('\xff'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\x80'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\xc2'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\xff'));
 }
 
 TEST(CharInfoTest, isHorizontalWhitespace) {
@@ -413,91 +413,91 @@
   EXPECT_EQ('\0', toUppercase('\0'));
 }
 
-TEST(CharInfoTest, isValidIdentifier) {
-  EXPECT_FALSE(isValidIdentifier(""));
+TEST(CharInfoTest, isValidAsciiIdentifier) {
+  EXPECT_FALSE(isValidAsciiIdentifier(""));
 
   // 1 character
-  EXPECT_FALSE(isValidIdentifier("."));
-  EXPECT_FALSE(isValidIdentifier("\n"));
-  EXPECT_FALSE(isValidIdentifier(" "));
-  EXPECT_FALSE(isValidIdentifier("\x80"));
-  EXPECT_FALSE(isValidIdentifier("\xc2"));
-  EXPECT_FALSE(isValidIdentifier("\xff"));
-  EXPECT_FALSE(isValidIdentifier("$"));
-  EXPECT_FALSE(isValidIdentifier("1"));
-
-  EXPECT_TRUE(isValidIdentifier("_"));
-  EXPECT_TRUE(isValidIdentifier("a"));
-  

[PATCH] D108308: [WIP] Cleanup identifier parsing.

2021-08-18 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 367325.
cor3ntin added a comment.

Looks better in lower case after all


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108308

Files:
  clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
  clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/SourceCode.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang/include/clang/Basic/CharInfo.h
  clang/include/clang/Lex/Lexer.h
  clang/lib/ARCMigrate/ObjCMT.cpp
  clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/Basic/Module.cpp
  clang/lib/Edit/EditedSource.cpp
  clang/lib/Frontend/LayoutOverrideSource.cpp
  clang/lib/Frontend/Rewrite/FrontendActions.cpp
  clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaAvailability.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Tooling/Transformer/Parsing.cpp
  clang/unittests/Basic/CharInfoTest.cpp
  llvm/cmake/modules/CheckCompilerVersion.cmake

Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -94,7 +94,7 @@
 "
   LLVM_LIBSTDCXX_MIN)
 if(NOT LLVM_LIBSTDCXX_MIN)
-  message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
+ # message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
 endif()
 # Test for libstdc++ version of at least 5.1 by checking for std::iostream_category().
 # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
Index: clang/unittests/Basic/CharInfoTest.cpp
===
--- clang/unittests/Basic/CharInfoTest.cpp
+++ clang/unittests/Basic/CharInfoTest.cpp
@@ -50,44 +50,44 @@
   EXPECT_FALSE(isASCII('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierHead) {
-  EXPECT_TRUE(isIdentifierHead('a'));
-  EXPECT_TRUE(isIdentifierHead('A'));
-  EXPECT_TRUE(isIdentifierHead('z'));
-  EXPECT_TRUE(isIdentifierHead('Z'));
-  EXPECT_TRUE(isIdentifierHead('_'));
-
-  EXPECT_FALSE(isIdentifierHead('0'));
-  EXPECT_FALSE(isIdentifierHead('.'));
-  EXPECT_FALSE(isIdentifierHead('`'));
-  EXPECT_FALSE(isIdentifierHead('\0'));
-
-  EXPECT_FALSE(isIdentifierHead('$'));
-  EXPECT_TRUE(isIdentifierHead('$', /*AllowDollar=*/true));
-
-  EXPECT_FALSE(isIdentifierHead('\x80'));
-  EXPECT_FALSE(isIdentifierHead('\xc2'));
-  EXPECT_FALSE(isIdentifierHead('\xff'));
+TEST(CharInfoTest, isAsciiIdentifierStart) {
+  EXPECT_TRUE(isAsciiIdentifierStart('a'));
+  EXPECT_TRUE(isAsciiIdentifierStart('A'));
+  EXPECT_TRUE(isAsciiIdentifierStart('z'));
+  EXPECT_TRUE(isAsciiIdentifierStart('Z'));
+  EXPECT_TRUE(isAsciiIdentifierStart('_'));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('0'));
+  EXPECT_FALSE(isAsciiIdentifierStart('.'));
+  EXPECT_FALSE(isAsciiIdentifierStart('`'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\0'));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('$'));
+  EXPECT_TRUE(isAsciiIdentifierStart('$', /*AllowDollar=*/true));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('\x80'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\xc2'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierBody) {
-  EXPECT_TRUE(isIdentifierBody('a'));
-  EXPECT_TRUE(isIdentifierBody('A'));
-  EXPECT_TRUE(isIdentifierBody('z'));
-  EXPECT_TRUE(isIdentifierBody('Z'));
-  EXPECT_TRUE(isIdentifierBody('_'));
+TEST(CharInfoTest, isAsciiIdentifierContinue) {
+  EXPECT_TRUE(isAsciiIdentifierContinue('a'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('A'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('z'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('Z'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('_'));
 
-  EXPECT_TRUE(isIdentifierBody('0'));
-  EXPECT_FALSE(isIdentifierBody('.'));
-  EXPECT_FALSE(isIdentifierBody('`'));
-  EXPECT_FALSE(isIdentifierBody('\0'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('0'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('.'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('`'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\0'));
 
-  EXPECT_FALSE(isIdentifierBody('$'));
-  EXPECT_TRUE(isIdentifierBody('$', /*AllowDollar=*/true));
+  EXPECT_FALSE(isAsciiIdentifierContinue('$'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('$', /*AllowDollar=*/true));
 
-  EXPECT_FALSE(isIdentifierBody('\x80'));
-  EXPECT_FALSE(isIdentifierBody('\xc2'));
-  EXPECT_FALSE(isIdentifierBody('\xff'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\x80'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\xc2'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\xff'));
 }
 
 TEST(CharInfoTest, 

[PATCH] D107394: [AIX] "aligned" attribute does not decrease alignment

2021-08-18 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1975
+  bool AlignAttrCanDecreaseAlignment =
+  AlignIsRequired && (Ty->getAs() != nullptr || FieldPacked);
+

Okay, so first off, the comment and variable names here make this sound very 
general when in fact this computation is only relevant to the AIX alignment 
upgrade logic.  Also, please do not introduce new variables with broad scope 
named things like `Ty` that are actually referring to a very specific type and 
not, say, the unadulterated type of the field.

It seems to me that the right way to think about this is that, while the AIX 
power alignment upgrade considers whether field type alignment is "required", 
it uses a different condition than the standard rule when making that decision. 
 It's important to understand what that rule is exactly, and we can't see that 
from the current test cases.  In particular, attributes on fields that define 
structs inline actually end up applying to both the field and the struct, which 
confounds unrelated issues.  Consider:

```
struct __attribute__((packed, aligned(2))) SS {
  double d;
};

struct S {
  // Neither the field nor the struct are packed, but the field type is.
  // Do we apply the alignment upgrade to S or not?
  struct SS s;
};
```

Regardless, I don't think this check for a typedef works; it's bypassing quite 
a bit of recursive logic for computing whether type alignment is required.  For 
example, you could have an explicitly aligned typedef of an array type, and 
you'll lose that typedef here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107394

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


[PATCH] D106721: [AArch64] Implemnt MSVC __mulh and __umulh builtins and corresponding IR level intrinsics

2021-08-18 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk 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/D106721/new/

https://reviews.llvm.org/D106721

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


[PATCH] D108021: [dllexport] Instantiate default ctor default args

2021-08-18 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

Thanks for the patch and test. Can I commit this for you?




Comment at: clang/lib/Sema/SemaDeclCXX.cpp:6012
+auto *CD = dyn_cast(MD);
+if (CD && CD->isDefaultConstructor() && TSK == TSK_Undeclared) {
+  S.InstantiateDefaultCtorDefaultArgs(CD);

This should probably happen when explicit instantiation definitions are 
exported, so the `TSK_ExplicitInstantiationDefinition` case. However, I don't 
consider it a blocking issue.


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

https://reviews.llvm.org/D108021

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


[PATCH] D108308: [WIP] Cleanup identifier parsing.

2021-08-18 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 367322.
cor3ntin added a comment.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

Spell ASCII in upper case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108308

Files:
  clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
  clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/SourceCode.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang/include/clang/Basic/CharInfo.h
  clang/include/clang/Lex/Lexer.h
  clang/lib/ARCMigrate/ObjCMT.cpp
  clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/Basic/Module.cpp
  clang/lib/Edit/EditedSource.cpp
  clang/lib/Frontend/LayoutOverrideSource.cpp
  clang/lib/Frontend/Rewrite/FrontendActions.cpp
  clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaAvailability.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Tooling/Transformer/Parsing.cpp
  clang/unittests/Basic/CharInfoTest.cpp
  llvm/cmake/modules/CheckCompilerVersion.cmake

Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -94,7 +94,7 @@
 "
   LLVM_LIBSTDCXX_MIN)
 if(NOT LLVM_LIBSTDCXX_MIN)
-  message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
+ # message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
 endif()
 # Test for libstdc++ version of at least 5.1 by checking for std::iostream_category().
 # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
Index: clang/unittests/Basic/CharInfoTest.cpp
===
--- clang/unittests/Basic/CharInfoTest.cpp
+++ clang/unittests/Basic/CharInfoTest.cpp
@@ -50,44 +50,44 @@
   EXPECT_FALSE(isASCII('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierHead) {
-  EXPECT_TRUE(isIdentifierHead('a'));
-  EXPECT_TRUE(isIdentifierHead('A'));
-  EXPECT_TRUE(isIdentifierHead('z'));
-  EXPECT_TRUE(isIdentifierHead('Z'));
-  EXPECT_TRUE(isIdentifierHead('_'));
-
-  EXPECT_FALSE(isIdentifierHead('0'));
-  EXPECT_FALSE(isIdentifierHead('.'));
-  EXPECT_FALSE(isIdentifierHead('`'));
-  EXPECT_FALSE(isIdentifierHead('\0'));
-
-  EXPECT_FALSE(isIdentifierHead('$'));
-  EXPECT_TRUE(isIdentifierHead('$', /*AllowDollar=*/true));
-
-  EXPECT_FALSE(isIdentifierHead('\x80'));
-  EXPECT_FALSE(isIdentifierHead('\xc2'));
-  EXPECT_FALSE(isIdentifierHead('\xff'));
+TEST(CharInfoTest, isASCIIIdentifierStart) {
+  EXPECT_TRUE(isASCIIIdentifierStart('a'));
+  EXPECT_TRUE(isASCIIIdentifierStart('A'));
+  EXPECT_TRUE(isASCIIIdentifierStart('z'));
+  EXPECT_TRUE(isASCIIIdentifierStart('Z'));
+  EXPECT_TRUE(isASCIIIdentifierStart('_'));
+
+  EXPECT_FALSE(isASCIIIdentifierStart('0'));
+  EXPECT_FALSE(isASCIIIdentifierStart('.'));
+  EXPECT_FALSE(isASCIIIdentifierStart('`'));
+  EXPECT_FALSE(isASCIIIdentifierStart('\0'));
+
+  EXPECT_FALSE(isASCIIIdentifierStart('$'));
+  EXPECT_TRUE(isASCIIIdentifierStart('$', /*AllowDollar=*/true));
+
+  EXPECT_FALSE(isASCIIIdentifierStart('\x80'));
+  EXPECT_FALSE(isASCIIIdentifierStart('\xc2'));
+  EXPECT_FALSE(isASCIIIdentifierStart('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierBody) {
-  EXPECT_TRUE(isIdentifierBody('a'));
-  EXPECT_TRUE(isIdentifierBody('A'));
-  EXPECT_TRUE(isIdentifierBody('z'));
-  EXPECT_TRUE(isIdentifierBody('Z'));
-  EXPECT_TRUE(isIdentifierBody('_'));
+TEST(CharInfoTest, isASCIIIdentifierContinue) {
+  EXPECT_TRUE(isASCIIIdentifierContinue('a'));
+  EXPECT_TRUE(isASCIIIdentifierContinue('A'));
+  EXPECT_TRUE(isASCIIIdentifierContinue('z'));
+  EXPECT_TRUE(isASCIIIdentifierContinue('Z'));
+  EXPECT_TRUE(isASCIIIdentifierContinue('_'));
 
-  EXPECT_TRUE(isIdentifierBody('0'));
-  EXPECT_FALSE(isIdentifierBody('.'));
-  EXPECT_FALSE(isIdentifierBody('`'));
-  EXPECT_FALSE(isIdentifierBody('\0'));
+  EXPECT_TRUE(isASCIIIdentifierContinue('0'));
+  EXPECT_FALSE(isASCIIIdentifierContinue('.'));
+  EXPECT_FALSE(isASCIIIdentifierContinue('`'));
+  EXPECT_FALSE(isASCIIIdentifierContinue('\0'));
 
-  EXPECT_FALSE(isIdentifierBody('$'));
-  EXPECT_TRUE(isIdentifierBody('$', /*AllowDollar=*/true));
+  EXPECT_FALSE(isASCIIIdentifierContinue('$'));
+  EXPECT_TRUE(isASCIIIdentifierContinue('$', /*AllowDollar=*/true));
 
-  EXPECT_FALSE(isIdentifierBody('\x80'));
-  EXPECT_FALSE(isIdentifierBody('\xc2'));
-  EXPECT_FALSE(isIdentifierBody('\xff'));
+  EXPECT_FALSE(isASCIIIdentifierContinue('\x80'));
+  EXPECT_FALSE(isASCIIIdentifierContinue('\xc2'));
+  

[PATCH] D108223: gn build: Build libclang.so on ELF platforms.

2021-08-18 Thread Peter Collingbourne via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb2e77cd095a6: gn build: Build libclang.so and libLTO.so on 
ELF platforms. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D108223?vs=366966=367318#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108223

Files:
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
  llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
@@ -1,20 +1,14 @@
 import("//llvm/utils/gn/build/symbol_exports.gni")
 import("//llvm/version.gni")
 
-lto_target_type = "shared_library"
-if (host_os != "mac" && host_os != "win") {
-  # ELF targets need -fPIC to build shared libs but they aren't on by default.
-  # For now, make libclang a static lib there.
-  lto_target_type = "static_library"
-}
-
 symbol_exports("exports") {
   exports_file = "lto.exports"
 }
 
-target(lto_target_type, "lto") {
+shared_library("lto") {
   output_name = "LTO"
   deps = [
+":exports",
 "//llvm/lib/Bitcode/Reader",
 "//llvm/lib/IR",
 "//llvm/lib/LTO",
@@ -29,10 +23,6 @@
 "lto.cpp",
   ]
 
-  if (lto_target_type == "shared_library") {
-deps += [ ":exports" ]
-  }
-
   if (host_os == "mac") {
 ldflags = [
   "-Wl,-compatibility_version,1",
Index: llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -5,33 +5,24 @@
 # This build file is just enough to get check-clang to pass, it's missing
 # several things from the CMake build:
 # - a build target copying the Python bindings
-# - the GN linux build always builds without -fPIC (as if LLVM_ENABLE_PIC=OFF
-#   in the CMake build), so libclang is always a static library on linux
 # - the GN build doesn't have LIBCLANG_BUILD_STATIC
 
-libclang_target_type = "shared_library"
-if (host_os != "win" && host_os != "mac") {
-  # ELF targets need -fPIC to build shared libs but they aren't on by default.
-  # For now, make libclang a static lib there.
-  libclang_target_type = "static_library"
-} else {
-  action("linker_script_to_exports") {
-script = "linker-script-to-export-list.py"
-inputs = [ "libclang.map" ]
-outputs = [ "$target_gen_dir/libclang.exports" ]
-args = [
-  rebase_path(inputs[0], root_build_dir),
-  rebase_path(outputs[0], root_build_dir),
-]
-  }
+action("linker_script_to_exports") {
+  script = "linker-script-to-export-list.py"
+  inputs = [ "libclang.map" ]
+  outputs = [ "$target_gen_dir/libclang.exports" ]
+  args = [
+rebase_path(inputs[0], root_build_dir),
+rebase_path(outputs[0], root_build_dir),
+  ]
+}
 
-  symbol_exports("exports") {
-deps = [ ":linker_script_to_exports" ]
-exports_file = "$target_gen_dir/libclang.exports"
-  }
+symbol_exports("exports") {
+  deps = [ ":linker_script_to_exports" ]
+  exports_file = "$target_gen_dir/libclang.exports"
 }
 
-target(libclang_target_type, "libclang") {
+shared_library("libclang") {
   configs += [ "//llvm/utils/gn/build:clang_code" ]
   deps = [
 "//clang/include/clang/Config",
@@ -48,14 +39,17 @@
 "//llvm/lib/Support",
 "//llvm/lib/Target:TargetsToBuild",
   ]
+  if (current_os == "win" || current_os == "mac") {
+deps += [ ":exports" ]
+  } else {
+inputs = [ "libclang.map" ]
+ldflags =
+[ "-Wl,--version-script," + rebase_path(inputs[0], root_build_dir) ]
+  }
   if (clang_enable_arcmt) {
 deps += [ "//clang/lib/ARCMigrate" ]
   }
 
-  if (libclang_target_type == "shared_library") {
-deps += [ ":exports" ]
-  }
-
   defines = []
 
   if (host_os == "win") {
Index: llvm/utils/gn/build/BUILD.gn
===
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -377,6 +377,9 @@
 "//llvm/include",
 "$root_gen_dir/llvm/include",
   ]
+  if (current_os != "win") {
+cflags = [ "-fPIC" ]
+  }
 }
 
 config("lld_code") {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Maintenance works at llvm lab today

2021-08-18 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM lab and buildmaster will be unavailable for about an hour starting 5
PM PST today for maintenance works.
Thank you for understanding.

Thanks

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


[PATCH] D107394: [AIX] "aligned" attribute does not decrease alignment

2021-08-18 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 367312.
stevewan added a comment.

Fields marked attribute "aligned" and "packed" don't need to go through 
alignment upgrade


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107394

Files:
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/test/Layout/aix-alignof-align-and-pack-attr.cpp


Index: clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
===
--- clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
+++ clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
@@ -27,3 +27,23 @@
 
 // CHECK: @{{.*}}test3{{.*}}c{{.*}} = global %"struct.test3::C" 
zeroinitializer, align 16
 } // namespace test3
+
+namespace test4 {
+struct C {
+  struct CC {
+long double ld;
+  } __attribute__((aligned(2))) cc;
+} c;
+
+// CHECK: @{{.*}}test4{{.*}}c{{.*}} = global %"struct.test4::C" 
zeroinitializer, align 8
+} // namespace test4
+
+namespace test5 {
+struct C {
+  struct CC {
+long double ld;
+  } __attribute__((aligned(2), packed)) cc;
+} c;
+
+// CHECK: @{{.*}}test5{{.*}}c{{.*}} = global %"struct.test5::C" 
zeroinitializer, align 2
+} // namespace test5
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1968,6 +1968,12 @@
 }
   }
 
+  const Type *Ty = D->getType()->getBaseElementTypeUnsafe();
+  // When used as part of a typedef, or together with a 'packed' attribute,
+  // the 'aligned' attribute can be used to decrease alignment.
+  bool AlignAttrCanDecreaseAlignment =
+  AlignIsRequired && (Ty->getAs() != nullptr || FieldPacked);
+
   // The AIX `power` alignment rules apply the natural alignment of the
   // "first member" if it is of a floating-point data type (or is an aggregate
   // whose recursively "first" member or element is such a type). The alignment
@@ -1978,7 +1984,7 @@
   // and zero-width bit-fields count as prior members; members of empty class
   // types marked `no_unique_address` are not considered to be prior members.
   CharUnits PreferredAlign = FieldAlign;
-  if (DefaultsToAIXPowerAlignment && !AlignIsRequired &&
+  if (DefaultsToAIXPowerAlignment && !AlignAttrCanDecreaseAlignment &&
   (FoundFirstNonOverlappingEmptyFieldForAIX || IsNaturalAlign)) {
 auto performBuiltinTypeAlignmentUpgrade = [&](const BuiltinType *BTy) {
   if (BTy->getKind() == BuiltinType::Double ||
@@ -1989,7 +1995,6 @@
   }
 };
 
-const Type *Ty = D->getType()->getBaseElementTypeUnsafe();
 if (const ComplexType *CTy = Ty->getAs()) {
   
performBuiltinTypeAlignmentUpgrade(CTy->getElementType()->castAs());
 } else if (const BuiltinType *BTy = Ty->getAs()) {


Index: clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
===
--- clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
+++ clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
@@ -27,3 +27,23 @@
 
 // CHECK: @{{.*}}test3{{.*}}c{{.*}} = global %"struct.test3::C" zeroinitializer, align 16
 } // namespace test3
+
+namespace test4 {
+struct C {
+  struct CC {
+long double ld;
+  } __attribute__((aligned(2))) cc;
+} c;
+
+// CHECK: @{{.*}}test4{{.*}}c{{.*}} = global %"struct.test4::C" zeroinitializer, align 8
+} // namespace test4
+
+namespace test5 {
+struct C {
+  struct CC {
+long double ld;
+  } __attribute__((aligned(2), packed)) cc;
+} c;
+
+// CHECK: @{{.*}}test5{{.*}}c{{.*}} = global %"struct.test5::C" zeroinitializer, align 2
+} // namespace test5
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1968,6 +1968,12 @@
 }
   }
 
+  const Type *Ty = D->getType()->getBaseElementTypeUnsafe();
+  // When used as part of a typedef, or together with a 'packed' attribute,
+  // the 'aligned' attribute can be used to decrease alignment.
+  bool AlignAttrCanDecreaseAlignment =
+  AlignIsRequired && (Ty->getAs() != nullptr || FieldPacked);
+
   // The AIX `power` alignment rules apply the natural alignment of the
   // "first member" if it is of a floating-point data type (or is an aggregate
   // whose recursively "first" member or element is such a type). The alignment
@@ -1978,7 +1984,7 @@
   // and zero-width bit-fields count as prior members; members of empty class
   // types marked `no_unique_address` are not considered to be prior members.
   CharUnits PreferredAlign = FieldAlign;
-  if (DefaultsToAIXPowerAlignment && !AlignIsRequired &&
+  if (DefaultsToAIXPowerAlignment && !AlignAttrCanDecreaseAlignment &&
   (FoundFirstNonOverlappingEmptyFieldForAIX || IsNaturalAlign)) {
 auto performBuiltinTypeAlignmentUpgrade = [&](const BuiltinType *BTy) {
   

[PATCH] D108317: [libomptarget][devicertl] Replace lanemask with uint64 at interface

2021-08-18 Thread Jon Chesterfield 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 rG21d91a8ef319: [libomptarget][devicertl] Replace lanemask 
with uint64 at interface (authored by JonChesterfield).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108317

Files:
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/test/Transforms/OpenMP/add_attributes.ll
  openmp/libomptarget/DeviceRTL/include/Interface.h
  openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
  openmp/libomptarget/deviceRTLs/common/src/sync.cu
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -375,9 +375,9 @@
 EXTERN void __kmpc_flush(kmp_Ident *loc);
 
 // vote
-EXTERN __kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask();
+EXTERN uint64_t __kmpc_warp_active_thread_mask(void);
 // syncwarp
-EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t);
+EXTERN void __kmpc_syncwarp(uint64_t);
 
 // tasks
 EXTERN kmp_TaskDescr *__kmpc_omp_task_alloc(kmp_Ident *loc, uint32_t global_tid,
Index: openmp/libomptarget/deviceRTLs/common/src/sync.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/sync.cu
+++ openmp/libomptarget/deviceRTLs/common/src/sync.cu
@@ -123,7 +123,7 @@
 // Vote
 
 
-EXTERN __kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask() {
+EXTERN uint64_t __kmpc_warp_active_thread_mask(void) {
   PRINT0(LD_IO, "call __kmpc_warp_active_thread_mask\n");
   return __kmpc_impl_activemask();
 }
@@ -132,7 +132,7 @@
 // Syncwarp
 
 
-EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) {
+EXTERN void __kmpc_syncwarp(uint64_t Mask) {
   PRINT0(LD_IO, "call __kmpc_syncwarp\n");
   __kmpc_impl_syncwarp(Mask);
 }
Index: openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
===
--- openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
+++ openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
@@ -286,11 +286,9 @@
 
 void __kmpc_flush(IdentTy *Loc) { fence::kernel(__ATOMIC_SEQ_CST); }
 
-__kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask() {
-  return mapping::activemask();
-}
+uint64_t __kmpc_warp_active_thread_mask(void) { return mapping::activemask(); }
 
-void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) { synchronize::warp(Mask); }
+void __kmpc_syncwarp(uint64_t Mask) { synchronize::warp(Mask); }
 
 void __kmpc_critical(IdentTy *Loc, int32_t TId, CriticalNameTy *Name) {
   omp_set_lock(reinterpret_cast(Name));
Index: openmp/libomptarget/DeviceRTL/include/Interface.h
===
--- openmp/libomptarget/DeviceRTL/include/Interface.h
+++ openmp/libomptarget/DeviceRTL/include/Interface.h
@@ -247,9 +247,9 @@
 
 void __kmpc_flush(IdentTy *Loc);
 
-__kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask();
+uint64_t __kmpc_warp_active_thread_mask(void);
 
-void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask);
+void __kmpc_syncwarp(uint64_t Mask);
 
 void __kmpc_critical(IdentTy *Loc, int32_t TId, CriticalNameTy *Name);
 
Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -626,9 +626,9 @@
 
 declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
-declare i32 @__kmpc_warp_active_thread_mask()
+declare i64 @__kmpc_warp_active_thread_mask()
 
-declare void @__kmpc_syncwarp(i32)
+declare void @__kmpc_syncwarp(i64)
 
 declare i32 @__tgt_target_mapper(%struct.ident_t*, i64, i8*, i32, i8**, i8**, i64*, i64*, i8**, i8**)
 
@@ -1149,10 +1149,10 @@
 ; CHECK-NEXT: declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
 ; CHECK: ; Function Attrs: convergent nounwind
-; CHECK-NEXT: declare i32 @__kmpc_warp_active_thread_mask()
+; CHECK-NEXT: declare i64 @__kmpc_warp_active_thread_mask()
 
 ; CHECK: ; Function Attrs: convergent nounwind
-; CHECK-NEXT: declare void @__kmpc_syncwarp(i32)
+; CHECK-NEXT: declare void @__kmpc_syncwarp(i64)
 
 ; CHECK: ; Function Attrs: nounwind
 ; CHECK-NEXT: declare i32 @__tgt_target_mapper(%struct.ident_t*, i64, i8*, i32, i8**, i8**, i64*, i64*, i8**, i8**)
@@ -1677,10 +1677,10 @@
 ; OPTIMISTIC-NEXT: declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
 ; 

[clang] 21d91a8 - [libomptarget][devicertl] Replace lanemask with uint64 at interface

2021-08-18 Thread Jon Chesterfield via cfe-commits

Author: Jon Chesterfield
Date: 2021-08-18T20:47:33+01:00
New Revision: 21d91a8ef319eec9c2c272e19beee726429524aa

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

LOG: [libomptarget][devicertl] Replace lanemask with uint64 at interface

Use uint64_t for lanemask on all GPU architectures at the interface
with clang. Updates tests. The deviceRTL is always linked as IR so the zext
and trunc introduced for wave32 architectures will fold after inlining.

Simplification partly motivated by amdgpu gfx10 which will be wave32 and
is awkward to express in the current arch-dependant typedef interface.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/test/OpenMP/nvptx_parallel_codegen.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/test/Transforms/OpenMP/add_attributes.ll
openmp/libomptarget/DeviceRTL/include/Interface.h
openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
openmp/libomptarget/deviceRTLs/common/src/sync.cu
openmp/libomptarget/deviceRTLs/interface.h

Removed: 




diff  --git a/clang/test/OpenMP/nvptx_parallel_codegen.cpp 
b/clang/test/OpenMP/nvptx_parallel_codegen.cpp
index 7cb86b80e158f..712c5a41c573d 100644
--- a/clang/test/OpenMP/nvptx_parallel_codegen.cpp
+++ b/clang/test/OpenMP/nvptx_parallel_codegen.cpp
@@ -485,7 +485,7 @@ int bar(int n){
 // CHECK3-NEXT:store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], 
align 4
 // CHECK3-NEXT:store i32* [[A]], i32** [[A_ADDR]], align 4
 // CHECK3-NEXT:[[TMP0:%.*]] = load i32*, i32** [[A_ADDR]], align 4
-// CHECK3-NEXT:[[TMP1:%.*]] = call i32 @__kmpc_warp_active_thread_mask()
+// CHECK3-NEXT:[[TMP1:%.*]] = call i64 @__kmpc_warp_active_thread_mask()
 // CHECK3-NEXT:[[NVPTX_TID:%.*]] = call i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
 // CHECK3-NEXT:[[NVPTX_NUM_THREADS:%.*]] = call i32 
@llvm.nvvm.read.ptx.sreg.ntid.x()
 // CHECK3-NEXT:store i32 0, i32* [[CRITICAL_COUNTER]], align 4
@@ -508,7 +508,7 @@ int bar(int n){
 // CHECK3-NEXT:call void @__kmpc_end_critical(%struct.ident_t* @[[GLOB1]], 
i32 [[TMP7]], [8 x i32]* @"_gomp_critical_user_$var")
 // CHECK3-NEXT:br label [[OMP_CRITICAL_SYNC]]
 // CHECK3:   omp.critical.sync:
-// CHECK3-NEXT:call void @__kmpc_syncwarp(i32 [[TMP1]])
+// CHECK3-NEXT:call void @__kmpc_syncwarp(i64 [[TMP1]])
 // CHECK3-NEXT:[[TMP9:%.*]] = add nsw i32 [[TMP4]], 1
 // CHECK3-NEXT:store i32 [[TMP9]], i32* [[CRITICAL_COUNTER]], align 4
 // CHECK3-NEXT:br label [[OMP_CRITICAL_LOOP]]
@@ -938,7 +938,7 @@ int bar(int n){
 // CHECK4-NEXT:store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], 
align 4
 // CHECK4-NEXT:store i32* [[A]], i32** [[A_ADDR]], align 4
 // CHECK4-NEXT:[[TMP0:%.*]] = load i32*, i32** [[A_ADDR]], align 4
-// CHECK4-NEXT:[[TMP1:%.*]] = call i32 @__kmpc_warp_active_thread_mask()
+// CHECK4-NEXT:[[TMP1:%.*]] = call i64 @__kmpc_warp_active_thread_mask()
 // CHECK4-NEXT:[[NVPTX_TID:%.*]] = call i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
 // CHECK4-NEXT:[[NVPTX_NUM_THREADS:%.*]] = call i32 
@llvm.nvvm.read.ptx.sreg.ntid.x()
 // CHECK4-NEXT:store i32 0, i32* [[CRITICAL_COUNTER]], align 4
@@ -961,7 +961,7 @@ int bar(int n){
 // CHECK4-NEXT:call void @__kmpc_end_critical(%struct.ident_t* @[[GLOB1]], 
i32 [[TMP7]], [8 x i32]* @"_gomp_critical_user_$var")
 // CHECK4-NEXT:br label [[OMP_CRITICAL_SYNC]]
 // CHECK4:   omp.critical.sync:
-// CHECK4-NEXT:call void @__kmpc_syncwarp(i32 [[TMP1]])
+// CHECK4-NEXT:call void @__kmpc_syncwarp(i64 [[TMP1]])
 // CHECK4-NEXT:[[TMP9:%.*]] = add nsw i32 [[TMP4]], 1
 // CHECK4-NEXT:store i32 [[TMP9]], i32* [[CRITICAL_COUNTER]], align 4
 // CHECK4-NEXT:br label [[OMP_CRITICAL_LOOP]]
@@ -1391,7 +1391,7 @@ int bar(int n){
 // CHECK5-NEXT:store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], 
align 4
 // CHECK5-NEXT:store i32* [[A]], i32** [[A_ADDR]], align 4
 // CHECK5-NEXT:[[TMP0:%.*]] = load i32*, i32** [[A_ADDR]], align 4
-// CHECK5-NEXT:[[TMP1:%.*]] = call i32 @__kmpc_warp_active_thread_mask()
+// CHECK5-NEXT:[[TMP1:%.*]] = call i64 @__kmpc_warp_active_thread_mask()
 // CHECK5-NEXT:[[NVPTX_TID:%.*]] = call i32 
@llvm.nvvm.read.ptx.sreg.tid.x()
 // CHECK5-NEXT:[[NVPTX_NUM_THREADS:%.*]] = call i32 
@llvm.nvvm.read.ptx.sreg.ntid.x()
 // CHECK5-NEXT:store i32 0, i32* [[CRITICAL_COUNTER]], align 4
@@ -1414,7 +1414,7 @@ int bar(int n){
 // CHECK5-NEXT:call void @__kmpc_end_critical(%struct.ident_t* @[[GLOB1]], 
i32 [[TMP7]], [8 x i32]* @"_gomp_critical_user_$var")
 // CHECK5-NEXT:br label [[OMP_CRITICAL_SYNC]]
 // 

[PATCH] D108317: [libomptarget][devicertl] Replace lanemask with uint64 at interface

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Yep, and optionally in the old one as well. The 32/64 conversion all shakes out 
OK in the end. Restricting the patch to the interface and immediate 
consequences makes it easier to review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108317

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


[PATCH] D108323: [asan] Added -inline-small-callbacks LLVM flag, which would force inline code for 8 and 16 byte data types when otherwise a callback would have been used.

2021-08-18 Thread Kirill Stoimenov via Phabricator via cfe-commits
kstoimenov created this revision.
kstoimenov added a reviewer: vitalybuka.
Herald added a subscriber: hiraditya.
kstoimenov requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

The reason to inline the 8 and 16 byte access checks is that the code for those 
is smaller than the 1, 2 and 4 byte checks. This allows to have a balanced, 
middle ground setting between size and speed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108323

Files:
  clang/test/CodeGen/asan-use-callbacks.cpp
  llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp


Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -306,6 +306,11 @@
 cl::desc("Realign stack to the value of this flag (power of two)"),
 cl::Hidden, cl::init(32));
 
+static cl::opt ClInlineSmallCallbacks(
+"asan-inline-small-callbacks",
+cl::desc("Inline callbacks for 8 and 16 byte types."), cl::Hidden,
+cl::init(false));
+
 static cl::opt ClInstrumentationWithCallsThreshold(
 "asan-instrumentation-with-call-threshold",
 cl::desc(
@@ -1741,6 +1746,10 @@
   Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy);
   size_t AccessSizeIndex = TypeSizeToSizeIndex(TypeSize);
 
+  if (ClInlineSmallCallbacks && AccessSizeIndex > 2) {
+UseCalls = false;
+  }
+
   if (UseCalls) {
 if (Exp == 0)
   IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][0][AccessSizeIndex],
Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -4,10 +4,14 @@
 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
 // RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
+// RUN: -mllvm -asan-inline-small-callbacks \
+// RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
 
-// CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4
-// CHECK-OUTLINE: call{{.*}}@__asan_load4
+// CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load8
+// CHECK-OUTLINE: call{{.*}}@__asan_load8
 
-int deref(int *p) {
+long deref(long *p) {
   return *p;
 }


Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -306,6 +306,11 @@
 cl::desc("Realign stack to the value of this flag (power of two)"),
 cl::Hidden, cl::init(32));
 
+static cl::opt ClInlineSmallCallbacks(
+"asan-inline-small-callbacks",
+cl::desc("Inline callbacks for 8 and 16 byte types."), cl::Hidden,
+cl::init(false));
+
 static cl::opt ClInstrumentationWithCallsThreshold(
 "asan-instrumentation-with-call-threshold",
 cl::desc(
@@ -1741,6 +1746,10 @@
   Value *AddrLong = IRB.CreatePointerCast(Addr, IntptrTy);
   size_t AccessSizeIndex = TypeSizeToSizeIndex(TypeSize);
 
+  if (ClInlineSmallCallbacks && AccessSizeIndex > 2) {
+UseCalls = false;
+  }
+
   if (UseCalls) {
 if (Exp == 0)
   IRB.CreateCall(AsanMemoryAccessCallback[IsWrite][0][AccessSizeIndex],
Index: clang/test/CodeGen/asan-use-callbacks.cpp
===
--- clang/test/CodeGen/asan-use-callbacks.cpp
+++ clang/test/CodeGen/asan-use-callbacks.cpp
@@ -4,10 +4,14 @@
 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
 // RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
 // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - \
+// RUN: -fsanitize=address %s -fsanitize-address-outline-instrumentation \
+// RUN: -mllvm -asan-inline-small-callbacks \
+// RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE
 
-// CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load4
-// CHECK-OUTLINE: call{{.*}}@__asan_load4
+// CHECK-NO-OUTLINE-NOT: call{{.*}}@__asan_load8
+// CHECK-OUTLINE: call{{.*}}@__asan_load8
 
-int deref(int *p) {
+long deref(long *p) {
   return *p;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67422: [analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.

2021-08-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ abandoned this revision.
NoQ added a comment.

Abandon in favor of splitting up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67422

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


[PATCH] D67422: [analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.

2021-08-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ reopened this revision.
NoQ added a comment.
Herald added a subscriber: manas.

This patch hasn't landed yet (reverted every time due to circular 
dependencies(?)). I plan to split it up into smaller patches as I rebase 
because rebase is already very painful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67422

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


[PATCH] D108320: Add semantic token modifier for non-const reference parameter

2021-08-18 Thread Tom Praschan via Phabricator via cfe-commits
tom-anders created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman.
tom-anders requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.
Herald added a project: clang-tools-extra.

See https://github.com/clangd/clangd/issues/839


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108320

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/SemanticHighlighting.h
  clang-tools-extra/clangd/test/initialize-params.test
  clang-tools-extra/clangd/test/semantic-tokens.test
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -729,6 +729,28 @@
   }
 };
   )cpp",
+  // Modifier for variables passed as non-const references
+  R"cpp(
+void $Function_decl[[fun]](int $Parameter_decl[[value]], const int& $Parameter_decl_readonly[[constRef]], 
+   int& $Parameter_decl[[ref]], int* $Parameter_decl[[ptr]], 
+   int $Parameter_decl[[defaultParameter]] = 3);
+struct $Class_decl[[S]] {
+  $Class_decl[[S]](int $Parameter_decl[[value]], const int& $Parameter_decl_readonly[[constRef]], 
+int& $Parameter_decl[[ref]], int* $Parameter_decl[[ptr]], 
+int $Parameter_decl[[defaultParameter]] = 3);
+  int $Field_decl[[field]];
+};
+void $Function_decl[[bar]]() {
+  int $LocalVariable_decl[[foo]];
+  $Function[[fun]]($LocalVariable[[foo]], $LocalVariable[[foo]], 
+   $LocalVariable_passedByNonConstRef[[foo]], &$LocalVariable[[foo]]);
+
+  $Class[[S]] $LocalVariable_decl[[s]]($LocalVariable[[foo]], $LocalVariable[[foo]], 
+   $LocalVariable_passedByNonConstRef[[foo]], &$LocalVariable[[foo]]);
+  $Function[[fun]]($LocalVariable[[s]].$Field[[field]], $LocalVariable[[s]].$Field[[field]], 
+   $LocalVariable[[s]].$Field_passedByNonConstRef[[field]], &$LocalVariable[[s]].$Field[[field]]);
+}
+  )cpp",
   };
   for (const auto  : TestCases)
 // Mask off scope modifiers to keep the tests manageable.
Index: clang-tools-extra/clangd/test/semantic-tokens.test
===
--- clang-tools-extra/clangd/test/semantic-tokens.test
+++ clang-tools-extra/clangd/test/semantic-tokens.test
@@ -23,7 +23,7 @@
 # CHECK-NEXT:  4,
 # CHECK-NEXT:  1,
 # CHECK-NEXT:  0,
-# CHECK-NEXT:  4097
+# CHECK-NEXT:  8193
 # CHECK-NEXT:],
 # CHECK-NEXT:"resultId": "1"
 # CHECK-NEXT:  }
@@ -49,7 +49,7 @@
 # CHECK-NEXT:  4,
 # CHECK-NEXT:  1,
 # CHECK-NEXT:  0,
-# CHECK-NEXT:  4097
+# CHECK-NEXT:  8193
 # CHECK-NEXT:],
 #Inserted at position 1
 # CHECK-NEXT:"deleteCount": 0,
@@ -72,12 +72,12 @@
 # CHECK-NEXT:  4,
 # CHECK-NEXT:  1,
 # CHECK-NEXT:  0,
-# CHECK-NEXT:  4097,
+# CHECK-NEXT:  8193,
 # CHECK-NEXT:  1,
 # CHECK-NEXT:  4,
 # CHECK-NEXT:  1,
 # CHECK-NEXT:  0,
-# CHECK-NEXT:  4097
+# CHECK-NEXT:  8193
 # CHECK-NEXT:],
 # CHECK-NEXT:"resultId": "3"
 # CHECK-NEXT:  }
Index: clang-tools-extra/clangd/test/initialize-params.test
===
--- clang-tools-extra/clangd/test/initialize-params.test
+++ clang-tools-extra/clangd/test/initialize-params.test
@@ -91,6 +91,7 @@
 # CHECK-NEXT:"virtual",
 # CHECK-NEXT:"dependentName",
 # CHECK-NEXT:"defaultLibrary",
+# CHECK-NEXT:"passedByNonConstRef",
 # CHECK-NEXT:"functionScope",
 # CHECK-NEXT:"classScope",
 # CHECK-NEXT:"fileScope",
Index: clang-tools-extra/clangd/SemanticHighlighting.h
===
--- clang-tools-extra/clangd/SemanticHighlighting.h
+++ clang-tools-extra/clangd/SemanticHighlighting.h
@@ -70,6 +70,8 @@
   DependentName,
   DefaultLibrary,
 
+  PassedByNonConstRef,
+
   FunctionScope,
   ClassScope,
   FileScope,
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -290,10 +290,12 @@
 }
 
 unsigned evaluateHighlightPriority(const HighlightingToken ) {
-  enum HighlightPriority { Dependent = 0, Resolved = 1 };
+  enum HighlightPriority { Dependent = 0, ResolvedButUnknown = 1, Resolved = 2 };

[PATCH] D108317: [libomptarget][devicertl] Replace lanemask with uint64 at interface

2021-08-18 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LG. We could replace `LaneMaskTy` in the new dev rtl but that is not necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108317

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


[PATCH] D108150: [Remarks] [AMDGPU] Emit optimization remarks for atomics generating hardware instructions

2021-08-18 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 marked an inline comment as done.
gandhi21299 added a comment.

Thanks for the review, I will merge this in as soon as the CI passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108150

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


[PATCH] D108150: [Remarks] [AMDGPU] Emit optimization remarks for atomics generating hardware instructions

2021-08-18 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 updated this revision to Diff 367273.
gandhi21299 marked an inline comment as done.
gandhi21299 added a comment.

- code refactor


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108150

Files:
  clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl
  clang/test/CodeGenOpenCL/atomics-remarks-gfx90a.cl
  clang/test/CodeGenOpenCL/atomics-unsafe-hw-remarks-gfx90a.cl
  llvm/lib/CodeGen/AtomicExpandPass.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/test/CodeGen/AMDGPU/atomics-cas-remarks-gfx90a.ll
  llvm/test/CodeGen/AMDGPU/atomics-hw-remarks-gfx90a.ll
  llvm/test/CodeGen/AMDGPU/atomics-remarks-gfx90a.ll

Index: llvm/test/CodeGen/AMDGPU/atomics-hw-remarks-gfx90a.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/atomics-hw-remarks-gfx90a.ll
@@ -0,0 +1,95 @@
+; RUN: llc -march=amdgcn -mcpu=gfx90a -verify-machineinstrs --pass-remarks=si-lower \
+; RUN:  %s -o - 2>&1 | FileCheck %s --check-prefix=GFX90A-HW
+
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope system due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope agent due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope workgroup due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope wavefront due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope singlethread due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope agent-one-as due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope workgroup-one-as due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope wavefront-one-as due to an unsafe request.
+; GFX90A-HW: Hardware instruction generated for atomic fadd operation at memory scope singlethread-one-as due to an unsafe request.
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw:
+; GFX90A-HW:ds_add_f64 v2, v[0:1]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw(double addrspace(3)* %ptr) #0 {
+main_body:
+  %ret = atomicrmw fadd double addrspace(3)* %ptr, double 4.0 seq_cst
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_agent:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_agent(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val syncscope("agent") monotonic, align 4
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_wg:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_wg(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val syncscope("workgroup") monotonic, align 4
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_wavefront:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_wavefront(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val syncscope("wavefront") monotonic, align 4
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_single_thread:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_single_thread(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val syncscope("singlethread") monotonic, align 4
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_aoa:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_aoa(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val syncscope("agent-one-as") monotonic, align 4
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_wgoa:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_wgoa(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val syncscope("workgroup-one-as") monotonic, align 4
+  ret void
+}
+
+; GFX90A-HW-LABEL: atomic_add_unsafe_hw_wfoa:
+; GFX90A-HW:global_atomic_add_f32 v0, v1, s[2:3]
+; GFX90A-HW:s_endpgm
+define amdgpu_kernel void @atomic_add_unsafe_hw_wfoa(float addrspace(1)* %ptr, float %val) #0 {
+main_body:
+  %ret = atomicrmw fadd float addrspace(1)* %ptr, float %val 

[PATCH] D108317: [libomptarget][devicertl] Replace lanemask with uint64 at interface

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield updated this revision to Diff 367295.
JonChesterfield added a comment.

- void


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108317

Files:
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/test/Transforms/OpenMP/add_attributes.ll
  openmp/libomptarget/DeviceRTL/include/Interface.h
  openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
  openmp/libomptarget/deviceRTLs/common/src/sync.cu
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -375,9 +375,9 @@
 EXTERN void __kmpc_flush(kmp_Ident *loc);
 
 // vote
-EXTERN __kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask();
+EXTERN uint64_t __kmpc_warp_active_thread_mask(void);
 // syncwarp
-EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t);
+EXTERN void __kmpc_syncwarp(uint64_t);
 
 // tasks
 EXTERN kmp_TaskDescr *__kmpc_omp_task_alloc(kmp_Ident *loc, uint32_t global_tid,
Index: openmp/libomptarget/deviceRTLs/common/src/sync.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/sync.cu
+++ openmp/libomptarget/deviceRTLs/common/src/sync.cu
@@ -123,7 +123,7 @@
 // Vote
 
 
-EXTERN __kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask() {
+EXTERN uint64_t __kmpc_warp_active_thread_mask(void) {
   PRINT0(LD_IO, "call __kmpc_warp_active_thread_mask\n");
   return __kmpc_impl_activemask();
 }
@@ -132,7 +132,7 @@
 // Syncwarp
 
 
-EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) {
+EXTERN void __kmpc_syncwarp(uint64_t Mask) {
   PRINT0(LD_IO, "call __kmpc_syncwarp\n");
   __kmpc_impl_syncwarp(Mask);
 }
Index: openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
===
--- openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
+++ openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
@@ -286,11 +286,9 @@
 
 void __kmpc_flush(IdentTy *Loc) { fence::kernel(__ATOMIC_SEQ_CST); }
 
-__kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask() {
-  return mapping::activemask();
-}
+uint64_t __kmpc_warp_active_thread_mask(void) { return mapping::activemask(); }
 
-void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) { synchronize::warp(Mask); }
+void __kmpc_syncwarp(uint64_t Mask) { synchronize::warp(Mask); }
 
 void __kmpc_critical(IdentTy *Loc, int32_t TId, CriticalNameTy *Name) {
   omp_set_lock(reinterpret_cast(Name));
Index: openmp/libomptarget/DeviceRTL/include/Interface.h
===
--- openmp/libomptarget/DeviceRTL/include/Interface.h
+++ openmp/libomptarget/DeviceRTL/include/Interface.h
@@ -247,9 +247,9 @@
 
 void __kmpc_flush(IdentTy *Loc);
 
-__kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask();
+uint64_t __kmpc_warp_active_thread_mask(void);
 
-void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask);
+void __kmpc_syncwarp(uint64_t Mask);
 
 void __kmpc_critical(IdentTy *Loc, int32_t TId, CriticalNameTy *Name);
 
Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -626,9 +626,9 @@
 
 declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
-declare i32 @__kmpc_warp_active_thread_mask()
+declare i64 @__kmpc_warp_active_thread_mask()
 
-declare void @__kmpc_syncwarp(i32)
+declare void @__kmpc_syncwarp(i64)
 
 declare i32 @__tgt_target_mapper(%struct.ident_t*, i64, i8*, i32, i8**, i8**, i64*, i64*, i8**, i8**)
 
@@ -1149,10 +1149,10 @@
 ; CHECK-NEXT: declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
 ; CHECK: ; Function Attrs: convergent nounwind
-; CHECK-NEXT: declare i32 @__kmpc_warp_active_thread_mask()
+; CHECK-NEXT: declare i64 @__kmpc_warp_active_thread_mask()
 
 ; CHECK: ; Function Attrs: convergent nounwind
-; CHECK-NEXT: declare void @__kmpc_syncwarp(i32)
+; CHECK-NEXT: declare void @__kmpc_syncwarp(i64)
 
 ; CHECK: ; Function Attrs: nounwind
 ; CHECK-NEXT: declare i32 @__tgt_target_mapper(%struct.ident_t*, i64, i8*, i32, i8**, i8**, i64*, i64*, i8**, i8**)
@@ -1677,10 +1677,10 @@
 ; OPTIMISTIC-NEXT: declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
 ; OPTIMISTIC: ; Function Attrs: convergent nounwind
-; OPTIMISTIC-NEXT: declare i32 @__kmpc_warp_active_thread_mask()
+; OPTIMISTIC-NEXT: declare i64 

[PATCH] D108317: [libomptarget][devicertl] Replace lanemask with uint64 at interface

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, dpalermo, grokos, tianshilei1992.
Herald added subscribers: hiraditya, tpr.
JonChesterfield requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, sstefan1.
Herald added projects: clang, OpenMP, LLVM.

Use uint64_t for lanemask on all GPU architectures at the interface
with clang. Updates tests. The deviceRTL is always linked as IR so the zext
and trunc introduced for wave32 architectures will fold after inlining.

Simplification partly motivated by amdgpu gfx10 which will be wave32, which
is awkward to express in the current arch-dependant typedef interface.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108317

Files:
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/test/Transforms/OpenMP/add_attributes.ll
  openmp/libomptarget/DeviceRTL/include/Interface.h
  openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
  openmp/libomptarget/deviceRTLs/common/src/sync.cu
  openmp/libomptarget/deviceRTLs/interface.h

Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -375,9 +375,9 @@
 EXTERN void __kmpc_flush(kmp_Ident *loc);
 
 // vote
-EXTERN __kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask();
+EXTERN uint64_t __kmpc_warp_active_thread_mask();
 // syncwarp
-EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t);
+EXTERN void __kmpc_syncwarp(uint64_t);
 
 // tasks
 EXTERN kmp_TaskDescr *__kmpc_omp_task_alloc(kmp_Ident *loc, uint32_t global_tid,
Index: openmp/libomptarget/deviceRTLs/common/src/sync.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/sync.cu
+++ openmp/libomptarget/deviceRTLs/common/src/sync.cu
@@ -123,7 +123,7 @@
 // Vote
 
 
-EXTERN __kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask() {
+EXTERN uint64_t __kmpc_warp_active_thread_mask() {
   PRINT0(LD_IO, "call __kmpc_warp_active_thread_mask\n");
   return __kmpc_impl_activemask();
 }
@@ -132,7 +132,7 @@
 // Syncwarp
 
 
-EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) {
+EXTERN void __kmpc_syncwarp(uint64_t Mask) {
   PRINT0(LD_IO, "call __kmpc_syncwarp\n");
   __kmpc_impl_syncwarp(Mask);
 }
Index: openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
===
--- openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
+++ openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
@@ -286,11 +286,9 @@
 
 void __kmpc_flush(IdentTy *Loc) { fence::kernel(__ATOMIC_SEQ_CST); }
 
-__kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask() {
-  return mapping::activemask();
-}
+uint64_t __kmpc_warp_active_thread_mask() { return mapping::activemask(); }
 
-void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) { synchronize::warp(Mask); }
+void __kmpc_syncwarp(uint64_t Mask) { synchronize::warp(Mask); }
 
 void __kmpc_critical(IdentTy *Loc, int32_t TId, CriticalNameTy *Name) {
   omp_set_lock(reinterpret_cast(Name));
Index: openmp/libomptarget/DeviceRTL/include/Interface.h
===
--- openmp/libomptarget/DeviceRTL/include/Interface.h
+++ openmp/libomptarget/DeviceRTL/include/Interface.h
@@ -247,9 +247,9 @@
 
 void __kmpc_flush(IdentTy *Loc);
 
-__kmpc_impl_lanemask_t __kmpc_warp_active_thread_mask();
+uint64_t __kmpc_warp_active_thread_mask(void);
 
-void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask);
+void __kmpc_syncwarp(uint64_t Mask);
 
 void __kmpc_critical(IdentTy *Loc, int32_t TId, CriticalNameTy *Name);
 
Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -626,9 +626,9 @@
 
 declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
-declare i32 @__kmpc_warp_active_thread_mask()
+declare i64 @__kmpc_warp_active_thread_mask()
 
-declare void @__kmpc_syncwarp(i32)
+declare void @__kmpc_syncwarp(i64)
 
 declare i32 @__tgt_target_mapper(%struct.ident_t*, i64, i8*, i32, i8**, i8**, i64*, i64*, i8**, i8**)
 
@@ -1149,10 +1149,10 @@
 ; CHECK-NEXT: declare void @__kmpc_push_target_tripcount_mapper(%struct.ident_t*, i64, i64)
 
 ; CHECK: ; Function Attrs: convergent nounwind
-; CHECK-NEXT: declare i32 @__kmpc_warp_active_thread_mask()
+; CHECK-NEXT: declare i64 @__kmpc_warp_active_thread_mask()
 
 ; CHECK: ; Function Attrs: convergent nounwind
-; CHECK-NEXT: declare void 

[PATCH] D108235: [CUDA] Bump default GPU architecture to sm_35.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In D108235#2952714 , @Hahnfeld wrote:

> (might be good to have an entry in the release notes?)

I've updated release notes in D108248 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108235

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


[PATCH] D108248: [CUDA] Bump the latest supported CUDA version to 11.4.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 367282.
tra added a comment.

Updated release notes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108248

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/Cuda.h


Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -33,7 +33,7 @@
   CUDA_112,
   CUDA_113,
   CUDA_114,
-  FULLY_SUPPORTED = CUDA_101,
+  FULLY_SUPPORTED = CUDA_114,
   PARTIALLY_SUPPORTED =
   CUDA_114, // Partially supported. Proceed with a warning.
   NEW = 1,  // Too new. Issue a warning, but allow using it.
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -109,6 +109,12 @@
 ^
 ...
 
+CUDA Language Changes in Clang
+---
+
+- Clang now supports CUDA versions up to 11.4.
+- Default GPU architecture has been changed from sm_20 to sm_35.
+
 Objective-C Language Changes in Clang
 -
 


Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -33,7 +33,7 @@
   CUDA_112,
   CUDA_113,
   CUDA_114,
-  FULLY_SUPPORTED = CUDA_101,
+  FULLY_SUPPORTED = CUDA_114,
   PARTIALLY_SUPPORTED =
   CUDA_114, // Partially supported. Proceed with a warning.
   NEW = 1,  // Too new. Issue a warning, but allow using it.
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -109,6 +109,12 @@
 ^
 ...
 
+CUDA Language Changes in Clang
+---
+
+- Clang now supports CUDA versions up to 11.4.
+- Default GPU architecture has been changed from sm_20 to sm_35.
+
 Objective-C Language Changes in Clang
 -
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108239: [CUDA] Add support for CUDA-11.4.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/Basic/Targets/NVPTX.cpp:48-49
 PTXVersion = llvm::StringSwitch(Feature)
+ .Case("+ptx72", 74)
+ .Case("+ptx71", 73)
  .Case("+ptx72", 72)

Hahnfeld wrote:
> Do you mean `+ptx74` and `+ptx73`?
Fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108239

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


[PATCH] D108239: [CUDA] Add support for CUDA-11.4.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 367267.
tra added a comment.

Fixed typos


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108239

Files:
  clang/include/clang/Basic/Cuda.h
  clang/lib/Basic/Cuda.cpp
  clang/lib/Basic/Targets/NVPTX.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  llvm/lib/Target/NVPTX/NVPTX.td

Index: llvm/lib/Target/NVPTX/NVPTX.td
===
--- llvm/lib/Target/NVPTX/NVPTX.td
+++ llvm/lib/Target/NVPTX/NVPTX.td
@@ -89,6 +89,10 @@
  "Use PTX version 7.1">;
 def PTX72 : SubtargetFeature<"ptx72", "PTXVersion", "72",
  "Use PTX version 7.2">;
+def PTX73 : SubtargetFeature<"ptx73", "PTXVersion", "73",
+ "Use PTX version 7.3">;
+def PTX74 : SubtargetFeature<"ptx74", "PTXVersion", "74",
+ "Use PTX version 7.4">;
 
 //===--===//
 // NVPTX supported processors.
Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -77,6 +77,12 @@
 return CudaVersion::CUDA_110;
   if (raw_version < 11020)
 return CudaVersion::CUDA_111;
+  if (raw_version < 11030)
+return CudaVersion::CUDA_112;
+  if (raw_version < 11040)
+return CudaVersion::CUDA_113;
+  if (raw_version < 11050)
+return CudaVersion::CUDA_114;
   return CudaVersion::LATEST;
 }
 
@@ -720,6 +726,8 @@
   case CudaVersion::CUDA_##CUDA_VER:   \
 PtxFeature = "+ptx" #PTX_VER;  \
 break;
+CASE_CUDA_VERSION(114, 74);
+CASE_CUDA_VERSION(113, 73);
 CASE_CUDA_VERSION(112, 72);
 CASE_CUDA_VERSION(111, 71);
 CASE_CUDA_VERSION(110, 70);
Index: clang/lib/Basic/Targets/NVPTX.cpp
===
--- clang/lib/Basic/Targets/NVPTX.cpp
+++ clang/lib/Basic/Targets/NVPTX.cpp
@@ -45,6 +45,8 @@
 if (!Feature.startswith("+ptx"))
   continue;
 PTXVersion = llvm::StringSwitch(Feature)
+ .Case("+ptx74", 74)
+ .Case("+ptx73", 73)
  .Case("+ptx72", 72)
  .Case("+ptx71", 71)
  .Case("+ptx70", 70)
Index: clang/lib/Basic/Cuda.cpp
===
--- clang/lib/Basic/Cuda.cpp
+++ clang/lib/Basic/Cuda.cpp
@@ -36,6 +36,10 @@
 return "11.1";
   case CudaVersion::CUDA_112:
 return "11.2";
+  case CudaVersion::CUDA_113:
+return "11.3";
+  case CudaVersion::CUDA_114:
+return "11.4";
   }
   llvm_unreachable("invalid enum");
 }
@@ -54,6 +58,8 @@
   .Case("11.0", CudaVersion::CUDA_110)
   .Case("11.1", CudaVersion::CUDA_111)
   .Case("11.2", CudaVersion::CUDA_112)
+  .Case("11.3", CudaVersion::CUDA_113)
+  .Case("11.4", CudaVersion::CUDA_114)
   .Default(CudaVersion::UNKNOWN);
 }
 
@@ -194,6 +200,8 @@
   case CudaArch::SM_20:
   case CudaArch::SM_21:
 return CudaVersion::CUDA_80;
+  case CudaArch::SM_30:
+return CudaVersion::CUDA_110;
   default:
 return CudaVersion::LATEST;
   }
@@ -227,6 +235,10 @@
 return CudaVersion::CUDA_111;
   case 112:
 return CudaVersion::CUDA_112;
+  case 113:
+return CudaVersion::CUDA_113;
+  case 114:
+return CudaVersion::CUDA_114;
   default:
 return CudaVersion::UNKNOWN;
   }
Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -31,7 +31,9 @@
   CUDA_110,
   CUDA_111,
   CUDA_112,
-  LATEST = CUDA_112,
+  CUDA_113,
+  CUDA_114,
+  LATEST = CUDA_114,
   LATEST_SUPPORTED = CUDA_101,
 };
 const char *CudaVersionToString(CudaVersion V);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D105007: [NewPM] Make some sanitizer passes parameterized in the PassRegistry

2021-08-18 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks accepted this revision.
aeubanks 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/D105007/new/

https://reviews.llvm.org/D105007

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


[PATCH] D108241: [hwasan] Flag stack safety check as requiring aarch64

2021-08-18 Thread Christopher Tetreault via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2afb9394a745: [hwasan] Flag stack safety check as requiring 
aarch64 (authored by ctetreau).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108241

Files:
  clang/test/CodeGen/hwasan-stack-safety-analysis.c


Index: clang/test/CodeGen/hwasan-stack-safety-analysis.c
===
--- clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=NOSAFETY
 


Index: clang/test/CodeGen/hwasan-stack-safety-analysis.c
===
--- clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=NOSAFETY
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 2afb939 - [hwasan] Flag stack safety check as requiring aarch64

2021-08-18 Thread Christopher Tetreault via cfe-commits

Author: Christopher Tetreault
Date: 2021-08-18T11:14:01-07:00
New Revision: 2afb9394a745733739f217d53cd9cf4ae03a3157

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

LOG: [hwasan] Flag stack safety check as requiring aarch64

Reviewed By: fmayer

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

Added: 


Modified: 
clang/test/CodeGen/hwasan-stack-safety-analysis.c

Removed: 




diff  --git a/clang/test/CodeGen/hwasan-stack-safety-analysis.c 
b/clang/test/CodeGen/hwasan-stack-safety-analysis.c
index ba50274de282..59fc53f8b1d1 100644
--- a/clang/test/CodeGen/hwasan-stack-safety-analysis.c
+++ b/clang/test/CodeGen/hwasan-stack-safety-analysis.c
@@ -1,3 +1,5 @@
+// REQUIRES: aarch64-registered-target
+
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=SAFETY
 // RUN: %clang -fno-legacy-pass-manager -fsanitize=hwaddress -target 
aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm 
-hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s 
--check-prefix=NOSAFETY
 



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


[PATCH] D105007: [NewPM] Update some sanitizer pass names in the PassRegistry

2021-08-18 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope updated this revision to Diff 367263.
bjope added a comment.
Herald added subscribers: cfe-commits, ormris.
Herald added a project: clang.

Updated to use _PASS_WITH_PARAMS and option parsing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105007

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -336,18 +336,19 @@
   PB.registerPipelineParsingCallback(
   [](StringRef Name, ModulePassManager ,
  ArrayRef) {
+AddressSanitizerOptions Opts;
 if (Name == "asan-pipeline") {
   MPM.addPass(
   RequireAnalysisPass());
   MPM.addPass(
-  createModuleToFunctionPassAdaptor(AddressSanitizerPass()));
+  createModuleToFunctionPassAdaptor(AddressSanitizerPass(Opts)));
   MPM.addPass(ModuleAddressSanitizerPass());
   return true;
 } else if (Name == "asan-function-pipeline") {
   MPM.addPass(
   RequireAnalysisPass());
   MPM.addPass(
-  createModuleToFunctionPassAdaptor(AddressSanitizerPass()));
+  createModuleToFunctionPassAdaptor(AddressSanitizerPass(Opts)));
   return true;
 }
 return false;
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -469,19 +469,14 @@
   DisableOptimization);
 }
 
-HWAddressSanitizerPass::HWAddressSanitizerPass(bool CompileKernel, bool Recover,
-   bool DisableOptimization)
-: CompileKernel(CompileKernel), Recover(Recover),
-  DisableOptimization(DisableOptimization) {}
-
 PreservedAnalyses HWAddressSanitizerPass::run(Module ,
   ModuleAnalysisManager ) {
   const StackSafetyGlobalInfo *SSI = nullptr;
   auto TargetTriple = llvm::Triple(M.getTargetTriple());
-  if (shouldUseStackSafetyAnalysis(TargetTriple, DisableOptimization))
+  if (shouldUseStackSafetyAnalysis(TargetTriple, Options.DisableOptimization))
 SSI = (M);
 
-  HWAddressSanitizer HWASan(M, CompileKernel, Recover, SSI);
+  HWAddressSanitizer HWASan(M, Options.CompileKernel, Options.Recover, SSI);
   bool Modified = false;
   auto  = MAM.getResult(M).getManager();
   for (Function  : M) {
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1212,20 +1212,14 @@
   return GlobalsMetadata(M);
 }
 
-AddressSanitizerPass::AddressSanitizerPass(
-bool CompileKernel, bool Recover, bool UseAfterScope,
-AsanDetectStackUseAfterReturnMode UseAfterReturn)
-: CompileKernel(CompileKernel), Recover(Recover),
-  UseAfterScope(UseAfterScope), UseAfterReturn(UseAfterReturn) {}
-
 PreservedAnalyses AddressSanitizerPass::run(Function ,
 AnalysisManager ) {
   auto  = AM.getResult(F);
   Module  = *F.getParent();
   if (auto *R = MAMProxy.getCachedResult(M)) {
 const TargetLibraryInfo *TLI = (F);
-AddressSanitizer Sanitizer(M, R, CompileKernel, Recover, UseAfterScope,
-   UseAfterReturn);
+AddressSanitizer Sanitizer(M, R, Options.CompileKernel, Options.Recover,
+   Options.UseAfterScope, Options.UseAfterReturn);
 if (Sanitizer.instrumentFunction(F, TLI))
   return PreservedAnalyses::none();
 return PreservedAnalyses::all();
Index: llvm/lib/Passes/PassRegistry.def
===
--- llvm/lib/Passes/PassRegistry.def
+++ llvm/lib/Passes/PassRegistry.def
@@ -60,8 +60,6 @@
 MODULE_PASS("globalopt", GlobalOptPass())
 MODULE_PASS("globalsplit", GlobalSplitPass())
 MODULE_PASS("hotcoldsplit", HotColdSplittingPass())
-MODULE_PASS("hwasan", HWAddressSanitizerPass(false, false))
-MODULE_PASS("khwasan", HWAddressSanitizerPass(true, true))
 MODULE_PASS("inferattrs", InferFunctionAttrsPass())
 MODULE_PASS("inliner-wrapper", ModuleInlinerWrapperPass())
 MODULE_PASS("inliner-wrapper-no-mandatory-first", ModuleInlinerWrapperPass(
@@ -123,6 

[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/Driver/ToolChains/Cuda.cpp:103-104
+std::string VersionString = CudaVersionToString(Version);
+if (!VersionString.empty())
+  VersionString += " ";
+D.Diag(diag::warn_drv_new_cuda_version)

Hahnfeld wrote:
> I think you have to prepend the space in order to match `CUDA version%0 is 
> newer than`, or move the `%0`. But I didn't try locally, might be missing 
> something.
Good catch. Fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247

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


[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 367261.
tra added a comment.

Prepend space to the version string.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247

Files:
  clang/include/clang/Basic/Cuda.h
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Basic/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.h
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/bin/.keep
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/.keep
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/cuda.h
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/lib/.keep
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/lib64/.keep
  
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
  clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h
  clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt
  clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h
  clang/test/Driver/cuda-version-check.cu

Index: clang/test/Driver/cuda-version-check.cu
===
--- clang/test/Driver/cuda-version-check.cu
+++ clang/test/Driver/cuda-version-check.cu
@@ -8,15 +8,12 @@
 // RUN:FileCheck %s --check-prefix=OK
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
-// Test version guess when no version.txt or cuda.h are found
+// Test version guess when cuda.h has not been found
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION
-// Unknown version with version.txt present
-// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda 2>&1 %s | \
-// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION_V
-// Unknown version with no version.txt but with version info present in cuda.h
-// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_111/usr/local/cuda 2>&1 %s | \
-// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION_H
+// Unknown version info present in cuda.h
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 %s | \
+// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION
 // Make sure that we don't warn about CUDA version during C++ compilation.
 // RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \
 // RUN:--cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
@@ -66,13 +63,14 @@
 // OK_SM35-NOT: error: GPU arch sm_35
 
 // We should only get one error per architecture.
+// ERR_SM20: error: GPU arch sm_20 {{.*}}
+// ERR_SM20-NOT: error: GPU arch sm_20
+
 // ERR_SM60: error: GPU arch sm_60 {{.*}}
 // ERR_SM60-NOT: error: GPU arch sm_60
 
 // ERR_SM61: error: GPU arch sm_61 {{.*}}
 // ERR_SM61-NOT: error: GPU arch sm_61
 
-// UNKNOWN_VERSION_V: unknown CUDA version: version.txt:{{.*}}; assuming the latest supported version
-// UNKNOWN_VERSION_H: unknown CUDA version: cuda.h: CUDA_VERSION={{.*}}; assuming the latest supported version
-// UNKNOWN_VERSION: unknown CUDA version: no version found in version.txt or cuda.h; assuming the latest supported version
+// UNKNOWN_VERSION: CUDA version is newer than the latest{{.*}} supported version
 // UNKNOWN_VERSION_CXX-NOT: unknown CUDA version
Index: clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h
===
--- /dev/null
+++ clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h
@@ -0,0 +1,7 @@
+//
+// Placeholder file for testing CUDA version detection
+//
+
+#define CUDA_VERSION 9000
+
+//
Index: clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt
===
--- clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-CUDA Version 8.0.42
Index: clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h
===
--- /dev/null
+++ clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h
@@ -0,0 +1,7 @@
+//
+// Placeholder file for testing CUDA version detection
+//
+
+#define CUDA_VERSION 8000
+
+//
Index: clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
===
--- clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-CUDA Version 999.999.999
Index: clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/cuda.h
===
--- /dev/null
+++ 

[PATCH] D108248: [CUDA] Bump the latest supported CUDA version to 11.4.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 367260.
tra added a comment.

Undo unintentional change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108248

Files:
  clang/include/clang/Basic/Cuda.h


Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -33,7 +33,7 @@
   CUDA_112,
   CUDA_113,
   CUDA_114,
-  FULLY_SUPPORTED = CUDA_101,
+  FULLY_SUPPORTED = CUDA_114,
   PARTIALLY_SUPPORTED =
   CUDA_114, // Partially supported. Proceed with a warning.
   NEW = 1,  // Too new. Issue a warning, but allow using it.


Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -33,7 +33,7 @@
   CUDA_112,
   CUDA_113,
   CUDA_114,
-  FULLY_SUPPORTED = CUDA_101,
+  FULLY_SUPPORTED = CUDA_114,
   PARTIALLY_SUPPORTED =
   CUDA_114, // Partially supported. Proceed with a warning.
   NEW = 1,  // Too new. Issue a warning, but allow using it.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108248: [CUDA] Bump the latest supported CUDA version to 11.4.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 367259.
tra edited the summary of this revision.
tra added a comment.

Prepend space to version string.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108248

Files:
  clang/include/clang/Basic/Cuda.h
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -101,7 +101,7 @@
   if (Version > CudaVersion::PARTIALLY_SUPPORTED) {
 std::string VersionString = CudaVersionToString(Version);
 if (!VersionString.empty())
-  VersionString += " ";
+  VersionString.insert(0, " ");
 D.Diag(diag::warn_drv_new_cuda_version)
 << VersionString
 << (CudaVersion::PARTIALLY_SUPPORTED != CudaVersion::FULLY_SUPPORTED)
Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -33,7 +33,7 @@
   CUDA_112,
   CUDA_113,
   CUDA_114,
-  FULLY_SUPPORTED = CUDA_101,
+  FULLY_SUPPORTED = CUDA_114,
   PARTIALLY_SUPPORTED =
   CUDA_114, // Partially supported. Proceed with a warning.
   NEW = 1,  // Too new. Issue a warning, but allow using it.


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -101,7 +101,7 @@
   if (Version > CudaVersion::PARTIALLY_SUPPORTED) {
 std::string VersionString = CudaVersionToString(Version);
 if (!VersionString.empty())
-  VersionString += " ";
+  VersionString.insert(0, " ");
 D.Diag(diag::warn_drv_new_cuda_version)
 << VersionString
 << (CudaVersion::PARTIALLY_SUPPORTED != CudaVersion::FULLY_SUPPORTED)
Index: clang/include/clang/Basic/Cuda.h
===
--- clang/include/clang/Basic/Cuda.h
+++ clang/include/clang/Basic/Cuda.h
@@ -33,7 +33,7 @@
   CUDA_112,
   CUDA_113,
   CUDA_114,
-  FULLY_SUPPORTED = CUDA_101,
+  FULLY_SUPPORTED = CUDA_114,
   PARTIALLY_SUPPORTED =
   CUDA_114, // Partially supported. Proceed with a warning.
   NEW = 1,  // Too new. Issue a warning, but allow using it.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D105265: [X86] AVX512FP16 instructions enabling 3/6

2021-08-18 Thread Sami Tolvanen via Phabricator via cfe-commits
samitolvanen added a comment.

FYI, this breaks the Linux kernel when built with ThinLTO: 
https://github.com/ClangBuiltLinux/linux/issues/1440


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105265

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


[PATCH] D108239: [CUDA] Add support for CUDA-11.4.

2021-08-18 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

I didn't follow the recent CUDA support in Clang very closely, but this makes 
sense to me.




Comment at: clang/lib/Basic/Targets/NVPTX.cpp:48-49
 PTXVersion = llvm::StringSwitch(Feature)
+ .Case("+ptx72", 74)
+ .Case("+ptx71", 73)
  .Case("+ptx72", 72)

Do you mean `+ptx74` and `+ptx73`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108239

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


[PATCH] D108235: [CUDA] Bump default GPU architecture to sm_35.

2021-08-18 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

(might be good to have an entry in the release notes?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108235

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


[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

2021-08-18 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

Otherwise LGTM




Comment at: clang/lib/Driver/ToolChains/Cuda.cpp:103-104
+std::string VersionString = CudaVersionToString(Version);
+if (!VersionString.empty())
+  VersionString += " ";
+D.Diag(diag::warn_drv_new_cuda_version)

I think you have to prepend the space in order to match `CUDA version%0 is 
newer than`, or move the `%0`. But I didn't try locally, might be missing 
something.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247

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


[PATCH] D108150: [Remarks] [AMDGPU] Emit optimization remarks for atomics generating hardware instructions

2021-08-18 Thread Stanislav Mekhanoshin via Phabricator via cfe-commits
rampitec added inline comments.



Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:12194
 
-  return (fpModeMatchesGlobalFPAtomicMode(RMW) ||
-  RMW->getFunction()
-  ->getFnAttribute("amdgpu-unsafe-fp-atomics")
-  .getValueAsString() == "true")
- ? AtomicExpansionKind::None
- : AtomicExpansionKind::CmpXChg;
+  if (fpModeMatchesGlobalFPAtomicMode(RMW) ||
+  RMW->getFunction()

```
  if (fpModeMatchesGlobalFPAtomicMode(RMW))
return AtomicExpansionKind::None;

  return RMW->getFunction()
 ->getFnAttribute("amdgpu-unsafe-fp-atomics")
 .getValueAsString() == "true"
 ? ReportUnsafeHWInst(AtomicExpansionKind::None)
 : AtomicExpansionKind::CmpXChg;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108150

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


[PATCH] D108308: Cleanup identifier parsing.

2021-08-18 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision.
Herald added subscribers: dexonsmith, usaxena95, kadircet, arphaman.
Herald added a reviewer: aaron.ballman.
cor3ntin requested review of this revision.
Herald added projects: clang, clang-tools-extra.
Herald added a subscriber: cfe-commits.

- Rename methods to clearly signal when they only deal with ASCII
- Simplify the parsing of identifier
- use start/continue instead of head/body for consistency with

Unicode terminology


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108308

Files:
  clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
  clang-tools-extra/clang-tidy/google/IntegerTypesCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/SourceCode.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang/include/clang/Basic/CharInfo.h
  clang/include/clang/Lex/Lexer.h
  clang/lib/ARCMigrate/ObjCMT.cpp
  clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/Basic/Module.cpp
  clang/lib/Edit/EditedSource.cpp
  clang/lib/Frontend/LayoutOverrideSource.cpp
  clang/lib/Frontend/Rewrite/FrontendActions.cpp
  clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaAvailability.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Tooling/Transformer/Parsing.cpp
  clang/unittests/Basic/CharInfoTest.cpp

Index: clang/unittests/Basic/CharInfoTest.cpp
===
--- clang/unittests/Basic/CharInfoTest.cpp
+++ clang/unittests/Basic/CharInfoTest.cpp
@@ -50,44 +50,44 @@
   EXPECT_FALSE(isASCII('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierHead) {
-  EXPECT_TRUE(isIdentifierHead('a'));
-  EXPECT_TRUE(isIdentifierHead('A'));
-  EXPECT_TRUE(isIdentifierHead('z'));
-  EXPECT_TRUE(isIdentifierHead('Z'));
-  EXPECT_TRUE(isIdentifierHead('_'));
-
-  EXPECT_FALSE(isIdentifierHead('0'));
-  EXPECT_FALSE(isIdentifierHead('.'));
-  EXPECT_FALSE(isIdentifierHead('`'));
-  EXPECT_FALSE(isIdentifierHead('\0'));
-
-  EXPECT_FALSE(isIdentifierHead('$'));
-  EXPECT_TRUE(isIdentifierHead('$', /*AllowDollar=*/true));
-
-  EXPECT_FALSE(isIdentifierHead('\x80'));
-  EXPECT_FALSE(isIdentifierHead('\xc2'));
-  EXPECT_FALSE(isIdentifierHead('\xff'));
+TEST(CharInfoTest, isAsciiIdentifierStart) {
+  EXPECT_TRUE(isAsciiIdentifierStart('a'));
+  EXPECT_TRUE(isAsciiIdentifierStart('A'));
+  EXPECT_TRUE(isAsciiIdentifierStart('z'));
+  EXPECT_TRUE(isAsciiIdentifierStart('Z'));
+  EXPECT_TRUE(isAsciiIdentifierStart('_'));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('0'));
+  EXPECT_FALSE(isAsciiIdentifierStart('.'));
+  EXPECT_FALSE(isAsciiIdentifierStart('`'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\0'));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('$'));
+  EXPECT_TRUE(isAsciiIdentifierStart('$', /*AllowDollar=*/true));
+
+  EXPECT_FALSE(isAsciiIdentifierStart('\x80'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\xc2'));
+  EXPECT_FALSE(isAsciiIdentifierStart('\xff'));
 }
 
-TEST(CharInfoTest, isIdentifierBody) {
-  EXPECT_TRUE(isIdentifierBody('a'));
-  EXPECT_TRUE(isIdentifierBody('A'));
-  EXPECT_TRUE(isIdentifierBody('z'));
-  EXPECT_TRUE(isIdentifierBody('Z'));
-  EXPECT_TRUE(isIdentifierBody('_'));
+TEST(CharInfoTest, isAsciiIdentifierContinue) {
+  EXPECT_TRUE(isAsciiIdentifierContinue('a'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('A'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('z'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('Z'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('_'));
 
-  EXPECT_TRUE(isIdentifierBody('0'));
-  EXPECT_FALSE(isIdentifierBody('.'));
-  EXPECT_FALSE(isIdentifierBody('`'));
-  EXPECT_FALSE(isIdentifierBody('\0'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('0'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('.'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('`'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\0'));
 
-  EXPECT_FALSE(isIdentifierBody('$'));
-  EXPECT_TRUE(isIdentifierBody('$', /*AllowDollar=*/true));
+  EXPECT_FALSE(isAsciiIdentifierContinue('$'));
+  EXPECT_TRUE(isAsciiIdentifierContinue('$', /*AllowDollar=*/true));
 
-  EXPECT_FALSE(isIdentifierBody('\x80'));
-  EXPECT_FALSE(isIdentifierBody('\xc2'));
-  EXPECT_FALSE(isIdentifierBody('\xff'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\x80'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\xc2'));
+  EXPECT_FALSE(isAsciiIdentifierContinue('\xff'));
 }
 
 TEST(CharInfoTest, isHorizontalWhitespace) {
@@ -413,91 +413,91 @@
   EXPECT_EQ('\0', toUppercase('\0'));
 }
 
-TEST(CharInfoTest, isValidIdentifier) {
-  EXPECT_FALSE(isValidIdentifier(""));
+TEST(CharInfoTest, isValidAsciiIdentifier) {
+  EXPECT_FALSE(isValidAsciiIdentifier(""));
 
   // 1 character
-  EXPECT_FALSE(isValidIdentifier("."));
-  EXPECT_FALSE(isValidIdentifier("\n"));
-  EXPECT_FALSE(isValidIdentifier(" "));
-  

[Job Ad] Intel is hiring Frontend Compiler Engineers

2021-08-18 Thread Aaron Ballman via cfe-commits
Intel is looking for Frontend Compiler Engineers to be a part of the
Intel compiler engineering organization on the frontend team. Join our
growing team, helping to develop new features and maintain existing
functionality in Clang. We are currently hiring folks for entry-level
and experienced positions who are passionate about C, C++, OpenMP, or
SYCL.

A highly competitive compensation package comprising pay, stock,
bonuses and other benefit programs is offered and negotiable.

For more detailed information about this opportunity and to apply,
click on the link below.

https://jobs.intel.com/ShowJob/Id/2998816/Front-End-Compiler-Developer

If you have any questions, feel free to reach out to me directly!

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


[PATCH] D107850: [asan] Implemented custom calling convention similar to the one used by HWASan for X86.

2021-08-18 Thread Kirill Stoimenov via Phabricator via cfe-commits
kstoimenov added a comment.

I know it seems redundant to pass the constants with every function call, but 
otherwise the code generation code will have to take dependency on 
AddressSanitizerCommon.h, which I am not sure is ideal. I spent some time 
looking into it and becomes quite messy. For example the tests now need a way 
to set the values for those variables. I think the main downside of this 
approach is the bloat in the IR code, but it is cleaner than exposing internal 
asan details.

One other option I have looked into is to pass this info using the Module. For 
example using the addModuleFlag function, but again there is a problem of the 
tests. We could have a quick chat to discuss this if you want.




Comment at: llvm/lib/Target/X86/X86MCInstLower.cpp:1334
+
+  unsigned Reg = MI.getOperand(0).getReg().id();
+  uint64_t ShadowBase = MI.getOperand(1).getImm();

vitalybuka wrote:
> Why this called reg when it's address?
Because it is the id of the register which is used to pass the address. For 
example for X86::RDI it will be 53. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107850

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


[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/test/Driver/cuda-version-check.cu:75
 
-// UNKNOWN_VERSION_V: unknown CUDA version: version.txt:{{.*}}; assuming the 
latest supported version
-// UNKNOWN_VERSION_H: unknown CUDA version: cuda.h: CUDA_VERSION={{.*}}; 
assuming the latest supported version
-// UNKNOWN_VERSION: unknown CUDA version: no version found in version.txt or 
cuda.h; assuming the latest supported version
+// UNKNOWN_VERSION: CUDA version [unknown] is newer than the latest{{.*}} 
supported version
+// NEW_VERSION: CUDA version 99010 is newer than the latest{{.*}} supported 
version

Hahnfeld wrote:
> Can we keep the `[unknown]` out of the warning message? I understand that we 
> cannot nicely print a version identifier that we don't know about, so maybe 
> only print if the version is known and newer than `PARTIALLY_SUPPORTED`?
Done. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247

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


[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

2021-08-18 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 367246.
tra edited the summary of this revision.
tra added a comment.

Do not report the version if we don't know it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247

Files:
  clang/include/clang/Basic/Cuda.h
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Basic/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/lib/Driver/ToolChains/Cuda.h
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/bin/.keep
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/.keep
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/cuda.h
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/lib/.keep
  clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/lib64/.keep
  
clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
  clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
  clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h
  clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt
  clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h
  clang/test/Driver/cuda-version-check.cu

Index: clang/test/Driver/cuda-version-check.cu
===
--- clang/test/Driver/cuda-version-check.cu
+++ clang/test/Driver/cuda-version-check.cu
@@ -8,15 +8,12 @@
 // RUN:FileCheck %s --check-prefix=OK
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
-// Test version guess when no version.txt or cuda.h are found
+// Test version guess when cuda.h has not been found
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION
-// Unknown version with version.txt present
-// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda 2>&1 %s | \
-// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION_V
-// Unknown version with no version.txt but with version info present in cuda.h
-// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA_111/usr/local/cuda 2>&1 %s | \
-// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION_H
+// Unknown version info present in cuda.h
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 %s | \
+// RUN:FileCheck %s --check-prefix=UNKNOWN_VERSION
 // Make sure that we don't warn about CUDA version during C++ compilation.
 // RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \
 // RUN:--cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
@@ -66,13 +63,14 @@
 // OK_SM35-NOT: error: GPU arch sm_35
 
 // We should only get one error per architecture.
+// ERR_SM20: error: GPU arch sm_20 {{.*}}
+// ERR_SM20-NOT: error: GPU arch sm_20
+
 // ERR_SM60: error: GPU arch sm_60 {{.*}}
 // ERR_SM60-NOT: error: GPU arch sm_60
 
 // ERR_SM61: error: GPU arch sm_61 {{.*}}
 // ERR_SM61-NOT: error: GPU arch sm_61
 
-// UNKNOWN_VERSION_V: unknown CUDA version: version.txt:{{.*}}; assuming the latest supported version
-// UNKNOWN_VERSION_H: unknown CUDA version: cuda.h: CUDA_VERSION={{.*}}; assuming the latest supported version
-// UNKNOWN_VERSION: unknown CUDA version: no version found in version.txt or cuda.h; assuming the latest supported version
+// UNKNOWN_VERSION: CUDA version is newer than the latest{{.*}} supported version
 // UNKNOWN_VERSION_CXX-NOT: unknown CUDA version
Index: clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h
===
--- /dev/null
+++ clang/test/Driver/Inputs/CUDA_90/usr/local/cuda/include/cuda.h
@@ -0,0 +1,7 @@
+//
+// Placeholder file for testing CUDA version detection
+//
+
+#define CUDA_VERSION 9000
+
+//
Index: clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt
===
--- clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-CUDA Version 8.0.42
Index: clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h
===
--- /dev/null
+++ clang/test/Driver/Inputs/CUDA_80/usr/local/cuda/include/cuda.h
@@ -0,0 +1,7 @@
+//
+// Placeholder file for testing CUDA version detection
+//
+
+#define CUDA_VERSION 8000
+
+//
Index: clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
===
--- clang/test/Driver/Inputs/CUDA-unknown/usr/local/cuda/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-CUDA Version 999.999.999
Index: clang/test/Driver/Inputs/CUDA-new/usr/local/cuda/include/cuda.h

Phabricator Creator Pulling the Plug

2021-08-18 Thread MyDeveloper Day via cfe-commits
All

I'm a massive fan of Phabricator, and I know there is often lots of
contentious discussion about its relative merits vs github,

But unless I missed this, was there any discussion regarding the recent
"Winding Down" announcement of Phabricator? and what it might mean for us
in LLVM

See:
https://admin.phacility.com/phame/post/view/11/phacility_is_winding_down_operations/
https://www.phacility.com/phabricator/

Personally I'm excited by the concept of a community driven replacement (
https://we.phorge.it/) .
epriestley did a truly amazing job, it wasn't open to public contributions.
Perhaps more open development could lead to closing some of the github gaps
that were of concern.

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


[PATCH] D107430: [OMPIRBuilder] Add ordered directive to OMPIRBuilder

2021-08-18 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

Note that the `OpenMPIRBuilderTest.OrderedDirective` test is still crashing.




Comment at: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:2156-2157
+
+  Value *EntryBBTI = EntryBB->getTerminator();
+  EXPECT_EQ(EntryBBTI, nullptr);
+

peixin wrote:
> Meinersbur wrote:
> > Consider emitting a terminator, call `finalize()` and `verifyModule`.
> Why do you want me to emit the terminator? If it is because you think the 
> outlined captured function is not generated due to finalize call, there is no 
> need. Discussed above. Sorry about the misguide.
Without terminator, `verifyModule` will complain about it being missing.  
`verifyModule` should be called to ensure that the emitted IR is well-formed. 
Anyway, you seem to have added it in the last diff update.


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

https://reviews.llvm.org/D107430

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


[PATCH] D108265: .clang-tidy: Push variable related readability-identifier-naming options down to projects

2021-08-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

The number of top-level projects using `VariableName` is smaller than the 
number of projects not using the style.
The top-level variable style just provoked projects to either override the 
options (flang/, lld/, mlir/) or disable the check.
`VariableName` is not even a suitable suggestion for new projects.

So the  `VariableName` setting does not belong to the top-level. llvm/ and 
clang-tools-extra/ should set it by themselves.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108265

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


[PATCH] D105267: [X86] AVX512FP16 instructions enabling 4/6

2021-08-18 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:1920
+  setOperationAction(ISD::STRICT_FTRUNC,  VT, Legal);
+  setOperationAction(ISD::FRINT,  VT, Legal);
+  setOperationAction(ISD::STRICT_FRINT,   VT, Legal);

LuoYuanke wrote:
> Does this node means "round to int"? What's the difference to "FNEARBYINT"?
rint and nearbyint are both C math library functions. rint raises an exception 
if the rounding isn't exact, nearbyint doesn't.



Comment at: llvm/lib/Target/X86/X86InstrFoldTables.cpp:3037
   { X86::VSQRTSDr_Int, X86::VSQRTSDm_Int, 
TB_NO_REVERSE },
+  { X86::VSQRTSHZr,X86::VSQRTSHZm,0 },
+  { X86::VSQRTSHZr_Int,X86::VSQRTSHZm_Int,
TB_NO_REVERSE },

LuoYuanke wrote:
> Why no TB_NO_REVERSE for it?
Only the _Int need TB_NO_REVERSE because the memory type is 16 bits but the 
register class is VR128X so the sizes are different. The unfolding code would 
use the size of the register class to do the unfold and create a 
vmovaps/vmovups which would increase the size of the load.

For VSQRTZr, the register class is FR16X and the memory size is 16 bits so they 
match.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105267

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


[PATCH] D107717: [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project

2021-08-18 Thread Alf via Phabricator via cfe-commits
gAlfonso-bit added a comment.

I don't think there are any other outstanding issues. Are we good to accept and 
merge? @ldionne


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

https://reviews.llvm.org/D107717

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


[PATCH] D108241: [hwasan] Flag stack safety check as requiring aarch64

2021-08-18 Thread Florian Mayer via Phabricator via cfe-commits
fmayer accepted this revision.
fmayer added a comment.
This revision is now accepted and ready to land.

Thanks LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108241

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


[PATCH] D108286: [clang][Driver][Linux] fix regression issue when define LIBCXX_LIBDIR_SUFFIX=64

2021-08-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/lib/Driver/ToolChains/Linux.cpp:307
+  if (StringRef(D.Dir).startswith(SysRoot)) {
 addPathIfExists(D, D.Dir + "/../lib", Paths);
+addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);

Is `D.Dir + "/../lib"` still needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108286

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


[PATCH] D107290: [PoC][RISCV] Add support for the vscale_range attribute

2021-08-18 Thread Fraser Cormack via Phabricator via cfe-commits
frasercrmck updated this revision to Diff 367232.
frasercrmck added a comment.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

update usage in vein of AArch64:

- use vscale_range attribute to determine RVV vector bits min/max values
- if no attribute is present, use existing backend flags
- sanitize and pass RVV vector bits from RISCVTargetMachine through to 
RISCVSubtarget
- RISCVSubtarget just stores and reports


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107290

Files:
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/RISCV.h
  clang/test/CodeGen/riscv-vscale-range.c
  llvm/lib/Target/RISCV/RISCVSubtarget.cpp
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

Index: llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
===
--- llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -32,6 +32,18 @@
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
 
+static cl::opt RVVVectorBitsMaxOpt(
+"riscv-v-vector-bits-max",
+cl::desc("Assume V extension vector registers are at most this big, "
+ "with zero meaning no maximum size is assumed."),
+cl::init(0), cl::Hidden);
+
+static cl::opt RVVVectorBitsMinOpt(
+"riscv-v-vector-bits-min",
+cl::desc("Assume V extension vector registers are at least this big, "
+ "with zero meaning no minimum size is assumed."),
+cl::init(0), cl::Hidden);
+
 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
   RegisterTargetMachine X(getTheRISCV32Target());
   RegisterTargetMachine Y(getTheRISCV64Target());
@@ -78,13 +90,50 @@
   Attribute TuneAttr = F.getFnAttribute("tune-cpu");
   Attribute FSAttr = F.getFnAttribute("target-features");
 
+  unsigned RVVBitsMin = 0;
+  unsigned RVVBitsMax = 0;
+  Attribute VScaleRangeAttr = F.getFnAttribute(Attribute::VScaleRange);
+  if (VScaleRangeAttr.isValid()) {
+std::tie(RVVBitsMin, RVVBitsMax) = VScaleRangeAttr.getVScaleRangeArgs();
+RVVBitsMin *= RISCV::RVVBitsPerBlock;
+RVVBitsMax *= RISCV::RVVBitsPerBlock;
+  } else {
+RVVBitsMin = RVVVectorBitsMinOpt;
+RVVBitsMax = RVVVectorBitsMaxOpt;
+  }
+
+  assert(RVVBitsMin % 128 == 0 &&
+ "RVV requires vector length in multiples of 128!");
+  assert(RVVBitsMax % 128 == 0 &&
+ "RVV requires vector length in multiples of 128!");
+  assert(RVVBitsMax <= 65536 &&
+ "RVV vector size must be no larger than 65536!");
+  assert((RVVBitsMax >= RVVBitsMin || RVVBitsMax == 0) &&
+ "Minimum RVV vector size should not be larger than its maximum!");
+
+  // Sanitize user input in case of no asserts.
+  if (RVVBitsMax != 0)
+RVVBitsMin = std::min(RVVBitsMin, RVVBitsMax);
+  RVVBitsMin =
+  PowerOf2Floor((RVVBitsMin < 128 || RVVBitsMin > 65536) ? 0 : RVVBitsMin);
+
+  RVVBitsMax = std::max(RVVBitsMin, RVVBitsMax);
+  RVVBitsMax =
+  PowerOf2Floor((RVVBitsMax < 128 || RVVBitsMax > 65536) ? 0 : RVVBitsMax);
+
   std::string CPU =
   CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
   std::string TuneCPU =
   TuneAttr.isValid() ? TuneAttr.getValueAsString().str() : CPU;
   std::string FS =
   FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
+
   std::string Key = CPU + TuneCPU + FS;
+  Key += "RVVMin";
+  Key += std::to_string(RVVBitsMin);
+  Key += "RVVMax";
+  Key += std::to_string(RVVBitsMax);
+
   auto  = SubtargetMap[Key];
   if (!I) {
 // This needs to be done before we create a new subtarget since any
@@ -101,7 +150,8 @@
   }
   ABIName = ModuleTargetABI->getString();
 }
-I = std::make_unique(TargetTriple, CPU, TuneCPU, FS, ABIName, *this);
+I = std::make_unique(
+TargetTriple, CPU, TuneCPU, FS, ABIName, RVVBitsMin, RVVBitsMax, *this);
   }
   return I.get();
 }
Index: llvm/lib/Target/RISCV/RISCVSubtarget.h
===
--- llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -62,6 +62,8 @@
   bool EnableSaveRestore = false;
   unsigned XLen = 32;
   MVT XLenVT = MVT::i32;
+  unsigned RVVVectorBitsMin;
+  unsigned RVVVectorBitsMax;
   uint8_t MaxInterleaveFactor = 2;
   RISCVABI::ABI TargetABI = RISCVABI::ABI_Unknown;
   BitVector UserReservedRegister;
@@ -82,7 +84,8 @@
 public:
   // Initializes the data members to match that of the specified triple.
   RISCVSubtarget(const Triple , StringRef CPU, StringRef TuneCPU,
- StringRef FS, StringRef ABIName, const TargetMachine );
+ StringRef FS, StringRef ABIName, unsigned RVVVectorBitsMin,
+ unsigned RVVVectorLMULMax, const TargetMachine );
 
   // Parses features string setting specified subtarget options. The
   // definition of this function is 

[PATCH] D108286: [clang][Driver][Linux] fix regression issue when define LIBCXX_LIBDIR_SUFFIX=64

2021-08-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Please provide more information: the platform name and the output of `g++ 
empty.cc '-###' |& sed -E 's/ "?-[LiIr]/\n&/g'`

Note that there is a FIXME. It's unclear why your platform needs the specific 
rule.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108286

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


[PATCH] D108246: [clang-offload-wrapper] Disabled ELF offload notes embedding by default.

2021-08-18 Thread Vyacheslav Zakharin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ffbe8c04ff2: [clang-offload-wrapper] Disabled ELF offload 
notes embedding by default. (authored by vzakhari).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108246

Files:
  clang/test/Driver/clang-offload-wrapper.c
  clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp


Index: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
===
--- clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
+++ clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
@@ -76,6 +76,10 @@
  "This option forces print-out of the temporary files' names."),
 cl::Hidden);
 
+static cl::opt AddOpenMPOffloadNotes(
+"add-omp-offload-notes",
+cl::desc("Add LLVMOMPOFFLOAD ELF notes to ELF device images."), 
cl::Hidden);
+
 namespace {
 
 class BinaryWrapper {
@@ -630,7 +634,7 @@
   return 1;
 }
 std::unique_ptr Buffer(std::move(*BufOrErr));
-if (File != "-") {
+if (File != "-" && AddOpenMPOffloadNotes) {
   // Adding ELF notes for STDIN is not supported yet.
   Buffer = Wrapper.addELFNotes(std::move(Buffer), File);
 }
Index: clang/test/Driver/clang-offload-wrapper.c
===
--- clang/test/Driver/clang-offload-wrapper.c
+++ clang/test/Driver/clang-offload-wrapper.c
@@ -19,7 +19,7 @@
 //
 // Check bitcode produced by the wrapper tool.
 //
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o %t.wrapper.bc 
%t.tgt 2>&1 | FileCheck %s --check-prefix ELF-WARNING
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.bc %t.tgt 2>&1 | FileCheck %s 
--check-prefix ELF-WARNING
 // RUN: llvm-dis %t.wrapper.bc -o - | FileCheck %s --check-prefix CHECK-IR
 
 // ELF-WARNING: is not an ELF image, so notes cannot be added to it.
@@ -58,16 +58,16 @@
 // Check that clang-offload-wrapper adds LLVMOMPOFFLOAD notes
 // into the ELF offload images:
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.64le -DBITS=64 
-DENCODING=LSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf64le.bc %t.64le
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf64le.bc %t.64le
 // RUN: llvm-dis %t.wrapper.elf64le.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.64be -DBITS=64 
-DENCODING=MSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf64be.bc %t.64be
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf64be.bc %t.64be
 // RUN: llvm-dis %t.wrapper.elf64be.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.32le -DBITS=32 
-DENCODING=LSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf32le.bc %t.32le
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf32le.bc %t.32le
 // RUN: llvm-dis %t.wrapper.elf32le.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.32be -DBITS=32 
-DENCODING=MSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf32be.bc %t.32be
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf32be.bc %t.32be
 // RUN: llvm-dis %t.wrapper.elf32be.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 
 // There is no clean way for extracting the offload image


Index: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
===
--- clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
+++ clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
@@ -76,6 +76,10 @@
  "This option forces print-out of the temporary files' names."),
 cl::Hidden);
 
+static cl::opt AddOpenMPOffloadNotes(
+"add-omp-offload-notes",
+cl::desc("Add LLVMOMPOFFLOAD ELF notes to ELF device images."), cl::Hidden);
+
 namespace {
 
 class BinaryWrapper {
@@ -630,7 +634,7 @@
   return 1;
 }
 std::unique_ptr Buffer(std::move(*BufOrErr));
-if (File != "-") {
+if (File != "-" && AddOpenMPOffloadNotes) {
   // Adding ELF notes for STDIN is not supported yet.
   Buffer = Wrapper.addELFNotes(std::move(Buffer), File);
 }
Index: clang/test/Driver/clang-offload-wrapper.c
===
--- clang/test/Driver/clang-offload-wrapper.c
+++ clang/test/Driver/clang-offload-wrapper.c
@@ -19,7 +19,7 @@
 //
 // Check bitcode produced by the wrapper tool.
 //
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o %t.wrapper.bc %t.tgt 2>&1 | FileCheck %s 

[clang] 1ffbe8c - [clang-offload-wrapper] Disabled ELF offload notes embedding by default.

2021-08-18 Thread Vyacheslav Zakharin via cfe-commits

Author: Vyacheslav Zakharin
Date: 2021-08-18T08:18:03-07:00
New Revision: 1ffbe8c04ff269ca9847c37036fbad943820d6ae

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

LOG: [clang-offload-wrapper] Disabled ELF offload notes embedding by default.

This change-set puts 93d08acaacec951dbb302f77eeae51974985b6b2 functionality
under -add-omp-offload-notes switch that is OFF by default.
CUDA toolchain is not able to handle ELF images with LLVMOMPOFFLOAD
notes for unknown reason (see https://reviews.llvm.org/D99551#2950272).
I disable the ELF notes embedding until the CUDA issue is triaged and resolved.

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

Added: 


Modified: 
clang/test/Driver/clang-offload-wrapper.c
clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp

Removed: 




diff  --git a/clang/test/Driver/clang-offload-wrapper.c 
b/clang/test/Driver/clang-offload-wrapper.c
index c671d88209744..1c84072fef80a 100644
--- a/clang/test/Driver/clang-offload-wrapper.c
+++ b/clang/test/Driver/clang-offload-wrapper.c
@@ -19,7 +19,7 @@
 //
 // Check bitcode produced by the wrapper tool.
 //
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o %t.wrapper.bc 
%t.tgt 2>&1 | FileCheck %s --check-prefix ELF-WARNING
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.bc %t.tgt 2>&1 | FileCheck %s 
--check-prefix ELF-WARNING
 // RUN: llvm-dis %t.wrapper.bc -o - | FileCheck %s --check-prefix CHECK-IR
 
 // ELF-WARNING: is not an ELF image, so notes cannot be added to it.
@@ -58,16 +58,16 @@
 // Check that clang-offload-wrapper adds LLVMOMPOFFLOAD notes
 // into the ELF offload images:
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.64le -DBITS=64 
-DENCODING=LSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf64le.bc %t.64le
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf64le.bc %t.64le
 // RUN: llvm-dis %t.wrapper.elf64le.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.64be -DBITS=64 
-DENCODING=MSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf64be.bc %t.64be
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf64be.bc %t.64be
 // RUN: llvm-dis %t.wrapper.elf64be.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.32le -DBITS=32 
-DENCODING=LSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf32le.bc %t.32le
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf32le.bc %t.32le
 // RUN: llvm-dis %t.wrapper.elf32le.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 // RUN: yaml2obj %S/Inputs/empty-elf-template.yaml -o %t.32be -DBITS=32 
-DENCODING=MSB
-// RUN: clang-offload-wrapper -target=x86_64-pc-linux-gnu -o 
%t.wrapper.elf32be.bc %t.32be
+// RUN: clang-offload-wrapper -add-omp-offload-notes 
-target=x86_64-pc-linux-gnu -o %t.wrapper.elf32be.bc %t.32be
 // RUN: llvm-dis %t.wrapper.elf32be.bc -o - | FileCheck %s --check-prefix 
OMPNOTES
 
 // There is no clean way for extracting the offload image

diff  --git a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp 
b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
index bbadd909089e3..b86a927010eb2 100644
--- a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
+++ b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
@@ -76,6 +76,10 @@ static cl::opt SaveTemps(
  "This option forces print-out of the temporary files' names."),
 cl::Hidden);
 
+static cl::opt AddOpenMPOffloadNotes(
+"add-omp-offload-notes",
+cl::desc("Add LLVMOMPOFFLOAD ELF notes to ELF device images."), 
cl::Hidden);
+
 namespace {
 
 class BinaryWrapper {
@@ -630,7 +634,7 @@ int main(int argc, const char **argv) {
   return 1;
 }
 std::unique_ptr Buffer(std::move(*BufOrErr));
-if (File != "-") {
+if (File != "-" && AddOpenMPOffloadNotes) {
   // Adding ELF notes for STDIN is not supported yet.
   Buffer = Wrapper.addELFNotes(std::move(Buffer), File);
 }



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


[PATCH] D108303: [clang][openmp] Disable embedded elf notes

2021-08-18 Thread Vyacheslav Zakharin via Phabricator via cfe-commits
vzakhari added a comment.

In D108303#2952393 , @JonChesterfield 
wrote:

> I like D108246  more. None of the 
> offloading tests updated in D108246  failed 
> with the above patch, perhaps they're not run by `make check-openmp`

Right, the clang-offload-wrapper test is run by `check-clang`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108303

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


[PATCH] D107882: BPF: Enable frontend constant folding for VLA size

2021-08-18 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

ping. @rsmith could you help take a look at the patch? Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107882

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


[PATCH] D108303: [clang][openmp] Disable embedded elf notes

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield abandoned this revision.
JonChesterfield added a comment.

I like D108246  more. None of the offloading 
tests updated in D108246  failed with the 
above patch, perhaps they're not run by `make check-openmp`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108303

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


[PATCH] D106960: [OffloadArch] Library to query properties of current offload archicture

2021-08-18 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: llvm/lib/OffloadArch/OffloadArch.cpp:280
+  return results;
+}

the _aot_ names are not great.



Comment at: llvm/lib/OffloadArch/amdgpu/hsa-subset.h:40
+// DEALINGS WITH THE SOFTWARE.
+//
+

licence is wrong.



Comment at: llvm/lib/OffloadArch/offload-arch/offload-arch.cpp:93
+\n\
+");
+  exit(1);

This is not AMD.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106960

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


[PATCH] D108246: [clang-offload-wrapper] Disabled ELF offload notes embedding by default.

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added inline comments.



Comment at: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp:79
 
+static cl::opt AddOpenMPOffloadNotes(
+"add-omp-offload-notes",

I'd have probably gone with an explicit false here but it doesn't make much 
difference.


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

https://reviews.llvm.org/D108246

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


[PATCH] D108303: [clang][openmp] Disable embedded elf notes

2021-08-18 Thread Vyacheslav Zakharin via Phabricator via cfe-commits
vzakhari added a comment.

Hi Jon, I am about to merge D108246  that 
disables the notes embedding.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108303

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


[PATCH] D108246: [clang-offload-wrapper] Disabled ELF offload notes embedding by default.

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield accepted this revision.
JonChesterfield added a comment.

Amusingly similar to D108303 . LGTM.


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

https://reviews.llvm.org/D108246

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


[PATCH] D99551: [clang-offload-wrapper] Add standard notes for ELF offload images

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

It's a hack, but D108303  will unblock nvptx 
offloading. Alternative to reverting. Suggest we go with that then revisit in a 
couple of weeks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99551

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


[PATCH] D99551: [clang-offload-wrapper] Add standard notes for ELF offload images

2021-08-18 Thread Vyacheslav Zakharin via Phabricator via cfe-commits
vzakhari added a comment.

In D99551#2952336 , @JonChesterfield 
wrote:

> Nvptx broken here too, amdgpu is fine. I'm guessing one of the cuda tools 
> does some overly aggressive input validation that we're running afoul of.
>
> There was a discussion about this on the call today - plan was to put it 
> behind a disabled boolean argument while fixing to avoid downstream churn. 
> Sadly the original patch was not authored with that in mind. I suggest if we 
> can't get that patch together asap we revert this and fix it offline (even if 
> the fix is adding said flag)

I am about to merge D108246  that is adding 
the switch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99551

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


[PATCH] D108303: [clang][openmp] Disable embedded elf notes

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield created this revision.
JonChesterfield added reviewers: vzakhari, ABataev, grokos, sdmitriev, 
jdoerfert, ronlieb.
Herald added subscribers: guansong, yaxunl.
JonChesterfield requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

D99551  broke nvptx offloading. This patch
fixes that by disabling the functional change of
D99551 , allowing time to fix it without 
excessive
out of tree churn


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108303

Files:
  clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp


Index: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
===
--- clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
+++ clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
@@ -587,6 +587,9 @@
 } // anonymous namespace
 
 int main(int argc, const char **argv) {
+  // Embedded elf notes does not work on nvptx, disabling it globally while
+  // a fix is worked on offline
+  const bool EmbedElfNotes = false;
   sys::PrintStackTraceOnErrorSignal(argv[0]);
 
   cl::HideUnrelatedOptions(ClangOffloadWrapperCategory);
@@ -630,7 +633,7 @@
   return 1;
 }
 std::unique_ptr Buffer(std::move(*BufOrErr));
-if (File != "-") {
+if (EmbedElfNotes && File != "-") {
   // Adding ELF notes for STDIN is not supported yet.
   Buffer = Wrapper.addELFNotes(std::move(Buffer), File);
 }


Index: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
===
--- clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
+++ clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
@@ -587,6 +587,9 @@
 } // anonymous namespace
 
 int main(int argc, const char **argv) {
+  // Embedded elf notes does not work on nvptx, disabling it globally while
+  // a fix is worked on offline
+  const bool EmbedElfNotes = false;
   sys::PrintStackTraceOnErrorSignal(argv[0]);
 
   cl::HideUnrelatedOptions(ClangOffloadWrapperCategory);
@@ -630,7 +633,7 @@
   return 1;
 }
 std::unique_ptr Buffer(std::move(*BufOrErr));
-if (File != "-") {
+if (EmbedElfNotes && File != "-") {
   // Adding ELF notes for STDIN is not supported yet.
   Buffer = Wrapper.addELFNotes(std::move(Buffer), File);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99551: [clang-offload-wrapper] Add standard notes for ELF offload images

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Nvptx broken here too, amdgpu is fine. I'm guessing one of the cuda tools does 
some overly aggressive input validation that we're running afoul of.

There was a discussion about this on the call today - plan was to put it behind 
a disabled boolean argument while fixing to avoid downstream churn. Sadly the 
original patch was not authored with that in mind. I suggest if we can't get 
that patch together asap we revert this and fix it offline (even if the fix is 
adding said flag)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99551

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


[PATCH] D108247: [CUDA] Improve CUDA version detection and diagnostics.

2021-08-18 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

The change about amdgpu LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108247

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


[PATCH] D108291: [clang-nvlink-wrapper] Wrapper around nvlink for archive files

2021-08-18 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Discussed at the multicompany meeting today. Consensus reached is that the 
whole-archive/no-whole-archive distinction is unimportant - we can ship a 
toolchain that has whole-archive semantics and later change the default when 
doing more work in the linker. It's not my idea of backwards compatibility but 
I'm sympathetic to the argument that there's enough churn in gpu offloading 
that this particular point is lost in the noise.

The code itself looks basically OK to me, it extract files & passes them 
unchanged into nvlink along with other files. Error handling is incomplete - we 
detect some things going wrong, but end up returning 0 anyway. Bunch of 
comments inline.

It would be nicer from a unix perspective if the tool read the archives and 
returned a list of files to pass to nvlink, in pipeline fashion, but that'll 
make temporary file cleanup hazardous. Forking nvlink seems better for that 
reason.

Might be a nice usability feature for --help to print some stuff then invoke 
nvlink with --help itself. If this is ~ a perfect filter, aside from expanding 
archives, it could conceivably be named nvlink and used wherever nvlink is.




Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:27
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#include 
+#endif

what's unistd used for here? can we drop this?



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:123
+  int ExecResult = -1;
+  // const char *NVLProgram = NVLinkPath.c_str();
+  std::vector NVLArgs;

should lose the commented out code



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:127
+  if (!nvlink) {
+errs() << "Error: nvlink program not found.";
+return;

this seems a fairly likely failure mode - perhaps we should find nvlink first, 
and only start writing archives members into temporary files etc after 
establishing that it exists



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:136
+  }
+  printNVLinkCommand(NVLArgs);
+  ExecResult = llvm::sys::ExecuteAndWait(NVLProgram, NVLArgs);

This unconditionally writes an nvlink invocation to stderr. Not good post 
debugging the first implementation, programs should execute silently when 
successful. We could look for a debugging flag / environment variable if 
necessary for debugging this in the field



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:137
+  printNVLinkCommand(NVLArgs);
+  ExecResult = llvm::sys::ExecuteAndWait(NVLProgram, NVLArgs);
+  if (ExecResult) {

there's a risk that the large number of arguments that results here exceeds the 
platform limitations. I don't know offhand if executeandwait handles that (e.g. 
by creating response files), or if nvlink understands response files



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:156
+
+  llvm::Error Err = llvm::Error::success();
+  auto ChildEnd = Archive.child_end();

there's a using namespace llvm above, can remove a lot of llvm:: prefixes



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:196
+std::error_code EC = llvm::sys::fs::remove(TmpFile);
+reportIfError(EC, "Unable to delete temporary file");
+  }

does this name the file it couldn't delete?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108291

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


[PATCH] D108302: [PowerPC] Fixed the crash due to early if conversion with fixed CR fields.

2021-08-18 Thread Victor Huang via Phabricator via cfe-commits
NeHuang created this revision.
NeHuang added reviewers: stefanp, nemanjai, PowerPC.
NeHuang added a project: LLVM.
Herald added subscribers: shchenz, kbarton, hiraditya.
NeHuang requested review of this revision.

This patch adds a fix to do early if conversion to select when conditional 
branch not using physical register to prevent the crash when expanding ISEL 
instruction.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108302

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll


Index: llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 
-verify-machineinstrs | FileCheck %s
+target datalayout = 
"E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+
+define dso_local signext i32 @test(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) 
local_unnamed_addr {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcmpgtsw. 2, 2, 3
+; CHECK-NEXT:bge 6, .LBB0_2
+; CHECK-NEXT:  # %bb.1: # %land.rhs
+; CHECK-NEXT:vcmpgtsw. 2, 4, 3
+; CHECK-NEXT:mfocrf 3, 2
+; CHECK-NEXT:rlwinm 3, 3, 25, 31, 31
+; CHECK-NEXT:clrldi 3, 3, 32
+; CHECK-NEXT:blr
+; CHECK-NEXT:  .LBB0_2:
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.altivec.vcmpgtsw.p(i32 2, <4 x i32> %a, <4 x 
i32> %b)
+  %tobool.not = icmp eq i32 %0, 0
+  br i1 %tobool.not, label %land.end, label %land.rhs
+
+land.rhs: ; preds = %entry
+  %1 = tail call i32 @llvm.ppc.altivec.vcmpgtsw.p(i32 2, <4 x i32> %c, <4 x 
i32> %b)
+  %tobool1 = icmp ne i32 %1, 0
+  %phi.cast = zext i1 %tobool1 to i32
+  br label %land.end
+
+land.end: ; preds = %land.rhs, %entry
+  %2 = phi i32 [ 0, %entry ], [ %phi.cast, %land.rhs ]
+  ret i32 %2
+}
+
+; Function Attrs: nofree nosync nounwind readnone
+declare i32 @llvm.ppc.altivec.vcmpgtsw.p(i32, <4 x i32>, <4 x i32>)
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
===
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -1541,6 +1541,12 @@
   if (Cond[1].getReg() == PPC::CTR || Cond[1].getReg() == PPC::CTR8)
 return false;
 
+  // If the condition branch uses physical register, then it cannot be turned
+  // into a select.
+  if (Register::isPhysicalRegister(Cond[1].getReg())) {
+return false;
+  }
+
   // Check register classes.
   const MachineRegisterInfo  = MBB.getParent()->getRegInfo();
   const TargetRegisterClass *RC =


Index: llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -verify-machineinstrs | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+
+define dso_local signext i32 @test(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) local_unnamed_addr {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcmpgtsw. 2, 2, 3
+; CHECK-NEXT:bge 6, .LBB0_2
+; CHECK-NEXT:  # %bb.1: # %land.rhs
+; CHECK-NEXT:vcmpgtsw. 2, 4, 3
+; CHECK-NEXT:mfocrf 3, 2
+; CHECK-NEXT:rlwinm 3, 3, 25, 31, 31
+; CHECK-NEXT:clrldi 3, 3, 32
+; CHECK-NEXT:blr
+; CHECK-NEXT:  .LBB0_2:
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.altivec.vcmpgtsw.p(i32 2, <4 x i32> %a, <4 x i32> %b)
+  %tobool.not = icmp eq i32 %0, 0
+  br i1 %tobool.not, label %land.end, label %land.rhs
+
+land.rhs: ; preds = %entry
+  %1 = tail call i32 @llvm.ppc.altivec.vcmpgtsw.p(i32 2, <4 x i32> %c, <4 x i32> %b)
+  %tobool1 = icmp ne i32 %1, 0
+  %phi.cast = zext i1 %tobool1 to i32
+  br label %land.end
+
+land.end: ; preds = %land.rhs, %entry
+  %2 = phi i32 [ 0, %entry ], [ %phi.cast, %land.rhs ]
+  ret i32 %2
+}
+
+; Function Attrs: nofree nosync nounwind readnone
+declare i32 @llvm.ppc.altivec.vcmpgtsw.p(i32, <4 x i32>, <4 x i32>)
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
===
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -1541,6 +1541,12 @@
   if (Cond[1].getReg() == PPC::CTR || 

[PATCH] D108246: [clang-offload-wrapper] Disabled ELF offload notes embedding by default.

2021-08-18 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

As discussed, LG, we will look into the NVIDIA GPU problem now to get rid of 
this again.


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

https://reviews.llvm.org/D108246

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


[PATCH] D108301: [MSP430][Clang] Update hard-coded MCU data

2021-08-18 Thread Jozef Lawrynowicz via Phabricator via cfe-commits
jozefl created this revision.
jozefl added a reviewer: asl.
jozefl requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch updates MSP430 MCU data to the latest version distributed by
TI, adding support for 451 additional MCUs.

The hardware multiply version supported by each MCU is now stored as an
enum in the MCU data file, rather than a string. The string value passed
to the -mhwmult= option is now also converted to an enum. Using an enum
simplifies the processing of values, as invalid user input can be
canonicalized as a descriptive enum. It also ensures that the hard-coded
MCU data is valid; that there are no values that the parser does not
recognize.

Clang will no longer explicitly disable hwmult features for MCUs that
don't have hardware multiply support, as hwmult feature are already
disabled by default.

The CPU version of each MCU is now stored with the hard-coded MCU data,
so Clang can enable the appropriate LLVM CPU features when a particular
MCU is selected.

The hard-coded MCU data is stored in lexicographic order, which enables
efficient searching of the data with binary search, using
std::lower_bound.

If the patch is acceptable, I would appreciate it if someone would apply
it for me, as I do not have commit access.

Thanks,
Jozef


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108301

Files:
  clang/include/clang/Basic/MSP430Target.def
  clang/lib/Driver/ToolChains/MSP430.cpp
  clang/test/Driver/msp430-hwmult.c
  clang/test/Driver/msp430-mmcu.c
  clang/test/Driver/msp430-toolchain.c

Index: clang/test/Driver/msp430-toolchain.c
===
--- clang/test/Driver/msp430-toolchain.c
+++ clang/test/Driver/msp430-toolchain.c
@@ -253,6 +253,10 @@
 // RUN:   | FileCheck -check-prefix=HWMult-32BIT %s
 // HWMult-32BIT: "--start-group" "-lmul_32"
 
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430fr5969 --sysroot="" 2>&1 \
+// RUN:   | FileCheck -check-prefix=HWMult-F5 %s
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430fr5969 -mhwmult=auto --sysroot="" 2>&1 \
+// RUN:   | FileCheck -check-prefix=HWMult-F5 %s
 // RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mhwmult=f5series --sysroot="" 2>&1 \
 // RUN:   | FileCheck -check-prefix=HWMult-F5 %s
 // HWMult-F5: "--start-group" "-lmul_f5"
@@ -261,4 +265,10 @@
 // RUN:   | FileCheck -check-prefix=HWMult-NONE %s
 // RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mhwmult=none -mmcu=msp430f4783 --sysroot="" 2>&1 \
 // RUN:   | FileCheck -check-prefix=HWMult-NONE %s
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mhwmult=auto -mmcu=msp430 --sysroot="" 2>&1 \
+// RUN:   | FileCheck -check-prefix=HWMult-NONE %s
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mhwmult=auto -mmcu=msp430x --sysroot="" 2>&1 \
+// RUN:   | FileCheck -check-prefix=HWMult-NONE %s
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430xv2 --sysroot="" 2>&1 \
+// RUN:   | FileCheck -check-prefix=HWMult-NONE %s
 // HWMult-NONE: "--start-group" "-lmul_none"
Index: clang/test/Driver/msp430-mmcu.c
===
--- clang/test/Driver/msp430-mmcu.c
+++ clang/test/Driver/msp430-mmcu.c
@@ -1,15 +1,62 @@
+// This file tests that various different values passed to -mmcu= select the
+// correct target features and linker scripts, and create MCU-specific defines.
+
+// Test the lexicographic ordering of MCUs in MSP430Target.def.
+//
+// The MCU "msp430f110" should appear before "msp430f1101" when the data has
+// been sorted lexicographically. Some sorts will put "msp430f110" *after*
+// "msp430f1101", so when this happens, Clang will not be able to find this MCU.
+
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430f110 2>&1 \
+// RUN:   | FileCheck %s
+
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430f1101 2>&1 \
+// RUN:   | FileCheck %s
+
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430f1101a 2>&1 \
+// RUN:   | FileCheck %s
+
+// CHECK-NOT: error: the clang compiler does not support
+
+// Test the symbol definitions, linker scripts and hardware multiply features
+// selected for different MCUs.
+
 // RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430c111 2>&1 \
 // RUN:   | FileCheck -check-prefix=MSP430-C111 %s
 
 // MSP430-C111: clang{{.*}} "-cc1" {{.*}} "-D__MSP430C111__"
+// MSP430-C111-NOT: "-target-feature" "+hwmult16"
+// MSP430-C111-NOT: "-target-feature" "+hwmult32"
+// MSP430-C111-NOT: "-target-feature" "+hwmultf5"
 // MSP430-C111: msp430-elf-ld{{.*}} "-Tmsp430c111.ld"
 
 // RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430i2020 2>&1 \
 // RUN:   | FileCheck -check-prefix=MSP430-I2020 %s
 
 // MSP430-I2020: clang{{.*}} "-cc1" {{.*}} "-D__MSP430i2020__"
+// 

[PATCH] D108299: [MSP430][Clang] Remove support for -mmcu=msp430

2021-08-18 Thread Jozef Lawrynowicz via Phabricator via cfe-commits
jozefl created this revision.
jozefl requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The -mmcu= option accepts a generic MCU named "msp430", which sets the
CPU to msp430 and disables hardware multiply support.

The current purpose of accepting this value is to allow -mmcu= to be
used as an alias for -mcpu=, however there are some downsides to doing
this. -mmcu= provides additional features that will interfere
with the expected behavior if the user tries to to use it as an alias
for -mcpu=.

-mmcu=msp430 will conflict with -mhwmult=, since the "msp430" MCU is
defined to have no hardware multiply support, so the user will not be
able to set an explicit hardware multiply version.

-mmcu=msp430 will put "-Tmsp430.ld" on the linker command line, however
TI's support files do not provide a linker script with this name and so
the user would have to explicitly create it.

If the patch is acceptable, I would appreciate it if someone would apply
it for me, as I do not have commit access.

Thanks,
Jozef


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108299

Files:
  clang/include/clang/Basic/MSP430Target.def
  clang/test/Driver/msp430-mmcu.c


Index: clang/test/Driver/msp430-mmcu.c
===
--- clang/test/Driver/msp430-mmcu.c
+++ clang/test/Driver/msp430-mmcu.c
@@ -14,3 +14,9 @@
 // RUN:   | FileCheck -check-prefix=MSP430-UNSUP %s
 
 // MSP430-UNSUP: error: the clang compiler does not support 'not-a-mcu'
+
+// The generic MCU name "msp430" is not supported.
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430 2>&1 
\
+// RUN:   | FileCheck -check-prefix=MSP430 %s
+
+// MSP430: error: the clang compiler does not support 'msp430'
Index: clang/include/clang/Basic/MSP430Target.def
===
--- clang/include/clang/Basic/MSP430Target.def
+++ clang/include/clang/Basic/MSP430Target.def
@@ -238,8 +238,7 @@
 MSP430_MCU_FEAT("msp430f4784", "32bit")
 MSP430_MCU_FEAT("msp430f4794", "32bit")
 
-// Generic MSUs
-MSP430_MCU("msp430")
+// Generic MCUs
 MSP430_MCU("msp430i2xxgeneric")
 
 #undef MSP430_MCU


Index: clang/test/Driver/msp430-mmcu.c
===
--- clang/test/Driver/msp430-mmcu.c
+++ clang/test/Driver/msp430-mmcu.c
@@ -14,3 +14,9 @@
 // RUN:   | FileCheck -check-prefix=MSP430-UNSUP %s
 
 // MSP430-UNSUP: error: the clang compiler does not support 'not-a-mcu'
+
+// The generic MCU name "msp430" is not supported.
+// RUN: %clang %s -### -no-canonical-prefixes -target msp430 -mmcu=msp430 2>&1 \
+// RUN:   | FileCheck -check-prefix=MSP430 %s
+
+// MSP430: error: the clang compiler does not support 'msp430'
Index: clang/include/clang/Basic/MSP430Target.def
===
--- clang/include/clang/Basic/MSP430Target.def
+++ clang/include/clang/Basic/MSP430Target.def
@@ -238,8 +238,7 @@
 MSP430_MCU_FEAT("msp430f4784", "32bit")
 MSP430_MCU_FEAT("msp430f4794", "32bit")
 
-// Generic MSUs
-MSP430_MCU("msp430")
+// Generic MCUs
 MSP430_MCU("msp430i2xxgeneric")
 
 #undef MSP430_MCU
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108111: [CodeComplete] Only complete attributes that match the current LangOpts

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

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108111

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


[PATCH] D108109: [CodeCompletion] Provide placeholders for known attribute arguments

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

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108109

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


[PATCH] D108291: [clang-nvlink-wrapper] Wrapper around nvlink for archive files

2021-08-18 Thread Ye Luo via Phabricator via cfe-commits
ye-luo added a comment.

this is the working steps in the linking script.

  clang-offload-bundler (host,device)
  in: complex_reduction.cpp.o
  out: complex_reduction-494ba8.o, complex_reduction-5aba63.cubin
  
  nvlink (device)
  in: complex_reduction-5aba63.cubin
  out: complex_reduction-b1898c.out
  
  clang-offload-wrapper (device)
  in: complex_reduction-b1898c.out
  out: cxx-a8318a.bc
  
  clang (device)
  in: cxx-a8318a.bc cxx-e54e6f.o
  
  ld (host, device)
  in: complex_reduction-494ba8.o, cxx-e54e6f.o
  out: executable

I'm not quite understand what this wrapper replaces and why.
"It is required for linking static device libraries on nvptx" is not explaining 
what is not working with existing steps and what the clang-nvlink-wrapper 
changes to make it work. Need elaboration.




Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:41
+For descriptions of the options please run 'nvlink --help'
+The wrapper extracts any arcive objects and call nvlink with the
+individual files instead, plus any other options/object.

arcive -> archive
 is input already
"The wrapper extracts any arcive objects " what does it mean?
"call nvlink with the individual files" waht individual files.
What is the output?
Please make this documentation more clear.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108291

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


[PATCH] D105267: [X86] AVX512FP16 instructions enabling 4/6

2021-08-18 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added inline comments.



Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:1920
+  setOperationAction(ISD::STRICT_FTRUNC,  VT, Legal);
+  setOperationAction(ISD::FRINT,  VT, Legal);
+  setOperationAction(ISD::STRICT_FRINT,   VT, Legal);

Does this node means "round to int"? What's the difference to "FNEARBYINT"?



Comment at: llvm/lib/Target/X86/X86ISelLowering.h:290
 
+// AVX-512-FP16 scalar reciprocal approximations
+FRSQRTS,

Move the code to line 283, so that it is adjacent to FRSQRT and FRCP?



Comment at: llvm/lib/Target/X86/X86InstrAVX512.td:9279
 /// avx512_fp14_s rcp14ss, rcp14sd, rsqrt14ss, rsqrt14sd
 multiclass avx512_fp14_s opc, string OpcodeStr, SDNode OpNode,
+ X86FoldableSchedWrite sched, X86VectorVTInfo _,

The name is not precise now. We now support non-fp14 node. Also update the 
comments.



Comment at: llvm/lib/Target/X86/X86InstrAVX512.td:9484
+  defm PHZ : avx512_fp28_p,
+  avx512_fp28_p_sae,
+  T_MAP6PD, EVEX_V512, EVEX_CD8<16, CD8VF>;

indent.



Comment at: llvm/lib/Target/X86/X86InstrAVX512.td:13476
+
+multiclass avx512_fp16_p_vl_all opc, string OpcodeStr, SDNode OpNode,
+   X86SchedWriteWidths sched> {

Why not merge this class to avx512_fp14_p_vl_all? Is it because it doesn't use 
MXCSR?



Comment at: llvm/lib/Target/X86/X86InstrAVX512.td:13477
+multiclass avx512_fp16_p_vl_all opc, string OpcodeStr, SDNode OpNode,
+   X86SchedWriteWidths sched> {
+  let Predicates = [HasFP16] in

indent.



Comment at: llvm/lib/Target/X86/X86InstrFoldTables.cpp:3037
   { X86::VSQRTSDr_Int, X86::VSQRTSDm_Int, 
TB_NO_REVERSE },
+  { X86::VSQRTSHZr,X86::VSQRTSHZm,0 },
+  { X86::VSQRTSHZr_Int,X86::VSQRTSHZm_Int,
TB_NO_REVERSE },

Why no TB_NO_REVERSE for it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105267

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


  1   2   >