[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 341418.
ychen added a comment.

- Handle deallocation.
- Fix tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97915

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCoroutine.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCoroutines/coro-alloc.cpp
  clang/test/CodeGenCoroutines/coro-cleanup.cpp
  clang/test/CodeGenCoroutines/coro-gro.cpp
  llvm/docs/Coroutines.rst
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/Coroutines/CoroInstr.h
  llvm/lib/Transforms/Coroutines/CoroInternal.h
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/lib/Transforms/Coroutines/Coroutines.cpp
  llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
  llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll

Index: llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
===
--- llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
+++ llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
@@ -62,7 +62,7 @@
   call i1 @llvm.coro.end(i8* null, i1 false)
   ret void
 }
-; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", i1, [14 x i8], %struct.big_structure }
+; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", i1, i8*, %struct.big_structure }
 ; CHECK-LABEL: @a.resume(
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 3
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 5
Index: llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
===
--- llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
+++ llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
@@ -62,10 +62,10 @@
   call i1 @llvm.coro.end(i8* null, i1 false)
   ret void
 }
-; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1, [26 x i8], %struct.big_structure.2 }
+; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1, i8*, [16 x i8], %struct.big_structure.2 }
 ; CHECK-LABEL: @a.resume(
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 3
-; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 6
+; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 7
 
 declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
 declare i1 @llvm.coro.alloc(token) #3
Index: llvm/lib/Transforms/Coroutines/Coroutines.cpp
===
--- llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -234,6 +234,7 @@
   Shape.CoroBegin = nullptr;
   Shape.CoroEnds.clear();
   Shape.CoroSizes.clear();
+  Shape.CoroAligns.clear();
   Shape.CoroSuspends.clear();
 
   Shape.FrameTy = nullptr;
@@ -268,6 +269,12 @@
   case Intrinsic::coro_size:
 CoroSizes.push_back(cast(II));
 break;
+  case Intrinsic::coro_align:
+CoroAligns.push_back(cast(II));
+break;
+  case Intrinsic::coro_raw_frame_ptr_offset:
+CoroRawFramePtrOffsets.push_back(cast(II));
+break;
   case Intrinsic::coro_frame:
 CoroFrames.push_back(cast(II));
 break;
@@ -375,6 +382,7 @@
 this->SwitchLowering.ResumeSwitch = nullptr;
 this->SwitchLowering.PromiseAlloca = SwitchId->getPromise();
 this->SwitchLowering.ResumeEntryBlock = nullptr;
+this->SwitchLowering.FramePtrOffset = 0;
 
 for (auto AnySuspend : CoroSuspends) {
   auto Suspend = dyn_cast(AnySuspend);
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -997,23 +997,44 @@
   Shape.AsyncLowering.AsyncFuncPointer->setInitializer(NewFuncPtrStruct);
 }
 
-static void replaceFrameSize(coro::Shape &Shape) {
+static void replaceFrameSizeAndAlign(coro::Shape &Shape) {
   if (Shape.ABI == coro::ABI::Async)
 updateAsyncFuncPointerContextSize(Shape);
 
-  if (Shape.CoroSizes.empty())
-return;
+  if (!Shape.CoroSizes.empty()) {
+// In the same function all coro.sizes should have the same result type.
+auto *SizeIntrin = Shape.CoroSizes.back();
+Module *M = SizeIntrin->getModule();
+const DataLayout &DL = M->getDataLayout();
+auto Size = DL.getTypeAllocSize(Shape.FrameTy);
+auto *SizeConstant = ConstantInt::get(SizeIntrin->getType(), Size);
+
+fo

[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

@rjmccall  the patch is on the large side. I'll submit a separate patch for the 
Sema part about searching for two allocators.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97915

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


[PATCH] D100739: [Coroutines] Handle overaligned frame allocation (2)

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen abandoned this revision.
ychen added a comment.

Reopened D97915  to address the feedbacks. 
Close this one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100739

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


[clang] 6a0283d - [NewPM] Add an option to dump pass structure

2021-04-29 Thread Evgeny Leviant via cfe-commits

Author: Evgeny Leviant
Date: 2021-04-29T10:29:42+03:00
New Revision: 6a0283d0d23cc8b056005caa31097dfb78853548

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

LOG: [NewPM] Add an option to dump pass structure

Patch adds -debug-pass-structure option to dump pass structure when
new pass manager is used.

Differential revision: https://reviews.llvm.org/D99599

Added: 
clang/test/Driver/debug-pass-structure.c

Modified: 
clang/lib/CodeGen/BackendUtil.cpp
llvm/include/llvm/Passes/StandardInstrumentations.h
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/test/Other/opt-O3-pipeline.ll

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 6df2d291384c..8dd510e745ed 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -866,6 +866,10 @@ static void setCommandLineOpts(const CodeGenOptions 
&CodeGenOpts) {
   if (!CodeGenOpts.DebugPass.empty()) {
 BackendArgs.push_back("-debug-pass");
 BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
+// New PM supports structure dumping. Old PM is still used for codegen,
+// so we need to pass both options.
+if (!CodeGenOpts.LegacyPassManager && CodeGenOpts.DebugPass == "Structure")
+  BackendArgs.push_back("-debug-pass-structure");
   }
   if (!CodeGenOpts.LimitFloatPrecision.empty()) {
 BackendArgs.push_back("-limit-float-precision");

diff  --git a/clang/test/Driver/debug-pass-structure.c 
b/clang/test/Driver/debug-pass-structure.c
new file mode 100644
index ..7e1d748ad847
--- /dev/null
+++ b/clang/test/Driver/debug-pass-structure.c
@@ -0,0 +1,62 @@
+// Test that we print pass structure with new and legacy PM.
+// RUN: %clang -fexperimental-new-pass-manager -fdebug-pass-structure -O3 -S 
-emit-llvm %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=NEWPM
+// RUN: %clang -flegacy-pass-manager -fdebug-pass-structure -O0 -S -emit-llvm 
%s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LEGACYPM
+
+// NEWPM: Annotation2MetadataPass on [module]
+// NEWPM-NEXT: ForceFunctionAttrsPass on [module]
+// NEWPM-NEXT: InferFunctionAttrsPass on [module]
+// NEWPM-NEXT:   InnerAnalysisManagerProxy<{{.*}}> analysis on [module]
+// NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+// NEWPM-NEXT: OpenMPOptPass on [module]
+// NEWPM-NEXT: IPSCCPPass on [module]
+// NEWPM-NEXT: CalledValuePropagationPass on [module]
+// NEWPM-NEXT: GlobalOptPass on [module]
+// NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+// NEWPM-NEXT: DeadArgumentEliminationPass on [module]
+// NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+// NEWPM-NEXT: ModuleInlinerWrapperPass on [module]
+// NEWPM-NEXT:   InlineAdvisorAnalysis analysis on [module]
+// NEWPM-NEXT:   RequireAnalysisPass<{{.*}}> on [module]
+// NEWPM-NEXT: GlobalsAA analysis on [module]
+// NEWPM-NEXT:   CallGraphAnalysis analysis on [module]
+// NEWPM-NEXT:   RequireAnalysisPass<{{.*}}> on [module]
+// NEWPM-NEXT: ProfileSummaryAnalysis analysis on [module]
+// NEWPM-NEXT:   ModuleToPostOrderCGSCCPassAdaptor on [module]
+// NEWPM-NEXT: InnerAnalysisManagerProxy<{{.*}}> analysis on [module]
+// NEWPM-NEXT:   LazyCallGraphAnalysis analysis on [module]
+// NEWPM-NEXT: GlobalOptPass on [module]
+// NEWPM-NEXT: GlobalDCEPass on [module]
+// NEWPM-NEXT: EliminateAvailableExternallyPass on [module]
+// NEWPM-NEXT: ReversePostOrderFunctionAttrsPass on [module]
+// NEWPM-NEXT: RequireAnalysisPass<{{.*}}> on [module]
+// NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+// NEWPM-NEXT: CGProfilePass on [module]
+// NEWPM-NEXT: GlobalDCEPass on [module]
+// NEWPM-NEXT: ConstantMergePass on [module]
+// NEWPM-NEXT: RelLookupTableConverterPass on [module]
+// NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+// NEWPM-NEXT: PrintModulePass on [module]
+
+// LEGACYPM:  Pass Arguments:  -tti -targetlibinfo -verify
+// LEGACYPM-NEXT: Target Transform Information
+// LEGACYPM-NEXT: Target Library Information
+// LEGACYPM-NEXT:   FunctionPass Manager
+// LEGACYPM-NEXT: Module Verifier
+// LEGACYPM-NEXT: Pass Arguments:  -tti -targetlibinfo 
-assumption-cache-tracker -profile-summary-info -annotation2metadata 
-forceattrs -basiccg -always-inline -annotation-remarks
+// LEGACYPM-NEXT: Target Transform Information
+// LEGACYPM-NEXT: Target Library Information
+// LEGACYPM-NEXT: Assumption Cache Tracker
+// LEGACYPM-NEXT: Profile summary info
+// LEGACYPM-NEXT:   ModulePass Manager
+// LEGACYPM-NEXT: Annotation2Metadata
+// LEGACYPM-NEXT: Force set function attributes
+// LEGACYPM-NEXT: CallGraph Construction
+// LEGACYPM-NEXT: Call Graph SCC Pass Manager
+// LEGACYPM-NEXT:   Inliner for always_inline functions
+// LEGACYPM-NEXT:   Funct

[PATCH] D99599: [NewPM] Add an option to dump pass structure

2021-04-29 Thread Eugene Leviant 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 rG6a0283d0d23c: [NewPM] Add an option to dump pass structure 
(authored by evgeny777).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99599

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/Driver/debug-pass-structure.c
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Other/opt-O3-pipeline.ll

Index: llvm/test/Other/opt-O3-pipeline.ll
===
--- llvm/test/Other/opt-O3-pipeline.ll
+++ llvm/test/Other/opt-O3-pipeline.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -enable-new-pm=0 -mtriple=x86_64-- -O3 -debug-pass=Structure < %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK,%llvmcheckext %s
+; RUN: opt -enable-new-pm=1 -mtriple=x86_64-- -O3 -debug-pass-structure < %s -o /dev/null 2>&1 | FileCheck --check-prefixes=NEWPM,%llvmcheckext %s
 
 ; REQUIRES: asserts
 
@@ -335,6 +336,178 @@
 ; CHECK-NEXT: Branch Probability Analysis
 ; CHECK-NEXT: Block Frequency Analysis
 
+; NEWPM:  VerifierPass on [module]
+; NEWPM-NEXT:   VerifierAnalysis analysis on [module]
+; NEWPM-NEXT: Annotation2MetadataPass on [module]
+; NEWPM-NEXT: ForceFunctionAttrsPass on [module]
+; NEWPM-NEXT: InferFunctionAttrsPass on [module]
+; NEWPM-NEXT:   InnerAnalysisManagerProxy<{{.*}}> analysis on [module]
+; NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+; NEWPM-NEXT:   PassManager<{{.*}}> on f
+; NEWPM-NEXT: PreservedCFGCheckerAnalysis analysis on f
+; NEWPM-NEXT: LowerExpectIntrinsicPass on f
+; NEWPM-NEXT: SimplifyCFGPass on f
+; NEWPM-NEXT:   TargetIRAnalysis analysis on f
+; NEWPM-NEXT:   AssumptionAnalysis analysis on f
+; NEWPM-NEXT: SROA on f
+; NEWPM-NEXT:   DominatorTreeAnalysis analysis on f
+; NEWPM-NEXT: EarlyCSEPass on f
+; NEWPM-NEXT:   TargetLibraryAnalysis analysis on f
+; NEWPM-NEXT: CallSiteSplittingPass on f
+; NEWPM-NEXT: OpenMPOptPass on [module]
+; NEWPM-NEXT: IPSCCPPass on [module]
+; NEWPM-NEXT: CalledValuePropagationPass on [module]
+; NEWPM-NEXT: GlobalOptPass on [module]
+; NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+; NEWPM-NEXT:   InnerAnalysisManagerProxy<{{.*}}> analysis on [module]
+; NEWPM-NEXT:   PromotePass on f
+; NEWPM-NEXT: PreservedCFGCheckerAnalysis analysis on f
+; NEWPM-NEXT: DominatorTreeAnalysis analysis on f
+; NEWPM-NEXT: AssumptionAnalysis analysis on f
+; NEWPM-NEXT: DeadArgumentEliminationPass on [module]
+; NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module]
+; NEWPM-NEXT:   PassManager<{{.*}}> on f
+; NEWPM-NEXT: InstCombinePass on f
+; NEWPM-NEXT:   TargetLibraryAnalysis analysis on f
+; NEWPM-NEXT:   OptimizationRemarkEmitterAnalysis analysis on f
+; NEWPM-NEXT:   TargetIRAnalysis analysis on f
+; NEWPM-NEXT:   AAManager analysis on f
+; NEWPM-NEXT: BasicAA analysis on f
+; NEWPM-NEXT:   OuterAnalysisManagerProxy<{{.*}}> analysis on f
+; NEWPM-NEXT: SimplifyCFGPass on f
+; NEWPM-NEXT: ModuleInlinerWrapperPass on [module]
+; NEWPM-NEXT:   InlineAdvisorAnalysis analysis on [module]
+; NEWPM-NEXT:   RequireAnalysisPass<{{.*}}> on [module]
+; NEWPM-NEXT: GlobalsAA analysis on [module]
+; NEWPM-NEXT:   CallGraphAnalysis analysis on [module]
+; NEWPM-NEXT:   RequireAnalysisPass<{{.*}}> on [module]
+; NEWPM-NEXT: ProfileSummaryAnalysis analysis on [module]
+; NEWPM-NEXT:   ModuleToPostOrderCGSCCPassAdaptor on [module]
+; NEWPM-NEXT: InnerAnalysisManagerProxy<{{.*}}> analysis on [module]
+; NEWPM-NEXT:   LazyCallGraphAnalysis analysis on [module]
+; NEWPM-NEXT: FunctionAnalysisManagerCGSCCProxy analysis on (f)
+; NEWPM-NEXT:   OuterAnalysisManagerProxy<{{.*}}> analysis on (f)
+; NEWPM-NEXT: DevirtSCCRepeatedPass on (f)
+; NEWPM-NEXT:   PassManager<{{.*}}> on (f)
+; NEWPM-NEXT: InlinerPass on (f)
+; NEWPM-NEXT: InlinerPass on (f)
+; NEWPM-NEXT: PostOrderFunctionAttrsPass on (f)
+; NEWPM-NEXT: ArgumentPromotionPass on (f)
+; NEWPM-NEXT: OpenMPOptCGSCCPass on (f)
+; NEWPM-NEXT: CGSCCToFunctionPassAdaptor on (f)
+; NEWPM-NEXT:   PassManager<{{.*}}> on f
+; NEWPM-NEXT: PreservedCFGCheckerAnalysis analysis on f
+; NEWPM-NEXT: SROA on f
+; NEWPM-NEXT:   DominatorTreeAnalysis analysis on f
+; NEWPM-NEXT: EarlyCSEPass on f
+; NEWPM-NEXT:   MemorySSAAnalysis analysis on f
+; NEWPM-NEXT: AAManager analysis on f
+; NEWPM-NEXT:   BasicAA analysis on f
+; NEWPM-NEXT: SpeculativeExecutionPass on f
+; NEWPM-NEXT: JumpThreadingPass on f
+; NEWPM-NEXT:   LazyValueAnal

[PATCH] D100667: [clang] Fix assert() crash when checking undeduced arg alignment

2021-04-29 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.

still LG




Comment at: clang/test/SemaCXX/recovery-expr-type.cpp:29
   // verify that "field has incomplete type" diagnostic is suppressed.
-  typeof(foo(42)) var; // expected-error {{no matching function}}
+  typeof(foo(42)) var; // expected-error {{no matching function}} \
+   // expected-error {{use of undeclared identifier 
'typeof'}} \

oh, `typeof` is a GNU extension, I think `-std=gnu++17` should suppress the new 
diagnostics. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100667

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


[clang] 6e5082b - [clang-format] Fix build on gcc < 7 introduced in rG9363aa9.

2021-04-29 Thread Marek Kurdej via cfe-commits

Author: Marek Kurdej
Date: 2021-04-29T09:57:34+02:00
New Revision: 6e5082bbc498ab7d68178ea883203b38f6cd47fb

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

LOG: [clang-format] Fix build on gcc < 7 introduced in rG9363aa9.

This fixes a bogus build error on gcc, e.g. 
https://lab.llvm.org/buildbot/#/builders/110/builds/2973.

/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/clang/lib/Format/TokenAnnotator.cpp:3097:53:
 error: binding ‘const clang::SourceRange’ to reference of type 
‘clang::SourceRange&’ discards qualifiers
   auto HasExistingWhitespace = [&Whitespace = Right.WhitespaceRange]() {
 ^

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index f20640a1343d..3fe62bc4adc0 100755
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3094,8 +3094,8 @@ bool TokenAnnotator::spaceRequiredBetween(const 
AnnotatedLine &Line,
 bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
  const FormatToken &Right) {
   const FormatToken &Left = *Right.Previous;
-  auto HasExistingWhitespace = [&Whitespace = Right.WhitespaceRange]() {
-return Whitespace.getBegin() != Whitespace.getEnd();
+  auto HasExistingWhitespace = [&Right]() {
+return Right.WhitespaceRange.getBegin() != Right.WhitespaceRange.getEnd();
   };
   if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo())
 return true; // Never ever merge two identifiers.



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


[clang] 40c2d61 - [clang-format] Fix build on gcc < 7 introduced in rG9363aa9.

2021-04-29 Thread Marek Kurdej via cfe-commits

Author: Marek Kurdej
Date: 2021-04-29T10:07:04+02:00
New Revision: 40c2d6188b08f7a1bdd23a8cfdfea8fa998bdff6

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

LOG: [clang-format] Fix build on gcc < 7 introduced in rG9363aa9.

This fixes another bogus build error on gcc, e.g. 
https://lab.llvm.org/buildbot/#/builders/110/builds/2974.

/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/clang/lib/Format/TokenAnnotator.cpp:3412:34:
 error: binding ‘const clang::format::FormatStyle’ to reference of type 
‘clang::format::FormatStyle&’ discards qualifiers
   auto ShouldAddSpacesInAngles = [&Style = this->Style,
  ^

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 3fe62bc4adc0..719bb3fdd066 100755
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3409,11 +3409,10 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
 return Style.SpaceAfterCStyleCast ||
Right.isOneOf(TT_BinaryOperator, TT_SelectorName);
 
-  auto ShouldAddSpacesInAngles = [&Style = this->Style,
-  &HasExistingWhitespace]() {
-if (Style.SpacesInAngles == FormatStyle::SIAS_Always)
+  auto ShouldAddSpacesInAngles = [this, &HasExistingWhitespace]() {
+if (this->Style.SpacesInAngles == FormatStyle::SIAS_Always)
   return true;
-if (Style.SpacesInAngles == FormatStyle::SIAS_Leave)
+if (this->Style.SpacesInAngles == FormatStyle::SIAS_Leave)
   return HasExistingWhitespace();
 return false;
   };



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


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

2021-04-29 Thread Chirag Khandelwal via Phabricator via cfe-commits
AMDChirag updated this revision to Diff 341436.
AMDChirag added a comment.

Rebased to HEAD


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91054

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/cancel_codegen.cpp

Index: clang/test/OpenMP/cancel_codegen.cpp
===
--- clang/test/OpenMP/cancel_codegen.cpp
+++ clang/test/OpenMP/cancel_codegen.cpp
@@ -1,28 +1,27 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,CHECK
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,CHECK
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.0 %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t.0 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP
 
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,IRBUILDER
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP_IRB
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.1 %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t.1 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP_IRB
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
-// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP_SIMD
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.2 %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t.2 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP_SIMD
 
-// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,CHECK
-// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,CHECK
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.3 %s
+// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t.3 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP
 
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,IRBUILDER
-// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER
+// RUN: %clang_cc

[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-29 Thread Joachim Protze via Phabricator via cfe-commits
protze.joachim added a comment.

Please update the test with a NFC commit.




Comment at: openmp/libomptarget/test/offloading/bug49779.cpp:1-5
+// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda

See D101326



Comment at: openmp/libomptarget/test/offloading/bug49779.cpp:29-36
+  assert(C >= 2 && C <= 6);
+
+  std::cout << "PASS\n";
+
+  return 0;
+}
+

Since the output goes to Filecheck anyways, I think we should avoid asserts, 
but let Filecheck test for expected results. 
The output for failing tests has more information with this approach.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D101515: clang-format: [JS] handle "off" in imports

2021-04-29 Thread Martin Probst via Phabricator via cfe-commits
mprobst created this revision.
mprobst added reviewers: krasimir, h-joo.
mprobst requested review of this revision.
Herald added a project: clang.

Previously, the JavaScript import sorter would ignore `// clang-format
off` and `on` comments. This change fixes that. It tracks whether
formatting is enabled for a stretch of imports, and then only sorts and
merges the imports where formatting is enabled, in individual chunks.

This means that there's no meaningful total order when module references are 
mixed
with blocks that have formatting disabled. The alternative approach
would have been to sort all imports that have formatting enabled in one
group. However that raises the question where to insert the
formatting-off block, which can also impact symbol visibility (in
particular for exports). In practice, sorting in chunks probably isn't a
big problem.

This change also simplifies the general algorithm: instead of tracking
indices separately and sorting them, it just sorts the vector of module
references. And instead of attempting to do fine grained tracking of
whether the code changed order, it just prints out the module references
text, and compares that to the previous text. Given that source files
typically have dozens, but not even hundreds of imports, the performance
impact seems negligible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101515

Files:
  clang/lib/Format/SortJavaScriptImports.cpp
  clang/unittests/Format/SortImportsTestJS.cpp

Index: clang/unittests/Format/SortImportsTestJS.cpp
===
--- clang/unittests/Format/SortImportsTestJS.cpp
+++ clang/unittests/Format/SortImportsTestJS.cpp
@@ -358,7 +358,8 @@
 
   // do not merge imports and exports
   verifySort("import {A} from 'foo';\n"
- "export {B} from 'foo';",
+ "\n"
+ "export {B} from 'foo';\n",
  "import {A} from 'foo';\n"
  "export   {B} from 'foo';");
   // do merge exports
@@ -373,6 +374,42 @@
  "import './a';\n");
 }
 
+TEST_F(SortImportsTestJS, RespectsClangFormatOff) {
+  verifySort("// clang-format off\n"
+ "import {B} from './b';\n"
+ "import {A} from './a';\n"
+ "// clang-format on\n",
+ "// clang-format off\n"
+ "import {B} from './b';\n"
+ "import {A} from './a';\n"
+ "// clang-format on\n");
+
+  verifySort("import {A} from './sorted1_a';\n"
+ "import {B} from './sorted1_b';\n"
+ "// clang-format off\n"
+ "import {B} from './unsorted_b';\n"
+ "import {A} from './unsorted_a';\n"
+ "// clang-format on\n"
+ "import {A} from './sorted2_a';\n"
+ "import {B} from './sorted2_b';\n",
+ "import {B} from './sorted1_b';\n"
+ "import {A} from './sorted1_a';\n"
+ "// clang-format off\n"
+ "import {B} from './unsorted_b';\n"
+ "import {A} from './unsorted_a';\n"
+ "// clang-format on\n"
+ "import {B} from './sorted2_b';\n"
+ "import {A} from './sorted2_a';\n");
+
+  // Boundary cases
+  verifySort("// clang-format on\n", "// clang-format on\n");
+  verifySort("// clang-format off\n", "// clang-format off\n");
+  verifySort("// clang-format on\n"
+ "// clang-format off\n",
+ "// clang-format on\n"
+ "// clang-format off\n");
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/SortJavaScriptImports.cpp
===
--- clang/lib/Format/SortJavaScriptImports.cpp
+++ clang/lib/Format/SortJavaScriptImports.cpp
@@ -19,6 +19,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/TokenKinds.h"
 #include "clang/Format/Format.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
@@ -69,6 +70,7 @@
 // This struct represents both exports and imports to build up the information
 // required for sorting module references.
 struct JsModuleReference {
+  bool FormattingOff = false;
   bool IsExport = false;
   // Module references are sorted into these categories, in order.
   enum ReferenceCategory {
@@ -146,39 +148,31 @@
 if (References.empty())
   return {Result, 0};
 
-SmallVector Indices;
-for (unsigned i = 0, e = References.size(); i != e; ++i)
-  Indices.push_back(i);
-llvm::stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
-  return References[LHSI] < References[RHSI];
-});
-bool ReferencesInOrder = llvm::is_sorted(Indices);
+// The text range of all parsed imports, to be replaced later.
+SourceRange InsertionPoint = References[0].Range;
+InsertionPoint.setEnd(References[References.size() - 1].Range.getEnd());
 
-mergeModuleReferences(Refe

[PATCH] D101516: Introduce clangd-server-monitor tool

2021-04-29 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
kbobyrev added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman, mgorny.
kbobyrev requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101516

Files:
  clang-tools-extra/clangd/index/remote/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/monitor/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp


Index: clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
@@ -0,0 +1,60 @@
+//===--- Monitor.cpp - Request server monitoring information through CLI 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "MonitoringService.grpc.pb.h"
+#include "MonitoringService.pb.h"
+
+#include "clang/Basic/Version.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Signals.h"
+
+#include 
+#include 
+
+namespace clang {
+namespace clangd {
+namespace remote {
+namespace {
+
+static constexpr char Overview[] = R"(
+This tool requests monitoring information (uptime, index freshness) from the
+server and prints it to stdout.
+)";
+
+llvm::cl::opt
+ServerAddress("server-address", llvm::cl::Positional,
+  llvm::cl::desc("Address of the invoked server."),
+  llvm::cl::Required);
+
+} // namespace
+} // namespace remote
+} // namespace clangd
+} // namespace clang
+
+int main(int argc, char *argv[]) {
+  using namespace clang::clangd::remote;
+  llvm::cl::ParseCommandLineOptions(argc, argv, Overview);
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
+
+  const auto Channel =
+  grpc::CreateChannel(ServerAddress, grpc::InsecureChannelCredentials());
+  const auto Stub = clang::clangd::remote::v1::Monitor::NewStub(Channel);
+  grpc::ClientContext Context;
+  Context.AddMetadata("version", clang::getClangToolFullVersion("clangd"));
+  const clang::clangd::remote::v1::MonitoringInfoRequest Request;
+  clang::clangd::remote::v1::MonitoringInfoReply Response;
+  const auto Status = Stub->MonitoringInfo(&Context, Request, &Response);
+  if (!Status.ok()) {
+llvm::errs() << llvm::formatv(
+"Can not request monitoring information ({0}): {1}\n",
+Status.error_code(), Status.error_message());
+return -1;
+  }
+  llvm::outs() << Response.DebugString();
+}
Index: clang-tools-extra/clangd/index/remote/monitor/CMakeLists.txt
===
--- /dev/null
+++ clang-tools-extra/clangd/index/remote/monitor/CMakeLists.txt
@@ -0,0 +1,17 @@
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+add_clang_executable(clangd-server-monitor
+  Monitor.cpp
+
+  DEPENDS
+  RemoteIndexServiceProto
+  )
+
+target_link_libraries(clangd-server-monitor
+  PRIVATE
+  clangBasic
+
+  MonitoringServiceProto
+  RemoteIndexServiceProto
+  )
Index: clang-tools-extra/clangd/index/remote/CMakeLists.txt
===
--- clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -38,6 +38,7 @@
 
   add_subdirectory(marshalling)
   add_subdirectory(server)
+  add_subdirectory(monitor)
 else()
   # Provides a no-op implementation of clangdRemoteIndex.
   add_subdirectory(unimplemented)


Index: clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
@@ -0,0 +1,60 @@
+//===--- Monitor.cpp - Request server monitoring information through CLI --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "MonitoringService.grpc.pb.h"
+#include "MonitoringService.pb.h"
+
+#include "clang/Basic/Version.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Signals.h"
+
+#include 
+#include 
+
+namespace clang {
+namespace clangd {
+namespace remote {
+namespace {
+
+static constexpr char Overview[] = R"(
+This tool requests monitoring information (uptime, index freshness) from the
+server and prints it to stdout.
+)";
+
+llvm::cl::opt
+ServerAddress("server-address", llvm::cl::Positional,
+  llvm::cl::desc("Address of 

[PATCH] D101209: [PowerPC] Provide fastmath sqrt and div functions in altivec.h

2021-04-29 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai updated this revision to Diff 341456.
nemanjai added a comment.

Changed `rsqrt` to be an actual reciprocal rather than just a refined `sqrt` 
estimate.

I have verified that the code generated is equivalent to gcc's and the results 
produced are the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101209

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-altivec.c
  clang/test/CodeGen/builtins-ppc-vsx.c

Index: clang/test/CodeGen/builtins-ppc-vsx.c
===
--- clang/test/CodeGen/builtins-ppc-vsx.c
+++ clang/test/CodeGen/builtins-ppc-vsx.c
@@ -2283,3 +2283,21 @@
 // CHECK-NEXT: call <2 x double> @llvm.copysign.v2f64(<2 x double> [[RA]], <2 x double> [[RB]])
   __builtin_vsx_xvcpsgndp(a, b);
 }
+
+vector double test_recipdivd(vector double a, vector double b) {
+  // CHECK-LABEL: test_recipdivd
+  // CHECK: fdiv fast <2 x double>
+  // CHECK-LE-LABEL: test_recipdivd
+  // CHECK-LE: fdiv fast <2 x double>
+  return vec_recipdiv(a, b);
+}
+
+vector double test_rsqrtd(vector double a, vector double b) {
+  // CHECK-LABEL: test_rsqrtd
+  // CHECK: call fast <2 x double> @llvm.sqrt.v2f64
+  // CHECK: fdiv fast <2 x double> 
+  // CHECK-LE-LABEL: test_rsqrtd
+  // CHECK-LE: call fast <2 x double> @llvm.sqrt.v2f64
+  // CHECK-LE: fdiv fast <2 x double> 
+  return vec_rsqrt(a);
+}
Index: clang/test/CodeGen/builtins-ppc-altivec.c
===
--- clang/test/CodeGen/builtins-ppc-altivec.c
+++ clang/test/CodeGen/builtins-ppc-altivec.c
@@ -9577,3 +9577,21 @@
   // CHECK: store <4 x float> %{{[0-9]+}}, <4 x float>* %{{[0-9]+}}, align 1
   // CHECK-LE: call void @llvm.ppc.vsx.stxvw4x.be(<4 x i32> %{{[0-9]+}}, i8* %{{[0-9]+}})
 }
+
+vector float test_rsqrtf(vector float a, vector float b) {
+  // CHECK-LABEL: test_rsqrtf
+  // CHECK: call fast <4 x float> @llvm.sqrt.v4f32
+  // CHECK: fdiv fast <4 x float> 
+  // CHECK-LE-LABEL: test_rsqrtf
+  // CHECK-LE: call fast <4 x float> @llvm.sqrt.v4f32
+  // CHECK-LE: fdiv fast <4 x float> 
+  return vec_rsqrt(a);
+}
+
+vector float test_recipdivf(vector float a, vector float b) {
+  // CHECK-LABEL: test_recipdivf
+  // CHECK: fdiv fast <4 x float>
+  // CHECK-LE-LABEL: test_recipdivf
+  // CHECK-LE: fdiv fast <4 x float>
+  return vec_recipdiv(a, b);
+}
Index: clang/lib/Headers/altivec.h
===
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -8359,6 +8359,16 @@
 }
 #endif
 
+static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) {
+  return __builtin_ppc_rsqrtf(__a);
+}
+
+#ifdef __VSX__
+static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) {
+  return __builtin_ppc_rsqrtd(__a);
+}
+#endif
+
 /* vec_vrsqrtefp */
 
 static __inline__ __vector float __attribute__((__always_inline__))
@@ -17897,6 +17907,18 @@
   return __builtin_altivec_vminsb(__a, -__a);
 }
 
+static vector float __ATTRS_o_ai vec_recipdiv(vector float __a,
+  vector float __b) {
+  return __builtin_ppc_recipdivf(__a, __b);
+}
+
+#ifdef __VSX__
+static vector double __ATTRS_o_ai vec_recipdiv(vector double __a,
+   vector double __b) {
+  return __builtin_ppc_recipdivd(__a, __b);
+}
+#endif
+
 #ifdef __POWER10_VECTOR__
 
 /* vec_extractm */
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -15114,6 +15114,25 @@
 return Builder.CreateCall(F, X);
   }
 
+  // Fastmath by default
+  case PPC::BI__builtin_ppc_recipdivf:
+  case PPC::BI__builtin_ppc_recipdivd:
+  case PPC::BI__builtin_ppc_rsqrtf:
+  case PPC::BI__builtin_ppc_rsqrtd: {
+Builder.getFastMathFlags().setFast();
+llvm::Type *ResultType = ConvertType(E->getType());
+Value *X = EmitScalarExpr(E->getArg(0));
+
+if (BuiltinID == PPC::BI__builtin_ppc_recipdivf ||
+BuiltinID == PPC::BI__builtin_ppc_recipdivd) {
+  Value *Y = EmitScalarExpr(E->getArg(1));
+  return Builder.CreateFDiv(X, Y, "recipdiv");
+}
+auto *One = ConstantFP::get(ResultType, 1.0);
+llvm::Function *F = CGM.getIntrinsic(Intrinsic::sqrt, ResultType);
+return Builder.CreateFDiv(One, Builder.CreateCall(F, X), "rsqrt");
+  }
+
   // FMA variations
   case PPC::BI__builtin_vsx_xvmaddadp:
   case PPC::BI__builtin_vsx_xvmaddasp:
Index: clang/include/clang/Basic/BuiltinsPPC.def
===
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -600,6 +600,12 @@
 BUILTIN(__builtin_vsx_scalar_extract_expq, "ULLiLLd", "")
 BUILTIN(__builtin_vsx_s

[clang] 0ff41c2 - Update libstdc++ hack comment

2021-04-29 Thread Nathan Sidwell via cfe-commits

Author: Nathan Sidwell
Date: 2021-04-29T03:57:10-07:00
New Revision: 0ff41c2ebc9904f881c958f9006bbf2b6bdc5d1e

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

LOG: Update libstdc++ hack comment

This libstc++ hack isn't ready for removal. Updating the comment to
note what I found. While I have not proven Ville's
__is_throw_swappable patch made this go away, that patch did remove
the use of noexcept(noexcept(swap())). I'm not sure when gcc grew
deferred noexcept parsing.

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

Added: 


Modified: 
clang/lib/Sema/SemaExceptionSpec.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaExceptionSpec.cpp 
b/clang/lib/Sema/SemaExceptionSpec.cpp
index 54f9fb3db9e39..f0b9e6a5bc3ba 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -35,10 +35,12 @@ static const FunctionProtoType 
*GetUnderlyingFunction(QualType T)
   return T->getAs();
 }
 
-/// HACK: libstdc++ has a bug where it shadows std::swap with a member
-/// swap function then tries to call std::swap unqualified from the exception
-/// specification of that function. This function detects whether we're in
-/// such a case and turns off delay-parsing of exception specifications.
+/// HACK: 2014-11-14 libstdc++ had a bug where it shadows std::swap with a
+/// member swap function then tries to call std::swap unqualified from the
+/// exception specification of that function. This function detects whether
+/// we're in such a case and turns off delay-parsing of exception
+/// specifications. Libstdc++ 6.1 (released 2016-04-27) appears to have
+/// resolved it as side-effect of commit ddb63209a8d (2015-06-05).
 bool Sema::isLibstdcxxEagerExceptionSpecHack(const Declarator &D) {
   auto *RD = dyn_cast(CurContext);
 



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


[PATCH] D101441: Update libstdc++ hack comment

2021-04-29 Thread Nathan Sidwell via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0ff41c2ebc99: Update libstdc++ hack comment (authored by 
urnathan).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101441

Files:
  clang/lib/Sema/SemaExceptionSpec.cpp


Index: clang/lib/Sema/SemaExceptionSpec.cpp
===
--- clang/lib/Sema/SemaExceptionSpec.cpp
+++ clang/lib/Sema/SemaExceptionSpec.cpp
@@ -35,10 +35,12 @@
   return T->getAs();
 }
 
-/// HACK: libstdc++ has a bug where it shadows std::swap with a member
-/// swap function then tries to call std::swap unqualified from the exception
-/// specification of that function. This function detects whether we're in
-/// such a case and turns off delay-parsing of exception specifications.
+/// HACK: 2014-11-14 libstdc++ had a bug where it shadows std::swap with a
+/// member swap function then tries to call std::swap unqualified from the
+/// exception specification of that function. This function detects whether
+/// we're in such a case and turns off delay-parsing of exception
+/// specifications. Libstdc++ 6.1 (released 2016-04-27) appears to have
+/// resolved it as side-effect of commit ddb63209a8d (2015-06-05).
 bool Sema::isLibstdcxxEagerExceptionSpecHack(const Declarator &D) {
   auto *RD = dyn_cast(CurContext);
 


Index: clang/lib/Sema/SemaExceptionSpec.cpp
===
--- clang/lib/Sema/SemaExceptionSpec.cpp
+++ clang/lib/Sema/SemaExceptionSpec.cpp
@@ -35,10 +35,12 @@
   return T->getAs();
 }
 
-/// HACK: libstdc++ has a bug where it shadows std::swap with a member
-/// swap function then tries to call std::swap unqualified from the exception
-/// specification of that function. This function detects whether we're in
-/// such a case and turns off delay-parsing of exception specifications.
+/// HACK: 2014-11-14 libstdc++ had a bug where it shadows std::swap with a
+/// member swap function then tries to call std::swap unqualified from the
+/// exception specification of that function. This function detects whether
+/// we're in such a case and turns off delay-parsing of exception
+/// specifications. Libstdc++ 6.1 (released 2016-04-27) appears to have
+/// resolved it as side-effect of commit ddb63209a8d (2015-06-05).
 bool Sema::isLibstdcxxEagerExceptionSpecHack(const Declarator &D) {
   auto *RD = dyn_cast(CurContext);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101519: [C++4OpenCL] Fix reinterpret_cast of vectors and types with address spaces

2021-04-29 Thread Ole Strohm via Phabricator via cfe-commits
olestrohm created this revision.
olestrohm added reviewers: Anastasia, svenvh.
olestrohm added a project: clang.
Herald added subscribers: ldrumm, yaxunl.
olestrohm requested review of this revision.
Herald added a subscriber: cfe-commits.

This fixes two issues with reinterpret_cast in C++ for OpenCL and adds tests to 
make sure they both pass without errors, and generate the correct code.

Reinterpret_cast can only convert a type to itself if it is an integral type 
(or pointer or reference or vectors), so I didn't include any exceptions for 
opencl types.
Not even float can be converted to itself, so I don't think it makes sense to 
allow this for any opencl types unlesss you think some of them fit the integral 
restriction.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=47977 and 
https://bugs.llvm.org/show_bug.cgi?id=49221


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101519

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGenOpenCLCXX/reinterpret_cast.clcpp
  clang/test/SemaOpenCLCXX/reinterpret-cast.clcpp

Index: clang/test/SemaOpenCLCXX/reinterpret-cast.clcpp
===
--- /dev/null
+++ clang/test/SemaOpenCLCXX/reinterpret-cast.clcpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only
+
+typedef int int2 __attribute__((ext_vector_type(2)));
+
+kernel void foo() {
+  long x;
+  auto x2 = reinterpret_cast(x);
+  int2 y;
+  auto y2 = reinterpret_cast(y);
+  auto y3 = reinterpret_cast(y); // expected-error{{reinterpret_cast from vector 'int2' (vector of 2 'int' values) to scalar 'int' of different size}}
+
+  __private int i;
+  auto i2 = reinterpret_cast<__private int>(i);
+  auto i3 = reinterpret_cast(i);
+
+  reserve_id_t z;
+  auto z2 = reinterpret_cast(z); // expected-error{{reinterpret_cast from 'reserve_id_t' to 'reserve_id_t' is not allowed}}
+}
Index: clang/test/CodeGenOpenCLCXX/reinterpret_cast.clcpp
===
--- /dev/null
+++ clang/test/CodeGenOpenCLCXX/reinterpret_cast.clcpp
@@ -0,0 +1,15 @@
+//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s
+
+typedef int int2 __attribute__((ext_vector_type(2)));
+
+//CHECK-LABEL: define{{.*}} spir_func void @_Z3barPU3AS1Dv2_i
+void bar(global int2 *vec) {
+  //CHECK: load i32, i32* %x, align 4
+  //CHECK: store i32 %{{[0-9]+}}, i32* %y, align 4
+  int x;
+  auto y = reinterpret_cast<__private int>(x);
+  //CHECK: bitcast <2 x i32> %{{[0-9]+}} to i64
+  auto lv = reinterpret_cast(vec[0]);
+  //CHECK: bitcast i64 %{{[0-9]+}} to <2 x i32>
+  auto vec0 = reinterpret_cast(lv);
+}
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -7358,6 +7358,25 @@
  matSrcType->getNumColumns() == matDestType->getNumColumns();
 }
 
+bool Sema::areVectorTypesSameSize(QualType srcTy, QualType destTy) {
+  assert(destTy->isVectorType() || srcTy->isVectorType());
+
+  uint64_t srcLen, destLen;
+  QualType srcEltTy, destEltTy;
+  if (!breakDownVectorType(srcTy, srcLen, srcEltTy))
+return false;
+  if (!breakDownVectorType(destTy, destLen, destEltTy))
+return false;
+
+  // ASTContext::getTypeSize will return the size rounded up to a
+  // power of 2, so instead of using that, we need to use the raw
+  // element size multiplied by the element count.
+  uint64_t srcEltSize = Context.getTypeSize(srcEltTy);
+  uint64_t destEltSize = Context.getTypeSize(destEltTy);
+
+  return (srcLen * srcEltSize == destLen * destEltSize);
+}
+
 /// Are the two types lax-compatible vector types?  That is, given
 /// that one of them is a vector, do they have equal storage sizes,
 /// where the storage size is the number of elements times the element
@@ -7376,18 +7395,7 @@
   if (srcTy->isScalarType() && destTy->isExtVectorType()) return false;
   if (destTy->isScalarType() && srcTy->isExtVectorType()) return false;
 
-  uint64_t srcLen, destLen;
-  QualType srcEltTy, destEltTy;
-  if (!breakDownVectorType(srcTy, srcLen, srcEltTy)) return false;
-  if (!breakDownVectorType(destTy, destLen, destEltTy)) return false;
-
-  // ASTContext::getTypeSize will return the size rounded up to a
-  // power of 2, so instead of using that, we need to use the raw
-  // element size multiplied by the element count.
-  uint64_t srcEltSize = Context.getTypeSize(srcEltTy);
-  uint64_t destEltSize = Context.getTypeSize(destEltTy);
-
-  return (srcLen * srcEltSize == destLen * destEltSize);
+  return areVectorTypesSameSize(srcTy, destTy);
 }
 
 /// Is this a legal conversion between two types, one of which is
Index: clang/lib/Sema/SemaCast.cpp
===
--- clang/lib/Sema/SemaCast.cpp
+++ clang/lib/Sema/SemaCast.cpp
@@ -2328,6 +2328,15 @@
   return TC_Success;
 }
 
+if (Self.Lang

[PATCH] D100872: Use OpenFlags instead of boolean to set a file as text/binary

2021-04-29 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan added inline comments.



Comment at: clang/include/clang/Frontend/CompilerInstance.h:738-740
+  createOutputFileImpl(StringRef OutputPath, llvm::sys::fs::OpenFlags Flags,
bool RemoveFileOnSignal, bool UseTemporary,
bool CreateMissingDirectories);

dexonsmith wrote:
> abhina.sreeskantharajan wrote:
> > rnk wrote:
> > > I think this is only going to be worth it if we can roll up all of these 
> > > booleans into a new flags enum for compiler instance. It also prevents 
> > > introducing a new use of FileSystem.h, which is an expensive header to 
> > > include.
> > Sorry, I don't think I completely understand your suggestion. Are you 
> > proposing that we create a new enum just for CompilerInstance.h for the 
> > other booleans like RemoveFileOnSignal, UseTemporary, 
> > CreateMissingDirectories? And this new enum also contain text/binary flags 
> > so we don't need to use the enum in FileSystem.h? 
> > 
> > For background, I need this specific change to set some more text files 
> > with OF_Text because my old commit got reverted since it caused CRLF issues 
> > on Windows https://reviews.llvm.org/D96363.
> > 
> Yes, I think that's what @rnk is suggesting, maybe along the lines of the 
> OutputConfigFlag in the (languishing, I need to get back to it) 
> OutputBackend/OutputManager proposal I have (see, e.g., 
> https://reviews.llvm.org/D95501, which needs to be split up), or maybe as a 
> struct with named members as @sammccall suggests there.
> 
> > It also prevents introducing a new use of FileSystem.h, which is an 
> > expensive header to include.
> Another option that'd be more isolated would be to split the OpenFlag enum 
> (and/or its friends) out to another header in 
> llvm/include/llvm/Support/FileSystem/ (say, 
> .../FileSystem/FileSystemEnums.h), like was done for UniqueID.h.
Thanks for clarifying. I think having a duplicate copy of the OpenFlags may be 
confusing. I like the idea of putting the enums in its own header file. But can 
that be done in a separate change than this patch? It will be a much larger 
change touching more files than this patcch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100872

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


[PATCH] D101462: Make it possible for targets to define their own MCObjectFileInfo

2021-04-29 Thread Philipp Krones via Phabricator via cfe-commits
flip1995 created this revision.
flip1995 added reviewers: MaskRay, rnk, asb.
Herald added subscribers: frasercrmck, dexonsmith, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, jocewei, rupprecht, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, jrtc27, gbedwell, 
niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, mgorny, jholewinski.
Herald added a reviewer: andreadb.
Herald added a reviewer: jhenderson.
flip1995 requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, aheejin.
Herald added projects: clang, LLDB, LLVM.

Some information about the object file may be target specific. As an example,
this patch removes the hard-coded 4-byte alignment for text sections and now
uses the alignment defined by the target in the target specific
MCObjectFileInfo.

To get this to work some refactoring was involved:

1. MCObjectFileInfo and MCContext depend on each other (even during 
construction)
2. This patch removes the dependency of MCContext on MCObjectFileInfo during 
construction
3. Additionally, it untangles MCContext  and MCObjectFileInfo a bit more by 
moving elements, like the TargetTriple information from MCObjectFileInfo to 
MCContext.

The contruction of a MCContext with a MCObjectFileInfo is still a little weird:

1. Construct MCContext
2. Construct MCObjectFileInfo
3. Set MOFI for MCContext

But to untangle this futher, the circular dependency between the two would've
to be removed completely, which would be too big of a change for the thing this
patch tries to achive.

The one backend that now makes usage of this patch is RISC-V, where the text
section only has to be 2-byte aligned when the C extension is enabled. This now
produces the same alignments for RISC-V text sections as GCC does.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101462

Files:
  clang/lib/Parse/ParseStmtAsm.cpp
  clang/tools/driver/cc1as_main.cpp
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
  lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCObjectFileInfo.h
  llvm/include/llvm/Support/TargetRegistry.h
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/DWARFLinker/DWARFStreamer.cpp
  llvm/lib/MC/MCAsmStreamer.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDisassembler/Disassembler.cpp
  llvm/lib/MC/MCELFStreamer.cpp
  llvm/lib/MC/MCMachOStreamer.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/lib/MC/MCParser/COFFAsmParser.cpp
  llvm/lib/MC/MCParser/DarwinAsmParser.cpp
  llvm/lib/MC/MCParser/MasmParser.cpp
  llvm/lib/MC/MCStreamer.cpp
  llvm/lib/MC/MCWinCOFFStreamer.cpp
  llvm/lib/Object/ModuleSymbolTable.cpp
  llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
  llvm/lib/Target/TargetLoweringObjectFile.cpp
  llvm/test/MC/RISCV/align.s
  llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
  llvm/tools/llvm-dwp/llvm-dwp.cpp
  llvm/tools/llvm-exegesis/lib/Analysis.cpp
  llvm/tools/llvm-exegesis/lib/LlvmState.cpp
  llvm/tools/llvm-exegesis/lib/SnippetFile.cpp
  llvm/tools/llvm-jitlink/llvm-jitlink.cpp
  llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-mca/llvm-mca.cpp
  llvm/tools/llvm-ml/Disassembler.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-objdump/MachODump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-profgen/ProfiledBinary.cpp
  llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
  llvm/tools/sancov/sancov.cpp
  llvm/unittests/CodeGen/MachineInstrTest.cpp
  llvm/unittests/CodeGen/MachineOperandTest.cpp
  llvm/unittests/CodeGen/TestAsmPrinter.cpp
  llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
  llvm/unittests/MC/DwarfLineTables.cpp
  llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp

Index: llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
===
--- llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
+++ llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
@@ -57,6 +57,7 @@
   std::unique_ptr MRI;
   std::unique_ptr MUPMAI;
   std::unique_ptr MII;
+  std::unique_ptr MSTI;
   std::unique_ptr Str;
   std::unique_ptr Parser;
   std::unique_ptr Ctx;
@@ -86,6 +87,10 @@
 MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions));
 EXPECT_NE(MAI, nullptr);
 
+std::unique_ptr MSTI;
+MSTI.reset(TheTarget->createMCSubtargetInfo(TripleName, "", ""));
+EXPECT_NE(MSTI, nullptr

[PATCH] D101462: Make it possible for targets to define their own MCObjectFileInfo

2021-04-29 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.
Herald added a subscriber: JDevlieghere.

What's the benefit of less-aligned functions? Is that not more likely to get 
poor performance due to cache line straddling of the first instruction? 
Regardless, the functional change should be separated out from the refactoring.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101462

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


[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 updated this revision to Diff 341213.
Ericson2314 added a comment.

Fix stray ':' typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/src/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -86,10 +88,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -83,14 +83,15 @@
 set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+get_filename_component(base_includedir "${CMAKE_INSTALL_INCLUDEDIR}" ABSOLUTE BASE_DIR "${POLLY_INSTALL_PREFIX}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
-"${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -100,12 +101,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
   else()
-set(tgt_prefix "lib/")
+set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
   endif()
 
-  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
+  set(tgt_path "${tgt_prefix}$")
   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
 
   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -2,7 +2,11 @@

[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-04-29 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 341262.

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

https://reviews.llvm.org/D89013

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  
clang/test/Driver/Inputs/basic_fuchsia_tree/include/aarch64-unknown-fuchsia/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_fuchsia_tree/include/riscv64-unknown-fuchsia/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_fuchsia_tree/include/x86_64-unknown-fuchsia/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/include/x86_64-unknown-linux-gnu/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/x86_64-unknown-linux-gnu/c++/v2/.keep
  
clang/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/x86_64-unknown-linux-gnu/c++/v2/.keep
  clang/test/Driver/fuchsia.cpp
  clang/test/Driver/linux-header-search.cpp
  libcxx/CMakeLists.txt
  libcxx/benchmarks/CMakeLists.txt
  libcxx/include/CMakeLists.txt
  libcxx/utils/libcxx/test/config.py
  libcxxabi/test/libcxxabi/test/config.py

Index: libcxxabi/test/libcxxabi/test/config.py
===
--- libcxxabi/test/libcxxabi/test/config.py
+++ libcxxabi/test/libcxxabi/test/config.py
@@ -69,6 +69,12 @@
 if not os.path.isdir(cxx_headers):
 self.lit_config.fatal("cxx_headers='%s' is not a directory."
   % cxx_headers)
+(path, version) = os.path.split(cxx_headers)
+(path, cxx) = os.path.split(path)
+cxx_target_headers = os.path.join(
+path, self.get_lit_conf('target_triple', None), cxx, version)
+if os.path.isdir(cxx_target_headers):
+self.cxx.compile_flags += ['-I' + cxx_target_headers]
 self.cxx.compile_flags += ['-I' + cxx_headers]
 
 libcxxabi_headers = self.get_lit_conf(
Index: libcxx/utils/libcxx/test/config.py
===
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -354,6 +354,12 @@
 self.cxx.compile_flags += ['-nostdinc++']
 if not os.path.isdir(cxx_headers):
 self.lit_config.fatal("cxx_headers='{}' is not a directory.".format(cxx_headers))
+(path, version) = os.path.split(cxx_headers)
+(path, cxx) = os.path.split(path)
+cxx_target_headers = os.path.join(
+path, self.get_lit_conf('target_triple', None), cxx, version)
+if os.path.isdir(cxx_target_headers):
+self.cxx.compile_flags += ['-I' + cxx_target_headers]
 self.cxx.compile_flags += ['-I' + cxx_headers]
 if self.libcxx_obj_root is not None:
 cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include',
Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -209,9 +209,9 @@
   wctype.h
   )
 
-configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site" @ONLY)
+configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" @ONLY)
 
-set(_all_includes "${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site")
+set(_all_includes "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site")
 foreach(f ${files})
   set(src "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
   set(dst "${LIBCXX_GENERATED_INCLUDE_DIR}/${f}")
@@ -228,24 +228,26 @@
 add_dependencies(cxx-headers generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET})
 # TODO: Use target_include_directories once we figure out why that breaks the runtimes build
 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
-  target_compile_options(cxx-headers INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_DIR}")
+  target_compile_options(cxx-headers INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_DIR}"
+ INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}")
 else()
-  target_compile_options(cxx-headers INTERFACE -I "${LIBCXX_GENERATED_INCLUDE_DIR}")
+  target_compile_options(cxx-headers INTERFACE -I${LIBCXX_GENERATED_INCLUDE_DIR}
+ INTERFACE -I${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
 endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   foreach(file ${files})
 get_filename_component(dir ${file} DIRECTORY)
 install(FILES ${file}
-  DESTINATION include/c++/v1/${dir}
+  DESTINATION ${LIBCXX_INSTALL_INCLUDE_DIR}/${dir}
   COMPONENT cxx-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 )
   endforeach()
 
   # Install the generated __config_site.
-  install(FILES ${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site
-DESTINATION include/c++/v1
+  install(FILES ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site
+DESTINATION ${LIBCXX_INSTALL_INCLUDE_TARGET_DIR}
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 COMPONENT cxx-head

[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-04-29 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/test/Driver/linux-header-search.cpp:16
 // CHECK-BASIC-LIBCXX-SYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" 
"[[SYSROOT]]/usr/include/x86_64-unknown-linux-gnu/c++/v1"
 // CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" 
"[[SYSROOT]]/usr/include/c++/v1"

You may want to use the `-SAME: {{^}} ` pattern in linux-cross.cpp to improve 
the checks.


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

https://reviews.llvm.org/D89013

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


[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-04-29 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

The path component `x86_64-unknown-linux-gnu` (not multiarch 
`x86_64-linux-gnu`) looks good to me


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

https://reviews.llvm.org/D89013

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


[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-04-29 Thread Petr Hosek via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea12d779bc23: [libc++] Support per-target __config_site in 
per-target runtime build (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D89013?vs=341262&id=341317#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89013

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  
clang/test/Driver/Inputs/basic_fuchsia_tree/include/aarch64-unknown-fuchsia/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_fuchsia_tree/include/riscv64-unknown-fuchsia/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_fuchsia_tree/include/x86_64-unknown-fuchsia/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/include/x86_64-unknown-linux-gnu/c++/v1/.keep
  
clang/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/x86_64-unknown-linux-gnu/c++/v2/.keep
  
clang/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/x86_64-unknown-linux-gnu/c++/v2/.keep
  clang/test/Driver/fuchsia.cpp
  clang/test/Driver/linux-header-search.cpp
  libcxx/CMakeLists.txt
  libcxx/benchmarks/CMakeLists.txt
  libcxx/include/CMakeLists.txt
  libcxx/utils/libcxx/test/config.py
  libcxxabi/test/libcxxabi/test/config.py

Index: libcxxabi/test/libcxxabi/test/config.py
===
--- libcxxabi/test/libcxxabi/test/config.py
+++ libcxxabi/test/libcxxabi/test/config.py
@@ -69,6 +69,12 @@
 if not os.path.isdir(cxx_headers):
 self.lit_config.fatal("cxx_headers='%s' is not a directory."
   % cxx_headers)
+(path, version) = os.path.split(cxx_headers)
+(path, cxx) = os.path.split(path)
+cxx_target_headers = os.path.join(
+path, self.get_lit_conf('target_triple', None), cxx, version)
+if os.path.isdir(cxx_target_headers):
+self.cxx.compile_flags += ['-I' + cxx_target_headers]
 self.cxx.compile_flags += ['-I' + cxx_headers]
 
 libcxxabi_headers = self.get_lit_conf(
Index: libcxx/utils/libcxx/test/config.py
===
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -354,6 +354,12 @@
 self.cxx.compile_flags += ['-nostdinc++']
 if not os.path.isdir(cxx_headers):
 self.lit_config.fatal("cxx_headers='{}' is not a directory.".format(cxx_headers))
+(path, version) = os.path.split(cxx_headers)
+(path, cxx) = os.path.split(path)
+cxx_target_headers = os.path.join(
+path, self.get_lit_conf('target_triple', None), cxx, version)
+if os.path.isdir(cxx_target_headers):
+self.cxx.compile_flags += ['-I' + cxx_target_headers]
 self.cxx.compile_flags += ['-I' + cxx_headers]
 if self.libcxx_obj_root is not None:
 cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include',
Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -209,9 +209,9 @@
   wctype.h
   )
 
-configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site" @ONLY)
+configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" @ONLY)
 
-set(_all_includes "${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site")
+set(_all_includes "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site")
 foreach(f ${files})
   set(src "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
   set(dst "${LIBCXX_GENERATED_INCLUDE_DIR}/${f}")
@@ -228,24 +228,26 @@
 add_dependencies(cxx-headers generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET})
 # TODO: Use target_include_directories once we figure out why that breaks the runtimes build
 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
-  target_compile_options(cxx-headers INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_DIR}")
+  target_compile_options(cxx-headers INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_DIR}"
+ INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}")
 else()
-  target_compile_options(cxx-headers INTERFACE -I "${LIBCXX_GENERATED_INCLUDE_DIR}")
+  target_compile_options(cxx-headers INTERFACE -I${LIBCXX_GENERATED_INCLUDE_DIR}
+ INTERFACE -I${LIBCXX_GENERATED_INCLUDE_TARGET_DIR})
 endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   foreach(file ${files})
 get_filename_component(dir ${file} DIRECTORY)
 install(FILES ${file}
-  DESTINATION include/c++/v1/${dir}
+  DESTINATION ${LIBCXX_INSTALL_INCLUDE_DIR}/${dir}
   COMPONENT cxx-headers
   PERMISSIONS

[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 updated this revision to Diff 341326.
Ericson2314 added a comment.

Fix bug makeing polly path full, and rebase fixing conflicts


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/src/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -86,10 +88,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -83,14 +83,15 @@
 set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+get_filename_component(base_includedir "${CMAKE_INSTALL_INCLUDEDIR}" ABSOLUTE BASE_DIR "${POLLY_INSTALL_PREFIX}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
-"${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -100,12 +101,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_BINDIR}/")
   else()
-set(tgt_prefix "lib/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/")
   endif()
 
-  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
+  set(tgt_path "${tgt_prefix}$")
   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
 
   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
Index: polly/CMakeLists.txt
===
--- polly/CMake

[PATCH] D101462: Make it possible for targets to define their own MCObjectFileInfo

2021-04-29 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

The refactoring part seems useful on its own. The controversial 4-byte 
alignment part should be split.

Doesn't GNU as use 4 for most architectures as well? Why do you want to change 
it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101462

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


[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 updated this revision to Diff 341339.
Ericson2314 added a comment.

Resubmit now prior diff is rebased, so CI doesn't trip up


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

Files:
  clang-tools-extra/clang-doc/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
  clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/modularize/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  clang/tools/c-index-test/CMakeLists.txt
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-rename/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  clang/tools/scan-view/CMakeLists.txt
  clang/utils/hmaptool/CMakeLists.txt
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/src/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/tools/lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  openmp/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/multiplex/CMakeLists.txt
  polly/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/lib/External/CMakeLists.txt
  pstl/CMakeLists.txt

Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -7,6 +7,8 @@
 #===--===##
 cmake_minimum_required(VERSION 3.13.4)
 
+include(GNUInstallDirs)
+
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
 string(REGEX REPLACE "#define _PSTL_VERSION (.*)$" "\\1" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
@@ -86,10 +88,10 @@
   "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
 DESTINATION lib/cmake/ParallelSTL)
 install(DIRECTORY include/
-DESTINATION include
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
 PATTERN "*.in" EXCLUDE)
 install(FILES "${PSTL_CONFIG_SITE_PATH}"
-DESTINATION include)
+DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 
 add_custom_target(install-pstl
   COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
Index: polly/lib/External/CMakeLists.txt
===
--- polly/lib/External/CMakeLists.txt
+++ polly/lib/External/CMakeLists.txt
@@ -290,7 +290,7 @@
 install(DIRECTORY
   ${ISL_SOURCE_DIR}/include/
   ${ISL_BINARY_DIR}/include/
-  DESTINATION include/polly
+  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/polly"
   FILES_MATCHING
   PATTERN "*.h"
   PATTERN "CMakeFiles" EXCLUDE
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -83,14 +83,15 @@
 set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
 set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+get_filename_component(base_includedir "${CMAKE_INSTALL_INCLUDEDIR}" ABSOLUTE BASE_DIR "${POLLY_INSTALL_PREFIX}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
-"${POLLY_INSTALL_PREFIX}/include/polly"
+"${base_includedir}"
+"${base_includedir}/polly"
 )
 else()
   set(POLLY_CONFIG_INCLUDE_DIRS
-"${POLLY_INSTALL_PREFIX}/include"
+"${base_includedir}"
 ${ISL_INCLUDE_DIRS}
 )
 endif()
@@ -100,12 +101,12 @@
 foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
   get_target_property(tgt_type ${tgt} TYPE)
   if (tgt_type STREQUAL "EXECUTABLE")
-set(tgt_prefix "bin/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_BINDIR}/")
   else()
-set(tgt_prefix "lib/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/")
   endif()
 
-  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
+  set(tgt_path "${tgt_prefix}$")
   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
 
   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLis

[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

In D99484#2724055 , @Ericson2314 wrote:

> Fix bug makeing polly path full, and rebase fixing conflicts

What was the problem?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 added a comment.

In D99484#2724343 , @Meinersbur wrote:

> In D99484#2724055 , @Ericson2314 
> wrote:
>
>> Fix bug makeing polly path full, and rebase fixing conflicts
>
> What was the problem?

I effectively replaced `${CMAKE_INSTALL_PREFIX}/lib` `${CMAKE_INSTALL_LIBDIR}`, 
which evaluates (by default) merely to `lib`. The fix was 
`${CMAKE_INSTALL_FULL_LIBDIR}` which will always return an absolute path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

In D99484#2724435 , @Ericson2314 wrote:

> I effectively replaced `${CMAKE_INSTALL_PREFIX}/lib` with 
> `${CMAKE_INSTALL_LIBDIR}`, which evaluates (by default) merely to `lib`. The 
> fix was `${CMAKE_INSTALL_FULL_LIBDIR}` which will always return an absolute 
> path.

AFAIU, install is always relative the the install prefix 
, so 
there should be no difference?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[PATCH] D101491: [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` suffix.

2021-04-29 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 accepted this revision.
jansvoboda11 added a comment.

In D101491#2724025 , @delcypher wrote:

> @jansvoboda11 Should I use the the alias feature so that the old 
> `-fsanitize-address-destructor-kind` argument is still parsed? I'm not sure 
> if it's worth it but if doing so is very simple and has a low maintenance 
> burden we should probably do it.

I'm fine with omitting the alias if the original flag didn't make it into a 
release and it's unlikely that downstream TOT users are using it.




Comment at: clang/include/clang/Driver/Options.td:1542
   Group;
 def sanitize_address_destructor_kind_EQ
+: Joined<["-"], "fsanitize-address-destructor=">,

Nit: remove `_kind` from the def name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101491

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


[PATCH] D101526: [analyzer][StdLibraryFunctionsChecker] Add NoteTags for applied arg constraints

2021-04-29 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision.
martong added reviewers: vsavchenko, NoQ, steakhal.
Herald added subscribers: ASDenysPetrov, gamesh411, dkrupp, donat.nagy, 
Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, 
xazax.hun, whisperity.
Herald added a reviewer: Szelethus.
martong requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In this patch I add a new NoteTag for each applied argument constraint.
This way, any other checker that reports a bug - where the applied
constraint is relevant - will display the corresponding note. With this
change we provide more information for the users to understand some
bug reports easier.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101526

Files:
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/test/Analysis/std-c-library-functions-arg-constraints-note-tags.cpp
  clang/test/Analysis/std-c-library-functions-arg-constraints.c

Index: clang/test/Analysis/std-c-library-functions-arg-constraints.c
===
--- clang/test/Analysis/std-c-library-functions-arg-constraints.c
+++ clang/test/Analysis/std-c-library-functions-arg-constraints.c
@@ -39,6 +39,7 @@
 
 void test_alnum_symbolic(int x) {
   int ret = isalnum(x);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should be within the range [[-1, -1], [0, 255]]}}
   (void)ret;
 
   clang_analyzer_eval(EOF <= x && x <= 255); // \
@@ -79,6 +80,7 @@
 
 void test_toupper_symbolic(int x) {
   int ret = toupper(x);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should be within the range [[-1, -1], [0, 255]]}}
   (void)ret;
 
   clang_analyzer_eval(EOF <= x && x <= 255); // \
@@ -119,6 +121,7 @@
 
 void test_tolower_symbolic(int x) {
   int ret = tolower(x);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should be within the range [[-1, -1], [0, 255]]}}
   (void)ret;
 
   clang_analyzer_eval(EOF <= x && x <= 255); // \
@@ -159,6 +162,7 @@
 
 void test_toascii_symbolic(int x) {
   int ret = toascii(x);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should be within the range [[-1, -1], [0, 255]]}}
   (void)ret;
 
   clang_analyzer_eval(EOF <= x && x <= 255); // \
@@ -198,6 +202,9 @@
 }
 void test_notnull_symbolic(FILE *fp, int *buf) {
   fread(buf, sizeof(int), 10, fp);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should not be NULL}}
+  // bugpath-note@-2{{Applied constraint: The 4th arg should not be NULL}}
+  // bugpath-note@-3{{Applied constraint: The size of the 1st arg should be equal to or less than the value of the 2nd arg times the 3rd arg}}
   clang_analyzer_eval(buf != 0); // \
   // report-warning{{TRUE}} \
   // bugpath-warning{{TRUE}} \
@@ -238,6 +245,12 @@
   // State split should not happen here. I.e. x == 1 should not be evaluated
   // FALSE.
   __two_constrained_args(x, y);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should be within the range [1, 1]}}
+  // bugpath-note@-2{{Applied constraint: The 2nd arg should be within the range [1, 1]}}
+  //NOTE! Because of the second `clang_analyzer_eval` call we have two bug
+  //reports, thus the 'Applied constraint' notes appear twice.
+  // bugpath-note@-5{{Applied constraint: The 1st arg should be within the range [1, 1]}}
+  // bugpath-note@-6{{Applied constraint: The 2nd arg should be within the range [1, 1]}}
   clang_analyzer_eval(x == 1); // \
   // report-warning{{TRUE}} \
   // bugpath-warning{{TRUE}} \
@@ -251,6 +264,8 @@
 int __arg_constrained_twice(int);
 void test_multiple_constraints_on_same_arg(int x) {
   __arg_constrained_twice(x);
+  // bugpath-note@-1{{The 1st arg should be out of the range [1, 1]}}
+  // bugpath-note@-2{{The 1st arg should be out of the range [2, 2]}}
   // Check that both constraints are applied and only one branch is there.
   clang_analyzer_eval(x < 1 || x > 2); // \
   // report-warning{{TRUE}} \
@@ -283,6 +298,7 @@
 void test_buf_size_symbolic(int s) {
   char buf[3];
   __buf_size_arg_constraint(buf, s);
+  // bugpath-note@-1{{The size of the 1st arg should be equal to or less than the value of the 2nd arg}}
   clang_analyzer_eval(s <= 3); // \
   // report-warning{{TRUE}} \
   // bugpath-warning{{TRUE}} \
@@ -292,6 +308,7 @@
 void test_buf_size_symbolic_and_offset(int s) {
   char buf[3];
   __buf_size_arg_constraint(buf + 1, s);
+  // bugpath-note@-1{{The size of the 1st arg should be equal to or less than the value of the 2nd arg}}
   clang_analyzer_eval(s <= 2); // \
   // report-warning{{TRUE}} \
   // bugpath-warning{{TRUE}} \
@@ -312,6 +329,7 @@
 void test_buf_size_symbolic_with_multiplication(size_t s) {
   short buf[3];
   __buf_size_arg_constraint_mul(buf, s, sizeof(short));
+  // bugpath-note@-1{{The size of the 1st arg should be equal to or less than the value of the 2nd arg times the 3rd arg}}
   clang_analyzer_eval(s * sizeof(short) <= 6); // \
   // report-warning{{TRUE}} \
   // bugpat

[PATCH] D101462: Make it possible for targets to define their own MCObjectFileInfo

2021-04-29 Thread Philipp Krones via Phabricator via cfe-commits
flip1995 added a comment.

Thanks for the review! I already thought that I will have to split this up, so 
I made the commits self contained so I'll do that. One question before I start:

Where should I split this? Should I only split out the RISC-V patch and leave 
the changes that targets can define their own `MCObjectFileInfo` in (commit 
a1b3a604a410), or should I also split out that part? Personally I would keep 
this change in the refactor PR and only split out the RISC-V changes.

---

About the alignment change: I guess we can discuss this then specifically for 
RISC-V in the split out review. But the short answer is: The main motivation is 
improving code size a bit, since less padding has to be added between 
functions. If function alignment is important `-align-all-functions=X` could be 
used.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101462

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


[PATCH] D99488: [SYCL][Doc] Add design document for SYCL mode

2021-04-29 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

If I build docs now I get the following output:

  llvm-project/build-doc/tools/clang/docs/SYCLSupport.rst:102: WARNING: Error 
in "code-block" directive:
  1 argument(s) required, 0 supplied.
  
  .. code-block::
  
 TODO: add support for `__attribute__((opencl_global_host))` and
 `__attribute__((opencl_global_device))`.

Is this something already being looked at?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99488

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


[clang] 8fb0d6d - [OpenCL][Docs] Describe extension for legacy atomics with generic addr space.

2021-04-29 Thread Anastasia Stulova via cfe-commits

Author: Anastasia Stulova
Date: 2021-04-29T14:02:34+01:00
New Revision: 8fb0d6df11e4d2b4a534c96fcc1b55459940151e

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

LOG: [OpenCL][Docs] Describe extension for legacy atomics with generic addr 
space.

This extension is primarily targeting SPIR-V compilations flow
as the IR translation is the same between 1.x and 2.x atomics.

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

Added: 


Modified: 
clang/docs/LanguageExtensions.rst

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 00759113775d4..5e5382879e0c8 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1813,6 +1813,23 @@ supporting the variadic arguments e.g. majority of CPU 
targets.
   #pragma OPENCL EXTENSION __cl_clang_variadic_functions : disable
   void bar(int a, ...); // error - variadic prototype is not allowed
 
+Legacy 1.x atomics with generic address space
+-
+
+Clang allows use of atomic functions from the OpenCL 1.x standards
+with the generic address space pointer in C++ for OpenCL mode.
+
+This is a non-portable feature and might not be supported by all
+targets.
+
+**Example of Use**:
+
+.. code-block:: c++
+
+  void foo(__generic volatile unsigned int* a) {
+atomic_add(a, 1);
+  }
+
 Builtin Functions
 =
 



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


[PATCH] D101089: [OpenCL] Document legacy atomics with generic address space

2021-04-29 Thread Anastasia Stulova via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8fb0d6df11e4: [OpenCL][Docs] Describe extension for legacy 
atomics with generic addr space. (authored by Anastasia).
Herald added a subscriber: ldrumm.
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D101089?vs=339711&id=341493#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101089

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -1813,6 +1813,23 @@
   #pragma OPENCL EXTENSION __cl_clang_variadic_functions : disable
   void bar(int a, ...); // error - variadic prototype is not allowed
 
+Legacy 1.x atomics with generic address space
+-
+
+Clang allows use of atomic functions from the OpenCL 1.x standards
+with the generic address space pointer in C++ for OpenCL mode.
+
+This is a non-portable feature and might not be supported by all
+targets.
+
+**Example of Use**:
+
+.. code-block:: c++
+
+  void foo(__generic volatile unsigned int* a) {
+atomic_add(a, 1);
+  }
+
 Builtin Functions
 =
 


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -1813,6 +1813,23 @@
   #pragma OPENCL EXTENSION __cl_clang_variadic_functions : disable
   void bar(int a, ...); // error - variadic prototype is not allowed
 
+Legacy 1.x atomics with generic address space
+-
+
+Clang allows use of atomic functions from the OpenCL 1.x standards
+with the generic address space pointer in C++ for OpenCL mode.
+
+This is a non-portable feature and might not be supported by all
+targets.
+
+**Example of Use**:
+
+.. code-block:: c++
+
+  void foo(__generic volatile unsigned int* a) {
+atomic_add(a, 1);
+  }
+
 Builtin Functions
 =
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1ed6e87 - [OpenCL][Docs] Misc updates to C++ for OpenCL and offline compilation

2021-04-29 Thread Anastasia Stulova via cfe-commits

Author: Anastasia Stulova
Date: 2021-04-29T14:15:07+01:00
New Revision: 1ed6e87ab02db4fb9379b80c820bebad9869aa4d

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

LOG: [OpenCL][Docs] Misc updates to C++ for OpenCL and offline compilation

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

Added: 


Modified: 
clang/docs/OpenCLSupport.rst
clang/docs/UsersManual.rst

Removed: 




diff  --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst
index 0d5774091fb6..5bde2c332022 100644
--- a/clang/docs/OpenCLSupport.rst
+++ b/clang/docs/OpenCLSupport.rst
@@ -334,17 +334,9 @@ to view the full bug list.
 Missing features or with limited support
 
 
-- Use of ObjC blocks is disabled and therefore the ``enqueue_kernel`` builtin
-  function is not supported currently. It is expected that if support for this
-  feature is added in the future, it will utilize C++ lambdas instead of ObjC
-  blocks.
-
 - IR generation for global destructors is incomplete (See:
   `PR48047 `_).
 
-- There is no distinct file extension for sources that are to be compiled
-  in C++ for OpenCL mode (See: `PR48097 `_)
-
 .. _opencl_300:
 
 OpenCL 3.0 Implementation Status

diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index ec521155a7f7..f84c4eceebb9 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -2927,7 +2927,7 @@ tools as well as open source tools such as `SPIRV-LLVM 
Translator
 to produce SPIR-V binary. More details are provided in `the offline
 compilation from OpenCL kernel sources into SPIR-V using open source
 tools
-`_.
+`_.
 
 Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
 supports full profile. There is only very limited support of the embedded



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


[PATCH] D101092: [OpenCL][Docs] Misc updates about C++ for OpenCL and offline compilation

2021-04-29 Thread Anastasia Stulova via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ed6e87ab02d: [OpenCL][Docs] Misc updates to C++ for OpenCL 
and offline compilation (authored by Anastasia).
Herald added a subscriber: ldrumm.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101092

Files:
  clang/docs/OpenCLSupport.rst
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -2927,7 +2927,7 @@
 to produce SPIR-V binary. More details are provided in `the offline
 compilation from OpenCL kernel sources into SPIR-V using open source
 tools
-`_.
+`_.
 
 Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
 supports full profile. There is only very limited support of the embedded
Index: clang/docs/OpenCLSupport.rst
===
--- clang/docs/OpenCLSupport.rst
+++ clang/docs/OpenCLSupport.rst
@@ -334,17 +334,9 @@
 Missing features or with limited support
 
 
-- Use of ObjC blocks is disabled and therefore the ``enqueue_kernel`` builtin
-  function is not supported currently. It is expected that if support for this
-  feature is added in the future, it will utilize C++ lambdas instead of ObjC
-  blocks.
-
 - IR generation for global destructors is incomplete (See:
   `PR48047 `_).
 
-- There is no distinct file extension for sources that are to be compiled
-  in C++ for OpenCL mode (See: `PR48097 `_)
-
 .. _opencl_300:
 
 OpenCL 3.0 Implementation Status


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -2927,7 +2927,7 @@
 to produce SPIR-V binary. More details are provided in `the offline
 compilation from OpenCL kernel sources into SPIR-V using open source
 tools
-`_.
+`_.
 
 Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
 supports full profile. There is only very limited support of the embedded
Index: clang/docs/OpenCLSupport.rst
===
--- clang/docs/OpenCLSupport.rst
+++ clang/docs/OpenCLSupport.rst
@@ -334,17 +334,9 @@
 Missing features or with limited support
 
 
-- Use of ObjC blocks is disabled and therefore the ``enqueue_kernel`` builtin
-  function is not supported currently. It is expected that if support for this
-  feature is added in the future, it will utilize C++ lambdas instead of ObjC
-  blocks.
-
 - IR generation for global destructors is incomplete (See:
   `PR48047 `_).
 
-- There is no distinct file extension for sources that are to be compiled
-  in C++ for OpenCL mode (See: `PR48097 `_)
-
 .. _opencl_300:
 
 OpenCL 3.0 Implementation Status
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99488: [SYCL][Doc] Add design document for SYCL mode

2021-04-29 Thread Alexey Bader via Phabricator via cfe-commits
bader added a comment.

In D99488#2725435 , @Anastasia wrote:

> If I build docs now I get the following output:
>
>   llvm-project/build-doc/tools/clang/docs/SYCLSupport.rst:102: WARNING: Error 
> in "code-block" directive:
>   1 argument(s) required, 0 supplied.
>   
>   .. code-block::
>   
>  TODO: add support for `__attribute__((opencl_global_host))` and
>  `__attribute__((opencl_global_device))`.
>
> Is this something already being looked at?

It looks like it can be fixed by adding language parameter:

> .. code-block:: c++

Unfortunately, I can't verify this fix locally. I see other types of warnings, 
which are treated as errors.

tools/clang/docs/ClangCommandLineReference.rst:22:Duplicate explicit target 
name: "cmdoption-clang--prefix".

Does anyone know how to avoid this issue?
If no, @Anastasia, could you confirm that adding `c++` parameter fixes the 
warning, please? If it does, I can commit this fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99488

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


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

2021-04-29 Thread Chirag Khandelwal via Phabricator via cfe-commits
AMDChirag updated this revision to Diff 341503.
AMDChirag added a comment.

Rebase to retrigger build

The build failed previously - seemingly with a test case that has nothing to do 
with this patch.
Retriggering and Rebasing the commit to ensure the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91054

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/cancel_codegen.cpp

Index: clang/test/OpenMP/cancel_codegen.cpp
===
--- clang/test/OpenMP/cancel_codegen.cpp
+++ clang/test/OpenMP/cancel_codegen.cpp
@@ -1,28 +1,27 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,CHECK
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,CHECK
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.0 %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t.0 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP
 
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,IRBUILDER
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP_IRB
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.1 %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t.1 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP_IRB
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
-// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP_SIMD
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.2 %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t.2 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP_SIMD
 
-// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,CHECK
-// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,CHECK
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.3 %s
+// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t.3 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP
 
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,IRBUILDER
-// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder 

[PATCH] D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check

2021-04-29 Thread Fabian Thurnheer via Phabricator via cfe-commits
DNS320 updated this revision to Diff 341492.
DNS320 marked 7 inline comments as done.
DNS320 added a comment.

I updated the check according to the last review.
The check should now fully implement the defined enforcement chapter from the 
ES.74 C++ Core Guideline.

About searching for declRefExpr outside the for statement:
I limited the search to the next ancestor compoundStmt of the varDecl, so the 
Visitor must not traverse the whole translation unit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100092

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  
clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.cpp
  
clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-declare-loop-variable-in-the-initializer.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-declare-loop-variable-in-the-initializer.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-declare-loop-variable-in-the-initializer.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-declare-loop-variable-in-the-initializer.cpp
@@ -0,0 +1,79 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-declare-loop-variable-in-the-initializer %t
+
+const int Limit{10};
+
+void func1() {
+  // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: Variable 'A' is only modified in a for statement and not used elsewhere. Consider declaring it inside the for statement. [cppcoreguidelines-declare-loop-variable-in-the-initializer]
+  // CHECK-MESSAGES: :11:5: note: Variable gets modified here
+  int A{0};
+
+  for (int I{0}; I < Limit; I++) {
+A = 3;
+  }
+}
+
+void func2() {
+  // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: Variable 'A' is only modified in a for statement and not used elsewhere. Consider declaring it inside the for statement. [cppcoreguidelines-declare-loop-variable-in-the-initializer]
+  // CHECK-MESSAGES: :21:5: note: Variable gets modified here
+  int A{0};
+
+  for (int I{0}; I < Limit; I++) {
+A += 3;
+  }
+}
+
+void func3() {
+  // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: Variable 'I' is only modified in a for statement and not used elsewhere. Consider declaring it inside the for statement. [cppcoreguidelines-declare-loop-variable-in-the-initializer]
+  // CHECK-MESSAGES: :30:8: note: Variable gets modified here
+  int I{0};
+
+  for (I = 1; I < Limit; I++) {
+  }
+}
+
+void func4() {
+  // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: Variable 'I' is only modified in a for statement and not used elsewhere. Consider declaring it inside the for statement. [cppcoreguidelines-declare-loop-variable-in-the-initializer]
+  // CHECK-MESSAGES: :39:21: note: Variable gets modified here
+  int I{0};
+
+  for (; I < Limit; I++) {
+  }
+}
+
+void func5() {
+  // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: Variable 'I' is only modified in a for statement and not used elsewhere. Consider declaring it inside the for statement. [cppcoreguidelines-declare-loop-variable-in-the-initializer]
+  // CHECK-MESSAGES: :48:34: note: Variable gets modified here
+  int I{0};
+
+  for (int Unused{0}; I < Limit; I++) {
+  }
+}
+
+void func6() {
+  // CHECK-MESSAGES: :[[@LINE+2]]:7: warning: Variable 'I' is only modified in a for statement and not used elsewhere. Consider declaring it inside the for statement. [cppcoreguidelines-declare-loop-variable-in-the-initializer]
+  // CHECK-MESSAGES: :58:8: note: Variable gets modified here
+  int I{0};
+  int Z{0};
+
+  for (I = 3; I < Limit; I++) {
+  }
+  Z = 3;
+}
+
+void func7() {
+  // OK
+  int A{0};
+
+  for (int I{0}; I < Limit; I++) {
+const int B{A};
+  }
+}
+
+void func8() {
+  // OK
+  int I{0};
+
+  for (I = 0; I < Limit; I++) {
+  }
+  const int A{I};
+}
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -143,6 +143,7 @@
`concurrency-thread-canceltype-asynchronous `_,
`cppcoreguidelines-avoid-goto `_,
`cppcoreguidelines-avoid-non-const-global-variables `_,
+   `cppcoreguidelines-declare-loop-variable-in-the-initializer `_,
`cppcoreguidelines-init-variables `_, "Yes"
`cppcoreguidelines-interfaces-global-init `_,
`cppcoreguidelines-macro-usage `_,
Index: clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-declare-loop-variable-in-the-initializer.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks

[PATCH] D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check

2021-04-29 Thread Fabian Thurnheer via Phabricator via cfe-commits
DNS320 added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.cpp:28
+
+  diag(MatchedForStmt->getBeginLoc(),
+   "Prefer to declare a loop variable in the initializer part of a "

Eugene.Zelenko wrote:
> It'll be reasonable to add add note with actual variable declaration.
The hole check was refactored. A diagnostic hint points now to the statement 
which modifies the variable.




Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.h:1
+//===--- DeclareLoopVariableInTheInitializerCheck.h - clang-tidy *- C++ 
-*-===//
+//

Eugene.Zelenko wrote:
> I may be mistaken, but proper code is `-*- C++ -*-`. Please remove  dash at 
> left side.
Thanks. I checked other header files with long names. I correct it this way, to 
match the other ones:
```
//===--- DeclareLoopVariableInTheInitializerCheck.h - clang-tidy-*- C++ -*-===//
//===--- ProBoundsArrayToPointerDecayCheck.h - clang-tidy*- C++ -*-===//
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100092

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


[PATCH] D101168: [C++4OpenCL] Add clang extension for non-portable kernel parameters

2021-04-29 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:1808
+With this extension it is possible to enable the use of some restricted types 
in kernel parameters.
+The restrictions can be relaxed using regular OpenCL extension pragma mechanism
+detailed in `the OpenCL Extension Specification, section 1.2

Let's add references to relevant OpenCL C and C++ for OpenCL sections with 
restrictions.



Comment at: clang/docs/LanguageExtensions.rst:1818
+.. code-block:: c++
+  // Is POD because it is Plain Old Data
+  struct Pod {





Comment at: clang/docs/LanguageExtensions.rst:1824
+
+  // Not POD because of the constructor
+  // Is standard layout because there is only one access control





Comment at: clang/docs/LanguageExtensions.rst:1824
+
+  // Not POD because of the constructor
+  // Is standard layout because there is only one access control

Anastasia wrote:
> 
Let's add `.` at the end of every sentance. :)



Comment at: clang/docs/LanguageExtensions.rst:1825
+  // Not POD because of the constructor
+  // Is standard layout because there is only one access control
+  struct OnlySL {





Comment at: clang/docs/LanguageExtensions.rst:1832
+
+  // Not standard layout because of two different access control
+  struct NotSL {




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

https://reviews.llvm.org/D101168

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


[PATCH] D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check

2021-04-29 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareLoopVariableInTheInitializerCheck.cpp:37
+  bool VisitDeclRefExpr(DeclRefExpr *D) {
+if (const VarDecl *To = dyn_cast(D->getDecl())) {
+  if (To == MatchedDecl &&

`const auto*` could be used because type is spelled in same statement.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100092

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


[clang] 3eb2be6 - Unbreak no-asserts testing

2021-04-29 Thread David Zarzycki via cfe-commits

Author: David Zarzycki
Date: 2021-04-29T10:01:37-04:00
New Revision: 3eb2be67b997ea62f47dbe90a62e828ecfb266a8

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

LOG: Unbreak no-asserts testing

Added: 


Modified: 
clang/test/Driver/debug-pass-structure.c

Removed: 




diff  --git a/clang/test/Driver/debug-pass-structure.c 
b/clang/test/Driver/debug-pass-structure.c
index 7e1d748ad847..30283249f412 100644
--- a/clang/test/Driver/debug-pass-structure.c
+++ b/clang/test/Driver/debug-pass-structure.c
@@ -1,6 +1,7 @@
 // Test that we print pass structure with new and legacy PM.
 // RUN: %clang -fexperimental-new-pass-manager -fdebug-pass-structure -O3 -S 
-emit-llvm %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=NEWPM
 // RUN: %clang -flegacy-pass-manager -fdebug-pass-structure -O0 -S -emit-llvm 
%s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LEGACYPM
+// REQUIRES: asserts
 
 // NEWPM: Annotation2MetadataPass on [module]
 // NEWPM-NEXT: ForceFunctionAttrsPass on [module]



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


[clang] c204106 - [Clang][OpenMP] Frontend work for sections - D89671

2021-04-29 Thread Chirag Khandelwal via cfe-commits

Author: Chirag Khandelwal
Date: 2021-04-29T19:52:27+05:30
New Revision: c20410618827b7870fbc86d45ff8e9b11bc169b4

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

LOG: [Clang][OpenMP] Frontend work for sections - D89671

This patch is child of D89671, contains the clang
implementation to use the OpenMP IRBuilder's section
construct.

Co-author: @anchu-rajendran

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/test/OpenMP/cancel_codegen.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 0a408837d1c6a..a3c7365fafd87 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1205,7 +1205,7 @@ namespace {
 // Builder if one is present.
 struct PushAndPopStackRAII {
   PushAndPopStackRAII(llvm::OpenMPIRBuilder *OMPBuilder, CodeGenFunction &CGF,
-  bool HasCancel)
+  bool HasCancel, llvm::omp::Directive Kind)
   : OMPBuilder(OMPBuilder) {
 if (!OMPBuilder)
   return;
@@ -1234,8 +1234,7 @@ struct PushAndPopStackRAII {
 
 // TODO: Remove this once we emit parallel regions through the
 //   OpenMPIRBuilder as it can do this setup internally.
-llvm::OpenMPIRBuilder::FinalizationInfo FI(
-{FiniCB, OMPD_parallel, HasCancel});
+llvm::OpenMPIRBuilder::FinalizationInfo FI({FiniCB, Kind, HasCancel});
 OMPBuilder->pushFinalizationCB(std::move(FI));
   }
   ~PushAndPopStackRAII() {
@@ -1276,7 +1275,7 @@ static llvm::Function 
*emitParallelOrTeamsOutlinedFunction(
   // TODO: Temporarily inform the OpenMPIRBuilder, if any, about the new
   //   parallel region to make cancellation barriers work properly.
   llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
-  PushAndPopStackRAII PSR(&OMPBuilder, CGF, HasCancel);
+  PushAndPopStackRAII PSR(&OMPBuilder, CGF, HasCancel, InnermostKind);
   CGOpenMPOutlinedRegionInfo CGInfo(*CS, ThreadIDVar, CodeGen, InnermostKind,
 HasCancel, OutlinedHelperName);
   CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(CGF, &CGInfo);

diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 7d8744651a4ee..83d3dd0fc813c 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3791,6 +3791,64 @@ void CodeGenFunction::EmitSections(const 
OMPExecutableDirective &S) {
 }
 
 void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
+  if (CGM.getLangOpts().OpenMPIRBuilder) {
+llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
+using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
+using BodyGenCallbackTy = llvm::OpenMPIRBuilder::StorableBodyGenCallbackTy;
+
+auto FiniCB = [this](InsertPointTy IP) {
+  OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP);
+};
+
+const CapturedStmt *ICS = S.getInnermostCapturedStmt();
+const Stmt *CapturedStmt = S.getInnermostCapturedStmt()->getCapturedStmt();
+const auto *CS = dyn_cast(CapturedStmt);
+llvm::SmallVector SectionCBVector;
+if (CS) {
+  for (const Stmt *SubStmt : CS->children()) {
+auto SectionCB = [this, SubStmt](InsertPointTy AllocaIP,
+ InsertPointTy CodeGenIP,
+ llvm::BasicBlock &FiniBB) {
+  OMPBuilderCBHelpers::InlinedRegionBodyRAII IRB(*this, AllocaIP,
+ FiniBB);
+  OMPBuilderCBHelpers::EmitOMPRegionBody(*this, SubStmt, CodeGenIP,
+ FiniBB);
+};
+SectionCBVector.push_back(SectionCB);
+  }
+} else {
+  auto SectionCB = [this, CapturedStmt](InsertPointTy AllocaIP,
+InsertPointTy CodeGenIP,
+llvm::BasicBlock &FiniBB) {
+OMPBuilderCBHelpers::InlinedRegionBodyRAII IRB(*this, AllocaIP, 
FiniBB);
+OMPBuilderCBHelpers::EmitOMPRegionBody(*this, CapturedStmt, CodeGenIP,
+   FiniBB);
+  };
+  SectionCBVector.push_back(SectionCB);
+}
+
+// Privatization callback that performs appropriate action for
+// shared/private/firstprivate/lastprivate/copyin/... variables.
+//
+// TODO: This defaults to shared right now.
+auto PrivCB = [](InsertPointTy AllocaIP, InsertPointTy CodeGenIP,
+ llvm::Value &, llvm::Value &Val, llvm::Value *&ReplVal) {
+  // The next 

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

2021-04-29 Thread Chirag Khandelwal via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc20410618827: [Clang][OpenMP] Frontend work for sections - 
D89671 (authored by AMDChirag).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91054

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/cancel_codegen.cpp

Index: clang/test/OpenMP/cancel_codegen.cpp
===
--- clang/test/OpenMP/cancel_codegen.cpp
+++ clang/test/OpenMP/cancel_codegen.cpp
@@ -1,28 +1,27 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,CHECK
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,CHECK
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.0 %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t.0 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP
 
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,IRBUILDER
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP_IRB
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.1 %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t.1 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP_IRB
 
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
-// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP_SIMD
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.2 %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t.2 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP_SIMD
 
-// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,CHECK
-// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,CHECK
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=OMP
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.3 %s
+// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t.3 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=OMP
 
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefixes=ALL,IRBUILDER
-// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-d

[PATCH] D101526: [analyzer][StdLibraryFunctionsChecker] Add NoteTags for applied arg constraints

2021-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments.



Comment at: 
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:836-837
+  NewState, NewNode,
+  C.getNoteTag([Msg](PathSensitiveBugReport &BR,
+ llvm::raw_ostream &OS) { OS << Msg; }));
 }

This way each and every applied constraint will be displayed even if the given 
argument does not constitute to the bug condition.
I recommend you branching within the lambda, on the interestingness of the 
given argument constraint.



Comment at: 
clang/test/Analysis/std-c-library-functions-arg-constraints.c:247-254
   __two_constrained_args(x, y);
+  // bugpath-note@-1{{Applied constraint: The 1st arg should be within the 
range [1, 1]}}
+  // bugpath-note@-2{{Applied constraint: The 2nd arg should be within the 
range [1, 1]}}
+  //NOTE! Because of the second `clang_analyzer_eval` call we have two bug
+  //reports, thus the 'Applied constraint' notes appear twice.
+  // bugpath-note@-5{{Applied constraint: The 1st arg should be within the 
range [1, 1]}}
+  // bugpath-note@-6{{Applied constraint: The 2nd arg should be within the 
range [1, 1]}}

nit.
BTW I raised my related concerns about this elsewhere.



Comment at: 
clang/test/Analysis/std-c-library-functions-arg-constraints.c:264-276
 int __arg_constrained_twice(int);
 void test_multiple_constraints_on_same_arg(int x) {
   __arg_constrained_twice(x);
+  // bugpath-note@-1{{The 1st arg should be out of the range [1, 1]}}
+  // bugpath-note@-2{{The 1st arg should be out of the range [2, 2]}}
   // Check that both constraints are applied and only one branch is there.
   clang_analyzer_eval(x < 1 || x > 2); // \

I was puzzled for a moment on why do you have two notes here.
By checking the definition of `__arg_constrained_twice()`, I can see that it 
has **two** `ArgConstraint`s.

Although, it shouldn't be a problem as on the UI we would visualize notes for 
only a single bugreport. So it is probably clear that both of the notes are 
valid and correspond to the given statement. It might look clunky in the LIT 
test, but should be 'somewhat' readable in real life.

You should take no action here. I leave this comment just for the record.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101526

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


[PATCH] D101389: [clang][CodeGen] Fix address space for sret

2021-04-29 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl abandoned this revision.
yaxunl added a comment.

In D101389#2724757 , @rjmccall wrote:

> In D101389#2724700 , @yaxunl wrote:
>
>> In D101389#2724636 , @rjmccall 
>> wrote:
>>
>>> I think this is intentional; requiring the indirect-result parameter to be 
>>> in the alloca address space would prevent direct initialization of 
>>> non-temporary memory, which is an important optimization in C++.
>>
>> You mean situations like this? https://godbolt.org/z/KnPs6znK8
>>
>> Address of a global variable is directly passed as the sret arg to the 
>> function returning a struct, instead of creating a temporary struct variable 
>> and passing its address as the sret arg?
>
> That's one specific case of copy-elision, but there are others, e.g.: 
> https://godbolt.org/z/boTeMseaM
>
> I suppose you could disable general copy-elision.  But don't you have 
> aggressive optimizations to strength-reduce generic pointer operations?

Thanks for the example. I agree that sret should be in default addr space.


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

https://reviews.llvm.org/D101389

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


[PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.

2021-04-29 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 added inline comments.



Comment at: polly/cmake/CMakeLists.txt:104-110
+set(tgt_prefix "${CMAKE_INSTALL_FULL_BINDIR}/")
   else()
-set(tgt_prefix "lib/")
+set(tgt_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/")
   endif()
 
-  set(tgt_path 
"${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
+  set(tgt_path "${tgt_prefix}$")
   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})

@Meinersbur the change was here. I did indeed get an error because this stuff 
prior to installing did in fact need an absolute path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99484

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


[PATCH] D101168: [C++4OpenCL] Add clang extension for non-portable kernel parameters

2021-04-29 Thread Ole Strohm via Phabricator via cfe-commits
olestrohm updated this revision to Diff 341526.
olestrohm set the repository for this revision to rG LLVM Github Monorepo.
olestrohm added a comment.

Added a link to the C++ for OpenCL specification and cleaned up the text 
according to the requests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101168

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/OpenCLExtensions.def
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Basic/Targets/NVPTX.h
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Misc/amdgcn.languageOptsOpenCL.cl
  clang/test/Misc/nvptx.languageOptsOpenCL.cl
  clang/test/Misc/r600.languageOptsOpenCL.cl
  clang/test/SemaOpenCLCXX/invalid-kernel.clcpp

Index: clang/test/SemaOpenCLCXX/invalid-kernel.clcpp
===
--- clang/test/SemaOpenCLCXX/invalid-kernel.clcpp
+++ clang/test/SemaOpenCLCXX/invalid-kernel.clcpp
@@ -1,4 +1,9 @@
-// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only
+// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only -triple spir-unknown-unknown
+// RUN: %clang_cc1 %s -pedantic -verify -fsyntax-only -triple spir-unknown-unknown -DUNSAFEKERNELPARAMETER
+
+#ifdef UNSAFEKERNELPARAMETER
+#pragma OPENCL EXTENSION __cl_clang_non_portable_kernel_parameters : enable
+#endif
 
 struct C {
   kernel void m(); //expected-error{{kernel functions cannot be class members}}
@@ -24,8 +29,10 @@
 kernel void int_p_r(__global int *__global &in);
 kernel void int_p_p_r(__global int *__global *__global &in);
 
-// expected-error@+1{{'__private atomic_int' (aka '__private _Atomic(int)') cannot be used as the type of a kernel parameter}}
 kernel void k_atomic_v(atomic_int in);
+#ifndef UNSAFEKERNELPARAMETER
+// expected-error@-2{{'__private atomic_int' (aka '__private _Atomic(int)') cannot be used as the type of a kernel parameter}}
+#endif
 kernel void k_atomic_p(__global atomic_int *in);
 kernel void k_atomic_r(__global atomic_int &in);
 
@@ -56,7 +63,10 @@
   StandardLayout(int a, int b) : a(a), b(b) {}
 };
 
-kernel void standard_v(StandardLayout in) {} //expected-error{{'__private StandardLayout' cannot be used as the type of a kernel parameter}}
+kernel void standard_v(StandardLayout in) {}
+#ifndef UNSAFEKERNELPARAMETER
+//expected-error@-2{{'__private StandardLayout' cannot be used as the type of a kernel parameter}}
+#endif
 kernel void standard_p(__global StandardLayout *in) {}
 kernel void standard_p_p(__global StandardLayout *__global *in) {}
 kernel void standard_r(__global StandardLayout &in) {}
@@ -67,7 +77,19 @@
   int b;
 };
 
-kernel void trivial_v(Trivial in) {} //expected-error{{'__private Trivial' cannot be used as the type of a kernel parameter}}
-kernel void trivial_p(__global Trivial *in) {} //expected-error{{'__global Trivial *__private' cannot be used as the type of a kernel parameter}}
-kernel void trivial_p_p(__global Trivial *__global *in) {} //expected-error{{'__global Trivial *__global *__private' cannot be used as the type of a kernel parameter}}
-kernel void trivial_r(__global Trivial &in) {} //expected-error{{'__global Trivial &__private' cannot be used as the type of a kernel parameter}}
+kernel void trivial_v(Trivial in) {}
+#ifndef UNSAFEKERNELPARAMETER
+//expected-error@-2{{'__private Trivial' cannot be used as the type of a kernel parameter}}
+#endif
+kernel void trivial_p(__global Trivial *in) {}
+#ifndef UNSAFEKERNELPARAMETER
+//expected-error@-2{{'__global Trivial *__private' cannot be used as the type of a kernel parameter}}
+#endif
+kernel void trivial_p_p(__global Trivial *__global *in) {}
+#ifndef UNSAFEKERNELPARAMETER
+//expected-error@-2{{'__global Trivial *__global *__private' cannot be used as the type of a kernel parameter}}
+#endif
+kernel void trivial_r(__global Trivial &in) {}
+#ifndef UNSAFEKERNELPARAMETER
+//expected-error@-2{{'__global Trivial &__private' cannot be used as the type of a kernel parameter}}
+#endif
Index: clang/test/Misc/r600.languageOptsOpenCL.cl
===
--- clang/test/Misc/r600.languageOptsOpenCL.cl
+++ clang/test/Misc/r600.languageOptsOpenCL.cl
@@ -34,6 +34,11 @@
 #endif
 #pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable
 
+#ifndef __cl_clang_non_portable_kernel_parameters
+#error "Missing __cl_clang_non_portable_kernel_parameters define"
+#endif
+#pragma OPENCL EXTENSION __cl_clang_non_portable_kernel_parameters : enable
+
 #ifdef cl_khr_fp16
 #error "Incorrect cl_khr_fp16 define"
 #endif
Index: clang/test/Misc/nvptx.languageOptsOpenCL.cl
===
--- clang/test/Misc/nvptx.languageOptsOpenCL.cl
+++ clang/test/Misc/nvptx.languageOptsOpenCL.cl
@@ -28,6 +28,11 @@
 #endif
 #pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable
 
+#ifndef __cl_clang_non_portable_kernel_parameters
+#error "Missing __cl_clang_non_portable_kernel_paramete

[PATCH] D101479: [Driver] Support libc++ in MSVC

2021-04-29 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

can you add a test for the linker invocation too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101479

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


[PATCH] D99488: [SYCL][Doc] Add design document for SYCL mode

2021-04-29 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In D99488#2725501 , @bader wrote:

> In D99488#2725435 , @Anastasia wrote:
>
>> If I build docs now I get the following output:
>>
>>   llvm-project/build-doc/tools/clang/docs/SYCLSupport.rst:102: WARNING: 
>> Error in "code-block" directive:
>>   1 argument(s) required, 0 supplied.
>>   
>>   .. code-block::
>>   
>>  TODO: add support for `__attribute__((opencl_global_host))` and
>>  `__attribute__((opencl_global_device))`.
>>
>> Is this something already being looked at?
>
> It looks like it can be fixed by adding language parameter:
>
>> .. code-block:: c++
>
> Unfortunately, I can't verify this fix locally. I see other types of 
> warnings, which are treated as errors.
>
> tools/clang/docs/ClangCommandLineReference.rst:22:Duplicate explicit target 
> name: "cmdoption-clang--prefix".
>
> Does anyone know how to avoid this issue?

I think you expected to get some bots failing. If not you can ask on `cfe-dev` 
perhaps...

I normally verify locally by building the docs e.g. `docs-clang-html` build 
target. It should catch the issues.

> If no, @Anastasia, could you confirm that adding `c++` parameter fixes the 
> warning, please? If it does, I can commit this fix.

With the following diff

  diff --git a/clang/docs/SYCLSupport.rst b/clang/docs/SYCLSupport.rst
  index 8c1ed19dff4e..b03dcfadafa5 100644
  --- a/clang/docs/SYCLSupport.rst
  +++ b/clang/docs/SYCLSupport.rst
  @@ -98,8 +98,7 @@ space attributes for pointers:
  * - ``__attribute__((opencl_private))``
- private_space
   
  -
  -.. code-block::
  +.. code-block:: C++
   
  TODO: add support for `__attribute__((opencl_global_host))` and
  `__attribute__((opencl_global_device))`.

I get

  llvm-project/build-doc/tools/clang/docs/SYCLSupport.rst:101: WARNING: Could 
not lex literal_block as "C++". Highlighting skipped.

But this seems to work

  diff --git a/clang/docs/SYCLSupport.rst b/clang/docs/SYCLSupport.rst
  index 8c1ed19dff4e..f714500300e1 100644
  --- a/clang/docs/SYCLSupport.rst
  +++ b/clang/docs/SYCLSupport.rst
  @@ -98,8 +98,6 @@ space attributes for pointers:
  * - ``__attribute__((opencl_private))``
- private_space
   
  +.. code-block:: C++
   
  -.. code-block::
  -
  -   TODO: add support for `__attribute__((opencl_global_host))` and
  -   `__attribute__((opencl_global_device))`.
  +//TODO: add support for __attribute__((opencl_global_host)) and 
__attribute__((opencl_global_device)).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99488

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


[PATCH] D91949: [clang-format] Add BeforeStructInitialization option in BraceWrapping configuration

2021-04-29 Thread Anastasiia Lukianenko via Phabricator via cfe-commits
anastasiia_lukianenko updated this revision to Diff 341537.

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

https://reviews.llvm.org/D91949

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -5069,6 +5069,78 @@
 format(Input, Style));
 }
 
+TEST_F(FormatTest, BreakBeforeStructInitialization) {
+  FormatStyle Style = getLLVMStyle();
+  Style.ColumnLimit = 80;
+  Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+  Style.BraceWrapping.BeforeStructInitialization = true;
+  Style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_No;
+  verifyFormat("struct new_struct struct_name =\n"
+   "{a = 1};",
+   Style);
+  verifyFormat("struct new_struct struct_name =\n"
+   "{a = 1, b = 2};",
+   Style);
+  verifyFormat("struct new_struct struct_name =\n"
+   "{\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("typedef struct Foo =\n"
+   "{\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("static constexpr struct Foo =\n"
+   "{\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("template <> struct Foo =\n"
+   "{\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("struct =\n"
+   "{\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  Style.BraceWrapping.BeforeStructInitialization = false;
+  verifyFormat("struct new_struct struct_name = {a = 1};", Style);
+  verifyFormat("struct new_struct struct_name = {a = 1, b = 2};", Style);
+  verifyFormat("struct new_struct struct_name = {\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("typedef struct Foo = {\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("static constexpr struct Foo = {\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("template <> struct Foo = {\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+  verifyFormat("struct = {\n"
+   "a = 1,\n"
+   "b = 2,\n"
+   "};",
+   Style);
+}
+
 TEST_F(FormatTest, BreakConstructorInitializersAfterColon) {
   FormatStyle Style = getLLVMStyle();
   Style.BreakConstructorInitializers = FormatStyle::BCIS_AfterColon;
@@ -16328,6 +16400,7 @@
   CHECK_PARSE_NESTED_BOOL(BraceWrapping, BeforeCatch);
   CHECK_PARSE_NESTED_BOOL(BraceWrapping, BeforeElse);
   CHECK_PARSE_NESTED_BOOL(BraceWrapping, BeforeLambdaBody);
+  CHECK_PARSE_NESTED_BOOL(BraceWrapping, BeforeStructInitialization);
   CHECK_PARSE_NESTED_BOOL(BraceWrapping, BeforeWhile);
   CHECK_PARSE_NESTED_BOOL(BraceWrapping, IndentBraces);
   CHECK_PARSE_NESTED_BOOL(BraceWrapping, SplitEmptyFunction);
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2702,7 +2702,11 @@
   nextToken();
 }
   }
-  if (FormatTok->Tok.is(tok::l_brace)) {
+  if (FormatTok->Tok.is(tok::equal) &&
+  Style.BraceWrapping.BeforeStructInitialization) {
+nextToken();
+addUnwrappedLine();
+  } else if (FormatTok->Tok.is(tok::l_brace)) {
 if (ParseAsExpr) {
   parseChildBlock();
 } else {
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -720,6 +720,8 @@
 IO.mapOptional("BeforeCatch", Wrapping.BeforeCatch);
 IO.mapOptional("BeforeElse", Wrapping.BeforeElse);
 IO.mapOptional("BeforeLambdaBody", Wrapping.BeforeLambdaBody);
+IO.mapOptional("BeforeStructInitialization",
+   Wrapping.BeforeStructInitialization);
 IO.mapOptional("BeforeWhile", Wrapping.BeforeWhile);
 IO.mapOptional("IndentBraces", Wrapping.IndentBraces);
 IO.mapOptional("SplitEmptyFunction", Wrapping.SplitEmptyFunction);
@@ -831,6 +833,7 @@
 /*BeforeCatch=*/false,
 /*BeforeElse=*/false,
 /*BeforeLambdaBody=*/false,
+   

[PATCH] D101542: [NFC] Refactor ExecuteAssembler in cc1as_main.cpp

2021-04-29 Thread Scott Linder via Phabricator via cfe-commits
scott.linder created this revision.
scott.linder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Introduce an extra scope (another static function) to replace calls to
`unique_ptr::reset` with implicit destructors via RAII.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101542

Files:
  clang/tools/driver/cc1as_main.cpp


Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -333,8 +333,8 @@
   return Out;
 }
 
-static bool ExecuteAssembler(AssemblerInvocation &Opts,
- DiagnosticsEngine &Diags) {
+static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
+ DiagnosticsEngine &Diags) {
   // Get the target specific parser.
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(Opts.Triple, Error);
@@ -531,12 +531,12 @@
 Failed = Parser->Run(Opts.NoInitialTextSection);
   }
 
-  // Parser has a reference to the output stream (Str), so close Parser first.
-  Parser.reset();
-  Str.reset();
-  // Close the output stream early.
-  BOS.reset();
-  FDOS.reset();
+  return Failed;
+}
+
+static bool ExecuteAssembler(AssemblerInvocation &Opts,
+ DiagnosticsEngine &Diags) {
+  bool Failed = ExecuteAssemblerImpl(Opts, Diags);
 
   // Delete output file if there were errors.
   if (Failed) {


Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -333,8 +333,8 @@
   return Out;
 }
 
-static bool ExecuteAssembler(AssemblerInvocation &Opts,
- DiagnosticsEngine &Diags) {
+static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
+ DiagnosticsEngine &Diags) {
   // Get the target specific parser.
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(Opts.Triple, Error);
@@ -531,12 +531,12 @@
 Failed = Parser->Run(Opts.NoInitialTextSection);
   }
 
-  // Parser has a reference to the output stream (Str), so close Parser first.
-  Parser.reset();
-  Str.reset();
-  // Close the output stream early.
-  BOS.reset();
-  FDOS.reset();
+  return Failed;
+}
+
+static bool ExecuteAssembler(AssemblerInvocation &Opts,
+ DiagnosticsEngine &Diags) {
+  bool Failed = ExecuteAssemblerImpl(Opts, Diags);
 
   // Delete output file if there were errors.
   if (Failed) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101542: [NFC] Refactor ExecuteAssembler in cc1as_main.cpp

2021-04-29 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added reviewers: MaskRay, dineshkb-amd, aykevl.
scott.linder added a comment.

I'm not sure who else to add, please feel free to update the reviewers


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101542

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


[PATCH] D101462: Make it possible for targets to define their own MCObjectFileInfo

2021-04-29 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

The `InitMCObjectFileInfo` refactoring is good, but I'll suggest 
`initMCObjectFileInfo(MCContext &ctx, bool PIC, bool LargeCodeModel)` (change 
the function name to `lowerCase`, and reorder MCContext before bool arguments).

The refactoring adding `Triple` to MCContext::MCContext should be separate. We 
sill want to see whether that is good.

The RISC-V functionality change should be separate as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101462

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


[PATCH] D101542: [NFC] Refactor ExecuteAssembler in cc1as_main.cpp

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

Seems reasonable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101542

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 added a comment.

In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not see how 
this helps SPMD mode with team privatization of declarations in-between target 
teams and parallel regions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D99432#2726019 , @estewart08 wrote:

> In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not see how 
> this helps SPMD mode with team privatization of declarations in-between 
> target teams and parallel regions.

Diв you try the reproducer with the applied patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 added a comment.

In D99432#2726025 , @ABataev wrote:

> In D99432#2726019 , @estewart08 
> wrote:
>
>> In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not see 
>> how this helps SPMD mode with team privatization of declarations in-between 
>> target teams and parallel regions.
>
> Diв you try the reproducer with the applied patch?

Yes, I still saw the test fail, although it was not with latest llvm-project. 
Are you saying the reproducer passes for you?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D99432#2726050 , @estewart08 wrote:

> In D99432#2726025 , @ABataev wrote:
>
>> In D99432#2726019 , @estewart08 
>> wrote:
>>
>>> In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not see 
>>> how this helps SPMD mode with team privatization of declarations in-between 
>>> target teams and parallel regions.
>>
>> Diв you try the reproducer with the applied patch?
>
> Yes, I still saw the test fail, although it was not with latest llvm-project. 
> Are you saying the reproducer passes for you?

I don't have CUDA installed but from what I see in the LLVM IR it shall pass. 
Do you have a debug log, does it crashes or produces incorrect results?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D101549: [Doc] Fix sphynx warnings about wrong code-block format

2021-04-29 Thread Alexey Bader via Phabricator via cfe-commits
bader created this revision.
bader added a reviewer: Anastasia.
Herald added a subscriber: ebevhan.
bader requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101549

Files:
  clang/docs/SYCLSupport.rst


Index: clang/docs/SYCLSupport.rst
===
--- clang/docs/SYCLSupport.rst
+++ clang/docs/SYCLSupport.rst
@@ -99,7 +99,7 @@
  - private_space
 
 
-.. code-block::
+.. code-block:: C++
+
+//TODO: add support for __attribute__((opencl_global_host)) and 
__attribute__((opencl_global_device)).
 
-   TODO: add support for `__attribute__((opencl_global_host))` and
-   `__attribute__((opencl_global_device))`.


Index: clang/docs/SYCLSupport.rst
===
--- clang/docs/SYCLSupport.rst
+++ clang/docs/SYCLSupport.rst
@@ -99,7 +99,7 @@
  - private_space
 
 
-.. code-block::
+.. code-block:: C++
+
+//TODO: add support for __attribute__((opencl_global_host)) and __attribute__((opencl_global_device)).
 
-   TODO: add support for `__attribute__((opencl_global_host))` and
-   `__attribute__((opencl_global_device))`.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-29 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis added a comment.

In D95976#2725027 , @protze.joachim 
wrote:

> Please update the test with a NFC commit.

Thanks, @protze.joachim. The changes look good. I'll get that NFC commit in 
soon-ish, unless you would like to take over.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D99488: [SYCL][Doc] Add design document for SYCL mode

2021-04-29 Thread Alexey Bader via Phabricator via cfe-commits
bader added a comment.

Thanks! I've uploaded this version to https://reviews.llvm.org/D101549.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99488

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


[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen planned changes to this revision.
ychen added a comment.

Found a bug. Will fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97915

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


[PATCH] D101551: [CMake] Set correct CXX_FLAGS for relative-vtables variants

2021-04-29 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: leonardchan.
Herald added a subscriber: mgorny.
phosek requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We overrite CXX_FLAGS to enable relative vtables, but doing so
overwrites generic Fuchsia CXX_FLAGS leading to a build failure
on Windows.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101551

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE 
BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE 
BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} 
${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF 
CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" 
CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} 
${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+noexcept_LLVM_BUILD_COMPILER_RT 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} 
${RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 
@@ -231,7 +231,7 @@
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} 
${RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 # Use .build-id link.
 list(APPEND RUNTIME_BUILD_ID_LINK "${target}")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS "${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} ${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" CACHE STRING "")
 set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
-set(RUNTIMES_${t

[PATCH] D101551: [CMake] Set correct CXX_FLAGS for relative-vtables variants

2021-04-29 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 341570.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101551

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE 
BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE 
BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF 
CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" 
CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+noexcept_LLVM_BUILD_COMPILER_RT 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 
@@ -231,7 +231,7 @@
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 # Use .build-id link.
 list(APPEND RUNTIME_BUILD_ID_LINK "${target}")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS "${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" CACHE STRING "")
 set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS "${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS "${RUNTIMES_${target}+relative-vtables+noex

[clang] ba63124 - [CMake] Set correct CXX_FLAGS for relative-vtables variants

2021-04-29 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2021-04-29T10:34:37-07:00
New Revision: ba631240ae9ccbf70f57c0ba22cf2dd5a3592da2

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

LOG: [CMake] Set correct CXX_FLAGS for relative-vtables variants

We overrite CXX_FLAGS to enable relative vtables, but doing so
overwrites generic Fuchsia CXX_FLAGS leading to a build failure
on Windows.

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

Added: 


Modified: 
clang/cmake/caches/Fuchsia-stage2.cmake

Removed: 




diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake 
b/clang/cmake/caches/Fuchsia-stage2.cmake
index a9ac3ce5d9ceb..f83ef1f3ac66b 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@ if(FUCHSIA_SDK)
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE 
BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE 
BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF 
CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" 
CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+noexcept_LLVM_BUILD_COMPILER_RT 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 
@@ -231,7 +231,7 @@ if(FUCHSIA_SDK)
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 # Use .build-id link.
 list(APPEND RUNTIME_BUILD_ID_LINK "${target}")



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


[PATCH] D101551: [CMake] Set correct CXX_FLAGS for relative-vtables variants

2021-04-29 Thread Petr Hosek 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 rGba631240ae9c: [CMake] Set correct CXX_FLAGS for 
relative-vtables variants (authored by phosek).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101551

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE 
BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE 
BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF 
CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" 
CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+noexcept_LLVM_BUILD_COMPILER_RT 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
 
@@ -231,7 +231,7 @@
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS
 OFF CACHE BOOL "")
 
set(RUNTIMES_${target}+relative-vtables+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang 
-fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 # Use .build-id link.
 list(APPEND RUNTIME_BUILD_ID_LINK "${target}")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -212,16 +212,16 @@
 set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 
 set(RUNTIMES_${target}+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS "${RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LLVM_USE_SANITIZER "Address" CACHE STRING "")
 set(RUNTIMES_${target}+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
 set(RUNTIMES_${target}+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
-set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS "${RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
+set(RUNTIMES_${target}+relative-vtables+asan_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
 
 set

[PATCH] D99543: [clang-tidy] Allow opt-in or out of some commonly occuring patterns in NarrowingConversionsCheck.

2021-04-29 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst:51
+
+   Narrowing conversions from any type in this semicolon separated list will be
+   ignored. This may be useful to weed out commonly occurring, but less 
commonly

nit: add dash "semicolon-separated"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99543

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


[PATCH] D99599: [NewPM] Add an option to dump pass structure

2021-04-29 Thread Haowei Wu via Phabricator via cfe-commits
haowei added a comment.

We are seeing test failures in our builders with message after your patch. 
Could you take a look and fix this unit test please?

  FAIL: Clang :: Driver/debug-pass-structure.c (6773 of 27894)
   TEST 'Clang :: Driver/debug-pass-structure.c' FAILED 

  Script:
  --
  : 'RUN: at line 2';   /opt/s/w/ir/x/w/staging/llvm_build/bin/clang 
-fexperimental-new-pass-manager -fdebug-pass-structure -O3 -S -emit-llvm 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c -o 
/dev/null 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c 
--check-prefix=NEWPM
  : 'RUN: at line 3';   /opt/s/w/ir/x/w/staging/llvm_build/bin/clang 
-flegacy-pass-manager -fdebug-pass-structure -O0 -S -emit-llvm 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c -o 
/dev/null 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c 
--check-prefix=LEGACYPM
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  /opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c:46:19: 
error: LEGACYPM-NEXT: expected string not found in input
  // LEGACYPM-NEXT: Pass Arguments: -tti -targetlibinfo 
-assumption-cache-tracker -profile-summary-info -annotation2metadata 
-forceattrs -basiccg -always-inline -annotation-remarks
^
  :5:17: note: scanning from here
   Module Verifier
  ^
  :6:1: note: possible intended match here
  Pass Arguments: -tti -targetlibinfo -assumption-cache-tracker 
-profile-summary-info -annotation2metadata -forceattrs -basiccg -always-inline 
-barrier -annotation-remarks
  ^
  
  Input file: 
  Check file: 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c
  
  -dump-input=help explains the following input dump.
  
  Input was:
  <<
 1: Pass Arguments: -tti -targetlibinfo -verify 
 2: Target Transform Information 
 3: Target Library Information 
 4:  FunctionPass Manager 
 5:  Module Verifier 
  next:46'0 X error: no match found
 6: Pass Arguments: -tti -targetlibinfo -assumption-cache-tracker 
-profile-summary-info -annotation2metadata -forceattrs -basiccg -always-inline 
-barrier -annotation-remarks 
  next:46'0 
~~
  next:46'1 ?   

   possible intended match
 7: Target Transform Information 
  next:46'0 ~
 8: Target Library Information 
  next:46'0 ~~~
 9: Assumption Cache Tracker 
  next:46'0 ~
10: Profile summary info 
  next:46'0 ~
11:  ModulePass Manager 
  next:46'0 
 .
 .
 .
  >>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99599

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


[PATCH] D99599: [NewPM] Add an option to dump pass structure

2021-04-29 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added a comment.

@haowei What are LLVM configuration options? Also please send output from

  /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -flegacy-pass-manager 
-fdebug-pass-structure -O0 -S -emit-llvm 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c -o 
/dev/null 2>&1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99599

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


[PATCH] D101554: [clangd] Add support for the `defaultLibrary` semantic token modifier

2021-04-29 Thread David Goldman via Phabricator via cfe-commits
dgoldman created this revision.
dgoldman added reviewers: sammccall, kadircet.
Herald added subscribers: usaxena95, jfb, arphaman.
dgoldman requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

This allows us to differentiate symbols from the system (e.g. system
includes or sysroot) differently than symbols defined in the user's
project, which can be used by editors to display them differently.

This is currently based on `FileCharacteristic`, but we can
consider alternatives such as `Sysroot` and file paths in the future.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101554

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/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
@@ -69,13 +69,16 @@
 std::vector>
 AdditionalFiles = {},
-uint32_t ModifierMask = -1) {
+uint32_t ModifierMask = -1,
+std::vector AdditionalArgs = {}) {
   Annotations Test(Code);
   TestTU TU;
   TU.Code = std::string(Test.code());
 
   TU.ExtraArgs.push_back("-std=c++20");
   TU.ExtraArgs.push_back("-xobjective-c++");
+  TU.ExtraArgs.insert(std::end(TU.ExtraArgs), std::begin(AdditionalArgs),
+  std::end(AdditionalArgs));
 
   for (auto File : AdditionalFiles)
 TU.AdditionalFiles.insert({File.first, std::string(File.second)});
@@ -102,9 +105,9 @@
   struct {
   } $Variable_decl[[S]];
   void $Function_decl[[foo]](int $Parameter_decl[[A]], $Class[[AS]] $Parameter_decl[[As]]) {
-$Primitive_deduced[[auto]] $LocalVariable_decl[[VeryLongVariableName]] = 12312;
+$Primitive_deduced_defaultLibrary[[auto]] $LocalVariable_decl[[VeryLongVariableName]] = 12312;
 $Class[[AS]] $LocalVariable_decl[[AA]];
-$Primitive_deduced[[auto]] $LocalVariable_decl[[L]] = $LocalVariable[[AA]].$Field[[SomeMember]] + $Parameter[[A]];
+$Primitive_deduced_defaultLibrary[[auto]] $LocalVariable_decl[[L]] = $LocalVariable[[AA]].$Field[[SomeMember]] + $Parameter[[A]];
 auto $LocalVariable_decl[[FN]] = [ $LocalVariable[[AA]]](int $Parameter_decl[[A]]) -> void {};
 $LocalVariable[[FN]](12312);
   }
@@ -320,8 +323,8 @@
   $Class_deduced[[decltype]](auto) $Variable_decl[[AF2]] = $Class[[Foo]]();
   $Class_deduced[[auto]] *$Variable_decl[[AFP]] = &$Variable[[AF]];
   $Enum_deduced[[auto]] &$Variable_decl[[AER]] = $Variable[[AE]];
-  $Primitive_deduced[[auto]] $Variable_decl[[Form]] = 10.2 + 2 * 4;
-  $Primitive_deduced[[decltype]]($Variable[[Form]]) $Variable_decl[[F]] = 10;
+  $Primitive_deduced_defaultLibrary[[auto]] $Variable_decl[[Form]] = 10.2 + 2 * 4;
+  $Primitive_deduced_defaultLibrary[[decltype]]($Variable[[Form]]) $Variable_decl[[F]] = 10;
   auto $Variable_decl[[Fun]] = []()->void{};
 )cpp",
   R"cpp(
@@ -731,6 +734,24 @@
 #define DEFINE_Y DEFINE(Y)
   )cpp"}},
  ~ScopeModifierMask);
+
+  checkHighlightings(R"cpp(
+#include "SYSObject.h"
+@interface $Class_defaultLibrary[[SYSObject]] ($Namespace_decl[[UserCategory]])
+@property(nonatomic, readonly) int $Field_decl_readonly[[user_property]];
+@end
+int $Function_decl[[somethingUsingSystemSymbols]]() {
+  $Class_defaultLibrary[[SYSObject]] *$LocalVariable_decl[[obj]] = [$Class_defaultLibrary[[SYSObject]] $StaticMethod_static_defaultLibrary[[new]]];
+  return $LocalVariable[[obj]].$Field_defaultLibrary[[value]] + $LocalVariable[[obj]].$Field_readonly[[user_property]];
+}
+  )cpp",
+ {{"SystemSDK/SYSObject.h", R"cpp(
+@interface SYSObject
+@property(nonatomic, assign) int value;
++ (instancetype)new;
+@end
+  )cpp"}},
+ ~ScopeModifierMask, {"-isystemSystemSDK/"});
 }
 
 TEST(SemanticHighlighting, ScopeModifiers) {
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
@@ -93,7 +93,8 @@
 # CHECK-NEXT:"functionScope",
 # CHECK-NEXT:"classScope",
 # CHECK-NEXT:"fileScope",
-# CHECK-NEXT:"globalScope"
+# CHECK-NEXT:"globalScope",
+# CHECK-NEXT:"defaultLibrary"
 # CHECK-NEXT:  ],
 # CHECK-NEXT:  "tokenTypes": [
 # CHECK-NEXT:"variable",
Index: clang-tools-extra/clan

[PATCH] D98300: [TLS] Initialization functions of dynamic TLS variables cannot be in a comdat (fix for PR48030)

2021-04-29 Thread Wolfgang Pieb via Phabricator via cfe-commits
wolfgangp added a comment.

ping...


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

https://reviews.llvm.org/D98300

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


[PATCH] D99599: [NewPM] Add an option to dump pass structure

2021-04-29 Thread Eugene Leviant via Phabricator via cfe-commits
evgeny777 added a comment.

Hm ... I see BarrierNoop pass being added before `annotation-remarks`. Why's 
that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99599

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


[PATCH] D101491: [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` suffix.

2021-04-29 Thread Dan Liew via Phabricator via cfe-commits
delcypher added a comment.

In D101491#2725348 , @jansvoboda11 
wrote:

> In D101491#2724025 , @delcypher 
> wrote:
>
>> @jansvoboda11 Should I use the the alias feature so that the old 
>> `-fsanitize-address-destructor-kind` argument is still parsed? I'm not sure 
>> if it's worth it but if doing so is very simple and has a low maintenance 
>> burden we should probably do it.
>
> I'm fine with omitting the alias if the original flag didn't make it into a 
> release and it's unlikely that downstream TOT users are using it.

The change that landed this flag originally 
(5d64dd8e3c22e12e4f7b3d08ffe88fc41e727117 
) doesn't 
seem to be in the `release/12.x` branch. It also wasn't cherry picked to the 
downstream Apple branches on GitHub. I can't be sure about other downstream 
users of LLVM but I do think it's very unlikely that anyone adopted this flag.

I don't mind adding an alias but I'd need a little guidance on how to do it 
correctly and also where to add code to emit a warning about the old flag being 
deprecated.




Comment at: clang/docs/ClangCommandLineReference.rst:873
 
-.. option:: -fsanitize-address-destructor-kind=
+.. option:: -fsanitize-address-destructor=
 

vitalybuka wrote:
>  here is inconsistent with MetaVarName<""
I'll fix that now.



Comment at: clang/include/clang/Driver/Options.td:1542
   Group;
 def sanitize_address_destructor_kind_EQ
+: Joined<["-"], "fsanitize-address-destructor=">,

jansvoboda11 wrote:
> Nit: remove `_kind` from the def name.
Good catch. I'll fix that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101491

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 added a comment.

In D99432#2726060 , @ABataev wrote:

> In D99432#2726050 , @estewart08 
> wrote:
>
>> In D99432#2726025 , @ABataev wrote:
>>
>>> In D99432#2726019 , @estewart08 
>>> wrote:
>>>
 In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not see 
 how this helps SPMD mode with team privatization of declarations 
 in-between target teams and parallel regions.
>>>
>>> Diв you try the reproducer with the applied patch?
>>
>> Yes, I still saw the test fail, although it was not with latest 
>> llvm-project. Are you saying the reproducer passes for you?
>
> I don't have CUDA installed but from what I see in the LLVM IR it shall pass. 
> Do you have a debug log, does it crashes or produces incorrect results?

This is on an AMDGPU but I assume the behavior would be similar for NVPTX.

It produces incorrect/incomplete results in the dist[0] index after a manual 
reduction and in turn the final global gpu_results array is incorrect.
When thread 0 does a reduction into dist[0] it has no knowledge of dist[1] 
having been updated by thread 1. Which tells me the array is still thread 
private.
Adding some printfs, looking at one teams' output:

SPMD

  Thread 0: dist[0]: 1
  Thread 0: dist[1]: 0  // This should be 1
  After reduction into dist[0]: 1  // This should be 2
  gpu_results = [1,1]  // [2,2] expected

Generic Mode:

  Thread 0: dist[0]: 1
  Thread 0: dist[1]: 1   
  After reduction into dist[0]: 2
  gpu_results = [2,2]


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D99599: [NewPM] Add an option to dump pass structure

2021-04-29 Thread Haowei Wu via Phabricator via cfe-commits
haowei added a comment.

In D99599#2726252 , @evgeny777 wrote:

> @haowei What are LLVM configuration options? Also please send output from
>
>   /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -flegacy-pass-manager 
> -fdebug-pass-structure -O0 -S -emit-llvm 
> /opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c -o 
> /dev/null 2>&1

Full cmake command line is:

  '/local_path/local_path/bin/cmake',
'-GNinja',
'-DCMAKE_MAKE_PROGRAM=/local_path/local_path/ninja',
'-DCMAKE_INSTALL_PREFIX=',
'-DCMAKE_C_COMPILER=/local_path/local_path/bin/clang',
'-DCMAKE_CXX_COMPILER=/local_path/local_path/bin/clang++',
'-DCMAKE_ASM_COMPILER=/local_path/local_path/bin/clang',
'-DCMAKE_AR=/local_path/local_path/bin/llvm-ar',
'-DCMAKE_LINKER=/local_path/local_path/bin/ld.lld',
'-DCMAKE_NM=/local_path/local_path/bin/llvm-nm',
'-DCMAKE_OBJCOPY=/local_path/local_path/bin/llvm-objcopy',
'-DCMAKE_OBJDUMP=/local_path/local_path/bin/llvm-objdump',
'-DCMAKE_RANLIB=/local_path/local_path/bin/llvm-ranlib',
'-DCMAKE_READELF=/local_path/local_path/bin/llvm-readelf',
'-DCMAKE_STRIP=/local_path/local_path/bin/llvm-strip',
'-DCMAKE_SYSROOT=/local_path/local_path/linux',
'-DZLIB_INCLUDE_DIR=/local_path/staging/zlib_install/include',
'-DZLIB_LIBRARY=/local_path/staging/zlib_install/lib/libz.a',
'-DLIBXML2_INCLUDE_DIR=/local_path/staging/libxml2_install/include/libxml2',
'-DLIBXML2_LIBRARY=/local_path/staging/libxml2_install/lib/libxml2.a',
'-DCMAKE_SHARED_LINKER_FLAGS=-static-libstdc++',
'-DCMAKE_MODULE_LINKER_FLAGS=-static-libstdc++',
'-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++',
'-DLLVM_ENABLE_LTO=False',
'-DLLVM_ENABLE_ASSERTIONS=True',
'-DLINUX_aarch64-unknown-linux-gnu_SYSROOT=/local_path/local_path/linux',

'-DLINUX_armv7-unknown-linux-gnueabihf_SYSROOT=/local_path/local_path/linux',
'-DLINUX_i386-unknown-linux-gnu_SYSROOT=/local_path/local_path/linux',
'-DLINUX_x86_64-unknown-linux-gnu_SYSROOT=/local_path/local_path/linux',
'-DFUCHSIA_SDK=/local_path/local_path/sdk',
'-C',
'/local_path/llvm-project/clang/cmake/caches/Fuchsia-stage2.cmake',
'/local_path/llvm-project/llvm',

I am currently doing a local build to see if I can generate the output you 
required.  We suspect it may be related to 
`ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER` which is enabled in 
`clang/cmake/caches/Fuchsia-stage2.cmake` we used.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99599

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D99432#2726337 , @estewart08 wrote:

> In D99432#2726060 , @ABataev wrote:
>
>> In D99432#2726050 , @estewart08 
>> wrote:
>>
>>> In D99432#2726025 , @ABataev wrote:
>>>
 In D99432#2726019 , @estewart08 
 wrote:

> In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not see 
> how this helps SPMD mode with team privatization of declarations 
> in-between target teams and parallel regions.

 Diв you try the reproducer with the applied patch?
>>>
>>> Yes, I still saw the test fail, although it was not with latest 
>>> llvm-project. Are you saying the reproducer passes for you?
>>
>> I don't have CUDA installed but from what I see in the LLVM IR it shall 
>> pass. Do you have a debug log, does it crashes or produces incorrect results?
>
> This is on an AMDGPU but I assume the behavior would be similar for NVPTX.
>
> It produces incorrect/incomplete results in the dist[0] index after a manual 
> reduction and in turn the final global gpu_results array is incorrect.
> When thread 0 does a reduction into dist[0] it has no knowledge of dist[1] 
> having been updated by thread 1. Which tells me the array is still thread 
> private.
> Adding some printfs, looking at one teams' output:
>
> SPMD
>
>   Thread 0: dist[0]: 1
>   Thread 0: dist[1]: 0  // This should be 1
>   After reduction into dist[0]: 1  // This should be 2
>   gpu_results = [1,1]  // [2,2] expected
>
> Generic Mode:
>
>   Thread 0: dist[0]: 1
>   Thread 0: dist[1]: 1   
>   After reduction into dist[0]: 2
>   gpu_results = [2,2]

Hmm, I would expect a crash if the array was allocated in the local memory. 
Could you try to add some more printfs (with data and addresses of the array) 
to check the results? Maybe there is a data race somewhere in the code?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D101503: [OpenMPIRBuilder] Add createOffloadMaptypes and createOffloadMapnames functions

2021-04-29 Thread Valentin Clement via Phabricator via cfe-commits
clementval updated this revision to Diff 341589.
clementval added a comment.

Fix global variable names. Separator comes from OpenMP runtime information.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101503

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -2095,6 +2095,35 @@
   return getOrCreateOMPInternalVariable(KmpCriticalNameTy, Name);
 }
 
+// Create the global variable holding the offload mappings information.
+GlobalVariable *
+OpenMPIRBuilder::createOffloadMaptypes(SmallVector &Mappings,
+   std::string VarName) {
+  llvm::Constant *MaptypesArrayInit =
+  llvm::ConstantDataArray::get(M.getContext(), Mappings);
+  auto *MaptypesArrayGlobal = new llvm::GlobalVariable(
+  M, MaptypesArrayInit->getType(),
+  /*isConstant=*/true, llvm::GlobalValue::PrivateLinkage, MaptypesArrayInit,
+  VarName);
+  MaptypesArrayGlobal->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
+  return MaptypesArrayGlobal;
+}
+
+// Create the global variables holding the offload names information.
+GlobalVariable *
+OpenMPIRBuilder::createOffloadMapnames(SmallVector &Names,
+   std::string VarName) {
+  llvm::Constant *MapNamesArrayInit = llvm::ConstantArray::get(
+  llvm::ArrayType::get(
+  llvm::Type::getInt8Ty(M.getContext())->getPointerTo(), Names.size()),
+  Names);
+  auto *MapNamesArrayGlobal = new llvm::GlobalVariable(
+  M, MapNamesArrayInit->getType(),
+  /*isConstant=*/true, llvm::GlobalValue::PrivateLinkage, MapNamesArrayInit,
+  VarName);
+  return MapNamesArrayGlobal;
+}
+
 // Create all simple and struct types exposed by the runtime and remember
 // the llvm::PointerTypes of them for easy access later.
 void OpenMPIRBuilder::initializeTypes(Module &M) {
Index: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
===
--- llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -615,6 +615,14 @@
   /// variables.
   StringMap, BumpPtrAllocator> InternalVars;
 
+  /// Create the global variable holding the offload mappings information.
+  GlobalVariable *createOffloadMaptypes(SmallVector &Mappings,
+std::string VarName);
+
+  /// Create the global variable holding the offload names information.
+  GlobalVariable *createOffloadMapnames(SmallVector &Names,
+std::string VarName);
+
 public:
   /// Generator for __kmpc_copyprivate
   ///
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -9375,17 +9375,12 @@
 
 // The map types are always constant so we don't need to generate code to
 // fill arrays. Instead, we create an array constant.
-SmallVector Mapping(CombinedInfo.Types.size(), 0);
+SmallVector Mapping(CombinedInfo.Types.size(), 0);
 llvm::copy(CombinedInfo.Types, Mapping.begin());
-llvm::Constant *MapTypesArrayInit =
-llvm::ConstantDataArray::get(CGF.Builder.getContext(), Mapping);
 std::string MaptypesName =
 CGM.getOpenMPRuntime().getName({"offload_maptypes"});
-auto *MapTypesArrayGbl = new llvm::GlobalVariable(
-CGM.getModule(), MapTypesArrayInit->getType(),
-/*isConstant=*/true, llvm::GlobalValue::PrivateLinkage,
-MapTypesArrayInit, MaptypesName);
-MapTypesArrayGbl->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
+auto *MapTypesArrayGbl =
+OMPBuilder.createOffloadMaptypes(Mapping, MaptypesName);
 Info.MapTypesArray = MapTypesArrayGbl;
 
 // The information types are only built if there is debug information
@@ -9397,19 +9392,12 @@
   auto fillInfoMap = [&](MappableExprsHandler::MappingExprInfo &MapExpr) {
 return emitMappingInformation(CGF, OMPBuilder, MapExpr);
   };
-  SmallVector InfoMap(CombinedInfo.Exprs.size());
+  SmallVector InfoMap(CombinedInfo.Exprs.size());
   llvm::transform(CombinedInfo.Exprs, InfoMap.begin(), fillInfoMap);
-
-  llvm::Constant *MapNamesArrayInit = llvm::ConstantArray::get(
-  llvm::ArrayType::get(
-  llvm::Type::getInt8Ty(CGF.Builder.getContext())->getPointerTo(),
-  CombinedInfo.Exprs.size()),
-  InfoMap);
-  auto *MapNamesArrayGbl = new llvm::GlobalVariable(
-  CGM.getModule(), MapNamesArrayInit->getType(),
-  /*isConstant=*/true, llvm::GlobalValu

[PATCH] D101352: [DOCS] Removed inconsistency in clang vs Clang usage in docs (c vs C)

2021-04-29 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

I'm not convinced by these changes?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101352

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


[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 341591.
ychen added a comment.

- fix a bug.

  ready for review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97915

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCoroutine.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCoroutines/coro-alloc.cpp
  clang/test/CodeGenCoroutines/coro-cleanup.cpp
  clang/test/CodeGenCoroutines/coro-gro.cpp
  llvm/docs/Coroutines.rst
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/Coroutines/CoroInstr.h
  llvm/lib/Transforms/Coroutines/CoroInternal.h
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/lib/Transforms/Coroutines/Coroutines.cpp
  llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
  llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll

Index: llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
===
--- llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
+++ llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
@@ -62,7 +62,7 @@
   call i1 @llvm.coro.end(i8* null, i1 false)
   ret void
 }
-; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", i1, [14 x i8], %struct.big_structure }
+; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", i1, i8*, %struct.big_structure }
 ; CHECK-LABEL: @a.resume(
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 3
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 5
Index: llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
===
--- llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
+++ llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
@@ -62,10 +62,10 @@
   call i1 @llvm.coro.end(i8* null, i1 false)
   ret void
 }
-; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1, [26 x i8], %struct.big_structure.2 }
+; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1, i8*, [16 x i8], %struct.big_structure.2 }
 ; CHECK-LABEL: @a.resume(
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 3
-; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 6
+; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 7
 
 declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
 declare i1 @llvm.coro.alloc(token) #3
Index: llvm/lib/Transforms/Coroutines/Coroutines.cpp
===
--- llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -234,6 +234,7 @@
   Shape.CoroBegin = nullptr;
   Shape.CoroEnds.clear();
   Shape.CoroSizes.clear();
+  Shape.CoroAligns.clear();
   Shape.CoroSuspends.clear();
 
   Shape.FrameTy = nullptr;
@@ -268,6 +269,12 @@
   case Intrinsic::coro_size:
 CoroSizes.push_back(cast(II));
 break;
+  case Intrinsic::coro_align:
+CoroAligns.push_back(cast(II));
+break;
+  case Intrinsic::coro_raw_frame_ptr_offset:
+CoroRawFramePtrOffsets.push_back(cast(II));
+break;
   case Intrinsic::coro_frame:
 CoroFrames.push_back(cast(II));
 break;
@@ -375,6 +382,7 @@
 this->SwitchLowering.ResumeSwitch = nullptr;
 this->SwitchLowering.PromiseAlloca = SwitchId->getPromise();
 this->SwitchLowering.ResumeEntryBlock = nullptr;
+this->SwitchLowering.FramePtrOffset = 0;
 
 for (auto AnySuspend : CoroSuspends) {
   auto Suspend = dyn_cast(AnySuspend);
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -997,23 +997,44 @@
   Shape.AsyncLowering.AsyncFuncPointer->setInitializer(NewFuncPtrStruct);
 }
 
-static void replaceFrameSize(coro::Shape &Shape) {
+static void replaceFrameSizeAndAlign(coro::Shape &Shape) {
   if (Shape.ABI == coro::ABI::Async)
 updateAsyncFuncPointerContextSize(Shape);
 
-  if (Shape.CoroSizes.empty())
-return;
+  if (!Shape.CoroSizes.empty()) {
+// In the same function all coro.sizes should have the same result type.
+auto *SizeIntrin = Shape.CoroSizes.back();
+Module *M = SizeIntrin->getModule();
+const DataLayout &DL = M->getDataLayout();
+auto Size = DL.getTypeAllocSize(Shape.FrameTy);
+auto *SizeConstant = ConstantInt::get(SizeIntrin->getType(), Size);
+
+for 

[PATCH] D101479: [Driver] Support libc++ in MSVC

2021-04-29 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

The test doesn't seem to pass on Jenkins. Maybe we need a REQUIRES line or a 
fake sysroot or something for the test.




Comment at: clang/lib/Driver/ToolChains/MSVC.cpp:1332
+
+  auto AddLibcxxIncludePath = [&](StringRef Path) {
+std::string Version = detectLibcxxVersion(Path);

I'm guessing this is copy-pasted code from the other toolchains, but this 
lambda makes less sense when its only called once. If you inline it, we don't 
need an extra SmallString or lambda.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101479

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


[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 341592.
ychen added a comment.

- fix typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97915

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCoroutine.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCoroutines/coro-alloc.cpp
  clang/test/CodeGenCoroutines/coro-cleanup.cpp
  clang/test/CodeGenCoroutines/coro-gro.cpp
  llvm/docs/Coroutines.rst
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/Coroutines/CoroInstr.h
  llvm/lib/Transforms/Coroutines/CoroInternal.h
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/lib/Transforms/Coroutines/Coroutines.cpp
  llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
  llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll

Index: llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
===
--- llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
+++ llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
@@ -62,7 +62,7 @@
   call i1 @llvm.coro.end(i8* null, i1 false)
   ret void
 }
-; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", i1, [14 x i8], %struct.big_structure }
+; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", i1, i8*, %struct.big_structure }
 ; CHECK-LABEL: @a.resume(
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 3
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 5
Index: llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
===
--- llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
+++ llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
@@ -62,10 +62,10 @@
   call i1 @llvm.coro.end(i8* null, i1 false)
   ret void
 }
-; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1, [26 x i8], %struct.big_structure.2 }
+; CHECK:   %a.Frame = type { void (%a.Frame*)*, void (%a.Frame*)*, %"struct.task::promise_type", %struct.big_structure, i1, i8*, [16 x i8], %struct.big_structure.2 }
 ; CHECK-LABEL: @a.resume(
 ; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 3
-; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 6
+; CHECK: %[[A:.*]] = getelementptr inbounds %a.Frame, %a.Frame* %FramePtr, i32 0, i32 7
 
 declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
 declare i1 @llvm.coro.alloc(token) #3
Index: llvm/lib/Transforms/Coroutines/Coroutines.cpp
===
--- llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -234,6 +234,7 @@
   Shape.CoroBegin = nullptr;
   Shape.CoroEnds.clear();
   Shape.CoroSizes.clear();
+  Shape.CoroAligns.clear();
   Shape.CoroSuspends.clear();
 
   Shape.FrameTy = nullptr;
@@ -268,6 +269,12 @@
   case Intrinsic::coro_size:
 CoroSizes.push_back(cast(II));
 break;
+  case Intrinsic::coro_align:
+CoroAligns.push_back(cast(II));
+break;
+  case Intrinsic::coro_raw_frame_ptr_offset:
+CoroRawFramePtrOffsets.push_back(cast(II));
+break;
   case Intrinsic::coro_frame:
 CoroFrames.push_back(cast(II));
 break;
@@ -375,6 +382,7 @@
 this->SwitchLowering.ResumeSwitch = nullptr;
 this->SwitchLowering.PromiseAlloca = SwitchId->getPromise();
 this->SwitchLowering.ResumeEntryBlock = nullptr;
+this->SwitchLowering.FramePtrOffset = 0;
 
 for (auto AnySuspend : CoroSuspends) {
   auto Suspend = dyn_cast(AnySuspend);
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -997,23 +997,44 @@
   Shape.AsyncLowering.AsyncFuncPointer->setInitializer(NewFuncPtrStruct);
 }
 
-static void replaceFrameSize(coro::Shape &Shape) {
+static void replaceFrameSizeAndAlign(coro::Shape &Shape) {
   if (Shape.ABI == coro::ABI::Async)
 updateAsyncFuncPointerContextSize(Shape);
 
-  if (Shape.CoroSizes.empty())
-return;
+  if (!Shape.CoroSizes.empty()) {
+// In the same function all coro.sizes should have the same result type.
+auto *SizeIntrin = Shape.CoroSizes.back();
+Module *M = SizeIntrin->getModule();
+const DataLayout &DL = M->getDataLayout();
+auto Size = DL.getTypeAllocSize(Shape.FrameTy);
+auto *SizeConstant = ConstantInt::get(SizeIntrin->getType(), Size);
+
+for (CoroSizeInst *CS : Sha

[PATCH] D70094: [clang-tidy] new altera ID dependent backward branch check

2021-04-29 Thread Frank Derry Wanye via Phabricator via cfe-commits
ffrankies marked an inline comment as done.
ffrankies added a comment.

@Eugene.Zelenko @aaron.ballman Are there any more changes that need to be made 
to this check or comments that need to be addressed?




Comment at: 
clang-tools-extra/clang-tidy/altera/IdDependentBackwardBranchCheck.cpp:200
+  if (isa(Loop))
+return DO_LOOP; // loop_type = 0;
+  else if (isa(Loop))

Eugene.Zelenko wrote:
> Is loop ID is not enough? Why does comment with numerical code used? Same 
> below.
Removed the comment with numerical code (I simply added it to avoid having to 
check the header file to see their numerical value). The LoopType is used in 
the diagnostics to select and emit the correct loop type as part of the 
diagnostic message, e.g.: 
```
diag(CondExpr->getBeginLoc(),
"backward branch (%select{do|while|for}0 loop) is ID-dependent due "
"to ID function call and may cause performance degradation")
   << Type;
```
I'm assuming the loop ID is a unique object identifier, so I don't think it'll 
serve the same purpose.


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

https://reviews.llvm.org/D70094

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


[PATCH] D97915: [Coroutines] Handle overaligned frame allocation

2021-04-29 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

For coroutine `f0` in `test/CodeGenCoroutines/coro-alloc.cpp`

The allocation looks like this:

  ; Function Attrs: noinline nounwind optnone mustprogress
  define dso_local void @f0() #0 {
  entry:
%0 = alloca %struct.global_new_delete_tag, align 1
%1 = alloca %struct.global_new_delete_tag, align 1
%__promise = alloca %"struct.std::experimental::coroutine_traits::promise_type", align 1
%ref.tmp = alloca %struct.suspend_always, align 1
%undef.agg.tmp = alloca %struct.suspend_always, align 1
%agg.tmp = alloca %"struct.std::experimental::coroutine_handle", align 1
%agg.tmp2 = alloca %"struct.std::experimental::coroutine_handle.0", align 1
%undef.agg.tmp3 = alloca %"struct.std::experimental::coroutine_handle.0", 
align 1
%ref.tmp4 = alloca %struct.suspend_always, align 1
%undef.agg.tmp5 = alloca %struct.suspend_always, align 1
%agg.tmp7 = alloca %"struct.std::experimental::coroutine_handle", align 1
%agg.tmp8 = alloca %"struct.std::experimental::coroutine_handle.0", align 1
%undef.agg.tmp9 = alloca %"struct.std::experimental::coroutine_handle.0", 
align 1
%2 = bitcast %"struct.std::experimental::coroutine_traits::promise_type"* %__promise to i8*
%3 = call token @llvm.coro.id(i32 16, i8* %2, i8* null, i8* null)
%4 = call i1 @llvm.coro.alloc(token %3)
br i1 %4, label %coro.alloc, label %coro.init
  
  coro.alloc:   ; preds = %entry
%5 = call i64 @llvm.coro.size.i64()
%6 = call i64 @llvm.coro.align.i64()
%7 = sub nsw i64 %6, 16
%8 = icmp sgt i64 %7, 0
%9 = select i1 %8, i64 %7, i64 0
%10 = add i64 %5, %9
%call = call noalias nonnull i8* @_Znwm(i64 %10) #11
br label %coro.check.align
  
  coro.check.align: ; preds = %coro.alloc
%11 = call i64 @llvm.coro.align.i64()
%12 = icmp ugt i64 %11, 16
br i1 %12, label %coro.alloc.align, label %coro.init
  
  coro.alloc.align: ; preds = %coro.check.align
%mask = sub i64 %11, 1
%intptr = ptrtoint i8* %call to i64
%over_boundary = add i64 %intptr, %mask
%inverted_mask = xor i64 %mask, -1
%aligned_intptr = and i64 %over_boundary, %inverted_mask
%diff = sub i64 %aligned_intptr, %intptr
%aligned_result = getelementptr inbounds i8, i8* %call, i64 %diff
call void @llvm.assume(i1 true) [ "align"(i8* %aligned_result, i64 %11) ]
%13 = call i32 @llvm.coro.raw.frame.ptr.offset.i32()
%14 = getelementptr inbounds i8, i8* %aligned_result, i32 %13
%15 = bitcast i8* %14 to i8**
store i8* %call, i8** %15, align 8
br label %coro.init
  
  coro.init:; preds = 
%coro.alloc.align, %coro.check.align, %entry
%16 = phi i8* [ null, %entry ], [ %call, %coro.check.align ], [ 
%aligned_result, %coro.alloc.align ]
%17 = call i8* @llvm.coro.begin(token %3, i8* %16)
call void 
@_ZNSt12experimental16coroutine_traitsIJv21global_new_delete_tagEE12promise_type17get_return_objectEv(%"struct.std::experimental::coroutine_traits::promise_type"* nonnull dereferenceable(1) %__promise)
call void 
@_ZNSt12experimental16coroutine_traitsIJv21global_new_delete_tagEE12promise_type15initial_suspendEv(%"struct.std::experimental::coroutine_traits::promise_type"* nonnull dereferenceable(1) %__promise)
%call1 = call zeroext i1 
@_ZN14suspend_always11await_readyEv(%struct.suspend_always* nonnull 
dereferenceable(1) %ref.tmp) #2
br i1 %call1, label %init.ready, label %init.suspend

The deallocation looks like this:

  cleanup:  ; preds = %final.ready, 
%final.cleanup, %init.cleanup
%cleanup.dest.slot.0 = phi i32 [ 0, %final.ready ], [ 2, %final.cleanup ], 
[ 2, %init.cleanup ]
%22 = call i8* @llvm.coro.free(token %3, i8* %17)
%23 = icmp ne i8* %22, null
br i1 %23, label %coro.free, label %after.coro.free
  
  coro.free:; preds = %cleanup
%24 = call i64 @llvm.coro.align.i64()
%25 = icmp ugt i64 %24, 16
%26 = call i32 @llvm.coro.raw.frame.ptr.offset.i32()
%27 = getelementptr inbounds i8, i8* %22, i32 %26
%28 = bitcast i8* %27 to i8**
%29 = load i8*, i8** %28, align 8
%30 = select i1 %25, i8* %29, i8* %22
call void @_ZdlPv(i8* %30) #2
br label %after.coro.free
  
  after.coro.free:  ; preds = %cleanup, 
%coro.free
switch i32 %cleanup.dest.slot.0, label %unreachable [
  i32 0, label %cleanup.cont
  i32 2, label %coro.ret
]
  
  cleanup.cont: ; preds = %after.coro.free
br label %coro.ret
  
  coro.ret: ; preds = %cleanup.cont, 
%after.coro.free, %final.suspend, %init.suspend
%31 = call i1 @llvm.coro.end(i8* null, i1 false)
ret void
  
  unreachable:  ; preds = %after.coro.free
unreacha

[PATCH] D101491: [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` suffix.

2021-04-29 Thread Dan Liew via Phabricator via cfe-commits
delcypher updated this revision to Diff 341596.
delcypher added a comment.

Rename def too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101491

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/CodeGen/asan-destructor-kind.cpp
  clang/test/Driver/darwin-asan-mkernel-kext.c
  clang/test/Driver/fsanitize-address-destructor-kind.c
  clang/test/Driver/fsanitize-address-destructor.c

Index: clang/test/Driver/fsanitize-address-destructor.c
===
--- clang/test/Driver/fsanitize-address-destructor.c
+++ clang/test/Driver/fsanitize-address-destructor.c
@@ -2,19 +2,19 @@
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address %s \
 // RUN:   -### 2>&1 | \
 // RUN:   FileCheck %s
-// CHECK-NOT: -fsanitize-address-destructor-kind
+// CHECK-NOT: -fsanitize-address-destructor
 
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=none %s -### 2>&1 | \
+// RUN:   -fsanitize-address-destructor=none %s -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-NONE-ARG %s
-// CHECK-NONE-ARG: "-fsanitize-address-destructor-kind=none"
+// CHECK-NONE-ARG: "-fsanitize-address-destructor=none"
 
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=global %s -### 2>&1 | \
+// RUN:   -fsanitize-address-destructor=global %s -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-GLOBAL-ARG %s
-// CHECK-GLOBAL-ARG: "-fsanitize-address-destructor-kind=global"
+// CHECK-GLOBAL-ARG: "-fsanitize-address-destructor=global"
 
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=bad_arg %s -### 2>&1 | \
+// RUN:   -fsanitize-address-destructor=bad_arg %s -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-INVALID-ARG %s
-// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor-kind='
+// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor='
Index: clang/test/Driver/darwin-asan-mkernel-kext.c
===
--- clang/test/Driver/darwin-asan-mkernel-kext.c
+++ clang/test/Driver/darwin-asan-mkernel-kext.c
@@ -5,11 +5,11 @@
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \
 // RUN:   -mkernel -### %s 2>&1 | FileCheck %s
 
-// CHECK: "-fsanitize-address-destructor-kind=none"
+// CHECK: "-fsanitize-address-destructor=none"
 
 // Check it's possible to override the driver's decision.
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \
-// RUN:   -mkernel -### -fsanitize-address-destructor-kind=global %s 2>&1 | \
+// RUN:   -mkernel -### -fsanitize-address-destructor=global %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-OVERRIDE %s
 
-// CHECK-OVERRIDE: "-fsanitize-address-destructor-kind=global"
+// CHECK-OVERRIDE: "-fsanitize-address-destructor=global"
Index: clang/test/CodeGen/asan-destructor-kind.cpp
===
--- clang/test/CodeGen/asan-destructor-kind.cpp
+++ clang/test/CodeGen/asan-destructor-kind.cpp
@@ -1,9 +1,9 @@
 // Frontend rejects invalid option
 // RUN: not %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=bad_arg -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=bad_arg -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 %s 2>&1 | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-BAD-ARG
-// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor-kind=bad_arg'
+// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor=bad_arg'
 
 // Default is global dtor
 // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 \
@@ -16,12 +16,12 @@
 
 // Explictly ask for global dtor
 // RUN: %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=global -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=global -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 -fno-legacy-pass-manager %s | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR
 //
 // RUN: %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=global -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=global -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 -flegacy-pass-manager %s | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR
 
@@ -30,12 +30,12 @@
 
 // Explictly ask for no dtors
 // RUN: %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=none -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=none -emit-llvm -o - \
 // RUN

[PATCH] D101491: [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` suffix.

2021-04-29 Thread Dan Liew via Phabricator via cfe-commits
delcypher added a comment.

@jansvoboda11 I'm going to land this patch as is (with your nit fixed). If you 
would like me to add an alias please follow up with me and I can put up a patch 
to do that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101491

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


[PATCH] D101491: [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` suffix.

2021-04-29 Thread Dan Liew 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 rG2d42b2ee7baf: [ASan] Rename 
`-fsanitize-address-destructor-kind=` to drop the `-kind` suffix. (authored by 
delcypher).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101491

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/CodeGen/asan-destructor-kind.cpp
  clang/test/Driver/darwin-asan-mkernel-kext.c
  clang/test/Driver/fsanitize-address-destructor-kind.c
  clang/test/Driver/fsanitize-address-destructor.c

Index: clang/test/Driver/fsanitize-address-destructor.c
===
--- clang/test/Driver/fsanitize-address-destructor.c
+++ clang/test/Driver/fsanitize-address-destructor.c
@@ -2,19 +2,19 @@
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address %s \
 // RUN:   -### 2>&1 | \
 // RUN:   FileCheck %s
-// CHECK-NOT: -fsanitize-address-destructor-kind
+// CHECK-NOT: -fsanitize-address-destructor
 
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=none %s -### 2>&1 | \
+// RUN:   -fsanitize-address-destructor=none %s -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-NONE-ARG %s
-// CHECK-NONE-ARG: "-fsanitize-address-destructor-kind=none"
+// CHECK-NONE-ARG: "-fsanitize-address-destructor=none"
 
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=global %s -### 2>&1 | \
+// RUN:   -fsanitize-address-destructor=global %s -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-GLOBAL-ARG %s
-// CHECK-GLOBAL-ARG: "-fsanitize-address-destructor-kind=global"
+// CHECK-GLOBAL-ARG: "-fsanitize-address-destructor=global"
 
 // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=bad_arg %s -### 2>&1 | \
+// RUN:   -fsanitize-address-destructor=bad_arg %s -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-INVALID-ARG %s
-// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor-kind='
+// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor='
Index: clang/test/Driver/darwin-asan-mkernel-kext.c
===
--- clang/test/Driver/darwin-asan-mkernel-kext.c
+++ clang/test/Driver/darwin-asan-mkernel-kext.c
@@ -5,11 +5,11 @@
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \
 // RUN:   -mkernel -### %s 2>&1 | FileCheck %s
 
-// CHECK: "-fsanitize-address-destructor-kind=none"
+// CHECK: "-fsanitize-address-destructor=none"
 
 // Check it's possible to override the driver's decision.
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \
-// RUN:   -mkernel -### -fsanitize-address-destructor-kind=global %s 2>&1 | \
+// RUN:   -mkernel -### -fsanitize-address-destructor=global %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=CHECK-OVERRIDE %s
 
-// CHECK-OVERRIDE: "-fsanitize-address-destructor-kind=global"
+// CHECK-OVERRIDE: "-fsanitize-address-destructor=global"
Index: clang/test/CodeGen/asan-destructor-kind.cpp
===
--- clang/test/CodeGen/asan-destructor-kind.cpp
+++ clang/test/CodeGen/asan-destructor-kind.cpp
@@ -1,9 +1,9 @@
 // Frontend rejects invalid option
 // RUN: not %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=bad_arg -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=bad_arg -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 %s 2>&1 | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-BAD-ARG
-// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor-kind=bad_arg'
+// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor=bad_arg'
 
 // Default is global dtor
 // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 \
@@ -16,12 +16,12 @@
 
 // Explictly ask for global dtor
 // RUN: %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=global -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=global -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 -fno-legacy-pass-manager %s | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR
 //
 // RUN: %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=global -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=global -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 -flegacy-pass-manager %s | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR
 
@@ -30,12 +30,12 @@
 
 // Explictly ask for no dtors
 // 

[clang] 2d42b2e - [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` suffix.

2021-04-29 Thread Dan Liew via cfe-commits

Author: Dan Liew
Date: 2021-04-29T11:55:42-07:00
New Revision: 2d42b2ee7bafe76d6b2c792b73f7371cb1cf8d94

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

LOG: [ASan] Rename `-fsanitize-address-destructor-kind=` to drop the `-kind` 
suffix.

Renaming the option is based on discussions in https://reviews.llvm.org/D101122.

It is normally not a good idea to rename driver flags but this flag is
new enough and obscure enough that it is very unlikely to have adopters.

While we're here also drop the `` metavar. It's not necessary and
is actually inconsistent with the documentation in
`clang/docs/ClangCommandLineReference.rst`.

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

Added: 
clang/test/Driver/fsanitize-address-destructor.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/SanitizerArgs.cpp
clang/test/CodeGen/asan-destructor-kind.cpp
clang/test/Driver/darwin-asan-mkernel-kext.c

Removed: 
clang/test/Driver/fsanitize-address-destructor-kind.c



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 24e0040a4f50d..6b67dc07982bd 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -870,7 +870,7 @@ Enable use-after-scope detection in AddressSanitizer
 
 Enable ODR indicator globals to avoid false ODR violation reports in partially 
sanitized programs at the cost of an increase in binary size
 
-.. option:: -fsanitize-address-destructor-kind=
+.. option:: -fsanitize-address-destructor=
 
 Set the kind of module destructors emitted by AddressSanitizer instrumentation.
 These destructors are emitted to unregister instrumented global variables when

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index eaebed5978368..8c9033ded10b6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1539,9 +1539,8 @@ defm sanitize_address_use_odr_indicator : BoolOption<"f", 
"sanitize-address-use-
 " reports in partially sanitized programs at the cost of an 
increase in binary size">,
   NegFlag>,
   Group;
-def sanitize_address_destructor_kind_EQ
-: Joined<["-"], "fsanitize-address-destructor-kind=">,
-  MetaVarName<"">,
+def sanitize_address_destructor_EQ
+: Joined<["-"], "fsanitize-address-destructor=">,
   Flags<[CC1Option]>,
   HelpText<"Set destructor type used in ASan instrumentation">,
   Group,

diff  --git a/clang/lib/Driver/SanitizerArgs.cpp 
b/clang/lib/Driver/SanitizerArgs.cpp
index 0f9f5d87696c4..8cb4f50eaac47 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -832,7 +832,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
 }
 
 if (const auto *Arg =
-Args.getLastArg(options::OPT_sanitize_address_destructor_kind_EQ)) 
{
+Args.getLastArg(options::OPT_sanitize_address_destructor_EQ)) {
   auto parsedAsanDtorKind = AsanDtorKindFromString(Arg->getValue());
   if (parsedAsanDtorKind == llvm::AsanDtorKind::Invalid) {
 TC.getDriver().Diag(clang::diag::err_drv_unsupported_option_argument)
@@ -1098,7 +1098,7 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const 
llvm::opt::ArgList &Args,
   // Only pass the option to the frontend if the user requested,
   // otherwise the frontend will just use the codegen default.
   if (AsanDtorKind != llvm::AsanDtorKind::Invalid) {
-CmdArgs.push_back(Args.MakeArgString("-fsanitize-address-destructor-kind=" 
+
+CmdArgs.push_back(Args.MakeArgString("-fsanitize-address-destructor=" +
  AsanDtorKindToString(AsanDtorKind)));
   }
 

diff  --git a/clang/test/CodeGen/asan-destructor-kind.cpp 
b/clang/test/CodeGen/asan-destructor-kind.cpp
index 567482b726435..8d70b663f67a2 100644
--- a/clang/test/CodeGen/asan-destructor-kind.cpp
+++ b/clang/test/CodeGen/asan-destructor-kind.cpp
@@ -1,9 +1,9 @@
 // Frontend rejects invalid option
 // RUN: not %clang_cc1 -fsanitize=address \
-// RUN:   -fsanitize-address-destructor-kind=bad_arg -emit-llvm -o - \
+// RUN:   -fsanitize-address-destructor=bad_arg -emit-llvm -o - \
 // RUN:   -triple x86_64-apple-macosx10.15 %s 2>&1 | \
 // RUN:   FileCheck %s --check-prefixes=CHECK-BAD-ARG
-// CHECK-BAD-ARG: invalid value 'bad_arg' in 
'-fsanitize-address-destructor-kind=bad_arg'
+// CHECK-BAD-ARG: invalid value 'bad_arg' in 
'-fsanitize-address-destructor=bad_arg'
 
 // Default is global dtor
 // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple 
x86_64-apple-macosx10.15 \
@@ -16,12 +16,12 @@
 
 // Explictly ask for global dtor
 // RUN: %clang_cc1 -fsanitize=address \
-// RUN:   -fs

[PATCH] D101561: [Prototype] Introduce attribute for ignoring C++ ABI

2021-04-29 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added a reviewer: aaron.ballman.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101561

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -4204,6 +4204,8 @@
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
+if (RT->getDecl()->hasAttr())
+  return ABIArgInfo::getDirect();
   }
 
   const Type *Base = nullptr;
Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -3150,6 +3150,12 @@
   }];
 }
 
+def UnstableABIDocs : Documentation {
+  let Category = DocCatDecl;
+  let Content = [{
+  }];
+}
+
 def MSInheritanceDocs : Documentation {
   let Category = DocCatDecl;
   let Heading = "__single_inhertiance, __multiple_inheritance, 
__virtual_inheritance";
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1538,6 +1538,16 @@
   let SimpleHandler = 1;
 }
 
+def UnstableABI : InheritableAttr {
+  // This attribute does not have a C [[]] spelling because it requires the
+  // CPlusPlus language option.
+  let Spellings = [Clang<"unstable_abi", 0>];
+  let Subjects = SubjectList<[CXXRecord]>;
+  let Documentation = [UnstableABIDocs];
+  let LangOpts = [CPlusPlus];
+  let SimpleHandler = 1;
+}
+
 def MaxFieldAlignment : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -4204,6 +4204,8 @@
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
+if (RT->getDecl()->hasAttr())
+  return ABIArgInfo::getDirect();
   }
 
   const Type *Base = nullptr;
Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -3150,6 +3150,12 @@
   }];
 }
 
+def UnstableABIDocs : Documentation {
+  let Category = DocCatDecl;
+  let Content = [{
+  }];
+}
+
 def MSInheritanceDocs : Documentation {
   let Category = DocCatDecl;
   let Heading = "__single_inhertiance, __multiple_inheritance, __virtual_inheritance";
Index: clang/include/clang/Basic/Attr.td
===
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1538,6 +1538,16 @@
   let SimpleHandler = 1;
 }
 
+def UnstableABI : InheritableAttr {
+  // This attribute does not have a C [[]] spelling because it requires the
+  // CPlusPlus language option.
+  let Spellings = [Clang<"unstable_abi", 0>];
+  let Subjects = SubjectList<[CXXRecord]>;
+  let Documentation = [UnstableABIDocs];
+  let LangOpts = [CPlusPlus];
+  let SimpleHandler = 1;
+}
+
 def MaxFieldAlignment : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91949: [clang-format] Add BeforeStructInitialization option in BraceWrapping configuration

2021-04-29 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2705
   }
-  if (FormatTok->Tok.is(tok::l_brace)) {
+  if (FormatTok->Tok.is(tok::equal)) {
+nextToken();

MyDeveloperDay wrote:
> shouldn't this be
> 
> ```FormatTok->Tok.is(tok::equal) && 
> Style.BraceWrapping.BeforeStructInitialization```
> 
> Otherwise you won't go into the `else if (FormatTok->Tok.is(tok::l_brace)) {` 
>  if its not turned on?
Is there a test case which would fail without that change? (I think no.) Should 
there be one? (I think yes!)


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

https://reviews.llvm.org/D91949

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


[PATCH] D99599: [NewPM] Add an option to dump pass structure

2021-04-29 Thread Haowei Wu via Phabricator via cfe-commits
haowei added a comment.

Output from `clang -flegacy-pass-manager -fdebug-pass-structure -O0 -S 
-emit-llvm 
/opt/s/w/ir/x/w/llvm-project/clang/test/Driver/debug-pass-structure.c -o 
/dev/null 2>&1`:

  Pass Arguments:  -tti -targetlibinfo
  Target Transform Information
  Target Library Information
FunctionPass Manager
  Pass Arguments:  -tti -targetlibinfo -assumption-cache-tracker 
-profile-summary-info -annotation2metadata -forceattrs -basiccg -always-inline 
-barrier -annotation-remarks
  Target Transform Information
  Target Library Information
  Assumption Cache Tracker
  Profile summary info
ModulePass Manager
  Annotation2Metadata
  Force set function attributes
  CallGraph Construction
  Call Graph SCC Pass Manager
Inliner for always_inline functions
  A No-Op Barrier Pass
  FunctionPass Manager
Annotation Remarks
  Print Module IR
  Pass Arguments:  -tti
  Target Transform Information
ModulePass Manager


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99599

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


[PATCH] D99432: [OPENMP]Fix PR48851: the locals are not globalized in SPMD mode.

2021-04-29 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 added a comment.

In D99432#2726391 , @ABataev wrote:

> In D99432#2726337 , @estewart08 
> wrote:
>
>> In D99432#2726060 , @ABataev wrote:
>>
>>> In D99432#2726050 , @estewart08 
>>> wrote:
>>>
 In D99432#2726025 , @ABataev 
 wrote:

> In D99432#2726019 , @estewart08 
> wrote:
>
>> In reference to https://bugs.llvm.org/show_bug.cgi?id=48851, I do not 
>> see how this helps SPMD mode with team privatization of declarations 
>> in-between target teams and parallel regions.
>
> Diв you try the reproducer with the applied patch?

 Yes, I still saw the test fail, although it was not with latest 
 llvm-project. Are you saying the reproducer passes for you?
>>>
>>> I don't have CUDA installed but from what I see in the LLVM IR it shall 
>>> pass. Do you have a debug log, does it crashes or produces incorrect 
>>> results?
>>
>> This is on an AMDGPU but I assume the behavior would be similar for NVPTX.
>>
>> It produces incorrect/incomplete results in the dist[0] index after a manual 
>> reduction and in turn the final global gpu_results array is incorrect.
>> When thread 0 does a reduction into dist[0] it has no knowledge of dist[1] 
>> having been updated by thread 1. Which tells me the array is still thread 
>> private.
>> Adding some printfs, looking at one teams' output:
>>
>> SPMD
>>
>>   Thread 0: dist[0]: 1
>>   Thread 0: dist[1]: 0  // This should be 1
>>   After reduction into dist[0]: 1  // This should be 2
>>   gpu_results = [1,1]  // [2,2] expected
>>
>> Generic Mode:
>>
>>   Thread 0: dist[0]: 1
>>   Thread 0: dist[1]: 1   
>>   After reduction into dist[0]: 2
>>   gpu_results = [2,2]
>
> Hmm, I would expect a crash if the array was allocated in the local memory. 
> Could you try to add some more printfs (with data and addresses of the array) 
> to check the results? Maybe there is a data race somewhere in the code?

As a reminder, each thread updates a unique index in the dist array and each 
team updates a unique index in gpu_results.

SPMD - shows each thread has a unique address for dist array

  Team 0 Thread 1: dist[0]: 0, 0x7f92e24a8bf8
  Team 0 Thread 1: dist[1]: 1, 0x7f92e24a8bfc
  
  Team 0 Thread 0: dist[0]: 1, 0x7f92e24a8bf0
  Team 0 Thread 0: dist[1]: 0, 0x7f92e24a8bf4
  
  Team 0 Thread 0: After reduction into dist[0]: 1
  Team 0 Thread 0: gpu_results address: 0x7f92a500
  --
  Team 1 Thread 1: dist[0]: 0, 0x7f92f9ec5188
  Team 1 Thread 1: dist[1]: 1, 0x7f92f9ec518c
  
  Team 1 Thread 0: dist[0]: 1, 0x7f92f9ec5180
  Team 1 Thread 0: dist[1]: 0, 0x7f92f9ec5184
  
  Team 1 Thread 0: After reduction into dist[0]: 1
  Team 1 Thread 0: gpu_results address: 0x7f92a500
  
  gpu_results[0]: 1
  gpu_results[1]: 1

Generic - shows each team shares dist array address amongst threads

  Team 0 Thread 1: dist[0]: 1, 0x7fac01938880
  Team 0 Thread 1: dist[1]: 1, 0x7fac01938884
  
  Team 0 Thread 0: dist[0]: 1, 0x7fac01938880
  Team 0 Thread 0: dist[1]: 1, 0x7fac01938884
  
  Team 0 Thread 0: After reduction into dist[0]: 2
  Team 0 Thread 0: gpu_results address: 0x7fabc500
  --
  Team 1 Thread 1: dist[0]: 1, 0x7fac19354e10
  Team 1 Thread 1: dist[1]: 1, 0x7fac19354e14
  
  Team 1 Thread 0: dist[0]: 1, 0x7fac19354e10
  Team 1 Thread 0: dist[1]: 1, 0x7fac19354e14
  
  Team 1 Thread 0: After reduction into dist[0]: 2
  Team 1 Thread 0: gpu_results address: 0x7fabc500


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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


[PATCH] D99381: [compiler-rt][hwasan] Add Fuchsia-specific sanitizer platform limits

2021-04-29 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 341610.
leonardchan marked an inline comment as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99381

Files:
  compiler-rt/lib/hwasan/hwasan_interceptors.cpp
  compiler-rt/lib/hwasan/hwasan_interface_internal.h
  compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_fuchsia.h


Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_fuchsia.h
===
--- /dev/null
+++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_fuchsia.h
@@ -0,0 +1,25 @@
+//===-- sanitizer_platform_limits_fuchsia.h 
---===//
+//
+// 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 is a part of Sanitizer common code.
+//
+// Sizes and layouts of platform-specific Fuchsia data structures.
+//===--===//
+
+#ifndef SANITIZER_PLATFORM_LIMITS_FUCHSIA_H
+#define SANITIZER_PLATFORM_LIMITS_FUCHSIA_H
+
+#if SANITIZER_FUCHSIA
+
+namespace __sanitizer {
+struct __sanitizer_struct_mallinfo {};
+}  // namespace __sanitizer
+
+#endif  // SANITIZER_FUCHSIA
+
+#endif
Index: compiler-rt/lib/hwasan/hwasan_interface_internal.h
===
--- compiler-rt/lib/hwasan/hwasan_interface_internal.h
+++ compiler-rt/lib/hwasan/hwasan_interface_internal.h
@@ -15,6 +15,7 @@
 #define HWASAN_INTERFACE_INTERNAL_H
 
 #include "sanitizer_common/sanitizer_internal_defs.h"
+#include "sanitizer_common/sanitizer_platform_limits_fuchsia.h"
 #include "sanitizer_common/sanitizer_platform_limits_posix.h"
 #include 
 
Index: compiler-rt/lib/hwasan/hwasan_interceptors.cpp
===
--- compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -21,6 +21,7 @@
 #include "hwasan_thread.h"
 #include "hwasan_poisoning.h"
 #include "hwasan_report.h"
+#include "sanitizer_common/sanitizer_platform_limits_fuchsia.h"
 #include "sanitizer_common/sanitizer_platform_limits_posix.h"
 #include "sanitizer_common/sanitizer_allocator.h"
 #include "sanitizer_common/sanitizer_allocator_interface.h"


Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_fuchsia.h
===
--- /dev/null
+++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_fuchsia.h
@@ -0,0 +1,25 @@
+//===-- sanitizer_platform_limits_fuchsia.h ---===//
+//
+// 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 is a part of Sanitizer common code.
+//
+// Sizes and layouts of platform-specific Fuchsia data structures.
+//===--===//
+
+#ifndef SANITIZER_PLATFORM_LIMITS_FUCHSIA_H
+#define SANITIZER_PLATFORM_LIMITS_FUCHSIA_H
+
+#if SANITIZER_FUCHSIA
+
+namespace __sanitizer {
+struct __sanitizer_struct_mallinfo {};
+}  // namespace __sanitizer
+
+#endif  // SANITIZER_FUCHSIA
+
+#endif
Index: compiler-rt/lib/hwasan/hwasan_interface_internal.h
===
--- compiler-rt/lib/hwasan/hwasan_interface_internal.h
+++ compiler-rt/lib/hwasan/hwasan_interface_internal.h
@@ -15,6 +15,7 @@
 #define HWASAN_INTERFACE_INTERNAL_H
 
 #include "sanitizer_common/sanitizer_internal_defs.h"
+#include "sanitizer_common/sanitizer_platform_limits_fuchsia.h"
 #include "sanitizer_common/sanitizer_platform_limits_posix.h"
 #include 
 
Index: compiler-rt/lib/hwasan/hwasan_interceptors.cpp
===
--- compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -21,6 +21,7 @@
 #include "hwasan_thread.h"
 #include "hwasan_poisoning.h"
 #include "hwasan_report.h"
+#include "sanitizer_common/sanitizer_platform_limits_fuchsia.h"
 #include "sanitizer_common/sanitizer_platform_limits_posix.h"
 #include "sanitizer_common/sanitizer_allocator.h"
 #include "sanitizer_common/sanitizer_allocator_interface.h"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99381: [compiler-rt][hwasan] Add Fuchsia-specific sanitizer platform limits

2021-04-29 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

In D99381#2723563 , @vitalybuka wrote:

> In D99381#2721619 , @phosek wrote:
>
>> What I think @vitalybuka meant is keeping 
>> `sanitizer_platform_limits_fuchsia.h` as you had it, but including it 
>> unconditionally. Since the entire file is wrapped in `#if SANITIZER_FUCHSIA 
>> ... #endif`, the inclusion would be a no-op on platforms other than Fuchsia 
>> so no need to wrap the `#include` in `#if SANITIZER_FUCHSIA` as well.
>
> Correct., Just:
>
>   #include "sanitizer_common/sanitizer_platform_limits_fuchsia.h"
>   #include "sanitizer_common/sanitizer_platform_limits_posix.h"

I see. Thanks for the clarifications.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99381

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


[PATCH] D101564: [OpenMP] Fix second debug name from map clause

2021-04-29 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny created this revision.
jdenny added reviewers: jhuber6, jdoerfert.
Herald added subscribers: guansong, yaxunl.
jdenny requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: clang.

This patch fixes a bug from D89802 .  For 
example, without it, Clang
generates x as the debug map name for both x and y in the following
example:

  #pragma omp target map(to: x, y)
  x = y = 1;


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101564

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/target_map_names.cpp


Index: clang/test/OpenMP/target_map_names.cpp
===
--- clang/test/OpenMP/target_map_names.cpp
+++ clang/test/OpenMP/target_map_names.cpp
@@ -16,7 +16,6 @@
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
-// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->s.f;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
@@ -25,7 +24,6 @@
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
-// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.p[:33];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";ps->p[:33];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
@@ -181,6 +179,18 @@
 
 // DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";s.Z[0:64];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
 
+// Clang used to mistakenly generate the map name "x" for both x and y on this
+// directive.  Conditions to reproduce the bug: a single map clause has two
+// variables, and at least the second is used in the associated statement.
+//
+// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";x;{{.*}}.cpp;[[@LINE+3]];7;;\00"
+// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] 
c";y;{{.*}}.cpp;[[@LINE+2]];10;;\00"
+void secondMapNameInClause() {
+  int x, y;
+  #pragma omp target map(to: x, y)
+  x = y = 1;
+}
+
 // DEBUG: %{{.+}} = call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, 
i64 -1, i8* @{{.+}}, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* 
{{.+}}, i8** getelementptr inbounds ([{{[0-9]+}} x i8*], [{{[0-9]+}} x i8*]* 
@.offload_mapnames{{.*}}, i32 0, i32 0), i8** {{.+}})
 // DEBUG: %{{.+}} = call i32 @__tgt_target_teams_mapper(%struct.ident_t* 
@{{.+}}, i64 -1, i8* @{{.+}}, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, 
i64* {{.+}}, i8** getelementptr inbounds ([{{[0-9]+}} x i8*], [{{[0-9]+}} x 
i8*]* @.offload_mapnames{{.*}}, i32 0, i32 0), i8** {{.+}}, i32 {{.+}}, i32 
{{.+}})
 // DEBUG: call void @__tgt_target_data_begin_mapper(%struct.ident_t* @{{.+}}, 
i64 -1, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* {{.+}}, i8** 
getelementptr inbounds ([{{[0-9]+}} x i8*], [{{[0-9]+}} x i8*]* 
@.offload_mapnames{{.*}}, i32 0, i32 0), i8** {{.+}})
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7764,6 +7764,8 @@
   const ValueDecl *MapDecl = (I->getAssociatedDeclaration())
  ? I->getAssociatedDeclaration()
  : BaseDecl;
+  MapExpr = (I->getAssociatedExpression()) ? I->getAssociatedExpression()
+   : MapExpr;
 
   // Get information on whether the element is a pointer. Have to do a
   // special treatment for array sections given that they are built-in


Index: clang/test/OpenMP/target_map_names.cpp
=

[PATCH] D101564: [OpenMP] Fix second debug name from map clause

2021-04-29 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 accepted this revision.
jhuber6 added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101564

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


[PATCH] D101566: Let -Wweak-template-vtables warn on implicit instantiations

2021-04-29 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert created this revision.
aaronpuchert added reviewers: dblaikie, rsmith.
aaronpuchert requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Implicit instantiations of template classes with virtual methods might
cause the vtable (and all virtual functions) to be instantiated and
emitted in multiple translation units. An explicit instantiation
declaration next to the template definition would ensure that only the
translation unit with the corresponding definition emits the vtable.

There are two places where we could emit the warning, on the class or
the implicit instantiation. I decided for emitting the warning on the
class, because that's likely where the fix would need to be. (Unless the
programmer decides to drop the instantiation or give a template argument
internal linkage.)

Fixes PR18733.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101566

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/warn-weak-vtables.cpp


Index: clang/test/SemaCXX/warn-weak-vtables.cpp
===
--- clang/test/SemaCXX/warn-weak-vtables.cpp
+++ clang/test/SemaCXX/warn-weak-vtables.cpp
@@ -8,7 +8,7 @@
   virtual void f() { } 
 };
 
-template struct B {
+template struct B { // expected-warning {{there is no explicit 
instantiation declaration for 'B', its vtable will be emitted in every 
translation unit}}
   virtual void f() { } 
 };
 
@@ -29,7 +29,8 @@
 // Use the vtables
 void uses_abc() {
   A a;
-  B b;
+  B b; // expected-note{{implicit instantiation first required here}}
+  B b_internal;
   C c;
 }
 
@@ -63,7 +64,7 @@
   virtual void f();
 };
 
-template class TemplVirt; // expected-warning{{explicit template 
instantiation 'TemplVirt' will emit a vtable in every translation unit}}
+template class TemplVirt;
 
 template<> struct TemplVirt {
   virtual void f();
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -17359,15 +17359,19 @@
 // no key function or the key function is inlined. Don't warn in C++ ABIs
 // that lack key functions, since the user won't be able to make one.
 if (Context.getTargetInfo().getCXXABI().hasKeyFunctions() &&
-Class->isExternallyVisible() && ClassTSK != TSK_ImplicitInstantiation) 
{
+Class->isExternallyVisible() &&
+ClassTSK != TSK_ExplicitInstantiationDefinition) {
   const FunctionDecl *KeyFunctionDef = nullptr;
   if (!KeyFunction || (KeyFunction->hasBody(KeyFunctionDef) &&
KeyFunctionDef->isInlined())) {
-Diag(Class->getLocation(),
- ClassTSK == TSK_ExplicitInstantiationDefinition
- ? diag::warn_weak_template_vtable
- : diag::warn_weak_vtable)
-<< Class;
+if (ClassTSK == TSK_ImplicitInstantiation) {
+  const auto *CTSD = cast(Class);
+  Diag(Class->getLocation(), diag::warn_weak_template_vtable) << Class;
+  Diag(CTSD->getPointOfInstantiation(),
+   diag::note_instantiation_required_here)
+  << /* explicit */ false;
+} else
+  Diag(Class->getLocation(), diag::warn_weak_vtable) << Class;
   }
 }
   }
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1583,8 +1583,8 @@
   "emitted in every translation unit">,
   InGroup>, DefaultIgnore;
 def warn_weak_template_vtable : Warning<
-  "explicit template instantiation %0 will emit a vtable in every "
-  "translation unit">,
+  "there is no explicit instantiation declaration for %0; its vtable will be "
+  "emitted in every translation unit">,
   InGroup>, DefaultIgnore;
 
 def ext_using_undefined_std : ExtWarn<


Index: clang/test/SemaCXX/warn-weak-vtables.cpp
===
--- clang/test/SemaCXX/warn-weak-vtables.cpp
+++ clang/test/SemaCXX/warn-weak-vtables.cpp
@@ -8,7 +8,7 @@
   virtual void f() { } 
 };
 
-template struct B {
+template struct B { // expected-warning {{there is no explicit instantiation declaration for 'B', its vtable will be emitted in every translation unit}}
   virtual void f() { } 
 };
 
@@ -29,7 +29,8 @@
 // Use the vtables
 void uses_abc() {
   A a;
-  B b;
+  B b; // expected-note{{implicit instantiation first required here}}
+  B b_internal;
   C c;
 }
 
@@ -63,7 +64,7 @@
   virtual void f();
 };
 
-template class TemplVirt; // expected-warning{{explicit template instantiation 'TemplVirt' will emit a vtable in every translation unit}}
+template class TemplVirt;
 
 template<> struct TemplVirt {
   virtual void f();
Index: clang/lib/Sema/SemaDeclCXX.

  1   2   >