[llvm-branch-commits] [llvm] 5b95eb0 - [debuginfo-test][cross-project-tests] Release note for new project name

2021-09-21 Thread James Henderson via llvm-branch-commits

Author: James Henderson
Date: 2021-09-21T09:48:35+01:00
New Revision: 5b95eb0b442e8eaa6b90ff765a3ad4c271c2d9eb

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

LOG: [debuginfo-test][cross-project-tests] Release note for new project name

Add a release note for the renaming of the debuginfo-test to
cross-project-tests, performed in commit
1364750dadbb56032ef73b4d0d8cbc88a51392da and follow-ons.

Reviewed by: sylvestre.ledru

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

Added: 


Modified: 
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index a192485d46836..ba83775aa8cd5 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -57,6 +57,15 @@ Non-comprehensive list of changes in this release
 
 * Flang is now included in the binary packages released by LLVM.
 
+* The debuginfo-test project has been renamed cross-project-tests and is now
+  intended for testing components from multiple projects, not just debug
+  information. The new "cross-project-tests" name replaces "debuginfo-test" in
+  LLVM_ENABLE_PROJECTS, and a new check-cross-project-tests target has been
+  added for running all tests in the project. The pre-existing check-debuginfo-
+  test target remains for running just the debug information tests.
+  (`D95339 `_ and
+  `D96513 `_)
+
 Changes to the LLVM IR
 --
 



___
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] 80f974e - [AArch64][GlobalISel] Use ZExtValue for zext(xor) when invert tb(n)z

2021-09-21 Thread Tom Stellard via llvm-branch-commits

Author: guopeilin
Date: 2021-09-21T09:15:10-07:00
New Revision: 80f974e40f81348b1676247e832287da29dd02dd

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

LOG: [AArch64][GlobalISel] Use ZExtValue for zext(xor) when invert tb(n)z

Currently, we use SExtValue to decide whether to invert tbz or tbnz.
However, for the case zext (xor x, c), we should use ZExt rather
than SExt otherwise we will generate totally opposite branches.

Reviewed By: paquette

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

(cherry picked from commit 5f48c144c58f6d23e850a1978a6fe05887103b17)

Added: 


Modified: 
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-xor-tbz-tbnz.mir

Removed: 




diff  --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp 
b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index a98248438e401..a17bd1b14f412 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -1301,6 +1301,7 @@ static AArch64CC::CondCode 
changeICMPPredToAArch64CC(CmpInst::Predicate P) {
 static Register getTestBitReg(Register Reg, uint64_t &Bit, bool &Invert,
   MachineRegisterInfo &MRI) {
   assert(Reg.isValid() && "Expected valid register!");
+  bool HasZext = false;
   while (MachineInstr *MI = getDefIgnoringCopies(Reg, MRI)) {
 unsigned Opc = MI->getOpcode();
 
@@ -1314,6 +1315,9 @@ static Register getTestBitReg(Register Reg, uint64_t 
&Bit, bool &Invert,
 // on the truncated x is the same as the bit number on x.
 if (Opc == TargetOpcode::G_ANYEXT || Opc == TargetOpcode::G_ZEXT ||
 Opc == TargetOpcode::G_TRUNC) {
+  if (Opc == TargetOpcode::G_ZEXT)
+HasZext = true;
+
   Register NextReg = MI->getOperand(1).getReg();
   // Did we find something worth folding?
   if (!NextReg.isValid() || !MRI.hasOneNonDBGUse(NextReg))
@@ -1342,8 +1346,12 @@ static Register getTestBitReg(Register Reg, uint64_t 
&Bit, bool &Invert,
 std::swap(ConstantReg, TestReg);
 VRegAndVal = getConstantVRegValWithLookThrough(ConstantReg, MRI);
   }
-  if (VRegAndVal)
-C = VRegAndVal->Value.getSExtValue();
+  if (VRegAndVal) {
+if (HasZext)
+  C = VRegAndVal->Value.getZExtValue();
+else
+  C = VRegAndVal->Value.getSExtValue();
+  }
   break;
 }
 case TargetOpcode::G_ASHR:

diff  --git a/llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-xor-tbz-tbnz.mir 
b/llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-xor-tbz-tbnz.mir
index 8e19ba41b2c0c..53ea6830fdc89 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-xor-tbz-tbnz.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-xor-tbz-tbnz.mir
@@ -117,6 +117,38 @@ body: |
 RET_ReallyLR
 ...
 ---
+name:dont_flip_eq_zext
+alignment:   4
+legalized:   true
+regBankSelected: true
+tracksRegLiveness: true
+body: |
+  ; CHECK-LABEL: name: dont_flip_eq_zext
+  ; CHECK: bb.0:
+  ; CHECK:   successors: %bb.0(0x4000), %bb.1(0x4000)
+  ; CHECK:   [[COPY:%[0-9]+]]:gpr32 = COPY $wzr
+  ; CHECK:   [[SUBREG_TO_REG:%[0-9]+]]:gpr64all = SUBREG_TO_REG 0, [[COPY]], 
%subreg.sub_32
+  ; CHECK:   [[COPY1:%[0-9]+]]:gpr64 = COPY [[SUBREG_TO_REG]]
+  ; CHECK:   TBNZX [[COPY1]], 63, %bb.1
+  ; CHECK:   B %bb.0
+  ; CHECK: bb.1:
+  ; CHECK:   RET_ReallyLR
+  bb.0:
+successors: %bb.0(0x4000), %bb.1(0x4000)
+
+%1:gpr(s32) = G_CONSTANT i32 0
+%3:gpr(s32) = G_CONSTANT i32 -1
+%4:gpr(s32) = G_XOR %1, %3
+%5:gpr(s64) = G_ZEXT %4(s32)
+%15:gpr(s64) = G_CONSTANT i64 0
+%13:gpr(s32) = G_ICMP intpred(slt), %5(s64), %15
+%7:gpr(s1) = G_TRUNC %13(s32)
+G_BRCOND %7(s1), %bb.1
+G_BR %bb.0
+  bb.1:
+RET_ReallyLR
+...
+---
 name:dont_flip_ne
 alignment:   4
 legalized:   true



___
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] d0f0b5b - Thread safety analysis: Warn when demoting locks on back edges

2021-09-21 Thread Tom Stellard via llvm-branch-commits

Author: Aaron Puchert
Date: 2021-09-21T09:25:53-07:00
New Revision: d0f0b5b99262454a063a11732bf25951627dae21

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

LOG: Thread safety analysis: Warn when demoting locks on back edges

Previously in D104261 we warned about dropping locks from back edges,
this is the corresponding change for exclusive/shared joins. If we're
entering the loop with an exclusive change, which is then relaxed to a
shared lock before we loop back, we have already analyzed the loop body
with the stronger exclusive lock and thus might have false positives.

There is a minor non-observable change: we modify the exit lock set of a
function, but since that isn't used further it doesn't change anything.

Reviewed By: aaron.ballman

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

(cherry picked from commit 9b889f826ff587e9758c80823419512d502e457d)

Added: 


Modified: 
clang/lib/Analysis/ThreadSafety.cpp
clang/test/SemaCXX/warn-thread-safety-analysis.cpp

Removed: 




diff  --git a/clang/lib/Analysis/ThreadSafety.cpp 
b/clang/lib/Analysis/ThreadSafety.cpp
index 5b2c882c4235a..41a55f9579bd0 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -1050,7 +1050,7 @@ class ThreadSafetyAnalyzer {
   const CFGBlock* PredBlock,
   const CFGBlock *CurrBlock);
 
-  bool join(const FactEntry &a, const FactEntry &b);
+  bool join(const FactEntry &a, const FactEntry &b, bool CanModify);
 
   void intersectAndWarn(FactSet &EntrySet, const FactSet &ExitSet,
 SourceLocation JoinLoc, LockErrorKind EntryLEK,
@@ -2188,25 +2188,28 @@ void BuildLockset::VisitDeclStmt(const DeclStmt *S) {
   }
 }
 
-/// Given two facts merging on a join point, decide whether to warn and which
-/// one to keep.
+/// Given two facts merging on a join point, possibly warn and decide whether 
to
+/// keep or replace.
 ///
-/// \return  false if we should keep \p A, true if we should keep \p B.
-bool ThreadSafetyAnalyzer::join(const FactEntry &A, const FactEntry &B) {
+/// \param CanModify Whether we can replace \p A by \p B.
+/// \return  false if we should keep \p A, true if we should take \p B.
+bool ThreadSafetyAnalyzer::join(const FactEntry &A, const FactEntry &B,
+bool CanModify) {
   if (A.kind() != B.kind()) {
 // For managed capabilities, the destructor should unlock in the right mode
 // anyway. For asserted capabilities no unlocking is needed.
 if ((A.managed() || A.asserted()) && (B.managed() || B.asserted())) {
-  // The shared capability subsumes the exclusive capability.
-  return B.kind() == LK_Shared;
-} else {
-  Handler.handleExclusiveAndShared("mutex", B.toString(), B.loc(), 
A.loc());
-  // Take the exclusive capability to reduce further warnings.
-  return B.kind() == LK_Exclusive;
+  // The shared capability subsumes the exclusive capability, if possible.
+  bool ShouldTakeB = B.kind() == LK_Shared;
+  if (CanModify || !ShouldTakeB)
+return ShouldTakeB;
 }
+Handler.handleExclusiveAndShared("mutex", B.toString(), B.loc(), A.loc());
+// Take the exclusive capability to reduce further warnings.
+return CanModify && B.kind() == LK_Exclusive;
   } else {
 // The non-asserted capability is the one we want to track.
-return A.asserted() && !B.asserted();
+return CanModify && A.asserted() && !B.asserted();
   }
 }
 
@@ -2237,8 +2240,8 @@ void ThreadSafetyAnalyzer::intersectAndWarn(FactSet 
&EntrySet,
 
 FactSet::iterator EntryIt = EntrySet.findLockIter(FactMan, ExitFact);
 if (EntryIt != EntrySet.end()) {
-  if (join(FactMan[*EntryIt], ExitFact) &&
-  EntryLEK == LEK_LockedSomePredecessors)
+  if (join(FactMan[*EntryIt], ExitFact,
+   EntryLEK != LEK_LockedSomeLoopIterations))
 *EntryIt = Fact;
 } else if (!ExitFact.managed()) {
   ExitFact.handleRemovalFromIntersection(ExitSet, FactMan, JoinLoc,

diff  --git a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp 
b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
index e9d41da80517c..125a1958c8ba7 100644
--- a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
+++ b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -2789,6 +2789,25 @@ void loopRelease() {
   }
 }
 
+void loopPromote() {
+  RelockableMutexLock scope(&mu, SharedTraits{});
+  for (unsigned i = 1; i < 10; ++i) {
+x = 1; // expected-warning {{writing variable 'x' requires holding mutex 
'mu' exclusively}}
+if (i == 5)
+  scope.PromoteShared();
+  }
+}
+
+void loopDemote() {
+  RelockableMutexLock scope(&mu, ExclusiveTraits{}); // expected-note {{the 
other acquisition of mutex 'mu' is