[llvm-branch-commits] [llvm] llvm-cov: Show `FileCoverageSummary` with `getCoverageForFile()` (PR #121192)
@@ -23,6 +23,16 @@ using namespace llvm; namespace { +template +bool IsSummaryEmpty(const SummaryTy &Report, const CoverageViewOptions &Opts) { ornata wrote: case should be `isSummaryEmpty` https://github.com/llvm/llvm-project/pull/121192 ___ 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] llvm-cov: Show `FileCoverageSummary` with `getCoverageForFile()` (PR #121192)
@@ -23,6 +23,16 @@ using namespace llvm; namespace { +template +bool IsSummaryEmpty(const SummaryTy &Report, const CoverageViewOptions &Opts) { ornata wrote: function name case should be `isSummaryEmpty` https://github.com/llvm/llvm-project/pull/121192 ___ 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] llvm-cov: Show `FileCoverageSummary` with `getCoverageForFile()` (PR #121192)
ornata wrote: >"Merge" facilities with std::max are removed as well for now. why? https://github.com/llvm/llvm-project/pull/121192 ___ 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] llvm-cov: Show `FileCoverageSummary` with `getCoverageForFile()` (PR #121192)
@@ -1432,6 +1434,8 @@ CoverageData CoverageMapping::getCoverageForFile(StringRef Filename) const { getImpreciseRecordIndicesForFilename(Filename); for (unsigned RecordIndex : RecordIndices) { const FunctionRecord &Function = Functions[RecordIndex]; +if (FilteredOutFunctions.count(&Function)) ornata wrote: >From the commit message, it is not obvious to me why we are now filtering out >functions. Can you explain? https://github.com/llvm/llvm-project/pull/121192 ___ 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] [DirectX] Handle dx.RawBuffer in DXILResourceAccess (PR #121725)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff ae36a7c2aa0626febb00b7bcf581a00ea0042d23 192d20b16e418b89a549e93406f782ac0a0fa093 --extensions cpp -- llvm/lib/Target/DirectX/DXILResourceAccess.cpp `` View the diff from clang-format here. ``diff diff --git a/llvm/lib/Target/DirectX/DXILResourceAccess.cpp b/llvm/lib/Target/DirectX/DXILResourceAccess.cpp index b0074b58e4..5164fd3813 100644 --- a/llvm/lib/Target/DirectX/DXILResourceAccess.cpp +++ b/llvm/lib/Target/DirectX/DXILResourceAccess.cpp @@ -22,7 +22,7 @@ using namespace llvm; static Value *calculateGEPOffset(GetElementPtrInst *GEP, Value *PrevOffset, - dxil::ResourceTypeInfo &RTI) { + dxil::ResourceTypeInfo &RTI) { assert(!PrevOffset && "Non-constant GEP chains not handled yet"); const DataLayout &DL = GEP->getDataLayout(); @@ -191,8 +191,7 @@ static void createLoadIntrinsic(IntrinsicInst *II, LoadInst *LI, Value *Offset, llvm_unreachable("Unhandled case in switch"); } -static void -replaceAccess(IntrinsicInst *II, dxil::ResourceTypeInfo &RTI) { +static void replaceAccess(IntrinsicInst *II, dxil::ResourceTypeInfo &RTI) { // Process users keeping track of indexing accumulated from GEPs. struct AccessAndOffset { User *Access; `` https://github.com/llvm/llvm-project/pull/121725 ___ 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] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #112730)
@@ -1193,11 +1206,26 @@ std::pair CodeGenPGO::getIsCounterPair(const Stmt *S) const { } void CodeGenPGO::emitCounterSetOrIncrement(CGBuilderTy &Builder, const Stmt *S, + bool UseSkipPath, bool UseBoth, llvm::Value *StepV) { - if (!RegionCounterMap || !Builder.GetInsertBlock()) + if (!RegionCounterMap) return; - unsigned Counter = (*RegionCounterMap)[S].first; + unsigned Counter; + auto &TheMap = (*RegionCounterMap)[S]; + auto IsCounter = TheMap.getIsCounterPair(); + if (!UseSkipPath) { +if (!IsCounter.first) + return; +Counter = (TheMap.first & CounterPair::Mask); + } else { +if (!IsCounter.second) + return; +Counter = (TheMap.second & CounterPair::Mask); + } + + if (!Builder.GetInsertBlock()) chapuni wrote: It was the result of splitting the condition. ``` if (!RegionCounterMap || !Builder.GetInsertBlock()) return; ``` to ``` if (!RegionCounterMap) return; auto &TheMap = (*RegionCounterMap)[S]; // S should be allocated (as an initial value) ... if (!Builder.GetInsertBlock()) return; ``` https://github.com/llvm/llvm-project/pull/112730 ___ 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] [DirectX] Handle dx.RawBuffer in DXILResourceAccess (PR #121725)
llvmbot wrote: @llvm/pr-subscribers-backend-directx Author: Justin Bogner (bogner) Changes This adds handling for raw and structured buffers when lowering resource access via `llvm.dx.resource.getpointer`. Fixes #121714 --- Patch is 25.43 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/121725.diff 3 Files Affected: - (modified) llvm/lib/Target/DirectX/DXILResourceAccess.cpp (+178-77) - (added) llvm/test/CodeGen/DirectX/ResourceAccess/load_rawbuffer.ll (+167) - (added) llvm/test/CodeGen/DirectX/ResourceAccess/store_rawbuffer.ll (+124) ``diff diff --git a/llvm/lib/Target/DirectX/DXILResourceAccess.cpp b/llvm/lib/Target/DirectX/DXILResourceAccess.cpp index 837624935c5fae..b0074b58e403c4 100644 --- a/llvm/lib/Target/DirectX/DXILResourceAccess.cpp +++ b/llvm/lib/Target/DirectX/DXILResourceAccess.cpp @@ -21,99 +21,207 @@ using namespace llvm; -static void replaceTypedBufferAccess(IntrinsicInst *II, - dxil::ResourceTypeInfo &RTI) { - const DataLayout &DL = II->getDataLayout(); +static Value *calculateGEPOffset(GetElementPtrInst *GEP, Value *PrevOffset, + dxil::ResourceTypeInfo &RTI) { + assert(!PrevOffset && "Non-constant GEP chains not handled yet"); + + const DataLayout &DL = GEP->getDataLayout(); + + uint64_t ScalarSize = 1; + if (RTI.isTyped()) { +Type *ContainedType = RTI.getHandleTy()->getTypeParameter(0); +// We need the size of an element in bytes so that we can calculate the +// offset in elements given a total offset in bytes. +Type *ScalarType = ContainedType->getScalarType(); +ScalarSize = DL.getTypeSizeInBits(ScalarType) / 8; + } + + APInt ConstantOffset(DL.getIndexTypeSizeInBits(GEP->getType()), 0); + if (GEP->accumulateConstantOffset(DL, ConstantOffset)) { +APInt Scaled = ConstantOffset.udiv(ScalarSize); +return ConstantInt::get(Type::getInt32Ty(GEP->getContext()), Scaled); + } + + auto IndexIt = GEP->idx_begin(); + assert(cast(IndexIt)->getZExtValue() == 0 && + "GEP is not indexing through pointer"); + ++IndexIt; + Value *Offset = *IndexIt; + assert(++IndexIt == GEP->idx_end() && "Too many indices in GEP"); + return Offset; +} + +static void createTypedBufferStore(IntrinsicInst *II, StoreInst *SI, + Value *Offset, dxil::ResourceTypeInfo &RTI) { + IRBuilder<> Builder(SI); + Type *ContainedType = RTI.getHandleTy()->getTypeParameter(0); + Type *LoadType = StructType::get(ContainedType, Builder.getInt1Ty()); + + Value *V = SI->getValueOperand(); + if (V->getType() == ContainedType) { +// V is already the right type. +assert(!Offset && "store of whole element has offset?"); + } else if (V->getType() == ContainedType->getScalarType()) { +// We're storing a scalar, so we need to load the current value and only +// replace the relevant part. +auto *Load = Builder.CreateIntrinsic( +LoadType, Intrinsic::dx_resource_load_typedbuffer, +{II->getOperand(0), II->getOperand(1)}); +auto *Struct = Builder.CreateExtractValue(Load, {0}); + +// If we have an offset from seeing a GEP earlier, use that. Otherwise, 0. +if (!Offset) + Offset = ConstantInt::get(Builder.getInt32Ty(), 0); +V = Builder.CreateInsertElement(Struct, V, Offset); + } else { +llvm_unreachable("Store to typed resource has invalid type"); + } + + auto *Inst = Builder.CreateIntrinsic( + Builder.getVoidTy(), Intrinsic::dx_resource_store_typedbuffer, + {II->getOperand(0), II->getOperand(1), V}); + SI->replaceAllUsesWith(Inst); +} + +static void createRawStore(IntrinsicInst *II, StoreInst *SI, Value *Offset) { + IRBuilder<> Builder(SI); + + if (!Offset) +Offset = ConstantInt::get(Builder.getInt32Ty(), 0); + Value *V = SI->getValueOperand(); + // TODO: break up larger types + auto *Inst = Builder.CreateIntrinsic( + Builder.getVoidTy(), Intrinsic::dx_resource_store_rawbuffer, + {II->getOperand(0), II->getOperand(1), Offset, V}); + SI->replaceAllUsesWith(Inst); +} + +static void createStoreIntrinsic(IntrinsicInst *II, StoreInst *SI, + Value *Offset, dxil::ResourceTypeInfo &RTI) { + switch (RTI.getResourceKind()) { + case dxil::ResourceKind::TypedBuffer: +return createTypedBufferStore(II, SI, Offset, RTI); + case dxil::ResourceKind::RawBuffer: + case dxil::ResourceKind::StructuredBuffer: +return createRawStore(II, SI, Offset); + case dxil::ResourceKind::Texture1D: + case dxil::ResourceKind::Texture2D: + case dxil::ResourceKind::Texture2DMS: + case dxil::ResourceKind::Texture3D: + case dxil::ResourceKind::TextureCube: + case dxil::ResourceKind::Texture1DArray: + case dxil::ResourceKind::Texture2DArray: + case dxil::ResourceKind::Texture2DMSArray: + case dxil::ResourceKind::TextureCubeArray: + case dxil::ResourceKind::FeedbackTexture2D: + case dxil::ResourceKind::FeedbackTexture2D
[llvm-branch-commits] [llvm] [DirectX] Handle dx.RawBuffer in DXILResourceAccess (PR #121725)
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/121725 This adds handling for raw and structured buffers when lowering resource access via `llvm.dx.resource.getpointer`. Fixes #121714 >From 192d20b16e418b89a549e93406f782ac0a0fa093 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 20 Dec 2024 17:43:37 -0700 Subject: [PATCH] [DirectX] Handle dx.RawBuffer in DXILResourceAccess This adds handling for raw and structured buffers when lowering resource access via `llvm.dx.resource.getpointer`. Fixes #121714 --- .../lib/Target/DirectX/DXILResourceAccess.cpp | 255 -- .../DirectX/ResourceAccess/load_rawbuffer.ll | 167 .../DirectX/ResourceAccess/store_rawbuffer.ll | 124 + 3 files changed, 469 insertions(+), 77 deletions(-) create mode 100644 llvm/test/CodeGen/DirectX/ResourceAccess/load_rawbuffer.ll create mode 100644 llvm/test/CodeGen/DirectX/ResourceAccess/store_rawbuffer.ll diff --git a/llvm/lib/Target/DirectX/DXILResourceAccess.cpp b/llvm/lib/Target/DirectX/DXILResourceAccess.cpp index 837624935c5fae..b0074b58e403c4 100644 --- a/llvm/lib/Target/DirectX/DXILResourceAccess.cpp +++ b/llvm/lib/Target/DirectX/DXILResourceAccess.cpp @@ -21,99 +21,207 @@ using namespace llvm; -static void replaceTypedBufferAccess(IntrinsicInst *II, - dxil::ResourceTypeInfo &RTI) { - const DataLayout &DL = II->getDataLayout(); +static Value *calculateGEPOffset(GetElementPtrInst *GEP, Value *PrevOffset, + dxil::ResourceTypeInfo &RTI) { + assert(!PrevOffset && "Non-constant GEP chains not handled yet"); + + const DataLayout &DL = GEP->getDataLayout(); + + uint64_t ScalarSize = 1; + if (RTI.isTyped()) { +Type *ContainedType = RTI.getHandleTy()->getTypeParameter(0); +// We need the size of an element in bytes so that we can calculate the +// offset in elements given a total offset in bytes. +Type *ScalarType = ContainedType->getScalarType(); +ScalarSize = DL.getTypeSizeInBits(ScalarType) / 8; + } + + APInt ConstantOffset(DL.getIndexTypeSizeInBits(GEP->getType()), 0); + if (GEP->accumulateConstantOffset(DL, ConstantOffset)) { +APInt Scaled = ConstantOffset.udiv(ScalarSize); +return ConstantInt::get(Type::getInt32Ty(GEP->getContext()), Scaled); + } + + auto IndexIt = GEP->idx_begin(); + assert(cast(IndexIt)->getZExtValue() == 0 && + "GEP is not indexing through pointer"); + ++IndexIt; + Value *Offset = *IndexIt; + assert(++IndexIt == GEP->idx_end() && "Too many indices in GEP"); + return Offset; +} + +static void createTypedBufferStore(IntrinsicInst *II, StoreInst *SI, + Value *Offset, dxil::ResourceTypeInfo &RTI) { + IRBuilder<> Builder(SI); + Type *ContainedType = RTI.getHandleTy()->getTypeParameter(0); + Type *LoadType = StructType::get(ContainedType, Builder.getInt1Ty()); + + Value *V = SI->getValueOperand(); + if (V->getType() == ContainedType) { +// V is already the right type. +assert(!Offset && "store of whole element has offset?"); + } else if (V->getType() == ContainedType->getScalarType()) { +// We're storing a scalar, so we need to load the current value and only +// replace the relevant part. +auto *Load = Builder.CreateIntrinsic( +LoadType, Intrinsic::dx_resource_load_typedbuffer, +{II->getOperand(0), II->getOperand(1)}); +auto *Struct = Builder.CreateExtractValue(Load, {0}); + +// If we have an offset from seeing a GEP earlier, use that. Otherwise, 0. +if (!Offset) + Offset = ConstantInt::get(Builder.getInt32Ty(), 0); +V = Builder.CreateInsertElement(Struct, V, Offset); + } else { +llvm_unreachable("Store to typed resource has invalid type"); + } + + auto *Inst = Builder.CreateIntrinsic( + Builder.getVoidTy(), Intrinsic::dx_resource_store_typedbuffer, + {II->getOperand(0), II->getOperand(1), V}); + SI->replaceAllUsesWith(Inst); +} + +static void createRawStore(IntrinsicInst *II, StoreInst *SI, Value *Offset) { + IRBuilder<> Builder(SI); + + if (!Offset) +Offset = ConstantInt::get(Builder.getInt32Ty(), 0); + Value *V = SI->getValueOperand(); + // TODO: break up larger types + auto *Inst = Builder.CreateIntrinsic( + Builder.getVoidTy(), Intrinsic::dx_resource_store_rawbuffer, + {II->getOperand(0), II->getOperand(1), Offset, V}); + SI->replaceAllUsesWith(Inst); +} + +static void createStoreIntrinsic(IntrinsicInst *II, StoreInst *SI, + Value *Offset, dxil::ResourceTypeInfo &RTI) { + switch (RTI.getResourceKind()) { + case dxil::ResourceKind::TypedBuffer: +return createTypedBufferStore(II, SI, Offset, RTI); + case dxil::ResourceKind::RawBuffer: + case dxil::ResourceKind::StructuredBuffer: +return createRawStore(II, SI, Offset); + case dxil::ResourceKind::Texture1D: + case dxil::ResourceKind::Texture2D: + case dxil::ResourceKind::Texture2DMS: + ca
[llvm-branch-commits] [clang] [llvm] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #112730)
@@ -1193,11 +1206,26 @@ std::pair CodeGenPGO::getIsCounterPair(const Stmt *S) const { } void CodeGenPGO::emitCounterSetOrIncrement(CGBuilderTy &Builder, const Stmt *S, + bool UseSkipPath, bool UseBoth, llvm::Value *StepV) { - if (!RegionCounterMap || !Builder.GetInsertBlock()) + if (!RegionCounterMap) return; - unsigned Counter = (*RegionCounterMap)[S].first; + unsigned Counter; + auto &TheMap = (*RegionCounterMap)[S]; + auto IsCounter = TheMap.getIsCounterPair(); + if (!UseSkipPath) { +if (!IsCounter.first) + return; +Counter = (TheMap.first & CounterPair::Mask); chapuni wrote: I encapsulated it. See #112724. https://github.com/llvm/llvm-project/pull/112730 ___ 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] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #112730)
@@ -112,6 +112,7 @@ class CodeGenPGO { public: std::pair getIsCounterPair(const Stmt *S) const; chapuni wrote: I couldn't name better. ``` return {I->second.Executed.hasValue(), I->second.Skipped.hasValue()}; ``` It is defined in #112724. https://github.com/llvm/llvm-project/pull/112730 ___ 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] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #112730)
@@ -638,6 +638,10 @@ static unsigned getMaxCounterID(const CounterMappingContext &Ctx, unsigned MaxCounterID = 0; for (const auto &Region : Record.MappingRegions) { MaxCounterID = std::max(MaxCounterID, Ctx.getMaxCounterID(Region.Count)); +if (Region.Kind == CounterMappingRegion::BranchRegion || +Region.Kind == CounterMappingRegion::MCDCBranchRegion) + MaxCounterID = chapuni wrote: I guess there was no idea in initial designs to increase `Counter`s dynamically. It shall be improved in the future. https://github.com/llvm/llvm-project/pull/112730 ___ 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] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #120930)
@@ -1632,11 +1632,17 @@ class CodeGenFunction : public CodeGenTypeCache { /// Increment the profiler's counter for the given statement by \p StepV. /// If \p StepV is null, the default increment is 1. void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) { +incrementProfileCounter(false, S, false, StepV); + } + + void incrementProfileCounter(bool UseSkipPath, const Stmt *S, chapuni wrote: Done with introduction of `{UseExecPath, UseSkipPath}`. https://github.com/llvm/llvm-project/pull/120930 ___ 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] [Coverage] Make additional counters available for BranchRegion. NFC. (PR #120930)
@@ -940,15 +939,35 @@ struct CounterCoverageMappingBuilder std::pair getBranchCounterPair(const Stmt *S, Counter ParentCnt) { -Counter ExecCnt = getRegionCounter(S); -return {ExecCnt, Builder.subtract(ParentCnt, ExecCnt)}; +auto &TheMap = CounterMap[S]; +auto ExecCnt = Counter::getCounter(TheMap.first); chapuni wrote: I guess it assumes `S` always hit. The logic is similar to the current implementation. `TheMap` will be allocated with an initial value if `S` doesn't hit. We can introduce more strict checks. https://github.com/llvm/llvm-project/pull/120930 ___ 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] [Coverage][Single] Enable Branch coverage for IfStmt (PR #113111)
@@ -864,8 +864,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { // If the skipped block has no labels in it, just emit the executed block. // This avoids emitting dead code and simplifies the CFG substantially. if (S.isConstexpr() || !ContainsLabel(Skipped)) { - if (CondConstant) -incrementProfileCounter(&S); + incrementProfileCounter(!CondConstant, &S, true); chapuni wrote: Done. See also #120930. `UseBoth` is not classified since I think its usage is rare. https://github.com/llvm/llvm-project/pull/113111 ___ 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] [Coverage][Single] Enable Branch coverage for loop statements (PR #113109)
@@ -1400,14 +1375,12 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S, if (ExitBlock != LoopExit.getBlock()) { EmitBlock(ExitBlock); +incrementProfileCounter(true, &S); chapuni wrote: Done. See also #120930. https://github.com/llvm/llvm-project/pull/113109 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [AArch64][GlobalISel] Legalize vector boolean bitcasts to scalars by lowering via stack. (PR #121171)
https://github.com/aemerson updated https://github.com/llvm/llvm-project/pull/121171 >From 0be38ccf5c865b4fddc357b33c378c70a20532b9 Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Thu, 26 Dec 2024 16:13:55 -0800 Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?= =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.5 [skip ci] --- .../CodeGen/GlobalISel/LegalizerHelper.cpp| 14 ++-- .../AArch64/GISel/AArch64LegalizerInfo.cpp| 1 + .../legalize-store-vector-bools.mir | 32 +++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/legalize-store-vector-bools.mir diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index e2247f76098e97..a931123638ffb9 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -3022,8 +3022,18 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) { return UnableToLegalize; LLT Ty = MRI.getType(MI.getOperand(0).getReg()); -if (!Ty.isScalar()) - return UnableToLegalize; +if (!Ty.isScalar()) { + // We need to widen the vector element type. + Observer.changingInstr(MI); + widenScalarSrc(MI, WideTy, 0, TargetOpcode::G_ANYEXT); + // We also need to adjust the MMO to turn this into a truncating store. + MachineMemOperand &MMO = **MI.memoperands_begin(); + MachineFunction &MF = MIRBuilder.getMF(); + auto *NewMMO = MF.getMachineMemOperand(&MMO, MMO.getPointerInfo(), Ty); + MI.setMemRefs(MF, {NewMMO}); + Observer.changedInstr(MI); + return Legalized; +} Observer.changingInstr(MI); diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp index 4b7d4158faf069..2c35482b7c9e5f 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp @@ -454,6 +454,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) {nxv2s64, p0, nxv2s64, 8}, }) .clampScalar(0, s8, s64) + .minScalarOrElt(0, s8) .lowerIf([=](const LegalityQuery &Query) { return Query.Types[0].isScalar() && Query.Types[0] != Query.MMODescrs[0].MemoryTy; diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-store-vector-bools.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-store-vector-bools.mir new file mode 100644 index 00..de70f89461780b --- /dev/null +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-store-vector-bools.mir @@ -0,0 +1,32 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -O0 -mtriple=aarch64 -run-pass=legalizer -global-isel-abort=2 %s -o - | FileCheck %s +# This test currently is expected to fall back after reaching truncstore of <8 x s8> as <8 x s1>. +--- +name:store_8xs1 +tracksRegLiveness: true +body: | + bb.1: +liveins: $q0, $q1, $x0 +; CHECK-LABEL: name: store_8xs1 +; CHECK: liveins: $q0, $q1, $x0 +; CHECK-NEXT: {{ $}} +; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0 +; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1 +; CHECK-NEXT: %ptr:_(p0) = COPY $x0 +; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>) +; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 +; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<8 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32) +; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<8 x s1>) = G_ICMP intpred(slt), [[CONCAT_VECTORS]](<8 x s32>), [[BUILD_VECTOR]] +; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<8 x s8>) = G_ANYEXT [[ICMP]](<8 x s1>) +; CHECK-NEXT: G_STORE [[ANYEXT]](<8 x s8>), %ptr(p0) :: (store (<8 x s1>)) +; CHECK-NEXT: RET_ReallyLR +%1:_(<4 x s32>) = COPY $q0 +%2:_(<4 x s32>) = COPY $q1 +%ptr:_(p0) = COPY $x0 +%0:_(<8 x s32>) = G_CONCAT_VECTORS %1(<4 x s32>), %2(<4 x s32>) +%4:_(s32) = G_CONSTANT i32 0 +%3:_(<8 x s32>) = G_BUILD_VECTOR %4(s32), %4(s32), %4(s32), %4(s32), %4(s32), %4(s32), %4(s32), %4(s32) +%5:_(<8 x s1>) = G_ICMP intpred(slt), %0(<8 x s32>), %3 +G_STORE %5(<8 x s1>), %ptr(p0) :: (store (<8 x s1>)) +RET_ReallyLR +... >From 18da0bff65252d4ef62f7dcefa73b7b508d10bec Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Fri, 27 Dec 2024 10:49:17 -0800 Subject: [PATCH 2/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?= =?UTF-8?q?anges=20introduced=20through=20rebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-T
[llvm-branch-commits] [llvm] llvm-cov: Show `FileCoverageSummary` with `getCoverageForFile()` (PR #121192)
@@ -1432,6 +1434,8 @@ CoverageData CoverageMapping::getCoverageForFile(StringRef Filename) const { getImpreciseRecordIndicesForFilename(Filename); for (unsigned RecordIndex : RecordIndices) { const FunctionRecord &Function = Functions[RecordIndex]; +if (FilteredOutFunctions.count(&Function)) chapuni wrote: The caller, llvm-cov, has the filter. I chose "blacklist" (rather than whitelist) since it is expected empty in usual cases. https://github.com/llvm/llvm-project/pull/121192 ___ 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] llvm-cov: Show `FileCoverageSummary` with `getCoverageForFile()` (PR #121192)
chapuni wrote: > > "Merge" facilities with std::max are removed as well for now. > > why? They will be reintroduced later, "Any" in #121194 . To be honest, I didn't imagine the way to preserve the old behavior. For now, this change introduces "Merge" behavior partially. https://github.com/llvm/llvm-project/pull/121192 ___ 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] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--fmodule-output` (PR #121046)
https://github.com/sharadhr updated https://github.com/llvm/llvm-project/pull/121046 >From a9f921227abccda6c82137bed0b95041f584a147 Mon Sep 17 00:00:00 2001 From: Sharadh Rajaraman Date: Tue, 24 Dec 2024 09:32:21 + Subject: [PATCH 1/2] Accept /Fo and -Fo in `-fmodule-output` when running under CL mode --- clang/lib/Driver/Driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index bc5ce9f14ab698..268d836841a107 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -5978,7 +5978,7 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA, llvm::PrettyStackTraceString CrashInfo("Computing output path"); // Output to a user requested destination? if (AtTopLevel && !isa(JA) && !isa(JA)) { -if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o)) +if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON)) return C.addResultFile(FinalOutput->getValue(), &JA); } >From bc9b68d11d8f4a2fe76b26b13d805126c40beafd Mon Sep 17 00:00:00 2001 From: Sharadh Rajaraman Date: Sun, 5 Jan 2025 14:09:24 + Subject: [PATCH 2/2] Use `IsCLMode` to guard cl-style output argument presence --- clang/lib/Driver/Driver.cpp | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 268d836841a107..9ea9ea390216f3 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -5978,8 +5978,15 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA, llvm::PrettyStackTraceString CrashInfo("Computing output path"); // Output to a user requested destination? if (AtTopLevel && !isa(JA) && !isa(JA)) { -if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON)) +Arg *FinalOutput = +IsCLMode() +? C.getArgs().getLastArg(options::OPT_o, options::OPT__SLASH_Fo, + options::OPT__SLASH_Fo_COLON) +: C.getArgs().getLastArg(options::OPT_o); + +if (FinalOutput != nullptr) { return C.addResultFile(FinalOutput->getValue(), &JA); +} } // For /P, preprocess to file named after BaseInput. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits