[llvm-branch-commits] [llvm] [SDAG][AMDGPU] Allow opting in to OOB-generating PTRADD transforms (PR #146074)

2025-06-27 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson approved this pull request. Thanks, I like this hook and it should also work well for CHERI where similar constraints to CPA exist: you can go out of bounds by a specific amount (the exact range depends on the pointer bounds), but if you go too far the pointer be

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-20 Thread Alexander Richardson via llvm-branch-commits
@@ -4274,6 +4274,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) { case lltok::kw_bitcast: case lltok::kw_addrspacecast: case lltok::kw_inttoptr: + // ptrtoaddr not supported in constant exprs (yet?). arichardson wrote

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-20 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: ping. What can I do to push this forward? I would like to avoid making any further follow-up changes if there is any risk this would not land. @nikic are you still happy with the introduction of this instruction? https://github.com/llvm/llvm-project/pull/139357 _

[llvm-branch-commits] [WIP] Introduce a G_PTRTOADDR GIsel node (PR #140300)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: GISelValueTracking correctly implemented in #143816 and #143815 https://github.com/llvm/llvm-project/pull/140300 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[llvm-branch-commits] [WIP] Introduce a G_PTRTOADDR GIsel node (PR #140300)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
@@ -204,6 +207,10 @@ LegacyLegalizerInfo::getAspectAction(const InstrAspect &Aspect) const { if (Aspect.Type.isScalar() || Aspect.Type.isPointer()) return findScalarLegalAction(Aspect); assert(Aspect.Type.isVector()); + if (Aspect.Opcode == TargetOpcode::G_PTRTOADDR)

[llvm-branch-commits] [GISelValueTracking] Baseline test for G_PTRTOADDR (PR #143815)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/143815 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [GIselValueTracking] Correctly truncate/zext G_PTRTOADDR (PR #143816)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/143816 G_PTRTOADDR is defined to return a zero-extended pointer address, so in case of ptr addrspace(8) 48 bits follwed by zeroes. Fixes the PtrToAddrExt test case in knownbits-ptrtoaddr.mir.

[llvm-branch-commits] [WIP] Introduce a G_PTRTOADDR GIsel node (PR #140300)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/140300 ___ 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] [WIP] Introduce a G_PTRTOADDR GIsel node (PR #140300)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/140300 ___ 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] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139601 ___ 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] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139601 ___ 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] [SelectionDAGBuilder] Use address width when lowering ptrtoaddr (PR #139423)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139423 >From d4520dc202a500c80309cf09517b2a2823bf13ab Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 17:33:01 -0700 Subject: [PATCH] remove unused variable Created using spr 1.3.6-beta.1 ---

[llvm-branch-commits] [llvm] [SelectionDAGBuilder] Use address width when lowering ptrtoaddr (PR #139423)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139423 >From d4520dc202a500c80309cf09517b2a2823bf13ab Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 17:33:01 -0700 Subject: [PATCH] remove unused variable Created using spr 1.3.6-beta.1 ---

[llvm-branch-commits] [AMDGPU] Baseline test for ptrtoaddr code generation (PR #143813)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/143813 This is currently not correct as it uses the same code path as ptrtoint. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.ll

[llvm-branch-commits] [AMDGPU] Baseline test for ptrtoaddr in lower-buffer-fat-pointers (PR #143812)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/143812 We should only be extracting the 32-bit offset in the ptrtoaddr case. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.

[llvm-branch-commits] [llvm] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139413 >From a2dec95d11a68c7911eef777ad78b07aa747bef5 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 15:35:50 -0700 Subject: [PATCH] remove fixme Created using spr 1.3.6-beta.1 --- .../test

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139413 >From a2dec95d11a68c7911eef777ad78b07aa747bef5 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 15:35:50 -0700 Subject: [PATCH 1/2] remove fixme Created using spr 1.3.6-beta.1 --- .../

[llvm-branch-commits] [llvm] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139413 >From a2dec95d11a68c7911eef777ad78b07aa747bef5 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 15:35:50 -0700 Subject: [PATCH] remove fixme Created using spr 1.3.6-beta.1 --- .../test

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-11 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: > Is this PR part of a stack or something? Yes there are follow-up change to make better use of the new instruction but this one can be reviewed standalone. The `spr` tool doesn't auto link related PRs, I can add some comments to link them here. #139601 #139423 https://git

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Sorry for the delay here. Updated and hopefully addressed outstanding feedback https://github.com/llvm/llvm-project/pull/139357 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
@@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s arichardson wrote: I see 79 tests that use this, but can drop if you think it makes sense. https://github.com/llvm/llvm-project/pull/139357 _

[llvm-branch-commits] [GISelValueTracking] Add test case for G_PTRTOINT (PR #139608)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139608 ___ 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] [GISelValueTracking] Add test case for G_PTRTOINT (PR #139608)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson edited https://github.com/llvm/llvm-project/pull/139608 ___ 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] [GISelValueTracking] Add test case for G_PTRTOINT (PR #139608)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139608 ___ 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] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-06-09 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Looks like this was fixed while I was busy with other things - https://github.com/llvm/llvm-project/pull/140213 changed this code to drop the invalid width usage. I'll update this PR to just add a test for the ptrtoint case. https://github.com/llvm/llvm-project/pull/139608

[llvm-branch-commits] [llvm] [AMDGPU][SDAG] Add ISD::PTRADD DAG combines (PR #142739)

2025-06-06 Thread Alexander Richardson via llvm-branch-commits
@@ -2627,6 +2629,93 @@ SDValue DAGCombiner::foldSubToAvg(SDNode *N, const SDLoc &DL) { return SDValue(); } +/// Try to fold a pointer arithmetic node. +/// This needs to be done separately from normal addition, because pointer +/// addition is not commutative. +SDValue DAGC

[llvm-branch-commits] [llvm] [AMDGPU][SDAG] Add ISD::PTRADD DAG combines (PR #142739)

2025-06-06 Thread Alexander Richardson via llvm-branch-commits
@@ -2627,6 +2629,93 @@ SDValue DAGCombiner::foldSubToAvg(SDNode *N, const SDLoc &DL) { return SDValue(); } +/// Try to fold a pointer arithmetic node. +/// This needs to be done separately from normal addition, because pointer +/// addition is not commutative. +SDValue DAGC

[llvm-branch-commits] [llvm] [AMDGPU][SDAG] Add tests for ISD::PTRADD DAG combines (PR #142738)

2025-06-04 Thread Alexander Richardson via llvm-branch-commits
@@ -0,0 +1,207 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -disable-separate-const-offset-from-gep=1 -amdgpu-use-sdag-ptradd=1 < %s | FileCheck --check-prefixes=GFX942,GFX942_PTRADD %s +; R

[llvm-branch-commits] [llvm] [AMDGPU][SDAG] Add ISD::PTRADD DAG combines (PR #142739)

2025-06-04 Thread Alexander Richardson via llvm-branch-commits
@@ -2627,6 +2629,93 @@ SDValue DAGCombiner::foldSubToAvg(SDNode *N, const SDLoc &DL) { return SDValue(); } +/// Try to fold a pointer arithmetic node. +/// This needs to be done separately from normal addition, because pointer +/// addition is not commutative. +SDValue DAGC

[llvm-branch-commits] [llvm] [AMDGPU][SDAG] Add ISD::PTRADD DAG combines (PR #142739)

2025-06-04 Thread Alexander Richardson via llvm-branch-commits
@@ -14935,6 +14936,52 @@ SDValue SITargetLowering::performAddCombine(SDNode *N, return SDValue(); } +SDValue SITargetLowering::performPtrAddCombine(SDNode *N, + DAGCombinerInfo &DCI) const { + SelectionDAG &DAG = DCI.DAG; + EVT

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-21 Thread Alexander Richardson via llvm-branch-commits
@@ -110,6 +110,7 @@ typedef enum { LLVMFPTrunc= 37, LLVMFPExt = 38, LLVMPtrToInt = 39, + LLVMPtrToAddr = 69, arichardson wrote: fneg and callbr also break the ordering - I think the intention in this file is to have them mat

[llvm-branch-commits] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-05-21 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Thanks for the review, I'll update this to use a new baseline test that does not depend on the new ptrtoaddr. https://github.com/llvm/llvm-project/pull/139608 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org h

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-21 Thread Alexander Richardson via llvm-branch-commits
@@ -7,9 +7,9 @@ define i32 @nested(i32 %src) #0 { ; CHECK-SAME: i32 [[A0:%.*]]) #[[ATTR0:[0-9]+]] { ; CHECK-NEXT: [[BB15160:.*:]] ; CHECK-NEXT:[[T1:%.*]] = call token @llvm.experimental.convergence.entry() -; CHECK-NEXT:%"vl77672llvm.experimental.convergence.anchor()"

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-21 Thread Alexander Richardson via llvm-branch-commits
@@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s arichardson wrote: I copied this from another test so assumed there was a reason for it but not sure what that would be. https://github.com/llvm/llvm-project/pull/139357 __

[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-19 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139419 ___ 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] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-19 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139419 ___ 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] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: The current behaviour is definitely buggy since we lower G_PTRTOINT as a COPY node, but assume that it zeroes the upper bits for ptr addrspace(8). I think this patch is sufficient to prevent that issue. https://github.com/llvm/llvm-project/pull/139608 ___

[llvm-branch-commits] [WIP] Introduce a G_PTRTOADDR GIsel node (PR #140300)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/140300 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
@@ -1583,6 +1583,26 @@ bool IRTranslator::translateCast(unsigned Opcode, const User &U, return true; } +bool IRTranslator::translatePtrToAddr(const User &U, + MachineIRBuilder &MIRBuilder) { + if (containsBF16Type(U)) +return false;

[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Is there anything else that needs to be changed on this PR? https://github.com/llvm/llvm-project/pull/139419 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Should I clang-format the other files that use manual alignment to ensure that future additions don't fail the clang-format checker? https://github.com/llvm/llvm-project/pull/139357 ___ llvm-branch-commits mailing list llvm-branch-c

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
@@ -4904,13 +4907,43 @@ class PtrToIntInst : public CastInst { // Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Instruction *I) { -return I->getOpcode() == PtrToInt; +return I->getOpcode() == PtrToInt || I->getOpcode()

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-16 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
@@ -4904,13 +4907,43 @@ class PtrToIntInst : public CastInst { // Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Instruction *I) { -return I->getOpcode() == PtrToInt; +return I->getOpcode() == PtrToInt || I->getOpcode()

[llvm-branch-commits] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139608 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139608 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139601 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139601 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-13 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
@@ -5773,7 +5773,7 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) { if (!DL.contains("-p7") && !DL.starts_with("p7")) Res.append("-p7:160:256:256:32"); if (!DL.contains("-p8") && !DL.starts_with("p8")) - Res.append("-p8:128:128"); +

[llvm-branch-commits] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Now that we use the full bitwidth the high KnownBits are no longer zext'ed to zeroes. But maybe the better approahc would be to just do KnownBits on the address bits and set the high bits to unknown? That should fix the issue as well? https://github.com/llvm/llvm-project/pu

[llvm-branch-commits] [GISelValueTracking] Use representation size for G_PTRTOINT src width (PR #139608)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/139608 While we can only reason about the index/address, the G_PTRTOINT operations returns all representation bits, so we can't assume the remaining ones are all zeroes. This behaviour was clarified as part of the d

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
@@ -1583,6 +1583,26 @@ bool IRTranslator::translateCast(unsigned Opcode, const User &U, return true; } +bool IRTranslator::translatePtrToAddr(const User &U, + MachineIRBuilder &MIRBuilder) { + if (containsBF16Type(U)) +return false;

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
@@ -1583,6 +1583,26 @@ bool IRTranslator::translateCast(unsigned Opcode, const User &U, return true; } +bool IRTranslator::translatePtrToAddr(const User &U, + MachineIRBuilder &MIRBuilder) { + if (containsBF16Type(U)) +return false;

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
@@ -1583,6 +1583,26 @@ bool IRTranslator::translateCast(unsigned Opcode, const User &U, return true; } +bool IRTranslator::translatePtrToAddr(const User &U, + MachineIRBuilder &MIRBuilder) { + if (containsBF16Type(U)) +return false;

[llvm-branch-commits] [IRTranslator] Handle ptrtoaddr (PR #139601)

2025-05-12 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/139601 We lower ptrtoaddr by emitting a G_PTRTOINT, truncating that to the address size and then truncate/zext to the final integer type. This has exposed an issue in the GlobalIsel postlegalizer combines where the

[llvm-branch-commits] [llvm] [SelectionDAGBuilder] Use address width when lowering ptrtoaddr (PR #139423)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139423 >From d4520dc202a500c80309cf09517b2a2823bf13ab Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 17:33:01 -0700 Subject: [PATCH] remove unused variable Created using spr 1.3.6-beta.1 ---

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [SelectionDAGBuilder] Use address width when lowering ptrtoaddr (PR #139423)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/139423 Instead of just deferring to ptrtoint, we should truncate to the index width and then perform the ZextOrTrunc. ___ llvm-branch-commits mailing list llvm-branch-c

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139413 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [llvm] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139413 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
@@ -145,79 +145,79 @@ define amdgpu_ps ptr addrspace(7) @s_ptrmask_buffer_fat_ptr_i32_neg8(ptr addrspa ret ptr addrspace(7) %masked } -define ptr addrspace(8) @v_ptrmask_buffer_resource_variable_i128(ptr addrspace(8) %ptr, i128 %mask) { -; GCN-LABEL: v_ptrmask_buffer_resou

[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
@@ -7970,17 +7970,26 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, // On arm64_32, pointers are 32 bits when stored in memory, but // zero-extended to 64 bits when in registers. Thus the mask is 32 bits to -// match the index type, but the po

[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/139419 Of the 128-bits of buffer descriptor only 48 bits are address bits, so following the discussion on https://discourse.llvm.org/t/clarifiying-the-semantics-of-ptrtoint/83987/54, the logic conclusion is to set

[llvm-branch-commits] [llvm] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139413 >From a2dec95d11a68c7911eef777ad78b07aa747bef5 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 10 May 2025 15:35:50 -0700 Subject: [PATCH] remove fixme Created using spr 1.3.6-beta.1 --- .../test

[llvm-branch-commits] [AMDGPULowerBufferFatPointers] Handle ptrtoaddr by extending the offset (PR #139413)

2025-05-10 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/139413 None ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/139357 This introduces a new `ptrtoaddr` instruction which is similar to `ptrtoint` but has two differences: 1) Unlike `ptrtoint`, `ptrtoaddr` does not capture provenance 2) `ptrtoaddr` only extracts (and then exte

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
@@ -4904,13 +4907,43 @@ class PtrToIntInst : public CastInst { // Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const Instruction *I) { -return I->getOpcode() == PtrToInt; +return I->getOpcode() == PtrToInt || I->getOpcode()

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sa

[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/139357 >From 25dc175562349410f161ef0e80246301d9a7ba79 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 May 2025 22:43:37 -0700 Subject: [PATCH] fix docs build Created using spr 1.3.6-beta.1 --- llvm/do

[llvm-branch-commits] [AutoUpgrade][AMDGPU] Adjust AS7 and AS9 address width to 48 bits (PR #137418)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson closed https://github.com/llvm/llvm-project/pull/137418 ___ 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] [AutoUpgrade][AMDGPU] Adjust AS7 and AS9 address width to 48 bits (PR #137418)

2025-05-09 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Abandoning based on the discussion in https://discourse.llvm.org/t/clarifiying-the-semantics-of-ptrtoint/83987/54?u=arichardson https://github.com/llvm/llvm-project/pull/137418 ___ llvm-branch-commits mailing list llvm-branch-commit

[llvm-branch-commits] [AutoUpgrade][AMDGPU] Adjust AS7 and AS9 address width to 48 bits (PR #137418)

2025-05-01 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson edited https://github.com/llvm/llvm-project/pull/137418 ___ 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] [AutoUpgrade][AMDGPU] Adjust AS7 and AS9 address width to 48 bits (PR #137418)

2025-05-01 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/137418 ___ 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] [AutoUpgrade][AMDGPU] Adjust AS7 address width to 48 bits (PR #137418)

2025-04-30 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: > So, `ptr addrspace(7)` is, in your terms `{{flags, length, [stride == 0], > base}, offset}` where that inner struct is a `ptr addrspace(8)`. p9 is > `{{flags, length, stride, base}, index, offset}`. > > The common usage pattern I'd expect for ptr addrspace(7) is to make `b

[llvm-branch-commits] [AutoUpgrade][AMDGPU] Adjust AS7 address width to 48 bits (PR #137418)

2025-04-30 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: > So p9 is quite weird. It's used, IIRC, by, > https://github.com/GPUOpen-Drivers/llpc internally to represent "structured" > pointers, and so its interpretation is `{p8 rsrc, i32 index, i32 offset}` . > This does still have a 48-bit effective address by way of a thoroughly

[llvm-branch-commits] [AutoUpgrade][AMDGPU] Adjust AS7 address width to 48 bits (PR #137418)

2025-04-30 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: @krzysz00 I tried setting the p8 index size to 0 and this almost works but there are a handful of tests that fail. The first one is: ``` define ptr addrspace(8) @v_ptrmask_buffer_resource_variable_i128_neg8(ptr addrspace(8) %ptr) { ; GCN-LABEL: v_ptrmask_buffer_resource_vari

[llvm-branch-commits] [llvm] [DataLayout][LangRef] Split non-integral and unstable pointer properties (PR #105735)

2025-03-19 Thread Alexander Richardson via llvm-branch-commits
@@ -650,48 +650,127 @@ literal types are uniqued in recent versions of LLVM. .. _nointptrtype: -Non-Integral Pointer Type -- +Non-Integral and Unstable Pointer Types +--- -Note: non-integral pointer types are a wor

[llvm-branch-commits] [clang] release/20.x: [CSKY] Default to unsigned char (PR #126436)

2025-02-21 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: > @arichardson (or anyone else). If you would like to add a note about this fix > in the release notes (completely optional). Please reply to this comment with > a one or two sentence description of the fix. When you are done, please add > the release:note label to this PR.

[llvm-branch-commits] [clang] release/20.x: [CSKY] Default to unsigned char (PR #126436)

2025-02-21 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: > @arichardson Would you be able to create a follow-up PR with the a release > note entry? Sure, will do this. https://github.com/llvm/llvm-project/pull/126436 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [clang] release/20.x: [CSKY] Default to unsigned char (PR #126436)

2025-02-09 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: I feel it would make sense to backport this to the release so that Rust built against LLVM20 has a consistent c_char signedness (https://github.com/rust-lang/rust/pull/132975) https://github.com/llvm/llvm-project/pull/126436 ___ ll

[llvm-branch-commits] [llvm] [DataLayout][LangRef] Split non-integral and unstable pointer properties (PR #105735)

2025-01-08 Thread Alexander Richardson via llvm-branch-commits
@@ -650,48 +650,127 @@ literal types are uniqued in recent versions of LLVM. .. _nointptrtype: -Non-Integral Pointer Type -- +Non-Integral and Unstable Pointer Types +--- -Note: non-integral pointer types are a wor

[llvm-branch-commits] [llvm] [DataLayout][LangRef] Split non-integral and unstable pointer properties (PR #105735)

2025-01-06 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/105735 >From e4bd1181d160b8728e7d4158417a83e183bd1709 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Thu, 22 Aug 2024 14:36:04 -0700 Subject: [PATCH 1/3] fix indentation in langref Created using spr 1.3.6-be

[llvm-branch-commits] [llvm] [DataLayout][LangRef] Split non-integral and unstable pointer properties (PR #105735)

2025-01-06 Thread Alexander Richardson via llvm-branch-commits
arichardson wrote: Would be good to get some input from the GC pointers side regarding non-integral pointers. I am not sure who is the best person for this now since I was told @preames is no longer interested in non-integral pointers. https://github.com/llvm/llvm-project/pull/105735

[llvm-branch-commits] [llvm] [DataLayout][LangRef] Split non-integral and unstable pointer properties (PR #105735)

2025-01-06 Thread Alexander Richardson via llvm-branch-commits
https://github.com/arichardson updated https://github.com/llvm/llvm-project/pull/105735 >From e4bd1181d160b8728e7d4158417a83e183bd1709 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Thu, 22 Aug 2024 14:36:04 -0700 Subject: [PATCH 1/3] fix indentation in langref Created using spr 1.3.6-be

[llvm-branch-commits] [llvm] [DataLayout][LangRef] Split non-integral and unstable pointer properties (PR #105735)

2025-01-06 Thread Alexander Richardson via llvm-branch-commits
@@ -650,48 +650,127 @@ literal types are uniqued in recent versions of LLVM. .. _nointptrtype: -Non-Integral Pointer Type -- +Non-Integral and Unstable Pointer Types +--- -Note: non-integral pointer types are a wor

  1   2   3   >