[llvm-branch-commits] [llvm] release/18.x: [DAGCombiner] In mergeTruncStore, make sure we aren't storing shifted in bits. (#90939) (PR #91038)

2024-05-22 Thread via llvm-branch-commits

https://github.com/AtariDreams updated 
https://github.com/llvm/llvm-project/pull/91038

>From 094e4fbb65a5f24474cbe556f895ee784f6bdffb Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Fri, 3 May 2024 09:59:33 -0700
Subject: [PATCH] [DAGCombiner] In mergeTruncStore, make sure we aren't storing
 shifted in bits. (#90939)

When looking through a right shift, we need to make sure that all of
the bits we are using from the shift come from the shift input and
not the sign or zero bits that are shifted in.

Fixes #90936.

(cherry picked from commit 3563af6c06ebc92bcaacef0e33285148ef0f75bd)
---
 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp |  4 
 llvm/test/CodeGen/AArch64/pr90936.ll  | 20 +++
 2 files changed, 24 insertions(+)
 create mode 100644 llvm/test/CodeGen/AArch64/pr90936.ll

diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 5038f8a1fc156..4951e45edb9ed 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8952,6 +8952,10 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
   if (ShiftAmtC % NarrowNumBits != 0)
 return SDValue();
 
+  // Make sure we aren't reading bits that are shifted in.
+  if (ShiftAmtC > WideVal.getScalarValueSizeInBits() - NarrowNumBits)
+return SDValue();
+
   Offset = ShiftAmtC / NarrowNumBits;
   WideVal = WideVal.getOperand(0);
 }
diff --git a/llvm/test/CodeGen/AArch64/pr90936.ll 
b/llvm/test/CodeGen/AArch64/pr90936.ll
new file mode 100644
index 0..38cda8d388945
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/pr90936.ll
@@ -0,0 +1,20 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=aarch64 | FileCheck %s
+
+define void @f(i16 %arg, ptr %arg1) {
+; CHECK-LABEL: f:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ubfx w8, w0, #8, #6
+; CHECK-NEXT:strb w0, [x1]
+; CHECK-NEXT:strb w8, [x1, #1]
+; CHECK-NEXT:ret
+bb:
+  %i = trunc i16 %arg to i8
+  %i2 = trunc i16 %arg to i14
+  %i3 = lshr i14 %i2, 8
+  store i8 %i, ptr %arg1, align 1
+  %i4 = getelementptr i8, ptr %arg1, i64 1
+  %i5 = trunc i14 %i3 to i8
+  store i8 %i5, ptr %i4, align 1
+  ret void
+}

___
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] [BOLT][NFC] Simplify analyzeIndirectBranch (PR #91662)

2024-05-22 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/91662
___
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] [BOLT] Eliminate dead jump tables (PR #91666)

2024-05-22 Thread Amir Ayupov via llvm-branch-commits

aaupov wrote:

> Looks like this is dangerous and crashes binaries in our tests? Do you still 
> want to move forward with this stack? Or are you working on it? If this stack 
> is work in progress, maybe mark it as "changes planned" or the equivalent in 
> github.

Yes, we'll need to discuss how to move forward with it, as it's unsafe as is. 
Marking as draft for now.

https://github.com/llvm/llvm-project/pull/91666
___
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] [BOLT] Eliminate dead jump tables (PR #91666)

2024-05-22 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov converted_to_draft 
https://github.com/llvm/llvm-project/pull/91666
___
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] [BOLT] Eliminate dead jump tables (PR #91666)

2024-05-22 Thread Rafael Auler via llvm-branch-commits

https://github.com/rafaelauler requested changes to this pull request.

Looks like this is dangerous and crashes binaries in our tests? Do you still 
want to move forward with this stack? Or are you working on it? If this stack 
is work in progress, maybe mark it as "changes planned" or the equivalent in 
github.

https://github.com/llvm/llvm-project/pull/91666
___
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] [BOLT][NFCI] Fix return type of BC::getSignedValueAtAddress (PR #91664)

2024-05-22 Thread Rafael Auler via llvm-branch-commits

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

LG

https://github.com/llvm/llvm-project/pull/91664
___
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] [lldb] daa63e1 - Revert "[lldb] Added Debuginfod tests and fixed a couple issues (#92572)"

2024-05-22 Thread via llvm-branch-commits

Author: Daniel Thornburgh
Date: 2024-05-22T13:54:32-07:00
New Revision: daa63e1870999e8ca8db454a788a0720740d194a

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

LOG: Revert "[lldb] Added Debuginfod tests and fixed a couple issues (#92572)"

This reverts commit e558d21e87882d40e29d858b1269ee8f1ddf2a38.

Added: 


Modified: 
lldb/include/lldb/Host/Config.h.cmake
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/source/API/SBDebugger.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolLocator/CMakeLists.txt
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp

Removed: 
lldb/test/API/debuginfod/Normal/Makefile
lldb/test/API/debuginfod/Normal/TestDebuginfod.py
lldb/test/API/debuginfod/Normal/main.c
lldb/test/API/debuginfod/SplitDWARF/Makefile
lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py
lldb/test/API/debuginfod/SplitDWARF/main.c



diff  --git a/lldb/include/lldb/Host/Config.h.cmake 
b/lldb/include/lldb/Host/Config.h.cmake
index 9e538534086a2..3defa454f6d42 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -33,8 +33,6 @@
 
 #cmakedefine01 LLDB_ENABLE_LZMA
 
-#cmakedefine01 LLVM_ENABLE_CURL
-
 #cmakedefine01 LLDB_ENABLE_CURSES
 
 #cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H

diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index b4ac3bdabac86..79cc0a2aeacbe 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -1055,10 +1055,6 @@ def _get_bool_config_skip_if_decorator(key):
 return unittest.skipIf(not have, "requires " + key)
 
 
-def skipIfCurlSupportMissing(func):
-return _get_bool_config_skip_if_decorator("curl")(func)
-
-
 def skipIfCursesSupportMissing(func):
 return _get_bool_config_skip_if_decorator("curses")(func)
 

diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 2cbc918ebbaeb..bd8eea3d6f5a0 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 #
 # GNUWin32 uname gives "windows32" or "server version windows32" while
 # some versions of MSYS uname return "MSYS_NT*", but most environments
-# standardize on "Windows_NT", so we'll make it consistent here.
+# standardize on "Windows_NT", so we'll make it consistent here. 
 # When running tests from Visual Studio, the environment variable isn't
 # inherited all the way down to the process spawned for make.
 #--
@@ -210,12 +210,6 @@ else
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
DSYM = $(EXE).debug
endif
-
-   ifeq "$(MAKE_DWP)" "YES"
-   MAKE_DWO := YES
-   DWP_NAME = $(EXE).dwp
-   DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
-   endif
 endif
 
 LIMIT_DEBUG_INFO_FLAGS =
@@ -364,7 +358,6 @@ ifneq "$(OS)" "Darwin"
 
OBJCOPY ?= $(call replace_cc_with,objcopy)
ARCHIVER ?= $(call replace_cc_with,ar)
-   DWP ?= $(call replace_cc_with,dwp)
override AR = $(ARCHIVER)
 endif
 
@@ -535,10 +528,6 @@ ifneq "$(CXX)" ""
endif
 endif
 
-ifeq "$(GEN_GNU_BUILD_ID)" "YES"
-   LDFLAGS += -Wl,--build-id
-endif
-
 #--
 # DYLIB_ONLY variable can be used to skip the building of a.out.
 # See the sections below regarding dSYM file as well as the building of
@@ -577,17 +566,10 @@ else
 endif
 else
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
-   cp "$(EXE)" "$(EXE).unstripped"
-endif
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
-ifeq "$(MAKE_DWP)" "YES"
-   $(DWP) -o "$(DWP_NAME)" $(DWOS)
 endif
-endif
-
 
 #--
 # Make the dylib
@@ -629,15 +611,9 @@ endif
 else
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-   ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
-   cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).unstripped"
-   endif
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" 
"$(DYLIB_FILENAME).debug"
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
 endif
-ifeq "$(MAKE_DWP)" "YES"
-   $(DWP) -o 

[llvm-branch-commits] [BOLT][NFC] Define getExprValue helper (PR #91663)

2024-05-22 Thread Rafael Auler via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/91663
___
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] [BOLT][NFC] Simplify analyzeIndirectBranch (PR #91662)

2024-05-22 Thread Rafael Auler via llvm-branch-commits

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

LG

https://github.com/llvm/llvm-project/pull/91662
___
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] [workflows] Rework pre-commit CI for the release branch (PR #91550)

2024-05-22 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar milestoned 
https://github.com/llvm/llvm-project/pull/91550
___
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] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread Rafael Auler via llvm-branch-commits

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

LGTM thanks

https://github.com/llvm/llvm-project/pull/93075
___
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] bf19260 - Revert "[IR] Avoid creating icmp/fcmp constant expressions (#92885)"

2024-05-22 Thread via llvm-branch-commits

Author: Daniel Thornburgh
Date: 2024-05-22T11:27:27-07:00
New Revision: bf19260fe0d348aee801f4446c4f8666740c8896

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

LOG: Revert "[IR] Avoid creating icmp/fcmp constant expressions (#92885)"

This reverts commit 108575f02ea9927009ed81231474d3a6f053602f.

Added: 


Modified: 
clang/test/Analysis/builtin_signbit.cpp
clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
clang/test/CodeGen/constantexpr-fneg.c
clang/test/CodeGenCXX/cxx11-thread-local.cpp
clang/test/CodeGenCXX/ubsan-nullability-arg.cpp
clang/test/CodeGenCXX/weak-external.cpp
clang/test/Driver/linker-wrapper-image.c
clang/test/OpenMP/threadprivate_codegen.cpp
llvm/include/llvm/Analysis/TargetFolder.h
llvm/include/llvm/IR/ConstantFolder.h
llvm/lib/Analysis/ConstantFolding.cpp
llvm/lib/IR/ConstantFold.cpp
llvm/test/Assembler/ConstantExprFold.ll
llvm/test/Assembler/ConstantExprNoFold.ll
llvm/test/Assembler/vector-cmp.ll
llvm/test/CodeGen/AMDGPU/lower-ctor-dtor-constexpr-alias.ll
llvm/test/CodeGen/AMDGPU/lower-ctor-dtor.ll
llvm/test/CodeGen/AMDGPU/lower-multiple-ctor-dtor.ll
llvm/test/Instrumentation/MemorySanitizer/check-constant-shadow.ll
llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll
llvm/test/Transforms/Attributor/value-simplify.ll
llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll
llvm/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll
llvm/test/Transforms/InstCombine/getelementptr.ll
llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll
llvm/test/Transforms/InstCombine/pr33453.ll
llvm/test/Transforms/InstCombine/pr83947.ll
llvm/test/Transforms/InstCombine/rem.ll
llvm/test/Transforms/InstCombine/select-and-or.ll
llvm/test/Transforms/InstCombine/select-safe-transforms.ll
llvm/test/Transforms/InstSimplify/ConstProp/bitcast.ll
llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll
llvm/test/Transforms/InstSimplify/compare.ll
llvm/test/Transforms/InstSimplify/past-the-end.ll
llvm/test/Transforms/JumpThreading/constant-fold-status.ll
llvm/test/Transforms/LowerTypeTests/cfi-direct-call1.ll
llvm/test/Transforms/LowerTypeTests/function-weak.ll
llvm/test/Transforms/SCCP/conditions-ranges.ll
llvm/test/Transforms/SimplifyCFG/phi-to-select-constexpr-icmp.ll

Removed: 




diff  --git a/clang/test/Analysis/builtin_signbit.cpp 
b/clang/test/Analysis/builtin_signbit.cpp
index be10f0950f69b..57e6816ce2802 100644
--- a/clang/test/Analysis/builtin_signbit.cpp
+++ b/clang/test/Analysis/builtin_signbit.cpp
@@ -84,30 +84,28 @@ long double ld = -1.0L;
 // CHECK-LE-LABEL: define dso_local void @_Z12test_signbitv(
 // CHECK-LE-SAME: ) #[[ATTR0:[0-9]+]] {
 // CHECK-LE-NEXT:  entry:
-// CHECK-LE-NEXT:[[TMP0:%.*]] = icmp slt i64 trunc (i128 bitcast 
(ppc_fp128 0xM3FF0 to i128) to i64), 0
-// CHECK-LE-NEXT:[[FROMBOOL:%.*]] = zext i1 [[TMP0]] to i8
+// CHECK-LE-NEXT:[[FROMBOOL:%.*]] = zext i1 icmp slt (i64 trunc (i128 
bitcast (ppc_fp128 0xM3FF0 to i128) to i64), i64 0) 
to i8
 // CHECK-LE-NEXT:store i8 [[FROMBOOL]], ptr @b, align 1
-// CHECK-LE-NEXT:[[TMP1:%.*]] = load ppc_fp128, ptr @ld, align 16
-// CHECK-LE-NEXT:[[TMP2:%.*]] = bitcast ppc_fp128 [[TMP1]] to i128
-// CHECK-LE-NEXT:[[TMP3:%.*]] = trunc i128 [[TMP2]] to i64
-// CHECK-LE-NEXT:[[TMP4:%.*]] = icmp slt i64 [[TMP3]], 0
-// CHECK-LE-NEXT:[[FROMBOOL1:%.*]] = zext i1 [[TMP4]] to i8
+// CHECK-LE-NEXT:[[TMP0:%.*]] = load ppc_fp128, ptr @ld, align 16
+// CHECK-LE-NEXT:[[TMP1:%.*]] = bitcast ppc_fp128 [[TMP0]] to i128
+// CHECK-LE-NEXT:[[TMP2:%.*]] = trunc i128 [[TMP1]] to i64
+// CHECK-LE-NEXT:[[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
+// CHECK-LE-NEXT:[[FROMBOOL1:%.*]] = zext i1 [[TMP3]] to i8
 // CHECK-LE-NEXT:store i8 [[FROMBOOL1]], ptr @b, align 1
 // CHECK-LE-NEXT:store i8 0, ptr @b, align 1
-// CHECK-LE-NEXT:[[TMP5:%.*]] = load double, ptr @d, align 8
-// CHECK-LE-NEXT:[[CONV:%.*]] = fptrunc double [[TMP5]] to float
-// CHECK-LE-NEXT:[[TMP6:%.*]] = bitcast float [[CONV]] to i32
-// CHECK-LE-NEXT:[[TMP7:%.*]] = icmp slt i32 [[TMP6]], 0
-// CHECK-LE-NEXT:[[FROMBOOL2:%.*]] = zext i1 [[TMP7]] to i8
+// CHECK-LE-NEXT:[[TMP4:%.*]] = load double, ptr @d, align 8
+// CHECK-LE-NEXT:[[CONV:%.*]] = fptrunc double [[TMP4]] to float
+// CHECK-LE-NEXT:[[TMP5:%.*]] = bitcast float [[CONV]] to i32
+// CHECK-LE-NEXT:[[TMP6:%.*]] = icmp slt i32 [[TMP5]], 0
+// CHECK-LE-NEXT:[[FROMBOOL2:%.*]] = zext i1 [[TMP6]] to i8
 

[llvm-branch-commits] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

Eliminate the dependence of Profile on Passes.

Test Plan: NFC


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


3 Files Affected:

- (modified) bolt/lib/Profile/CMakeLists.txt (-1) 
- (modified) bolt/lib/Profile/DataAggregator.cpp (-2) 
- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+5-1) 


``diff
diff --git a/bolt/lib/Profile/CMakeLists.txt b/bolt/lib/Profile/CMakeLists.txt
index 045ac47edb950..ca8b9c34e63b1 100644
--- a/bolt/lib/Profile/CMakeLists.txt
+++ b/bolt/lib/Profile/CMakeLists.txt
@@ -17,6 +17,5 @@ add_llvm_library(LLVMBOLTProfile
 target_link_libraries(LLVMBOLTProfile
   PRIVATE
   LLVMBOLTCore
-  LLVMBOLTPasses
   LLVMBOLTUtils
   )
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index c0fd69b98c82d..a9252ea04453d 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -613,8 +613,6 @@ Error DataAggregator::readProfile(BinaryContext ) {
 if (std::error_code EC = writeBATYAML(BC, opts::SaveProfile))
   report_error("cannot create output data file", EC);
 }
-PrintProgramStats PPS(BAT);
-BC.logBOLTErrorsAndQuitOnFatal(PPS.runOnFunctions(BC));
   }
 
   return Error::success();
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index 9cc4c8c8c4faf..7024437110314 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -17,6 +17,7 @@
 #include "bolt/Core/MCPlusBuilder.h"
 #include "bolt/Core/ParallelUtilities.h"
 #include "bolt/Core/Relocation.h"
+#include "bolt/Passes/BinaryPasses.h"
 #include "bolt/Passes/CacheMetrics.h"
 #include "bolt/Passes/ReorderFunctions.h"
 #include "bolt/Profile/BoltAddressTranslation.h"
@@ -3285,8 +3286,11 @@ void RewriteInstance::processProfileData() {
   // Release memory used by profile reader.
   ProfileReader.reset();
 
-  if (opts::AggregateOnly)
+  if (opts::AggregateOnly) {
+PrintProgramStats PPS(&*BAT);
+BC->logBOLTErrorsAndQuitOnFatal(PPS.runOnFunctions(*BC));
 exit(0);
+  }
 }
 
 void RewriteInstance::disassembleFunctions() {

``




https://github.com/llvm/llvm-project/pull/93075
___
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] [BOLT][NFC] Move out PrintProgramStats from Profile into Rewrite (PR #93075)

2024-05-22 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/93075

Eliminate the dependence of Profile on Passes.

Test Plan: NFC



___
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] [LAA] Use SCEVUse to add extra NUW flags to pointer bounds. (WIP) (PR #91962)

2024-05-22 Thread Florian Hahn via llvm-branch-commits

https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/91962

>From ab0311667695fb255625cc846e02373800fad8b1 Mon Sep 17 00:00:00 2001
From: Florian Hahn 
Date: Wed, 1 May 2024 11:03:42 +0100
Subject: [PATCH 1/3] [SCEV,LAA] Add tests to make sure scoped SCEVs don't
 impact other SCEVs.

---
 .../LoopAccessAnalysis/scoped-scevs.ll| 182 ++
 1 file changed, 182 insertions(+)
 create mode 100644 llvm/test/Analysis/LoopAccessAnalysis/scoped-scevs.ll

diff --git a/llvm/test/Analysis/LoopAccessAnalysis/scoped-scevs.ll 
b/llvm/test/Analysis/LoopAccessAnalysis/scoped-scevs.ll
new file mode 100644
index 0..323ba2a739cf8
--- /dev/null
+++ b/llvm/test/Analysis/LoopAccessAnalysis/scoped-scevs.ll
@@ -0,0 +1,182 @@
+; NOTE: Assertions have been autogenerated by 
utils/update_analyze_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -passes='print,print' 
-disable-output %s 2>&1 | FileCheck --check-prefixes=LAA,AFTER %s
+; RUN: opt 
-passes='print,print,print' 
-disable-output %s 2>&1 | FileCheck --check-prefixes=BEFORE,LAA,AFTER %s
+
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
+declare void @use(ptr)
+
+; Check that scoped expressions created by LAA do not interfere with non-scoped
+; SCEVs with the same operands. The tests first run print to
+; populate the SCEV cache. They contain a GEP computing A+405, which is the end
+; of the accessed range, before and/or after the loop. No nuw flags should be
+; added to them in the second print output.
+
+define ptr @test_ptr_range_end_computed_before_and_after_loop(ptr %A) {
+; BEFORE-LABEL: 'test_ptr_range_end_computed_before_and_after_loop'
+; BEFORE-NEXT:  Classifying expressions for: 
@test_ptr_range_end_computed_before_and_after_loop
+; BEFORE:%x = getelementptr inbounds i8, ptr %A, i64 405
+; BEFORE-NEXT:--> (405 + %A) U: full-set S: full-set
+; BEFORE:%y = getelementptr inbounds i8, ptr %A, i64 405
+; BEFORE-NEXT:--> (405 + %A) U: full-set S: full-set
+;
+; LAA-LABEL: 'test_ptr_range_end_computed_before_and_after_loop'
+; LAA-NEXT:loop:
+; LAA-NEXT:  Memory dependences are safe with run-time checks
+; LAA-NEXT:  Dependences:
+; LAA-NEXT:  Run-time memory checks:
+; LAA-NEXT:  Check 0:
+; LAA-NEXT:Comparing group ([[GRP1:0x[0-9a-f]+]]):
+; LAA-NEXT:  %gep.A.400 = getelementptr inbounds i32, ptr %A.1, i64 %iv
+; LAA-NEXT:Against group ([[GRP2:0x[0-9a-f]+]]):
+; LAA-NEXT:  %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
+; LAA-NEXT:  Grouped accesses:
+; LAA-NEXT:Group [[GRP1]]:
+; LAA-NEXT:  (Low: (1 + %A) High: (405 + %A))
+; LAA-NEXT:Member: {(1 + %A),+,4}<%loop>
+; LAA-NEXT:Group [[GRP2]]:
+; LAA-NEXT:  (Low: %A High: (101 + %A))
+; LAA-NEXT:Member: {%A,+,1}<%loop>
+; LAA-EMPTY:
+; LAA-NEXT:  Non vectorizable stores to invariant address were not found 
in loop.
+; LAA-NEXT:  SCEV assumptions:
+; LAA-EMPTY:
+; LAA-NEXT:  Expressions re-written:
+;
+; AFTER-LABEL: 'test_ptr_range_end_computed_before_and_after_loop'
+; AFTER-NEXT:  Classifying expressions for: 
@test_ptr_range_end_computed_before_and_after_loop
+; AFTER:%x = getelementptr inbounds i8, ptr %A, i64 405
+; AFTER-NEXT:--> (405 + %A) U: full-set S: full-set
+; AFTER:%y = getelementptr inbounds i8, ptr %A, i64 405
+; AFTER-NEXT:--> (405 + %A) U: full-set S: full-set
+entry:
+  %A.1 = getelementptr inbounds i8, ptr %A, i64 1
+  %x = getelementptr inbounds i8, ptr %A, i64 405
+  call void @use(ptr %x)
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %gep.A.400 = getelementptr inbounds i32, ptr %A.1, i64 %iv
+  %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
+  %l = load i8, ptr %gep.A, align 1
+  %ext = zext i8 %l to i32
+  store i32 %ext, ptr %gep.A.400, align 4
+  %iv.next = add nuw nsw i64 %iv, 1
+  %ec = icmp eq i64 %iv, 100
+  br i1 %ec, label %exit, label %loop
+
+exit:
+  %y = getelementptr inbounds i8, ptr %A, i64 405
+  ret ptr %y
+}
+
+define void @test_ptr_range_end_computed_before_loop(ptr %A) {
+; BEFORE-LABEL: 'test_ptr_range_end_computed_before_loop'
+; BEFORE-NEXT:  Classifying expressions for: 
@test_ptr_range_end_computed_before_loop
+; BEFORE-NEXT:%A.1 = getelementptr inbounds i8, ptr %A, i64 1
+; BEFORE-NEXT:--> (1 + %A) U: full-set S: full-set
+; BEFORE-NEXT:%x = getelementptr inbounds i8, ptr %A, i64 405
+;
+; LAA-LABEL: 'test_ptr_range_end_computed_before_loop'
+; LAA-NEXT:loop:
+; LAA-NEXT:  Memory dependences are safe with run-time checks
+; LAA-NEXT:  Dependences:
+; LAA-NEXT:  Run-time memory checks:
+; LAA-NEXT:  Check 0:
+; LAA-NEXT:Comparing group ([[GRP3:0x[0-9a-f]+]]):
+; LAA-NEXT:  %gep.A.400 = getelementptr inbounds i32, ptr %A.1, i64 %iv
+; LAA-NEXT:Against group ([[GRP4:0x[0-9a-f]+]]):
+; LAA-NEXT:  %gep.A = getelementptr inbounds i8, ptr 

[llvm-branch-commits] [llvm] 5474b1f - Revert "[MIPS] match llvm.{min, max}num with {min, max}.fmt for R6 (#89021)"

2024-05-22 Thread via llvm-branch-commits

Author: YunQiang Su
Date: 2024-05-22T22:09:27+08:00
New Revision: 5474b1f0bd73c94f78ccf63565b46fd1ee34b589

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

LOG: Revert "[MIPS] match llvm.{min,max}num with {min,max}.fmt for R6 (#89021)"

This reverts commit 715219482b99ceef9bf83a2ff68c64c8faa930cd.

Added: 


Modified: 
llvm/lib/Target/Mips/Mips32r6InstrInfo.td
llvm/lib/Target/Mips/MipsISelLowering.cpp
llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll

Removed: 
llvm/test/CodeGen/Mips/mipsr6-minmaxnum.ll



diff  --git a/llvm/lib/Target/Mips/Mips32r6InstrInfo.td 
b/llvm/lib/Target/Mips/Mips32r6InstrInfo.td
index f609305bfee42..bef7607118ce0 100644
--- a/llvm/lib/Target/Mips/Mips32r6InstrInfo.td
+++ b/llvm/lib/Target/Mips/Mips32r6InstrInfo.td
@@ -1117,22 +1117,6 @@ def : MipsPat<(select i32:$cond, immz, i32:$f),
   ISA_MIPS32R6;
 }
 
-// llvm.fmin/fmax operations.
-let AdditionalPredicates = [NotInMicroMips] in {
-  def : MipsPat<(fmaxnum f32:$lhs, f32:$rhs),
-(MAX_S   f32:$lhs, f32:$rhs)>,
-ISA_MIPS32R6;
-  def : MipsPat<(fmaxnum f64:$lhs, f64:$rhs),
-(MAX_D   f64:$lhs, f64:$rhs)>,
-ISA_MIPS32R6;
-  def : MipsPat<(fminnum f32:$lhs, f32:$rhs),
-(MIN_S   f32:$lhs, f32:$rhs)>,
-ISA_MIPS32R6;
-  def : MipsPat<(fminnum f64:$lhs, f64:$rhs),
-(MIN_D   f64:$lhs, f64:$rhs)>,
-ISA_MIPS32R6;
-}
-
 // Pseudo instructions
 let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, hasDelaySlot = 
1,
 hasExtraSrcRegAllocReq = 1, isCTI = 1, Defs = [AT], hasPostISelHook = 1 in 
{

diff  --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp 
b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 459164fa7a29d..834728a5b46e8 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -358,15 +358,6 @@ MipsTargetLowering::MipsTargetLowering(const 
MipsTargetMachine ,
   setOperationAction(ISD::FCOPYSIGN,  MVT::f64,   Custom);
   setOperationAction(ISD::FP_TO_SINT, MVT::i32,   Custom);
 
-  // Lower fmin and fmax operations for MIPS R6.
-  // Instructions are defined but never used.
-  if (Subtarget.hasMips32r6() || Subtarget.hasMips64r6()) {
-setOperationAction(ISD::FMINNUM, MVT::f32, Legal);
-setOperationAction(ISD::FMINNUM, MVT::f64, Legal);
-setOperationAction(ISD::FMAXNUM, MVT::f32, Legal);
-setOperationAction(ISD::FMAXNUM, MVT::f64, Legal);
-  }
-
   if (Subtarget.isGP64bit()) {
 setOperationAction(ISD::GlobalAddress,  MVT::i64,   Custom);
 setOperationAction(ISD::BlockAddress,   MVT::i64,   Custom);

diff  --git a/llvm/test/CodeGen/Mips/mipsr6-minmaxnum.ll 
b/llvm/test/CodeGen/Mips/mipsr6-minmaxnum.ll
deleted file mode 100644
index e14e89916e6dc..0
--- a/llvm/test/CodeGen/Mips/mipsr6-minmaxnum.ll
+++ /dev/null
@@ -1,69 +0,0 @@
-; RUN: llc %s -mtriple=mipsisa32r6el-linux-gnu -o - | \
-; RUN: FileCheck %s --check-prefix=MIPS32R6EL
-; RUN: llc %s -mtriple=mipsisa64r6el-linux-gnuabi64 -o - | \
-; RUN: FileCheck %s --check-prefix=MIPS64R6EL
-
-define float @mins(float %x, float %y) {
-; MIPS32R6EL-LABEL:mins
-; MIPS32R6EL:  # %bb.0:
-; MIPS32R6EL-NEXT: jr  $ra
-; MIPS32R6EL-NEXT: min.s   $f0, $f12, $f14
-;
-; MIPS64R6EL-LABEL:mins
-; MIPS64R6EL:  # %bb.0:
-; MIPS64R6EL-NEXT: jr  $ra
-; MIPS64R6EL-NEXT: min.s   $f0, $f12, $f13
-
-  %r = tail call float @llvm.minnum.f32(float %x, float %y)
-  ret float %r
-}
-
-define float @maxs(float %x, float %y) {
-; MIPS32R6EL-LABEL:maxs
-; MIPS32R6EL:  # %bb.0:
-; MIPS32R6EL-NEXT: jr  $ra
-; MIPS32R6EL-NEXT: max.s   $f0, $f12, $f14
-;
-; MIPS64R6EL-LABEL:maxs
-; MIPS64R6EL:  # %bb.0:
-; MIPS64R6EL-NEXT: jr  $ra
-; MIPS64R6EL-NEXT: max.s   $f0, $f12, $f13
-
-  %r = tail call float @llvm.maxnum.f32(float %x, float %y)
-  ret float %r
-}
-
-define double @mind(double %x, double %y) {
-; MIPS32R6EL-LABEL:mind
-; MIPS32R6EL:  # %bb.0:
-; MIPS32R6EL-NEXT: jr  $ra
-; MIPS32R6EL-NEXT: min.d   $f0, $f12, $f14
-;
-; MIPS64R6EL-LABEL:mind
-; MIPS64R6EL:  # %bb.0:
-; MIPS64R6EL-NEXT: jr  $ra
-; MIPS64R6EL-NEXT: min.d   $f0, $f12, $f13
-
-  %r = tail call double @llvm.minnum.f64(double %x, double %y)
-  ret double %r
-}
-
-define double @maxd(double %x, double %y) {
-; MIPS32R6EL-LABEL:maxd
-; MIPS32R6EL:  # %bb.0:
-; MIPS32R6EL-NEXT: jr  $ra
-; MIPS32R6EL-NEXT: max.d   $f0, $f12, $f14
-;
-; MIPS64R6EL-LABEL:maxd
-; MIPS64R6EL:  # %bb.0:
-; MIPS64R6EL-NEXT: jr  $ra
-; MIPS64R6EL-NEXT: max.d   $f0, $f12, $f13
-
-  %r = tail call 

[llvm-branch-commits] [llvm] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-22 Thread Shilei Tian via llvm-branch-commits


@@ -292,6 +294,7 @@ if(WIN32)
   set(LIBOMP_IMP_LIB_TARGET omp)
   set(LIBOMP_GENERATED_DEF_FILE ${LIBOMP_LIB_NAME}.def)
   add_custom_target(libomp-needed-def-file DEPENDS 
${LIBOMP_GENERATED_DEF_FILE})
+  set_target_properties(libomp-needed-def-file PROPERTIES FOLDER 
"OpenMP/Codegenning")

shiltian wrote:

`Codegenning` is really weird. I don't see this word anywhere else in LLVM 
project. Probably just `OpenMP/CodeGen`.

https://github.com/llvm/llvm-project/pull/89750
___
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] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-22 Thread Shilei Tian via llvm-branch-commits


@@ -126,6 +126,7 @@ macro(libomp_test_touch_recipe test_touch_dir)
 endmacro()
 libomp_append(libomp_test_touch_env "KMP_VERSION=1")
 add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
+set_target_properties(libomp-test-touch PROPERTIES FOLDER "OpenMP/Tests")

shiltian wrote:

My point is, when it comes to directory (except the top level folder), we don't 
call it "OpenMP". I don't have a strong objection, but just find `libomp` more 
conventional. I'll leave it up to you.

https://github.com/llvm/llvm-project/pull/89750
___
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] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-22 Thread Shilei Tian via llvm-branch-commits

https://github.com/shiltian edited 
https://github.com/llvm/llvm-project/pull/89750
___
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] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-22 Thread Shilei Tian via llvm-branch-commits

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

LG with nit

https://github.com/llvm/llvm-project/pull/89750
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -15980,7 +15985,44 @@ StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
  "affected loops");
 
   // Decode the permutation clause.
-  constexpr uint64_t Permutation[] = {1, 0};
+  SmallVector Permutation;
+  if (!PermutationClause) {
+Permutation = {1, 0};
+  } else {
+ArrayRef PermArgs = PermutationClause->getArgsRefs();
+llvm::BitVector Flags(PermArgs.size());
+for (Expr *PermArg : PermArgs) {
+  std::optional PermCstExpr =
+  PermArg->getIntegerConstantExpr(Context);
+  if (!PermCstExpr)
+continue;
+  uint64_t PermInt = PermCstExpr->getZExtValue();
+  assert(1 <= PermInt && PermInt <= NumLoops &&
+ "Must be a permutation; diagnostic emitted in "
+ "ActOnOpenMPPermutationClause");
+  if (Flags[PermInt - 1]) {
+SourceRange ExprRange(PermArg->getBeginLoc(), PermArg->getEndLoc());
+Diag(PermArg->getExprLoc(),
+ diag::err_omp_interchange_permutation_value_repeated)
+<< PermInt << ExprRange;
+continue;
+  }
+  Flags[PermInt - 1] = true;
+
+  Permutation.push_back(PermInt - 1);
+}
+
+if (Permutation.size() != NumLoops)
+  return StmtError();
+  }
+
+  // Nothing to transform with trivial permutation.
+  if (NumLoops <= 1 || llvm::all_of(llvm::enumerate(Permutation), [](auto p) {

alexey-bataev wrote:

`auto P`

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -15972,6 +15971,12 @@ StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
 return OMPInterchangeDirective::Create(Context, StartLoc, EndLoc, Clauses,
NumLoops, AStmt, nullptr, nullptr);
 
+  // An invalid expression in the permutation clause is set to nullptr in
+  // ActOnOpenMPPermutationClause.
+  if (PermutationClause && llvm::any_of(PermutationClause->getArgsRefs(),
+[](Expr *E) { return !E; }))

alexey-bataev wrote:

Use is_contained

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -9861,13 +9842,19 @@ buildPreInits(ASTContext ,
 
 /// Build pre-init statement for the given statements.
 static Stmt *buildPreInits(ASTContext , ArrayRef PreInits) {
-  if (PreInits.empty())
-return nullptr;
-
-  SmallVector Stmts;
-  for (Stmt *S : PreInits)
-appendFlattendedStmtList(Stmts, S);
-  return CompoundStmt::Create(Context, PreInits, FPOptionsOverride(), {}, {});
+  if (!PreInits.empty()) {
+SmallVector Stmts;
+for (Stmt *S : PreInits) {
+  // Do not nest CompoundStmts.
+  if (auto *CS = dyn_cast(S)) {
+llvm::append_range(Stmts, CS->body());
+continue;
+  }
+  Stmts.push_back(S);
+}
+return CompoundStmt::Create(Context, PreInits, FPOptionsOverride(), {}, 
{});
+  }
+  return nullptr;

alexey-bataev wrote:

Original code should work correctly, no?

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -15209,7 +15206,7 @@ static void collectLoopStmts(Stmt *AStmt, 
MutableArrayRef LoopStmts) {
 LoopStmts[Cnt] = CurStmt;
 return false;
   });
-  assert(!is_contained(LoopStmts, nullptr) &&
+  assert(llvm::all_of(LoopStmts, [](Stmt *LoopStmt) { return LoopStmt; }) &&

alexey-bataev wrote:

restore

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -1774,6 +1793,18 @@ void 
OMPClausePrinter::VisitOMPSizesClause(OMPSizesClause *Node) {
   OS << ")";
 }
 
+void OMPClausePrinter::VisitOMPPermutationClause(OMPPermutationClause *Node) {
+  OS << "permutation(";
+  bool First = true;
+  for (Expr *Size : Node->getArgsRefs()) {
+if (!First)
+  OS << ", ";
+Size->printPretty(OS, nullptr, Policy, 0);
+First = false;
+  }

alexey-bataev wrote:

`llvm::interleaveComma(Node->getArgsRefs(), OS,
[&](const Expr *E) { E->printPretty(OS, nullptr, 
Policy, 0); });`

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -9970,9 +9957,12 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr 
*CollapseLoopCountExpr,
 // Search for pre-init declared variables that need to be captured
 // to be referenceable inside the directive.
 SmallVector Constituents;
-appendFlattendedStmtList(Constituents, DependentPreInits);
+if (auto *CS = dyn_cast(DependentPreInits))

alexey-bataev wrote:

Restore original

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -15149,8 +15139,15 @@ bool SemaOpenMP::checkTransformableLoopNest(
   DependentPreInits = Dir->getPreInits();
 else
   llvm_unreachable("Unhandled loop transformation");
-
-appendFlattendedStmtList(OriginalInits.back(), DependentPreInits);
+if (!DependentPreInits)

alexey-bataev wrote:

Restore

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -870,6 +870,106 @@ class OMPSizesClause final
   }
 };
 
+/// This class represents the 'permutation' clause in the
+/// '#pragma omp interchange' directive.
+///
+/// \code{c}
+///   #pragma omp interchange permutation(2,1)
+///   for (int i = 0; i < 64; ++i)
+/// for (int j = 0; j < 64; ++j)
+/// \endcode
+class OMPPermutationClause final
+: public OMPClause,
+  private llvm::TrailingObjects {
+  friend class OMPClauseReader;
+  friend class llvm::TrailingObjects;
+
+  /// Location of '('.
+  SourceLocation LParenLoc;
+
+  /// Number of arguments in the clause, and hence also the number of loops to
+  /// be permuted.
+  unsigned NumLoops;
+
+  /// Sets the permutation index expressions.
+  void setArgRefs(ArrayRef VL) {
+assert(VL.size() == NumLoops);
+std::copy(VL.begin(), VL.end(),

alexey-bataev wrote:

Use llvm::copy

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -870,6 +870,106 @@ class OMPSizesClause final
   }
 };
 
+/// This class represents the 'permutation' clause in the
+/// '#pragma omp interchange' directive.
+///
+/// \code{c}
+///   #pragma omp interchange permutation(2,1)
+///   for (int i = 0; i < 64; ++i)
+/// for (int j = 0; j < 64; ++j)
+/// \endcode
+class OMPPermutationClause final
+: public OMPClause,
+  private llvm::TrailingObjects {
+  friend class OMPClauseReader;
+  friend class llvm::TrailingObjects;
+
+  /// Location of '('.
+  SourceLocation LParenLoc;
+
+  /// Number of arguments in the clause, and hence also the number of loops to
+  /// be permuted.
+  unsigned NumLoops;
+
+  /// Sets the permutation index expressions.
+  void setArgRefs(ArrayRef VL) {
+assert(VL.size() == NumLoops);

alexey-bataev wrote:

Add assertion message

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Krzysztof Parzyszek via llvm-branch-commits


@@ -1067,6 +1067,14 @@ struct SizesT {
   SizeList v;
 };
 
+// V6.0:  `permutation` clause
+template  //

kparzysz wrote:

Not a big deal, but the clauses here are sorted alphabetically.

https://github.com/llvm/llvm-project/pull/92030
___
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] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits


@@ -15937,6 +15945,160 @@ StmtResult 
SemaOpenMP::ActOnOpenMPReverseDirective(Stmt *AStmt,
  buildPreInits(Context, PreInits));
 }
 
+StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
+ArrayRef Clauses, Stmt *AStmt, SourceLocation StartLoc,
+SourceLocation EndLoc) {
+  ASTContext  = getASTContext();
+  DeclContext *CurContext = SemaRef.CurContext;
+  Scope *CurScope = SemaRef.getCurScope();
+
+  // Empty statement should only be possible if there already was an error.
+  if (!AStmt)
+return StmtError();
+
+  // interchange without permutation clause swaps two loops.
+  constexpr size_t NumLoops = 2;
+
+  // Verify and diagnose loop nest.
+  SmallVector LoopHelpers(NumLoops);
+  Stmt *Body = nullptr;
+  SmallVector, 2> OriginalInits;
+  if (!checkTransformableLoopNest(OMPD_interchange, AStmt, NumLoops,
+  LoopHelpers, Body, OriginalInits))
+return StmtError();
+
+  // Delay interchange to when template is completely instantiated.
+  if (CurContext->isDependentContext())
+return OMPInterchangeDirective::Create(Context, StartLoc, EndLoc, Clauses,
+   NumLoops, AStmt, nullptr, nullptr);
+
+  assert(LoopHelpers.size() == NumLoops &&
+ "Expecting loop iteration space dimensionaly to match number of "
+ "affected loops");
+  assert(OriginalInits.size() == NumLoops &&
+ "Expecting loop iteration space dimensionaly to match number of "
+ "affected loops");
+
+  // Decode the permutation clause.
+  constexpr uint64_t Permutation[] = {1, 0};
+
+  // Find the affected loops.
+  SmallVector LoopStmts(NumLoops, nullptr);
+  collectLoopStmts(AStmt, LoopStmts);
+
+  // Collect pre-init statements on the order before the permuation.
+  SmallVector PreInits;
+  for (auto I : llvm::seq(NumLoops)) {
+OMPLoopBasedDirective::HelperExprs  = LoopHelpers[I];
+
+assert(LoopHelper.Counters.size() == 1 &&
+   "Single-dimensional loop iteration space expected");
+auto *OrigCntVar = cast(LoopHelper.Counters.front());
+
+std::string OrigVarName = OrigCntVar->getNameInfo().getAsString();
+addLoopPreInits(Context, LoopHelper, LoopStmts[I], OriginalInits[I],
+PreInits);
+  }
+
+  SmallVector PermutedIndVars;
+  PermutedIndVars.resize(NumLoops);

alexey-bataev wrote:

SmallVector PermutedIndVars(NumLoops);

https://github.com/llvm/llvm-project/pull/93022
___
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] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits

https://github.com/alexey-bataev edited 
https://github.com/llvm/llvm-project/pull/93022
___
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] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread Alexey Bataev via llvm-branch-commits

https://github.com/alexey-bataev approved this pull request.

LG with a nit

https://github.com/llvm/llvm-project/pull/93022
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Michael Kruse via llvm-branch-commits


@@ -5779,6 +5779,80 @@ class OMPReverseDirective final : public 
OMPLoopTransformationDirective {
   }
 };
 
+/// Represents the '#pragma omp interchange' loop transformation directive.
+///
+/// \code{c}
+///   #pragma omp interchange
+///   for (int i = 0; i < m; ++i)
+/// for (int j = 0; j < n; ++j)
+///   ..
+/// \endcode
+class OMPInterchangeDirective final : public OMPLoopTransformationDirective {

Meinersbur wrote:

Interchange construct extracted out into #93022

https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/92030
___
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] [flang] [llvm] [Clang][OpenMP] Add interchange directive (PR #92030)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/92030
___
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] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Michael Kruse (Meinersbur)


Changes

Add the interchange directive which will be introduced in the upcoming OpenMP 
6.0 specification. A preview has been published in [Technical Report 
12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf).

---

Patch is 185.81 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/93022.diff


30 Files Affected:

- (modified) clang/include/clang-c/Index.h (+4) 
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+3) 
- (modified) clang/include/clang/AST/StmtOpenMP.h (+75-1) 
- (modified) clang/include/clang/Basic/StmtNodes.td (+1) 
- (modified) clang/include/clang/Sema/SemaOpenMP.h (+6) 
- (modified) clang/include/clang/Serialization/ASTBitCodes.h (+1) 
- (modified) clang/lib/AST/StmtOpenMP.cpp (+20) 
- (modified) clang/lib/AST/StmtPrinter.cpp (+5) 
- (modified) clang/lib/AST/StmtProfile.cpp (+5) 
- (modified) clang/lib/Basic/OpenMPKinds.cpp (+3-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+3) 
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+10) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+1) 
- (modified) clang/lib/Parse/ParseOpenMP.cpp (+2) 
- (modified) clang/lib/Sema/SemaExceptionSpec.cpp (+1) 
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+162) 
- (modified) clang/lib/Sema/TreeTransform.h (+11) 
- (modified) clang/lib/Serialization/ASTReaderStmt.cpp (+11) 
- (modified) clang/lib/Serialization/ASTWriterStmt.cpp (+5) 
- (added) clang/test/OpenMP/interchange_ast_print.cpp (+135) 
- (added) clang/test/OpenMP/interchange_codegen.cpp (+1990) 
- (added) clang/test/OpenMP/interchange_messages.cpp (+77) 
- (modified) clang/tools/libclang/CIndex.cpp (+8) 
- (modified) clang/tools/libclang/CXCursor.cpp (+3) 
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+3) 
- (added) openmp/runtime/test/transform/interchange/foreach.cpp (+216) 
- (added) openmp/runtime/test/transform/interchange/intfor.c (+38) 
- (added) openmp/runtime/test/transform/interchange/iterfor.cpp (+222) 
- (added) 
openmp/runtime/test/transform/interchange/parallel-wsloop-collapse-foreach.cpp 
(+340) 
- (added) 
openmp/runtime/test/transform/interchange/parallel-wsloop-collapse-intfor.cpp 
(+106) 


``diff
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index c7d63818ece23..a79aafbf20222 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -2150,6 +2150,10 @@ enum CXCursorKind {
*/
   CXCursor_OMPReverseDirective = 307,
 
+  /** OpenMP interchange directive.
+   */
+  CXCursor_OMPInterchangeDirective = 308,
+
   /** OpenACC Compute Construct.
*/
   CXCursor_OpenACCComputeConstruct = 320,
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 06b29d59785f6..1bb167d7ddc3c 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3024,6 +3024,9 @@ DEF_TRAVERSE_STMT(OMPUnrollDirective,
 DEF_TRAVERSE_STMT(OMPReverseDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
+DEF_TRAVERSE_STMT(OMPInterchangeDirective,
+  { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
 DEF_TRAVERSE_STMT(OMPForDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
diff --git a/clang/include/clang/AST/StmtOpenMP.h 
b/clang/include/clang/AST/StmtOpenMP.h
index fb7f413162fad..01c8b8e1a9f5e 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -1009,7 +1009,7 @@ class OMPLoopTransformationDirective : public 
OMPLoopBasedDirective {
   static bool classof(const Stmt *T) {
 Stmt::StmtClass C = T->getStmtClass();
 return C == OMPTileDirectiveClass || C == OMPUnrollDirectiveClass ||
-   C == OMPReverseDirectiveClass;
+   C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass;
   }
 };
 
@@ -5777,6 +5777,80 @@ class OMPReverseDirective final : public 
OMPLoopTransformationDirective {
   }
 };
 
+/// Represents the '#pragma omp interchange' loop transformation directive.
+///
+/// \code{c}
+///   #pragma omp interchange
+///   for (int i = 0; i < m; ++i)
+/// for (int j = 0; j < n; ++j)
+///   ..
+/// \endcode
+class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
+  friend class ASTStmtReader;
+  friend class OMPExecutableDirective;
+
+  /// Offsets of child members.
+  enum {
+PreInitsOffset = 0,
+TransformedStmtOffset,
+  };
+
+  explicit OMPInterchangeDirective(SourceLocation StartLoc,
+   SourceLocation EndLoc, unsigned NumLoops)
+  : OMPLoopTransformationDirective(OMPInterchangeDirectiveClass,
+   llvm::omp::OMPD_interchange, StartLoc,
+   EndLoc, NumLoops) {
+setNumGeneratedLoops(3 * NumLoops);
+  }
+
+  void setPreInits(Stmt *PreInits) {
+   

[llvm-branch-commits] [clang] [llvm] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-flang-openmp

Author: Michael Kruse (Meinersbur)


Changes

Add the interchange directive which will be introduced in the upcoming OpenMP 
6.0 specification. A preview has been published in [Technical Report 
12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf).

---

Patch is 185.81 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/93022.diff


30 Files Affected:

- (modified) clang/include/clang-c/Index.h (+4) 
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+3) 
- (modified) clang/include/clang/AST/StmtOpenMP.h (+75-1) 
- (modified) clang/include/clang/Basic/StmtNodes.td (+1) 
- (modified) clang/include/clang/Sema/SemaOpenMP.h (+6) 
- (modified) clang/include/clang/Serialization/ASTBitCodes.h (+1) 
- (modified) clang/lib/AST/StmtOpenMP.cpp (+20) 
- (modified) clang/lib/AST/StmtPrinter.cpp (+5) 
- (modified) clang/lib/AST/StmtProfile.cpp (+5) 
- (modified) clang/lib/Basic/OpenMPKinds.cpp (+3-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+3) 
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+10) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+1) 
- (modified) clang/lib/Parse/ParseOpenMP.cpp (+2) 
- (modified) clang/lib/Sema/SemaExceptionSpec.cpp (+1) 
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+162) 
- (modified) clang/lib/Sema/TreeTransform.h (+11) 
- (modified) clang/lib/Serialization/ASTReaderStmt.cpp (+11) 
- (modified) clang/lib/Serialization/ASTWriterStmt.cpp (+5) 
- (added) clang/test/OpenMP/interchange_ast_print.cpp (+135) 
- (added) clang/test/OpenMP/interchange_codegen.cpp (+1990) 
- (added) clang/test/OpenMP/interchange_messages.cpp (+77) 
- (modified) clang/tools/libclang/CIndex.cpp (+8) 
- (modified) clang/tools/libclang/CXCursor.cpp (+3) 
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+3) 
- (added) openmp/runtime/test/transform/interchange/foreach.cpp (+216) 
- (added) openmp/runtime/test/transform/interchange/intfor.c (+38) 
- (added) openmp/runtime/test/transform/interchange/iterfor.cpp (+222) 
- (added) 
openmp/runtime/test/transform/interchange/parallel-wsloop-collapse-foreach.cpp 
(+340) 
- (added) 
openmp/runtime/test/transform/interchange/parallel-wsloop-collapse-intfor.cpp 
(+106) 


``diff
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index c7d63818ece23..a79aafbf20222 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -2150,6 +2150,10 @@ enum CXCursorKind {
*/
   CXCursor_OMPReverseDirective = 307,
 
+  /** OpenMP interchange directive.
+   */
+  CXCursor_OMPInterchangeDirective = 308,
+
   /** OpenACC Compute Construct.
*/
   CXCursor_OpenACCComputeConstruct = 320,
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 06b29d59785f6..1bb167d7ddc3c 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3024,6 +3024,9 @@ DEF_TRAVERSE_STMT(OMPUnrollDirective,
 DEF_TRAVERSE_STMT(OMPReverseDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
+DEF_TRAVERSE_STMT(OMPInterchangeDirective,
+  { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
 DEF_TRAVERSE_STMT(OMPForDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
diff --git a/clang/include/clang/AST/StmtOpenMP.h 
b/clang/include/clang/AST/StmtOpenMP.h
index fb7f413162fad..01c8b8e1a9f5e 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -1009,7 +1009,7 @@ class OMPLoopTransformationDirective : public 
OMPLoopBasedDirective {
   static bool classof(const Stmt *T) {
 Stmt::StmtClass C = T->getStmtClass();
 return C == OMPTileDirectiveClass || C == OMPUnrollDirectiveClass ||
-   C == OMPReverseDirectiveClass;
+   C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass;
   }
 };
 
@@ -5777,6 +5777,80 @@ class OMPReverseDirective final : public 
OMPLoopTransformationDirective {
   }
 };
 
+/// Represents the '#pragma omp interchange' loop transformation directive.
+///
+/// \code{c}
+///   #pragma omp interchange
+///   for (int i = 0; i < m; ++i)
+/// for (int j = 0; j < n; ++j)
+///   ..
+/// \endcode
+class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
+  friend class ASTStmtReader;
+  friend class OMPExecutableDirective;
+
+  /// Offsets of child members.
+  enum {
+PreInitsOffset = 0,
+TransformedStmtOffset,
+  };
+
+  explicit OMPInterchangeDirective(SourceLocation StartLoc,
+   SourceLocation EndLoc, unsigned NumLoops)
+  : OMPLoopTransformationDirective(OMPInterchangeDirectiveClass,
+   llvm::omp::OMPD_interchange, StartLoc,
+   EndLoc, NumLoops) {
+setNumGeneratedLoops(3 * NumLoops);
+  }
+

[llvm-branch-commits] [clang] [llvm] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-modules

Author: Michael Kruse (Meinersbur)


Changes

Add the interchange directive which will be introduced in the upcoming OpenMP 
6.0 specification. A preview has been published in [Technical Report 
12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf).

---

Patch is 185.81 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/93022.diff


30 Files Affected:

- (modified) clang/include/clang-c/Index.h (+4) 
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+3) 
- (modified) clang/include/clang/AST/StmtOpenMP.h (+75-1) 
- (modified) clang/include/clang/Basic/StmtNodes.td (+1) 
- (modified) clang/include/clang/Sema/SemaOpenMP.h (+6) 
- (modified) clang/include/clang/Serialization/ASTBitCodes.h (+1) 
- (modified) clang/lib/AST/StmtOpenMP.cpp (+20) 
- (modified) clang/lib/AST/StmtPrinter.cpp (+5) 
- (modified) clang/lib/AST/StmtProfile.cpp (+5) 
- (modified) clang/lib/Basic/OpenMPKinds.cpp (+3-1) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+3) 
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+10) 
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+1) 
- (modified) clang/lib/Parse/ParseOpenMP.cpp (+2) 
- (modified) clang/lib/Sema/SemaExceptionSpec.cpp (+1) 
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+162) 
- (modified) clang/lib/Sema/TreeTransform.h (+11) 
- (modified) clang/lib/Serialization/ASTReaderStmt.cpp (+11) 
- (modified) clang/lib/Serialization/ASTWriterStmt.cpp (+5) 
- (added) clang/test/OpenMP/interchange_ast_print.cpp (+135) 
- (added) clang/test/OpenMP/interchange_codegen.cpp (+1990) 
- (added) clang/test/OpenMP/interchange_messages.cpp (+77) 
- (modified) clang/tools/libclang/CIndex.cpp (+8) 
- (modified) clang/tools/libclang/CXCursor.cpp (+3) 
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+3) 
- (added) openmp/runtime/test/transform/interchange/foreach.cpp (+216) 
- (added) openmp/runtime/test/transform/interchange/intfor.c (+38) 
- (added) openmp/runtime/test/transform/interchange/iterfor.cpp (+222) 
- (added) 
openmp/runtime/test/transform/interchange/parallel-wsloop-collapse-foreach.cpp 
(+340) 
- (added) 
openmp/runtime/test/transform/interchange/parallel-wsloop-collapse-intfor.cpp 
(+106) 


``diff
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index c7d63818ece23..a79aafbf20222 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -2150,6 +2150,10 @@ enum CXCursorKind {
*/
   CXCursor_OMPReverseDirective = 307,
 
+  /** OpenMP interchange directive.
+   */
+  CXCursor_OMPInterchangeDirective = 308,
+
   /** OpenACC Compute Construct.
*/
   CXCursor_OpenACCComputeConstruct = 320,
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 06b29d59785f6..1bb167d7ddc3c 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3024,6 +3024,9 @@ DEF_TRAVERSE_STMT(OMPUnrollDirective,
 DEF_TRAVERSE_STMT(OMPReverseDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
+DEF_TRAVERSE_STMT(OMPInterchangeDirective,
+  { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
 DEF_TRAVERSE_STMT(OMPForDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
diff --git a/clang/include/clang/AST/StmtOpenMP.h 
b/clang/include/clang/AST/StmtOpenMP.h
index fb7f413162fad..01c8b8e1a9f5e 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -1009,7 +1009,7 @@ class OMPLoopTransformationDirective : public 
OMPLoopBasedDirective {
   static bool classof(const Stmt *T) {
 Stmt::StmtClass C = T->getStmtClass();
 return C == OMPTileDirectiveClass || C == OMPUnrollDirectiveClass ||
-   C == OMPReverseDirectiveClass;
+   C == OMPReverseDirectiveClass || C == OMPInterchangeDirectiveClass;
   }
 };
 
@@ -5777,6 +5777,80 @@ class OMPReverseDirective final : public 
OMPLoopTransformationDirective {
   }
 };
 
+/// Represents the '#pragma omp interchange' loop transformation directive.
+///
+/// \code{c}
+///   #pragma omp interchange
+///   for (int i = 0; i < m; ++i)
+/// for (int j = 0; j < n; ++j)
+///   ..
+/// \endcode
+class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
+  friend class ASTStmtReader;
+  friend class OMPExecutableDirective;
+
+  /// Offsets of child members.
+  enum {
+PreInitsOffset = 0,
+TransformedStmtOffset,
+  };
+
+  explicit OMPInterchangeDirective(SourceLocation StartLoc,
+   SourceLocation EndLoc, unsigned NumLoops)
+  : OMPLoopTransformationDirective(OMPInterchangeDirectiveClass,
+   llvm::omp::OMPD_interchange, StartLoc,
+   EndLoc, NumLoops) {
+setNumGeneratedLoops(3 * NumLoops);
+  }
+
+  void setPreInits(Stmt 

[llvm-branch-commits] [clang] [llvm] [openmp] [Clang][OpenMP] Add interchange directive (PR #93022)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur ready_for_review 
https://github.com/llvm/llvm-project/pull/93022
___
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] e8e53a5 - Revert "[libc++][vector] Inline remaining constructors filling vector with th…"

2024-05-22 Thread via llvm-branch-commits

Author: Vitaly Buka
Date: 2024-05-22T04:28:03-07:00
New Revision: e8e53a594603300ba9faf03ce3e4e157ee036feb

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

LOG: Revert "[libc++][vector] Inline remaining constructors filling vector with 
th…"

This reverts commit c7e9b4918e5bd4936dbc036ba65eae178f5cc994.

Added: 


Modified: 
libcxx/include/vector

Removed: 




diff  --git a/libcxx/include/vector b/libcxx/include/vector
index b190557fb7b7e..976bde9b9048c 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -424,36 +424,11 @@ public:
 #endif
   : __end_cap_(nullptr, __a) {
   }
-
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit 
vector(size_type __n) {
-auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-if (__n > 0) {
-  __vallocate(__n);
-  __construct_at_end(__n);
-}
-__guard.__complete();
-  }
-
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit 
vector(size_type __n);
 #if _LIBCPP_STD_VER >= 14
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit 
vector(size_type __n, const allocator_type& __a)
-  : __end_cap_(nullptr, __a) {
-auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-if (__n > 0) {
-  __vallocate(__n);
-  __construct_at_end(__n);
-}
-__guard.__complete();
-  }
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit 
vector(size_type __n, const allocator_type& __a);
 #endif
-
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, 
const value_type& __x) {
-auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-if (__n > 0) {
-  __vallocate(__n);
-  __construct_at_end(__n, __x);
-}
-__guard.__complete();
-  }
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, 
const value_type& __x);
 
   template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
   _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
@@ -1150,6 +1125,39 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, 
_Allocator>::__append(size_type _
   }
 }
 
+template 
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n) {
+  auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+  if (__n > 0) {
+__vallocate(__n);
+__construct_at_end(__n);
+  }
+  __guard.__complete();
+}
+
+#if _LIBCPP_STD_VER >= 14
+template 
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, 
const allocator_type& __a)
+: __end_cap_(nullptr, __a) {
+  auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+  if (__n > 0) {
+__vallocate(__n);
+__construct_at_end(__n);
+  }
+  __guard.__complete();
+}
+#endif
+
+template 
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, 
const value_type& __x) {
+  auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+  if (__n > 0) {
+__vallocate(__n);
+__construct_at_end(__n, __x);
+  }
+  __guard.__complete();
+}
+
 template 
 template ::value &&



___
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] [flang] [flang] Revise IDE folder structure (PR #89745)

2024-05-22 Thread David Truby via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/89745
___
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] [polly] [polly] Revise IDE folder structure (PR #89752)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/89752

>From a85a17723d76371ccc8feb245c455d6aaf2c297f Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Tue, 23 Apr 2024 13:19:16 +0200
Subject: [PATCH 1/3] [polly] Revise IDE folder structure

---
 polly/CMakeLists.txt   | 5 +++--
 polly/cmake/polly_macros.cmake | 2 +-
 polly/docs/CMakeLists.txt  | 1 +
 polly/lib/CMakeLists.txt   | 4 +---
 polly/test/CMakeLists.txt  | 7 ++-
 polly/unittests/CMakeLists.txt | 2 +-
 6 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index 5d0f2cd7f00ec..a0d1ab49e7837 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -4,6 +4,7 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   cmake_minimum_required(VERSION 3.20.0)
   set(POLLY_STANDALONE_BUILD TRUE)
 endif()
+set(LLVM_SUBPROJECT_TITLE "Polly")
 
 # Must go below project(..)
 include(GNUInstallDirs)
@@ -157,8 +158,8 @@ foreach (file IN LISTS files)
 endforeach ()
 
 add_custom_target(polly-check-format DEPENDS ${check_format_depends})
-set_target_properties(polly-check-format PROPERTIES FOLDER "Polly")
+set_target_properties(polly-check-format PROPERTIES FOLDER "Polly/Meta")
 
 add_custom_target(polly-update-format DEPENDS ${update_format_depends})
-set_target_properties(polly-update-format PROPERTIES FOLDER "Polly")
+set_target_properties(polly-update-format PROPERTIES FOLDER "Polly/Meta")
 
diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake
index df541eeccc4cb..b1bd1e1b03cda 100644
--- a/polly/cmake/polly_macros.cmake
+++ b/polly/cmake/polly_macros.cmake
@@ -21,7 +21,7 @@ macro(add_polly_library name)
 set(libkind)
   endif()
   add_library( ${name} ${libkind} ${srcs} )
-  set_target_properties(${name} PROPERTIES FOLDER "Polly")
+  set_target_properties(${name} PROPERTIES FOLDER "Polly/Libraries")
 
   if( LLVM_COMMON_DEPENDS )
 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
diff --git a/polly/docs/CMakeLists.txt b/polly/docs/CMakeLists.txt
index a1ef5ce5277f7..2bd16e53c542f 100644
--- a/polly/docs/CMakeLists.txt
+++ b/polly/docs/CMakeLists.txt
@@ -77,6 +77,7 @@ if (LLVM_ENABLE_DOXYGEN)
 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Generating polly doxygen documentation." VERBATIM)
+  set_target_properties(doxygen-polly PROPERTIES FOLDER "Polly/Docs")
 
   if (LLVM_BUILD_DOCS)
 add_dependencies(doxygen doxygen-polly)
diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt
index 4557878e515e6..f18cdcd09cfca 100644
--- a/polly/lib/CMakeLists.txt
+++ b/polly/lib/CMakeLists.txt
@@ -92,8 +92,6 @@ add_llvm_pass_plugin(Polly
   LINK_COMPONENTS
   ${POLLY_COMPONENTS}
   )
-set_target_properties(obj.Polly PROPERTIES FOLDER "Polly")
-set_target_properties(Polly PROPERTIES FOLDER "Polly")
 
 if (MSVC_IDE OR XCODE)
   # Configure source groups for Polly source files. By default, in the IDE 
there
@@ -120,7 +118,7 @@ if (WIN32 OR CYGWIN OR NOT LLVM_ENABLE_PIC)
   # Add dummy target, either because loadable modules are not supported
   # as on Windows or because PIC code has been disabled
   add_custom_target(LLVMPolly)
-  set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
+  set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly/Meta")
 else ()
   add_polly_loadable_module(LLVMPolly
 Plugin/Polly.cpp
diff --git a/polly/test/CMakeLists.txt b/polly/test/CMakeLists.txt
index 81cee34a780d6..338c7dbfa1158 100644
--- a/polly/test/CMakeLists.txt
+++ b/polly/test/CMakeLists.txt
@@ -1,7 +1,7 @@
 set(LLVM_SHLIBEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
 
 add_custom_target(check-polly)
-set_target_properties(check-polly PROPERTIES FOLDER "Polly")
+set_target_properties(check-polly PROPERTIES FOLDER "Polly/Tests")
 
 if(NOT LLVM_MAIN_SRC_DIR)
   find_program(LLVM_OPT NAMES opt HINTS ${LLVM_TOOLS_BINARY_DIR})
@@ -64,7 +64,6 @@ add_lit_testsuite(check-polly-tests "Running polly regression 
tests"
   polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
   DEPENDS ${POLLY_TEST_DEPS}
   )
-set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
 add_dependencies(check-polly check-polly-tests)
 
 configure_lit_site_cfg(
@@ -80,7 +79,6 @@ if (POLLY_GTEST_AVAIL)
 EXCLUDE_FROM_CHECK_ALL
 DEPENDS PollyUnitTests
 )
-  set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
 endif ()
 
 configure_file(
@@ -94,7 +92,6 @@ if (POLLY_BUNDLED_ISL)
 EXCLUDE_FROM_CHECK_ALL
 DEPENDS polly-isl-test
 )
-  set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
 endif (POLLY_BUNDLED_ISL)
 
 # Run polly-check-format as part of polly-check only if we are compiling with
@@ -114,5 +111,5 @@ configure_file(
 
 # Add a legacy target spelling: polly-test
 add_custom_target(polly-test)
-set_target_properties(polly-test PROPERTIES FOLDER "Polly")
+set_target_properties(polly-test 

[llvm-branch-commits] [mlir] [mlir] Revise IDE folder structure (PR #89749)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/89749

>From 82bac5ccd7d6d2b4e146ed4e383a8484e735606e Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Tue, 23 Apr 2024 13:08:54 +0200
Subject: [PATCH 1/3] [mlir] Revise IDE folder structure

---
 mlir/CMakeLists.txt| 9 ++---
 mlir/cmake/modules/AddMLIR.cmake   | 5 +++--
 mlir/docs/CMakeLists.txt   | 1 +
 mlir/examples/toy/CMakeLists.txt   | 2 +-
 mlir/examples/transform/CMakeLists.txt | 1 +
 mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt | 2 ++
 mlir/lib/TableGen/CMakeLists.txt   | 1 +
 mlir/test/CAPI/CMakeLists.txt  | 2 ++
 mlir/test/CMakeLists.txt   | 2 +-
 mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt  | 1 +
 mlir/tools/mlir-pdll/CMakeLists.txt| 1 -
 mlir/tools/mlir-tblgen/CMakeLists.txt  | 1 -
 mlir/unittests/CMakeLists.txt  | 2 --
 13 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 5c4301af040b4..0ff6658f831f5 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -1,5 +1,6 @@
 # MLIR project.
 cmake_minimum_required(VERSION 3.20.0)
+set(LLVM_SUBPROJECT_TITLE "MLIR")
 
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -96,12 +97,13 @@ endif()
 # tablegen'd targets.
 # mlir-generic-headers are dialect-independent.
 add_custom_target(mlir-generic-headers)
-set_target_properties(mlir-generic-headers PROPERTIES FOLDER "Misc")
+set_target_properties(mlir-generic-headers PROPERTIES FOLDER "MLIR/Resources")
 # mlir-headers may be dialect-dependent.
 add_custom_target(mlir-headers)
-set_target_properties(mlir-headers PROPERTIES FOLDER "Misc")
+set_target_properties(mlir-headers PROPERTIES FOLDER "MLIR/Resources")
 add_dependencies(mlir-headers mlir-generic-headers)
 add_custom_target(mlir-doc)
+set_target_properties(mlir-doc PROPERTIES FOLDER "MLIR/Docs")
 
 # Only enable execution engine if the native target is available.
 if(${LLVM_NATIVE_ARCH} IN_LIST LLVM_TARGETS_TO_BUILD)
@@ -198,6 +200,7 @@ add_subdirectory(lib/CAPI)
 if (MLIR_INCLUDE_TESTS)
   add_definitions(-DMLIR_INCLUDE_TESTS)
   add_custom_target(MLIRUnitTests)
+  set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR/Tests")
   if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
 add_subdirectory(unittests)
   else()
@@ -258,7 +261,7 @@ endif()
 
 # Custom target to install all mlir libraries
 add_custom_target(mlir-libraries)
-set_target_properties(mlir-libraries PROPERTIES FOLDER "Misc")
+set_target_properties(mlir-libraries PROPERTIES FOLDER "MLIR/Install")
 
 if (NOT LLVM_ENABLE_IDE)
   add_llvm_install_targets(install-mlir-libraries
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 1d2ed748bc2f1..5a9a5b799763a 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -173,6 +173,7 @@ function(add_mlir_doc doc_filename output_file 
output_directory command)
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${output_file}.md)
   add_custom_target(${output_file}DocGen DEPENDS ${GEN_DOC_FILE})
   add_dependencies(mlir-doc ${output_file}DocGen)
+  set_target_properties(${output_file}DocGen PROPERTIES FOLDER "MLIR/Docs")
 endfunction()
 
 # Sets ${srcs} to contain the list of additional headers for the target. Extra
@@ -252,7 +253,7 @@ function(add_mlir_example_library name)
   list(APPEND ARG_DEPENDS mlir-generic-headers)
 
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs} 
DEPENDS ${ARG_DEPENDS} LINK_COMPONENTS ${ARG_LINK_COMPONENTS} LINK_LIBS 
${ARG_LINK_LIBS})
-  set_target_properties(${name} PROPERTIES FOLDER "Examples")
+  set_target_properties(${name} PROPERTIES FOLDER "MLIR/Examples")
   if (LLVM_BUILD_EXAMPLES AND NOT ${ARG_DISABLE_INSTALL})
 add_mlir_library_install(${name})
   else()
@@ -329,7 +330,7 @@ function(add_mlir_library name)
 # Add empty "phony" target
 add_custom_target(${name})
   endif()
-  set_target_properties(${name} PROPERTIES FOLDER "MLIR libraries")
+  set_target_properties(${name} PROPERTIES FOLDER "MLIR/Libraries")
 
   # Setup aggregate.
   if(ARG_ENABLE_AGGREGATION)
diff --git a/mlir/docs/CMakeLists.txt b/mlir/docs/CMakeLists.txt
index 36cd3f9983881..43192569847cf 100644
--- a/mlir/docs/CMakeLists.txt
+++ b/mlir/docs/CMakeLists.txt
@@ -78,6 +78,7 @@ if (LLVM_ENABLE_DOXYGEN)
 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Generating mlir doxygen documentation." VERBATIM)
+  set_target_properties(doxygen-mlir PROPERTIES FOLDER "MLIR/Docs")
 
   if (LLVM_BUILD_DOCS)
 add_dependencies(doxygen doxygen-mlir)
diff --git a/mlir/examples/toy/CMakeLists.txt 

[llvm-branch-commits] [compiler-rt] [compiler-rt] Revise IDE folder structure (PR #89753)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/89753
___
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] [compiler-rt] Revise IDE folder structure (PR #89753)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/89753
___
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] [compiler-rt] Revise IDE folder structure (PR #89753)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/89753

>From 470842dbe4668a22349624e69d1d3decf00b1da6 Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Tue, 23 Apr 2024 13:15:38 +0200
Subject: [PATCH 1/2] [compiler-rt] Revise IDE folder structure

---
 compiler-rt/CMakeLists.txt|  3 ++-
 compiler-rt/cmake/Modules/AddCompilerRT.cmake | 19 ++-
 .../cmake/Modules/CompilerRTDarwinUtils.cmake |  4 ++--
 .../cmake/Modules/CompilerRTUtils.cmake   |  4 ++--
 compiler-rt/cmake/base-config-ix.cmake|  4 ++--
 compiler-rt/include/CMakeLists.txt|  2 +-
 compiler-rt/lib/asan/tests/CMakeLists.txt |  8 
 compiler-rt/lib/builtins/CMakeLists.txt   |  2 +-
 compiler-rt/lib/fuzzer/tests/CMakeLists.txt   |  6 +++---
 compiler-rt/lib/gwp_asan/tests/CMakeLists.txt |  4 ++--
 .../lib/interception/tests/CMakeLists.txt |  4 ++--
 compiler-rt/lib/memprof/tests/CMakeLists.txt  |  4 ++--
 compiler-rt/lib/orc/tests/CMakeLists.txt  |  6 +++---
 .../lib/sanitizer_common/tests/CMakeLists.txt |  4 ++--
 compiler-rt/lib/stats/CMakeLists.txt  |  2 +-
 compiler-rt/lib/tsan/CMakeLists.txt   |  2 +-
 compiler-rt/lib/tsan/dd/CMakeLists.txt|  2 +-
 compiler-rt/lib/tsan/rtl/CMakeLists.txt   |  2 +-
 compiler-rt/lib/xray/tests/CMakeLists.txt |  4 ++--
 compiler-rt/test/CMakeLists.txt   |  1 +
 compiler-rt/test/asan/CMakeLists.txt  |  3 ---
 compiler-rt/test/asan_abi/CMakeLists.txt  |  1 -
 compiler-rt/test/builtins/CMakeLists.txt  |  1 -
 compiler-rt/test/cfi/CMakeLists.txt   |  3 ---
 compiler-rt/test/dfsan/CMakeLists.txt |  1 -
 compiler-rt/test/fuzzer/CMakeLists.txt|  1 -
 compiler-rt/test/gwp_asan/CMakeLists.txt  |  1 -
 compiler-rt/test/hwasan/CMakeLists.txt|  2 --
 compiler-rt/test/interception/CMakeLists.txt  |  1 -
 compiler-rt/test/lsan/CMakeLists.txt  |  1 -
 compiler-rt/test/memprof/CMakeLists.txt   |  3 ---
 compiler-rt/test/metadata/CMakeLists.txt  |  1 -
 compiler-rt/test/msan/CMakeLists.txt  |  1 -
 compiler-rt/test/orc/CMakeLists.txt   |  1 -
 compiler-rt/test/profile/CMakeLists.txt   |  1 -
 compiler-rt/test/safestack/CMakeLists.txt |  1 -
 .../test/sanitizer_common/CMakeLists.txt  |  2 --
 .../test/shadowcallstack/CMakeLists.txt   |  1 -
 compiler-rt/test/tsan/CMakeLists.txt  |  1 -
 compiler-rt/test/ubsan/CMakeLists.txt |  2 --
 compiler-rt/test/ubsan_minimal/CMakeLists.txt |  1 -
 compiler-rt/test/xray/CMakeLists.txt  |  1 -
 42 files changed, 45 insertions(+), 73 deletions(-)

diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 6ce451e3cac2e..65063e0057bbc 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -4,6 +4,7 @@
 # based on the ability of the host toolchain to target various platforms.
 
 cmake_minimum_required(VERSION 3.20.0)
+set(LLVM_SUBPROJECT_TITLE "Compiler-RT")
 
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -90,7 +91,7 @@ if (COMPILER_RT_STANDALONE_BUILD)
   if (TARGET intrinsics_gen)
 # Loading the llvm config causes this target to be imported so place it
 # under the appropriate folder in an IDE.
-set_target_properties(intrinsics_gen PROPERTIES FOLDER "Compiler-RT Misc")
+set_target_properties(intrinsics_gen PROPERTIES FOLDER "LLVM/Tablegenning")
   endif()
 
   find_package(Python3 COMPONENTS Interpreter)
diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 75b34c8e27e00..9be8ef1b362d8 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -91,7 +91,7 @@ function(add_compiler_rt_object_libraries name)
   ${extra_cflags_${libname}} ${target_flags})
 set_property(TARGET ${libname} APPEND PROPERTY
   COMPILE_DEFINITIONS ${LIB_DEFS})
-set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Libraries")
+set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT/Libraries")
 if(APPLE)
   set_target_properties(${libname} PROPERTIES
 OSX_ARCHITECTURES "${LIB_ARCHS_${libname}}")
@@ -110,7 +110,7 @@ endmacro()
 
 function(add_compiler_rt_component name)
   add_custom_target(${name})
-  set_target_properties(${name} PROPERTIES FOLDER "Compiler-RT Misc")
+  set_target_properties(${name} PROPERTIES FOLDER "Compiler-RT/Components")
   if(COMMAND runtime_register_component)
 runtime_register_component(${name})
   endif()
@@ -293,7 +293,7 @@ function(add_compiler_rt_runtime name type)
 if(NOT TARGET ${LIB_PARENT_TARGET})
   add_custom_target(${LIB_PARENT_TARGET})
   set_target_properties(${LIB_PARENT_TARGET} PROPERTIES
-FOLDER "Compiler-RT Misc")
+FOLDER "Compiler-RT/Runtimes")

[llvm-branch-commits] [llvm] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -1012,25 +1014,37 @@ bool 
AArch64CallLowering::isEligibleForTailCallOptimization(
 }
 
 static unsigned getCallOpcode(const MachineFunction , bool IsIndirect,
-  bool IsTailCall) {
+  bool IsTailCall,
+  std::optional 
,
+  MachineRegisterInfo ) {
   const AArch64FunctionInfo *FuncInfo = CallerF.getInfo();
 
-  if (!IsTailCall)
-return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL;
+  if (!IsTailCall) {
+if (!PAI)
+  return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL;

kovdan01 wrote:

Explicit cast to `unsigned` does not look necessary - the `AArch64::BL` is an 
unscoped enum with no explicit underlying type set, and the value would be 
casted to the function return type `unsigned` w/o the explicit cast. If there 
is some strong reason to have this explicit cast (please let me know if so), it 
should also be used below for `return AArch64::BLRA;` to keep things consistent.

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -8640,6 +8642,15 @@ void SelectionDAGBuilder::LowerCallTo(const CallBase 
, SDValue Callee,
   CB.countOperandBundlesOfType(LLVMContext::OB_preallocated) != 0)
   .setCFIType(CFIType)
   .setConvergenceControlToken(ConvControlToken);
+
+  // Set the pointer authentication info if we have it.
+  if (PAI) {
+if (!TLI.supportPtrAuthBundles())
+  report_fatal_error(

kovdan01 wrote:

Please add a test for the error message

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -8410,17 +8447,57 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo ,
 InGlue = Chain.getValue(1);
   }
 
+  unsigned Opc = IsTailCall ? AArch64ISD::TC_RETURN : AArch64ISD::CALL;
+
   std::vector Ops;
   Ops.push_back(Chain);
   Ops.push_back(Callee);
 
+  // Calls with operand bundle "clang.arc.attachedcall" are special. They 
should
+  // be expanded to the call, directly followed by a special marker sequence 
and
+  // a call to an ObjC library function.  Use CALL_RVMARKER to do that.
+  if (CLI.CB && objcarc::hasAttachedCallOpBundle(CLI.CB)) {
+assert(!IsTailCall &&
+   "tail calls cannot be marked with clang.arc.attachedcall");
+Opc = AArch64ISD::CALL_RVMARKER;
+
+// Add a target global address for the retainRV/claimRV runtime function
+// just before the call target.
+Function *ARCFn = *objcarc::getAttachedARCFunction(CLI.CB);
+auto GA = DAG.getTargetGlobalAddress(ARCFn, DL, PtrVT);
+Ops.insert(Ops.begin() + 1, GA);
+  } else if (CallConv == CallingConv::ARM64EC_Thunk_X64) {
+Opc = AArch64ISD::CALL_ARM64EC_TO_X64;
+  } else if (GuardWithBTI)

kovdan01 wrote:

Previous parts of if/else chain use braces, so use them here as well. See 
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements:

> readability is also harmed if an if/else chain does not use braced bodies for 
> either all or none of its members

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -1694,6 +1718,35 @@ let Predicates = [HasPAuth] in {
 def BLRABZ  : AuthOneOperand<0b001, 1, "blrabz">;
   }
 
+  // BLRA pseudo, generalized version of BLRAA/BLRAB/Z.
+  // This directly manipulates x16/x17, which are the only registers the OS
+  // guarantees are safe to use for sensitive operations.

kovdan01 wrote:

A link to the docs/spec with such info would be nice to have

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -1769,6 +1775,39 @@ void AArch64AsmPrinter::emitPtrauthAuthResign(const 
MachineInstr *MI) {
 OutStreamer->emitLabel(EndSym);
 }
 
+void AArch64AsmPrinter::emitPtrauthBranch(const MachineInstr *MI) {
+  unsigned InstsEmitted = 0;
+
+  unsigned BrTarget = MI->getOperand(0).getReg();
+  auto Key = (AArch64PACKey::ID)MI->getOperand(1).getImm();

kovdan01 wrote:

There is an assertion against `Disc` that it fits 16 bits, we probably want to 
have an assertion against `Key` as well. For example, in 
`AArch64AsmPrinter::emitInstruction` below this approach is already used - we 
first store the `Key` as `uint64_t` and then check that it's value is valid.

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -0,0 +1,183 @@
+; RUN: llc -mtriple arm64e-apple-darwin -o - -global-isel -global-isel-abort=1 
-verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK

kovdan01 wrote:

Please also add tests for ELF: `-mtriple aarch64 -mattr=+pauth`. Check 
directives are going be different for some cases, for example, personality 
encoding would be different, assembly syntax would have minor differences like 
comment style, function prologue/epilogue might change if we do not need to 
save frame pointer, labels might have different names, etc.

The call lowering itself looks agnostic to specific triple, but IMHO there 
should be tests which check that it works both for Apple triples and for a 
generic ELF triple. Also applies to other test files

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -1909,9 +1948,60 @@ void AArch64AsmPrinter::emitInstruction(const 
MachineInstr *MI) {
 emitPtrauthAuthResign(MI);
 return;
 
+  case AArch64::BLRA:
+emitPtrauthBranch(MI);
+return;
+
   // Tail calls use pseudo instructions so they have the proper code-gen
   // attributes (isCall, isReturn, etc.). We lower them to the real
   // instruction here.
+  case AArch64::AUTH_TCRETURN:
+  case AArch64::AUTH_TCRETURN_BTI: {
+const uint64_t Key = MI->getOperand(2).getImm();
+assert(Key < 2 && "Unknown key kind for authenticating tail-call return");

kovdan01 wrote:

There are many assertions and if statements all around the code which try to 
check that key is either IA or IB. They look inconsistent: sometimes we have 
`Key < 2`, sometimes `Key == 0 || Key == 1', sometimes `Key > 1` (for an 
opposite check). I like the approach from 
`AArch64AsmPrinter::emitPtrauthBranch`:

```
  assert((Key == AArch64PACKey::IA || Key == AArch64PACKey::IB) &&
 "Invalid auth call key");`
```

It does not rely on magic constants and it's our intentions are clear. The 
check might be moved to a small helper, it'll be probably more handy to use it 
everywhere. Please make assertions and if statements checking the key against 
IA or IB consistent with each other.

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -1909,9 +1948,60 @@ void AArch64AsmPrinter::emitInstruction(const 
MachineInstr *MI) {
 emitPtrauthAuthResign(MI);
 return;
 
+  case AArch64::BLRA:
+emitPtrauthBranch(MI);
+return;
+
   // Tail calls use pseudo instructions so they have the proper code-gen
   // attributes (isCall, isReturn, etc.). We lower them to the real
   // instruction here.
+  case AArch64::AUTH_TCRETURN:
+  case AArch64::AUTH_TCRETURN_BTI: {
+const uint64_t Key = MI->getOperand(2).getImm();
+assert(Key < 2 && "Unknown key kind for authenticating tail-call return");
+const uint64_t Disc = MI->getOperand(3).getImm();
+Register AddrDisc = MI->getOperand(4).getReg();
+
+Register ScratchReg = MI->getOperand(0).getReg() == AArch64::X16
+  ? AArch64::X17
+  : AArch64::X16;
+
+unsigned DiscReg = AddrDisc;
+if (Disc) {
+  assert(isUInt<16>(Disc) && "Integer discriminator is too wide");
+
+  if (AddrDisc != AArch64::NoRegister) {
+EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::ORRXrs)
+ .addReg(ScratchReg)
+ .addReg(AArch64::XZR)
+ .addReg(AddrDisc)
+ .addImm(0));
+EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::MOVKXi)
+ .addReg(ScratchReg)
+ .addReg(ScratchReg)
+ .addImm(Disc)
+ .addImm(/*shift=*/48));
+  } else {
+EmitToStreamer(*OutStreamer, MCInstBuilder(AArch64::MOVZXi)
+ .addReg(ScratchReg)
+ .addImm(Disc)
+ .addImm(/*shift=*/0));
+  }
+  DiscReg = ScratchReg;
+}
+
+const bool isZero = DiscReg == AArch64::NoRegister;

kovdan01 wrote:

```suggestion
const bool IsZero = DiscReg == AArch64::NoRegister;
```

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -0,0 +1,183 @@
+; RUN: llc -mtriple arm64e-apple-darwin -o - -global-isel -global-isel-abort=1 
-verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK

kovdan01 wrote:

`--check-prefixes=CHECK` is not necessary (at least now, when no other RUN 
lines are present)

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -1012,25 +1014,37 @@ bool 
AArch64CallLowering::isEligibleForTailCallOptimization(
 }
 
 static unsigned getCallOpcode(const MachineFunction , bool IsIndirect,
-  bool IsTailCall) {
+  bool IsTailCall,
+  std::optional 
,
+  MachineRegisterInfo ) {
   const AArch64FunctionInfo *FuncInfo = CallerF.getInfo();
 
-  if (!IsTailCall)
-return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL;
+  if (!IsTailCall) {
+if (!PAI)
+  return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL;
+
+assert(IsIndirect && "authenticated direct call");
+assert(PAI->Key == 0 || PAI->Key == 1 && "invalid ptrauth key");
+return AArch64::BLRA;
+  }
 
   if (!IsIndirect)
 return AArch64::TCRETURNdi;
 
-  // When BTI or PAuthLR are enabled, there are restrictions on using x16 and
-  // x17 to hold the function pointer.
+  // When BTI is enabled, we need to use TCRETURNriBTI to make sure that we use
+  // x16 or x17.
   if (FuncInfo->branchTargetEnforcement()) {
-if (FuncInfo->branchProtectionPAuthLR())
+if (PAI)
+  return AArch64::AUTH_TCRETURN_BTI;
+else if (FuncInfo->branchProtectionPAuthLR())

kovdan01 wrote:

Do not use else after return 
https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits

https://github.com/kovdan01 edited 
https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits


@@ -8410,17 +8447,57 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo ,
 InGlue = Chain.getValue(1);
   }
 
+  unsigned Opc = IsTailCall ? AArch64ISD::TC_RETURN : AArch64ISD::CALL;
+
   std::vector Ops;
   Ops.push_back(Chain);
   Ops.push_back(Callee);
 
+  // Calls with operand bundle "clang.arc.attachedcall" are special. They 
should
+  // be expanded to the call, directly followed by a special marker sequence 
and
+  // a call to an ObjC library function.  Use CALL_RVMARKER to do that.
+  if (CLI.CB && objcarc::hasAttachedCallOpBundle(CLI.CB)) {
+assert(!IsTailCall &&
+   "tail calls cannot be marked with clang.arc.attachedcall");
+Opc = AArch64ISD::CALL_RVMARKER;
+
+// Add a target global address for the retainRV/claimRV runtime function
+// just before the call target.
+Function *ARCFn = *objcarc::getAttachedARCFunction(CLI.CB);
+auto GA = DAG.getTargetGlobalAddress(ARCFn, DL, PtrVT);
+Ops.insert(Ops.begin() + 1, GA);
+  } else if (CallConv == CallingConv::ARM64EC_Thunk_X64) {
+Opc = AArch64ISD::CALL_ARM64EC_TO_X64;
+  } else if (GuardWithBTI)
+Opc = AArch64ISD::CALL_BTI;
+
   if (IsTailCall) {
 // Each tail call may have to adjust the stack by a different amount, so
 // this information must travel along with the operation for eventual
 // consumption by emitEpilogue.
 Ops.push_back(DAG.getTargetConstant(FPDiff, DL, MVT::i32));
   }
 
+  if (CLI.PAI) {
+const uint64_t Key = CLI.PAI->Key;
+// Authenticated calls only support IA and IB.
+if (Key > 1)
+  report_fatal_error("Unsupported key kind for authenticating call");

kovdan01 wrote:

Please add a test for the error message

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-22 Thread Daniil Kovalev via llvm-branch-commits

https://github.com/kovdan01 requested changes to this pull request.


https://github.com/llvm/llvm-project/pull/85736
___
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] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/89750
___
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] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-22 Thread Michael Kruse via llvm-branch-commits


@@ -126,6 +126,7 @@ macro(libomp_test_touch_recipe test_touch_dir)
 endmacro()
 libomp_append(libomp_test_touch_env "KMP_VERSION=1")
 add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
+set_target_properties(libomp-test-touch PROPERTIES FOLDER "OpenMP/Tests")

Meinersbur wrote:

 * The subproject's directory name is 
[`openmp`](https://github.com/llvm/llvm-project/tree/main/openmp)
 * The [README 
](https://github.com/llvm/llvm-project/blob/89c23f7683efbdf896670218be9095d57ae3e348/openmp/README.rst?plain=1#L2)
 calls it "LLVM OpenMP Libraries".
 * The website is [*openmp*.llvm.org](https://openmp.llvm.org/), and libomp is 
not even mentioned. Its title is "LLVM/OpenMP", I think we can drop the "LLVM" 
prefix within the LLVM repository.
 * `libompd`, `libomptarget` (formerly), `omp.h`, Archer, and ompopt 
documentation lives in there too, i.e. this is not the subproject for just 
libomp.

The folder names require an IDE what display them, none of them are available 
for Linux. They are also not directories in the filesystem, case should not 
matter.

I could call it "OpenMP Libraries" if that makes it clearer.

https://github.com/llvm/llvm-project/pull/89750
___
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] [BOLT] Revise IDE folder structure (PR #89742)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/89742

>From 140a539c9e3248b128bdffdbc9ae5e2e8b4366c0 Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Tue, 23 Apr 2024 13:23:47 +0200
Subject: [PATCH 1/3] [bolt] Revise IDE folder structure

---
 bolt/CMakeLists.txt  | 2 ++
 bolt/cmake/modules/AddBOLT.cmake | 1 -
 bolt/docs/CMakeLists.txt | 1 +
 bolt/test/CMakeLists.txt | 3 +--
 bolt/unittests/CMakeLists.txt| 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index cc3a70fa35e0a..26df6a4208b7a 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -1,3 +1,5 @@
+set(LLVM_SUBPROJECT_TITLE "BOLT")
+
 include(ExternalProject)
 
 set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/bolt/cmake/modules/AddBOLT.cmake b/bolt/cmake/modules/AddBOLT.cmake
index 1f69b9046320a..c7ac662c6b121 100644
--- a/bolt/cmake/modules/AddBOLT.cmake
+++ b/bolt/cmake/modules/AddBOLT.cmake
@@ -3,7 +3,6 @@ include(LLVMDistributionSupport)
 
 macro(add_bolt_executable name)
   add_llvm_executable(${name} ${ARGN})
-  set_target_properties(${name} PROPERTIES FOLDER "BOLT")
 endmacro()
 
 macro(add_bolt_tool name)
diff --git a/bolt/docs/CMakeLists.txt b/bolt/docs/CMakeLists.txt
index b230512fe5717..12ae852566785 100644
--- a/bolt/docs/CMakeLists.txt
+++ b/bolt/docs/CMakeLists.txt
@@ -79,6 +79,7 @@ if (LLVM_ENABLE_DOXYGEN)
 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Generating bolt doxygen documentation." VERBATIM)
+  set_target_properties(doxygen-bolt PROPERTIES FOLDER "BOLT/Docs")
 
   if (LLVM_BUILD_DOCS)
 add_dependencies(doxygen doxygen-bolt)
diff --git a/bolt/test/CMakeLists.txt b/bolt/test/CMakeLists.txt
index 89862fd59eb8e..d468ff984840f 100644
--- a/bolt/test/CMakeLists.txt
+++ b/bolt/test/CMakeLists.txt
@@ -56,7 +56,7 @@ list(APPEND BOLT_TEST_DEPS
   )
 
 add_custom_target(bolt-test-depends DEPENDS ${BOLT_TEST_DEPS})
-set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT")
+set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT/Tests")
 
 add_lit_testsuite(check-bolt "Running the BOLT regression tests"
   ${CMAKE_CURRENT_BINARY_DIR}
@@ -64,7 +64,6 @@ add_lit_testsuite(check-bolt "Running the BOLT regression 
tests"
   DEPENDS ${BOLT_TEST_DEPS}
   ARGS ${BOLT_TEST_EXTRA_ARGS}
   )
-set_target_properties(check-bolt PROPERTIES FOLDER "BOLT")
 
 add_lit_testsuites(BOLT ${CMAKE_CURRENT_SOURCE_DIR}
   PARAMS ${BOLT_TEST_PARAMS}
diff --git a/bolt/unittests/CMakeLists.txt b/bolt/unittests/CMakeLists.txt
index 77159e92dec55..64414b83d39fe 100644
--- a/bolt/unittests/CMakeLists.txt
+++ b/bolt/unittests/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_custom_target(BoltUnitTests)
-set_target_properties(BoltUnitTests PROPERTIES FOLDER "BOLT tests")
+set_target_properties(BoltUnitTests PROPERTIES FOLDER "BOLT/Tests")
 
 function(add_bolt_unittest test_dirname)
   add_unittest(BoltUnitTests ${test_dirname} ${ARGN})

>From ad704f8babf3c065d928329bf6f663b995f7323e Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Tue, 21 May 2024 22:05:54 +0200
Subject: [PATCH 2/3] Finetune BOLT folders

---
 bolt/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index 26df6a4208b7a..3c1fe967d6597 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -123,7 +123,7 @@ option(BOLT_BUILD_TOOLS
   "Build the BOLT tools. If OFF, just generate build targets." ON)
 
 add_custom_target(bolt)
-set_target_properties(bolt PROPERTIES FOLDER "BOLT")
+set_target_properties(bolt PROPERTIES FOLDER "BOLT/Meta")
 add_llvm_install_targets(install-bolt DEPENDS bolt COMPONENT bolt)
 
 include_directories(

>From 32db9e656f955cc0b6f1aecc61cb115d91cbbbce Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Wed, 22 May 2024 09:39:03 +0200
Subject: [PATCH 3/3] Use 'Metatarget' to disambiguiate from the company name

---
 bolt/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index 3c1fe967d6597..74907ad118d12 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -123,7 +123,7 @@ option(BOLT_BUILD_TOOLS
   "Build the BOLT tools. If OFF, just generate build targets." ON)
 
 add_custom_target(bolt)
-set_target_properties(bolt PROPERTIES FOLDER "BOLT/Meta")
+set_target_properties(bolt PROPERTIES FOLDER "BOLT/Metatargets")
 add_llvm_install_targets(install-bolt DEPENDS bolt COMPONENT bolt)
 
 include_directories(

___
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] [BOLT] Revise IDE folder structure (PR #89742)

2024-05-22 Thread Michael Kruse via llvm-branch-commits


@@ -121,7 +123,7 @@ option(BOLT_BUILD_TOOLS
   "Build the BOLT tools. If OFF, just generate build targets." ON)
 
 add_custom_target(bolt)
-set_target_properties(bolt PROPERTIES FOLDER "BOLT")
+set_target_properties(bolt PROPERTIES FOLDER "BOLT/Meta")

Meinersbur wrote:

This is not supposed to be the company name, but meta in the sense of 
[self-referential](https://en.wikipedia.org/wiki/Meta_(prefix)). That is, 
targets that only exists to trigger the build of other targets. In this case, 
all of BOLT (as in `make all` if BOLT was its own build system). "Metatarget" 
would disambiguate the meaning.

An alternative could be 
"[Phony](https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html)".

https://github.com/llvm/llvm-project/pull/89742
___
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] [BOLT] Revise IDE folder structure (PR #89742)

2024-05-22 Thread Michael Kruse via llvm-branch-commits

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