[PATCH] D93579: [clang][AVR] Improve avr-ld command line options

2021-01-23 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay accepted this revision.
dylanmckay added a comment.
This revision is now accepted and ready to land.

Great patch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93579

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


[PATCH] D27651: [clang-format] Even with AlignConsecutiveDeclarations, PointerAlignment: Right should keep *s and &s to the right

2021-01-23 Thread Jasper Swallen via Phabricator via cfe-commits
jasperswallen added a comment.

Is there any possibility of this being merged/reimplemented? This is a big 
annoyance for our project right now. If needed, I can potentially take a look 
at redoing it.


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

https://reviews.llvm.org/D27651

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


[clang] 2b9a834 - [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.

2021-01-23 Thread Jeroen Dobbelaere via cfe-commits

Author: Jeroen Dobbelaere
Date: 2021-01-23T12:10:57+01:00
New Revision: 2b9a834c43cb1f93d33958c14b695896bb4e9c1e

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

LOG: [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias 
arguments.

Insert a llvm.experimental.noalias.scope.decl intrinsic that identifies where a 
noalias argument was inlined.

This patch includes some refactorings from D90104.

Reviewed By: nikic

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

Added: 
llvm/test/Transforms/Inline/noalias-calls2.ll

Modified: 
clang/test/CodeGen/aarch64-ls64.c
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/Coroutines/ArgAddr.ll
llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
llvm/test/Transforms/Coroutines/coro-retcon-value.ll
llvm/test/Transforms/Coroutines/coro-retcon.ll
llvm/test/Transforms/Coroutines/ex2.ll
llvm/test/Transforms/Coroutines/ex3.ll
llvm/test/Transforms/Coroutines/ex4.ll
llvm/test/Transforms/Inline/launder.invariant.group.ll
llvm/test/Transforms/Inline/noalias-calls-always.ll
llvm/test/Transforms/Inline/noalias-calls.ll
llvm/test/Transforms/Inline/noalias-cs.ll
llvm/test/Transforms/Inline/noalias.ll
llvm/test/Transforms/Inline/noalias2.ll
llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll
llvm/test/Transforms/PhaseOrdering/pr39282.ll

Removed: 




diff  --git a/clang/test/CodeGen/aarch64-ls64.c 
b/clang/test/CodeGen/aarch64-ls64.c
index 77e4b41fbd58..17fce0094ac9 100644
--- a/clang/test/CodeGen/aarch64-ls64.c
+++ b/clang/test/CodeGen/aarch64-ls64.c
@@ -21,6 +21,7 @@ uint64_t status;
 // CHECK-NEXT:[[__ADDR_ADDR_I:%.*]] = alloca i8*, align 8
 // CHECK-NEXT:[[REF_TMP:%.*]] = alloca [[STRUCT_DATA512_T:%.*]], align 8
 // CHECK-NEXT:[[TMP0:%.*]] = load i8*, i8** @addr, align 8
+// CHECK-NEXT:call void @llvm.experimental.noalias.scope.decl(metadata !6)
 // CHECK-NEXT:store i8* [[TMP0]], i8** [[__ADDR_ADDR_I]], align 8, 
!noalias !6
 // CHECK-NEXT:[[TMP1:%.*]] = load i8*, i8** [[__ADDR_ADDR_I]], align 8, 
!noalias !6
 // CHECK-NEXT:[[VAL_I:%.*]] = getelementptr inbounds [[STRUCT_DATA512_T]], 
%struct.data512_t* [[REF_TMP]], i32 0, i32 0

diff  --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp 
b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 65bf6a3b32dc..abdd2b2361b7 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -79,6 +79,12 @@ EnableNoAliasConversion("enable-noalias-to-md-conversion", 
cl::init(true),
   cl::Hidden,
   cl::desc("Convert noalias attributes to metadata during inlining."));
 
+static cl::opt
+UseNoAliasIntrinsic("use-noalias-intrinsic-during-inlining", cl::Hidden,
+cl::ZeroOrMore, cl::init(true),
+cl::desc("Use the llvm.experimental.noalias.scope.decl 
"
+ "intrinsic during inlining."));
+
 // Disabled by default, because the added alignment assumptions may increase
 // compile-time and block optimizations. This option is not suitable for use
 // with frontends that emit comprehensive parameter alignment annotations.
@@ -821,91 +827,119 @@ static void PropagateCallSiteMetadata(CallBase &CB, 
ValueToValueMapTy &VMap) {
   }
 }
 
-/// When inlining a function that contains noalias scope metadata,
-/// this metadata needs to be cloned so that the inlined blocks
-/// have 
diff erent "unique scopes" at every call site. Were this not done, then
-/// aliasing scopes from a function inlined into a caller multiple times could
-/// not be 
diff erentiated (and this would lead to miscompiles because the
-/// non-aliasing property communicated by the metadata could have
-/// call-site-specific control dependencies).
-static void CloneAliasScopeMetadata(CallBase &CB, ValueToValueMapTy &VMap) {
-  const Function *CalledFunc = CB.getCalledFunction();
+/// Utility for cloning !noalias and !alias.scope metadata. When a code region
+/// using scoped alias metadata is inlined, the aliasing relationships may not
+/// hold between the two version. It is necessary to create a deep clone of the
+/// metadata, putting the two versions in separate scope domains.
+class ScopedAliasMetadataDeepCloner {
+  using MetadataMap = DenseMap;
   SetVector MD;
-
-  // Note: We could only clone the metadata if it is already used in the
-  // caller. I'm omitting that check here because it might confuse
-  // inter-procedural alias analysis passes. We can revisit this if it becomes
-  // an efficiency or overhead problem.
-
-  for (const BasicBlock &I : *CalledFunc)
-for (const Instruction &J : I) {

[PATCH] D93040: [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.

2021-01-23 Thread Jeroen Dobbelaere via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2b9a834c43cb: [InlineFunction] Use 
llvm.experimental.noalias.scope.decl for noalias arguments. (authored by 
jeroen.dobbelaere).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93040

Files:
  clang/test/CodeGen/aarch64-ls64.c
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
  llvm/test/Transforms/Coroutines/coro-retcon-value.ll
  llvm/test/Transforms/Coroutines/coro-retcon.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Inline/launder.invariant.group.ll
  llvm/test/Transforms/Inline/noalias-calls-always.ll
  llvm/test/Transforms/Inline/noalias-calls.ll
  llvm/test/Transforms/Inline/noalias-calls2.ll
  llvm/test/Transforms/Inline/noalias-cs.ll
  llvm/test/Transforms/Inline/noalias.ll
  llvm/test/Transforms/Inline/noalias2.ll
  llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
  llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll
  llvm/test/Transforms/PhaseOrdering/pr39282.ll

Index: llvm/test/Transforms/PhaseOrdering/pr39282.ll
===
--- llvm/test/Transforms/PhaseOrdering/pr39282.ll
+++ llvm/test/Transforms/PhaseOrdering/pr39282.ll
@@ -19,12 +19,20 @@
 define void @pr39282(i32* %addr1, i32* %addr2) {
 ; CHECK-LABEL: @pr39282(
 ; CHECK-NEXT:  start:
-; CHECK-NEXT:[[X_I:%.*]] = load i32, i32* [[ADDR1:%.*]], align 4, !alias.scope !0, !noalias !3
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META0:metadata !.*]])
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META3:metadata !.*]])
+; CHECK-NEXT:[[X_I:%.*]] = load i32, i32* [[ADDR1:%.*]], align 4, !alias.scope !3, !noalias !0
 ; CHECK-NEXT:[[ADDR1I_1:%.*]] = getelementptr inbounds i32, i32* [[ADDR1]], i64 1
 ; CHECK-NEXT:[[ADDR2I_1:%.*]] = getelementptr inbounds i32, i32* [[ADDR2:%.*]], i64 1
-; CHECK-NEXT:[[X_I_1:%.*]] = load i32, i32* [[ADDR1I_1]], align 4, !alias.scope !0, !noalias !3
-; CHECK-NEXT:store i32 [[X_I]], i32* [[ADDR2]], align 4, !alias.scope !3, !noalias !0
-; CHECK-NEXT:store i32 [[X_I_1]], i32* [[ADDR2I_1]], align 4, !alias.scope !3, !noalias !0
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META0]])
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META3]])
+; CHECK-NEXT:[[X_I_1:%.*]] = load i32, i32* [[ADDR1I_1]], align 4, !alias.scope !3, !noalias !0
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META0]])
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META3]])
+; CHECK-NEXT:store i32 [[X_I]], i32* [[ADDR2]], align 4, !alias.scope !0, !noalias !3
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META0]])
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META3]])
+; CHECK-NEXT:store i32 [[X_I_1]], i32* [[ADDR2I_1]], align 4, !alias.scope !0, !noalias !3
 ; CHECK-NEXT:ret void
 ;
 start:
Index: llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll
===
--- llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll
+++ llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll
@@ -70,6 +70,7 @@
 ; CHECK-NEXT:[[I2:%.*]] = alloca [[TMP0:%.*]], align 8
 ; CHECK-NEXT:[[I1_SROA_0_0_I5_SROA_IDX:%.*]] = getelementptr inbounds [[TMP0]], %0* [[ARG:%.*]], i64 0, i32 0
 ; CHECK-NEXT:[[I1_SROA_0_0_COPYLOAD:%.*]] = load i32*, i32** [[I1_SROA_0_0_I5_SROA_IDX]], align 8
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META0:metadata !.*]])
 ; CHECK-NEXT:[[I_SROA_0_0_I6_SROA_IDX:%.*]] = getelementptr inbounds [[TMP0]], %0* [[I2]], i64 0, i32 0
 ; CHECK-NEXT:store i32* [[I1_SROA_0_0_COPYLOAD]], i32** [[I_SROA_0_0_I6_SROA_IDX]], align 8
 ; CHECK-NEXT:tail call void @_Z7escape01S(%0* nonnull byval(%0) align 8 [[I2]])
@@ -109,6 +110,7 @@
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:[[I1_SROA_0_0_I4_SROA_IDX:%.*]] = getelementptr inbounds [[TMP0:%.*]], %0* [[ARG:%.*]], i64 0, i32 0
 ; CHECK-NEXT:[[I1_SROA_0_0_COPYLOAD:%.*]] = load i32*, i32** [[I1_SROA_0_0_I4_SROA_IDX]], align 8
+; CHECK-NEXT:tail call void @llvm.experimental.noalias.scope.decl([[META3:metadata !.*]])
 ; CHECK-NEXT:[[I5:%.*]] = tail call i32 @_Z4condv()
 ; CHECK-NEXT:[[I6_NOT:%.*]] = icmp eq i32 [[I5]], 0
 ; CHECK-NEXT:br i1 [[I6_NOT]], label [[BB10:%.*]], label [[BB7:%.*]]
Index: llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
==

[clang] 2325157 - [Clang] Move assembler into a separate file

2021-01-23 Thread Ayke van Laethem via cfe-commits

Author: Ayke van Laethem
Date: 2021-01-23T14:34:23+01:00
New Revision: 2325157c0568ffd16f3318ad54f947e4e2109ef6

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

LOG: [Clang] Move assembler into a separate file

This change adds an AssemblerInvocation class, similar to the
CompilerInvocation class. It can be used to invoke cc1as directly.

The project I'm working on wants to compile Clang and use it as a static
library. For that to work, there must be a way to invoke the assembler
programmatically, using the same arguments as you would otherwise pass
to cc1as.

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

Added: 
clang/include/clang/Frontend/AssemblerInvocation.h
clang/lib/Frontend/AssemblerInvocation.cpp

Modified: 
clang/lib/Frontend/CMakeLists.txt
clang/tools/driver/cc1as_main.cpp

Removed: 




diff  --git a/clang/include/clang/Frontend/AssemblerInvocation.h 
b/clang/include/clang/Frontend/AssemblerInvocation.h
new file mode 100644
index ..8644f6c14228
--- /dev/null
+++ b/clang/include/clang/Frontend/AssemblerInvocation.h
@@ -0,0 +1,126 @@
+//===- AssemblerInvocation.h - Assembler Invocation Helper Data -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_CLANG_FRONTEND_ASSEMBLERINVOCATION_H
+#define LLVM_CLANG_FRONTEND_ASSEMBLERINVOCATION_H
+
+#include "llvm/MC/MCTargetOptions.h"
+
+namespace clang {
+
+/// Helper class for representing a single invocation of the assembler.
+struct AssemblerInvocation {
+  /// @name Target Options
+  /// @{
+
+  /// The name of the target triple to assemble for.
+  std::string Triple;
+
+  /// If given, the name of the target CPU to determine which instructions
+  /// are legal.
+  std::string CPU;
+
+  /// The list of target specific features to enable or disable -- this should
+  /// be a list of strings starting with '+' or '-'.
+  std::vector Features;
+
+  /// The list of symbol definitions.
+  std::vector SymbolDefs;
+
+  /// @}
+  /// @name Language Options
+  /// @{
+
+  std::vector IncludePaths;
+  unsigned NoInitialTextSection : 1;
+  unsigned SaveTemporaryLabels : 1;
+  unsigned GenDwarfForAssembly : 1;
+  unsigned RelaxELFRelocations : 1;
+  unsigned DwarfVersion;
+  std::string DwarfDebugFlags;
+  std::string DwarfDebugProducer;
+  std::string DebugCompilationDir;
+  std::map DebugPrefixMap;
+  llvm::DebugCompressionType CompressDebugSections =
+  llvm::DebugCompressionType::None;
+  std::string MainFileName;
+  std::string SplitDwarfOutput;
+
+  /// @}
+  /// @name Frontend Options
+  /// @{
+
+  std::string InputFile;
+  std::vector LLVMArgs;
+  std::string OutputPath;
+  enum FileType {
+FT_Asm,  ///< Assembly (.s) output, transliterate mode.
+FT_Null, ///< No output, for timing purposes.
+FT_Obj   ///< Object file output.
+  };
+  FileType OutputType;
+  unsigned ShowHelp : 1;
+  unsigned ShowVersion : 1;
+
+  /// @}
+  /// @name Transliterate Options
+  /// @{
+
+  unsigned OutputAsmVariant;
+  unsigned ShowEncoding : 1;
+  unsigned ShowInst : 1;
+
+  /// @}
+  /// @name Assembler Options
+  /// @{
+
+  unsigned RelaxAll : 1;
+  unsigned NoExecStack : 1;
+  unsigned FatalWarnings : 1;
+  unsigned NoWarn : 1;
+  unsigned IncrementalLinkerCompatible : 1;
+  unsigned EmbedBitcode : 1;
+
+  /// The name of the relocation model to use.
+  std::string RelocationModel;
+
+  /// The ABI targeted by the backend. Specified using -target-abi. Empty
+  /// otherwise.
+  std::string TargetABI;
+
+  /// @}
+
+public:
+  AssemblerInvocation() {
+Triple = "";
+NoInitialTextSection = 0;
+InputFile = "-";
+OutputPath = "-";
+OutputType = FT_Asm;
+OutputAsmVariant = 0;
+ShowInst = 0;
+ShowEncoding = 0;
+RelaxAll = 0;
+NoExecStack = 0;
+FatalWarnings = 0;
+NoWarn = 0;
+IncrementalLinkerCompatible = 0;
+DwarfVersion = 0;
+EmbedBitcode = 0;
+  }
+
+  static bool CreateFromArgs(AssemblerInvocation &Res,
+ ArrayRef Argv,
+ DiagnosticsEngine &Diags);
+};
+
+bool ExecuteAssembler(AssemblerInvocation &Opts, DiagnosticsEngine &Diags);
+
+} // namespace clang
+
+#endif // LLVM_CLANG_FRONTEND_ASSEMBLERINVOCATION_H

diff  --git a/clang/lib/Frontend/AssemblerInvocation.cpp 
b/clang/lib/Frontend/AssemblerInvocation.cpp
new file mode 100644
index ..7f6944c60379
--- /dev/null
+++ b/clang/lib/Frontend/AssemblerInvocation.cpp
@@ -0,0 +1,432 @@
+//===- AssemblerInvocation.cpp 

[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Ayke via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2325157c0568: [Clang] Move assembler into a separate file 
(authored by aykevl).

Changed prior to commit:
  https://reviews.llvm.org/D63852?vs=206769&id=318750#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63852

Files:
  clang/include/clang/Frontend/AssemblerInvocation.h
  clang/lib/Frontend/AssemblerInvocation.cpp
  clang/lib/Frontend/CMakeLists.txt
  clang/tools/driver/cc1as_main.cpp

Index: clang/lib/Frontend/CMakeLists.txt
===
--- clang/lib/Frontend/CMakeLists.txt
+++ clang/lib/Frontend/CMakeLists.txt
@@ -9,6 +9,7 @@
   )
 
 add_clang_library(clangFrontend
+  AssemblerInvocation.cpp
   ASTConsumers.cpp
   ASTMerge.cpp
   ASTUnit.cpp
Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -15,6 +15,7 @@
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/Options.h"
+#include "clang/Frontend/AssemblerInvocation.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Frontend/Utils.h"
@@ -56,493 +57,9 @@
 #include 
 #include 
 using namespace clang;
-using namespace clang::driver;
-using namespace clang::driver::options;
 using namespace llvm;
 using namespace llvm::opt;
 
-namespace {
-
-/// Helper class for representing a single invocation of the assembler.
-struct AssemblerInvocation {
-  /// @name Target Options
-  /// @{
-
-  /// The name of the target triple to assemble for.
-  std::string Triple;
-
-  /// If given, the name of the target CPU to determine which instructions
-  /// are legal.
-  std::string CPU;
-
-  /// The list of target specific features to enable or disable -- this should
-  /// be a list of strings starting with '+' or '-'.
-  std::vector Features;
-
-  /// The list of symbol definitions.
-  std::vector SymbolDefs;
-
-  /// @}
-  /// @name Language Options
-  /// @{
-
-  std::vector IncludePaths;
-  unsigned NoInitialTextSection : 1;
-  unsigned SaveTemporaryLabels : 1;
-  unsigned GenDwarfForAssembly : 1;
-  unsigned RelaxELFRelocations : 1;
-  unsigned DwarfVersion;
-  std::string DwarfDebugFlags;
-  std::string DwarfDebugProducer;
-  std::string DebugCompilationDir;
-  std::map DebugPrefixMap;
-  llvm::DebugCompressionType CompressDebugSections =
-  llvm::DebugCompressionType::None;
-  std::string MainFileName;
-  std::string SplitDwarfOutput;
-
-  /// @}
-  /// @name Frontend Options
-  /// @{
-
-  std::string InputFile;
-  std::vector LLVMArgs;
-  std::string OutputPath;
-  enum FileType {
-FT_Asm,  ///< Assembly (.s) output, transliterate mode.
-FT_Null, ///< No output, for timing purposes.
-FT_Obj   ///< Object file output.
-  };
-  FileType OutputType;
-  unsigned ShowHelp : 1;
-  unsigned ShowVersion : 1;
-
-  /// @}
-  /// @name Transliterate Options
-  /// @{
-
-  unsigned OutputAsmVariant;
-  unsigned ShowEncoding : 1;
-  unsigned ShowInst : 1;
-
-  /// @}
-  /// @name Assembler Options
-  /// @{
-
-  unsigned RelaxAll : 1;
-  unsigned NoExecStack : 1;
-  unsigned FatalWarnings : 1;
-  unsigned NoWarn : 1;
-  unsigned IncrementalLinkerCompatible : 1;
-  unsigned EmbedBitcode : 1;
-
-  /// The name of the relocation model to use.
-  std::string RelocationModel;
-
-  /// The ABI targeted by the backend. Specified using -target-abi. Empty
-  /// otherwise.
-  std::string TargetABI;
-
-  /// @}
-
-public:
-  AssemblerInvocation() {
-Triple = "";
-NoInitialTextSection = 0;
-InputFile = "-";
-OutputPath = "-";
-OutputType = FT_Asm;
-OutputAsmVariant = 0;
-ShowInst = 0;
-ShowEncoding = 0;
-RelaxAll = 0;
-NoExecStack = 0;
-FatalWarnings = 0;
-NoWarn = 0;
-IncrementalLinkerCompatible = 0;
-DwarfVersion = 0;
-EmbedBitcode = 0;
-  }
-
-  static bool CreateFromArgs(AssemblerInvocation &Res,
- ArrayRef Argv,
- DiagnosticsEngine &Diags);
-};
-
-}
-
-bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
- ArrayRef Argv,
- DiagnosticsEngine &Diags) {
-  bool Success = true;
-
-  // Parse the arguments.
-  const OptTable &OptTbl = getDriverOptTable();
-
-  const unsigned IncludedFlagsBitmask = options::CC1AsOption;
-  unsigned MissingArgIndex, MissingArgCount;
-  InputArgList Args = OptTbl.ParseArgs(Argv, MissingArgIndex, MissingArgCount,
-   IncludedFlagsBitmask);
-
-  // Check for missing argument error.
-  if (MissingArgCount) {
-Diags.Report(diag::err_drv_missing_argument)
-<< Args.getArgString(MissingArgIndex) << Mi

[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Ayke via Phabricator via cfe-commits
aykevl added a comment.

Thanks! I have updated this patch to match LLVM main and committed it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63852

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


[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Ayke via Phabricator via cfe-commits
aykevl added a comment.

Well that didn't quite work. I get errors like this:

  
tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/AssemblerInvocation.cpp.o:(.toc+0x0):
 undefined reference to `vtable for llvm::MCSubtargetInfo'
  
tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/AssemblerInvocation.cpp.o:
 In function `clang::ExecuteAssembler(clang::AssemblerInvocation&, 
clang::DiagnosticsEngine&)':
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x418):
 undefined reference to `llvm::MCTargetOptions::MCTargetOptions()'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x564):
 undefined reference to `llvm::MCContext::MCContext(llvm::MCAsmInfo const*, 
llvm::MCRegisterInfo const*, llvm::MCObjectFileInfo const*, llvm::SourceMgr 
const*, llvm::MCTargetOptions const*, bool)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x5c0):
 undefined reference to 
`llvm::MCObjectFileInfo::InitMCObjectFileInfo(llvm::Triple const&, bool, 
llvm::MCContext&, bool)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x71c):
 undefined reference to 
`llvm::MCContext::addDebugPrefixMapEntry(std::__cxx11::basic_string, std::allocator > const&, 
std::__cxx11::basic_string, std::allocator > 
const&)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0xa1c):
 undefined reference to 
`llvm::MCAsmBackend::createDwoObjectWriter(llvm::raw_pwrite_stream&, 
llvm::raw_pwrite_stream&) const'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0xea0):
 undefined reference to `llvm::MCContext::setGenDwarfRootFile(llvm::StringRef, 
llvm::StringRef)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x11d8):
 undefined reference to `llvm::createAsmStreamer(llvm::MCContext&, 
std::unique_ptr >, bool, bool, 
llvm::MCInstPrinter*, std::unique_ptr >&&, 
std::unique_ptr 
>&&, bool)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x137c):
 undefined reference to `llvm::createMCAsmParser(llvm::SourceMgr&, 
llvm::MCContext&, llvm::MCStreamer&, llvm::MCAsmInfo const&, unsigned int)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1460):
 undefined reference to `llvm::MCContext::setSymbolValue(llvm::MCStreamer&, 
llvm::StringRef, unsigned long)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1500):
 undefined reference to `llvm::MCContext::setSymbolValue(llvm::MCStreamer&, 
llvm::StringRef, unsigned long)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x16dc):
 undefined reference to `llvm::MCContext::~MCContext()'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1be8):
 undefined reference to `llvm::createELFStreamer(llvm::MCContext&, 
std::unique_ptr 
>&&, std::unique_ptr >&&, 
std::unique_ptr 
>&&, bool)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1c08):
 undefined reference to `llvm::createXCOFFStreamer(llvm::MCContext&, 
std::unique_ptr 
>&&, std::unique_ptr >&&, 
std::unique_ptr 
>&&, bool)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1d20):
 undefined reference to `llvm::MCContext::getMachOSection(llvm::StringRef, 
llvm::StringRef, unsigned int, unsigned int, llvm::SectionKind, char const*)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1d54):
 undefined reference to `llvm::MCStreamer::emitZeros(unsigned long)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x1d68):
 undefined reference to 
`llvm::MCAsmParser::setTargetParser(llvm::MCTargetAsmParser&)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x2090):
 undefined reference to 
`llvm::MCAsmBackend::createObjectWriter(llvm::raw_pwrite_stream&) const'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x2128):
 undefined reference to `llvm::createNullStreamer(llvm::MCContext&)'
  
AssemblerInvocation.cpp:(.text._ZN5clang16ExecuteAssemblerERNS_19AssemblerInvocationERNS_17DiagnosticsEngineE+0x24e0):
 undefined reference to `llvm::createMachOStreamer(llvm::MCContext&, 
std::unique_ptr 
>&&, std::unique_ptr >&&, 
std::

[clang] 0057cc5 - Revert "[Clang] Move assembler into a separate file"

2021-01-23 Thread Ayke van Laethem via cfe-commits

Author: Ayke van Laethem
Date: 2021-01-23T15:04:27+01:00
New Revision: 0057cc5a215e5a26cfbd7e1707b55bf05fa9b6bf

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

LOG: Revert "[Clang] Move assembler into a separate file"

This reverts commit 2325157c0568ffd16f3318ad54f947e4e2109ef6.

Unfortunately this commit produces linker errors on some builds:
http://lab.llvm.org:8011/#/builders/57/builds/3704
http://lab.llvm.org:8011/#/builders/112/builds/3216
http://lab.llvm.org:8011/#/builders/121/builds/3900

Added: 


Modified: 
clang/lib/Frontend/CMakeLists.txt
clang/tools/driver/cc1as_main.cpp

Removed: 
clang/include/clang/Frontend/AssemblerInvocation.h
clang/lib/Frontend/AssemblerInvocation.cpp



diff  --git a/clang/include/clang/Frontend/AssemblerInvocation.h 
b/clang/include/clang/Frontend/AssemblerInvocation.h
deleted file mode 100644
index 8644f6c14228..
--- a/clang/include/clang/Frontend/AssemblerInvocation.h
+++ /dev/null
@@ -1,126 +0,0 @@
-//===- AssemblerInvocation.h - Assembler Invocation Helper Data -*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLVM_CLANG_FRONTEND_ASSEMBLERINVOCATION_H
-#define LLVM_CLANG_FRONTEND_ASSEMBLERINVOCATION_H
-
-#include "llvm/MC/MCTargetOptions.h"
-
-namespace clang {
-
-/// Helper class for representing a single invocation of the assembler.
-struct AssemblerInvocation {
-  /// @name Target Options
-  /// @{
-
-  /// The name of the target triple to assemble for.
-  std::string Triple;
-
-  /// If given, the name of the target CPU to determine which instructions
-  /// are legal.
-  std::string CPU;
-
-  /// The list of target specific features to enable or disable -- this should
-  /// be a list of strings starting with '+' or '-'.
-  std::vector Features;
-
-  /// The list of symbol definitions.
-  std::vector SymbolDefs;
-
-  /// @}
-  /// @name Language Options
-  /// @{
-
-  std::vector IncludePaths;
-  unsigned NoInitialTextSection : 1;
-  unsigned SaveTemporaryLabels : 1;
-  unsigned GenDwarfForAssembly : 1;
-  unsigned RelaxELFRelocations : 1;
-  unsigned DwarfVersion;
-  std::string DwarfDebugFlags;
-  std::string DwarfDebugProducer;
-  std::string DebugCompilationDir;
-  std::map DebugPrefixMap;
-  llvm::DebugCompressionType CompressDebugSections =
-  llvm::DebugCompressionType::None;
-  std::string MainFileName;
-  std::string SplitDwarfOutput;
-
-  /// @}
-  /// @name Frontend Options
-  /// @{
-
-  std::string InputFile;
-  std::vector LLVMArgs;
-  std::string OutputPath;
-  enum FileType {
-FT_Asm,  ///< Assembly (.s) output, transliterate mode.
-FT_Null, ///< No output, for timing purposes.
-FT_Obj   ///< Object file output.
-  };
-  FileType OutputType;
-  unsigned ShowHelp : 1;
-  unsigned ShowVersion : 1;
-
-  /// @}
-  /// @name Transliterate Options
-  /// @{
-
-  unsigned OutputAsmVariant;
-  unsigned ShowEncoding : 1;
-  unsigned ShowInst : 1;
-
-  /// @}
-  /// @name Assembler Options
-  /// @{
-
-  unsigned RelaxAll : 1;
-  unsigned NoExecStack : 1;
-  unsigned FatalWarnings : 1;
-  unsigned NoWarn : 1;
-  unsigned IncrementalLinkerCompatible : 1;
-  unsigned EmbedBitcode : 1;
-
-  /// The name of the relocation model to use.
-  std::string RelocationModel;
-
-  /// The ABI targeted by the backend. Specified using -target-abi. Empty
-  /// otherwise.
-  std::string TargetABI;
-
-  /// @}
-
-public:
-  AssemblerInvocation() {
-Triple = "";
-NoInitialTextSection = 0;
-InputFile = "-";
-OutputPath = "-";
-OutputType = FT_Asm;
-OutputAsmVariant = 0;
-ShowInst = 0;
-ShowEncoding = 0;
-RelaxAll = 0;
-NoExecStack = 0;
-FatalWarnings = 0;
-NoWarn = 0;
-IncrementalLinkerCompatible = 0;
-DwarfVersion = 0;
-EmbedBitcode = 0;
-  }
-
-  static bool CreateFromArgs(AssemblerInvocation &Res,
- ArrayRef Argv,
- DiagnosticsEngine &Diags);
-};
-
-bool ExecuteAssembler(AssemblerInvocation &Opts, DiagnosticsEngine &Diags);
-
-} // namespace clang
-
-#endif // LLVM_CLANG_FRONTEND_ASSEMBLERINVOCATION_H

diff  --git a/clang/lib/Frontend/AssemblerInvocation.cpp 
b/clang/lib/Frontend/AssemblerInvocation.cpp
deleted file mode 100644
index 7f6944c60379..
--- a/clang/lib/Frontend/AssemblerInvocation.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-//===- AssemblerInvocation.cpp 
-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https

[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Ayke via Phabricator via cfe-commits
aykevl added a comment.

@echristo do you have an idea what's going on or how to fix this? I suspect I'm 
not including a required dependency or maybe I've put `AssemblerInvocation` in 
the wrong directory/library.
I'm not very familiar with CMake or C++ so I'm not sure how to best fix this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63852

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


[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

@aykevl, please check http://lab.llvm.org:8011/#/builders/57/builds/3704: it 
seems you are missing a change to `clang/lib/Frontend/CMakeLists.txt` to update 
the `LLVM_LINK_COMPONENTS`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63852

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


[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

In D63852#2517500 , @aykevl wrote:

> or maybe I've put `AssemblerInvocation` in the wrong directory/library.

This seems to be a good design question. I think a lot of people consider 
`-cc1` functionality to be the "frontend". I am not sure that goes for `-cc1as` 
functionality. This might even be a new library in a sense (a 
libclangAssemblyFrontend).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63852

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


[PATCH] D63852: [Clang] Move assembler into a separate file

2021-01-23 Thread Ayke via Phabricator via cfe-commits
aykevl added a comment.

Yeah I was wondering the same thing when I saw the failure. Unfortunately such 
design is a bit outside of my LLVM knowledge. I would just like to use 
cc1as_main.cpp functionality outside of LLVM without needing to update my copy 
of cc1as with every LLVM update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63852

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


[PATCH] D95271: [CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker.

2021-01-23 Thread Wenlei He via Phabricator via cfe-commits
wenlei added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:609
+  // Pass an option to enable pseudo probe emission.
+  if (Args.hasArg(options::OPT_fpseudo_probe_for_profiling))
+CmdArgs.push_back("-plugin-opt=pseudo-probe-for-profiling");

`getLastArg(options::OPT_fpseudo_probe_for_profiling, 
options::OPT_fno_pseudo_probe_for_profiling` instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95271

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


[PATCH] D93579: [clang][AVR] Improve avr-ld command line options

2021-01-23 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/Driver/ToolChains/AVR.cpp:37
 } MCUInfo[] = {
 {"at90s1200", "", "avr1"},
 {"attiny11", "", "avr1"},

This may cause -Wmissing-field-initializers, please fix



Comment at: clang/test/Driver/avr-ld.c:2
+// RUN: %clang -### --target=avr -mmcu=at90s2313 %s 2>&1 | FileCheck 
-check-prefix LINKA %s
+// LINKA: {{".*ld.*"}} {{.*}} {{"-L.*tiny-stack"}} {{.*}} "-Tdata=0x800060" 
{{.*}} "-lat90s2313" "-mavr2"
+

You need `--sysroot` and a mock `ld` file in the tree.

See lto.c


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93579

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


[PATCH] D95161: [Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with `libomptarget-nvptx-bc-path`

2021-01-23 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 318772.
tianshilei1992 added a comment.

Fixed test case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95161

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/test/Driver/Inputs/libomptarget/libomptarget-nvptx-test.bc
  clang/test/Driver/openmp-offload-gpu.c

Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -34,22 +34,6 @@
 
 /// ###
 
-/// Check that -lomptarget-nvptx is passed to nvlink.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp \
-// RUN:  -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-NVLINK %s
-/// Check that the value of --libomptarget-nvptx-path is forwarded to nvlink.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp \
-// RUN:  --libomptarget-nvptx-path=/path/to/libomptarget/ \
-// RUN:  -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-NVLINK,CHK-LIBOMPTARGET-NVPTX-PATH %s
-
-// CHK-NVLINK: nvlink
-// CHK-LIBOMPTARGET-NVPTX-PATH-SAME: "-L/path/to/libomptarget/"
-// CHK-NVLINK-SAME: "-lomptarget-nvptx"
-
-/// ###
-
 /// Check cubin file generation and usage by nvlink
 // RUN:   %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \
 // RUN:  -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s 2>&1 \
@@ -173,13 +157,15 @@
 // RUN:   -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB %s
-/// The user can override default detection using --libomptarget-nvptx-path=.
-// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --libomptarget-nvptx-path=%S/Inputs/libomptarget \
+/// The user can override default detection using --libomptarget-nvptx-bc-path=.
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc \
 // RUN:   -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB %s
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_20.bc
+// CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
@@ -191,7 +177,18 @@
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
 
-// CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices.
+// CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Please use --libomptarget-nvptx-bc-path to specify nvptx bitcode library.
+
+/// ###
+
+/// Check that the error is thrown when the libomptarget bitcode library does not exist.
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
+// RUN:   --libomptarget-nvptx-bc-path=not-exist.bc \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-ERROR %s
+
+// CHK-BCLIB-ERROR: Bitcode library 'not-exist.bc' does not exist.
 
 /// Check that debug info is emitted in dwarf-2
 // RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \
Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -600,11 +600,6 @@
   CmdArgs.push_back("-arch");
   CmdArgs.push_back(Args.MakeArgString(GPUArch));
 
-  // Assume that the directory specified with --libomptarget_nvptx_path
-  // c

[PATCH] D95161: [Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with `libomptarget-nvptx-bc-path`

2021-01-23 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Still LGTM. A little surprised these are being run on windows, but good to be 
robust.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95161

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


[PATCH] D95161: [Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with `libomptarget-nvptx-bc-path`

2021-01-23 Thread Shilei Tian via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ad038aafa3a: [Clang][OpenMP][NVPTX] Replace 
`libomptarget-nvptx-path` with `libomptarget… (authored by tianshilei1992).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95161

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Cuda.cpp
  clang/test/Driver/Inputs/libomptarget/libomptarget-nvptx-test.bc
  clang/test/Driver/openmp-offload-gpu.c

Index: clang/test/Driver/openmp-offload-gpu.c
===
--- clang/test/Driver/openmp-offload-gpu.c
+++ clang/test/Driver/openmp-offload-gpu.c
@@ -34,22 +34,6 @@
 
 /// ###
 
-/// Check that -lomptarget-nvptx is passed to nvlink.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp \
-// RUN:  -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-NVLINK %s
-/// Check that the value of --libomptarget-nvptx-path is forwarded to nvlink.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp \
-// RUN:  --libomptarget-nvptx-path=/path/to/libomptarget/ \
-// RUN:  -fopenmp-targets=nvptx64-nvidia-cuda %s 2>&1 \
-// RUN:   | FileCheck -check-prefixes=CHK-NVLINK,CHK-LIBOMPTARGET-NVPTX-PATH %s
-
-// CHK-NVLINK: nvlink
-// CHK-LIBOMPTARGET-NVPTX-PATH-SAME: "-L/path/to/libomptarget/"
-// CHK-NVLINK-SAME: "-lomptarget-nvptx"
-
-/// ###
-
 /// Check cubin file generation and usage by nvlink
 // RUN:   %clang -### -no-canonical-prefixes -target powerpc64le-unknown-linux-gnu -fopenmp=libomp \
 // RUN:  -fopenmp-targets=nvptx64-nvidia-cuda -save-temps %s 2>&1 \
@@ -173,13 +157,15 @@
 // RUN:   -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB %s
-/// The user can override default detection using --libomptarget-nvptx-path=.
-// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --libomptarget-nvptx-path=%S/Inputs/libomptarget \
+/// The user can override default detection using --libomptarget-nvptx-bc-path=.
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc \
 // RUN:   -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHK-BCLIB %s
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-USER %s
 
 // CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_20.bc
+// CHK-BCLIB-USER: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###
@@ -191,7 +177,18 @@
 // RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BCLIB-WARN %s
 
-// CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices.
+// CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Please use --libomptarget-nvptx-bc-path to specify nvptx bitcode library.
+
+/// ###
+
+/// Check that the error is thrown when the libomptarget bitcode library does not exist.
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN:   -Xopenmp-target -march=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
+// RUN:   --libomptarget-nvptx-bc-path=not-exist.bc \
+// RUN:   -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-BCLIB-ERROR %s
+
+// CHK-BCLIB-ERROR: Bitcode library 'not-exist.bc' does not exist.
 
 /// Check that debug info is emitted in dwarf-2
 // RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \
Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -600,11 +600,6 @@
   CmdArgs.push_back("-arch");
   CmdArgs.push_back(

[clang] 5ad038a - [Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with `libomptarget-nvptx-bc-path`

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

Author: Shilei Tian
Date: 2021-01-23T14:42:38-05:00
New Revision: 5ad038aafa3a07a4491bf12cf6edf2026f3f17d1

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

LOG: [Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with 
`libomptarget-nvptx-bc-path`

D94700 removed the static library so we no longer need to pass
`-llibomptarget-nvptx` to `nvlink`. Since the bitcode library is the only device
runtime for now, instead of emitting a warning when it is not found, an error
should be raised. We also set a new option `libomptarget-nvptx-bc-path` to let
user choose which bitcode library is being used.

Reviewed By: JonChesterfield

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

Added: 
clang/test/Driver/Inputs/libomptarget/libomptarget-nvptx-test.bc

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Cuda.cpp
clang/test/Driver/openmp-offload-gpu.c

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index d8ad75ce..fc42bcfe3759 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1143,9 +1143,9 @@ Set directory to include search path with prefix
 
 Add directory to SYSTEM include search path, absolute paths are relative to 
-isysroot
 
-.. option:: --libomptarget-nvptx-path=
+.. option:: --libomptarget-nvptx-bc-path=
 
-Path to libomptarget-nvptx libraries
+Path to libomptarget-nvptx bitcode library
 
 .. option:: --ptxas-path=
 

diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index e92a4bf1dac5..d4ad278da6b7 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -263,12 +263,12 @@ def err_drv_omp_host_target_not_supported : Error<
   "The target '%0' is not a supported OpenMP host target.">;
 def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
   "The option -fopenmp-targets must be used in conjunction with a -fopenmp 
option compatible with offloading, please use -fopenmp=libomp or 
-fopenmp=libiomp5.">;
+def err_drv_omp_offload_target_missingbcruntime : Error<
+  "No library '%0' found in the default clang lib directory or in 
LIBRARY_PATH. Please use --libomptarget-nvptx-bc-path to specify nvptx bitcode 
library.">;
+def err_drv_omp_offload_target_bcruntime_not_found : Error<"Bitcode library 
'%0' does not exist.">;
 def warn_drv_omp_offload_target_duplicate : Warning<
   "The OpenMP offloading target '%0' is similar to target '%1' already 
specified - will be ignored.">,
   InGroup;
-def warn_drv_omp_offload_target_missingbcruntime : Warning<
-  "No library '%0' found in the default clang lib directory or in 
LIBRARY_PATH. Expect degraded performance due to no inlining of runtime 
functions on target devices.">,
-  InGroup;
 def err_drv_unsupported_embed_bitcode
 : Error<"%0 is not supported with -fembed-bitcode">;
 def err_drv_bitcode_unsupported_on_toolchain : Error<

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 3bb545f84132..7685d343ab96 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -992,8 +992,8 @@ def gpu_max_threads_per_block_EQ : Joined<["--"], 
"gpu-max-threads-per-block=">,
 def gpu_instrument_lib_EQ : Joined<["--"], "gpu-instrument-lib=">,
   HelpText<"Instrument device library for HIP, which is a LLVM bitcode 
containing "
   "__cyg_profile_func_enter and __cyg_profile_func_exit">;
-def libomptarget_nvptx_path_EQ : Joined<["--"], "libomptarget-nvptx-path=">, 
Group,
-  HelpText<"Path to libomptarget-nvptx libraries">;
+def libomptarget_nvptx_bc_path_EQ : Joined<["--"], 
"libomptarget-nvptx-bc-path=">, Group,
+  HelpText<"Path to libomptarget-nvptx bitcode library">;
 def dD : Flag<["-"], "dD">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
 def dI : Flag<["-"], "dI">, Group, Flags<[CC1Option]>,

diff  --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index 95fd5a1fbfee..4c549bf91dea 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -600,11 +600,6 @@ void NVPTX::OpenMPLinker::ConstructJob(Compilation &C, 
const JobAction &JA,
   CmdArgs.push_back("-arch");
   CmdArgs.push_back(Args.MakeArgString(GPUArch));
 
-  // Assume that the directory specified with --libomptarget_nvptx_path
-  // contains the static library libomptarget-nvptx.a.
-  if (const Arg *A = Args.getLastArg(options::OPT_libomptarget_nvptx_path_EQ))
-

[PATCH] D95161: [Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with `libomptarget-nvptx-bc-path`

2021-01-23 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added a comment.

In D95161#2517662 , @JonChesterfield 
wrote:

> Still LGTM. A little surprised these are being run on windows, but good to be 
> robust.

It's driver test which only invokes `-###`. ;-) No actual execution.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95161

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


[PATCH] D93040: [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.

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

http://llvm-compile-time-tracker.com/compare.php?from=344afa853fcfcc085cb5c957b4a07c7ea013bb1b&to=2b9a834c43cb1f93d33958c14b695896bb4e9c1e&stat=size-text

Codesize regression 1% for tramp3d. Can you check it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93040

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


[PATCH] D93040: [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.

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

In D93040#2517758 , @xbolva00 wrote:

> http://llvm-compile-time-tracker.com/compare.php?from=344afa853fcfcc085cb5c957b4a07c7ea013bb1b&to=2b9a834c43cb1f93d33958c14b695896bb4e9c1e&stat=size-text
>
> Codesize regression 1% for tramp3d. Can you check it?

I assume this to be a secondary effect of having the instructions in the first 
place. Maybe some unroll or inline size threshold needs to be thought about 
them. At the end of the day, we might not be able to avoid something like this 
as we make `!noalias` correct, though, I imagine the threshold theory which can 
be resolved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93040

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


[PATCH] D94745: [OpenMP][WIP] Build the deviceRTLs with OpenMP instead of target dependent language - NOT FOR REVIEW

2021-01-23 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 318788.
tianshilei1992 added a comment.

Code cleanup


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94745

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp
  openmp/libomptarget/deviceRTLs/common/allocator.h
  openmp/libomptarget/deviceRTLs/common/omptarget.h
  openmp/libomptarget/deviceRTLs/common/src/libcall.cu
  openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
  openmp/libomptarget/deviceRTLs/common/src/reduction.cu
  openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
  openmp/libomptarget/deviceRTLs/nvptx/src/nvptx_interface.h
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h

Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
===
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -13,18 +13,16 @@
 #define _TARGET_IMPL_H_
 
 #include 
-#include 
 #include 
 #include 
 #include 
 
 #include "nvptx_interface.h"
 
-#define DEVICE __device__
-#define INLINE __forceinline__ DEVICE
-#define NOINLINE __noinline__ DEVICE
-#define SHARED __shared__
-#define ALIGN(N) __align__(N)
+#define DEVICE
+#define INLINE inline __attribute__((always_inline))
+#define NOINLINE __attribute__((noinline))
+#define ALIGN(N) __attribute__((aligned(N)))
 
 
 // Kernel options
Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
===
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
@@ -14,25 +14,6 @@
 #include "target_impl.h"
 #include "common/debug.h"
 
-#include 
-
-// Forward declaration of CUDA primitives which will be evetually transformed
-// into LLVM intrinsics.
-extern "C" {
-unsigned int __activemask();
-unsigned int __ballot(unsigned);
-// The default argument here is based on NVIDIA's website
-// https://developer.nvidia.com/blog/using-cuda-warp-level-primitives/
-int __shfl_sync(unsigned mask, int val, int src_line, int width = WARPSIZE);
-int __shfl(int val, int src_line, int width = WARPSIZE);
-int __shfl_down(int var, unsigned detla, int width);
-int __shfl_down_sync(unsigned mask, int var, unsigned detla, int width);
-void __syncwarp(int mask);
-void __threadfence();
-void __threadfence_block();
-void __threadfence_system();
-}
-
 DEVICE void __kmpc_impl_unpack(uint64_t val, uint32_t &lo, uint32_t &hi) {
   asm volatile("mov.b64 {%0,%1}, %2;" : "=r"(lo), "=r"(hi) : "l"(val));
 }
@@ -74,10 +55,12 @@
 
 // In Cuda 9.0, __ballot(1) from Cuda 8.0 is replaced with __activemask().
 DEVICE __kmpc_impl_lanemask_t __kmpc_impl_activemask() {
-#if CUDA_VERSION >= 9000
-  return __activemask();
+#if CUDA_VERSION < 9020
+  return __nvvm_vote_ballot(1);
 #else
-  return __ballot(1);
+  unsigned int mask;
+  asm volatile("activemask.b32 %0;" : "=r"(mask));
+  return mask;
 #endif
 }
 
@@ -85,9 +68,9 @@
 DEVICE int32_t __kmpc_impl_shfl_sync(__kmpc_impl_lanemask_t Mask, int32_t Var,
  int32_t SrcLane) {
 #if CUDA_VERSION >= 9000
-  return __shfl_sync(Mask, Var, SrcLane);
+  return __nvvm_shfl_sync_idx_i32(Mask, Var, SrcLane, 0x1f);
 #else
-  return __shfl(Var, SrcLane);
+  return __nvvm_shfl_idx_i32(Var, SrcLane, 0x1f);
 #endif // CUDA_VERSION
 }
 
@@ -95,9 +78,10 @@
   int32_t Var, uint32_t Delta,
   int32_t Width) {
 #if CUDA_VERSION >= 9000
-  return __shfl_down_sync(Mask, Var, Delta, Width);
+  return __nvvm_shfl_sync_down_i32(Mask, Var, Delta,
+   ((WARPSIZE - Width) << 8) | 0x1f);
 #else
-  return __shfl_down(Var, Delta, Width);
+  return __nvvm_shfl_down_i32(Var, Delta, ((WARPSIZE - Width) << 8) | 0x1f);
 #endif // CUDA_VERSION
 }
 
@@ -105,7 +89,7 @@
 
 DEVICE void __kmpc_impl_syncwarp(__kmpc_impl_lanemask_t Mask) {
 #if CUDA_VERSION >= 9000
-  __syncwarp(Mask);
+  __nvvm_bar_warp_sync(Mask);
 #else
   // In Cuda < 9.0 no need to sync threads in warps.
 #endif // CUDA_VERSION
@@ -126,9 +110,9 @@
: "memory");
 }
 
-DEVICE void __kmpc_impl_threadfence() { __threadfence(); }
-DEVICE void __kmpc_impl_threadfence_block() { __threadfence_block(); }
-DEVICE void __kmpc_impl_threadfence_system() { __threadfence_system(); }
+DEVICE void __kmpc_impl_threadfence() { __nvvm_membar_gl(); }
+DEVICE void __kmpc_impl_threadfence_block() { __nvvm_membar_cta(); }
+DEVICE void __kmpc_impl_threadfence_system() { __nvvm_membar_sys(); }
 
 // Calls to the NVPTX layer (assuming 1D layout)
 DEVICE int GetThreadIdInBlock() { return __nvvm_read_ptx_sreg_tid_x(); }
Index: openmp/libomptarget/deviceRTLs/nvptx/src/nvptx_interface.h

[PATCH] D93040: [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.

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

In D93040#2517769 , @jdoerfert wrote:

> In D93040#2517758 , @xbolva00 wrote:
>
>> http://llvm-compile-time-tracker.com/compare.php?from=344afa853fcfcc085cb5c957b4a07c7ea013bb1b&to=2b9a834c43cb1f93d33958c14b695896bb4e9c1e&stat=size-text
>>
>> Codesize regression 1% for tramp3d. Can you check it?
>
> I assume this to be a secondary effect of having the instructions in the 
> first place. Maybe some unroll or inline size threshold needs to be thought 
> about them. At the end of the day, we might not be able to avoid something 
> like this as we make `!noalias` correct, though, I imagine the threshold 
> theory which can be resolved.

The loop unrolling/rotating and the cleanup patches are not yet committed. You 
can see the effect of those here:

http://llvm-compile-time-tracker.com/compare.php?from=344afa853fcfcc085cb5c957b4a07c7ea013bb1b&to=eaf871f4e7fde26cd755cc4c2d67f2c244c66f18&stat=size-text

Also see D95141  for links to more results.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93040

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


[PATCH] D95299: Fix truncated __OPENMP_NVPTX__ preprocessor condition

2021-01-23 Thread Ryan Burns via Phabricator via cfe-commits
r-burns created this revision.
Herald added subscribers: guansong, yaxunl.
r-burns requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

I don't have a test case for this but noticed this warning when including 
system headers with `-I` rather than `-isystem`.

  In file included from :1:
  In file included from 
/nix/store/jq6bpm0xmhnbffhs5rkxq4n88g5xi2zg-clang-wrapper-11.0.1/resource-root/include/__clang_cuda_runtime_wrapper.h:157:
  
/nix/store/jq6bpm0xmhnbffhs5rkxq4n88g5xi2zg-clang-wrapper-11.0.1/resource-root/include/__clang_cuda_math.h:39:25:
 warning: extra tokens at end of #ifdef directive [-Wextra-tokens]
  #ifdef __OPENMP_NVPTX__ && defined(__cplusplus) && __cplusplus < 201402L
  ^


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95299

Files:
  clang/lib/Headers/__clang_cuda_math.h


Index: clang/lib/Headers/__clang_cuda_math.h
===
--- clang/lib/Headers/__clang_cuda_math.h
+++ clang/lib/Headers/__clang_cuda_math.h
@@ -36,7 +36,7 @@
 // because the OpenMP overlay requires constexpr functions here but prior to
 // c++14 void return functions could not be constexpr.
 #pragma push_macro("__DEVICE_VOID__")
-#ifdef __OPENMP_NVPTX__ && defined(__cplusplus) && __cplusplus < 201402L
+#if defined(__OPENMP_NVPTX__) && defined(__cplusplus) && __cplusplus < 201402L
 #define __DEVICE_VOID__ static __attribute__((always_inline, nothrow))
 #else
 #define __DEVICE_VOID__ __DEVICE__


Index: clang/lib/Headers/__clang_cuda_math.h
===
--- clang/lib/Headers/__clang_cuda_math.h
+++ clang/lib/Headers/__clang_cuda_math.h
@@ -36,7 +36,7 @@
 // because the OpenMP overlay requires constexpr functions here but prior to
 // c++14 void return functions could not be constexpr.
 #pragma push_macro("__DEVICE_VOID__")
-#ifdef __OPENMP_NVPTX__ && defined(__cplusplus) && __cplusplus < 201402L
+#if defined(__OPENMP_NVPTX__) && defined(__cplusplus) && __cplusplus < 201402L
 #define __DEVICE_VOID__ static __attribute__((always_inline, nothrow))
 #else
 #define __DEVICE_VOID__ __DEVICE__
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits