[llvm-branch-commits] [clang] [llvm] [LLVM][PassBuilder] Extend the function signature of callback for optimizer pipeline extension point (PR #100953)

2024-07-29 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic commented:

This seems fine to me in general. The patch stack seems to be messed up though, 
or at least this seems to contain some unrelated AMDGPU changes.

@jdoerfert Possibly the issue you saw is that this callback just isn't used by 
the post-link full LTO pipeline at all? It uses 
invokeFullLinkTimeOptimizationLastEPCallbacks instead. Maybe with this change 
it would make sense to remove that one and merge it into the main 
OptimizerLastEPCallback with the appropriate LTOPhase?

The other thing I wonder about is whether this argument should be added to 
other callbacks as well for consistency.

https://github.com/llvm/llvm-project/pull/100953
___
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] [LLVM][PassBuilder] Extend the function signature of callback for optimizer pipeline extension point (PR #100953)

2024-07-29 Thread Nikita Popov via llvm-branch-commits


@@ -2159,7 +2161,7 @@ ModulePassManager 
PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
   CoroPM.addPass(GlobalDCEPass());
   MPM.addPass(CoroConditionalWrapper(std::move(CoroPM)));
 
-  invokeOptimizerLastEPCallbacks(MPM, Level);
+  invokeOptimizerLastEPCallbacks(MPM, Level, ThinOrFullLTOPhase::None);

nikic wrote:

This doesn't look right. We should pass ThinOrFullLTOPhase through to 
buildO0DefaultPipeline.

https://github.com/llvm/llvm-project/pull/100953
___
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] [LLVM][PassBuilder] Extend the function signature of callback for optimizer pipeline extension point (PR #100953)

2024-07-29 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/100953
___
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] [InstCombine][asan] Don't speculate loads before `select ptr` (PR #100773)

2024-07-26 Thread Nikita Popov via llvm-branch-commits


@@ -1042,8 +1042,8 @@ Instruction *InstCombinerImpl::visitLoadInst(LoadInst 
) {
   }
 
   // None of the following transforms are legal for volatile/ordered atomic
-  // loads.  Most of them do apply for unordered atomics.
-  if (!LI.isUnordered()) return nullptr;
+  // loads and sanitizers.  Most of them do apply for unordered atomics.
+  if (mustSuppressSpeculation(LI)) return nullptr;

nikic wrote:

Can we move this check to where it is relevant, i.e. the select fold in 
particular?

Also, should this check be inside isSafeToLoadUnconditionally maybe?

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


[llvm-branch-commits] [llvm] release/19.x: Revert " [LICM] Fold associative binary ops to promote code hoisting (#81608)" (PR #100094)

2024-07-23 Thread Nikita Popov via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/100094
___
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] [LV] Disable VPlan-based cost model for 19.x release. (PR #100097)

2024-07-23 Thread Nikita Popov via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/100097
___
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] [Hashing] Use a non-deterministic seed if LLVM_ENABLE_ABI_BREAKING_CHECKS (PR #96282)

2024-06-27 Thread Nikita Popov via llvm-branch-commits

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

LGTM, but please wait a bit in case there is more feedback.

https://github.com/llvm/llvm-project/pull/96282
___
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] [Hashing] Use a non-deterministic seed if LLVM_ENABLE_ABI_BREAKING_CHECKS (PR #96282)

2024-06-27 Thread Nikita Popov via llvm-branch-commits


@@ -322,24 +306,20 @@ struct hash_state {
   }
 };
 
-
-/// A global, fixed seed-override variable.
-///
-/// This variable can be set using the \see llvm::set_fixed_execution_seed
-/// function. See that function for details. Do not, under any circumstances,
-/// set or read this variable.
-extern uint64_t fixed_seed_override;
-
+/// In LLVM_ENABLE_ABI_BREAKING_CHECKS builds, the seed is non-deterministic
+/// (address of a variable) to prevent having users depend on the particular
+/// hash values. On platforms without ASLR, this is still likely
+/// non-deterministic per build.
 inline uint64_t get_execution_seed() {
-  // FIXME: This needs to be a per-execution seed. This is just a placeholder
-  // implementation. Switching to a per-execution seed is likely to flush out
-  // instability bugs and so will happen as its own commit.
-  //
-  // However, if there is a fixed seed override set the first time this is
-  // called, return that instead of the per-execution seed.
-  const uint64_t seed_prime = 0xff51afd7ed558ccdULL;
-  static uint64_t seed = fixed_seed_override ? fixed_seed_override : 
seed_prime;
-  return seed;
+  [[maybe_unused]] static const char seed = 0;

nikic wrote:

Move this inside the `#if`?

https://github.com/llvm/llvm-project/pull/96282
___
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] [Hashing] Use a non-deterministic seed (PR #96282)

2024-06-21 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic commented:

I like the idea, but I'm not sure this should be always enabled. This sounds 
like a lot of debugging fun when a seed-dependent case is not caught in testing.

Can we have this part of LLVM_REVERSE_ITERATION instead, which is used to 
detect similar hash iteration stability issues? We have a build bot for it.

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


[llvm-branch-commits] [llvm] release/18.x: [SystemZ] Bugfix in getDemandedSrcElements(). (#88623) (PR #95463)

2024-06-18 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@tstellar Per 
https://github.com/llvm/llvm-project/issues/95454#issuecomment-2166748656 this 
is not an LLVM 18 regression, so I'm not sure it counts as critical. The fix 
does look safe though.

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


[llvm-branch-commits] [llvm] release/18.x: [PPCMergeStringPool] Only replace constant once (#92996) (PR #93442)

2024-06-04 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

> What release note should we use for this change?

Something like this maybe?

> Fix a regression from the 18.1.6 release, which could result in compiler 
> crashes in the PPCMergeStringPool pass when compiling for PowerPC targets.

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


[llvm-branch-commits] [llvm] release/18.x: [RISCV] Re-separate unaligned scalar and vector memory features in the backend. (PR #92143)

2024-05-17 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

The approach looks reasonable to me. 

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


[llvm-branch-commits] [llvm] release/18.x: InstCombine: Process addrspacecast uses in PointerReplacer (#91953) (PR #92479)

2024-05-17 Thread Nikita Popov via llvm-branch-commits

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

There are test failures.

Generally I don't have enough confidence in this change for a last-minute 
backport.

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Drop nuw flag when CtlzOp is a sub nuw (#91776) (PR #91917)

2024-05-15 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


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

2024-05-15 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@tstellar AtariDreams is requesting backports for random commits that somehow 
mention miscompilations or crashes, without having any understanding of what 
the changes are about or how they relate to other changes. They have submitted 
a large amount of invalid or nonsensical backports for that reason, despite 
many requests to stop doing so. When there is any doubt, you should not merge 
backport PRs created by this user. That said, this specific one does look 
harmless to me.

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


[llvm-branch-commits] [llvm] release/18.x: [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

2024-05-15 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Drop nuw flag when CtlzOp is a sub nuw (#91776) (PR #91917)

2024-05-14 Thread Nikita Popov via llvm-branch-commits


@@ -284,6 +284,42 @@ define <4 x i32> @bit_ceil_v4i32(<4 x i32> %x) {
   ret <4 x i32> %sel
 }
 
+define i32 @pr91691(i32 %0) {
+; CHECK-LABEL: @pr91691(
+; CHECK-NEXT:[[TMP2:%.*]] = sub i32 -2, [[TMP0:%.*]]
+; CHECK-NEXT:[[TMP3:%.*]] = tail call range(i32 0, 33) i32 
@llvm.ctlz.i32(i32 [[TMP2]], i1 false)
+; CHECK-NEXT:[[TMP4:%.*]] = sub nsw i32 0, [[TMP3]]
+; CHECK-NEXT:[[TMP5:%.*]] = and i32 [[TMP4]], 31
+; CHECK-NEXT:[[TMP6:%.*]] = shl nuw i32 1, [[TMP5]]
+; CHECK-NEXT:ret i32 [[TMP6]]
+;
+  %2 = sub nuw i32 -2, %0
+  %3 = tail call i32 @llvm.ctlz.i32(i32 %2, i1 false)
+  %4 = sub i32 32, %3
+  %5 = shl i32 1, %4
+  %6 = icmp ult i32 %0, -2
+  %7 = select i1 %6, i32 %5, i32 1
+  ret i32 %7
+}
+
+define i32 @pr91691_keep_nsw(i32 %0) {
+; CHECK-LABEL: @pr91691_keep_nsw(
+; CHECK-NEXT:[[TMP2:%.*]] = sub nsw i32 -2, [[TMP0:%.*]]
+; CHECK-NEXT:[[TMP3:%.*]] = tail call range(i32 0, 33) i32 
@llvm.ctlz.i32(i32 [[TMP2]], i1 false)
+; CHECK-NEXT:[[TMP4:%.*]] = sub nsw i32 0, [[TMP3]]
+; CHECK-NEXT:[[TMP5:%.*]] = and i32 [[TMP4]], 31
+; CHECK-NEXT:[[TMP6:%.*]] = shl nuw i32 1, [[TMP5]]
+; CHECK-NEXT:ret i32 [[TMP6]]
+;
+  %2 = sub nsw i32 -2, %0
+  %3 = tail call i32 @llvm.ctlz.i32(i32 %2, i1 false)
+  %4 = sub i32 32, %3
+  %5 = shl i32 1, %4
+  %6 = icmp ult i32 %0, -2
+  %7 = select i1 %6, i32 %5, i32 1
+  ret i32 %7
+}
+

nikic wrote:

@tstellar Is it possible to add some additional permission to the fine-grained 
token to make this work? I wasn't able to find any docs on the interaction of 
fine-grained tokens and maintainer_can_modify.

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


[llvm-branch-commits] [clang] [llvm] release/18.x: [RISCV] Re-separate unaligned scalar and vector memory features in the backend. (PR #92143)

2024-05-14 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@topperc Yes, it has been changed back for LLVM 19. See 
https://github.com/rust-lang/rust/blob/8387315ab3c26a57a1f53a90f188f0bc88514bca/compiler/rustc_codegen_llvm/src/llvm_util.rs#L273-L277

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


[llvm-branch-commits] [llvm] release/18.x: [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

2024-05-14 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

The size of the structure doesn't change, but the initialization requirements 
and the meaning of the members do. Given that this doesn't seem to address any 
real-world issue, I think it's safer not to backport this into the last 18.1 
point release.

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


[llvm-branch-commits] [clang] [llvm] release/18.x: [RISCV] Re-separate unaligned scalar and vector memory features in the backend. (PR #92143)

2024-05-14 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

Note that backporting this may require changes for LLVM users (I know that it 
will require rustc changes at least). This may not be a good candidate for the 
last 18.1 point release.

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


[llvm-branch-commits] [llvm] release/18.x Revert "[SLP]Fix a crash if the argument of call was affected by minbitwidth analysis." (PR #91682)

2024-05-14 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

This is probably more of a question for @alexey-bataev.

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


[llvm-branch-commits] [llvm] release/18.x Revert "[SLP]Fix a crash if the argument of call was affected by minbitwidth analysis." (PR #91682)

2024-05-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [libcxx] release/18.x: change the visibility of libc++ header to public in libcxx module (PR #91182)

2024-05-13 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic milestoned 
https://github.com/llvm/llvm-project/pull/91182
___
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] [libclc] release/18.x: [libclc] Fix linking against libIRReader (PR #91553)

2024-05-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Drop nuw flag when CtlzOp is a sub nuw (#91776) (PR #91917)

2024-05-13 Thread Nikita Popov via llvm-branch-commits


@@ -284,6 +284,42 @@ define <4 x i32> @bit_ceil_v4i32(<4 x i32> %x) {
   ret <4 x i32> %sel
 }
 
+define i32 @pr91691(i32 %0) {
+; CHECK-LABEL: @pr91691(
+; CHECK-NEXT:[[TMP2:%.*]] = sub i32 -2, [[TMP0:%.*]]
+; CHECK-NEXT:[[TMP3:%.*]] = tail call range(i32 0, 33) i32 
@llvm.ctlz.i32(i32 [[TMP2]], i1 false)
+; CHECK-NEXT:[[TMP4:%.*]] = sub nsw i32 0, [[TMP3]]
+; CHECK-NEXT:[[TMP5:%.*]] = and i32 [[TMP4]], 31
+; CHECK-NEXT:[[TMP6:%.*]] = shl nuw i32 1, [[TMP5]]
+; CHECK-NEXT:ret i32 [[TMP6]]
+;
+  %2 = sub nuw i32 -2, %0
+  %3 = tail call i32 @llvm.ctlz.i32(i32 %2, i1 false)
+  %4 = sub i32 32, %3
+  %5 = shl i32 1, %4
+  %6 = icmp ult i32 %0, -2
+  %7 = select i1 %6, i32 %5, i32 1
+  ret i32 %7
+}
+
+define i32 @pr91691_keep_nsw(i32 %0) {
+; CHECK-LABEL: @pr91691_keep_nsw(
+; CHECK-NEXT:[[TMP2:%.*]] = sub nsw i32 -2, [[TMP0:%.*]]
+; CHECK-NEXT:[[TMP3:%.*]] = tail call range(i32 0, 33) i32 
@llvm.ctlz.i32(i32 [[TMP2]], i1 false)
+; CHECK-NEXT:[[TMP4:%.*]] = sub nsw i32 0, [[TMP3]]
+; CHECK-NEXT:[[TMP5:%.*]] = and i32 [[TMP4]], 31
+; CHECK-NEXT:[[TMP6:%.*]] = shl nuw i32 1, [[TMP5]]
+; CHECK-NEXT:ret i32 [[TMP6]]
+;
+  %2 = sub nsw i32 -2, %0
+  %3 = tail call i32 @llvm.ctlz.i32(i32 %2, i1 false)
+  %4 = sub i32 32, %3
+  %5 = shl i32 1, %4
+  %6 = icmp ult i32 %0, -2
+  %7 = select i1 %6, i32 %5, i32 1
+  ret i32 %7
+}
+

nikic wrote:

I don't. I just checked, and the PRs are created with 
maintainer_can_modify=True in 
https://github.com/llvm/llvm-project/blob/e6b2197a89f5d6d0f56a03c03b8afda561eee899/llvm/utils/git/github-automation.py#L590
 I have no idea why this doesn't work...

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Drop nuw flag when CtlzOp is a sub nuw (#91776) (PR #91917)

2024-05-13 Thread Nikita Popov via llvm-branch-commits

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

Looks like the test is failing on the release branch.

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


[llvm-branch-commits] [llvm] release/18.x: [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

2024-05-13 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

I wonder why CI doesn't flag this as an ABI-breaking change, given that it 
modifies members of a class in llvm/include.

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


[llvm-branch-commits] [llvm] release/18.x: [PPCMergeStringPool] Avoid replacing constant with instruction (#88846) (PR #91557)

2024-05-09 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/91557

>From d17c08705c750388a4ae586dc9fb892d81dba5ca Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Thu, 9 May 2024 13:27:20 +0900
Subject: [PATCH] [PPCMergeStringPool] Avoid replacing constant with
 instruction (#88846)

String pool merging currently, for a reason that's not entirely clear to
me, tries to create GEP instructions instead of GEP constant expressions
when replacing constant references. It only uses constant expressions in
cases where this is required. However, it does not catch all cases where
such a requirement exists. For example, the landingpad catch clause has
to be a constant.

Fix this by always using the constant expression variant, which also
makes the implementation simpler.

Additionally, there are some edge cases where even replacement with a
constant GEP is not legal. The one I am aware of is the
llvm.eh.typeid.for intrinsic, so add a special case to forbid
replacements for it.

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

(cherry picked from commit 3a3aeb8eba40e981d3a9ff92175f949c2f3d4434)
---
 .../lib/Target/PowerPC/PPCMergeStringPool.cpp | 57 ++-
 .../mergeable-string-pool-exceptions.ll   | 47 +++
 .../PowerPC/mergeable-string-pool-large.ll| 14 ++---
 .../mergeable-string-pool-pass-only.mir   | 18 +++---
 .../CodeGen/PowerPC/mergeable-string-pool.ll  | 14 ++---
 5 files changed, 87 insertions(+), 63 deletions(-)
 create mode 100644 
llvm/test/CodeGen/PowerPC/mergeable-string-pool-exceptions.ll

diff --git a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp 
b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
index d9465e86d8966..ebd876d50c44e 100644
--- a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
@@ -23,6 +23,7 @@
 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Instructions.h"
+#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ValueSymbolTable.h"
 #include "llvm/Pass.h"
@@ -116,9 +117,20 @@ class PPCMergeStringPool : public ModulePass {
 // sure that they can be replaced.
 static bool hasReplaceableUsers(GlobalVariable ) {
   for (User *CurrentUser : GV.users()) {
-// Instruction users are always valid.
-if (isa(CurrentUser))
+if (auto *I = dyn_cast(CurrentUser)) {
+  // Do not merge globals in exception pads.
+  if (I->isEHPad())
+return false;
+
+  if (auto *II = dyn_cast(I)) {
+// Some intrinsics require a plain global.
+if (II->getIntrinsicID() == Intrinsic::eh_typeid_for)
+  return false;
+  }
+
+  // Other instruction users are always valid.
   continue;
+}
 
 // We cannot replace GlobalValue users because they are not just nodes
 // in IR. To replace a user like this we would need to create a new
@@ -302,14 +314,6 @@ void PPCMergeStringPool::replaceUsesWithGEP(GlobalVariable 
*GlobalToReplace,
 Users.push_back(CurrentUser);
 
   for (User *CurrentUser : Users) {
-Instruction *UserInstruction = dyn_cast(CurrentUser);
-Constant *UserConstant = dyn_cast(CurrentUser);
-
-// At this point we expect that the user is either an instruction or a
-// constant.
-assert((UserConstant || UserInstruction) &&
-   "Expected the user to be an instruction or a constant.");
-
 // The user was not found so it must have been replaced earlier.
 if (!userHasOperand(CurrentUser, GlobalToReplace))
   continue;
@@ -318,38 +322,13 @@ void 
PPCMergeStringPool::replaceUsesWithGEP(GlobalVariable *GlobalToReplace,
 if (isa(CurrentUser))
   continue;
 
-if (!UserInstruction) {
-  // User is a constant type.
-  Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
-  PooledStructType, GPool, Indices);
-  UserConstant->handleOperandChange(GlobalToReplace, ConstGEP);
-  continue;
-}
-
-if (PHINode *UserPHI = dyn_cast(UserInstruction)) {
-  // GEP instructions cannot be added before PHI nodes.
-  // With getInBoundsGetElementPtr we create the GEP and then replace it
-  // inline into the PHI.
-  Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
-  PooledStructType, GPool, Indices);
-  UserPHI->replaceUsesOfWith(GlobalToReplace, ConstGEP);
-  continue;
-}
-// The user is a valid instruction that is not a PHINode.
-GetElementPtrInst *GEPInst =
-GetElementPtrInst::Create(PooledStructType, GPool, Indices);
-GEPInst->insertBefore(UserInstruction);
-
-LLVM_DEBUG(dbgs() << "Inserting GEP before:\n");
-LLVM_DEBUG(UserInstruction->dump());
-
+Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
+PooledStructType, GPool, Indices);
 LLVM_DEBUG(dbgs() << "Replacing this global:\n");
 LLVM_DEBUG(GlobalToReplace->dump());
 LLVM_DEBUG(dbgs() << "with this:\n");
-

[llvm-branch-commits] [llvm] release/18.x: [PPCMergeStringPool] Avoid replacing constant with instruction (#88846) (PR #91557)

2024-05-08 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic created https://github.com/llvm/llvm-project/pull/91557

Backport of 3a3aeb8eba40e981d3a9ff92175f949c2f3d4434 to the release branch.

>From 7764bb3a47f241ca4e4d3fe42e96ab6bdecbdbe0 Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Thu, 9 May 2024 13:27:20 +0900
Subject: [PATCH] [PPCMergeStringPool] Avoid replacing constant with
 instruction (#88846)

String pool merging currently, for a reason that's not entirely clear to
me, tries to create GEP instructions instead of GEP constant expressions
when replacing constant references. It only uses constant expressions in
cases where this is required. However, it does not catch all cases where
such a requirement exists. For example, the landingpad catch clause has
to be a constant.

Fix this by always using the constant expression variant, which also
makes the implementation simpler.

Additionally, there are some edge cases where even replacement with a
constant GEP is not legal. The one I am aware of is the
llvm.eh.typeid.for intrinsic, so add a special case to forbid
replacements for it.

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

(cherry picked from commit 3a3aeb8eba40e981d3a9ff92175f949c2f3d4434)
---
 .../lib/Target/PowerPC/PPCMergeStringPool.cpp | 57 ++-
 .../mergeable-string-pool-exceptions.ll   | 47 +++
 .../mergeable-string-pool-pass-only.mir   | 18 +++---
 3 files changed, 73 insertions(+), 49 deletions(-)
 create mode 100644 
llvm/test/CodeGen/PowerPC/mergeable-string-pool-exceptions.ll

diff --git a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp 
b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
index d9465e86d8966..ebd876d50c44e 100644
--- a/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp
@@ -23,6 +23,7 @@
 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Instructions.h"
+#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ValueSymbolTable.h"
 #include "llvm/Pass.h"
@@ -116,9 +117,20 @@ class PPCMergeStringPool : public ModulePass {
 // sure that they can be replaced.
 static bool hasReplaceableUsers(GlobalVariable ) {
   for (User *CurrentUser : GV.users()) {
-// Instruction users are always valid.
-if (isa(CurrentUser))
+if (auto *I = dyn_cast(CurrentUser)) {
+  // Do not merge globals in exception pads.
+  if (I->isEHPad())
+return false;
+
+  if (auto *II = dyn_cast(I)) {
+// Some intrinsics require a plain global.
+if (II->getIntrinsicID() == Intrinsic::eh_typeid_for)
+  return false;
+  }
+
+  // Other instruction users are always valid.
   continue;
+}
 
 // We cannot replace GlobalValue users because they are not just nodes
 // in IR. To replace a user like this we would need to create a new
@@ -302,14 +314,6 @@ void PPCMergeStringPool::replaceUsesWithGEP(GlobalVariable 
*GlobalToReplace,
 Users.push_back(CurrentUser);
 
   for (User *CurrentUser : Users) {
-Instruction *UserInstruction = dyn_cast(CurrentUser);
-Constant *UserConstant = dyn_cast(CurrentUser);
-
-// At this point we expect that the user is either an instruction or a
-// constant.
-assert((UserConstant || UserInstruction) &&
-   "Expected the user to be an instruction or a constant.");
-
 // The user was not found so it must have been replaced earlier.
 if (!userHasOperand(CurrentUser, GlobalToReplace))
   continue;
@@ -318,38 +322,13 @@ void 
PPCMergeStringPool::replaceUsesWithGEP(GlobalVariable *GlobalToReplace,
 if (isa(CurrentUser))
   continue;
 
-if (!UserInstruction) {
-  // User is a constant type.
-  Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
-  PooledStructType, GPool, Indices);
-  UserConstant->handleOperandChange(GlobalToReplace, ConstGEP);
-  continue;
-}
-
-if (PHINode *UserPHI = dyn_cast(UserInstruction)) {
-  // GEP instructions cannot be added before PHI nodes.
-  // With getInBoundsGetElementPtr we create the GEP and then replace it
-  // inline into the PHI.
-  Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
-  PooledStructType, GPool, Indices);
-  UserPHI->replaceUsesOfWith(GlobalToReplace, ConstGEP);
-  continue;
-}
-// The user is a valid instruction that is not a PHINode.
-GetElementPtrInst *GEPInst =
-GetElementPtrInst::Create(PooledStructType, GPool, Indices);
-GEPInst->insertBefore(UserInstruction);
-
-LLVM_DEBUG(dbgs() << "Inserting GEP before:\n");
-LLVM_DEBUG(UserInstruction->dump());
-
+Constant *ConstGEP = ConstantExpr::getInBoundsGetElementPtr(
+PooledStructType, GPool, Indices);
 LLVM_DEBUG(dbgs() << "Replacing this global:\n");
 LLVM_DEBUG(GlobalToReplace->dump());
 LLVM_DEBUG(dbgs() << "with this:\n");
-LLVM_DEBUG(GEPInst->dump());
-
-// 

[llvm-branch-commits] [llvm] release/18.x: [PPCMergeStringPool] Avoid replacing constant with instruction (#88846) (PR #91557)

2024-05-08 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [InstSimplify] Do not simplify freeze in `simplifyWithOpReplaced` (#91215) (PR #91419)

2024-05-08 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] release/18.x: [InstSimplify] Do not simplify freeze in `simplifyWithOpReplaced` (#91215) (PR #91419)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [clang] [llvm] release/18.x [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (#90702) (PR #91349)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

We cannot change DataLayout in a released version.

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


[llvm-branch-commits] [clang] [llvm] release/18.x [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (#90702) (PR #91349)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/91349
___
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] [Inline][Cloning] Drop incompatible attributes from `NewFunc` (PR #91350)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@AtariDreams I will ask you, again, to not request backports for changes you do 
not understand. If you are not the patch author and you do not personally 
require the backport, do not request it.

https://github.com/llvm/llvm-project/pull/91350
___
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] [Inline][Cloning] Drop incompatible attributes from `NewFunc` (PR #91350)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/91350
___
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] [Inline][Cloning] Drop incompatible attributes from `NewFunc` (PR #91350)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

This backport makes no sense. It takes only one out of two related commits. And 
taking both would be too high risk for a late backport anyway.

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


[llvm-branch-commits] [llvm] release/18.x: [AArc64][GlobalISel] Fix legalizer assert for G_INSERT_VECTOR_ELT (PR #90827)

2024-05-07 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@aemerson It looks like llvmbot does not enable the "Maintainers are allowed to 
edit this pull request" option, so it's not possible to edit this pull request. 
Need to submit a new one.

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


[llvm-branch-commits] [llvm] release/18.x: [AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622) (PR #91034)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [SelectionDAG] Mark frame index as "aliased" at argument copy elison (PR #91035)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

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


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

2024-05-05 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [LV, LAA] Don't vectorize loops with load and store to invar address. (PR #91092)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic milestoned 
https://github.com/llvm/llvm-project/pull/91092
___
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] Fix libclang-abi-tests to work with new version scheme (PR #91096)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [AArch64][SelectionDAG] Mask for SUBS with multiple users cannot be elided (#90911) (PR #91151)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix miscompile in negation of select (#89698) (PR #91089)

2024-05-05 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

Declining backport: This is an ABI breaking change, and while it would be 
possible to rewrite the fix in a way that does not break ABI, I don't think the 
fix itself is important to backport (this is not a regression, the issue exists 
since at least LLVM 12).

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


[llvm-branch-commits] [clang] release/18.x: Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)" (PR #90544)

2024-05-03 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@vgvassilev My bad, I completely missed that the changed header is in the lib/ 
directory, not in include/.

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


[llvm-branch-commits] [clang] release/18.x: Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)" (PR #90544)

2024-04-30 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

This looks like an ABI breaking change to me.

I think the libclang-cpp.so ABI test is currently broken due to the new minor 
version scheme. (cc @tstellar we need something like 
https://github.com/llvm/llvm-project/pull/85166 for the clang ABI check)

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


[llvm-branch-commits] [clang] release/18.x [X86_64] fix SSE type error in vaarg (PR #86698)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

Closing this as rejected per previous comments.

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


[llvm-branch-commits] [clang] release/18.x [X86_64] fix SSE type error in vaarg (PR #86698)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [TableGen] Fix ReplaceRegAction RTTI Kind (PR #89790)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [TableGen] Fix ReplaceRegAction RTTI Kind (PR #89790)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@AtariDreams Please, can you stop submitting random backport requests for 
changes that you have no involvement with, and where nobody else expressed a 
desire for a backport?

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


[llvm-branch-commits] [clang] [clang][builtin] Implement __builtin_allow_runtime_check (PR #87568)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic commented:

This looks very reasonable to me, but I'm not a clang reviewer...

https://github.com/llvm/llvm-project/pull/87568
___
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] [InstCombiner] Remove trivially dead `llvm.allow.{runtime, ubsan}.check()` (PR #84851)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/84851
___
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] [InstCombiner] Remove unused `llvm.experimental.hot()` (PR #84851)

2024-04-29 Thread Nikita Popov via llvm-branch-commits


@@ -2827,6 +2827,14 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst 
) {
 }))
   return nullptr;
 break;
+  case Intrinsic::experimental_hot: {
+// The intrinsic declaration includes sideeffects to avoid it moved. This
+// prevents removing even if the intrinsic is unused. We should remove
+// unused ones to enabled other optimizations.
+if (CI.use_empty())
+  return eraseInstFromFunction(CI);

nikic wrote:

This should be handled inside wouldInstructionBeTriviallyDead.

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


[llvm-branch-commits] [llvm] release/18.x: [CGP] Drop poison-generating flags after hoisting (#90382) (PR #90437)

2024-04-29 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] release/18.x: [IRCE] Skip icmp ptr in `InductiveRangeCheck::parseRangeCheckICmp` (#89967) (PR #90182)

2024-04-28 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Fix unexpected overwriting in `foldSelectWithSRem` (#89539) (PR #89546)

2024-04-21 Thread Nikita Popov via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/89546
___
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] Revert "[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)" (PR #88818)

2024-04-17 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

Given that this change has already caused two distinct bugs, I don't think we 
will accept a backport for it anyway, so don't worry about the release branch.

https://github.com/llvm/llvm-project/pull/88818
___
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] Revert "[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)" (PR #88818)

2024-04-17 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

@yingopq The patches are not reverted in main, so you can base your fix on top 
of the existing changes (or revert them as part of your PR, if that's easier?)

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


[llvm-branch-commits] [llvm] release/18x:[X86] Fix typo: QWORD alignment is greater than or equal to 8, not greater than 8 (#87819) (PR #88394)

2024-04-17 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

This looks like an optimization improvement, not a bug fix, to me, and as such 
should not be backported.

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


[llvm-branch-commits] [llvm] release/18x:[X86] Fix typo: QWORD alignment is greater than or equal to 8, not greater than 8 (#87819) (PR #88394)

2024-04-17 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic milestoned 
https://github.com/llvm/llvm-project/pull/88394
___
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] Revert "[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)" (PR #88818)

2024-04-16 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

I'd also add that this fixes a regression from a previous LLVM 18 point release:

> Fix regressions introduced in LLVM 18.1.3 in MIPS atomicrmw min/max codegen.

https://github.com/llvm/llvm-project/pull/88818
___
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] Revert "[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)" (PR #88818)

2024-04-15 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/88818
___
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] Revert "[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)" (PR #88818)

2024-04-15 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic created https://github.com/llvm/llvm-project/pull/88818

…omic max (#77072)"

These changes caused correctness regressions observed in Rust, see 
https://github.com/llvm/llvm-project/pull/77072#issuecomment-2049009507 and 
following. Revert the incorrect changes from the release branch.

This reverts commit 0e501dbd932ef1c6f4e747c83bf33beef0a09ecf.
This reverts commit fbb27d16fa12aa595cbd20a1fb5f1c5b80748fa4.

>From 8b6d4e5d2293ee529405988780d65f0700d6275a Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Tue, 16 Apr 2024 09:10:46 +0900
Subject: [PATCH] Revert "[Mips] Fix missing sign extension in expansion of
 sub-word atomic max (#77072)"

These changes caused correctness regressions observed in Rust,
see
https://github.com/llvm/llvm-project/pull/77072#issuecomment-2049009507.

This reverts commit 0e501dbd932ef1c6f4e747c83bf33beef0a09ecf.
This reverts commit fbb27d16fa12aa595cbd20a1fb5f1c5b80748fa4.
---
 llvm/lib/Target/Mips/MipsExpandPseudo.cpp |  60 +--
 llvm/test/CodeGen/Mips/atomic-min-max.ll  | 615 +++---
 2 files changed, 81 insertions(+), 594 deletions(-)

diff --git a/llvm/lib/Target/Mips/MipsExpandPseudo.cpp 
b/llvm/lib/Target/Mips/MipsExpandPseudo.cpp
index c30129743a9626..2c2554b5b4bc3b 100644
--- a/llvm/lib/Target/Mips/MipsExpandPseudo.cpp
+++ b/llvm/lib/Target/Mips/MipsExpandPseudo.cpp
@@ -388,32 +388,18 @@ bool MipsExpandPseudo::expandAtomicBinOpSubword(
 Opcode = Mips::XOR;
 break;
   case Mips::ATOMIC_LOAD_UMIN_I8_POSTRA:
-IsUnsigned = true;
-IsMin = true;
-break;
   case Mips::ATOMIC_LOAD_UMIN_I16_POSTRA:
 IsUnsigned = true;
-IsMin = true;
-break;
+[[fallthrough]];
   case Mips::ATOMIC_LOAD_MIN_I8_POSTRA:
-SEOp = Mips::SEB;
-IsMin = true;
-break;
   case Mips::ATOMIC_LOAD_MIN_I16_POSTRA:
 IsMin = true;
 break;
   case Mips::ATOMIC_LOAD_UMAX_I8_POSTRA:
-IsUnsigned = true;
-IsMax = true;
-break;
   case Mips::ATOMIC_LOAD_UMAX_I16_POSTRA:
 IsUnsigned = true;
-IsMax = true;
-break;
+[[fallthrough]];
   case Mips::ATOMIC_LOAD_MAX_I8_POSTRA:
-SEOp = Mips::SEB;
-IsMax = true;
-break;
   case Mips::ATOMIC_LOAD_MAX_I16_POSTRA:
 IsMax = true;
 break;
@@ -475,42 +461,14 @@ bool MipsExpandPseudo::expandAtomicBinOpSubword(
 
 // For little endian we need to clear uninterested bits.
 if (STI->isLittle()) {
-  if (!IsUnsigned) {
-BuildMI(loopMBB, DL, TII->get(Mips::SRAV), OldVal)
-.addReg(OldVal)
-.addReg(ShiftAmnt);
-BuildMI(loopMBB, DL, TII->get(Mips::SRAV), Incr)
-.addReg(Incr)
-.addReg(ShiftAmnt);
-if (STI->hasMips32r2()) {
-  BuildMI(loopMBB, DL, TII->get(SEOp), OldVal).addReg(OldVal);
-  BuildMI(loopMBB, DL, TII->get(SEOp), Incr).addReg(Incr);
-} else {
-  const unsigned ShiftImm = SEOp == Mips::SEH ? 16 : 24;
-  BuildMI(loopMBB, DL, TII->get(Mips::SLL), OldVal)
-  .addReg(OldVal, RegState::Kill)
-  .addImm(ShiftImm);
-  BuildMI(loopMBB, DL, TII->get(Mips::SRA), OldVal)
-  .addReg(OldVal, RegState::Kill)
-  .addImm(ShiftImm);
-  BuildMI(loopMBB, DL, TII->get(Mips::SLL), Incr)
-  .addReg(Incr, RegState::Kill)
-  .addImm(ShiftImm);
-  BuildMI(loopMBB, DL, TII->get(Mips::SRA), Incr)
-  .addReg(Incr, RegState::Kill)
-  .addImm(ShiftImm);
-}
-  } else {
-// and OldVal, OldVal, Mask
-// and Incr, Incr, Mask
-BuildMI(loopMBB, DL, TII->get(Mips::AND), OldVal)
-.addReg(OldVal)
-.addReg(Mask);
-BuildMI(loopMBB, DL, TII->get(Mips::AND), Incr)
-.addReg(Incr)
-.addReg(Mask);
-  }
+  // and OldVal, OldVal, Mask
+  // and Incr, Incr, Mask
+  BuildMI(loopMBB, DL, TII->get(Mips::AND), OldVal)
+  .addReg(OldVal)
+  .addReg(Mask);
+  BuildMI(loopMBB, DL, TII->get(Mips::AND), 
Incr).addReg(Incr).addReg(Mask);
 }
+
 // unsigned: sltu Scratch4, oldVal, Incr
 // signed:   slt Scratch4, oldVal, Incr
 BuildMI(loopMBB, DL, TII->get(SLTScratch4), Scratch4)
diff --git a/llvm/test/CodeGen/Mips/atomic-min-max.ll 
b/llvm/test/CodeGen/Mips/atomic-min-max.ll
index a96581bdb39a4c..f953c885ea7345 100644
--- a/llvm/test/CodeGen/Mips/atomic-min-max.ll
+++ b/llvm/test/CodeGen/Mips/atomic-min-max.ll
@@ -3,7 +3,6 @@
 ; RUN: llc -march=mips -O0 -mcpu=mips32r6 -verify-machineinstrs %s -o - | 
FileCheck %s --check-prefix=MIPSR6
 ; RUN: llc -march=mips -O0 -mcpu=mips32r2 -mattr=+micromips 
-verify-machineinstrs %s -o - | FileCheck %s --check-prefix=MM
 ; RUN: llc -march=mips -O0 -mcpu=mips32r6 -mattr=+micromips 
-verify-machineinstrs %s -o - | FileCheck %s --check-prefix=MMR6
-; RUN: llc -march=mipsel -O0 -mcpu=mips32 -verify-machineinstrs %s -o - | 
FileCheck %s --check-prefix=MIPS32
 ; RUN: llc -march=mipsel -O0 

[llvm-branch-commits] [llvm] Revert "[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)" (PR #88818)

2024-04-15 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [InstSimplify] Make sure the simplified value doesn't generate poison in threadBinOpOverSelect (#87075) (PR #88353)

2024-04-11 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] release/18.x [SelectionDAG] Prevent combination on inconsistent type in 'carryDiamond' (PR #86697)

2024-04-08 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [clang] release/18.x [X86_64] fix SSE type error in vaarg (PR #86698)

2024-04-08 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [X86] Fix miscompile in combineShiftRightArithmetic (PR #86728)

2024-04-08 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [SLP]Fix a crash if the argument of call was affected by minbitwidth analysis (PR #86731)

2024-04-08 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [ConstantRange] Fix off by 1 bugs in UIToFP and SIToFP handling. (#86041) (PR #86153)

2024-04-08 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [clang] release/18.x: backport PR84230 (PR #86106)

2024-03-21 Thread Nikita Popov via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/86106
___
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] [dse] Skip llvm.allow.{runtime, ubsan}.check() (PR #86067)

2024-03-21 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

I don't think that this change is necessary. The InaccessibleMemOnly modelling 
will take care of it.

https://github.com/llvm/llvm-project/pull/86067
___
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] [CostModel] No cost for llvm.allow.{runtime, ubsan}.check() (PR #86064)

2024-03-21 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] release/18.x: workflows: Fix baseline version for llvm abi checks (#85166) (PR #85789)

2024-03-19 Thread Nikita Popov via llvm-branch-commits

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

LGTM

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


[llvm-branch-commits] [llvm] release/18.x: [llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710) (PR #85746)

2024-03-19 Thread Nikita Popov via llvm-branch-commits

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

A bit unfortunate to have these changes post-release, but I think we do need to 
make them.

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


[llvm-branch-commits] [llvm] release/18.x: [InstCombine] Drop UB-implying attrs/metadata after speculating an instruction (#85542) (PR #85562)

2024-03-17 Thread Nikita Popov via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/85562
___
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] Backport #85277 (PR #85422)

2024-03-15 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [lld] [llvm] Backport fixes for ARM64EC import libraries (PR #84590)

2024-03-13 Thread Nikita Popov via llvm-branch-commits


@@ -91,6 +120,10 @@ struct COFFShortExport {
   /// file, this is "baz" in "EXPORTS\nfoo = bar == baz".
   std::string AliasTarget;
 
+  /// Specifies EXPORTAS name. In a .def file, this is "bar" in
+  /// "EXPORTS\nfoo EXPORTAS bar".
+  std::string ExportAs;

nikic wrote:

This looks like an ABI break.

https://github.com/llvm/llvm-project/pull/84590
___
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: Add workaround for lld failures on MacOS (#85021) (PR #85110)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [clang] release/18.x: [ObjC] Check entire chain of superclasses to determine class layout (PR #84093)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/84093
___
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] [lld] [llvm] [openmp] SystemZ release notes for 18.x. (PR #84560)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [lld] [llvm] Backport fixes for ARM64EC import libraries (PR #84590)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [ARM] Switch to LiveRegUnits to fix r7 register allocation bug (PR #84475)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [clang-tools-extra] [clangd] Add clangd 18 release notes (PR #84436)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic milestoned 
https://github.com/llvm/llvm-project/pull/84436
___
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] [openmp] release/18.x: [openmp] __kmp_x86_cpuid fix for i386/PIC builds. (#84626) (PR #85053)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic milestoned 
https://github.com/llvm/llvm-project/pull/85053
___
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] [openmp] release/18.x: [openmp] __kmp_x86_cpuid fix for i386/PIC builds. (#84626) (PR #85053)

2024-03-13 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [X86] Add missing subvector_subreg_lowering for BF16 (#83720) (PR #84491)

2024-03-12 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [X86] Add missing subvector_subreg_lowering for BF16 (#83720) (PR #83834)

2024-03-12 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [clang] release/18x: [clang] Avoid -Wshadow warning when init-capture named same as class … (PR #84912)

2024-03-12 Thread Nikita Popov via llvm-branch-commits

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


[llvm-branch-commits] [llvm] release/18.x: [DSE] Remove malloc from EarliestEscapeInfo before removing. (#84157) (PR #84946)

2024-03-12 Thread Nikita Popov via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/84946
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits

nikic wrote:

Please submit an RFC on discourse for this change.

https://github.com/llvm/llvm-project/pull/84850
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits


@@ -27639,6 +27639,54 @@ constant `true`. However it is always correct to 
replace
 it with any other `i1` value. Any pass can
 freely do it if it can benefit from non-default lowering.
 
+'``llvm.experimental.hot``' Intrinsic
+^
+
+Syntax:
+"""
+
+::
+
+  declare i1 @llvm.experimental.hot()
+
+Overview:
+"
+
+This intrinsic returns true iff it's known that containing basic block is hot 
in
+profile.
+
+When used with profile based optimization allows to change program behaviour
+deppending on the code hotness.
+
+Arguments:
+""
+
+None.
+
+Semantics:
+""
+
+The intrinsic ``@llvm.experimental.hot()`` returns either `true` or `false`,
+deppending on profile used. Expresion is evaluated as `true` iff profile and
+summary are availible and profile counter for the block reach hotness 
threshold.

nikic wrote:

```suggestion
summary are available and profile counter for the block reach hotness threshold.
```

https://github.com/llvm/llvm-project/pull/84850
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits


@@ -27639,6 +27639,54 @@ constant `true`. However it is always correct to 
replace
 it with any other `i1` value. Any pass can
 freely do it if it can benefit from non-default lowering.
 
+'``llvm.experimental.hot``' Intrinsic
+^
+
+Syntax:
+"""
+
+::
+
+  declare i1 @llvm.experimental.hot()
+
+Overview:
+"
+
+This intrinsic returns true iff it's known that containing basic block is hot 
in
+profile.
+
+When used with profile based optimization allows to change program behaviour
+deppending on the code hotness.
+
+Arguments:
+""
+
+None.
+
+Semantics:
+""
+
+The intrinsic ``@llvm.experimental.hot()`` returns either `true` or `false`,
+deppending on profile used. Expresion is evaluated as `true` iff profile and
+summary are availible and profile counter for the block reach hotness 
threshold.
+For each evaluation of a call to this intrinsic, the program must be valid and
+correct both if it returns `true` and if it returns `false`.
+
+When used in a branch condition, it allows us to choose between
+two alternative correct solutions for the same problem, like
+in example below:
+
+.. code-block:: text
+
+%cond = call i1 @llvm.experimental.hot()
+br i1 %cond, label %fast_path, label %slow_path
+
+  label %fast_path:

nikic wrote:

```suggestion
  fast_path:
```

https://github.com/llvm/llvm-project/pull/84850
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits


@@ -27639,6 +27639,54 @@ constant `true`. However it is always correct to 
replace
 it with any other `i1` value. Any pass can
 freely do it if it can benefit from non-default lowering.
 
+'``llvm.experimental.hot``' Intrinsic
+^
+
+Syntax:
+"""
+
+::
+
+  declare i1 @llvm.experimental.hot()
+
+Overview:
+"
+
+This intrinsic returns true iff it's known that containing basic block is hot 
in
+profile.
+
+When used with profile based optimization allows to change program behaviour
+deppending on the code hotness.
+
+Arguments:
+""
+
+None.
+
+Semantics:
+""
+
+The intrinsic ``@llvm.experimental.hot()`` returns either `true` or `false`,

nikic wrote:

```suggestion
The intrinsic ``@llvm.experimental.hot()`` returns either ``true`` or ``false``,
```
Here and elsewhere.

https://github.com/llvm/llvm-project/pull/84850
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits


@@ -27639,6 +27639,54 @@ constant `true`. However it is always correct to 
replace
 it with any other `i1` value. Any pass can
 freely do it if it can benefit from non-default lowering.
 
+'``llvm.experimental.hot``' Intrinsic
+^
+
+Syntax:
+"""
+
+::
+
+  declare i1 @llvm.experimental.hot()
+
+Overview:
+"
+
+This intrinsic returns true iff it's known that containing basic block is hot 
in
+profile.
+
+When used with profile based optimization allows to change program behaviour
+deppending on the code hotness.
+
+Arguments:
+""
+
+None.
+
+Semantics:
+""
+
+The intrinsic ``@llvm.experimental.hot()`` returns either `true` or `false`,
+deppending on profile used. Expresion is evaluated as `true` iff profile and

nikic wrote:

```suggestion
depending on profile used. Expresion is evaluated as `true` iff profile and
```

https://github.com/llvm/llvm-project/pull/84850
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits


@@ -27639,6 +27639,54 @@ constant `true`. However it is always correct to 
replace
 it with any other `i1` value. Any pass can
 freely do it if it can benefit from non-default lowering.
 
+'``llvm.experimental.hot``' Intrinsic
+^
+
+Syntax:
+"""
+
+::
+
+  declare i1 @llvm.experimental.hot()
+
+Overview:
+"
+
+This intrinsic returns true iff it's known that containing basic block is hot 
in
+profile.
+
+When used with profile based optimization allows to change program behaviour
+deppending on the code hotness.
+
+Arguments:
+""
+
+None.
+
+Semantics:
+""
+
+The intrinsic ``@llvm.experimental.hot()`` returns either `true` or `false`,
+deppending on profile used. Expresion is evaluated as `true` iff profile and
+summary are availible and profile counter for the block reach hotness 
threshold.
+For each evaluation of a call to this intrinsic, the program must be valid and
+correct both if it returns `true` and if it returns `false`.
+
+When used in a branch condition, it allows us to choose between
+two alternative correct solutions for the same problem, like
+in example below:
+
+.. code-block:: text
+
+%cond = call i1 @llvm.experimental.hot()
+br i1 %cond, label %fast_path, label %slow_path
+
+  label %fast_path:
+; Omit diagnostics.
+
+  label %slow_path:

nikic wrote:

```suggestion
  slow_path:
```

https://github.com/llvm/llvm-project/pull/84850
___
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] [IR] Introduce `llvm.experimental.hot()` (PR #84850)

2024-03-12 Thread Nikita Popov via llvm-branch-commits


@@ -27639,6 +27639,54 @@ constant `true`. However it is always correct to 
replace
 it with any other `i1` value. Any pass can
 freely do it if it can benefit from non-default lowering.
 
+'``llvm.experimental.hot``' Intrinsic
+^
+
+Syntax:
+"""
+
+::
+
+  declare i1 @llvm.experimental.hot()
+
+Overview:
+"
+
+This intrinsic returns true iff it's known that containing basic block is hot 
in
+profile.
+
+When used with profile based optimization allows to change program behaviour
+deppending on the code hotness.

nikic wrote:

```suggestion
depending on the code hotness.
```

https://github.com/llvm/llvm-project/pull/84850
___
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] Backport PR83993 to 18.x (PR #84298)

2024-03-11 Thread Nikita Popov via llvm-branch-commits

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


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


  1   2   3   >