[llvm-branch-commits] [clang] release/19.x: [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (#89934) (PR #106166)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106166
___
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] release/19.x: [PowerPC] Fix mask for __st[d/w/h/b]cx builtins (#104453) (PR #106085)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106085

>From ed699666de2d82eab266bf41372175da73202834 Mon Sep 17 00:00:00 2001
From: Zaara Syeda 
Date: Thu, 22 Aug 2024 09:55:46 -0400
Subject: [PATCH] [PowerPC] Fix mask for __st[d/w/h/b]cx builtins (#104453)

These builtins are currently returning CR0 which will have the format
[0, 0, flag_true_if_saved, XER].
We only want to return flag_true_if_saved. This patch adds a shift to
remove the XER bit before returning.

(cherry picked from commit 327edbe07ab4370ceb20ea7c805f64950871d835)
---
 llvm/lib/Target/PowerPC/PPCInstr64Bit.td |  4 ++--
 llvm/lib/Target/PowerPC/PPCInstrInfo.td  | 12 ++--
 ...-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll |  2 +-
 .../builtins-ppc-xlcompat-LoadReserve-StoreCond.ll   |  9 ++---
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td 
b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
index 8f5afbae01de15..ed39fc67a0a730 100644
--- a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
+++ b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
@@ -2014,9 +2014,9 @@ def SLBSYNC : XForm_0<31, 338, (outs), (ins), "slbsync", 
IIC_SprSLBSYNC, []>;
 } // IsISA3_0
 
 def : Pat<(int_ppc_stdcx ForceXForm:$dst, g8rc:$A),
-  (STDCX g8rc:$A, ForceXForm:$dst)>;
+  (RLWINM (STDCX g8rc:$A, ForceXForm:$dst), 31, 31, 31)>;
 def : Pat<(PPCStoreCond ForceXForm:$dst, g8rc:$A, 8),
-  (STDCX g8rc:$A, ForceXForm:$dst)>;
+  (RLWINM (STDCX g8rc:$A, ForceXForm:$dst), 31, 31, 31)>;
 
 def : Pat<(i64 (int_ppc_mfspr timm:$SPR)),
   (MFSPR8 $SPR)>;
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td 
b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 1686249c0f89d4..69f8ddc0ea7010 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -5286,13 +5286,13 @@ def : Pat<(i64 (bitreverse i64:$A)),
   (OR8 (RLDICR DWBytes7654.DWord, 32, 31), DWBytes3210.DWord)>;
 
 def : Pat<(int_ppc_stwcx ForceXForm:$dst, gprc:$A),
-  (STWCX gprc:$A, ForceXForm:$dst)>;
+  (RLWINM (STWCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>;
 def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 4),
-  (STWCX gprc:$A, ForceXForm:$dst)>;
+  (RLWINM (STWCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>;
 def : Pat<(int_ppc_stbcx ForceXForm:$dst, gprc:$A),
-  (STBCX gprc:$A, ForceXForm:$dst)>;
+  (RLWINM (STBCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>;
 def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 1),
-  (STBCX gprc:$A, ForceXForm:$dst)>;
+  (RLWINM (STBCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>;
 
 def : Pat<(int_ppc_fcfid f64:$A),
 (XSCVSXDDP $A)>;
@@ -5322,9 +5322,9 @@ def : Pat<(int_ppc_mtmsr gprc:$RS),
 
 let Predicates = [IsISA2_07] in {
   def : Pat<(int_ppc_sthcx ForceXForm:$dst, gprc:$A),
-(STHCX gprc:$A, ForceXForm:$dst)>;
+(RLWINM (STHCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>;
   def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 2),
-(STHCX gprc:$A, ForceXForm:$dst)>;
+(RLWINM (STHCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>;
 }
 def : Pat<(int_ppc_dcbtstt ForceXForm:$dst),
   (DCBTST 16, ForceXForm:$dst)>;
diff --git 
a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll
 
b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll
index ddfdcda7a61a75..d765f0845641c6 100644
--- 
a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll
+++ 
b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll
@@ -26,7 +26,7 @@ define dso_local i64 @test_stdcx(ptr %a, i64 %b) {
 ; CHECK-NEXT:stdcx. 4, 0, 3
 ; CHECK-NEXT:mfocrf 3, 128
 ; CHECK-NEXT:srwi 3, 3, 28
-; CHECK-NEXT:extsw 3, 3
+; CHECK-NEXT:rlwinm 3, 3, 31, 31, 31
 ; CHECK-NEXT:blr
 entry:
   %0 = tail call i32 @llvm.ppc.stdcx(ptr %a, i64 %b)
diff --git 
a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll 
b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll
index 8d90c5cb882064..778fd0a37a1ede 100644
--- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll
+++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll
@@ -36,7 +36,7 @@ define dso_local signext i32 @test_stwcx(ptr %a, i32 signext 
%b) {
 ; CHECK-64-NEXT:stwcx. 4, 0, 3
 ; CHECK-64-NEXT:mfocrf 3, 128
 ; CHECK-64-NEXT:srwi 3, 3, 28
-; CHECK-64-NEXT:extsw 3, 3
+; CHECK-64-NEXT:rlwinm 3, 3, 31, 31, 31
 ; CHECK-64-NEXT:blr
 ;
 ; CHECK-32-LABEL: test_stwcx:
@@ -44,6 +44,7 @@ define dso_local signext i32 @test_stwcx(ptr %a, i32 signext 
%b) {
 ; CHECK-32-NEXT:stwcx. 4, 0, 3
 ; CHECK-32-NEXT:mfocrf 3, 128
 ; CHECK-32-NEXT:srwi 3, 3, 28
+; CHECK-32-NEXT:rlwinm 3, 3, 31, 31, 31
 ; CHECK-32-NEXT:blr
 entry:
   %0 = tail call i32 @llvm.

[llvm-branch-commits] [llvm] 441fb41 - [AMDGPU] GFX12 VMEM loads can write VGPR results out of order (#105549)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Jay Foad
Date: 2024-09-01T10:06:31+02:00
New Revision: 441fb41cb487d286977b7e1cdabc3efe4c2010cf

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

LOG: [AMDGPU] GFX12 VMEM loads can write VGPR results out of order (#105549)

Fix SIInsertWaitcnts to account for this by adding extra waits to avoid
WAW dependencies.

(cherry picked from commit 5506831f7bc8dc04ebe77f4d26940007bfb4ab39)

Added: 


Modified: 
llvm/lib/Target/AMDGPU/AMDGPU.td
llvm/lib/Target/AMDGPU/GCNSubtarget.h
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fadd.ll
llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmax.ll
llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmin.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll
llvm/test/CodeGen/AMDGPU/load-constant-i16.ll
llvm/test/CodeGen/AMDGPU/load-global-i16.ll
llvm/test/CodeGen/AMDGPU/load-global-i32.ll
llvm/test/CodeGen/AMDGPU/spill-csr-frame-ptr-reg-copy.ll
llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir

Removed: 




diff  --git a/llvm/lib/Target/AMDGPU/AMDGPU.td 
b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 7906e0ee9d7858..9efdbd751d96e3 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -953,6 +953,12 @@ def FeatureRequiredExportPriority : 
SubtargetFeature<"required-export-priority",
   "Export priority must be explicitly manipulated on GFX11.5"
 >;
 
+def FeatureVmemWriteVgprInOrder : SubtargetFeature<"vmem-write-vgpr-in-order",
+  "HasVmemWriteVgprInOrder",
+  "true",
+  "VMEM instructions of the same type write VGPR results in order"
+>;
+
 //======//
 // Subtarget Features (options and debugging)
 //======//
@@ -1123,7 +1129,8 @@ def FeatureSouthernIslands : 
GCNSubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
   FeatureDsSrc2Insts, FeatureLDSBankCount32, FeatureMovrel,
   FeatureTrigReducedRange, FeatureExtendedImageInsts, FeatureImageInsts,
   FeatureGDS, FeatureGWS, FeatureDefaultComponentZero,
-  FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts
+  FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts,
+  FeatureVmemWriteVgprInOrder
   ]
 >;
 
@@ -1136,7 +1143,8 @@ def FeatureSeaIslands : 
GCNSubtargetFeatureGeneration<"SEA_ISLANDS",
   FeatureDsSrc2Insts, FeatureExtendedImageInsts, FeatureUnalignedBufferAccess,
   FeatureImageInsts, FeatureGDS, FeatureGWS, FeatureDefaultComponentZero,
   FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts,
-  FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts
+  FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts,
+  FeatureVmemWriteVgprInOrder
   ]
 >;
 
@@ -1152,7 +1160,7 @@ def FeatureVolcanicIslands : 
GCNSubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
FeatureGFX7GFX8GFX9Insts, FeatureSMemTimeInst, FeatureMadMacF32Insts,
FeatureDsSrc2Insts, FeatureExtendedImageInsts, FeatureFastDenormalF32,
FeatureUnalignedBufferAccess, FeatureImageInsts, FeatureGDS, FeatureGWS,
-   FeatureDefaultComponentZero
+   FeatureDefaultComponentZero, FeatureVmemWriteVgprInOrder
   ]
 >;
 
@@ -1170,7 +1178,8 @@ def FeatureGFX9 : GCNSubtargetFeatureGeneration<"GFX9",
FeatureScalarFlatScratchInsts, FeatureScalarAtomics, FeatureR128A16,
FeatureA16, FeatureSMemTimeInst, FeatureFastDenormalF32, 
FeatureSupportsXNACK,
FeatureUnalignedBufferAccess, FeatureUnalignedDSAccess,
-   FeatureNegativeScratchOffsetBug, FeatureGWS, FeatureDefaultComponentZero
+   FeatureNegativeScratchOffsetBug, FeatureGWS, FeatureDefaultComponentZero,
+   FeatureVmemWriteVgprInOrder
   ]
 >;
 
@@ -1193,7 +1202,8 @@ def FeatureGFX10 : GCNSubtargetFeatureGeneration<"GFX10",
FeatureGDS, FeatureGWS, FeatureDefaultComponentZero,
FeatureMaxHardClauseLength63,
FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts,
-   FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts
+   FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts,
+   FeatureVmemWriteVgprInOrder
   ]
 >;
 
@@ -1215,7 +1225,8 @@ def FeatureGFX11 : GCNSubtargetFeatureGeneration<"GFX11",
FeatureUnalignedBufferAccess, FeatureUnalignedDSAccess, FeatureGDS,
FeatureGWS, FeatureDefaultComponentZero,
FeatureMaxHardClauseLength32,
-   FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF32FlatInsts
+   FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF32FlatInsts,
+   FeatureVmemWriteVgprInOrder
   ]
 >;
 

diff  --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h 
b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 902f51ae358d59..9386bcf0d74b22

[llvm-branch-commits] [llvm] release/19.x: workflows/release-tasks: Pass required secrets to all called workflows (#106286) (PR #106491)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@tstellar (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106491
___
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] release/19.x: [PowerPC] Respect endianness when bitcasting to fp128 (#95931) (PR #105623)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/105623

>From 45b149d2531948d2cc0e9d699a8e5371360a3bdf Mon Sep 17 00:00:00 2001
From: Tim Gymnich 
Date: Thu, 8 Aug 2024 02:51:04 +0200
Subject: [PATCH] [PowerPC] Respect endianness when bitcasting to fp128
 (#95931)

Fixes #92246

Match the behaviour of `bitcast v2i64 (BUILD_PAIR %lo %hi)` when
encountering `bitcast fp128 (BUILD_PAIR %lo $hi)`.
by inserting a missing swap of the arguments based on endianness.

### Current behaviour:
**fp128**
bitcast fp128 (BUILD_PAIR %lo $hi) => BUILD_FP128 %lo %hi
BUILD_FP128 %lo %hi => MTVSRDD %hi %lo

**v2i64**
bitcast v2i64 (BUILD_PAIR %lo %hi) => BUILD_VECTOR %hi %lo
BUILD_VECTOR %hi %lo => MTVSRDD %lo %hi

(cherry picked from commit 408d82d352eb98e2d0a804c66d359cd7a49228fe)
---
 llvm/lib/Target/PowerPC/PPCISelLowering.cpp  | 14 +-
 llvm/test/CodeGen/PowerPC/f128-aggregates.ll | 12 ++--
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp 
b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index aaf0449a55387f..21cf4d9eeac173 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -9338,14 +9338,18 @@ SDValue PPCTargetLowering::LowerBITCAST(SDValue Op, 
SelectionDAG &DAG) const {
   SDLoc dl(Op);
   SDValue Op0 = Op->getOperand(0);
 
+  SDValue Lo = Op0.getOperand(0);
+  SDValue Hi = Op0.getOperand(1);
+
   if ((Op.getValueType() != MVT::f128) ||
-  (Op0.getOpcode() != ISD::BUILD_PAIR) ||
-  (Op0.getOperand(0).getValueType() != MVT::i64) ||
-  (Op0.getOperand(1).getValueType() != MVT::i64) || !Subtarget.isPPC64())
+  (Op0.getOpcode() != ISD::BUILD_PAIR) || (Lo.getValueType() != MVT::i64) 
||
+  (Hi.getValueType() != MVT::i64) || !Subtarget.isPPC64())
 return SDValue();
 
-  return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Op0.getOperand(0),
- Op0.getOperand(1));
+  if (!Subtarget.isLittleEndian())
+std::swap(Lo, Hi);
+
+  return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Lo, Hi);
 }
 
 static const SDValue *getNormalLoadInput(const SDValue &Op, bool &IsPermuted) {
diff --git a/llvm/test/CodeGen/PowerPC/f128-aggregates.ll 
b/llvm/test/CodeGen/PowerPC/f128-aggregates.ll
index b3d2457d31eebc..4be855e30ea1d4 100644
--- a/llvm/test/CodeGen/PowerPC/f128-aggregates.ll
+++ b/llvm/test/CodeGen/PowerPC/f128-aggregates.ll
@@ -283,7 +283,7 @@ define fp128 @testMixedAggregate([3 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testMixedAggregate:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r8, r7
+; CHECK-BE-NEXT:mtvsrdd v2, r7, r8
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testMixedAggregate:
@@ -310,7 +310,7 @@ define fp128 @testMixedAggregate_02([4 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testMixedAggregate_02:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r6, r5
+; CHECK-BE-NEXT:mtvsrdd v2, r5, r6
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testMixedAggregate_02:
@@ -344,7 +344,7 @@ define fp128 @testMixedAggregate_03([4 x i128] %sa.coerce) {
 ; CHECK-BE-LABEL: testMixedAggregate_03:
 ; CHECK-BE:   # %bb.0: # %entry
 ; CHECK-BE-NEXT:mtvsrwa v2, r4
-; CHECK-BE-NEXT:mtvsrdd v3, r6, r5
+; CHECK-BE-NEXT:mtvsrdd v3, r5, r6
 ; CHECK-BE-NEXT:xscvsdqp v2, v2
 ; CHECK-BE-NEXT:xsaddqp v2, v3, v2
 ; CHECK-BE-NEXT:mtvsrd v3, r9
@@ -467,7 +467,7 @@ define fp128 @testUnion_01([1 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testUnion_01:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r4, r3
+; CHECK-BE-NEXT:mtvsrdd v2, r3, r4
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testUnion_01:
@@ -494,7 +494,7 @@ define fp128 @testUnion_02([1 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testUnion_02:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r4, r3
+; CHECK-BE-NEXT:mtvsrdd v2, r3, r4
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testUnion_02:
@@ -521,7 +521,7 @@ define fp128 @testUnion_03([4 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testUnion_03:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r8, r7
+; CHECK-BE-NEXT:mtvsrdd v2, r7, r8
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testUnion_03:

___
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] release/19.x: [clang-format] js handle anonymous classes (#106242) (PR #106390)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106390
___
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] 894ec4e - [analyzer] Add missing include to llvm/lib/Support/Z3Solver.cpp (#106410)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Luke Shingles
Date: 2024-09-01T10:18:03+02:00
New Revision: 894ec4e3a1d56a5dd5a8205b4fd734136db87cfd

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

LOG: [analyzer] Add missing include  to 
llvm/lib/Support/Z3Solver.cpp (#106410)

Resolves #106361. Adding #include  to
llvm/lib/Support/Z3Solver.cpp fixes compilation errors for homebrew
build on macOS with Xcode 14.
https://github.com/Homebrew/homebrew-core/actions/runs/10604291631/job/29390993615?pr=181351
shows that this is resolved when the include is patched in (Linux CI
failure is due to unrelated timeout).

(cherry picked from commit fcb3a0485857c749d04ea234a8c3d629c62ab211)

Added: 


Modified: 
llvm/lib/Support/Z3Solver.cpp

Removed: 




diff  --git a/llvm/lib/Support/Z3Solver.cpp b/llvm/lib/Support/Z3Solver.cpp
index 5a34ff160f6cf4..9aece099b06295 100644
--- a/llvm/lib/Support/Z3Solver.cpp
+++ b/llvm/lib/Support/Z3Solver.cpp
@@ -19,6 +19,7 @@ using namespace llvm;
 #include "llvm/ADT/Twine.h"
 
 #include 
+#include 
 
 #include 
 



___
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] [compiler-rt] release/19.x: [compiler-rt] Fix definition of `usize` on 32-bit Windows (PR #106303)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@arichardson (or anyone else). If you would like to add a note about this fix 
in the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106303
___
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] release/19.x: Revert "[clang] fix broken canonicalization of DeducedTemplateSpeciatizationType (#95202)" (PR #106516)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106516
___
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] release/19.x: [clang-format] Correctly identify token-pasted record names (#106484) (PR #106900)

2024-09-01 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/106900

Backport 7579787e05966f21684dd4b4a15b9deac13d09e1

Requested by: @owenca

>From 95fa0bee9314a878b3a58d748998c3b3ef42bd75 Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Thu, 29 Aug 2024 19:14:19 -0700
Subject: [PATCH] [clang-format] Correctly identify token-pasted record names
 (#106484)

See
https://github.com/llvm/llvm-project/pull/89706#issuecomment-2315549955.

(cherry picked from commit 7579787e05966f21684dd4b4a15b9deac13d09e1)
---
 clang/lib/Format/UnwrappedLineParser.cpp  |  1 +
 clang/unittests/Format/TokenAnnotatorTest.cpp | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 53ddb710d2143b..7f5d157ae95891 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -4016,6 +4016,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
   }
   break;
 case tok::coloncolon:
+case tok::hashhash:
   break;
 default:
   if (!JSPastExtendsOrImplements && !ClassName &&
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 81e2628f28e583..f0533c92f6538c 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -3208,6 +3208,16 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   ASSERT_EQ(Tokens.size(), 11u) << Tokens;
   EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_ClassLBrace);
   EXPECT_BRACE_KIND(Tokens[7], BK_Block);
+  EXPECT_TOKEN(Tokens[8], tok::r_brace, TT_ClassRBrace);
+  EXPECT_BRACE_KIND(Tokens[8], BK_Block);
+
+  Tokens = annotate("#define FOO(X) \\\n"
+"  struct X##_tag_ {};");
+  ASSERT_EQ(Tokens.size(), 14u) << Tokens;
+  EXPECT_TOKEN(Tokens[10], tok::l_brace, TT_StructLBrace);
+  EXPECT_BRACE_KIND(Tokens[10], BK_Block);
+  EXPECT_TOKEN(Tokens[11], tok::r_brace, TT_StructRBrace);
+  EXPECT_BRACE_KIND(Tokens[11], BK_Block);
 }
 
 TEST_F(TokenAnnotatorTest, UnderstandsElaboratedTypeSpecifier) {

___
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] release/19.x: [clang-format] js handle anonymous classes (#106242) (PR #106390)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@kadircet (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106390
___
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] [libunwind] release/19.x: [libunwind] Stop installing the mach-o module map (#105616) (PR #105896)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/105896
___
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] bac3db3 - [clang-format] Revert "[clang-format][NFC] Delete TT_LambdaArrow (#70… (#105923)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Owen Pan
Date: 2024-09-01T10:15:12+02:00
New Revision: bac3db3c8b41c921d8ec895a9dc89ce310a670cb

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

LOG: [clang-format] Revert "[clang-format][NFC] Delete TT_LambdaArrow (#70… 
(#105923)

…519)"

This reverts commit e00d32afb9d33a1eca48e2b041c9688436706c5b and adds a
test for lambda arrow SplitPenalty.

Fixes #105480.

Added: 


Modified: 
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/FormatToken.h
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp

Removed: 




diff  --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index b07360425ca6e1..7d89f0e63dd225 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -842,10 +842,8 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState 
&State, bool DryRun,
 CurrentState.ContainsUnwrappedBuilder = true;
   }
 
-  if (Current.is(TT_TrailingReturnArrow) &&
-  Style.Language == FormatStyle::LK_Java) {
+  if (Current.is(TT_LambdaArrow) && Style.Language == FormatStyle::LK_Java)
 CurrentState.NoLineBreak = true;
-  }
   if (Current.isMemberAccess() && Previous.is(tok::r_paren) &&
   (Previous.MatchingParen &&
(Previous.TotalLength - Previous.MatchingParen->TotalLength > 10))) {
@@ -1000,7 +998,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState 
&State,
   //
   // is common and should be formatted like a free-standing function. The same
   // goes for wrapping before the lambda return type arrow.
-  if (Current.isNot(TT_TrailingReturnArrow) &&
+  if (Current.isNot(TT_LambdaArrow) &&
   (!Style.isJavaScript() || Current.NestingLevel != 0 ||
!PreviousNonComment || PreviousNonComment->isNot(tok::equal) ||
!Current.isOneOf(Keywords.kw_async, Keywords.kw_function))) {
@@ -1257,7 +1255,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const 
LineState &State) {
 }
 return CurrentState.Indent;
   }
-  if (Current.is(TT_TrailingReturnArrow) &&
+  if (Current.is(TT_LambdaArrow) &&
   Previous.isOneOf(tok::kw_noexcept, tok::kw_mutable, tok::kw_constexpr,
tok::kw_consteval, tok::kw_static, TT_AttributeSquare)) 
{
 return ContinuationIndent;
@@ -1590,7 +1588,7 @@ unsigned 
ContinuationIndenter::moveStateToNextToken(LineState &State,
   }
   if (Current.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && Newline)
 CurrentState.NestedBlockIndent = State.Column + Current.ColumnWidth + 1;
-  if (Current.isOneOf(TT_LambdaLSquare, TT_TrailingReturnArrow))
+  if (Current.isOneOf(TT_LambdaLSquare, TT_LambdaArrow))
 CurrentState.LastSpace = State.Column;
   if (Current.is(TT_RequiresExpression) &&
   Style.RequiresExpressionIndentation == FormatStyle::REI_Keyword) {

diff  --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h
index cc45d5a8c5c1ec..9bfeb2052164ee 100644
--- a/clang/lib/Format/FormatToken.h
+++ b/clang/lib/Format/FormatToken.h
@@ -102,6 +102,7 @@ namespace format {
   TYPE(JsTypeColon)
\
   TYPE(JsTypeOperator) 
\
   TYPE(JsTypeOptionalQuestion) 
\
+  TYPE(LambdaArrow)
\
   TYPE(LambdaLBrace)   
\
   TYPE(LambdaLSquare)  
\
   TYPE(LeadingJavaAnnotation)  
\
@@ -725,7 +726,7 @@ struct FormatToken {
   bool isMemberAccess() const {
 return isOneOf(tok::arrow, tok::period, tok::arrowstar) &&
!isOneOf(TT_DesignatedInitializerPeriod, TT_TrailingReturnArrow,
-TT_LeadingJavaAnnotation);
+TT_LambdaArrow, TT_LeadingJavaAnnotation);
   }
 
   bool isPointerOrReference() const {

diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 2f6ffb2e508650..3f00a28e62988a 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -831,7 +831,7 @@ class AnnotatingParser {
 }
 // An arrow after an ObjC method expression is not a lambda arrow.
 if (CurrentToken->is(TT_ObjCMethodExpr) && CurrentToken->Next &&
-CurrentToken->Next->is(TT_TrailingReturnArrow)) {
+CurrentToken->Next->is(TT_LambdaArrow)) {
   CurrentToken->Next->overwriteFixedType(TT_Unknown);
 }
 Left->MatchingParen = CurrentToken;
@@ -1769,8 +1769,10 

[llvm-branch-commits] [clang] 1b1ddb7 - [clang-format] Fix a misannotation of redundant r_paren as CastRParen (#105921)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Owen Pan
Date: 2024-09-01T10:07:28+02:00
New Revision: 1b1ddb767e430a29c35c8b12760b7aa21f508d15

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

LOG: [clang-format] Fix a misannotation of redundant r_paren as CastRParen 
(#105921)

Fixes #105880.

(cherry picked from commit 6bc225e0630f28e83290a43c3d9b25b057fc815a)

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 851f79895ac5ac..3b1ddf99888ca8 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2874,6 +2874,8 @@ class AnnotatingParser {
 // Search for unexpected tokens.
 for (auto *Prev = BeforeRParen; Prev != LParen; Prev = Prev->Previous) {
   if (Prev->is(tok::r_paren)) {
+if (Prev->is(TT_CastRParen))
+  return false;
 Prev = Prev->MatchingParen;
 if (!Prev)
   return false;

diff  --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index c20b50d14b80b1..1f15c00573bade 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -741,6 +741,12 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) {
   EXPECT_TOKEN(Tokens[9], tok::r_paren, TT_CastRParen);
   EXPECT_TOKEN(Tokens[10], tok::amp, TT_UnaryOperator);
 
+  Tokens = annotate("int result = ((int)a) - b;");
+  ASSERT_EQ(Tokens.size(), 13u) << Tokens;
+  EXPECT_TOKEN(Tokens[6], tok::r_paren, TT_CastRParen);
+  EXPECT_TOKEN(Tokens[8], tok::r_paren, TT_Unknown);
+  EXPECT_TOKEN(Tokens[9], tok::minus, TT_BinaryOperator);
+
   auto Style = getLLVMStyle();
   Style.TypeNames.push_back("Foo");
   Tokens = annotate("#define FOO(bar) foo((Foo)&bar)", Style);



___
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] [compiler-rt] release/19.x: [builtins] Fix missing main() function in float16/bfloat16 support checks (#104478) (PR #106843)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106843
___
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] 9ec54c3 - [clang-format] Fix misalignments of pointers in angle brackets (#106013)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Owen Pan
Date: 2024-09-01T10:12:18+02:00
New Revision: 9ec54c307b6151b1ddb3f7fe3b7cba4d9309b26c

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

LOG: [clang-format] Fix misalignments of pointers in angle brackets (#106013)

Fixes #105898.

(cherry picked from commit 656d5aa95825515a55ded61f19d41053c850c82d)

Added: 


Modified: 
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index a31874a7c3195a..fd4a40a86082e2 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -469,7 +469,9 @@ AlignTokenSequence(const FormatStyle &Style, unsigned 
Start, unsigned End,
 // except if the token is equal, then a space is needed.
 if ((Style.PointerAlignment == FormatStyle::PAS_Right ||
  Style.ReferenceAlignment == FormatStyle::RAS_Right) &&
-CurrentChange.Spaces != 0 && CurrentChange.Tok->isNot(tok::equal)) {
+CurrentChange.Spaces != 0 &&
+!CurrentChange.Tok->isOneOf(tok::equal, tok::r_paren,
+TT_TemplateCloser)) {
   const bool ReferenceNotRightAligned =
   Style.ReferenceAlignment != FormatStyle::RAS_Right &&
   Style.ReferenceAlignment != FormatStyle::RAS_Pointer;

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 82af149e048c94..29200b72d3d008 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -19186,6 +19186,24 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) {
"X= func(long,\n"
"arrg);",
Alignment);
+
+  Alignment.ColumnLimit = 80;
+  Alignment.SpacesInAngles = FormatStyle::SIAS_Always;
+  verifyFormat("void **ptr = reinterpret_cast< void ** >(unkn);\n"
+   "ptr= reinterpret_cast< void ** >(ptr[0]);",
+   Alignment);
+  verifyFormat("quint32 *dstimg  = reinterpret_cast< quint32 * >(out(i));\n"
+   "quint32 *dstmask = reinterpret_cast< quint32 * >(outmask(i));",
+   Alignment);
+
+  Alignment.SpacesInParens = FormatStyle::SIPO_Custom;
+  Alignment.SpacesInParensOptions.InCStyleCasts = true;
+  verifyFormat("void **ptr = ( void ** )unkn;\n"
+   "ptr= ( void ** )ptr[0];",
+   Alignment);
+  verifyFormat("quint32 *dstimg  = ( quint32 * )out.scanLine(i);\n"
+   "quint32 *dstmask = ( quint32 * )outmask.scanLine(i);",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveBitFields) {



___
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] release/19.x: [clang-format] Fix misalignments of pointers in angle brackets (#106013) (PR #106326)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106326
___
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] release/19.x: [clang-format] Fix a misannotation of less/greater as angle brackets (#105941) (PR #105971)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@owenca (or anyone else). If you would like to add a note about this fix in the 
release notes (completely optional). Please reply to this comment with a one or 
two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/105971
___
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] release/19.x: [RemoveDIs] Simplify spliceDebugInfo, fixing splice-to-end edge case (#105670) (PR #106690)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@OCHyams (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106690
___
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] 52ab956 - [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (#89934)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Younan Zhang
Date: 2024-09-01T10:10:41+02:00
New Revision: 52ab956704050302926e8afe1c7dbda4578acb9d

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

LOG: [Clang][Sema] Revisit the fix for the lambda within a type alias template 
decl (#89934)

In the last patch #82310, we used template depths to tell if such alias
decls contain lambdas, which is wrong because the lambda can also appear
as a part of the default argument, and that would make
`getTemplateInstantiationArgs` provide extra template arguments in
undesired contexts. This leads to issue #89853.

Moreover, our approach
for https://github.com/llvm/llvm-project/issues/82104 was sadly wrong.
We tried to teach `DeduceReturnType` to consider alias template
arguments; however, giving these arguments in the context where they
should have been substituted in a `TransformCallExpr` call is never
correct.

This patch addresses such problems by using a `RecursiveASTVisitor` to
check if the lambda is contained by an alias `Decl`, as well as
twiddling the lambda dependencies - we should also build a dependent
lambda expression if the surrounding alias template arguments were
dependent.

Fixes #89853
Fixes #102760
Fixes #105885

(cherry picked from commit b412ec5d3924c7570c2c96106f95a92403a4e09b)

Added: 


Modified: 
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/test/SemaTemplate/alias-template-with-lambdas.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 8995d461362d70..a09e3be83c4544 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -20,6 +20,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprConcepts.h"
 #include "clang/AST/PrettyDeclStackTrace.h"
+#include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeVisitor.h"
@@ -87,12 +88,19 @@ struct Response {
 // than lambda classes.
 const FunctionDecl *
 getPrimaryTemplateOfGenericLambda(const FunctionDecl *LambdaCallOperator) {
+  if (!isLambdaCallOperator(LambdaCallOperator))
+return LambdaCallOperator;
   while (true) {
 if (auto *FTD = dyn_cast_if_present(
 LambdaCallOperator->getDescribedTemplate());
 FTD && FTD->getInstantiatedFromMemberTemplate()) {
   LambdaCallOperator =
   FTD->getInstantiatedFromMemberTemplate()->getTemplatedDecl();
+} else if (LambdaCallOperator->getPrimaryTemplate()) {
+  // Cases where the lambda operator is instantiated in
+  // TemplateDeclInstantiator::VisitCXXMethodDecl.
+  LambdaCallOperator =
+  LambdaCallOperator->getPrimaryTemplate()->getTemplatedDecl();
 } else if (auto *Prev = cast(LambdaCallOperator)
 ->getInstantiatedFromMemberFunction())
   LambdaCallOperator = Prev;
@@ -138,22 +146,28 @@ getEnclosingTypeAliasTemplateDecl(Sema &SemaRef) {
 // Check if we are currently inside of a lambda expression that is
 // surrounded by a using alias declaration. e.g.
 //   template  using type = decltype([](auto) { ^ }());
-// By checking if:
-//  1. The lambda expression and the using alias declaration share the
-//  same declaration context.
-//  2. They have the same template depth.
 // We have to do so since a TypeAliasTemplateDecl (or a TypeAliasDecl) is never
 // a DeclContext, nor does it have an associated specialization Decl from which
 // we could collect these template arguments.
 bool isLambdaEnclosedByTypeAliasDecl(
-const FunctionDecl *PrimaryLambdaCallOperator,
+const FunctionDecl *LambdaCallOperator,
 const TypeAliasTemplateDecl *PrimaryTypeAliasDecl) {
-  return cast(PrimaryLambdaCallOperator->getDeclContext())
- ->getTemplateDepth() ==
- PrimaryTypeAliasDecl->getTemplateDepth() &&
- getLambdaAwareParentOfDeclContext(
- const_cast(PrimaryLambdaCallOperator)) ==
- PrimaryTypeAliasDecl->getDeclContext();
+  struct Visitor : RecursiveASTVisitor {
+Visitor(const FunctionDecl *CallOperator) : CallOperator(CallOperator) {}
+bool VisitLambdaExpr(const LambdaExpr *LE) {
+  // Return true to bail out of the traversal, implying the Decl contains
+  // the lambda.
+  return getPrimaryTemplateOfGenericLambda(LE->getCallOperator()) !=
+ CallOperator;
+}
+const FunctionDecl *CallOperator;
+  };
+
+  QualType Underlying =
+  PrimaryTypeAliasDecl->getTemplatedDecl()->getUnderlyingType();
+
+  return !Visitor(getPrimaryTemplateOfGenericLambda(LambdaCallOperator))
+  .TraverseType(Underlying);
 }
 
 // Add template arguments from a variable template instantiation.
@@ -290,23 +304,8 @@ Response HandleF

[llvm-branch-commits] [llvm] release/19.x: Restrict LLVM_TARGETS_TO_BUILD in Windows release packaging (#106059) (PR #106546)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@zmodem (or anyone else). If you would like to add a note about this fix in the 
release notes (completely optional). Please reply to this comment with a one or 
two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106546
___
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] release/19.x: [IndVars] Check if WideInc available before trying to use it (PR #106892)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

@shafik @AaronBallman is this good to be merged?

https://github.com/llvm/llvm-project/pull/106892
___
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] eba1ef5 - [AArch64] Make apple-m4 armv8.7-a again (from armv9.2-a). (#106312)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Ahmed Bougacha
Date: 2024-09-01T09:49:34+02:00
New Revision: eba1ef5a1b7a84ed1954797dcd6d6f073b1f1a56

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

LOG: [AArch64] Make apple-m4 armv8.7-a again (from armv9.2-a).  (#106312)

This is a partial revert of c66e1d6f3429.  Even though that
allowed us to declare v9.2-a support without picking up SVE2
in both the backend and the driver, the frontend itself still
enabled SVE via the arch version's default extensions.

Avoid that by reverting back to v8.7-a while we look into
longer-term solutions.

(cherry picked from commit e5e38ddf1b8043324175868831da21e941c00aff)

Added: 


Modified: 
clang/test/CodeGen/aarch64-targetattr.c
llvm/lib/Target/AArch64/AArch64Processors.td
llvm/unittests/TargetParser/TargetParserTest.cpp

Removed: 




diff  --git a/clang/test/CodeGen/aarch64-targetattr.c 
b/clang/test/CodeGen/aarch64-targetattr.c
index d6227be2ebef83..a5f94b46cbb172 100644
--- a/clang/test/CodeGen/aarch64-targetattr.c
+++ b/clang/test/CodeGen/aarch64-targetattr.c
@@ -191,6 +191,14 @@ __attribute__((target("no-v9.3a")))
 //
 void minusarch() {}
 
+__attribute__((target("cpu=apple-m4")))
+// CHECK-LABEL: define {{[^@]+}}@applem4
+// CHECK-SAME: () #[[ATTR18:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret void
+//
+void applem4() {}
+
 //.
 // CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-features"="+crc,+fp-armv8,+lse,+neon,+ras,+rdm,+v8.1a,+v8.2a,+v8a" }
 // CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+v8.1a,+v8.2a,+v8a"
 }
@@ -210,6 +218,7 @@ void minusarch() {}
 // CHECK: attributes #[[ATTR15]] = { noinline nounwind optnone 
"branch-target-enforcement" "guarded-control-stack" "no-trapping-math"="true" 
"sign-return-address"="non-leaf" "sign-return-address-key"="a_key" 
"stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" 
"target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
 // CHECK: attributes #[[ATTR16]] = { noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" }
 // CHECK: attributes #[[ATTR17]] = { noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-features"="-v9.3a" }
+// CHECK: attributes #[[ATTR18]] = { noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-cpu"="apple-m4" 
"target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+sme,+sme-f64f64,+sme-i16i64,+sme2,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8.7a,+v8a,+wfxt"
 }
 //.
 // CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
 // CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}

diff  --git a/llvm/lib/Target/AArch64/AArch64Processors.td 
b/llvm/lib/Target/AArch64/AArch64Processors.td
index 6df87fc6a815f7..410b53e14de22e 100644
--- a/llvm/lib/Target/AArch64/AArch64Processors.td
+++ b/llvm/lib/Target/AArch64/AArch64Processors.td
@@ -895,7 +895,12 @@ def ProcessorFeatures {
  FeatureLSE, FeaturePAuth,
  FeatureRAS, FeatureRCPC, FeatureRDM,
  FeatureBF16, FeatureDotProd, 
FeatureMatMulInt8, FeatureSSBS];
-  list AppleM4 = [HasV9_2aOps, FeatureSHA2, FeatureFPARMv8,
+  // Technically apple-m4 is v9.2a, but we can't use that here.
+  // Historically, llvm defined v9.0a as requiring SVE, but it's optional
+  // according to the Arm ARM, and not supported by the core.  We decoupled the
+  // two in the clang driver and in the backend subtarget features, but it's
+  // still an issue in the clang frontend.  v8.7a is the next closest choice.
+  list AppleM4 = [HasV8_7aOps, FeatureSHA2, FeatureFPARMv8,
 FeatureNEON, FeaturePerfMon, FeatureSHA3,
 FeatureFullFP16, FeatureFP16FML,
 FeatureAES, FeatureBF16,

diff  --git a/llvm/unittests/TargetParser/TargetParserTest.cpp 
b/llvm/unittests/TargetParser/TargetParserTest.cpp
index dcbbc68332c799..11a28603674137 100644
--- a/llvm/unittests/TargetParser/TargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -1638,7 +1638,7 @@ INSTANTIATE_TEST_SUITE_P(
  

[llvm-branch-commits] [clang] [clang-format] Correctly identify token-pasted record names (PR #106897)

2024-09-01 Thread Owen Pan via llvm-branch-commits

https://github.com/owenca milestoned 
https://github.com/llvm/llvm-project/pull/106897
___
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] 4913755 - Revert "[LinkerWrapper] Extend with usual pass options (#96704)" (#102226)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Joseph Huber
Date: 2024-09-01T10:13:30+02:00
New Revision: 491375504831aae3da85ffb288ca3c8b3c94b1ea

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

LOG: Revert "[LinkerWrapper] Extend with usual pass options (#96704)" (#102226)

This reverts commit 90ccf2187332ff900d46a58a27cb0353577d37cb.

Fixes: https://github.com/llvm/llvm-project/issues/100212
(cherry picked from commit 030ee841a9c9fbbd6e7c001e751737381da01f7b)

Conflicts:
clang/test/Driver/linker-wrapper-passes.c

Added: 


Modified: 
clang/test/lit.cfg.py
clang/test/lit.site.cfg.py.in

Removed: 
clang/test/Driver/linker-wrapper-passes.c



diff  --git a/clang/test/Driver/linker-wrapper-passes.c 
b/clang/test/Driver/linker-wrapper-passes.c
deleted file mode 100644
index b257c942afa075..00
--- a/clang/test/Driver/linker-wrapper-passes.c
+++ /dev/null
@@ -1,71 +0,0 @@
-// Check various clang-linker-wrapper pass options after -offload-opt.
-
-// REQUIRES: llvm-plugins, llvm-examples
-// REQUIRES: x86-registered-target
-// REQUIRES: amdgpu-registered-target
-// Setup.
-// RUN: mkdir -p %t
-// RUN: %clang -cc1 -emit-llvm-bc -o %t/host-x86_64-unknown-linux-gnu.bc \
-// RUN: -disable-O0-optnone -triple=x86_64-unknown-linux-gnu %s
-// RUN: %clang -cc1 -emit-llvm-bc -o %t/openmp-amdgcn-amd-amdhsa.bc \
-// RUN: -disable-O0-optnone -triple=amdgcn-amd-amdhsa %s
-// RUN: opt %t/openmp-amdgcn-amd-amdhsa.bc -o %t/openmp-amdgcn-amd-amdhsa.bc \
-// RUN: -passes=forceattrs -force-remove-attribute=f:noinline
-// RUN: clang-offload-packager -o %t/openmp-x86_64-unknown-linux-gnu.out \
-// RUN: 
--image=file=%t/openmp-amdgcn-amd-amdhsa.bc,triple=amdgcn-amd-amdhsa
-// RUN: %clang -cc1 -S -o %t/host-x86_64-unknown-linux-gnu.s \
-// RUN: -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \
-// RUN: -fembed-offload-object=%t/openmp-x86_64-unknown-linux-gnu.out \
-// RUN: %t/host-x86_64-unknown-linux-gnu.bc
-// RUN: %clang -cc1as -o %t/host-x86_64-unknown-linux-gnu.o \
-// RUN: -triple x86_64-unknown-linux-gnu -filetype obj -target-cpu x86-64 \
-// RUN: %t/host-x86_64-unknown-linux-gnu.s
-
-// Check plugin, -passes, and no remarks.
-// RUN: clang-linker-wrapper -o a.out --embed-bitcode \
-// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \
-// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \
-// RUN: --offload-opt=-passes="function(goodbye),module(inline)" 2>&1 | \
-// RUN:   FileCheck -match-full-lines -check-prefixes=OUT %s
-
-// Check plugin, -p, and remarks.
-// RUN: clang-linker-wrapper -o a.out --embed-bitcode \
-// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \
-// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \
-// RUN: --offload-opt=-p="function(goodbye),module(inline)" \
-// RUN: --offload-opt=-pass-remarks=inline \
-// RUN: --offload-opt=-pass-remarks-output=%t/remarks.yml \
-// RUN: --offload-opt=-pass-remarks-filter=inline \
-// RUN: --offload-opt=-pass-remarks-format=yaml 2>&1 | \
-// RUN:   FileCheck -match-full-lines -check-prefixes=OUT,REM %s
-// RUN: FileCheck -input-file=%t/remarks.yml -match-full-lines \
-// RUN: -check-prefixes=YML %s
-
-// Check handling of bad plugin.
-// RUN: not clang-linker-wrapper \
-// RUN: --offload-opt=-load-pass-plugin=%t/nonexistent.so 2>&1 | \
-// RUN:   FileCheck -match-full-lines -check-prefixes=BAD-PLUGIN %s
-
-//  OUT-NOT: {{.}}
-//  OUT: Bye: f
-// OUT-NEXT: Bye: test
-// REM-NEXT: remark: {{.*}} 'f' inlined into 'test' {{.*}}
-//  OUT-NOT: {{.}}
-
-//  YML-NOT: {{.}}
-//  YML: --- !Passed
-// YML-NEXT: Pass: inline
-// YML-NEXT: Name: Inlined
-// YML-NEXT: Function: test
-// YML-NEXT: Args:
-//  YML:  - Callee: f
-//  YML:  - Caller: test
-//  YML: ...
-//  YML-NOT: {{.}}
-
-// BAD-PLUGIN-NOT: {{.}}
-// BAD-PLUGIN: {{.*}}Could not load library {{.*}}nonexistent.so{{.*}}
-// BAD-PLUGIN-NOT: {{.}}
-
-void f() {}
-void test() { f(); }

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 2bd7501136a10e..92a3361ce672e2 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -110,15 +110,6 @@
 if config.clang_examples:
 config.available_features.add("examples")
 
-if config.llvm_examples:
-config.available_features.add("llvm-examples")
-
-if config.llvm_linked_bye_extension:
-config.substitutions.append(("%offload-opt-loadbye", ""))
-else:
-loadbye = 
f"-load-pass-plugin={config.llvm_shlib_dir}/Bye{config.llvm_shlib_ext}"
-config.substitutions.append(("%offload-opt-loadbye", 
f"--offload-opt={loadbye}"))
-
 
 def have_host_jit_feature_support(feature_name):
 clang_repl_exe = lit.util.which("clang-repl", config.clang_tools_dir)
@@ -223,9 +214,6 @@ def have_host_cl

[llvm-branch-commits] [clang] [clang-format] Correctly identify token-pasted record names (PR #106897)

2024-09-01 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)


Changes

See https://github.com/llvm/llvm-project/pull/89706#issuecomment-2315549955.

---
Full diff: https://github.com/llvm/llvm-project/pull/106897.diff


2 Files Affected:

- (modified) clang/lib/Format/UnwrappedLineParser.cpp (+1) 
- (modified) clang/unittests/Format/TokenAnnotatorTest.cpp (+10) 


``diff
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 53ddb710d2143b..7f5d157ae95891 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -4016,6 +4016,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
   }
   break;
 case tok::coloncolon:
+case tok::hashhash:
   break;
 default:
   if (!JSPastExtendsOrImplements && !ClassName &&
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 81e2628f28e583..f0533c92f6538c 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -3208,6 +3208,16 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   ASSERT_EQ(Tokens.size(), 11u) << Tokens;
   EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_ClassLBrace);
   EXPECT_BRACE_KIND(Tokens[7], BK_Block);
+  EXPECT_TOKEN(Tokens[8], tok::r_brace, TT_ClassRBrace);
+  EXPECT_BRACE_KIND(Tokens[8], BK_Block);
+
+  Tokens = annotate("#define FOO(X) \\\n"
+"  struct X##_tag_ {};");
+  ASSERT_EQ(Tokens.size(), 14u) << Tokens;
+  EXPECT_TOKEN(Tokens[10], tok::l_brace, TT_StructLBrace);
+  EXPECT_BRACE_KIND(Tokens[10], BK_Block);
+  EXPECT_TOKEN(Tokens[11], tok::r_brace, TT_StructRBrace);
+  EXPECT_BRACE_KIND(Tokens[11], BK_Block);
 }
 
 TEST_F(TokenAnnotatorTest, UnderstandsElaboratedTypeSpecifier) {

``




https://github.com/llvm/llvm-project/pull/106897
___
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-tools-extra] [clangd] Add clangd 19 release notes (PR #105975)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@HighCommander4 (or anyone else). If you would like to add a note about this 
fix in the release notes (completely optional). Please reply to this comment 
with a one or two sentence description of the fix.  When you are done, please 
add the release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/105975
___
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] release/19.x: [clang-format] Fix misalignments of pointers in angle brackets (#106013) (PR #106326)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@owenca (or anyone else). If you would like to add a note about this fix in the 
release notes (completely optional). Please reply to this comment with a one or 
two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106326
___
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] release/19.x: [IndVars] Check if WideInc available before trying to use it (PR #106892)

2024-09-01 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-transforms

Author: None (llvmbot)


Changes

Backport c9a5e1b665dbba898e9981fd7d48881947e6560e

Requested by: @nikic

---
Full diff: https://github.com/llvm/llvm-project/pull/106892.diff


2 Files Affected:

- (modified) llvm/lib/Transforms/Utils/SimplifyIndVar.cpp (+17-11) 
- (added) llvm/test/Transforms/IndVarSimplify/pr106239.ll (+36) 


``diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp 
b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 5bda7c50c62c66..0b4a75e0bc52de 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1928,18 +1928,24 @@ Instruction 
*WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU,
 if (!WideAddRec.first)
   return nullptr;
 
-// Reuse the IV increment that SCEVExpander created. Recompute flags, 
unless
-// the flags for both increments agree and it is safe to use the ones from
-// the original inc. In that case, the new use of the wide increment won't
-// be more poisonous.
-bool NeedToRecomputeFlags =
-!SCEVExpander::canReuseFlagsFromOriginalIVInc(OrigPhi, WidePhi,
-  DU.NarrowUse, WideInc) ||
-DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() ||
-DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap();
+auto CanUseWideInc = [&]() {
+  if (!WideInc)
+return false;
+  // Reuse the IV increment that SCEVExpander created. Recompute flags,
+  // unless the flags for both increments agree and it is safe to use the
+  // ones from the original inc. In that case, the new use of the wide
+  // increment won't be more poisonous.
+  bool NeedToRecomputeFlags =
+  !SCEVExpander::canReuseFlagsFromOriginalIVInc(
+  OrigPhi, WidePhi, DU.NarrowUse, WideInc) ||
+  DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() ||
+  DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap();
+  return WideAddRec.first == WideIncExpr &&
+ Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags);
+};
+
 Instruction *WideUse = nullptr;
-if (WideAddRec.first == WideIncExpr &&
-Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags))
+if (CanUseWideInc())
   WideUse = WideInc;
 else {
   WideUse = cloneIVUser(DU, WideAddRec.first);
diff --git a/llvm/test/Transforms/IndVarSimplify/pr106239.ll 
b/llvm/test/Transforms/IndVarSimplify/pr106239.ll
new file mode 100644
index 00..8d5aa99539a5a7
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/pr106239.ll
@@ -0,0 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -S -passes=indvars < %s | FileCheck %s
+
+target datalayout = "n8:16:32:64"
+
+; Make sure it does not crash.
+
+define i32 @m() {
+; CHECK-LABEL: define i32 @m() {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:br label %[[FOR_BODY_I6:.*]]
+; CHECK:   [[FOR_BODY_I6]]:
+; CHECK-NEXT:br i1 true, label %[[I_EXIT:.*]], label %[[IF_END_I:.*]]
+; CHECK:   [[IF_END_I]]:
+; CHECK-NEXT:store i64 0, ptr null, align 8
+; CHECK-NEXT:br label %[[FOR_BODY_I6]]
+; CHECK:   [[I_EXIT]]:
+; CHECK-NEXT:ret i32 0
+;
+entry:
+  %div.i4 = sdiv i32 1, 0
+  br label %for.body.i6
+
+for.body.i6:  ; preds = %if.end.i, %entry
+  %add57.i = phi i32 [ %add.i7, %if.end.i ], [ 0, %entry ]
+  br i1 true, label %i.exit, label %if.end.i
+
+if.end.i: ; preds = %for.body.i6
+  %add.i7 = add i32 %add57.i, %div.i4
+  %conv.i = zext i32 %add57.i to i64
+  store i64 %conv.i, ptr null, align 8
+  br label %for.body.i6
+
+i.exit:   ; preds = %for.body.i6
+  ret i32 0
+}

``




https://github.com/llvm/llvm-project/pull/106892
___
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] release/19.x: [clang-format] Correctly identify token-pasted record names (#106484) (PR #106900)

2024-09-01 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: None (llvmbot)


Changes

Backport 7579787e05966f21684dd4b4a15b9deac13d09e1

Requested by: @owenca

---
Full diff: https://github.com/llvm/llvm-project/pull/106900.diff


2 Files Affected:

- (modified) clang/lib/Format/UnwrappedLineParser.cpp (+1) 
- (modified) clang/unittests/Format/TokenAnnotatorTest.cpp (+10) 


``diff
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 53ddb710d2143b..7f5d157ae95891 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -4016,6 +4016,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
   }
   break;
 case tok::coloncolon:
+case tok::hashhash:
   break;
 default:
   if (!JSPastExtendsOrImplements && !ClassName &&
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 81e2628f28e583..f0533c92f6538c 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -3208,6 +3208,16 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   ASSERT_EQ(Tokens.size(), 11u) << Tokens;
   EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_ClassLBrace);
   EXPECT_BRACE_KIND(Tokens[7], BK_Block);
+  EXPECT_TOKEN(Tokens[8], tok::r_brace, TT_ClassRBrace);
+  EXPECT_BRACE_KIND(Tokens[8], BK_Block);
+
+  Tokens = annotate("#define FOO(X) \\\n"
+"  struct X##_tag_ {};");
+  ASSERT_EQ(Tokens.size(), 14u) << Tokens;
+  EXPECT_TOKEN(Tokens[10], tok::l_brace, TT_StructLBrace);
+  EXPECT_BRACE_KIND(Tokens[10], BK_Block);
+  EXPECT_TOKEN(Tokens[11], tok::r_brace, TT_StructRBrace);
+  EXPECT_BRACE_KIND(Tokens[11], BK_Block);
 }
 
 TEST_F(TokenAnnotatorTest, UnderstandsElaboratedTypeSpecifier) {

``




https://github.com/llvm/llvm-project/pull/106900
___
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] 3f768dd - Add release note about ABI implementation changes for _BitInt on Arm

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Maciej Gabka
Date: 2024-09-01T10:05:56+02:00
New Revision: 3f768dd6806aeca74bfdf21bde9135d96b137ef3

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

LOG:  Add release note about ABI implementation changes for _BitInt on Arm

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ef5a2fda1ea771..5eed9827343dd5 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1221,6 +1221,9 @@ Arm and AArch64 Support
``-mabi=pauthtest`` option or via specifying ``pauthtest`` environment part 
of
target triple.
 
+ - The C23 ``_BitInt`` implementation has been brought into compliance
+   with AAPCS32 and AAPCS64.
+
 Android Support
 ^^^
 



___
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] release/19.x: [PowerPC] Fix mask for __st[d/w/h/b]cx builtins (#104453) (PR #106085)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@syzaara (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106085
___
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] release/19.x: workflows/release-tasks: Pass required secrets to all called workflows (#106286) (PR #106491)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106491
___
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] release/19.x: [clang][AArch64] Add SME2.1 feature macros (#105657) (PR #106135)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106135

>From 456006bc91c3d972f3c549b6296cad5e83630c7d Mon Sep 17 00:00:00 2001
From: SpencerAbson 
Date: Fri, 23 Aug 2024 14:27:49 +0100
Subject: [PATCH] [clang][AArch64] Add SME2.1 feature macros (#105657)

(cherry picked from commit 2617023923175b0fd2a8cb94ad677c061c01627f)
---
 clang/lib/Basic/Targets/AArch64.cpp   | 40 ++-
 clang/lib/Basic/Targets/AArch64.h |  3 ++
 .../Preprocessor/aarch64-target-features.c| 16 
 3 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index 6ba31cc05a0d75..63fc15f916c558 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -471,23 +471,25 @@ void AArch64TargetInfo::getTargetDefines(const 
LangOptions &Opts,
   if (HasSVE2 && HasSVE2SM4)
 Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
 
+  if (HasSVEB16B16)
+Builder.defineMacro("__ARM_FEATURE_SVE_B16B16", "1");
+
   if (HasSME) {
 Builder.defineMacro("__ARM_FEATURE_SME");
 Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
   }
 
-  if (HasSME2) {
-Builder.defineMacro("__ARM_FEATURE_SME", "1");
+  if (HasSME2)
 Builder.defineMacro("__ARM_FEATURE_SME2", "1");
-Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
-  }
 
-  if (HasSME2p1) {
-Builder.defineMacro("__ARM_FEATURE_SME", "1");
-Builder.defineMacro("__ARM_FEATURE_SME2", "1");
+  if (HasSME2p1)
 Builder.defineMacro("__ARM_FEATURE_SME2p1", "1");
-Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
-  }
+
+  if (HasSMEF16F16)
+Builder.defineMacro("__ARM_FEATURE_SME_F16F16", "1");
+
+  if (HasSMEB16B16)
+Builder.defineMacro("__ARM_FEATURE_SME_B16B16", "1");
 
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
@@ -749,6 +751,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sve", FPU & SveMode)
   .Case("sve-bf16", FPU & SveMode && HasBFloat16)
   .Case("sve-i8mm", FPU & SveMode && HasMatMul)
+  .Case("sve-b16b16", HasSVEB16B16)
   .Case("f32mm", FPU & SveMode && HasMatmulFP32)
   .Case("f64mm", FPU & SveMode && HasMatmulFP64)
   .Case("sve2", FPU & SveMode && HasSVE2)
@@ -763,6 +766,8 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sme-f64f64", HasSMEF64F64)
   .Case("sme-i16i64", HasSMEI16I64)
   .Case("sme-fa64", HasSMEFA64)
+  .Case("sme-f16f16", HasSMEF16F16)
+  .Case("sme-b16b16", HasSMEB16B16)
   .Cases("memtag", "memtag2", HasMTE)
   .Case("sb", HasSB)
   .Case("predres", HasPredRes)
@@ -863,6 +868,8 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasSVE2 = true;
   HasSVE2SM4 = true;
 }
+if (Feature == "+sve-b16b16")
+  HasSVEB16B16 = true;
 if (Feature == "+sve2-bitperm") {
   FPU |= NeonMode;
   FPU |= SveMode;
@@ -919,6 +926,21 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasSVE2 = true;
   HasSMEFA64 = true;
 }
+if (Feature == "+sme-f16f16") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+  HasSMEF16F16 = true;
+}
+if (Feature == "+sme-b16b16") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+  HasSVEB16B16 = true;
+  HasSMEB16B16 = true;
+}
 if (Feature == "+sb")
   HasSB = true;
 if (Feature == "+predres")
diff --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index 7bdf5a2b4106e4..526f7f30a38618 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -53,6 +53,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasSVE2AES = false;
   bool HasSVE2SHA3 = false;
   bool HasSVE2SM4 = false;
+  bool HasSVEB16B16 = false;
   bool HasSVE2BitPerm = false;
   bool HasMatmulFP64 = false;
   bool HasMatmulFP32 = false;
@@ -71,6 +72,8 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasSME2 = false;
   bool HasSMEF64F64 = false;
   bool HasSMEI16I64 = false;
+  bool HasSMEF16F16 = false;
+  bool HasSMEB16B16 = false;
   bool HasSME2p1 = false;
   bool HasSB = false;
   bool HasPredRes = false;
diff --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index 87bd3e142d2c40..ae2bdda6f536c5 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -709,3 +709,19 @@
 // CHECK-SME2p1: __ARM_FEATURE_SME 1
 // CHECK-SME2p1: __ARM_FEATURE_SME2 1
 // CHECK-SME2p1: __ARM_FEATURE_SME2p1 1
+
+// RUN: %clang --target=aarch64 -march=armv9-a+sve-b16b16 -x c -E -dM %s -o - 
| FileCheck --check-prefix=CHECK-SVEB16B16 %s
+// CHECK-SVEB16

[llvm-branch-commits] [llvm] daea6b9 - [AMDGPU] Add GFX12 test coverage for vmcnt flushing in loop headers (#105548)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Jay Foad
Date: 2024-09-01T10:06:31+02:00
New Revision: daea6b9c40a1ee9d44f5658c182094147bb78340

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

LOG: [AMDGPU] Add GFX12 test coverage for vmcnt flushing in loop headers 
(#105548)

(cherry picked from commit 61194617ad7862f144e0f6db34175553e8c34763)

Added: 


Modified: 
llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir

Removed: 




diff  --git a/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir 
b/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir
index 2417becb7c2167..e51174919b8d3a 100644
--- a/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir
+++ b/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir
@@ -1,5 +1,6 @@
 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass 
si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX9 %s
 # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass 
si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX10 %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass 
si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX12 %s
 
 ---
 
@@ -20,6 +21,13 @@
 # GFX10-LABEL: bb.1:
 # GFX10: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop
+# GFX12-LABEL: bb.0:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop
 body: |
   bb.0:
@@ -58,6 +66,13 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop_noterm
+# GFX12-LABEL: bb.0:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop_noterm
 body: |
   bb.0:
@@ -129,6 +144,13 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop_load
+# GFX12-LABEL: bb.0:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop_load
 body: |
   bb.0:
@@ -170,6 +192,13 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop_no_store
+# GFX12-LABEL: bb.0:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop_no_store
 body: |
   bb.0:
@@ -212,6 +241,13 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10-NOT: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop_no_use
+# GFX12-LABEL: bb.0:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop_no_use
 body: |
   bb.0:
@@ -255,6 +291,14 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10-NOT: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop2
+# GFX12-LABEL: bb.0:
+# GFX12: BUFFER_LOAD_FORMAT_X_IDXEN
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop2
 body: |
   bb.0:
@@ -294,6 +338,14 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10-NOT: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop2_store
+# GFX12-LABEL: bb.0:
+# GFX12: BUFFER_LOAD_FORMAT_X_IDXEN
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop2_store
 body: |
   bb.0:
@@ -334,6 +386,13 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop2_use_in_loop
+# GFX12-LABEL: bb.0:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop2_use_in_loop
 body: |
   bb.0:
@@ -379,6 +438,15 @@ body: |
 # GFX10-LABEL: bb.2:
 # GFX10-NOT: S_WAITCNT 16
 # GFX10-LABEL: bb.3:
+
+# GFX12-LABEL: waitcnt_vm_loop2_nowait
+# GFX12-LABEL: bb.0:
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.3:
 name:waitcnt_vm_loop2_nowait
 body: |
   bb.0:
@@ -427,6 +495,14 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10-NOT: S_WAITCNT 16
 # GFX10-LABEL: bb.2:
+
+# GFX12-LABEL: waitcnt_vm_loop2_reginterval
+# GFX12-LABEL: bb.0:
+# GFX12: GLOBAL_LOAD_DWORDX4
+# GFX12: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop2_reginterval
 body: |
   bb.0:
@@ -467,6 +543,13 @@ body: |
 # GFX10-LABEL: bb.1:
 # GFX10: S_WA

[llvm-branch-commits] [clang] [clang-format] Correctly identify token-pasted record names (PR #106897)

2024-09-01 Thread Owen Pan via llvm-branch-commits

https://github.com/owenca closed 
https://github.com/llvm/llvm-project/pull/106897
___
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] [lld] release/19.x: [lld-macho] Fix crash: ObjC category merge + relative method lists (#104081) (PR #105615)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/105615

>From 40b076410194df3783b0c9cefa9f018fb190bdff Mon Sep 17 00:00:00 2001
From: alx32 <103613512+al...@users.noreply.github.com>
Date: Wed, 14 Aug 2024 19:30:41 -0700
Subject: [PATCH] [lld-macho] Fix crash: ObjC category merge + relative method
 lists (#104081)

A crash was happening when both ObjC Category Merging and Relative
method lists were enabled.

ObjC Category Merging creates new data sections and adds them by calling
`addInputSection`. `addInputSection` uses the symbols within the added
section to determine which container to actually add the section to.

The issue is that ObjC Category merging is calling `addInputSection`
before actually adding the relevant symbols the the added section. This
causes `addInputSection` to add the `InputSection` to the wrong
container, eventually resulting in a crash.

To fix this, we ensure that ObjC Category Merging calls
`addInputSection` only after the symbols have been added to the
`InputSection`.

(cherry picked from commit 0df91893efc752a76c7bbe6b063d66c8a2fa0d55)
---
 lld/MachO/ObjC.cpp| 10 +-
 .../MachO/objc-category-merging-minimal.s | 20 +--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lld/MachO/ObjC.cpp b/lld/MachO/ObjC.cpp
index 9c056f40aa943f..39d885188d34ac 100644
--- a/lld/MachO/ObjC.cpp
+++ b/lld/MachO/ObjC.cpp
@@ -873,7 +873,6 @@ Defined *ObjcCategoryMerger::emitAndLinkProtocolList(
   infoCategoryWriter.catPtrListInfo.align);
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
   listSec->live = true;
-  addInputSection(listSec);
 
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
 
@@ -889,6 +888,7 @@ Defined *ObjcCategoryMerger::emitAndLinkProtocolList(
 
   ptrListSym->used = true;
   parentSym->getObjectFile()->symbols.push_back(ptrListSym);
+  addInputSection(listSec);
 
   createSymbolReference(parentSym, ptrListSym, linkAtOffset,
 infoCategoryWriter.catBodyInfo.relocTemplate);
@@ -933,7 +933,6 @@ void ObjcCategoryMerger::emitAndLinkPointerList(
   infoCategoryWriter.catPtrListInfo.align);
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
   listSec->live = true;
-  addInputSection(listSec);
 
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
 
@@ -949,6 +948,7 @@ void ObjcCategoryMerger::emitAndLinkPointerList(
 
   ptrListSym->used = true;
   parentSym->getObjectFile()->symbols.push_back(ptrListSym);
+  addInputSection(listSec);
 
   createSymbolReference(parentSym, ptrListSym, linkAtOffset,
 infoCategoryWriter.catBodyInfo.relocTemplate);
@@ -974,7 +974,6 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string 
&forCategoryName,
bodyData, infoCategoryWriter.catListInfo.align);
   newCatList->parent = infoCategoryWriter.catListInfo.outputSection;
   newCatList->live = true;
-  addInputSection(newCatList);
 
   newCatList->parent = infoCategoryWriter.catListInfo.outputSection;
 
@@ -990,6 +989,7 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string 
&forCategoryName,
 
   catListSym->used = true;
   objFile->symbols.push_back(catListSym);
+  addInputSection(newCatList);
   return catListSym;
 }
 
@@ -1012,7 +1012,6 @@ Defined *ObjcCategoryMerger::emitCategoryBody(const 
std::string &name,
bodyData, infoCategoryWriter.catBodyInfo.align);
   newBodySec->parent = infoCategoryWriter.catBodyInfo.outputSection;
   newBodySec->live = true;
-  addInputSection(newBodySec);
 
   std::string symName =
   objc::symbol_names::category + baseClassName + "(" + name + ")";
@@ -1025,6 +1024,7 @@ Defined *ObjcCategoryMerger::emitCategoryBody(const 
std::string &name,
 
   catBodySym->used = true;
   objFile->symbols.push_back(catBodySym);
+  addInputSection(newBodySec);
 
   createSymbolReference(catBodySym, nameSym, catLayout.nameOffset,
 infoCategoryWriter.catBodyInfo.relocTemplate);
@@ -1245,7 +1245,6 @@ void 
ObjcCategoryMerger::generateCatListForNonErasedCategories(
   infoCategoryWriter.catListInfo.align);
   listSec->parent = infoCategoryWriter.catListInfo.outputSection;
   listSec->live = true;
-  addInputSection(listSec);
 
   std::string slotSymName = "<__objc_catlist slot for category ";
   slotSymName += nonErasedCatBody->getName();
@@ -1260,6 +1259,7 @@ void 
ObjcCategoryMerger::generateCatListForNonErasedCategories(
 
   catListSlotSym->used = true;
   objFile->symbols.push_back(catListSlotSym);
+  addInputSection(listSec);
 
   // Now link the category body into the newly created slot
   createSymbolReference(catListSlotSym, nonErasedCatBody, 0,
diff --git a/lld/test/MachO/objc-category-merging-minimal.s 
b/lld/test/MachO/objc-category-merging-minimal.s
index 527493303c583e..b94799a57a4d85 100644
--- a/lld/te

[llvm-branch-commits] [llvm] 45b149d - [PowerPC] Respect endianness when bitcasting to fp128 (#95931)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Tim Gymnich
Date: 2024-09-01T10:05:25+02:00
New Revision: 45b149d2531948d2cc0e9d699a8e5371360a3bdf

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

LOG: [PowerPC] Respect endianness when bitcasting to fp128 (#95931)

Fixes #92246

Match the behaviour of `bitcast v2i64 (BUILD_PAIR %lo %hi)` when
encountering `bitcast fp128 (BUILD_PAIR %lo $hi)`.
by inserting a missing swap of the arguments based on endianness.

### Current behaviour:
**fp128**
bitcast fp128 (BUILD_PAIR %lo $hi) => BUILD_FP128 %lo %hi
BUILD_FP128 %lo %hi => MTVSRDD %hi %lo

**v2i64**
bitcast v2i64 (BUILD_PAIR %lo %hi) => BUILD_VECTOR %hi %lo
BUILD_VECTOR %hi %lo => MTVSRDD %lo %hi

(cherry picked from commit 408d82d352eb98e2d0a804c66d359cd7a49228fe)

Added: 


Modified: 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/f128-aggregates.ll

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp 
b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index aaf0449a55387f..21cf4d9eeac173 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -9338,14 +9338,18 @@ SDValue PPCTargetLowering::LowerBITCAST(SDValue Op, 
SelectionDAG &DAG) const {
   SDLoc dl(Op);
   SDValue Op0 = Op->getOperand(0);
 
+  SDValue Lo = Op0.getOperand(0);
+  SDValue Hi = Op0.getOperand(1);
+
   if ((Op.getValueType() != MVT::f128) ||
-  (Op0.getOpcode() != ISD::BUILD_PAIR) ||
-  (Op0.getOperand(0).getValueType() != MVT::i64) ||
-  (Op0.getOperand(1).getValueType() != MVT::i64) || !Subtarget.isPPC64())
+  (Op0.getOpcode() != ISD::BUILD_PAIR) || (Lo.getValueType() != MVT::i64) 
||
+  (Hi.getValueType() != MVT::i64) || !Subtarget.isPPC64())
 return SDValue();
 
-  return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Op0.getOperand(0),
- Op0.getOperand(1));
+  if (!Subtarget.isLittleEndian())
+std::swap(Lo, Hi);
+
+  return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Lo, Hi);
 }
 
 static const SDValue *getNormalLoadInput(const SDValue &Op, bool &IsPermuted) {

diff  --git a/llvm/test/CodeGen/PowerPC/f128-aggregates.ll 
b/llvm/test/CodeGen/PowerPC/f128-aggregates.ll
index b3d2457d31eebc..4be855e30ea1d4 100644
--- a/llvm/test/CodeGen/PowerPC/f128-aggregates.ll
+++ b/llvm/test/CodeGen/PowerPC/f128-aggregates.ll
@@ -283,7 +283,7 @@ define fp128 @testMixedAggregate([3 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testMixedAggregate:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r8, r7
+; CHECK-BE-NEXT:mtvsrdd v2, r7, r8
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testMixedAggregate:
@@ -310,7 +310,7 @@ define fp128 @testMixedAggregate_02([4 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testMixedAggregate_02:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r6, r5
+; CHECK-BE-NEXT:mtvsrdd v2, r5, r6
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testMixedAggregate_02:
@@ -344,7 +344,7 @@ define fp128 @testMixedAggregate_03([4 x i128] %sa.coerce) {
 ; CHECK-BE-LABEL: testMixedAggregate_03:
 ; CHECK-BE:   # %bb.0: # %entry
 ; CHECK-BE-NEXT:mtvsrwa v2, r4
-; CHECK-BE-NEXT:mtvsrdd v3, r6, r5
+; CHECK-BE-NEXT:mtvsrdd v3, r5, r6
 ; CHECK-BE-NEXT:xscvsdqp v2, v2
 ; CHECK-BE-NEXT:xsaddqp v2, v3, v2
 ; CHECK-BE-NEXT:mtvsrd v3, r9
@@ -467,7 +467,7 @@ define fp128 @testUnion_01([1 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testUnion_01:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r4, r3
+; CHECK-BE-NEXT:mtvsrdd v2, r3, r4
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testUnion_01:
@@ -494,7 +494,7 @@ define fp128 @testUnion_02([1 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testUnion_02:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r4, r3
+; CHECK-BE-NEXT:mtvsrdd v2, r3, r4
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testUnion_02:
@@ -521,7 +521,7 @@ define fp128 @testUnion_03([4 x i128] %a.coerce) {
 ;
 ; CHECK-BE-LABEL: testUnion_03:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:mtvsrdd v2, r8, r7
+; CHECK-BE-NEXT:mtvsrdd v2, r7, r8
 ; CHECK-BE-NEXT:blr
 ;
 ; CHECK-P8-LABEL: testUnion_03:



___
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] [lld] release/19.x: [ELF] Move ElfSym into Ctx. NFC (PR #101844)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/101844
___
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] [lld] release/19.x: [lld-macho] Fix crash: ObjC category merge + relative method lists (#104081) (PR #105615)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/105615
___
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] [libcxx] 6f62347 - [libcxx] don't `#include ` if wide chars aren't enabled (#99911)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Ties Stuij
Date: 2024-09-01T10:20:37+02:00
New Revision: 6f623478d48c171d59e95b25ea2aca49dca8f135

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

LOG: [libcxx] don't `#include ` if wide chars aren't enabled (#99911)

Pull request #96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.

(cherry picked from commit ec56790c3b27df4fa1513594ca9a74fd8ad5bf7f)

Added: 


Modified: 
libcxx/include/format

Removed: 




diff  --git a/libcxx/include/format b/libcxx/include/format
index c3f2b45f0f7305..a88b3ef8528e2d 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -237,21 +237,21 @@ namespace std {
 #  include 
 #  include 
 #  include 
-#  include 
 #  include 
 #  include 
+#  include 
 #  include 
 #  include 
+#  include 
+#  include 
 #  include 
 #  include 
 #  include 
 #  include 
-#endif
 
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-#  include 
-#  include 
-#  include 
+#  if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#include 
+#  endif
 #endif
 
 #endif // _LIBCPP_FORMAT



___
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] [compiler-rt] release/19.x: [builtins] Fix divtc3.c etc. compilation on Solaris/SPARC with gcc (#101662) (PR #101847)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

Any news on this? Should it be withdrawn considering there are issues with it?

https://github.com/llvm/llvm-project/pull/101847
___
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] 78f97e2 - [analyzer] Limit `isTainted()` by skipping complicated symbols (#105493)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Balazs Benics
Date: 2024-09-01T10:01:07+02:00
New Revision: 78f97e22e5d87f9efc6b2c0ec76f60667458ca8a

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

LOG: [analyzer] Limit `isTainted()` by skipping complicated symbols (#105493)

As discussed in

https://discourse.llvm.org/t/rfc-make-istainted-and-complex-symbols-friends/79570/10

Some `isTainted()` queries can blow up the analysis times, and
effectively halt the analysis under specific workloads.

We don't really have the time now to do a caching re-implementation of
`isTainted()`, so we need to workaround the case.

The workaround with the smallest blast radius was to limit what symbols
`isTainted()` does the query (by walking the SymExpr). So far, the
threshold 10 worked for us, but this value can be overridden using the
"max-tainted-symbol-complexity" config value.

This new option is "deprecated" from the getgo, as I expect this issue
to be fixed within the next few months and I don't want users to
override this value anyways. If they do, this message will let them know
that they are on their own, and the next release may break them (as we
no longer recognize this option if we drop it).

Mitigates #89720

CPP-5414

(cherry picked from commit 848658955a9d2d42ea3e319d191e2dcd5d76c837)

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
clang/lib/StaticAnalyzer/Checkers/Taint.cpp
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/taint-generic.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b68b823ae6761d..ef5a2fda1ea771 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1407,6 +1407,11 @@ Crash and bug fixes
 - Z3 crosschecking (aka. Z3 refutation) is now bounded, and can't consume
   more total time than the eymbolic execution itself. (#GH97298)
 
+- In clang-18, we regressed in terms of analysis time for projects having many
+  nested loops with buffer indexing or shifting or other binary operations.
+  For example, functions computing 
diff erent hash values. Some of this slowdown
+  was attributed to taint analysis, which is fixed now. (#GH105493)
+
 - ``std::addressof``, ``std::as_const``, ``std::forward``,
   ``std::forward_like``, ``std::move``, ``std::move_if_noexcept``, are now
   modeled just like their builtin counterpart. (#GH94193)

diff  --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def 
b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
index 29aa6a3b8a16e7..737bc8e86cfb6a 100644
--- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -407,6 +407,11 @@ ANALYZER_OPTION(
 ANALYZER_OPTION(unsigned, MaxSymbolComplexity, "max-symbol-complexity",
 "The maximum complexity of symbolic constraint.", 35)
 
+// 
HACK:https://discourse.llvm.org/t/rfc-make-istainted-and-complex-symbols-friends/79570
+// Ideally, we should get rid of this option soon.
+ANALYZER_OPTION(unsigned, MaxTaintedSymbolComplexity, 
"max-tainted-symbol-complexity",
+"[DEPRECATED] The maximum complexity of a symbol to carry 
taint", 9)
+
 ANALYZER_OPTION(unsigned, MaxTimesInlineLarge, "max-times-inline-large",
 "The maximum times a large function could be inlined.", 32)
 

diff  --git a/clang/lib/StaticAnalyzer/Checkers/Taint.cpp 
b/clang/lib/StaticAnalyzer/Checkers/Taint.cpp
index 6362c82b009d72..0bb5739db4b756 100644
--- a/clang/lib/StaticAnalyzer/Checkers/Taint.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/Taint.cpp
@@ -12,6 +12,7 @@
 
 #include "clang/StaticAnalyzer/Checkers/Taint.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include 
 
@@ -256,6 +257,12 @@ std::vector 
taint::getTaintedSymbolsImpl(ProgramStateRef State,
   if (!Sym)
 return TaintedSymbols;
 
+  // 
HACK:https://discourse.llvm.org/t/rfc-make-istainted-and-complex-symbols-friends/79570
+  if (const auto &Opts = State->getAnalysisManager().getAnalyzerOptions();
+  Sym->computeComplexity() > Opts.MaxTaintedSymbolComplexity) {
+return {};
+  }
+
   // Traverse all the symbols this symbol depends on to see if any are tainted.
   for (SymbolRef SubSym : Sym->symbols()) {
 if (!isa(SubSym))

diff  --git a/clang/test/Analysis/analyzer-config.c 
b/clang/test/Analysis/analyzer-config.c
index 2a4c40005a4dc0..1ee0d8e4eecebd 100644
--- a/clang/test/Analysis/analyzer-config.c
+++ b/clang/test/Analysis/analyzer-config.c
@@ -96,6 +96,7 @@
 // CHECK-NEXT: max-inlinable-size = 100
 // CHECK-NEXT: max-nodes = 

[llvm-branch-commits] [libcxx] release/19.x: [libcxx] don't `#include ` if wide chars aren't enabled (#99911) (PR #106788)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@ldionne (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106788
___
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] [llvm] release/19.x: workflows/release-binaries: Enable flang builds on Windows (#101344) (PR #106480)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106480

>From 884e9d026ec889b91615e0fef48062fa8cc723e8 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Wed, 28 Aug 2024 18:22:57 -0700
Subject: [PATCH] workflows/release-binaries: Enable flang builds on Windows
 (#101344)

Flang for Windows depends on compiler-rt, so we need to enable it for
the stage1 builds. This also fixes failures building the flang tests on
macOS.

Fixes #100202.

(cherry picked from commit 8927576b8f6442bb6129bda597efee46176f8aec)
---
 .github/workflows/release-binaries.yml | 8 
 clang/cmake/caches/Release.cmake   | 7 +--
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/release-binaries.yml 
b/.github/workflows/release-binaries.yml
index 509016e5b89c45..672dd7517d23ce 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -135,16 +135,8 @@ jobs:
   target_cmake_flags="$target_cmake_flags 
-DBOOTSTRAP_DARWIN_osx_ARCHS=$arches 
-DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
 fi
 
-# x86 macOS and x86 Windows have trouble building flang, so disable it.
-# Windows: https://github.com/llvm/llvm-project/issues/100202
-# macOS: 'rebase opcodes terminated early at offset 1 of 80016' when 
building __fortran_builtins.mod
 build_flang="true"
 
-if [ "$target" = "Windows-X64" ]; then
-  target_cmake_flags="$target_cmake_flags 
-DLLVM_RELEASE_ENABLE_PROJECTS=\"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir\""
-  build_flang="false"
-fi
-
 if [ "${{ runner.os }}" = "Windows" ]; then
   # The build times out on Windows, so we need to disable LTO.
   target_cmake_flags="$target_cmake_flags 
-DLLVM_RELEASE_ENABLE_LTO=OFF"
diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index e5161dd9a27b96..6d5f75ca0074ee 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -47,11 +47,14 @@ set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
 
 set(STAGE1_PROJECTS "clang")
-set(STAGE1_RUNTIMES "")
+
+# Building Flang on Windows requires compiler-rt, so we need to build it in
+# stage1.  compiler-rt is also required for building the Flang tests on
+# macOS.
+set(STAGE1_RUNTIMES "compiler-rt")
 
 if (LLVM_RELEASE_ENABLE_PGO)
   list(APPEND STAGE1_PROJECTS "lld")
-  list(APPEND STAGE1_RUNTIMES "compiler-rt")
   set(CLANG_BOOTSTRAP_TARGETS
 generate-profdata
 stage2-package

___
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] [clang-format] Correctly identify token-pasted record names (PR #106897)

2024-09-01 Thread Owen Pan via llvm-branch-commits

owenca wrote:

See https://github.com/llvm/llvm-project/pull/106484#issuecomment-2319705402.

https://github.com/llvm/llvm-project/pull/106897
___
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] [compiler-rt] 6d7e428 - [builtins] Fix missing main() function in float16/bfloat16 support checks (#104478)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: OverMighty
Date: 2024-09-01T10:22:52+02:00
New Revision: 6d7e428df611861fb1f5151dea938ebfcc7b1363

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

LOG: [builtins] Fix missing main() function in float16/bfloat16 support checks 
(#104478)

The CMake docs state that `check_c_source_compiles()` checks whether the
supplied code "can be compiled as a C source file and linked as an
executable (so it must contain at least a `main()` function)."

https://cmake.org/cmake/help/v3.30/module/CheckCSourceCompiles.html

In practice, this command is a wrapper around `try_compile()`:

- 
https://gitlab.kitware.com/cmake/cmake/blob/2904ce00d2ed6ad5dac6d3459af62d8223e06ce0/Modules/CheckCSourceCompiles.cmake#L54
- 
https://gitlab.kitware.com/cmake/cmake/blob/2904ce00d2ed6ad5dac6d3459af62d8223e06ce0/Modules/Internal/CheckSourceCompiles.cmake#L101

When `CMAKE_SOURCE_DIR` is compiler-rt/lib/builtins/,
`CMAKE_TRY_COMPILE_TARGET_TYPE` is set to `STATIC_LIBRARY`, so the
checks for `float16` and `bfloat16` support work as intended in a
Clang + compiler-rt runtime build for example, as it runs CMake
recursively from that directory.

However, when using llvm/ or compiler-rt/ as CMake source directory, as
`CMAKE_TRY_COMPILE_TARGET_TYPE` defaults to `EXECUTABLE`, these checks
will indeed fail if the code doesn't have a `main()` function. This
results in LLVM using x86 SIMD registers when generating calls to
builtins that, with Arch Linux's compiler-rt package for example,
actually use a GPR for their argument or return value as they use
`uint16_t` instead of `_Float16`.

This had been caught in post-commit review:
https://reviews.llvm.org/D145237#4521152. Use of the internal
`CMAKE_C_COMPILER_WORKS` variable is not what hides the issue, however.

PR #69842 tried to fix this by unconditionally setting
`CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC_LIBRARY`, but it apparently
caused other issues, so it was reverted. This PR just adds a `main()`
function in the checks, as per the CMake docs.

(cherry picked from commit 68d8b3846ab1e6550910f2a9a685690eee558af2)

Added: 


Modified: 
compiler-rt/lib/builtins/CMakeLists.txt

Removed: 




diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt 
b/compiler-rt/lib/builtins/CMakeLists.txt
index abea8c498f7bdc..e0b2d08c207754 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -867,10 +867,12 @@ else ()
   endif()
 endif()
   endif()
-  check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }"
+  check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }
+   int main(void) { return 0; }"
   COMPILER_RT_HAS_${arch}_FLOAT16)
   append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 
BUILTIN_CFLAGS_${arch})
-  check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }"
+  check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }
+   int main(void) { return 0; }"
   COMPILER_RT_HAS_${arch}_BFLOAT16)
   # Build BF16 files only when "__bf16" is available.
   if(COMPILER_RT_HAS_${arch}_BFLOAT16)



___
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] release/19.x: [clang-format] Fix a misannotation of redundant r_paren as CastRParen (#105921) (PR #105967)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/105967

>From 1b1ddb767e430a29c35c8b12760b7aa21f508d15 Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Sat, 24 Aug 2024 19:12:15 -0700
Subject: [PATCH] [clang-format] Fix a misannotation of redundant r_paren as
 CastRParen (#105921)

Fixes #105880.

(cherry picked from commit 6bc225e0630f28e83290a43c3d9b25b057fc815a)
---
 clang/lib/Format/TokenAnnotator.cpp   | 2 ++
 clang/unittests/Format/TokenAnnotatorTest.cpp | 6 ++
 2 files changed, 8 insertions(+)

diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 851f79895ac5ac..3b1ddf99888ca8 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2874,6 +2874,8 @@ class AnnotatingParser {
 // Search for unexpected tokens.
 for (auto *Prev = BeforeRParen; Prev != LParen; Prev = Prev->Previous) {
   if (Prev->is(tok::r_paren)) {
+if (Prev->is(TT_CastRParen))
+  return false;
 Prev = Prev->MatchingParen;
 if (!Prev)
   return false;
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index c20b50d14b80b1..1f15c00573bade 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -741,6 +741,12 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) {
   EXPECT_TOKEN(Tokens[9], tok::r_paren, TT_CastRParen);
   EXPECT_TOKEN(Tokens[10], tok::amp, TT_UnaryOperator);
 
+  Tokens = annotate("int result = ((int)a) - b;");
+  ASSERT_EQ(Tokens.size(), 13u) << Tokens;
+  EXPECT_TOKEN(Tokens[6], tok::r_paren, TT_CastRParen);
+  EXPECT_TOKEN(Tokens[8], tok::r_paren, TT_Unknown);
+  EXPECT_TOKEN(Tokens[9], tok::minus, TT_BinaryOperator);
+
   auto Style = getLLVMStyle();
   Style.TypeNames.push_back("Foo");
   Tokens = annotate("#define FOO(bar) foo((Foo)&bar)", Style);

___
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] release/19.x: [PowerPC] Respect endianness when bitcasting to fp128 (#95931) (PR #105623)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/105623
___
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] 09cca6b - [AMDGPU] Remove one case of vmcnt loop header flushing for GFX12 (#105550)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Jay Foad
Date: 2024-09-01T10:06:31+02:00
New Revision: 09cca6b1897d501020c02769f9a937401f13e37a

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

LOG: [AMDGPU] Remove one case of vmcnt loop header flushing for GFX12 (#105550)

When a loop contains a VMEM load whose result is only used outside the
loop, do not bother to flush vmcnt in the loop head on GFX12. A wait for
vmcnt will be required inside the loop anyway, because VMEM instructions
can write their VGPR results out of order.

(cherry picked from commit fa2dccb377d0b712223efe5b62e5fc633580a9e6)

Added: 


Modified: 
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir

Removed: 




diff  --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp 
b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 9e91548ba598d0..13130db884dc1c 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -2390,7 +2390,7 @@ bool SIInsertWaitcnts::shouldFlushVmCnt(MachineLoop *ML,
   }
   if (!ST->hasVscnt() && HasVMemStore && !HasVMemLoad && UsesVgprLoadedOutside)
 return true;
-  return HasVMemLoad && UsesVgprLoadedOutside;
+  return HasVMemLoad && UsesVgprLoadedOutside && ST->hasVmemWriteVgprInOrder();
 }
 
 bool SIInsertWaitcnts::runOnMachineFunction(MachineFunction &MF) {

diff  --git a/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir 
b/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir
index bdef55ab956a01..0ddd2aa285b264 100644
--- a/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir
+++ b/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir
@@ -295,7 +295,7 @@ body: |
 # GFX12-LABEL: waitcnt_vm_loop2
 # GFX12-LABEL: bb.0:
 # GFX12: BUFFER_LOAD_FORMAT_X_IDXEN
-# GFX12: S_WAIT_LOADCNT 0
+# GFX12-NOT: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.1:
 # GFX12: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.2:
@@ -342,7 +342,7 @@ body: |
 # GFX12-LABEL: waitcnt_vm_loop2_store
 # GFX12-LABEL: bb.0:
 # GFX12: BUFFER_LOAD_FORMAT_X_IDXEN
-# GFX12: S_WAIT_LOADCNT 0
+# GFX12-NOT: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.1:
 # GFX12: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.2:
@@ -499,9 +499,9 @@ body: |
 # GFX12-LABEL: waitcnt_vm_loop2_reginterval
 # GFX12-LABEL: bb.0:
 # GFX12: GLOBAL_LOAD_DWORDX4
-# GFX12: S_WAIT_LOADCNT 0
-# GFX12-LABEL: bb.1:
 # GFX12-NOT: S_WAIT_LOADCNT 0
+# GFX12-LABEL: bb.1:
+# GFX12: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.2:
 name:waitcnt_vm_loop2_reginterval
 body: |
@@ -600,7 +600,7 @@ body: |
 # GFX12-LABEL: bb.0:
 # GFX12: BUFFER_LOAD_FORMAT_X_IDXEN
 # GFX12: BUFFER_LOAD_FORMAT_X_IDXEN
-# GFX12: S_WAIT_LOADCNT 0
+# GFX12-NOT: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.1:
 # GFX12: S_WAIT_LOADCNT 0
 # GFX12-LABEL: bb.2:



___
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] [lld] release/19.x: [ELF] Move ElfSym into Ctx. NFC (PR #101844)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

I will close this for now since I haven't gotten a reply and don't think it 
should be merged this late in the release process. Re-open if you disagree and 
we can discuss.

https://github.com/llvm/llvm-project/pull/101844
___
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] [libunwind] 00ff55d - [libunwind] Stop installing the mach-o module map (#105616)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Ian Anderson
Date: 2024-09-01T10:07:04+02:00
New Revision: 00ff55d61c765467e9a72c0fd570343d3cfb3b43

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

LOG: [libunwind] Stop installing the mach-o module map (#105616)

libunwind shouldn't know that compact_unwind_encoding.h is part of a
MachO module that it doesn't own. Delete the mach-o module map, and let
whatever is in charge of the mach-o directory be the one to say how its
module is organized and where compact_unwind_encoding.h fits in.

(cherry picked from commit 172c4a4a147833f1c08df1555f3170aa9ccb6cbe)

Added: 


Modified: 
libunwind/include/CMakeLists.txt

Removed: 
libunwind/include/mach-o/compact_unwind_encoding.modulemap



diff  --git a/libunwind/include/CMakeLists.txt 
b/libunwind/include/CMakeLists.txt
index 51065d68afd4ea..6796d67a3354ff 100644
--- a/libunwind/include/CMakeLists.txt
+++ b/libunwind/include/CMakeLists.txt
@@ -3,7 +3,6 @@ set(files
 libunwind.h
 libunwind.modulemap
 mach-o/compact_unwind_encoding.h
-mach-o/compact_unwind_encoding.modulemap
 unwind_arm_ehabi.h
 unwind_itanium.h
 unwind.h

diff  --git a/libunwind/include/mach-o/compact_unwind_encoding.modulemap 
b/libunwind/include/mach-o/compact_unwind_encoding.modulemap
deleted file mode 100644
index 6eae657d31b5c5..00
--- a/libunwind/include/mach-o/compact_unwind_encoding.modulemap
+++ /dev/null
@@ -1,4 +0,0 @@
-module MachO.compact_unwind_encoding [system] {
-  header "compact_unwind_encoding.h"
-  export *
-}



___
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] [compiler-rt] release/19.x: [compiler-rt] Fix definition of `usize` on 32-bit Windows (PR #106303)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106303

>From 32927ca57e805681fa93ed913c0f0d3c075563b7 Mon Sep 17 00:00:00 2001
From: Alexander Richardson 
Date: Tue, 27 Aug 2024 15:37:24 -0700
Subject: [PATCH] [compiler-rt] Fix definition of `usize` on 32-bit Windows

32-bit Windows uses `unsigned int` for uintptr_t and size_t.
Commit 18e06e3e2f3d47433e1ed323b8725c76035fc1ac changed uptr to
unsigned long, so it no longer matches the real size_t/uintptr_t and
therefore the current definition of usize result in:
`error C2821: first formal parameter to 'operator new' must be 'size_t'`

However, the real problem is that uptr is wrong to work around the fact
that we have local SIZE_T and SSIZE_T typedefs that trample on the
basetsd.h definitions of the same name and therefore need to match
exactly. Unlike size_t/ssize_t the uppercase ones always use unsigned
long (even on 32-bit).

This commit works around the build breakage by keeping the existing
definitions of uptr/sptr and just changing usize. A follow-up change
will attempt to fix this properly.

Fixes: https://github.com/llvm/llvm-project/issues/101998

Reviewed By: mstorsjo

Pull Request: https://github.com/llvm/llvm-project/pull/106151

(cherry picked from commit bb27dd853a713866c025a94ead8f03a1e25d1b6e)
---
 .../lib/sanitizer_common/sanitizer_internal_defs.h   | 9 +
 1 file changed, 9 insertions(+)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h 
b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index 294e330c4d5611..eebfb00aad7acd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -194,7 +194,16 @@ typedef u64  OFF64_T;
 #ifdef __SIZE_TYPE__
 typedef __SIZE_TYPE__ usize;
 #else
+// Since we use this for operator new, usize must match the real size_t, but on
+// 32-bit Windows the definition of uptr does not actually match uintptr_t or
+// size_t because we are working around typedef mismatches for the (S)SIZE_T
+// types used in interception.h.
+// Until the definition of uptr has been fixed we have to special case Win32.
+#  if SANITIZER_WINDOWS && SANITIZER_WORDSIZE == 32
+typedef unsigned int usize;
+#  else
 typedef uptr usize;
+#  endif
 #endif
 
 typedef u64 tid_t;

___
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] release/19.x: [RemoveDIs] Simplify spliceDebugInfo, fixing splice-to-end edge case (#105670) (PR #106690)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106690

>From e1be8cf8723e8577abaeef586ec4c39f30053913 Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams 
Date: Wed, 28 Aug 2024 14:20:33 +0100
Subject: [PATCH] [RemoveDIs] Simplify spliceDebugInfo, fixing splice-to-end
 edge case (#105670)

Not quite NFC, fixes splitBasicBlockBefore case when we split before an
instruction with debug records (but without the headBit set, i.e., we are
splitting before the instruction but after the debug records that come before
it). splitBasicBlockBefore splices the instructions before the split point into
a new block. Prior to this patch, the debug records would get shifted up to the
front of the spliced instructions (as seen in the modified unittest - I believe
the unittest was checking erroneous behaviour). We instead want to leave those
debug records at the end of the spliced instructions.

The functionality of the deleted `else if` branch is covered by the remaining
`if` now that `DestMarker` is set to the trailing marker if `Dest` is `end()`.
Previously the "===" markers were sometimes detached, now we always detach
them and always reattach them.

Note: `deleteTrailingDbgRecords` only "unlinks" the tailing marker from the
block, it doesn't delete anything. The trailing marker is still cleaned up
properly inside the final `if` body with `DestMarker->eraseFromParent();`.

Part 1 of 2 needed for #105571

(cherry picked from commit f5815534d180c544bffd46f09c28b6fc334260fb)
---
 llvm/lib/IR/BasicBlock.cpp  | 24 +
 llvm/unittests/IR/BasicBlockDbgInfoTest.cpp |  4 ++--
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index bf19934da047c4..0a9498f051cb59 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -961,9 +961,13 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator 
Dest, BasicBlock *Src,
   // Detach the marker at Dest -- this lets us move the "" DbgRecords
   // around.
   DbgMarker *DestMarker = nullptr;
-  if (Dest != end()) {
-if ((DestMarker = getMarker(Dest)))
+  if ((DestMarker = getMarker(Dest))) {
+if (Dest == end()) {
+  assert(DestMarker == getTrailingDbgRecords());
+  deleteTrailingDbgRecords();
+} else {
   DestMarker->removeFromParent();
+}
   }
 
   // If we're moving the tail range of DbgRecords (":::"), absorb them into the
@@ -1005,22 +1009,14 @@ void 
BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src,
 } else {
   // Insert them right at the start of the range we moved, ahead of First
   // and the "" DbgRecords.
+  // This also covers the rare circumstance where we insert at end(), and 
we
+  // did not generate the iterator with begin() / getFirstInsertionPt(),
+  // meaning any trailing debug-info at the end of the block would
+  // "normally" have been pushed in front of "First". We move it there now.
   DbgMarker *FirstMarker = createMarker(First);
   FirstMarker->absorbDebugValues(*DestMarker, true);
 }
 DestMarker->eraseFromParent();
-  } else if (Dest == end() && !InsertAtHead) {
-// In the rare circumstance where we insert at end(), and we did not
-// generate the iterator with begin() / getFirstInsertionPt(), it means
-// any trailing debug-info at the end of the block would "normally" have
-// been pushed in front of "First". Move it there now.
-DbgMarker *TrailingDbgRecords = getTrailingDbgRecords();
-if (TrailingDbgRecords) {
-  DbgMarker *FirstMarker = createMarker(First);
-  FirstMarker->absorbDebugValues(*TrailingDbgRecords, true);
-  TrailingDbgRecords->eraseFromParent();
-  deleteTrailingDbgRecords();
-}
   }
 }
 
diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp 
b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
index 91a0745a0cc76e..835780e63aaf4f 100644
--- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
+++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
@@ -141,11 +141,11 @@ TEST(BasicBlockDbgInfoTest, SplitBasicBlockBefore) {
   Function *F = M->getFunction("func");
 
   BasicBlock &BB = F->getEntryBlock();
-  auto I = std::prev(BB.end(), 2);
+  auto I = std::prev(BB.end(), 2); // store i32 2, ptr %1.
   BB.splitBasicBlockBefore(I, "before");
 
   BasicBlock &BBBefore = F->getEntryBlock();
-  auto I2 = std::prev(BBBefore.end(), 2);
+  auto I2 = std::prev(BBBefore.end()); // br label %1 (new).
   ASSERT_TRUE(I2->hasDbgRecords());
 }
 

___
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] [libunwind] release/19.x: [libunwind] Stop installing the mach-o module map (#105616) (PR #105896)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/105896

>From 00ff55d61c765467e9a72c0fd570343d3cfb3b43 Mon Sep 17 00:00:00 2001
From: Ian Anderson 
Date: Thu, 22 Aug 2024 13:44:58 -0700
Subject: [PATCH] [libunwind] Stop installing the mach-o module map (#105616)

libunwind shouldn't know that compact_unwind_encoding.h is part of a
MachO module that it doesn't own. Delete the mach-o module map, and let
whatever is in charge of the mach-o directory be the one to say how its
module is organized and where compact_unwind_encoding.h fits in.

(cherry picked from commit 172c4a4a147833f1c08df1555f3170aa9ccb6cbe)
---
 libunwind/include/CMakeLists.txt   | 1 -
 libunwind/include/mach-o/compact_unwind_encoding.modulemap | 4 
 2 files changed, 5 deletions(-)
 delete mode 100644 libunwind/include/mach-o/compact_unwind_encoding.modulemap

diff --git a/libunwind/include/CMakeLists.txt b/libunwind/include/CMakeLists.txt
index 51065d68afd4ea..6796d67a3354ff 100644
--- a/libunwind/include/CMakeLists.txt
+++ b/libunwind/include/CMakeLists.txt
@@ -3,7 +3,6 @@ set(files
 libunwind.h
 libunwind.modulemap
 mach-o/compact_unwind_encoding.h
-mach-o/compact_unwind_encoding.modulemap
 unwind_arm_ehabi.h
 unwind_itanium.h
 unwind.h
diff --git a/libunwind/include/mach-o/compact_unwind_encoding.modulemap 
b/libunwind/include/mach-o/compact_unwind_encoding.modulemap
deleted file mode 100644
index 6eae657d31b5c5..00
--- a/libunwind/include/mach-o/compact_unwind_encoding.modulemap
+++ /dev/null
@@ -1,4 +0,0 @@
-module MachO.compact_unwind_encoding [system] {
-  header "compact_unwind_encoding.h"
-  export *
-}

___
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] 7b86034 - [llvm][CodeGen] Added a new restriction for II by pragma in window scheduler (#99448)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Kai Yan
Date: 2024-09-01T10:00:16+02:00
New Revision: 7b86034dcb8c7fd7ea125cec43f0117cd4a428b6

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

LOG: [llvm][CodeGen] Added a new restriction for II by pragma in window 
scheduler (#99448)

Added a new restriction for window scheduling.
Window scheduling is disabled when llvm.loop.pipeline.initiationinterval
is set.

Added: 
llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir

Modified: 
llvm/lib/CodeGen/MachinePipeliner.cpp

Removed: 




diff  --git a/llvm/lib/CodeGen/MachinePipeliner.cpp 
b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 497e282bb97682..5c68711ff61938 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -528,8 +528,16 @@ bool MachinePipeliner::useSwingModuloScheduler() {
 }
 
 bool MachinePipeliner::useWindowScheduler(bool Changed) {
-  // WindowScheduler does not work when it is off or when SwingModuloScheduler
-  // is successfully scheduled.
+  // WindowScheduler does not work for following cases:
+  // 1. when it is off.
+  // 2. when SwingModuloScheduler is successfully scheduled.
+  // 3. when pragma II is enabled.
+  if (II_setByPragma) {
+LLVM_DEBUG(dbgs() << "Window scheduling is disabled when "
+ "llvm.loop.pipeline.initiationinterval is set.\n");
+return false;
+  }
+
   return WindowSchedulingOption == WindowSchedulingFlag::WS_Force ||
  (WindowSchedulingOption == WindowSchedulingFlag::WS_On && !Changed);
 }

diff  --git 
a/llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir 
b/llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir
new file mode 100644
index 00..6e69a76290fb1d
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir
@@ -0,0 +1,83 @@
+# RUN: llc  --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \
+# RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \
+# RUN: | FileCheck %s
+# REQUIRES: asserts
+
+# Test that checks no window scheduler is performed if the II set by pragma was
+# enabled
+
+# CHECK: Window scheduling is disabled when 
llvm.loop.pipeline.initiationinterval is set.
+
+--- |
+  define void @test_pragma_ii_fail(ptr %a0, i32 %a1) {
+  b0:
+%v0 = icmp sgt i32 %a1, 1
+br i1 %v0, label %b1, label %b4
+
+  b1:   ; preds = %b0
+%v1 = load i32, ptr %a0, align 4
+%v2 = add i32 %v1, 10
+%v4 = add i32 %a1, -1
+%cgep = getelementptr i32, ptr %a0, i32 1
+br label %b2
+
+  b2:   ; preds = %b2, %b1
+%v5 = phi i32 [ %v12, %b2 ], [ %v4, %b1 ]
+%v6 = phi ptr [ %cgep2, %b2 ], [ %cgep, %b1 ]
+%v7 = phi i32 [ %v10, %b2 ], [ %v2, %b1 ]
+store i32 %v7, ptr %v6, align 4
+%v8 = add i32 %v7, 10
+%cgep1 = getelementptr i32, ptr %v6, i32 -1
+store i32 %v8, ptr %cgep1, align 4
+%v10 = add i32 %v7, 10
+%v12 = add i32 %v5, -1
+%v13 = icmp eq i32 %v12, 0
+%cgep2 = getelementptr i32, ptr %v6, i32 1
+br i1 %v13, label %b4, label %b2, !llvm.loop !0
+
+  b4:   ; preds = %b2, %b0
+ret void
+  }
+
+  !0 = distinct !{!0, !1}
+  !1 = !{!"llvm.loop.pipeline.initiationinterval", i32 2}
+...
+---
+name:test_pragma_ii_fail
+tracksRegLiveness: true
+body: |
+  bb.0.b0:
+successors: %bb.1(0x4000), %bb.3(0x4000)
+liveins: $r0, $r1
+  
+%0:intregs = COPY $r1
+%1:intregs = COPY $r0
+%2:predregs = C2_cmpgti %0, 1
+J2_jumpf %2, %bb.3, implicit-def dead $pc
+J2_jump %bb.1, implicit-def dead $pc
+  
+  bb.1.b1:
+successors: %bb.2(0x8000)
+  
+%3:intregs, %4:intregs = L2_loadri_pi %1, 4
+%5:intregs = A2_addi killed %3, 10
+%6:intregs = A2_addi %0, -1
+%7:intregs = COPY %6
+J2_loop0r %bb.2, %7, implicit-def $lc0, implicit-def $sa0, implicit-def 
$usr
+  
+  bb.2.b2 (machine-block-address-taken):
+successors: %bb.3(0x0400), %bb.2(0x7c00)
+  
+%8:intregs = PHI %4, %bb.1, %9, %bb.2
+%10:intregs = PHI %5, %bb.1, %11, %bb.2
+S2_storeri_io %8, 0, %10
+%11:intregs = A2_addi %10, 10
+S2_storeri_io %8, -4, %11
+%9:intregs = A2_addi %8, 4
+ENDLOOP0 %bb.2, implicit-def $pc, implicit-def $lc0, implicit $sa0, 
implicit $lc0
+J2_jump %bb.3, implicit-def dead $pc
+  
+  bb.3.b4:
+PS_jmpret $r31, implicit-def dead $pc
+
+...



___
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] release/19.x: [clang-format] Fix misalignments of pointers in angle brackets (#106013) (PR #106326)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106326

>From 9ec54c307b6151b1ddb3f7fe3b7cba4d9309b26c Mon Sep 17 00:00:00 2001
From: Owen Pan 
Date: Tue, 27 Aug 2024 19:13:27 -0700
Subject: [PATCH] [clang-format] Fix misalignments of pointers in angle
 brackets (#106013)

Fixes #105898.

(cherry picked from commit 656d5aa95825515a55ded61f19d41053c850c82d)
---
 clang/lib/Format/WhitespaceManager.cpp |  4 +++-
 clang/unittests/Format/FormatTest.cpp  | 18 ++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index a31874a7c3195a..fd4a40a86082e2 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -469,7 +469,9 @@ AlignTokenSequence(const FormatStyle &Style, unsigned 
Start, unsigned End,
 // except if the token is equal, then a space is needed.
 if ((Style.PointerAlignment == FormatStyle::PAS_Right ||
  Style.ReferenceAlignment == FormatStyle::RAS_Right) &&
-CurrentChange.Spaces != 0 && CurrentChange.Tok->isNot(tok::equal)) {
+CurrentChange.Spaces != 0 &&
+!CurrentChange.Tok->isOneOf(tok::equal, tok::r_paren,
+TT_TemplateCloser)) {
   const bool ReferenceNotRightAligned =
   Style.ReferenceAlignment != FormatStyle::RAS_Right &&
   Style.ReferenceAlignment != FormatStyle::RAS_Pointer;
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 82af149e048c94..29200b72d3d008 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -19186,6 +19186,24 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) {
"X= func(long,\n"
"arrg);",
Alignment);
+
+  Alignment.ColumnLimit = 80;
+  Alignment.SpacesInAngles = FormatStyle::SIAS_Always;
+  verifyFormat("void **ptr = reinterpret_cast< void ** >(unkn);\n"
+   "ptr= reinterpret_cast< void ** >(ptr[0]);",
+   Alignment);
+  verifyFormat("quint32 *dstimg  = reinterpret_cast< quint32 * >(out(i));\n"
+   "quint32 *dstmask = reinterpret_cast< quint32 * >(outmask(i));",
+   Alignment);
+
+  Alignment.SpacesInParens = FormatStyle::SIPO_Custom;
+  Alignment.SpacesInParensOptions.InCStyleCasts = true;
+  verifyFormat("void **ptr = ( void ** )unkn;\n"
+   "ptr= ( void ** )ptr[0];",
+   Alignment);
+  verifyFormat("quint32 *dstimg  = ( quint32 * )out.scanLine(i);\n"
+   "quint32 *dstmask = ( quint32 * )outmask.scanLine(i);",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveBitFields) {

___
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] f131edf - [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (#99064)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Avi Kivity
Date: 2024-09-01T10:21:45+02:00
New Revision: f131edf6fbe8e2ab7306aba72698daa6153ec91e

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

LOG: [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (#99064)

(cherry picked from commit 46a4132e167aa44d8ec7776262ce2a0e6d47de59)

Added: 
llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll

Modified: 
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp 
b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 1ce8f58c1aa140..4924d5a317478f 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1625,11 +1625,17 @@ void PGOUseFunc::setBranchWeights() {
   continue;
 
 // We have a non-zero Branch BB.
-unsigned Size = BBCountInfo.OutEdges.size();
-SmallVector EdgeCounts(Size, 0);
+
+// SuccessorCount can be greater than OutEdgesCount, because
+// removed edges don't appear in OutEdges.
+unsigned OutEdgesCount = BBCountInfo.OutEdges.size();
+unsigned SuccessorCount = BB.getTerminator()->getNumSuccessors();
+assert(OutEdgesCount <= SuccessorCount);
+
+SmallVector EdgeCounts(SuccessorCount, 0);
 uint64_t MaxCount = 0;
-for (unsigned s = 0; s < Size; s++) {
-  const PGOUseEdge *E = BBCountInfo.OutEdges[s];
+for (unsigned It = 0; It < OutEdgesCount; It++) {
+  const PGOUseEdge *E = BBCountInfo.OutEdges[It];
   const BasicBlock *SrcBB = E->SrcBB;
   const BasicBlock *DestBB = E->DestBB;
   if (DestBB == nullptr)

diff  --git a/llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll 
b/llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll
new file mode 100644
index 00..4f5f936606ca3f
--- /dev/null
+++ b/llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll
@@ -0,0 +1,42 @@
+; RUN: rm -rf %t && split-file %s %t
+
+; RUN: llvm-profdata merge %t/a.proftext -o %t/a.profdata
+; RUN: opt < %t/a.ll --passes=pgo-instr-use 
-pgo-test-profile-file=%t/a.profdata
+
+;--- a.ll
+target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-redhat-linux-gnu"
+
+define void @_bar() presplitcoroutine personality ptr null {
+  %1 = call token @llvm.coro.save(ptr null)
+  %2 = call i8 @llvm.coro.suspend(token none, i1 false)
+  switch i8 %2, label %5 [
+i8 0, label %3
+i8 1, label %4
+  ]
+
+3:; preds = %0
+  ret void
+
+4:; preds = %0
+  ret void
+
+5:; preds = %0
+  ret void
+}
+
+declare token @llvm.coro.save(ptr)
+
+declare i8 @llvm.coro.suspend(token, i1)
+
+;--- a.proftext
+# IR level Instrumentation Flag
+:ir
+
+_bar
+# Func Hash:
+1063705160175073211
+# Num Counters:
+2
+1
+0



___
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] [compiler-rt] 32927ca - [compiler-rt] Fix definition of `usize` on 32-bit Windows

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Alexander Richardson
Date: 2024-09-01T10:11:50+02:00
New Revision: 32927ca57e805681fa93ed913c0f0d3c075563b7

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

LOG: [compiler-rt] Fix definition of `usize` on 32-bit Windows

32-bit Windows uses `unsigned int` for uintptr_t and size_t.
Commit 18e06e3e2f3d47433e1ed323b8725c76035fc1ac changed uptr to
unsigned long, so it no longer matches the real size_t/uintptr_t and
therefore the current definition of usize result in:
`error C2821: first formal parameter to 'operator new' must be 'size_t'`

However, the real problem is that uptr is wrong to work around the fact
that we have local SIZE_T and SSIZE_T typedefs that trample on the
basetsd.h definitions of the same name and therefore need to match
exactly. Unlike size_t/ssize_t the uppercase ones always use unsigned
long (even on 32-bit).

This commit works around the build breakage by keeping the existing
definitions of uptr/sptr and just changing usize. A follow-up change
will attempt to fix this properly.

Fixes: https://github.com/llvm/llvm-project/issues/101998

Reviewed By: mstorsjo

Pull Request: https://github.com/llvm/llvm-project/pull/106151

(cherry picked from commit bb27dd853a713866c025a94ead8f03a1e25d1b6e)

Added: 


Modified: 
compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h

Removed: 




diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h 
b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index 294e330c4d5611..eebfb00aad7acd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -194,7 +194,16 @@ typedef u64  OFF64_T;
 #ifdef __SIZE_TYPE__
 typedef __SIZE_TYPE__ usize;
 #else
+// Since we use this for operator new, usize must match the real size_t, but on
+// 32-bit Windows the definition of uptr does not actually match uintptr_t or
+// size_t because we are working around typedef mismatches for the (S)SIZE_T
+// types used in interception.h.
+// Until the definition of uptr has been fixed we have to special case Win32.
+#  if SANITIZER_WINDOWS && SANITIZER_WORDSIZE == 32
+typedef unsigned int usize;
+#  else
 typedef uptr usize;
+#  endif
 #endif
 
 typedef u64 tid_t;



___
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] release/19.x: [clang][AArch64] Add SME2.1 feature macros (#105657) (PR #106135)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106135
___
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] a333954 - Revert " [InstCombine] Replace all dominated uses of condition with constants…"

2024-09-01 Thread via llvm-branch-commits

Author: ronlieb
Date: 2024-09-01T15:47:23-04:00
New Revision: a333954a2198ee3817ba89853a29c3fbee1f7705

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

LOG: Revert " [InstCombine] Replace all dominated uses of condition with 
constants…"

This reverts commit 380fa875ab050293be6c8723d770700100b10b8f.

Added: 


Modified: 
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/assume.ll
llvm/test/Transforms/InstCombine/branch.ll
llvm/test/Transforms/InstCombine/compare-unescaped.ll
llvm/test/Transforms/InstCombine/icmp-dom.ll
llvm/test/Transforms/InstCombine/indexed-gep-compares.ll
llvm/test/Transforms/InstCombine/known-bits.ll
llvm/test/Transforms/InstCombine/phi-known-bits-operand-order.ll
llvm/test/Transforms/InstCombine/phi.ll
llvm/test/Transforms/InstCombine/pr44245.ll
llvm/test/Transforms/InstCombine/sink-into-ncd.ll
llvm/test/Transforms/InstCombine/sink_to_unreachable.ll
llvm/test/Transforms/InstCombine/zext-phi.ll
llvm/test/Transforms/LoopVectorize/AArch64/uniform-args-call-variants.ll

llvm/test/Transforms/PhaseOrdering/AArch64/constraint-elimination-placement.ll

Removed: 
llvm/test/Transforms/PhaseOrdering/branch-dom-cond.ll



diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp 
b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 866e5f8a00b52d..8a96d1d0fb4c90 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3705,23 +3705,6 @@ Instruction 
*InstCombinerImpl::visitBranchInst(BranchInst &BI) {
 return nullptr;
   }
 
-  // Replace all dominated uses of the condition with true/false
-  if (BI.getSuccessor(0) != BI.getSuccessor(1)) {
-for (auto &U : make_early_inc_range(Cond->uses())) {
-  BasicBlockEdge Edge0(BI.getParent(), BI.getSuccessor(0));
-  if (DT.dominates(Edge0, U)) {
-replaceUse(U, ConstantInt::getTrue(Cond->getType()));
-addToWorklist(cast(U.getUser()));
-continue;
-  }
-  BasicBlockEdge Edge1(BI.getParent(), BI.getSuccessor(1));
-  if (DT.dominates(Edge1, U)) {
-replaceUse(U, ConstantInt::getFalse(Cond->getType()));
-addToWorklist(cast(U.getUser()));
-  }
-}
-  }
-
   DC.registerBranch(&BI);
   return nullptr;
 }

diff  --git a/llvm/test/Transforms/InstCombine/assume.ll 
b/llvm/test/Transforms/InstCombine/assume.ll
index a728c294628cad..474da9968b66ad 100644
--- a/llvm/test/Transforms/InstCombine/assume.ll
+++ b/llvm/test/Transforms/InstCombine/assume.ll
@@ -485,7 +485,7 @@ define i1 @nonnull3B(ptr %a, i1 %control) {
 ; CHECK-NEXT:call void @llvm.assume(i1 [[CMP]]) [ "nonnull"(ptr [[LOAD]]) ]
 ; CHECK-NEXT:ret i1 [[CMP]]
 ; CHECK:   not_taken:
-; CHECK-NEXT:ret i1 false
+; CHECK-NEXT:ret i1 [[CONTROL]]
 ;
 entry:
   %load = load ptr, ptr %a
@@ -513,7 +513,7 @@ define i1 @nonnull3C(ptr %a, i1 %control) {
 ; CHECK:   exit:
 ; CHECK-NEXT:ret i1 [[CMP2]]
 ; CHECK:   not_taken:
-; CHECK-NEXT:ret i1 false
+; CHECK-NEXT:ret i1 [[CONTROL]]
 ;
 entry:
   %load = load ptr, ptr %a
@@ -543,7 +543,7 @@ define i1 @nonnull3D(ptr %a, i1 %control) {
 ; CHECK:   exit:
 ; CHECK-NEXT:ret i1 [[CMP2]]
 ; CHECK:   not_taken:
-; CHECK-NEXT:ret i1 false
+; CHECK-NEXT:ret i1 [[CONTROL]]
 ;
 entry:
   %load = load ptr, ptr %a

diff  --git a/llvm/test/Transforms/InstCombine/branch.ll 
b/llvm/test/Transforms/InstCombine/branch.ll
index 1d5ff72eef9ce6..1110d5f90b1790 100644
--- a/llvm/test/Transforms/InstCombine/branch.ll
+++ b/llvm/test/Transforms/InstCombine/branch.ll
@@ -242,99 +242,3 @@ t:
 f:
   ret i32 3
 }
-
-define i32 @dom_true(i1 %cmp) {
-; CHECK-LABEL: @dom_true(
-; CHECK-NEXT:br i1 [[CMP:%.*]], label [[IF_THEN:%.*]], label 
[[IF_ELSE:%.*]]
-; CHECK:   if.then:
-; CHECK-NEXT:ret i32 1
-; CHECK:   if.else:
-; CHECK-NEXT:ret i32 0
-;
-  br i1 %cmp, label %if.then, label %if.else
-
-if.then:
-  %zext = zext i1 %cmp to i32
-  ret i32 %zext
-
-if.else:
-  ret i32 0
-}
-
-define i32 @dom_false(i1 %cmp) {
-; CHECK-LABEL: @dom_false(
-; CHECK-NEXT:br i1 [[CMP:%.*]], label [[IF_ELSE:%.*]], label 
[[IF_THEN:%.*]]
-; CHECK:   if.then:
-; CHECK-NEXT:ret i32 0
-; CHECK:   if.else:
-; CHECK-NEXT:ret i32 0
-;
-  br i1 %cmp, label %if.else, label %if.then
-
-if.then:
-  %zext = zext i1 %cmp to i32
-  ret i32 %zext
-
-if.else:
-  ret i32 0
-}
-
-define i32 @dom_true_phi(i1 %cmp) {
-; CHECK-LABEL: @dom_true_phi(
-; CHECK-NEXT:br i1 [[CMP:%.*]], label [[IF_THEN:%.*]], label 
[[IF_ELSE:%.*]]
-; CHECK:   if.then:
-; CHECK-NEXT:br label [[IF_END:%.*]]
-; CHECK:   if.else:
-; CHECK-NEXT:br label [[I

[llvm-branch-commits] [clang] release/19.x: Revert "[clang] fix broken canonicalization of DeducedTemplateSpeciatizationType (#95202)" (PR #106516)

2024-09-01 Thread via llvm-branch-commits

cor3ntin wrote:

no need!

https://github.com/llvm/llvm-project/pull/106516
___
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] release/19.x: [clang-format] Correctly identify token-pasted record names (#106484) (PR #106900)

2024-09-01 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/106900
___
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] release/19.x: [analyzer] Add missing include to llvm/lib/Support/Z3Solver.cpp (#106410) (PR #106525)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106525

>From 894ec4e3a1d56a5dd5a8205b4fd734136db87cfd Mon Sep 17 00:00:00 2001
From: Luke Shingles 
Date: Thu, 29 Aug 2024 11:09:07 +0100
Subject: [PATCH] [analyzer] Add missing include  to
 llvm/lib/Support/Z3Solver.cpp (#106410)

Resolves #106361. Adding #include  to
llvm/lib/Support/Z3Solver.cpp fixes compilation errors for homebrew
build on macOS with Xcode 14.
https://github.com/Homebrew/homebrew-core/actions/runs/10604291631/job/29390993615?pr=181351
shows that this is resolved when the include is patched in (Linux CI
failure is due to unrelated timeout).

(cherry picked from commit fcb3a0485857c749d04ea234a8c3d629c62ab211)
---
 llvm/lib/Support/Z3Solver.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/Support/Z3Solver.cpp b/llvm/lib/Support/Z3Solver.cpp
index 5a34ff160f6cf4..9aece099b06295 100644
--- a/llvm/lib/Support/Z3Solver.cpp
+++ b/llvm/lib/Support/Z3Solver.cpp
@@ -19,6 +19,7 @@ using namespace llvm;
 #include "llvm/ADT/Twine.h"
 
 #include 
+#include 
 
 #include 
 

___
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] 1b643db - Restrict LLVM_TARGETS_TO_BUILD in Windows release packaging (#106059)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Hans
Date: 2024-09-01T09:48:25+02:00
New Revision: 1b643dbad74986718460f28347cbd17085402383

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

LOG: Restrict LLVM_TARGETS_TO_BUILD in Windows release packaging (#106059)

When including all targets, some files become too large for the NSIS
installer to handle.

Fixes #101994

(cherry picked from commit 2a28df66dc3f7ff5b6233241837854acefb68d77)

Added: 


Modified: 
llvm/utils/release/build_llvm_release.bat

Removed: 




diff  --git a/llvm/utils/release/build_llvm_release.bat 
b/llvm/utils/release/build_llvm_release.bat
index 55b20c7c28ac12..64ae2d41ab2b02 100755
--- a/llvm/utils/release/build_llvm_release.bat
+++ b/llvm/utils/release/build_llvm_release.bat
@@ -151,6 +151,7 @@ set common_cmake_flags=^
   -DCMAKE_BUILD_TYPE=Release ^
   -DLLVM_ENABLE_ASSERTIONS=OFF ^
   -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
+  -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86" ^
   -DLLVM_BUILD_LLVM_C_DYLIB=ON ^
   -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^
   -DPython3_FIND_REGISTRY=NEVER ^



___
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] [LoongArch] Legalize ISD::CTPOP for GRLenVT type with LSX (PR #106941)

2024-09-01 Thread via llvm-branch-commits

https://github.com/wangleiat created 
https://github.com/llvm/llvm-project/pull/106941

None


___
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] [LoongArch] Legalize ISD::CTPOP for GRLenVT type with LSX (PR #106941)

2024-09-01 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-loongarch

Author: wanglei (wangleiat)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/106941.diff


3 Files Affected:

- (modified) llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp (+41) 
- (modified) llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td (+4) 
- (modified) llvm/test/CodeGen/LoongArch/ctpop-with-lsx.ll (+41-148) 


``diff
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp 
b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index 95c1b150722f64..0e17ce7ea02bb4 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -283,6 +283,7 @@ LoongArchTargetLowering::LoongArchTargetLowering(const 
TargetMachine &TM,
  ISD::SETUGE, ISD::SETUGT},
 VT, Expand);
 }
+setOperationAction(ISD::CTPOP, GRLenVT, Legal);
   }
 
   // Set operations for 'LASX' feature.
@@ -4488,6 +4489,44 @@ emitPseudoXVINSGR2VR(MachineInstr &MI, MachineBasicBlock 
*BB,
   return BB;
 }
 
+static MachineBasicBlock *emitPseudoCTPOP(MachineInstr &MI,
+  MachineBasicBlock *BB,
+  const LoongArchSubtarget &Subtarget) 
{
+  assert(Subtarget.hasExtLSX());
+  const TargetInstrInfo *TII = Subtarget.getInstrInfo();
+  const TargetRegisterClass *RC = &LoongArch::LSX128RegClass;
+  DebugLoc DL = MI.getDebugLoc();
+  MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
+  Register Dst = MI.getOperand(0).getReg();
+  Register Src = MI.getOperand(1).getReg();
+  Register ScratchReg1 = MRI.createVirtualRegister(RC);
+  Register ScratchReg2 = MRI.createVirtualRegister(RC);
+  Register ScratchReg3 = MRI.createVirtualRegister(RC);
+
+  BuildMI(*BB, MI, DL, TII->get(LoongArch::VLDI), ScratchReg1).addImm(0);
+  BuildMI(*BB, MI, DL,
+  TII->get(Subtarget.is64Bit() ? LoongArch::VINSGR2VR_D
+   : LoongArch::VINSGR2VR_W),
+  ScratchReg2)
+  .addReg(ScratchReg1)
+  .addReg(Src)
+  .addImm(0);
+  BuildMI(
+  *BB, MI, DL,
+  TII->get(Subtarget.is64Bit() ? LoongArch::VPCNT_D : LoongArch::VPCNT_W),
+  ScratchReg3)
+  .addReg(ScratchReg2);
+  BuildMI(*BB, MI, DL,
+  TII->get(Subtarget.is64Bit() ? LoongArch::VPICKVE2GR_D
+   : LoongArch::VPICKVE2GR_W),
+  Dst)
+  .addReg(ScratchReg3)
+  .addImm(0);
+
+  MI.eraseFromParent();
+  return BB;
+}
+
 MachineBasicBlock *LoongArchTargetLowering::EmitInstrWithCustomInserter(
 MachineInstr &MI, MachineBasicBlock *BB) const {
   const TargetInstrInfo *TII = Subtarget.getInstrInfo();
@@ -4546,6 +4585,8 @@ MachineBasicBlock 
*LoongArchTargetLowering::EmitInstrWithCustomInserter(
   case LoongArch::PseudoXVINSGR2VR_B:
   case LoongArch::PseudoXVINSGR2VR_H:
 return emitPseudoXVINSGR2VR(MI, BB, Subtarget);
+  case LoongArch::PseudoCTPOP:
+return emitPseudoCTPOP(MI, BB, Subtarget);
   }
 }
 
diff --git a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td 
b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
index 659ba38c695d33..e7ac9f3bd04cbf 100644
--- a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
+++ b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
@@ -1238,6 +1238,10 @@ def PseudoVBZ_W : VecCond;
 def PseudoVBZ_D : VecCond;
 def PseudoVBZ : VecCond;
 
+let usesCustomInserter = 1 in
+def PseudoCTPOP : Pseudo<(outs GPR:$rd), (ins GPR:$rj),
+ [(set GPR:$rd, (ctpop GPR:$rj))]>;
+
 } // Predicates = [HasExtLSX]
 
 multiclass PatVr {
diff --git a/llvm/test/CodeGen/LoongArch/ctpop-with-lsx.ll 
b/llvm/test/CodeGen/LoongArch/ctpop-with-lsx.ll
index a5cffb29eec614..c01f3cdb405682 100644
--- a/llvm/test/CodeGen/LoongArch/ctpop-with-lsx.ll
+++ b/llvm/test/CodeGen/LoongArch/ctpop-with-lsx.ll
@@ -10,30 +10,20 @@ declare i64 @llvm.ctpop.i64(i64)
 define i8 @test_ctpop_i8(i8 %a) nounwind {
 ; LA32-LABEL: test_ctpop_i8:
 ; LA32:   # %bb.0:
-; LA32-NEXT:srli.w $a1, $a0, 1
-; LA32-NEXT:andi $a1, $a1, 85
-; LA32-NEXT:sub.w $a0, $a0, $a1
-; LA32-NEXT:andi $a1, $a0, 51
-; LA32-NEXT:srli.w $a0, $a0, 2
-; LA32-NEXT:andi $a0, $a0, 51
-; LA32-NEXT:add.w $a0, $a1, $a0
-; LA32-NEXT:srli.w $a1, $a0, 4
-; LA32-NEXT:add.w $a0, $a0, $a1
-; LA32-NEXT:andi $a0, $a0, 15
+; LA32-NEXT:andi $a0, $a0, 255
+; LA32-NEXT:vldi $vr0, 0
+; LA32-NEXT:vinsgr2vr.w $vr0, $a0, 0
+; LA32-NEXT:vpcnt.w $vr0, $vr0
+; LA32-NEXT:vpickve2gr.w $a0, $vr0, 0
 ; LA32-NEXT:ret
 ;
 ; LA64-LABEL: test_ctpop_i8:
 ; LA64:   # %bb.0:
-; LA64-NEXT:srli.d $a1, $a0, 1
-; LA64-NEXT:andi $a1, $a1, 85
-; LA64-NEXT:sub.d $a0, $a0, $a1
-; LA64-NEXT:andi $a1, $a0, 51
-; LA64-NEXT:srli.d $a0, $a0, 2
-; LA64-NEXT:andi $a0, $a0, 51
-; LA64-NEXT:add.d $a0, $a1, $a0
-; LA64-NEXT:srli.d $a1, $a0, 4
-; LA64-NEXT:ad

[llvm-branch-commits] [clang] 03cc174 - Revert "[clang] fix broken canonicalization of DeducedTemplateSpecializationType (#95202)"

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Corentin Jabot
Date: 2024-09-01T10:17:33+02:00
New Revision: 03cc174e0307ec90091c31c621bd6cee4338c4da

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

LOG: Revert "[clang] fix broken canonicalization of 
DeducedTemplateSpecializationType (#95202)"

This reverts commit 2e1ad93961a3f444659c5d02d800e3144acccdb4.

Reverting #95202 in the 19.x branch

Fixes #106182

The change in #95202 causes code to crash and there is
no good way to backport a fix for that as there are ABI-impacting
changes at play.
Instead we revert #95202 in the 19x branch, fixing the regression
and preserving the 18.x behavior (which is GCC's behavior)

https://github.com/llvm/llvm-project/pull/106335#discussion_r1735174841

Added: 


Modified: 
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/TemplateName.h
clang/include/clang/AST/Type.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/TemplateName.cpp
clang/unittests/AST/CMakeLists.txt

Removed: 
clang/unittests/AST/ProfilingTest.cpp



diff  --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 6d1c8ca8a2f961..16a19645d7f367 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1805,13 +1805,6 @@ class ASTContext : public RefCountedBase {
 QualType DeducedType,
 bool IsDependent) const;
 
-private:
-  QualType getDeducedTemplateSpecializationTypeInternal(TemplateName Template,
-QualType DeducedType,
-bool IsDependent,
-QualType Canon) const;
-
-public:
   /// Return the unique reference to the type for the specified TagDecl
   /// (struct/union/class/enum) decl.
   QualType getTagDeclType(const TagDecl *Decl) const;

diff  --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index e3b7dd261535d6..e7313dee012813 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -347,9 +347,7 @@ class TemplateName {
   /// error.
   void dump() const;
 
-  void Profile(llvm::FoldingSetNodeID &ID) {
-ID.AddPointer(Storage.getOpaqueValue());
-  }
+  void Profile(llvm::FoldingSetNodeID &ID);
 
   /// Retrieve the template name as a void pointer.
   void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }

diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 25defea58c2dc2..9a711030cff9ca 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -6421,27 +6421,30 @@ class DeducedTemplateSpecializationType : public 
DeducedType,
 
   DeducedTemplateSpecializationType(TemplateName Template,
 QualType DeducedAsType,
-bool IsDeducedAsDependent, QualType Canon)
+bool IsDeducedAsDependent)
   : DeducedType(DeducedTemplateSpecialization, DeducedAsType,
 toTypeDependence(Template.getDependence()) |
 (IsDeducedAsDependent
  ? TypeDependence::DependentInstantiation
  : TypeDependence::None),
-Canon),
+DeducedAsType.isNull() ? QualType(this, 0)
+   : DeducedAsType.getCanonicalType()),
 Template(Template) {}
 
 public:
   /// Retrieve the name of the template that we are deducing.
   TemplateName getTemplateName() const { return Template;}
 
-  void Profile(llvm::FoldingSetNodeID &ID) const {
+  void Profile(llvm::FoldingSetNodeID &ID) {
 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
   }
 
   static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template,
   QualType Deduced, bool IsDependent) {
 Template.Profile(ID);
-Deduced.Profile(ID);
+QualType CanonicalType =
+Deduced.isNull() ? Deduced : Deduced.getCanonicalType();
+ID.AddPointer(CanonicalType.getAsOpaquePtr());
 ID.AddBoolean(IsDependent || Template.isDependent());
   }
 

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 3da5e888f25175..1064507f34616a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -6269,9 +6269,11 @@ QualType ASTContext::getUnconstrainedType(QualType T) 
const {
   return T;
 }
 
-QualType ASTContext::getDeducedTemplateSpecializationTypeInternal(
-TemplateName Template, QualType DeducedType, bool IsDependent,
-QualType Canon) const {
+/// Return

[llvm-branch-commits] [llvm] release/19.x: [SLP]Fix PR104422: Wrong value truncation (PR #104747)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

ping

https://github.com/llvm/llvm-project/pull/104747
___
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] [libcxx] release/19.x: [libcxx] don't `#include ` if wide chars aren't enabled (#99911) (PR #106788)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106788

>From 6f623478d48c171d59e95b25ea2aca49dca8f135 Mon Sep 17 00:00:00 2001
From: Ties Stuij 
Date: Tue, 23 Jul 2024 14:09:34 +0100
Subject: [PATCH] [libcxx] don't `#include ` if wide chars aren't
 enabled (#99911)

Pull request #96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.

(cherry picked from commit ec56790c3b27df4fa1513594ca9a74fd8ad5bf7f)
---
 libcxx/include/format | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libcxx/include/format b/libcxx/include/format
index c3f2b45f0f7305..a88b3ef8528e2d 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -237,21 +237,21 @@ namespace std {
 #  include 
 #  include 
 #  include 
-#  include 
 #  include 
 #  include 
+#  include 
 #  include 
 #  include 
+#  include 
+#  include 
 #  include 
 #  include 
 #  include 
 #  include 
-#endif
 
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-#  include 
-#  include 
-#  include 
+#  if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
+#include 
+#  endif
 #endif
 
 #endif // _LIBCPP_FORMAT

___
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] release/19.x: [IndVars] Check if WideInc available before trying to use it (PR #106892)

2024-09-01 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/106892

Backport c9a5e1b665dbba898e9981fd7d48881947e6560e

Requested by: @nikic

>From cf74f4b3c57683edd22f2383f62f056eeeba98ca Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Wed, 28 Aug 2024 12:54:14 +0200
Subject: [PATCH] [IndVars] Check if WideInc available before trying to use it

WideInc/WideIncExpr can be null. Previously this worked out
because the comparison with WideIncExpr would fail. Now we have
accesses to WideInc prior to that. Avoid the issue with an
explicit check.

Fixes https://github.com/llvm/llvm-project/issues/106239.

(cherry picked from commit c9a5e1b665dbba898e9981fd7d48881947e6560e)
---
 llvm/lib/Transforms/Utils/SimplifyIndVar.cpp  | 28 +--
 .../Transforms/IndVarSimplify/pr106239.ll | 36 +++
 2 files changed, 53 insertions(+), 11 deletions(-)
 create mode 100644 llvm/test/Transforms/IndVarSimplify/pr106239.ll

diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp 
b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 5bda7c50c62c66..0b4a75e0bc52de 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1928,18 +1928,24 @@ Instruction 
*WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU,
 if (!WideAddRec.first)
   return nullptr;
 
-// Reuse the IV increment that SCEVExpander created. Recompute flags, 
unless
-// the flags for both increments agree and it is safe to use the ones from
-// the original inc. In that case, the new use of the wide increment won't
-// be more poisonous.
-bool NeedToRecomputeFlags =
-!SCEVExpander::canReuseFlagsFromOriginalIVInc(OrigPhi, WidePhi,
-  DU.NarrowUse, WideInc) ||
-DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() ||
-DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap();
+auto CanUseWideInc = [&]() {
+  if (!WideInc)
+return false;
+  // Reuse the IV increment that SCEVExpander created. Recompute flags,
+  // unless the flags for both increments agree and it is safe to use the
+  // ones from the original inc. In that case, the new use of the wide
+  // increment won't be more poisonous.
+  bool NeedToRecomputeFlags =
+  !SCEVExpander::canReuseFlagsFromOriginalIVInc(
+  OrigPhi, WidePhi, DU.NarrowUse, WideInc) ||
+  DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() ||
+  DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap();
+  return WideAddRec.first == WideIncExpr &&
+ Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags);
+};
+
 Instruction *WideUse = nullptr;
-if (WideAddRec.first == WideIncExpr &&
-Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags))
+if (CanUseWideInc())
   WideUse = WideInc;
 else {
   WideUse = cloneIVUser(DU, WideAddRec.first);
diff --git a/llvm/test/Transforms/IndVarSimplify/pr106239.ll 
b/llvm/test/Transforms/IndVarSimplify/pr106239.ll
new file mode 100644
index 00..8d5aa99539a5a7
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/pr106239.ll
@@ -0,0 +1,36 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 
UTC_ARGS: --version 5
+; RUN: opt -S -passes=indvars < %s | FileCheck %s
+
+target datalayout = "n8:16:32:64"
+
+; Make sure it does not crash.
+
+define i32 @m() {
+; CHECK-LABEL: define i32 @m() {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:br label %[[FOR_BODY_I6:.*]]
+; CHECK:   [[FOR_BODY_I6]]:
+; CHECK-NEXT:br i1 true, label %[[I_EXIT:.*]], label %[[IF_END_I:.*]]
+; CHECK:   [[IF_END_I]]:
+; CHECK-NEXT:store i64 0, ptr null, align 8
+; CHECK-NEXT:br label %[[FOR_BODY_I6]]
+; CHECK:   [[I_EXIT]]:
+; CHECK-NEXT:ret i32 0
+;
+entry:
+  %div.i4 = sdiv i32 1, 0
+  br label %for.body.i6
+
+for.body.i6:  ; preds = %if.end.i, %entry
+  %add57.i = phi i32 [ %add.i7, %if.end.i ], [ 0, %entry ]
+  br i1 true, label %i.exit, label %if.end.i
+
+if.end.i: ; preds = %for.body.i6
+  %add.i7 = add i32 %add57.i, %div.i4
+  %conv.i = zext i32 %add57.i to i64
+  store i64 %conv.i, ptr null, align 8
+  br label %for.body.i6
+
+i.exit:   ; preds = %for.body.i6
+  ret i32 0
+}

___
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] [lld] 40b0764 - [lld-macho] Fix crash: ObjC category merge + relative method lists (#104081)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: alx32
Date: 2024-09-01T10:04:06+02:00
New Revision: 40b076410194df3783b0c9cefa9f018fb190bdff

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

LOG: [lld-macho] Fix crash: ObjC category merge + relative method lists 
(#104081)

A crash was happening when both ObjC Category Merging and Relative
method lists were enabled.

ObjC Category Merging creates new data sections and adds them by calling
`addInputSection`. `addInputSection` uses the symbols within the added
section to determine which container to actually add the section to.

The issue is that ObjC Category merging is calling `addInputSection`
before actually adding the relevant symbols the the added section. This
causes `addInputSection` to add the `InputSection` to the wrong
container, eventually resulting in a crash.

To fix this, we ensure that ObjC Category Merging calls
`addInputSection` only after the symbols have been added to the
`InputSection`.

(cherry picked from commit 0df91893efc752a76c7bbe6b063d66c8a2fa0d55)

Added: 


Modified: 
lld/MachO/ObjC.cpp
lld/test/MachO/objc-category-merging-minimal.s

Removed: 




diff  --git a/lld/MachO/ObjC.cpp b/lld/MachO/ObjC.cpp
index 9c056f40aa943f..39d885188d34ac 100644
--- a/lld/MachO/ObjC.cpp
+++ b/lld/MachO/ObjC.cpp
@@ -873,7 +873,6 @@ Defined *ObjcCategoryMerger::emitAndLinkProtocolList(
   infoCategoryWriter.catPtrListInfo.align);
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
   listSec->live = true;
-  addInputSection(listSec);
 
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
 
@@ -889,6 +888,7 @@ Defined *ObjcCategoryMerger::emitAndLinkProtocolList(
 
   ptrListSym->used = true;
   parentSym->getObjectFile()->symbols.push_back(ptrListSym);
+  addInputSection(listSec);
 
   createSymbolReference(parentSym, ptrListSym, linkAtOffset,
 infoCategoryWriter.catBodyInfo.relocTemplate);
@@ -933,7 +933,6 @@ void ObjcCategoryMerger::emitAndLinkPointerList(
   infoCategoryWriter.catPtrListInfo.align);
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
   listSec->live = true;
-  addInputSection(listSec);
 
   listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection;
 
@@ -949,6 +948,7 @@ void ObjcCategoryMerger::emitAndLinkPointerList(
 
   ptrListSym->used = true;
   parentSym->getObjectFile()->symbols.push_back(ptrListSym);
+  addInputSection(listSec);
 
   createSymbolReference(parentSym, ptrListSym, linkAtOffset,
 infoCategoryWriter.catBodyInfo.relocTemplate);
@@ -974,7 +974,6 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string 
&forCategoryName,
bodyData, infoCategoryWriter.catListInfo.align);
   newCatList->parent = infoCategoryWriter.catListInfo.outputSection;
   newCatList->live = true;
-  addInputSection(newCatList);
 
   newCatList->parent = infoCategoryWriter.catListInfo.outputSection;
 
@@ -990,6 +989,7 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string 
&forCategoryName,
 
   catListSym->used = true;
   objFile->symbols.push_back(catListSym);
+  addInputSection(newCatList);
   return catListSym;
 }
 
@@ -1012,7 +1012,6 @@ Defined *ObjcCategoryMerger::emitCategoryBody(const 
std::string &name,
bodyData, infoCategoryWriter.catBodyInfo.align);
   newBodySec->parent = infoCategoryWriter.catBodyInfo.outputSection;
   newBodySec->live = true;
-  addInputSection(newBodySec);
 
   std::string symName =
   objc::symbol_names::category + baseClassName + "(" + name + ")";
@@ -1025,6 +1024,7 @@ Defined *ObjcCategoryMerger::emitCategoryBody(const 
std::string &name,
 
   catBodySym->used = true;
   objFile->symbols.push_back(catBodySym);
+  addInputSection(newBodySec);
 
   createSymbolReference(catBodySym, nameSym, catLayout.nameOffset,
 infoCategoryWriter.catBodyInfo.relocTemplate);
@@ -1245,7 +1245,6 @@ void 
ObjcCategoryMerger::generateCatListForNonErasedCategories(
   infoCategoryWriter.catListInfo.align);
   listSec->parent = infoCategoryWriter.catListInfo.outputSection;
   listSec->live = true;
-  addInputSection(listSec);
 
   std::string slotSymName = "<__objc_catlist slot for category ";
   slotSymName += nonErasedCatBody->getName();
@@ -1260,6 +1259,7 @@ void 
ObjcCategoryMerger::generateCatListForNonErasedCategories(
 
   catListSlotSym->used = true;
   objFile->symbols.push_back(catListSlotSym);
+  addInputSection(listSec);
 
   // Now link the category body into the newly created slot
   createSymbolReference(catListSlotSym, nonErasedCatBody, 0,

diff  --git a/lld/test/MachO/objc-category-merging-minimal.s 
b/lld/test/MachO/objc-category-merging-minimal.s
index 5274933

[llvm-branch-commits] [clang] release/19.x: [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (#89934) (PR #106166)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106166

>From 52ab956704050302926e8afe1c7dbda4578acb9d Mon Sep 17 00:00:00 2001
From: Younan Zhang 
Date: Tue, 27 Aug 2024 09:25:53 +0800
Subject: [PATCH] [Clang][Sema] Revisit the fix for the lambda within a type
 alias template decl (#89934)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In the last patch #82310, we used template depths to tell if such alias
decls contain lambdas, which is wrong because the lambda can also appear
as a part of the default argument, and that would make
`getTemplateInstantiationArgs` provide extra template arguments in
undesired contexts. This leads to issue #89853.

Moreover, our approach
for https://github.com/llvm/llvm-project/issues/82104 was sadly wrong.
We tried to teach `DeduceReturnType` to consider alias template
arguments; however, giving these arguments in the context where they
should have been substituted in a `TransformCallExpr` call is never
correct.

This patch addresses such problems by using a `RecursiveASTVisitor` to
check if the lambda is contained by an alias `Decl`, as well as
twiddling the lambda dependencies - we should also build a dependent
lambda expression if the surrounding alias template arguments were
dependent.

Fixes #89853
Fixes #102760
Fixes #105885

(cherry picked from commit b412ec5d3924c7570c2c96106f95a92403a4e09b)
---
 clang/lib/Sema/SemaTemplateInstantiate.cpp| 73 +-
 .../alias-template-with-lambdas.cpp   | 75 ++-
 2 files changed, 110 insertions(+), 38 deletions(-)

diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 8995d461362d70..a09e3be83c4544 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -20,6 +20,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprConcepts.h"
 #include "clang/AST/PrettyDeclStackTrace.h"
+#include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeVisitor.h"
@@ -87,12 +88,19 @@ struct Response {
 // than lambda classes.
 const FunctionDecl *
 getPrimaryTemplateOfGenericLambda(const FunctionDecl *LambdaCallOperator) {
+  if (!isLambdaCallOperator(LambdaCallOperator))
+return LambdaCallOperator;
   while (true) {
 if (auto *FTD = dyn_cast_if_present(
 LambdaCallOperator->getDescribedTemplate());
 FTD && FTD->getInstantiatedFromMemberTemplate()) {
   LambdaCallOperator =
   FTD->getInstantiatedFromMemberTemplate()->getTemplatedDecl();
+} else if (LambdaCallOperator->getPrimaryTemplate()) {
+  // Cases where the lambda operator is instantiated in
+  // TemplateDeclInstantiator::VisitCXXMethodDecl.
+  LambdaCallOperator =
+  LambdaCallOperator->getPrimaryTemplate()->getTemplatedDecl();
 } else if (auto *Prev = cast(LambdaCallOperator)
 ->getInstantiatedFromMemberFunction())
   LambdaCallOperator = Prev;
@@ -138,22 +146,28 @@ getEnclosingTypeAliasTemplateDecl(Sema &SemaRef) {
 // Check if we are currently inside of a lambda expression that is
 // surrounded by a using alias declaration. e.g.
 //   template  using type = decltype([](auto) { ^ }());
-// By checking if:
-//  1. The lambda expression and the using alias declaration share the
-//  same declaration context.
-//  2. They have the same template depth.
 // We have to do so since a TypeAliasTemplateDecl (or a TypeAliasDecl) is never
 // a DeclContext, nor does it have an associated specialization Decl from which
 // we could collect these template arguments.
 bool isLambdaEnclosedByTypeAliasDecl(
-const FunctionDecl *PrimaryLambdaCallOperator,
+const FunctionDecl *LambdaCallOperator,
 const TypeAliasTemplateDecl *PrimaryTypeAliasDecl) {
-  return cast(PrimaryLambdaCallOperator->getDeclContext())
- ->getTemplateDepth() ==
- PrimaryTypeAliasDecl->getTemplateDepth() &&
- getLambdaAwareParentOfDeclContext(
- const_cast(PrimaryLambdaCallOperator)) ==
- PrimaryTypeAliasDecl->getDeclContext();
+  struct Visitor : RecursiveASTVisitor {
+Visitor(const FunctionDecl *CallOperator) : CallOperator(CallOperator) {}
+bool VisitLambdaExpr(const LambdaExpr *LE) {
+  // Return true to bail out of the traversal, implying the Decl contains
+  // the lambda.
+  return getPrimaryTemplateOfGenericLambda(LE->getCallOperator()) !=
+ CallOperator;
+}
+const FunctionDecl *CallOperator;
+  };
+
+  QualType Underlying =
+  PrimaryTypeAliasDecl->getTemplatedDecl()->getUnderlyingType();
+
+  return !Visitor(getPrimaryTemplateOfGenericLambda(LambdaCallOperator))
+  .TraverseType(Underlying);
 }
 
 // Add template arguments from a variable template instantiation.
@@ -290,23 +304,8 @@ Response HandleFunction(Sema &Sem

[llvm-branch-commits] [clang] release/19.x: [clang-format] Fix a misannotation of redundant r_paren as CastRParen (#105921) (PR #105967)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@owenca (or anyone else). If you would like to add a note about this fix in the 
release notes (completely optional). Please reply to this comment with a one or 
two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/105967
___
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] release/19.x: [MIPS] Optimize sortRelocs for o32 (PR #106008)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

@MaskRay @topperc maybe? what do you think about merging this?

https://github.com/llvm/llvm-project/pull/106008
___
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] release/19.x: [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (#99064) (PR #106823)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106823
___
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] release/19.x: [C++20] [Modules] Don't insert class not in named modules to PendingEmittingVTables (#106501) (PR #106504)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106504
___
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] 456006b - [clang][AArch64] Add SME2.1 feature macros (#105657)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: SpencerAbson
Date: 2024-09-01T10:10:15+02:00
New Revision: 456006bc91c3d972f3c549b6296cad5e83630c7d

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

LOG: [clang][AArch64] Add SME2.1 feature macros (#105657)

(cherry picked from commit 2617023923175b0fd2a8cb94ad677c061c01627f)

Added: 


Modified: 
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Basic/Targets/AArch64.h
clang/test/Preprocessor/aarch64-target-features.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index 6ba31cc05a0d75..63fc15f916c558 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -471,23 +471,25 @@ void AArch64TargetInfo::getTargetDefines(const 
LangOptions &Opts,
   if (HasSVE2 && HasSVE2SM4)
 Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1");
 
+  if (HasSVEB16B16)
+Builder.defineMacro("__ARM_FEATURE_SVE_B16B16", "1");
+
   if (HasSME) {
 Builder.defineMacro("__ARM_FEATURE_SME");
 Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
   }
 
-  if (HasSME2) {
-Builder.defineMacro("__ARM_FEATURE_SME", "1");
+  if (HasSME2)
 Builder.defineMacro("__ARM_FEATURE_SME2", "1");
-Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
-  }
 
-  if (HasSME2p1) {
-Builder.defineMacro("__ARM_FEATURE_SME", "1");
-Builder.defineMacro("__ARM_FEATURE_SME2", "1");
+  if (HasSME2p1)
 Builder.defineMacro("__ARM_FEATURE_SME2p1", "1");
-Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1");
-  }
+
+  if (HasSMEF16F16)
+Builder.defineMacro("__ARM_FEATURE_SME_F16F16", "1");
+
+  if (HasSMEB16B16)
+Builder.defineMacro("__ARM_FEATURE_SME_B16B16", "1");
 
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
@@ -749,6 +751,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sve", FPU & SveMode)
   .Case("sve-bf16", FPU & SveMode && HasBFloat16)
   .Case("sve-i8mm", FPU & SveMode && HasMatMul)
+  .Case("sve-b16b16", HasSVEB16B16)
   .Case("f32mm", FPU & SveMode && HasMatmulFP32)
   .Case("f64mm", FPU & SveMode && HasMatmulFP64)
   .Case("sve2", FPU & SveMode && HasSVE2)
@@ -763,6 +766,8 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("sme-f64f64", HasSMEF64F64)
   .Case("sme-i16i64", HasSMEI16I64)
   .Case("sme-fa64", HasSMEFA64)
+  .Case("sme-f16f16", HasSMEF16F16)
+  .Case("sme-b16b16", HasSMEB16B16)
   .Cases("memtag", "memtag2", HasMTE)
   .Case("sb", HasSB)
   .Case("predres", HasPredRes)
@@ -863,6 +868,8 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasSVE2 = true;
   HasSVE2SM4 = true;
 }
+if (Feature == "+sve-b16b16")
+  HasSVEB16B16 = true;
 if (Feature == "+sve2-bitperm") {
   FPU |= NeonMode;
   FPU |= SveMode;
@@ -919,6 +926,21 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasSVE2 = true;
   HasSMEFA64 = true;
 }
+if (Feature == "+sme-f16f16") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+  HasSMEF16F16 = true;
+}
+if (Feature == "+sme-b16b16") {
+  HasSME = true;
+  HasSME2 = true;
+  HasBFloat16 = true;
+  HasFullFP16 = true;
+  HasSVEB16B16 = true;
+  HasSMEB16B16 = true;
+}
 if (Feature == "+sb")
   HasSB = true;
 if (Feature == "+predres")

diff  --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index 7bdf5a2b4106e4..526f7f30a38618 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -53,6 +53,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasSVE2AES = false;
   bool HasSVE2SHA3 = false;
   bool HasSVE2SM4 = false;
+  bool HasSVEB16B16 = false;
   bool HasSVE2BitPerm = false;
   bool HasMatmulFP64 = false;
   bool HasMatmulFP32 = false;
@@ -71,6 +72,8 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasSME2 = false;
   bool HasSMEF64F64 = false;
   bool HasSMEI16I64 = false;
+  bool HasSMEF16F16 = false;
+  bool HasSMEB16B16 = false;
   bool HasSME2p1 = false;
   bool HasSB = false;
   bool HasPredRes = false;

diff  --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index 87bd3e142d2c40..ae2bdda6f536c5 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -709,3 +709,19 @@
 // CHECK-SME2p1: __ARM_FEATURE_SME 1
 // CHECK-SME2p1: __ARM_FEATURE_SME2 1
 // CHECK-SME2p1: __ARM_FEATURE_SME2p1 1
+
+// RUN: %clang --target=aarch64 -march=armv9-a+s

[llvm-branch-commits] [clang] release/19.x: [clang] Install scan-build-py into plain "lib" directory (#106612) (PR #106853)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106853
___
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] 816fde1 - [clang] Install scan-build-py into plain "lib" directory (#106612)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Michał Górny
Date: 2024-09-01T09:52:01+02:00
New Revision: 816fde1cbb700ebcc8b3df81fb93d675c04c12cd

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

LOG: [clang] Install scan-build-py into plain "lib" directory (#106612)

Install scan-build-py modules into the plain `lib` directory,
without LLVM_LIBDIR_SUFFIX appended, to match the path expected
by `intercept-build` executable.  This fixes the program being unable
to find its modules.  Using unsuffixed path makes sense here, since
Python modules are not subject to multilib.

This change effectively reverts 1334e129a39cb427e7b855e9a711a3e7604e50e5.
The commit in question changed the path without a clear justification
("does not respect the given prefix") and the Python code was never
modified to actually work with the change.

Fixes #106608

(cherry picked from commit 0c4cf79defe30d43279bf4526cdf32b6c7f8a197)

Added: 


Modified: 
clang/tools/scan-build-py/CMakeLists.txt

Removed: 




diff  --git a/clang/tools/scan-build-py/CMakeLists.txt 
b/clang/tools/scan-build-py/CMakeLists.txt
index 3aca22c0b0a8d3..9273eb5ed977e4 100644
--- a/clang/tools/scan-build-py/CMakeLists.txt
+++ b/clang/tools/scan-build-py/CMakeLists.txt
@@ -88,7 +88,7 @@ foreach(lib ${LibScanbuild})
  DEPENDS 
${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib})
   list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib})
   install(FILES lib/libscanbuild/${lib}
-  DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libscanbuild
+  DESTINATION lib/libscanbuild
   COMPONENT scan-build-py)
 endforeach()
 
@@ -106,7 +106,7 @@ foreach(resource ${LibScanbuildResources})
  DEPENDS 
${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource})
   list(APPEND Depends 
${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource})
   install(FILES lib/libscanbuild/resources/${resource}
-  DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libscanbuild/resources
+  DESTINATION lib/libscanbuild/resources
   COMPONENT scan-build-py)
 endforeach()
 
@@ -122,7 +122,7 @@ foreach(lib ${LibEar})
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib})
   list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib})
   install(FILES lib/libear/${lib}
-  DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libear
+  DESTINATION lib/libear
   COMPONENT scan-build-py)
 endforeach()
 



___
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] release/19.x: Revert "[clang] fix broken canonicalization of DeducedTemplateSpeciatizationType (#95202)" (PR #106516)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@cor3ntin (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106516
___
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] [clang-format] Revert "[clang-format][NFC] Delete TT_LambdaArrow (#70… (PR #106482)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

This was manually merged as bac3db3c8b41c921d8ec895a9dc89ce310a670cb

In the future please make sure that when you open manual PR's that you allow 
the maintainers to update the branch, otherwise I can't automatically merge it.

https://github.com/llvm/llvm-project/pull/106482
___
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] e81188d - [llvm][CodeGen] Added missing initialization failure information for window scheduler (#99449)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Kai Yan
Date: 2024-09-01T10:00:16+02:00
New Revision: e81188d58202ee7b887e48bc3e4b102fc5f45619

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

LOG: [llvm][CodeGen] Added missing initialization failure information for 
window scheduler (#99449)

Added missing initialization failure information for window scheduler.

Added: 


Modified: 
llvm/lib/CodeGen/WindowScheduler.cpp
llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir

Removed: 




diff  --git a/llvm/lib/CodeGen/WindowScheduler.cpp 
b/llvm/lib/CodeGen/WindowScheduler.cpp
index 0777480499e55b..3fe8a1aaafd128 100644
--- a/llvm/lib/CodeGen/WindowScheduler.cpp
+++ b/llvm/lib/CodeGen/WindowScheduler.cpp
@@ -232,8 +232,11 @@ bool WindowScheduler::initialize() {
   return false;
 }
 for (auto &Def : MI.all_defs())
-  if (Def.isReg() && Def.getReg().isPhysical())
+  if (Def.isReg() && Def.getReg().isPhysical()) {
+LLVM_DEBUG(dbgs() << "Physical registers are not supported in "
+ "window scheduling!\n");
 return false;
+  }
   }
   if (SchedInstrNum <= WindowRegionLimit) {
 LLVM_DEBUG(dbgs() << "There are too few MIs in the window region!\n");

diff  --git a/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir 
b/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir
index 601b98dca8e20b..be75301b016ed9 100644
--- a/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir
+++ b/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir
@@ -3,6 +3,7 @@
 # RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \
 # RUN: | FileCheck %s
 
+# CHECK: Physical registers are not supported in window scheduling!
 # CHECK: The WindowScheduler failed to initialize!
 
 ---



___
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] Add release note about ABI implementation changes for _BitInt on Arm (PR #105659)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/105659
___
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] release/19.x: [clang-format] Fix a misannotation of less/greater as angle brackets (#105941) (PR #105971)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/105971
___
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] [clang-format] Revert "[clang-format][NFC] Delete TT_LambdaArrow (#70… (PR #106482)

2024-09-01 Thread Owen Pan via llvm-branch-commits

owenca wrote:

Will do. Sorry about that!

https://github.com/llvm/llvm-project/pull/106482
___
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] [libcxx] 6883c49 - [libc++] Add missing include to three_way_comp_ref_type.h

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Louis Dionne
Date: 2024-09-01T10:11:08+02:00
New Revision: 6883c490e04a0f681b95e32eaa74aa82458bdb28

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

LOG: [libc++] Add missing include to three_way_comp_ref_type.h

We were using a `_LIBCPP_ASSERT_FOO` macro without including `<__assert>`.

rdar://134425695
(cherry picked from commit 0df78123fdaed39d5135c2e4f4628f515e6d549d)

Added: 


Modified: 
libcxx/include/__algorithm/three_way_comp_ref_type.h

Removed: 




diff  --git a/libcxx/include/__algorithm/three_way_comp_ref_type.h 
b/libcxx/include/__algorithm/three_way_comp_ref_type.h
index 70c5818976f075..5702a1fee08262 100644
--- a/libcxx/include/__algorithm/three_way_comp_ref_type.h
+++ b/libcxx/include/__algorithm/three_way_comp_ref_type.h
@@ -9,6 +9,7 @@
 #ifndef _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H
 #define _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H
 
+#include <__assert>
 #include <__compare/ordering.h>
 #include <__config>
 #include <__utility/declval.h>



___
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] release/19.x: [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (#99064) (PR #106823)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@tchaikov (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106823
___
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] Backport taint analysis slowdown regression fix (PR #105516)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/105516
___
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] d9806ff - [clang-format] Fix a misannotation of less/greater as angle brackets (#105941)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Owen Pan
Date: 2024-09-01T10:07:54+02:00
New Revision: d9806ffe4e4d26de9c01f6b8ac0deae169b1d88d

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

LOG: [clang-format] Fix a misannotation of less/greater as angle brackets 
(#105941)

Fixes #105877.

(cherry picked from commit 0916ae49b89db6eb9eee9f6fee4f1a65fd9cdb74)

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 3b1ddf99888ca8..2f6ffb2e508650 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -249,7 +249,7 @@ class AnnotatingParser {
 if (Precedence > prec::Conditional && Precedence < prec::Relational)
   return false;
   }
-  if (Prev.is(TT_ConditionalExpr))
+  if (Prev.isOneOf(tok::question, tok::colon) && !Style.isProto())
 SeenTernaryOperator = true;
   updateParameterCount(Left, CurrentToken);
   if (Style.Language == FormatStyle::LK_Proto) {

diff  --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 1f15c00573bade..51afe1bf2ff9be 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -614,6 +614,11 @@ TEST_F(TokenAnnotatorTest, 
UnderstandsNonTemplateAngleBrackets) {
   EXPECT_TOKEN(Tokens[2], tok::less, TT_BinaryOperator);
   EXPECT_TOKEN(Tokens[8], tok::greater, TT_BinaryOperator);
 
+  Tokens = annotate("return checklower ? a < b : a > b;");
+  ASSERT_EQ(Tokens.size(), 12u) << Tokens;
+  EXPECT_TOKEN(Tokens[4], tok::less, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[8], tok::greater, TT_BinaryOperator);
+
   Tokens = annotate("return A < B ^ A > B;");
   ASSERT_EQ(Tokens.size(), 10u) << Tokens;
   EXPECT_TOKEN(Tokens[2], tok::less, TT_BinaryOperator);



___
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] [compiler-rt] release/19.x: [compiler-rt] Fix definition of `usize` on 32-bit Windows (PR #106303)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106303
___
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] release/19.x: [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (#89934) (PR #106166)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@zyn0217 (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/106166
___
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] [libcxx] release/19.x: [libc++] Add missing include to three_way_comp_ref_type.h (PR #106265)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106265
___
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] [compiler-rt] release/19.x: [builtins] Fix missing main() function in float16/bfloat16 support checks (#104478) (PR #106843)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru updated https://github.com/llvm/llvm-project/pull/106843

>From 6d7e428df611861fb1f5151dea938ebfcc7b1363 Mon Sep 17 00:00:00 2001
From: OverMighty 
Date: Fri, 30 Aug 2024 12:59:05 +0200
Subject: [PATCH] [builtins] Fix missing main() function in float16/bfloat16
 support checks (#104478)

The CMake docs state that `check_c_source_compiles()` checks whether the
supplied code "can be compiled as a C source file and linked as an
executable (so it must contain at least a `main()` function)."

https://cmake.org/cmake/help/v3.30/module/CheckCSourceCompiles.html

In practice, this command is a wrapper around `try_compile()`:

- 
https://gitlab.kitware.com/cmake/cmake/blob/2904ce00d2ed6ad5dac6d3459af62d8223e06ce0/Modules/CheckCSourceCompiles.cmake#L54
- 
https://gitlab.kitware.com/cmake/cmake/blob/2904ce00d2ed6ad5dac6d3459af62d8223e06ce0/Modules/Internal/CheckSourceCompiles.cmake#L101

When `CMAKE_SOURCE_DIR` is compiler-rt/lib/builtins/,
`CMAKE_TRY_COMPILE_TARGET_TYPE` is set to `STATIC_LIBRARY`, so the
checks for `float16` and `bfloat16` support work as intended in a
Clang + compiler-rt runtime build for example, as it runs CMake
recursively from that directory.

However, when using llvm/ or compiler-rt/ as CMake source directory, as
`CMAKE_TRY_COMPILE_TARGET_TYPE` defaults to `EXECUTABLE`, these checks
will indeed fail if the code doesn't have a `main()` function. This
results in LLVM using x86 SIMD registers when generating calls to
builtins that, with Arch Linux's compiler-rt package for example,
actually use a GPR for their argument or return value as they use
`uint16_t` instead of `_Float16`.

This had been caught in post-commit review:
https://reviews.llvm.org/D145237#4521152. Use of the internal
`CMAKE_C_COMPILER_WORKS` variable is not what hides the issue, however.

PR #69842 tried to fix this by unconditionally setting
`CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC_LIBRARY`, but it apparently
caused other issues, so it was reverted. This PR just adds a `main()`
function in the checks, as per the CMake docs.

(cherry picked from commit 68d8b3846ab1e6550910f2a9a685690eee558af2)
---
 compiler-rt/lib/builtins/CMakeLists.txt | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt 
b/compiler-rt/lib/builtins/CMakeLists.txt
index abea8c498f7bdc..e0b2d08c207754 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -867,10 +867,12 @@ else ()
   endif()
 endif()
   endif()
-  check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }"
+  check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }
+   int main(void) { return 0; }"
   COMPILER_RT_HAS_${arch}_FLOAT16)
   append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 
BUILTIN_CFLAGS_${arch})
-  check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }"
+  check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }
+   int main(void) { return 0; }"
   COMPILER_RT_HAS_${arch}_BFLOAT16)
   # Build BF16 files only when "__bf16" is available.
   if(COMPILER_RT_HAS_${arch}_BFLOAT16)

___
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] f88180b - [clang-format] js handle anonymous classes (#106242)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Krasimir Georgiev
Date: 2024-09-01T10:12:36+02:00
New Revision: f88180bbc489a587954adfce40cc5c90adc74962

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

LOG: [clang-format] js handle anonymous classes (#106242)

Addresses a regression in JavaScript when formatting anonymous classes.

-

Co-authored-by: Owen Pan 
(cherry picked from commit 77d63cfd18aa6643544cf7acd5ee287689d54cca)

Added: 


Modified: 
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTestJS.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 688c7c5b1e977f..5e56a6944a8160 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -3978,6 +3978,9 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
   auto IsNonMacroIdentifier = [](const FormatToken *Tok) {
 return Tok->is(tok::identifier) && Tok->TokenText != 
Tok->TokenText.upper();
   };
+  // JavaScript/TypeScript supports anonymous classes like:
+  // a = class extends foo { }
+  bool JSPastExtendsOrImplements = false;
   // The actual identifier can be a nested name specifier, and in macros
   // it is often token-pasted.
   // An [[attribute]] can be before the identifier.
@@ -3988,6 +3991,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
   FormatTok->isOneOf(tok::period, tok::comma))) {
 if (Style.isJavaScript() &&
 FormatTok->isOneOf(Keywords.kw_extends, Keywords.kw_implements)) {
+  JSPastExtendsOrImplements = true;
   // JavaScript/TypeScript supports inline object types in
   // extends/implements positions:
   // class Foo implements {bar: number} { }
@@ -4013,8 +4017,8 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
 case tok::coloncolon:
   break;
 default:
-  if (!ClassName && Previous->is(tok::identifier) &&
-  Previous->isNot(TT_AttributeMacro)) {
+  if (!JSPastExtendsOrImplements && !ClassName &&
+  Previous->is(tok::identifier) && Previous->isNot(TT_AttributeMacro)) 
{
 ClassName = Previous;
   }
 }

diff  --git a/clang/unittests/Format/FormatTestJS.cpp 
b/clang/unittests/Format/FormatTestJS.cpp
index b910ce620de7a9..4b29ba720f6823 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -579,6 +579,14 @@ TEST_F(FormatTestJS, GoogScopes) {
"});");
 }
 
+TEST_F(FormatTestJS, GoogAnonymousClass) {
+  verifyFormat("a = class extends goog.structs.a {\n"
+   "  a() {\n"
+   "return 0;\n"
+   "  }\n"
+   "};");
+}
+
 TEST_F(FormatTestJS, IIFEs) {
   // Internal calling parens; no semi.
   verifyFormat("(function() {\n"

diff  --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 51afe1bf2ff9be..fbc7186cac1b84 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -3200,6 +3200,12 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   EXPECT_BRACE_KIND(Tokens[8], BK_BracedInit);
   EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
   EXPECT_BRACE_KIND(Tokens[13], BK_Block);
+
+  Tokens = annotate("a = class extends goog.a {};",
+getGoogleStyle(FormatStyle::LK_JavaScript));
+  ASSERT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_ClassLBrace);
+  EXPECT_BRACE_KIND(Tokens[7], BK_Block);
 }
 
 TEST_F(TokenAnnotatorTest, UnderstandsElaboratedTypeSpecifier) {



___
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] c8c66e0 - [C++20] [Modules] Don't insert class not in named modules to PendingEmittingVTables (#106501)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

Author: Chuanqi Xu
Date: 2024-09-01T10:16:58+02:00
New Revision: c8c66e01d83323a3db57fade24befb26b0e6fe84

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

LOG: [C++20] [Modules] Don't insert class not in named modules to 
PendingEmittingVTables (#106501)

Close https://github.com/llvm/llvm-project/issues/102933

The root cause of the issue is an oversight in
https://github.com/llvm/llvm-project/pull/102287 that I didn't notice
that PendingEmittingVTables should only accept classes in named modules.

(cherry picked from commit 47615ff2347a8be429404285de3b1c03b411e7af)

Added: 
clang/test/Modules/pr106483.cppm

Modified: 
clang/include/clang/Serialization/ASTWriter.h
clang/lib/Serialization/ASTWriter.cpp

Removed: 




diff  --git a/clang/include/clang/Serialization/ASTWriter.h 
b/clang/include/clang/Serialization/ASTWriter.h
index 71a7c28047e318..700f0ad001116b 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -500,8 +500,8 @@ class ASTWriter : public ASTDeserializationListener,
   std::vector NonAffectingRanges;
   std::vector NonAffectingOffsetAdjustments;
 
-  /// A list of classes which need to emit the VTable in the corresponding
-  /// object file.
+  /// A list of classes in named modules which need to emit the VTable in
+  /// the corresponding object file.
   llvm::SmallVector PendingEmittingVTables;
 
   /// Computes input files that didn't affect compilation of the current 
module,

diff  --git a/clang/lib/Serialization/ASTWriter.cpp 
b/clang/lib/Serialization/ASTWriter.cpp
index 7c0636962459e9..cb63dec92e331d 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -3963,6 +3963,9 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP,
 }
 
 void ASTWriter::handleVTable(CXXRecordDecl *RD) {
+  if (!RD->isInNamedModule())
+return;
+
   PendingEmittingVTables.push_back(RD);
 }
 

diff  --git a/clang/test/Modules/pr106483.cppm 
b/clang/test/Modules/pr106483.cppm
new file mode 100644
index 00..a19316b9dd50cc
--- /dev/null
+++ b/clang/test/Modules/pr106483.cppm
@@ -0,0 +1,41 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-module-interface -o %t/a.pcm
+// RUN: %clang_cc1 -std=c++23 %t/b.cppm -emit-module-interface -o %t/b.pcm \
+// RUN:   -fprebuilt-module-path=%t
+// RUN: %clang_cc1 -std=c++23 -fprebuilt-module-path=%t %t/b.pcm -emit-llvm \
+// RUN: -disable-llvm-passes -o - | FileCheck %t/b.cppm
+
+//--- a.cppm
+module;
+
+struct base {
+virtual void f() const;
+};
+
+inline void base::f() const {
+}
+
+export module a;
+export using ::base;
+
+//--- b.cppm
+module;
+
+struct base {
+virtual void f() const;
+};
+
+inline void base::f() const {
+}
+
+export module b;
+import a;
+export using ::base;
+
+export extern "C" void func() {}
+
+// We only need to check that the IR are successfully emitted instead of crash.
+// CHECK: func



___
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] [libcxx] release/19.x: [libcxx] don't `#include ` if wide chars aren't enabled (#99911) (PR #106788)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106788
___
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] release/19.x: [clang-format] Correctly annotate braces in ObjC square brackets (#106654) (PR #106819)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru closed https://github.com/llvm/llvm-project/pull/106819
___
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] [libunwind] release/19.x: [libunwind] Stop installing the mach-o module map (#105616) (PR #105896)

2024-09-01 Thread via llvm-branch-commits

github-actions[bot] wrote:

@ian-twilightcoder (or anyone else). If you would like to add a note about this 
fix in the release notes (completely optional). Please reply to this comment 
with a one or two sentence description of the fix.  When you are done, please 
add the release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/105896
___
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] [compiler-rt] release/19.x: [compiler-rt] Support building runtimes for Windows on arm32 (#101462) (PR #106518)

2024-09-01 Thread Tobias Hieta via llvm-branch-commits

tru wrote:

ping @vitalybuka 

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


  1   2   >