[llvm-branch-commits] [llvm] f760d57 - LangRef: fix significand bits of fp128

2020-12-31 Thread Nuno Lopes via llvm-branch-commits

Author: Nuno Lopes
Date: 2020-12-31T11:13:25Z
New Revision: f760d57052d8d16de9679f6c65149005515ead97

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

LOG: LangRef: fix significand bits of fp128

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 3db5879129ae..ab5287014683 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -3070,7 +3070,7 @@ Floating-Point Types
  - 64-bit floating-point value
 
* - ``fp128``
- - 128-bit floating-point value (112-bit significand)
+ - 128-bit floating-point value (113-bit significand)
 
* - ``x86_fp80``
  -  80-bit floating-point value (X87)



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


[llvm-branch-commits] [llvm] a2513cb - remove pessimizing moves (reported by gcc 10)

2020-12-31 Thread Nuno Lopes via llvm-branch-commits

Author: Nuno Lopes
Date: 2020-12-31T20:35:56Z
New Revision: a2513cb8655e0aea4baffb4391e946ad3e56d883

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

LOG: remove pessimizing moves (reported by gcc 10)

Added: 


Modified: 
llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h

Removed: 




diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h 
b/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h
index 1c8b8e0bc922..63db9d4942ba 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h
@@ -1510,20 +1510,20 @@ class SingleThreadedRPCEndpoint
 Args...)) {
   detail::ResultTraits::consumeAbandoned(
   std::move(Result));
-  return std::move(Err);
+  return Err;
 }
 
 if (auto Err = this->C.send()) {
   detail::ResultTraits::consumeAbandoned(
   std::move(Result));
-  return std::move(Err);
+  return Err;
 }
 
 while (!ReceivedResponse) {
   if (auto Err = this->handleOne()) {
 detail::ResultTraits::consumeAbandoned(
 std::move(Result));
-return std::move(Err);
+return Err;
   }
 }
 



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


[llvm-branch-commits] [clang] 9231045 - Make LLVM build in C++20 mode

2020-12-17 Thread Nuno Lopes via llvm-branch-commits

Author: Barry Revzin
Date: 2020-12-17T10:44:10Z
New Revision: 92310454bf0f1f9686f38afd11756c7d046495c9

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

LOG: Make LLVM build in C++20 mode

Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the comparison operators such that
they should work in both C++17 and C++20 modes. It also makes two other small
C++20-specific changes (adding a constructor to a type that cases to be an
aggregate, and adding casts from u8 literals which no longer have type
const char*).

There were four categories of errors that this review fixes.
Here are canonical examples of them, ordered from most to least common:

// 1) Missing const
namespace missing_const {
struct A {
#ifndef FIXED
bool operator==(A const&);
#else
bool operator==(A const&) const;
#endif
};

bool a = A{} == A{}; // error
}

// 2) Type mismatch on CRTP
namespace crtp_mismatch {
template 
struct Base {
#ifndef FIXED
bool operator==(Derived const&) const;
#else
// in one case changed to taking Base const&
friend bool operator==(Derived const&, Derived const&);
#endif
};

struct D : Base { };

bool b = D{} == D{}; // error
}

// 3) iterator/const_iterator with only mixed comparison
namespace iter_const_iter {
template 
struct iterator {
using const_iterator = iterator;

iterator();

template  = 0>
iterator(iterator const&);

#ifndef FIXED
bool operator==(const_iterator const&) const;
#else
friend bool operator==(iterator const&, iterator const&);
#endif
};

bool c = iterator{} == iterator{} // error
  || iterator{} == iterator{}
  || iterator{} == iterator{}
  || iterator{} == iterator{};
}

// 4) Same-type comparison but only have mixed-type operator
namespace ambiguous_choice {
enum Color { Red };

struct C {
C();
C(Color);
operator Color() const;
bool operator==(Color) const;
friend bool operator==(C, C);
};

bool c = C{} == C{}; // error
bool d = C{} == Red;
}

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

Added: 


Modified: 
clang/include/clang/AST/StmtIterator.h
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
llvm/include/llvm/ADT/AllocatorList.h
llvm/include/llvm/ADT/DenseMap.h
llvm/include/llvm/ADT/DenseSet.h
llvm/include/llvm/ADT/DirectedGraph.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/StringMap.h
llvm/include/llvm/ADT/iterator.h
llvm/include/llvm/CodeGen/DIE.h
llvm/include/llvm/CodeGen/LiveInterval.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/BasicBlock.h
llvm/include/llvm/Object/StackMapParser.h
llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/include/llvm/Support/BinaryStreamRef.h
llvm/include/llvm/Support/SuffixTree.h
llvm/lib/CodeGen/PeepholeOptimizer.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/Transforms/Scalar/GVNHoist.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/unittests/ADT/STLExtrasTest.cpp

Removed: 




diff  --git a/clang/include/clang/AST/StmtIterator.h 
b/clang/include/clang/AST/StmtIterator.h
index 911205347aad..bcdb0df829fb 100644
--- a/clang/include/clang/AST/StmtIterator.h
+++ b/clang/include/clang/AST/StmtIterator.h
@@ -104,12 +104,13 @@ class StmtIteratorImpl : public StmtIteratorBase,
 return tmp;
   }
 
-  bool operator==(const DERIVED& RHS) const {
-return stmt == RHS.stmt && DGI == RHS.DGI && RawVAPtr == RHS.RawVAPtr;
+  friend bool operator==(const DERIVED &LHS, const DERIVED &RHS) {
+return LHS.stmt == RHS.stmt && LHS.DGI == RHS.DGI &&
+   LHS.RawVAPtr == RHS.RawVAPtr;
   }
 
-  bool operator!=(const DERIVED& RHS) const {
-return stmt != RHS.stmt || DGI != RHS.DGI || RawVAPtr != RHS.RawVAPtr;
+  friend bool operator!=(const DERIVED &LHS, const DERIVED &RHS) {
+return !(LHS == RHS);
   }
 
   REFERENCE operator*() const {

diff  --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index c4aa361b8262..db7e967b15ae 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -61,6 +61,12 @@ enum OpenMPDirectiveKindEx {
 struct OpenMPDirectiveKindExWrapper {
   OpenMPDirectiveKindExWrapper(unsigned Value) : Value(Value) {}
   OpenMPDirectiveKindE

[llvm-branch-commits] [llvm] 3c01af9 - DenseMap: fix build with clang in C++20 mode

2020-12-08 Thread Nuno Lopes via llvm-branch-commits

Author: Nuno Lopes
Date: 2020-12-08T18:39:31Z
New Revision: 3c01af9aeebe01030e6138cece02675d2f148bb3

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

LOG: DenseMap: fix build with clang in C++20 mode
clang was complaing about this code:
llvm/include/llvm/IR/PassManager.h:715:17: error: ISO C++20 considers use of 
overloaded operator '!=' to be ambiguous despite there being a unique best 
viable function with non-reversed arguments 
[-Werror,-Wambiguous-reversed-operator]
  if (IMapI != IsResultInvalidated.end())
  ~ ^  ~
llvm/include/llvm/ADT/DenseMap.h:1253:8: note: candidate function with 
non-reversed arguments
  bool operator!=(const ConstIterator &RHS) const {
   ^
llvm/include/llvm/ADT/DenseMap.h:1246:8: note: ambiguous candidate function 
with reversed arguments
  bool operator==(const ConstIterator &RHS) const {
   ^

The warning is triggered when the DenseMapIterator (lhs) is not const and so
the == operator is applied to different types on lhs/rhs.
Using a template allows the function to be available for both const/non-const
iterator types and gets rid of the warning

Added: 


Modified: 
llvm/include/llvm/ADT/DenseMap.h

Removed: 




diff  --git a/llvm/include/llvm/ADT/DenseMap.h 
b/llvm/include/llvm/ADT/DenseMap.h
index f591ee07ac00..7da347125c34 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -1189,8 +1189,6 @@ class DenseMapIterator : DebugEpochBase::HandleBase {
   friend class DenseMapIterator;
   friend class DenseMapIterator;
 
-  using ConstIterator = DenseMapIterator;
-
 public:
   using 
diff erence_type = ptr
diff _t;
   using value_type =
@@ -1243,14 +1241,17 @@ class DenseMapIterator : DebugEpochBase::HandleBase {
 return Ptr;
   }
 
-  bool operator==(const ConstIterator &RHS) const {
+  template 
+  bool operator==(const T &RHS) const {
 assert((!Ptr || isHandleInSync()) && "handle not in sync!");
 assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!");
 assert(getEpochAddress() == RHS.getEpochAddress() &&
"comparing incomparable iterators!");
 return Ptr == RHS.Ptr;
   }
-  bool operator!=(const ConstIterator &RHS) const {
+
+  template 
+  bool operator!=(const T &RHS) const {
 assert((!Ptr || isHandleInSync()) && "handle not in sync!");
 assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!");
 assert(getEpochAddress() == RHS.getEpochAddress() &&



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


[llvm-branch-commits] [llvm] d2a7b83 - AA: make AliasAnalysis.h compatible with C++20 (NFC)

2020-12-10 Thread Nuno Lopes via llvm-branch-commits

Author: Nuno Lopes
Date: 2020-12-10T15:32:11Z
New Revision: d2a7b83c5c7b9b26e73261be2a4d60a5b53ba80f

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

LOG: AA: make AliasAnalysis.h compatible with C++20 (NFC)
can't mix arithmetic with different enums

Added: 


Modified: 
llvm/include/llvm/Analysis/AliasAnalysis.h

Removed: 




diff  --git a/llvm/include/llvm/Analysis/AliasAnalysis.h 
b/llvm/include/llvm/Analysis/AliasAnalysis.h
index ce4ebab3efa4..cc5cec44b455 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -540,7 +540,7 @@ class AAResults {
   /// write at most from objects pointed to by their pointer-typed arguments
   /// (with arbitrary offsets).
   static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB) {
-return !(MRB & FMRL_Anywhere & ~FMRL_ArgumentPointees);
+return !((unsigned)MRB & FMRL_Anywhere & ~FMRL_ArgumentPointees);
   }
 
   /// Checks if functions with the specified behavior are known to potentially
@@ -548,26 +548,27 @@ class AAResults {
   /// (with arbitrary offsets).
   static bool doesAccessArgPointees(FunctionModRefBehavior MRB) {
 return isModOrRefSet(createModRefInfo(MRB)) &&
-   (MRB & FMRL_ArgumentPointees);
+   ((unsigned)MRB & FMRL_ArgumentPointees);
   }
 
   /// Checks if functions with the specified behavior are known to read and
   /// write at most from memory that is inaccessible from LLVM IR.
   static bool onlyAccessesInaccessibleMem(FunctionModRefBehavior MRB) {
-return !(MRB & FMRL_Anywhere & ~FMRL_InaccessibleMem);
+return !((unsigned)MRB & FMRL_Anywhere & ~FMRL_InaccessibleMem);
   }
 
   /// Checks if functions with the specified behavior are known to potentially
   /// read or write from memory that is inaccessible from LLVM IR.
   static bool doesAccessInaccessibleMem(FunctionModRefBehavior MRB) {
-return isModOrRefSet(createModRefInfo(MRB)) && (MRB & 
FMRL_InaccessibleMem);
+return isModOrRefSet(createModRefInfo(MRB)) &&
+ ((unsigned)MRB & FMRL_InaccessibleMem);
   }
 
   /// Checks if functions with the specified behavior are known to read and
   /// write at most from memory that is inaccessible from LLVM IR or objects
   /// pointed to by their pointer-typed arguments (with arbitrary offsets).
   static bool onlyAccessesInaccessibleOrArgMem(FunctionModRefBehavior MRB) {
-return !(MRB & FMRL_Anywhere &
+return !((unsigned)MRB & FMRL_Anywhere &
  ~(FMRL_InaccessibleMem | FMRL_ArgumentPointees));
   }
 



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


[llvm-branch-commits] [llvm] AMDGPU: Replace unused permlane inputs with poison instead of undef (PR #131288)

2025-03-17 Thread Nuno Lopes via llvm-branch-commits

https://github.com/nunoplopes approved this pull request.


https://github.com/llvm/llvm-project/pull/131288
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] AMDGPU: Replace unused update.dpp inputs with poison instead of undef (PR #131287)

2025-03-17 Thread Nuno Lopes via llvm-branch-commits

https://github.com/nunoplopes approved this pull request.


https://github.com/llvm/llvm-project/pull/131287
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] AMDGPU: Replace unused update.dpp inputs with poison instead of undef (PR #131287)

2025-03-14 Thread Nuno Lopes via llvm-branch-commits

nunoplopes wrote:

We don't propagate poison through intrinsics blindly. We do it when the 
semantics allow it.
Using poison as placeholder for unused lanes, don't care bits, etc is fine. But 
you are right that then we cannot make the intrinsic return poison because 
those arguments are poison.

We already do similar things with vector instructions and several intrinsics.

https://github.com/llvm/llvm-project/pull/131287
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] AMDGPU: Replace unused permlane inputs with poison instead of undef (PR #131288)

2025-03-15 Thread Nuno Lopes via llvm-branch-commits


@@ -1115,7 +1115,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, 
IntrinsicInst &II) const {
   case Intrinsic::amdgcn_permlanex16_var: {
 // Discard vdst_in if it's not going to be read.
 Value *VDstIn = II.getArgOperand(0);
-if (isa(VDstIn))
+if (isa(VDstIn))

nunoplopes wrote:

I don't know how prevalent this intrinsic is, but I would maybe leave this one 
as-is to preserve compatibility with older IR. We can always do a search & 
replace later when we get rid of undef.
The rest LGTM, thanks!

https://github.com/llvm/llvm-project/pull/131288
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [InstCombine] Enable select freeze poison folding when storing value (PR #129776)

2025-03-07 Thread Nuno Lopes via llvm-branch-commits

nunoplopes wrote:

FWIW, we have been using this patch internally and it helps substancial in a 
couple of benchmarks.

https://github.com/llvm/llvm-project/pull/129776
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits