[clang] 577e0ef - [clang][AST] Silence unused-value warnings in unittest DeclPrinterTest

2024-03-27 Thread Alina Sbirlea via cfe-commits

Author: Alina Sbirlea
Date: 2024-03-26T23:24:02-07:00
New Revision: 577e0ef94fb0b4ba9f97a6f58a1961f7ba247d21

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

LOG: [clang][AST] Silence unused-value warnings in unittest DeclPrinterTest

Added: 


Modified: 
clang/unittests/AST/DeclPrinterTest.cpp

Removed: 




diff  --git a/clang/unittests/AST/DeclPrinterTest.cpp 
b/clang/unittests/AST/DeclPrinterTest.cpp
index 07fa02bd96e25d..8a29d0544a04bf 100644
--- a/clang/unittests/AST/DeclPrinterTest.cpp
+++ b/clang/unittests/AST/DeclPrinterTest.cpp
@@ -1391,7 +1391,7 @@ TEST(DeclPrinter, TestCXXRecordDecl17) {
   "struct X {};"
   "Z A;",
   "A", "Z A"));
-  [](PrintingPolicy ) { Policy.SuppressTagKeyword = false; };
+  (void)[](PrintingPolicy ) { Policy.SuppressTagKeyword = false; };
 }
 
 TEST(DeclPrinter, TestCXXRecordDecl18) {
@@ -1402,7 +1402,7 @@ TEST(DeclPrinter, TestCXXRecordDecl18) {
   "struct Y{};"
   "Y, 2> B;",
   "B", "Y, 2> B"));
-  [](PrintingPolicy ) { Policy.SuppressTagKeyword = false; };
+  (void)[](PrintingPolicy ) { Policy.SuppressTagKeyword = false; };
 }
 
 TEST(DeclPrinter, TestCXXRecordDecl19) {
@@ -1413,7 +1413,7 @@ TEST(DeclPrinter, TestCXXRecordDecl19) {
   "struct Y{};"
   "Y, 2> B;",
   "B", "Y, 2> B"));
-  [](PrintingPolicy ) { Policy.SuppressTagKeyword = true; };
+  (void)[](PrintingPolicy ) { Policy.SuppressTagKeyword = true; };
 }
 TEST(DeclPrinter, TestCXXRecordDecl20) {
   ASSERT_TRUE(PrintedDeclCXX98Matches(
@@ -1432,7 +1432,7 @@ TEST(DeclPrinter, TestCXXRecordDecl20) {
   "Outer, 5>::NestedStruct nestedInstance(100);",
   "nestedInstance",
   "Outer, 5>::NestedStruct nestedInstance(100)"));
-  [](PrintingPolicy ) { Policy.SuppressTagKeyword = false; };
+  (void)[](PrintingPolicy ) { Policy.SuppressTagKeyword = false; };
 }
 
 TEST(DeclPrinter, TestCXXRecordDecl21) {
@@ -1452,7 +1452,7 @@ TEST(DeclPrinter, TestCXXRecordDecl21) {
   "Outer, 5>::NestedStruct nestedInstance(100);",
   "nestedInstance",
   "Outer, 5>::NestedStruct nestedInstance(100)"));
-  [](PrintingPolicy ) { Policy.SuppressTagKeyword = true; };
+  (void)[](PrintingPolicy ) { Policy.SuppressTagKeyword = true; };
 }
 
 TEST(DeclPrinter, TestFunctionParamUglified) {



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


[clang] e22de4e - [DominatorTree] Simplify ChildrenGetter.

2020-07-28 Thread Alina Sbirlea via cfe-commits

Author: Alina Sbirlea
Date: 2020-07-28T15:44:20-07:00
New Revision: e22de4e46d1dd1aacc3a7060d24bcbe89908ba6c

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

LOG: [DominatorTree] Simplify ChildrenGetter.

Summary:
Simplify ChildrenGetter to a simple wrapper around a GraphDiff call.
GraphDiff already handles nullptr in children, so the special casing in
clang can also be removed.

Reviewers: kuhar, dblaikie

Subscribers: llvm-commits, cfe-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/include/clang/Analysis/Analyses/Dominators.h
llvm/include/llvm/Support/GenericDomTreeConstruction.h

Removed: 




diff  --git a/clang/include/clang/Analysis/Analyses/Dominators.h 
b/clang/include/clang/Analysis/Analyses/Dominators.h
index 95a661138df4..25a5ba9d83fe 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -273,76 +273,6 @@ class ControlDependencyCalculator : public ManagedAnalysis 
{
 
 namespace llvm {
 
-/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
-/// if statement's condition is always false, it's 'then' branch is represented
-/// with a nullptr. This however will result in a nullpointer derefernece for
-/// dominator tree calculation.
-///
-/// To circumvent this, let's just crudely specialize the children getters
-/// used in LLVM's dominator tree builder.
-namespace DomTreeBuilder {
-
-using ClangCFGDomChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
- 
/*Inverse=*/false>;
-
-template <>
-template <>
-inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  ResultTy Ret(RChildren.begin(), RChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGDomReverseChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
-  
/*Inverse=*/true>;
-
-template <>
-template <>
-inline ClangCFGDomReverseChildrenGetter::ResultTy
-ClangCFGDomReverseChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  ResultTy Ret(IChildren.begin(), IChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGPostDomChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
- 
/*Inverse=*/false>;
-
-template <>
-template <>
-inline ClangCFGPostDomChildrenGetter::ResultTy
-ClangCFGPostDomChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  ResultTy Ret(RChildren.begin(), RChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGPostDomReverseChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
-  
/*Inverse=*/true>;
-
-template <>
-template <>
-inline ClangCFGPostDomReverseChildrenGetter::ResultTy
-ClangCFGPostDomReverseChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  ResultTy Ret(IChildren.begin(), IChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-} // end of namespace DomTreeBuilder
-
 //===-
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.

diff  --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h 
b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index 5a1f03c879db..6a9d38bceb38 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -103,31 +103,13 @@ struct SemiNCAInfo {
 // in progress, we need this information to continue it.
   }
 
-  template  struct ChildrenGetter {
-using ResultTy = SmallVector;
-
-static ResultTy Get(NodePtr N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  return ResultTy(RChildren.begin(), RChildren.end());
-}
-
-static ResultTy Get(NodePtr N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  return ResultTy(IChildren.begin(), IChildren.end());
-}
-
-using Tag = std::integral_constant;
-
-// The function below is the core part of the batch updater. It allows the
-// Depth Based Search algorithm to perform incremental updates in lockstep
-// with updates to the 

[clang] bd541b2 - [NewPassManager] Add assertions when getting statefull cached analysis.

2020-05-13 Thread Alina Sbirlea via cfe-commits

Author: Alina Sbirlea
Date: 2020-05-13T12:38:38-07:00
New Revision: bd541b217f4d750391677144ccaa586874236f38

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

LOG: [NewPassManager] Add assertions when getting statefull cached analysis.

Summary:
Analyses that are statefull should not be retrieved through a proxy from
an outer IR unit, as these analyses are only invalidated at the end of
the inner IR unit manager.
This patch disallows getting the outer manager and provides an API to
get a cached analysis through the proxy. If the analysis is not
stateless, the call to getCachedResult will assert.

Reviewers: chandlerc

Subscribers: mehdi_amini, eraman, hiraditya, zzheng, llvm-commits

Tags: #llvm

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

Added: 


Modified: 
clang/test/CodeGen/thinlto-distributed-newpm.ll
llvm/include/llvm/Analysis/AliasAnalysis.h
llvm/include/llvm/Analysis/CGSCCPassManager.h
llvm/include/llvm/IR/PassManager.h
llvm/include/llvm/Transforms/Utils/CallGraphUpdater.h
llvm/lib/Analysis/CGSCCPassManager.cpp
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
llvm/unittests/IR/PassManagerTest.cpp
llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp

Removed: 




diff  --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll 
b/clang/test/CodeGen/thinlto-distributed-newpm.ll
index 5740c6f616be..013da3c9af4c 100644
--- a/clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -85,10 +85,7 @@
 ; CHECK-O: Running pass: PostOrderFunctionAttrsPass on (main)
 ; CHECK-O: Invalidating all non-preserved analyses for: (main)
 ; CHECK-O: Clearing all analysis results for: main
-; CHECK-O: Invalidating analysis: FunctionAnalysisManagerCGSCCProxy on (main)
 ; CHECK-O3: Running pass: ArgumentPromotionPass on (main)
-; CHECK-O2: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
-; CHECK-O: Running analysis: FunctionAnalysisManagerCGSCCProxy on (main)
 ; CHECK-O3: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Running analysis: PassInstrumentationAnalysis on main
 ; CHECK-O3: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>

diff  --git a/llvm/include/llvm/Analysis/AliasAnalysis.h 
b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 95b4c2a482b2..c35ee2f499de 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -1185,8 +1185,8 @@ class AAManager : public AnalysisInfoMixin {
   static void getModuleAAResultImpl(Function , FunctionAnalysisManager ,
 AAResults ) {
 auto  = AM.getResult(F);
-auto  = MAMProxy.getManager();
-if (auto *R = MAM.template getCachedResult(*F.getParent())) {
+if (auto *R =
+MAMProxy.template getCachedResult(*F.getParent())) {
   AAResults.addAAResult(*R);
   MAMProxy
   .template registerOuterAnalysisInvalidation();

diff  --git a/llvm/include/llvm/Analysis/CGSCCPassManager.h 
b/llvm/include/llvm/Analysis/CGSCCPassManager.h
index 4c5191797f59..b5b58686d958 100644
--- a/llvm/include/llvm/Analysis/CGSCCPassManager.h
+++ b/llvm/include/llvm/Analysis/CGSCCPassManager.h
@@ -380,10 +380,15 @@ class FunctionAnalysisManagerCGSCCProxy
 public:
   class Result {
   public:
+explicit Result() : FAM(nullptr) {}
 explicit Result(FunctionAnalysisManager ) : FAM() {}
 
+void updateFAM(FunctionAnalysisManager ) { this->FAM =  }
 /// Accessor for the analysis manager.
-FunctionAnalysisManager () { return *FAM; }
+FunctionAnalysisManager () {
+  assert(FAM);
+  return *FAM;
+}
 
 bool invalidate(LazyCallGraph::SCC , const PreservedAnalyses ,
 CGSCCAnalysisManager::Invalidator );
@@ -415,7 +420,8 @@ using CGSCCAnalysisManagerFunctionProxy =
 /// update result struct for the overall CGSCC walk.
 LazyCallGraph::SCC (
 LazyCallGraph , LazyCallGraph::SCC , LazyCallGraph::Node ,
-CGSCCAnalysisManager , CGSCCUpdateResult );
+CGSCCAnalysisManager , CGSCCUpdateResult ,
+FunctionAnalysisManager );
 
 /// Helper to update the call graph after running a CGSCC pass.
 ///
@@ -425,7 +431,8 @@ LazyCallGraph::SCC 
(
 /// update 

Re: [PATCH] D77341: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

2020-04-09 Thread Alina Sbirlea via cfe-commits
I'm hoping rG5da1671bf823 fixes them. Please let me know if not and I will
revert.

Alina

On Thu, Apr 9, 2020 at 7:03 PM Stella Stamenova via Phabricator <
revi...@reviews.llvm.org> wrote:

> stella.stamenova added a comment.
>
> It looks like this broke the windows lldb buildbot:
>
> lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/15542
>
> It already had a test failure, so you probably didn’t get the email.
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D77341/new/
>
> https://reviews.llvm.org/D77341
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a903749 - [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

2020-04-09 Thread Alina Sbirlea via cfe-commits

Author: Alina Sbirlea
Date: 2020-04-09T18:08:39-07:00
New Revision: a90374988e4eb8c50d91e11f4e61cdbd5debb235

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

LOG: [DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

Summary:
This replaces the ChildrenGetter inside the DominatorTree with
GraphTraits over a GraphDiff object, an object which encapsulated the
view of the previous CFG.
This also simplifies the extentions in clang which use DominatorTree, as
GraphDiff also filters nullptrs.

Reviewers: kuhar, dblaikie, NutshellySima

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang

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

Added: 


Modified: 
clang/include/clang/Analysis/Analyses/Dominators.h
llvm/include/llvm/IR/CFGDiff.h
llvm/include/llvm/IR/Dominators.h
llvm/include/llvm/Support/GenericDomTree.h
llvm/include/llvm/Support/GenericDomTreeConstruction.h
llvm/lib/IR/Dominators.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/Analyses/Dominators.h 
b/clang/include/clang/Analysis/Analyses/Dominators.h
index 061c98137da2..c0cfc186c365 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -275,76 +275,6 @@ class ControlDependencyCalculator : public ManagedAnalysis 
{
 
 namespace llvm {
 
-/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
-/// if statement's condition is always false, it's 'then' branch is represented
-/// with a nullptr. This however will result in a nullpointer derefernece for
-/// dominator tree calculation.
-///
-/// To circumvent this, let's just crudely specialize the children getters
-/// used in LLVM's dominator tree builder.
-namespace DomTreeBuilder {
-
-using ClangCFGDomChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
- 
/*Inverse=*/false>;
-
-template <>
-template <>
-inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  ResultTy Ret(RChildren.begin(), RChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGDomReverseChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
-  
/*Inverse=*/true>;
-
-template <>
-template <>
-inline ClangCFGDomReverseChildrenGetter::ResultTy
-ClangCFGDomReverseChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  ResultTy Ret(IChildren.begin(), IChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGPostDomChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
- 
/*Inverse=*/false>;
-
-template <>
-template <>
-inline ClangCFGPostDomChildrenGetter::ResultTy
-ClangCFGPostDomChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto RChildren = reverse(children(N));
-  ResultTy Ret(RChildren.begin(), RChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-using ClangCFGPostDomReverseChildrenGetter =
-SemiNCAInfo::ChildrenGetter<
-  
/*Inverse=*/true>;
-
-template <>
-template <>
-inline ClangCFGPostDomReverseChildrenGetter::ResultTy
-ClangCFGPostDomReverseChildrenGetter::Get(
-clang::CFGBlock *N, std::integral_constant) {
-  auto IChildren = inverse_children(N);
-  ResultTy Ret(IChildren.begin(), IChildren.end());
-  Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
-  return Ret;
-}
-
-} // end of namespace DomTreeBuilder
-
 //===-
 /// DominatorTree GraphTraits specialization so the DominatorTree can be
 /// iterable by generic graph iterators.

diff  --git a/llvm/include/llvm/IR/CFGDiff.h b/llvm/include/llvm/IR/CFGDiff.h
index c50db0de79a3..5f2b5c709324 100644
--- a/llvm/include/llvm/IR/CFGDiff.h
+++ b/llvm/include/llvm/IR/CFGDiff.h
@@ -195,6 +195,23 @@ template  
class GraphDiff {
 #endif
 };
 
+namespace detail {
+template 
+auto reverse_if_helper(Range &, std::integral_constant) {
+  return std::forward(R);
+}
+
+template 
+auto reverse_if_helper(Range &, std::integral_constant) {
+  return llvm::reverse(std::forward(R));
+}
+
+template  auto reverse_if(Range &) {
+  return reverse_if_helper(std::forward(R),
+   std::integral_constant{});
+}
+} // namespace detail
+
 template >
 struct CFGViewChildren {
@@ -211,9 +228,10 @@ struct CFGViewChildren {
 
 // filter 

[clang] 90bdb03 - Update clang test.

2020-01-17 Thread Alina Sbirlea via cfe-commits

Author: Alina Sbirlea
Date: 2020-01-17T11:08:59-08:00
New Revision: 90bdb037276be43df260af004f620b21645d2617

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

LOG: Update clang test.

Added: 


Modified: 
clang/test/CodeGen/thinlto-distributed-newpm.ll

Removed: 




diff  --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll 
b/clang/test/CodeGen/thinlto-distributed-newpm.ll
index 66bcd1cb250b..bac9c4322045 100644
--- a/clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -170,7 +170,6 @@
 ; CHECK-O: Invalidating analysis: DemandedBitsAnalysis on main
 ; CHECK-O: Invalidating analysis: PostDominatorTreeAnalysis on main
 ; CHECK-O: Invalidating analysis: CallGraphAnalysis
-; CHECK-O: Invalidating analysis: GlobalsAA
 ; CHECK-O: Finished {{.*}}Module pass manager run.
 ; CHECK-O: Running pass: PassManager<{{.*}}Module>
 ; CHECK-O: Starting {{.*}}Module pass manager run.
@@ -180,7 +179,6 @@
 ; CHECK-O: Running pass: ReversePostOrderFunctionAttrsPass
 ; CHECK-O: Running analysis: CallGraphAnalysis
 ; CHECK-O: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
-; CHECK-O: Running analysis: GlobalsAA
 ; CHECK-O: Running pass: 
ModuleToFunctionPassAdaptor<{{.*}}PassManager<{{.*}}Function> >
 ; CHECK-O: Starting {{.*}}Function pass manager run.
 ; CHECK-O: Running pass: Float2IntPass on main



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


Re: [PATCH] D55802: Change CGObjC to use objc intrinsics instead of runtime methods

2019-11-02 Thread Alina Sbirlea via cfe-commits
Following up on this, AFAICT this is working as intended on the LLVM side.

The different decision is made in GlobalsAA + MemoryDependencyAnalysis.
IIUC, the logic there is along the lines of: if I have a global G that's
"internal" ("static" in C), and an intrinsic method M, then M cannot read
from or write to G. In the LLVM IR for the test, @deallocCalled is an
internal global, @llvm.objc.autoreleasePoolPop is an intrinsic, hence
@llvm.objc.autoreleasePoolPop cannot read or write @deallocCalled.

Please note however that there are a couple of things that I found and
intend to fix in GlobalsAA, but they do not seem to affect this case.

The one problem in particular that I thought was relevant here is that the
"MayReadAnyGlobal" is not set on a path in
GlobalsAAResult::AnalyzeCallGraph, but should apply when the function is
not an intrinsic (judging by the other code paths). If
@llvm.objc.autoreleasePoolPop was not an intrinsic, then with the fix in
D69690  would resolve this miscompile.
Perhaps we should not rely on the assumption that intrinsics are restricted
to this behavior in GlobalsAA?

Best,
Alina


On Thu, Oct 17, 2019 at 3:00 PM Alina Sbirlea 
wrote:

> I only got a chance to look more into this now. I can reproduce it with
> re-inserting the "static".
>
> The miscompile is not related to MemorySSA, i.e. disabling all uses of
> MemorySSA doesn't help.
> It appears to be a GVN bug, but I haven't tracked it further than this.
>
> To repro, see attached .ll files. The only difference is the global
> variable being static or not, which in IR translates to internal or
> dso_local.
> A simple `opt -O3 AssociatedObject_O0_*.ll` shows the difference you
> mention.
>
> Reducing the pipeline, I believe the result after the following command is
> incorrect.
> `opt -globals-aa -gvn AssociatedObject_O0_*.ll`
> I'll need to dig deeper to confirm and track down the bug inside the pass.
>
>
> Thanks,
> Alina
>
>
> On Mon, Sep 30, 2019 at 4:30 AM David Chisnall <
> david.chisn...@cl.cam.ac.uk> wrote:
>
>> Hi,
>>
>> Yes, I believe it does still reproduce (at least, with the most recent
>> build that I tried).  We worked around the clang bug to make the test
>> pass:
>>
>>
>> https://github.com/gnustep/libobjc2/commit/eab35fce379eb6ab1423dbb6d7908cb782f13458#diff-7f1eea7fdb5c7c3bf21f08d1cfe98a19
>>
>> Reintroducing the 'static' on deallocCalled reduces the test case to
>> unconditionally failing the assert immediately after the pop, and DCEs
>> the rest of the code.
>>
>> David
>>
>> On 11/09/2019 01:17, Alina Sbirlea wrote:
>> > Hi David,
>> >
>> > Does this still reproduce?
>> > I'm seeing the load after the call to autoreleasePoolPop at ToT, but
>> > perhaps I'm not using the proper flags?
>> > I only checked out the github repo and did "clang
>> > -fobjc-runtime=gnustep-2.0 -O3 -emit-llvm -S
>> > libobjc2/Test/AssociatedObject.m" with a ToT clang.
>> >
>> > Thanks,
>> > Alina
>> >
>> >
>> > On Sun, Feb 24, 2019 at 9:56 AM Pete Cooper via llvm-commits
>> > mailto:llvm-comm...@lists.llvm.org>>
>> wrote:
>> >
>> > Hey David
>> >
>> > Thanks for letting me know, and analysing it this far!
>> >
>> > I also can't see anything wrong with the intrinsic.  Its just
>> > defined as:
>> >
>> > def int_objc_autoreleasePoolPop : Intrinsic<[],
>> > [llvm_ptr_ty]>;
>> >
>> >
>> > which (I believe) means it has unmodelled side effects so it should
>> > have been fine for your example.
>> >
>> > I'll try build the same file you did and see if I can reproduce.
>> >
>> > Cheers,
>> > Pete
>> >
>> >> On Feb 24, 2019, at 7:48 AM, David Chisnall via Phabricator
>> >> mailto:revi...@reviews.llvm.org>>
>> wrote:
>> >>
>> >> theraven added a comment.
>> >> Herald added a project: LLVM.
>> >>
>> >> After some bisection, it appears that this is the revision that
>> >> introduced the regression in the GNUstep Objective-C runtime test
>> >> suite that I reported on the list a few weeks ago.  In this is the
>> >> test (compiled with `-fobjc-runtime=gnustep-2.0 -O3` and an ELF
>> >> triple):
>> >>
>> >>
>> https://github.com/gnustep/libobjc2/blob/master/Test/AssociatedObject.m
>> >>
>> >> After this change, Early CSE w/ MemorySSA is determining that the
>> >> second load of `deallocCalled` is redundant.  The code goes from:
>> >>
>> >>%7 = load i1, i1* @deallocCalled, align 1
>> >>br i1 %7, label %8, label %9
>> >>
>> >>  ; :8:  ; preds = %0
>> >>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x
>> >> i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds
>> >> ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26, i8*
>> >> getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64
>> >> 0)) #5
>> >>unreachable
>> >>
>> >>  ; :9:  ; preds = %0
>> >>   

Re: [PATCH] D55802: Change CGObjC to use objc intrinsics instead of runtime methods

2019-10-18 Thread Alina Sbirlea via cfe-commits
I only got a chance to look more into this now. I can reproduce it with
re-inserting the "static".

The miscompile is not related to MemorySSA, i.e. disabling all uses of
MemorySSA doesn't help.
It appears to be a GVN bug, but I haven't tracked it further than this.

To repro, see attached .ll files. The only difference is the global
variable being static or not, which in IR translates to internal or
dso_local.
A simple `opt -O3 AssociatedObject_O0_*.ll` shows the difference you
mention.

Reducing the pipeline, I believe the result after the following command is
incorrect.
`opt -globals-aa -gvn AssociatedObject_O0_*.ll`
I'll need to dig deeper to confirm and track down the bug inside the pass.


Thanks,
Alina


On Mon, Sep 30, 2019 at 4:30 AM David Chisnall 
wrote:

> Hi,
>
> Yes, I believe it does still reproduce (at least, with the most recent
> build that I tried).  We worked around the clang bug to make the test pass:
>
>
> https://github.com/gnustep/libobjc2/commit/eab35fce379eb6ab1423dbb6d7908cb782f13458#diff-7f1eea7fdb5c7c3bf21f08d1cfe98a19
>
> Reintroducing the 'static' on deallocCalled reduces the test case to
> unconditionally failing the assert immediately after the pop, and DCEs
> the rest of the code.
>
> David
>
> On 11/09/2019 01:17, Alina Sbirlea wrote:
> > Hi David,
> >
> > Does this still reproduce?
> > I'm seeing the load after the call to autoreleasePoolPop at ToT, but
> > perhaps I'm not using the proper flags?
> > I only checked out the github repo and did "clang
> > -fobjc-runtime=gnustep-2.0 -O3 -emit-llvm -S
> > libobjc2/Test/AssociatedObject.m" with a ToT clang.
> >
> > Thanks,
> > Alina
> >
> >
> > On Sun, Feb 24, 2019 at 9:56 AM Pete Cooper via llvm-commits
> > mailto:llvm-comm...@lists.llvm.org>>
> wrote:
> >
> > Hey David
> >
> > Thanks for letting me know, and analysing it this far!
> >
> > I also can't see anything wrong with the intrinsic.  Its just
> > defined as:
> >
> > def int_objc_autoreleasePoolPop : Intrinsic<[],
> > [llvm_ptr_ty]>;
> >
> >
> > which (I believe) means it has unmodelled side effects so it should
> > have been fine for your example.
> >
> > I'll try build the same file you did and see if I can reproduce.
> >
> > Cheers,
> > Pete
> >
> >> On Feb 24, 2019, at 7:48 AM, David Chisnall via Phabricator
> >> mailto:revi...@reviews.llvm.org>> wrote:
> >>
> >> theraven added a comment.
> >> Herald added a project: LLVM.
> >>
> >> After some bisection, it appears that this is the revision that
> >> introduced the regression in the GNUstep Objective-C runtime test
> >> suite that I reported on the list a few weeks ago.  In this is the
> >> test (compiled with `-fobjc-runtime=gnustep-2.0 -O3` and an ELF
> >> triple):
> >>
> >>
> https://github.com/gnustep/libobjc2/blob/master/Test/AssociatedObject.m
> >>
> >> After this change, Early CSE w/ MemorySSA is determining that the
> >> second load of `deallocCalled` is redundant.  The code goes from:
> >>
> >>%7 = load i1, i1* @deallocCalled, align 1
> >>br i1 %7, label %8, label %9
> >>
> >>  ; :8:  ; preds = %0
> >>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x
> >> i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds
> >> ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26, i8*
> >> getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64
> >> 0)) #5
> >>unreachable
> >>
> >>  ; :9:  ; preds = %0
> >>call void @llvm.objc.autoreleasePoolPop(i8* %1)
> >>%10 = load i1, i1* @deallocCalled, align 1
> >>br i1 %10, label %12, label %11
> >>
> >>  ; :11: ; preds = %9
> >>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x
> >> i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds
> >> ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 29, i8*
> >> getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64
> >> 0)) #5
> >>unreachable
> >>
> >> to:
> >>
> >>%7 = load i1, i1* @deallocCalled, align 1
> >>br i1 %7, label %8, label %9
> >>
> >>  ; :8:  ; preds = %0
> >>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x
> >> i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds
> >> ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26, i8*
> >> getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64
> >> 0)) #5
> >>unreachable
> >>
> >>  ; :9:  ; preds = %0
> >>call void @llvm.objc.autoreleasePoolPop(i8* %1)
> >>br i1 %7, label %11, label %10
> >>
> >>  ; :10: ; preds = %9
> >>call void @__assert(i8* getelementptr inbounds 

Re: [PATCH] D55802: Change CGObjC to use objc intrinsics instead of runtime methods

2019-09-11 Thread Alina Sbirlea via cfe-commits
Hi David,

Does this still reproduce?
I'm seeing the load after the call to autoreleasePoolPop at ToT, but
perhaps I'm not using the proper flags?
I only checked out the github repo and did "clang
-fobjc-runtime=gnustep-2.0 -O3 -emit-llvm -S
libobjc2/Test/AssociatedObject.m" with a ToT clang.

Thanks,
Alina


On Sun, Feb 24, 2019 at 9:56 AM Pete Cooper via llvm-commits <
llvm-comm...@lists.llvm.org> wrote:

> Hey David
>
> Thanks for letting me know, and analysing it this far!
>
> I also can't see anything wrong with the intrinsic.  Its just defined as:
>
> def int_objc_autoreleasePoolPop : Intrinsic<[], [llvm_ptr_ty]>;
>
>
> which (I believe) means it has unmodelled side effects so it should have
> been fine for your example.
>
> I'll try build the same file you did and see if I can reproduce.
>
> Cheers,
> Pete
>
> On Feb 24, 2019, at 7:48 AM, David Chisnall via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> theraven added a comment.
> Herald added a project: LLVM.
>
> After some bisection, it appears that this is the revision that introduced
> the regression in the GNUstep Objective-C runtime test suite that I
> reported on the list a few weeks ago.  In this is the test (compiled with
> `-fobjc-runtime=gnustep-2.0 -O3` and an ELF triple):
>
> https://github.com/gnustep/libobjc2/blob/master/Test/AssociatedObject.m
>
> After this change, Early CSE w/ MemorySSA is determining that the second
> load of `deallocCalled` is redundant.  The code goes from:
>
>%7 = load i1, i1* @deallocCalled, align 1
>br i1 %7, label %8, label %9
>
>  ; :8:  ; preds = %0
>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]*
> @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x
> i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([15 x i8],
> [15 x i8]* @.str.1, i64 0, i64 0)) #5
>unreachable
>
>  ; :9:  ; preds = %0
>call void @llvm.objc.autoreleasePoolPop(i8* %1)
>%10 = load i1, i1* @deallocCalled, align 1
>br i1 %10, label %12, label %11
>
>  ; :11: ; preds = %9
>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]*
> @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x
> i8]* @.str, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([14 x i8],
> [14 x i8]* @.str.2, i64 0, i64 0)) #5
>unreachable
>
> to:
>
>%7 = load i1, i1* @deallocCalled, align 1
>br i1 %7, label %8, label %9
>
>  ; :8:  ; preds = %0
>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]*
> @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x
> i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([15 x i8],
> [15 x i8]* @.str.1, i64 0, i64 0)) #5
>unreachable
>
>  ; :9:  ; preds = %0
>call void @llvm.objc.autoreleasePoolPop(i8* %1)
>br i1 %7, label %11, label %10
>
>  ; :10: ; preds = %9
>call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]*
> @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x
> i8]* @.str, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([14 x i8],
> [14 x i8]* @.str.2, i64 0, i64 0)) #5
>unreachable
>
> Later optimisations then determine that, because the assert does not
> return, the only possible value for %7 is false and cause the second assert
> to fire unconditionally.
>
> It appears that we are not correctly modelling the side effects of the
> `llvm.objc.autoreleasePoolPop` intrinsic, but it's not entirely clear why
> not.  The same test compiled for the macos runtime does not appear to
> exhibit the same behaviour.  The previous revision, where we emitted a call
> to `objc_autoreleasePoolPop` and not the intrinsic worked correctly, but
> with this change the optimisers are assuming that no globals can be
> modified across an autorelease pool pop operation (at least, in some
> situations).
>
> Looking at the definition of the intrinsic, I don't see anything wrong, so
> I still suspect that there is a MemorySSA bug that this has uncovered,
> rather than anything wrong in this series of commits.  Any suggestions as
> to where to look would be appreciated.
>
>
> Repository:
>  rL LLVM
>
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D55802/new/
>
> https://reviews.llvm.org/D55802
>
>
>
>
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r361562 - Use clang_cc1 instead of clang in CodeGen test.

2019-05-24 Thread Alina Sbirlea via cfe-commits
Hi Douglas,

Please let me know if the build is fixed after r361674.

Thank you,
Alina


On Fri, May 24, 2019 at 2:26 PM  wrote:

> Hi Alina,
>
> This test that you added seems to fail on targets that don't build the x86
> backend, for example:
>
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-selfhost-neon/builds/1855
>
>  TEST 'Clang :: CodeGen/loop-vectorize.c' FAILED
> 
> Script:
> --
> : 'RUN: at line 1';
>  /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/clang
> -cc1 -internal-isystem
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/lib/clang/9.0.0/include
> -nostdsysteminc -triple x86_64 -target-cpu x86-64 -S -O1 -vectorize-loops
> -emit-llvm -o -
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> |
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/FileCheck
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> -check-prefix=CHECK-ENABLE-VECT
> : 'RUN: at line 2';
>  /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/clang
> -cc1 -internal-isystem
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/lib/clang/9.0.0/include
> -nostdsysteminc -triple x86_64 -target-cpu x86-64 -S -O1 -emit-llvm -o -
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> |
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/FileCheck
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> -check-prefix=CHECK-DISABLE-VECT
> : 'RUN: at line 3';
>  /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/clang
> -cc1 -internal-isystem
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/lib/clang/9.0.0/include
> -nostdsysteminc -triple x86_64 -target-cpu x86-64
> -fexperimental-new-pass-manager -S -O1 -vectorize-loops -emit-llvm -o -
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> |
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/FileCheck
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> -check-prefix=CHECK-ENABLE-VECT
> : 'RUN: at line 4';
>  /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/clang
> -cc1 -internal-isystem
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/lib/clang/9.0.0/include
> -nostdsysteminc -triple x86_64 -target-cpu x86-64
> -fexperimental-new-pass-manager -S -O1 -emit-llvm -o -
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> |
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/stage2/bin/FileCheck
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c
> -check-prefix=CHECK-DISABLE-VECT
> --
> Exit Code: 1
>
> Command Output (stderr):
> --
> /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/tools/clang/test/CodeGen/loop-vectorize.c:7:23:
> error: CHECK-ENABLE-VECT: expected string not found in input
> // CHECK-ENABLE-VECT: fmul <{{[0-9]+}} x double>
>   ^
> :9:25: note: scanning from here
> define void @for_test() local_unnamed_addr #0 {
> ^
> :11:5: note: possible intended match here
>  %A = alloca [1000 x double], align 16
>     ^
>
> --
>
> Can you take a look into fixing the test or running it only when the x86
> backend is present?
>
> Douglas Yung
>
> -Original Message-
> From: cfe-commits  On Behalf Of Alina
> Sbirlea via cfe-commits
> Sent: Thursday, May 23, 2019 15:08
> To: cfe-commits@lists.llvm.org
> Subject: r361562 - Use clang_cc1 instead of clang in CodeGen test.
>
> Author: asbirlea
> Date: Thu May 23 15:07:37 2019
> New Revision: 361562
>
> URL: http://llvm.org/viewvc/llvm-project?rev=361562=rev
> Log:
> Use clang_cc1 instead of clang in CodeGen test.
>
> Modified:
> cfe/trunk/test/CodeGen/loop-vectorize.c
>
> Modified: cfe/trunk/test/CodeGen/loop-vectorize.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-vectorize.c?rev=361562=361561=361562=diff
>
> ==
> --- cfe/trunk/test/CodeGen/loop-vectorize.c (original)
> +++ cfe/trunk/test/CodeGen/loop-vectorize.c Thu May 23 15:07:37 2019
> @@ -1,7 +1,7 @@
> -// RUN: %clang -target x86_64 -S -c -O1 -fvectorize -emit-llvm

r361674 - Mark tests as x86.

2019-05-24 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Fri May 24 14:49:27 2019
New Revision: 361674

URL: http://llvm.org/viewvc/llvm-project?rev=361674=rev
Log:
Mark tests as x86.

Modified:
cfe/trunk/test/CodeGen/loop-unroll.c
cfe/trunk/test/CodeGen/loop-vectorize.c

Modified: cfe/trunk/test/CodeGen/loop-unroll.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-unroll.c?rev=361674=361673=361674=diff
==
--- cfe/trunk/test/CodeGen/loop-unroll.c (original)
+++ cfe/trunk/test/CodeGen/loop-unroll.c Fri May 24 14:49:27 2019
@@ -2,6 +2,7 @@
 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -S -O1 -fno-unroll-loops 
-emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-DISABLE-UNROLL
 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -funroll-loops -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-ENABLE-UNROLL
 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -fno-unroll-loops -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-DISABLE-UNROLL
+// REQUIRES: x86-registered-target
 
 // CHECK-ENABLE-UNROLL-LABEL: @for_test()
 // CHECK-ENABLE-UNROLL: br label %[[FORBODY:[a-z0-9_\.]+]]

Modified: cfe/trunk/test/CodeGen/loop-vectorize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-vectorize.c?rev=361674=361673=361674=diff
==
--- cfe/trunk/test/CodeGen/loop-vectorize.c (original)
+++ cfe/trunk/test/CodeGen/loop-vectorize.c Fri May 24 14:49:27 2019
@@ -2,6 +2,7 @@
 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -S -O1 -emit-llvm -o - %s 
| FileCheck %s -check-prefix=CHECK-DISABLE-VECT
 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -vectorize-loops -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-ENABLE-VECT
 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -emit-llvm -o - %s | FileCheck %s 
-check-prefix=CHECK-DISABLE-VECT
+// REQUIRES: x86-registered-target
 
 // CHECK-ENABLE-VECT-LABEL: @for_test()
 // CHECK-ENABLE-VECT: fmul <{{[0-9]+}} x double>


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


r361653 - [NewPassManager] Add tuning option: LoopUnrolling [clang-change]

2019-05-24 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Fri May 24 10:40:52 2019
New Revision: 361653

URL: http://llvm.org/viewvc/llvm-project?rev=361653=rev
Log:
[NewPassManager] Add tuning option: LoopUnrolling [clang-change]

Summary:
Use CodeGenOpts's setting for loop unrolling.
[to be coupled with D61618]

Reviewers: chandlerc

Subscribers: jlebar, dmgreen, cfe-commits, llvm-commits

Tags: #clang

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

Added:
cfe/trunk/test/CodeGen/loop-unroll.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=361653=361652=361653=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri May 24 10:40:52 2019
@@ -1051,6 +1051,7 @@ void EmitAssemblyHelper::EmitAssemblyWit
   }
 
   PipelineTuningOptions PTO;
+  PTO.LoopUnrolling = CodeGenOpts.UnrollLoops;
   // For historical reasons, loop interleaving is set to mirror setting for 
loop
   // unrolling.
   PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;

Added: cfe/trunk/test/CodeGen/loop-unroll.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-unroll.c?rev=361653=auto
==
--- cfe/trunk/test/CodeGen/loop-unroll.c (added)
+++ cfe/trunk/test/CodeGen/loop-unroll.c Fri May 24 10:40:52 2019
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -S -O1 -funroll-loops 
-emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-UNROLL
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -S -O1 -fno-unroll-loops 
-emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-DISABLE-UNROLL
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -funroll-loops -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-ENABLE-UNROLL
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -fno-unroll-loops -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-DISABLE-UNROLL
+
+// CHECK-ENABLE-UNROLL-LABEL: @for_test()
+// CHECK-ENABLE-UNROLL: br label %[[FORBODY:[a-z0-9_\.]+]]
+// CHECK-ENABLE-UNROLL: [[FORBODY]]:
+// CHECK-ENABLE-UNROLL: store
+// CHECK-ENABLE-UNROLL: store
+// CHECK-ENABLE-UNROLL: br i1 %[[EXITCOND:[a-z0-9_\.]+]], label 
%[[FORBODY5:[a-z0-9_\.]+]], label %[[FORBODY]]
+// CHECK-ENABLE-UNROLL: [[FORBODY5]]:
+// CHECK-ENABLE-UNROLL: fmul
+// CHECK-ENABLE-UNROLL: fadd
+// CHECK-ENABLE-UNROLL: store
+// CHECK-ENABLE-UNROLL: fmul
+// CHECK-ENABLE-UNROLL: fadd
+// CHECK-ENABLE-UNROLL: store
+// CHECK-ENABLE-UNROLL: fmul
+// CHECK-ENABLE-UNROLL: fadd
+// CHECK-ENABLE-UNROLL: store
+
+// CHECK-DISABLE-UNROLL-LABEL: @for_test()
+// CHECK-DISABLE-UNROLL: br label %[[FORBODY:[a-z0-9_\.]+]]
+// CHECK-DISABLE-UNROLL: [[FORBODY]]:
+// CHECK-DISABLE-UNROLL: store
+// CHECK-DISABLE-UNROLL-NOT: store
+// CHECK-DISABLE-UNROLL: br i1 %[[EXITCOND:[a-z0-9_\.]+]], label 
%[[FORBODY5:[a-z0-9_\.]+]], label %[[FORBODY]]
+// CHECK-DISABLE-UNROLL: [[FORBODY5]]:
+// CHECK-DISABLE-UNROLL: fmul
+// CHECK-DISABLE-UNROLL: fadd
+// CHECK-DISABLE-UNROLL: store
+// CHECK-DISABLE-UNROLL: fmul
+// CHECK-DISABLE-UNROLL: fadd
+// CHECK-DISABLE-UNROLL: store
+// CHECK-DISABLE-UNROLL-NOT: fmul
+// CHECK-DISABLE-UNROLL-NOT: fadd
+// CHECK-DISABLE-UNROLL-NOT: store
+
+int printf(const char * restrict format, ...);
+
+void for_test() {
+  double A[1000], B[1000];
+  int L = 500;
+  for (int i = 0; i < L; i++) {
+A[i] = i;
+  }
+  for (int i = 0; i < L; i++) {
+B[i] = A[i]*5;
+B[i]++;
+A[i] *= 7;
+A[i]++;
+  }
+  printf("%lf %lf\n", A[0], B[0]);
+}


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


r361562 - Use clang_cc1 instead of clang in CodeGen test.

2019-05-23 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Thu May 23 15:07:37 2019
New Revision: 361562

URL: http://llvm.org/viewvc/llvm-project?rev=361562=rev
Log:
Use clang_cc1 instead of clang in CodeGen test.

Modified:
cfe/trunk/test/CodeGen/loop-vectorize.c

Modified: cfe/trunk/test/CodeGen/loop-vectorize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-vectorize.c?rev=361562=361561=361562=diff
==
--- cfe/trunk/test/CodeGen/loop-vectorize.c (original)
+++ cfe/trunk/test/CodeGen/loop-vectorize.c Thu May 23 15:07:37 2019
@@ -1,7 +1,7 @@
-// RUN: %clang -target x86_64 -S -c -O1 -fvectorize -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-ENABLE-VECT
-// RUN: %clang -target x86_64 -S -c -O1 -fno-vectorize -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-DISABLE-VECT
-// RUN: %clang -target x86_64 -fexperimental-new-pass-manager -S -c -O1 
-fvectorize -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-VECT
-// RUN: %clang -target x86_64 -fexperimental-new-pass-manager -S -c -O1 
-fno-vectorize -emit-llvm -o - %s | FileCheck %s 
-check-prefix=CHECK-DISABLE-VECT
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -S -O1 -vectorize-loops 
-emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-VECT
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -S -O1 -emit-llvm -o - %s 
| FileCheck %s -check-prefix=CHECK-DISABLE-VECT
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -vectorize-loops -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-ENABLE-VECT
+// RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 
-fexperimental-new-pass-manager -S -O1 -emit-llvm -o - %s | FileCheck %s 
-check-prefix=CHECK-DISABLE-VECT
 
 // CHECK-ENABLE-VECT-LABEL: @for_test()
 // CHECK-ENABLE-VECT: fmul <{{[0-9]+}} x double>


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


r361542 - Update breaking test.

2019-05-23 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Thu May 23 12:51:16 2019
New Revision: 361542

URL: http://llvm.org/viewvc/llvm-project?rev=361542=rev
Log:
Update breaking test.

Modified:
cfe/trunk/test/CodeGen/loop-vectorize.c

Modified: cfe/trunk/test/CodeGen/loop-vectorize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-vectorize.c?rev=361542=361541=361542=diff
==
--- cfe/trunk/test/CodeGen/loop-vectorize.c (original)
+++ cfe/trunk/test/CodeGen/loop-vectorize.c Thu May 23 12:51:16 2019
@@ -10,7 +10,7 @@
 // CHECK-DISABLE-VECT: fmul double
 // CHECK-DISABLE-VECT-NOT: fmul <{{[0-9]+}} x double>
 
-#include 
+int printf(const char * restrict format, ...);
 
 void for_test() {
   double A[1000], B[1000];


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


r361534 - [NewPassManager] Add tuning option: SLPVectorization [clang-change]

2019-05-23 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Thu May 23 11:51:02 2019
New Revision: 361534

URL: http://llvm.org/viewvc/llvm-project?rev=361534=rev
Log:
[NewPassManager] Add tuning option: SLPVectorization [clang-change]

Summary:
NewPassManager is not using CodeGenOpts values before this patch.
[to be coupled with D61616]

Reviewers: chandlerc

Subscribers: jlebar, cfe-commits, llvm-commits

Tags: #clang

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

Added:
cfe/trunk/test/CodeGen/loop-vectorize.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=361534=361533=361534=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu May 23 11:51:02 2019
@@ -1050,7 +1050,14 @@ void EmitAssemblyHelper::EmitAssemblyWit
   CodeGenOpts.DebugInfoForProfiling);
   }
 
-  PassBuilder PB(TM.get(), PipelineTuningOptions(), PGOOpt);
+  PipelineTuningOptions PTO;
+  // For historical reasons, loop interleaving is set to mirror setting for 
loop
+  // unrolling.
+  PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
+  PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
+  PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
+
+  PassBuilder PB(TM.get(), PTO, PGOOpt);
 
   // Attempt to load pass plugins and register their callbacks with PB.
   for (auto  : CodeGenOpts.PassPlugins) {

Added: cfe/trunk/test/CodeGen/loop-vectorize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/loop-vectorize.c?rev=361534=auto
==
--- cfe/trunk/test/CodeGen/loop-vectorize.c (added)
+++ cfe/trunk/test/CodeGen/loop-vectorize.c Thu May 23 11:51:02 2019
@@ -0,0 +1,25 @@
+// RUN: %clang -target x86_64 -S -c -O1 -fvectorize -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-ENABLE-VECT
+// RUN: %clang -target x86_64 -S -c -O1 -fno-vectorize -emit-llvm -o - %s | 
FileCheck %s -check-prefix=CHECK-DISABLE-VECT
+// RUN: %clang -target x86_64 -fexperimental-new-pass-manager -S -c -O1 
-fvectorize -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-VECT
+// RUN: %clang -target x86_64 -fexperimental-new-pass-manager -S -c -O1 
-fno-vectorize -emit-llvm -o - %s | FileCheck %s 
-check-prefix=CHECK-DISABLE-VECT
+
+// CHECK-ENABLE-VECT-LABEL: @for_test()
+// CHECK-ENABLE-VECT: fmul <{{[0-9]+}} x double>
+
+// CHECK-DISABLE-VECT-LABEL: @for_test()
+// CHECK-DISABLE-VECT: fmul double
+// CHECK-DISABLE-VECT-NOT: fmul <{{[0-9]+}} x double>
+
+#include 
+
+void for_test() {
+  double A[1000], B[1000];
+  int L = 500;
+  for (int i = 0; i < L; i++) {
+A[i] = i;
+  }
+  for (int i = 0; i < L; i++) {
+B[i] = A[i]*5;
+  }
+  printf("%lf %lf\n", A[0], B[0]);
+}


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


r359616 - Set LoopInterleaved in the PassManagerBuilder.

2019-04-30 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Tue Apr 30 14:29:23 2019
New Revision: 359616

URL: http://llvm.org/viewvc/llvm-project?rev=359616=rev
Log:
Set LoopInterleaved in the PassManagerBuilder.

Summary: Corresponds to D61030.

Subscribers: jlebar, cfe-commits, llvm-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=359616=359615=359616=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Apr 30 14:29:23 2019
@@ -560,6 +560,9 @@ void EmitAssemblyHelper::CreatePasses(le
   PMBuilder.LoopVectorize = CodeGenOpts.VectorizeLoop;
 
   PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops;
+  // Loop interleaving in the loop vectorizer has historically been set to be
+  // enabled when loop unrolling is enabled.
+  PMBuilder.LoopsInterleaved = CodeGenOpts.UnrollLoops;
   PMBuilder.MergeFunctions = CodeGenOpts.MergeFunctions;
   PMBuilder.PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO;
   PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO;


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


r358765 - Update to use PipelineTuningOptions. Corresponds to llvm change: D59723.

2019-04-19 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Fri Apr 19 09:32:08 2019
New Revision: 358765

URL: http://llvm.org/viewvc/llvm-project?rev=358765=rev
Log:
Update to use PipelineTuningOptions. Corresponds to llvm change: D59723.

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=358765=358764=358765=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Apr 19 09:32:08 2019
@@ -1011,7 +1011,7 @@ void EmitAssemblyHelper::EmitAssemblyWit
   CodeGenOpts.DebugInfoForProfiling);
   }
 
-  PassBuilder PB(TM.get(), PGOOpt);
+  PassBuilder PB(TM.get(), PipelineTuningOptions(), PGOOpt);
 
   // Attempt to load pass plugins and register their callbacks with PB.
   for (auto  : CodeGenOpts.PassPlugins) {


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


r345446 - Revert r345170 [along with its llvm counterpart r345169] as it makes Halide builds timeout.

2018-10-27 Thread Alina Sbirlea via cfe-commits
Author: asbirlea
Date: Fri Oct 26 21:51:09 2018
New Revision: 345446

URL: http://llvm.org/viewvc/llvm-project?rev=345446=rev
Log:
Revert r345170 [along with its llvm counterpart r345169] as it makes Halide 
builds timeout.

Modified:
cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
cfe/trunk/test/Driver/hexagon-vectorize.c

Modified: cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp?rev=345446=345445=345446=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp Fri Oct 26 21:51:09 2018
@@ -516,9 +516,9 @@ void HexagonToolChain::addClangTargetOpt
 CC1Args.push_back("-target-feature");
 CC1Args.push_back("+reserved-r19");
   }
-  if (!isAutoHVXEnabled(DriverArgs)) {
+  if (isAutoHVXEnabled(DriverArgs)) {
 CC1Args.push_back("-mllvm");
-CC1Args.push_back("-hexagon-autohvx=0");
+CC1Args.push_back("-hexagon-autohvx");
   }
 }
 

Modified: cfe/trunk/test/Driver/hexagon-vectorize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hexagon-vectorize.c?rev=345446=345445=345446=diff
==
--- cfe/trunk/test/Driver/hexagon-vectorize.c (original)
+++ cfe/trunk/test/Driver/hexagon-vectorize.c Fri Oct 26 21:51:09 2018
@@ -3,7 +3,7 @@
 // RUN: %clang -target hexagon -fvectorize -fno-vectorize -### %s 2>&1 | 
FileCheck %s --check-prefix=CHECK-NOVECTOR
 // RUN: %clang -target hexagon -fvectorize -### %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-NEEDHVX
 
-// CHECK-DEFAULT: -hexagon-autohvx={{false|0}}
-// CHECK-VECTOR-NOT: -hexagon-autohvx={{false|0}}
-// CHECK-NOVECTOR: -hexagon-autohvx={{false|0}}
+// CHECK-DEFAULT-NOT: hexagon-autohvx
+// CHECK-VECTOR: "-mllvm" "-hexagon-autohvx"
+// CHECK-NOVECTOR-NOT: hexagon-autohvx
 // CHECK-NEEDHVX: warning: auto-vectorization requires HVX, use -mhvx to 
enable it


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