Skip to content

Commit 2b15c4a

Browse files
authored
[AArch64] Postcommit fixes for histogram intrinsic (#92095)
A buildbot with expensive checks enabled flagged some problems with my patch. There was also a post-commit nit on the langref changes.
1 parent 041baf2 commit 2b15c4a

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

llvm/docs/LangRef.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19143,8 +19143,8 @@ will be on any later loop iteration.
1914319143
This intrinsic will only return 0 if the input count is also 0. A non-zero input
1914419144
count will produce a non-zero result.
1914519145

19146-
'``llvm.experimental.vector.histogram.*``' Intrinsics
19147-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19146+
'``llvm.experimental.vector.histogram.*``' Intrinsic
19147+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1914819148

1914919149
These intrinsics are overloaded.
1915019150

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27395,9 +27395,11 @@ SDValue AArch64TargetLowering::LowerVECTOR_HISTOGRAM(SDValue Op,
2739527395
SDValue IncSplat = DAG.getSplatVector(MemVT, DL, Inc);
2739627396
SDValue Ops[] = {Chain, PassThru, Mask, Ptr, Index, Scale};
2739727397

27398-
// Set the MMO to load only, rather than load|store.
27399-
MachineMemOperand *GMMO = HG->getMemOperand();
27400-
GMMO->setFlags(MachineMemOperand::MOLoad);
27398+
MachineMemOperand *MMO = HG->getMemOperand();
27399+
// Create an MMO for the gather, without load|store flags.
27400+
MachineMemOperand *GMMO = DAG.getMachineFunction().getMachineMemOperand(
27401+
MMO->getPointerInfo(), MachineMemOperand::MOLoad, MMO->getSize(),
27402+
MMO->getAlign(), MMO->getAAInfo());
2740127403
ISD::MemIndexType IndexType = HG->getIndexType();
2740227404
SDValue Gather =
2740327405
DAG.getMaskedGather(DAG.getVTList(MemVT, MVT::Other), MemVT, DL, Ops,
@@ -27412,10 +27414,10 @@ SDValue AArch64TargetLowering::LowerVECTOR_HISTOGRAM(SDValue Op,
2741227414
SDValue Mul = DAG.getNode(ISD::MUL, DL, MemVT, HistCnt, IncSplat);
2741327415
SDValue Add = DAG.getNode(ISD::ADD, DL, MemVT, Gather, Mul);
2741427416

27415-
// Create a new MMO for the scatter.
27417+
// Create an MMO for the scatter, without load|store flags.
2741627418
MachineMemOperand *SMMO = DAG.getMachineFunction().getMachineMemOperand(
27417-
GMMO->getPointerInfo(), MachineMemOperand::MOStore, GMMO->getSize(),
27418-
GMMO->getAlign(), GMMO->getAAInfo());
27419+
MMO->getPointerInfo(), MachineMemOperand::MOStore, MMO->getSize(),
27420+
MMO->getAlign(), MMO->getAAInfo());
2741927421

2742027422
SDValue ScatterOps[] = {GChain, Add, Mask, Ptr, Index, Scale};
2742127423
SDValue Scatter = DAG.getMaskedScatter(DAG.getVTList(MVT::Other), MemVT, DL,

llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
10061006
CI->getArgOperand(1)->getType()))
10071007
return false;
10081008
scalarizeMaskedVectorHistogram(DL, CI, DTU, ModifiedDT);
1009-
break;
1009+
return true;
10101010
case Intrinsic::masked_load:
10111011
// Scalarize unsupported vector masked load
10121012
if (TTI.isLegalMaskedLoad(

llvm/test/CodeGen/AArch64/neon-scalarize-histogram.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2-
; RUN: llc -mtriple=aarch64 < %s -o - | FileCheck %s
2+
; RUN: llc -mtriple=aarch64 -verify-machineinstrs < %s -o - | FileCheck %s
33

44
;; This test exercises the default lowering of the histogram to scalarized code.
55

llvm/test/CodeGen/AArch64/sve2-histcnt.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2-
; RUN: llc -mtriple=aarch64 < %s -o - | FileCheck %s
2+
; RUN: llc -mtriple=aarch64 -verify-machineinstrs < %s -o - | FileCheck %s
33

44
define void @histogram_i64(<vscale x 2 x ptr> %buckets, i64 %inc, <vscale x 2 x i1> %mask) #0 {
55
; CHECK-LABEL: histogram_i64:

0 commit comments

Comments
 (0)