294 changes: 182 additions & 112 deletions llvm/lib/Transforms/IPO/Attributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "llvm/Transforms/IPO/Attributor.h"

#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
Expand All @@ -24,6 +25,7 @@
#include "llvm/Analysis/InlineCost.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/MustExecute.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantFold.h"
Expand All @@ -34,13 +36,15 @@
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/DebugCounter.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
Expand Down Expand Up @@ -904,38 +908,42 @@ static bool isEqualOrWorse(const Attribute &New, const Attribute &Old) {
}

/// Return true if the information provided by \p Attr was added to the
/// attribute list \p Attrs. This is only the case if it was not already present
/// in \p Attrs at the position describe by \p PK and \p AttrIdx.
/// attribute set \p AttrSet. This is only the case if it was not already
/// present in \p AttrSet.
static bool addIfNotExistent(LLVMContext &Ctx, const Attribute &Attr,
AttributeList &Attrs, int AttrIdx,
bool ForceReplace = false) {
AttributeSet AttrSet, bool ForceReplace,
AttrBuilder &AB) {

if (Attr.isEnumAttribute()) {
Attribute::AttrKind Kind = Attr.getKindAsEnum();
if (Attrs.hasAttributeAtIndex(AttrIdx, Kind))
if (!ForceReplace &&
isEqualOrWorse(Attr, Attrs.getAttributeAtIndex(AttrIdx, Kind)))
return false;
Attrs = Attrs.addAttributeAtIndex(Ctx, AttrIdx, Attr);
if (AttrSet.hasAttribute(Kind))
return false;
AB.addAttribute(Kind);
return true;
}
if (Attr.isStringAttribute()) {
StringRef Kind = Attr.getKindAsString();
if (Attrs.hasAttributeAtIndex(AttrIdx, Kind))
if (!ForceReplace &&
isEqualOrWorse(Attr, Attrs.getAttributeAtIndex(AttrIdx, Kind)))
if (AttrSet.hasAttribute(Kind)) {
if (!ForceReplace)
return false;
Attrs = Attrs.addAttributeAtIndex(Ctx, AttrIdx, Attr);
}
AB.addAttribute(Kind, Attr.getValueAsString());
return true;
}
if (Attr.isIntAttribute()) {
Attribute::AttrKind Kind = Attr.getKindAsEnum();
if (Attrs.hasAttributeAtIndex(AttrIdx, Kind))
if (!ForceReplace &&
isEqualOrWorse(Attr, Attrs.getAttributeAtIndex(AttrIdx, Kind)))
if (!ForceReplace && Kind == Attribute::Memory) {
MemoryEffects ME = Attr.getMemoryEffects() & AttrSet.getMemoryEffects();
if (ME == AttrSet.getMemoryEffects())
return false;
AB.addMemoryAttr(ME);
return true;
}
if (AttrSet.hasAttribute(Kind)) {
if (!ForceReplace && isEqualOrWorse(Attr, AttrSet.getAttribute(Kind)))
return false;
Attrs = Attrs.removeAttributeAtIndex(Ctx, AttrIdx, Kind);
Attrs = Attrs.addAttributeAtIndex(Ctx, AttrIdx, Attr);
}
AB.addAttribute(Attr);
return true;
}

Expand Down Expand Up @@ -1011,11 +1019,44 @@ ChangeStatus AbstractAttribute::update(Attributor &A) {
return HasChanged;
}

bool Attributor::getAttrsFromAssumes(const IRPosition &IRP,
Attribute::AttrKind AK,
SmallVectorImpl<Attribute> &Attrs) {
assert(IRP.getPositionKind() != IRPosition::IRP_INVALID &&
"Did expect a valid position!");
MustBeExecutedContextExplorer *Explorer =
getInfoCache().getMustBeExecutedContextExplorer();
if (!Explorer)
return false;

Value &AssociatedValue = IRP.getAssociatedValue();

const Assume2KnowledgeMap &A2K =
getInfoCache().getKnowledgeMap().lookup({&AssociatedValue, AK});

// Check if we found any potential assume use, if not we don't need to create
// explorer iterators.
if (A2K.empty())
return false;

LLVMContext &Ctx = AssociatedValue.getContext();
unsigned AttrsSize = Attrs.size();
auto EIt = Explorer->begin(IRP.getCtxI()),
EEnd = Explorer->end(IRP.getCtxI());
for (const auto &It : A2K)
if (Explorer->findInContextOf(It.first, EIt, EEnd))
Attrs.push_back(Attribute::get(Ctx, AK, It.second.Max));
return AttrsSize != Attrs.size();
}

template <typename DescTy>
ChangeStatus
IRAttributeManifest::manifestAttrs(Attributor &A, const IRPosition &IRP,
const ArrayRef<Attribute> &DeducedAttrs,
bool ForceReplace) {
if (DeducedAttrs.empty())
Attributor::updateAttrMap(const IRPosition &IRP,
const ArrayRef<DescTy> &AttrDescs,
function_ref<bool(const DescTy &, AttributeSet,
AttributeMask &, AttrBuilder &)>
CB) {
if (AttrDescs.empty())
return ChangeStatus::UNCHANGED;
switch (IRP.getPositionKind()) {
case IRPosition::IRP_FLOAT:
Expand All @@ -1025,25 +1066,121 @@ IRAttributeManifest::manifestAttrs(Attributor &A, const IRPosition &IRP,
break;
};

// In the following some generic code that will manifest attributes in
// DeducedAttrs if they improve the current IR. Due to the different
// annotation positions we use the underlying AttributeList interface.
AttributeList Attrs = IRP.getAttrList();
AttributeList AL;
Value *AttrListAnchor = IRP.getAttrListAnchor();
auto It = AttrsMap.find(AttrListAnchor);
if (It == AttrsMap.end())
AL = IRP.getAttrList();
else
AL = It->getSecond();

ChangeStatus HasChanged = ChangeStatus::UNCHANGED;
LLVMContext &Ctx = IRP.getAnchorValue().getContext();
for (const Attribute &Attr : DeducedAttrs) {
if (!addIfNotExistent(Ctx, Attr, Attrs, IRP.getAttrIdx(), ForceReplace))
continue;
auto AttrIdx = IRP.getAttrIdx();
AttributeSet AS = AL.getAttributes(AttrIdx);
AttributeMask AM;
AttrBuilder AB(Ctx);

HasChanged = ChangeStatus::CHANGED;
}
ChangeStatus HasChanged = ChangeStatus::UNCHANGED;
for (const DescTy &AttrDesc : AttrDescs)
if (CB(AttrDesc, AS, AM, AB))
HasChanged = ChangeStatus::CHANGED;

if (HasChanged == ChangeStatus::UNCHANGED)
return HasChanged;
return ChangeStatus::UNCHANGED;

IRP.setAttrList(Attrs);
return HasChanged;
AL = AL.removeAttributesAtIndex(Ctx, AttrIdx, AM);
AL = AL.addAttributesAtIndex(Ctx, AttrIdx, AB);
AttrsMap[AttrListAnchor] = AL;
return ChangeStatus::CHANGED;
}

bool Attributor::hasAttr(const IRPosition &IRP,
ArrayRef<Attribute::AttrKind> AttrKinds,
bool IgnoreSubsumingPositions,
Attribute::AttrKind ImpliedAttributeKind) {
bool Implied = false;
bool HasAttr = false;
auto HasAttrCB = [&](const Attribute::AttrKind &Kind, AttributeSet AttrSet,
AttributeMask &, AttrBuilder &) {
if (AttrSet.hasAttribute(Kind)) {
Implied |= Kind != ImpliedAttributeKind;
HasAttr = true;
}
return false;
};
for (const IRPosition &EquivIRP : SubsumingPositionIterator(IRP)) {
updateAttrMap<Attribute::AttrKind>(EquivIRP, AttrKinds, HasAttrCB);
if (HasAttr)
break;
// The first position returned by the SubsumingPositionIterator is
// always the position itself. If we ignore subsuming positions we
// are done after the first iteration.
if (IgnoreSubsumingPositions)
break;
Implied = true;
}
if (!HasAttr) {
Implied = true;
SmallVector<Attribute> Attrs;
for (Attribute::AttrKind AK : AttrKinds)
if (getAttrsFromAssumes(IRP, AK, Attrs)) {
HasAttr = true;
break;
}
}

// Check if we should manifest the implied attribute kind at the IRP.
if (ImpliedAttributeKind != Attribute::None && HasAttr && Implied)
manifestAttrs(IRP, {Attribute::get(IRP.getAnchorValue().getContext(),
ImpliedAttributeKind)});
return HasAttr;
}

void Attributor::getAttrs(const IRPosition &IRP,
ArrayRef<Attribute::AttrKind> AttrKinds,
SmallVectorImpl<Attribute> &Attrs,
bool IgnoreSubsumingPositions) {
auto CollectAttrCB = [&](const Attribute::AttrKind &Kind,
AttributeSet AttrSet, AttributeMask &,
AttrBuilder &) {
if (AttrSet.hasAttribute(Kind))
Attrs.push_back(AttrSet.getAttribute(Kind));
return false;
};
for (const IRPosition &EquivIRP : SubsumingPositionIterator(IRP)) {
updateAttrMap<Attribute::AttrKind>(EquivIRP, AttrKinds, CollectAttrCB);
// The first position returned by the SubsumingPositionIterator is
// always the position itself. If we ignore subsuming positions we
// are done after the first iteration.
if (IgnoreSubsumingPositions)
break;
}
for (Attribute::AttrKind AK : AttrKinds)
getAttrsFromAssumes(IRP, AK, Attrs);
}

ChangeStatus
Attributor::removeAttrs(const IRPosition &IRP,
const ArrayRef<Attribute::AttrKind> &AttrKinds) {
auto RemoveAttrCB = [&](const Attribute::AttrKind &Kind, AttributeSet AttrSet,
AttributeMask &AM, AttrBuilder &) {
if (!AttrSet.hasAttribute(Kind))
return false;
AM.addAttribute(Kind);
return true;
};
return updateAttrMap<Attribute::AttrKind>(IRP, AttrKinds, RemoveAttrCB);
}

ChangeStatus Attributor::manifestAttrs(const IRPosition &IRP,
const ArrayRef<Attribute> &Attrs,
bool ForceReplace) {
LLVMContext &Ctx = IRP.getAnchorValue().getContext();
auto AddAttrCB = [&](const Attribute &Attr, AttributeSet AttrSet,
AttributeMask &, AttrBuilder &AB) {
return addIfNotExistent(Ctx, Attr, AttrSet, ForceReplace, AB);
};
return updateAttrMap<Attribute>(IRP, Attrs, AddAttrCB);
}

const IRPosition IRPosition::EmptyKey(DenseMapInfo<void *>::getEmptyKey());
Expand Down Expand Up @@ -1117,83 +1254,6 @@ SubsumingPositionIterator::SubsumingPositionIterator(const IRPosition &IRP) {
}
}

bool IRPosition::hasAttr(ArrayRef<Attribute::AttrKind> AKs,
bool IgnoreSubsumingPositions, Attributor *A) const {
SmallVector<Attribute, 4> Attrs;
for (const IRPosition &EquivIRP : SubsumingPositionIterator(*this)) {
for (Attribute::AttrKind AK : AKs)
if (EquivIRP.getAttrsFromIRAttr(AK, Attrs))
return true;
// The first position returned by the SubsumingPositionIterator is
// always the position itself. If we ignore subsuming positions we
// are done after the first iteration.
if (IgnoreSubsumingPositions)
break;
}
if (A)
for (Attribute::AttrKind AK : AKs)
if (getAttrsFromAssumes(AK, Attrs, *A))
return true;
return false;
}

void IRPosition::getAttrs(ArrayRef<Attribute::AttrKind> AKs,
SmallVectorImpl<Attribute> &Attrs,
bool IgnoreSubsumingPositions, Attributor *A) const {
for (const IRPosition &EquivIRP : SubsumingPositionIterator(*this)) {
for (Attribute::AttrKind AK : AKs)
EquivIRP.getAttrsFromIRAttr(AK, Attrs);
// The first position returned by the SubsumingPositionIterator is
// always the position itself. If we ignore subsuming positions we
// are done after the first iteration.
if (IgnoreSubsumingPositions)
break;
}
if (A)
for (Attribute::AttrKind AK : AKs)
getAttrsFromAssumes(AK, Attrs, *A);
}

bool IRPosition::getAttrsFromIRAttr(Attribute::AttrKind AK,
SmallVectorImpl<Attribute> &Attrs) const {
if (getPositionKind() == IRP_INVALID || getPositionKind() == IRP_FLOAT)
return false;

AttributeList AttrList = getAttrList();

bool HasAttr = AttrList.hasAttributeAtIndex(getAttrIdx(), AK);
if (HasAttr)
Attrs.push_back(AttrList.getAttributeAtIndex(getAttrIdx(), AK));
return HasAttr;
}

bool IRPosition::getAttrsFromAssumes(Attribute::AttrKind AK,
SmallVectorImpl<Attribute> &Attrs,
Attributor &A) const {
assert(getPositionKind() != IRP_INVALID && "Did expect a valid position!");
Value &AssociatedValue = getAssociatedValue();

const Assume2KnowledgeMap &A2K =
A.getInfoCache().getKnowledgeMap().lookup({&AssociatedValue, AK});

// Check if we found any potential assume use, if not we don't need to create
// explorer iterators.
if (A2K.empty())
return false;

LLVMContext &Ctx = AssociatedValue.getContext();
unsigned AttrsSize = Attrs.size();
MustBeExecutedContextExplorer *Explorer =
A.getInfoCache().getMustBeExecutedContextExplorer();
if (!Explorer)
return false;
auto EIt = Explorer->begin(getCtxI()), EEnd = Explorer->end(getCtxI());
for (const auto &It : A2K)
if (Explorer->findInContextOf(It.first, EIt, EEnd))
Attrs.push_back(Attribute::get(Ctx, AK, It.second.Max));
return AttrsSize != Attrs.size();
}

void IRPosition::verify() {
#ifdef EXPENSIVE_CHECKS
switch (getPositionKind()) {
Expand Down Expand Up @@ -2188,6 +2248,16 @@ ChangeStatus Attributor::manifestAttributes() {
llvm_unreachable("Expected the final number of abstract attributes to "
"remain unchanged!");
}

for (auto &It : AttrsMap) {
AttributeList &AL = It.getSecond();
const IRPosition &IRP =
isa<Function>(It.getFirst())
? IRPosition::function(*cast<Function>(It.getFirst()))
: IRPosition::callsite_function(*cast<CallBase>(It.getFirst()));
IRP.setAttrList(AL);
}

return ManifestChange;
}

Expand Down
182 changes: 75 additions & 107 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ define i32 @foo(ptr %A) {
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
; CGSCC-LABEL: define {{[^@]+}}@foo
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR1:[0-9]+]] {
; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]])
; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]]) #[[ATTR2:[0-9]+]]
; CGSCC-NEXT: ret i32 [[X]]
;
%X = call i32 @callee(i1 false, ptr %A) ; <i32> [#uses=1]
Expand All @@ -54,8 +54,9 @@ define i32 @foo(ptr %A) {

;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR2]] = { memory(read) }
;.
22 changes: 12 additions & 10 deletions llvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ define void @no_promote(ptr %arg) #1 {
; TUNIT-NEXT: bb:
; TUNIT-NEXT: [[TMP:%.*]] = alloca <4 x i64>, align 32
; TUNIT-NEXT: [[TMP2:%.*]] = alloca <4 x i64>, align 32
; TUNIT-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false)
; TUNIT-NEXT: call fastcc void @no_promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], ptr noalias nocapture nofree noundef nonnull readonly align 32 dereferenceable(32) [[TMP]]) #[[ATTR3:[0-9]+]]
; TUNIT-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR3:[0-9]+]]
; TUNIT-NEXT: call fastcc void @no_promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], ptr noalias nocapture nofree noundef nonnull readonly align 32 dereferenceable(32) [[TMP]]) #[[ATTR4:[0-9]+]]
; TUNIT-NEXT: [[TMP4:%.*]] = load <4 x i64>, ptr [[TMP2]], align 32
; TUNIT-NEXT: store <4 x i64> [[TMP4]], ptr [[ARG]], align 2
; TUNIT-NEXT: ret void
Expand All @@ -40,8 +40,8 @@ define void @no_promote(ptr %arg) #1 {
; CGSCC-NEXT: bb:
; CGSCC-NEXT: [[TMP:%.*]] = alloca <4 x i64>, align 32
; CGSCC-NEXT: [[TMP2:%.*]] = alloca <4 x i64>, align 32
; CGSCC-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false)
; CGSCC-NEXT: call fastcc void @no_promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], ptr noalias nocapture nofree noundef nonnull readonly align 32 dereferenceable(32) [[TMP]]) #[[ATTR3:[0-9]+]]
; CGSCC-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR3:[0-9]+]]
; CGSCC-NEXT: call fastcc void @no_promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], ptr noalias nocapture nofree noundef nonnull readonly align 32 dereferenceable(32) [[TMP]]) #[[ATTR4:[0-9]+]]
; CGSCC-NEXT: [[TMP4:%.*]] = load <4 x i64>, ptr [[TMP2]], align 32
; CGSCC-NEXT: store <4 x i64> [[TMP4]], ptr [[ARG]], align 2
; CGSCC-NEXT: ret void
Expand Down Expand Up @@ -80,9 +80,9 @@ define void @promote(ptr %arg) #0 {
; TUNIT-NEXT: bb:
; TUNIT-NEXT: [[TMP:%.*]] = alloca <4 x i64>, align 32
; TUNIT-NEXT: [[TMP2:%.*]] = alloca <4 x i64>, align 32
; TUNIT-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false)
; TUNIT-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR3]]
; TUNIT-NEXT: [[TMP0:%.*]] = load <4 x i64>, ptr [[TMP]], align 32
; TUNIT-NEXT: call fastcc void @promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], <4 x i64> [[TMP0]]) #[[ATTR3]]
; TUNIT-NEXT: call fastcc void @promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], <4 x i64> [[TMP0]]) #[[ATTR4]]
; TUNIT-NEXT: [[TMP4:%.*]] = load <4 x i64>, ptr [[TMP2]], align 32
; TUNIT-NEXT: store <4 x i64> [[TMP4]], ptr [[ARG]], align 2
; TUNIT-NEXT: ret void
Expand All @@ -93,9 +93,9 @@ define void @promote(ptr %arg) #0 {
; CGSCC-NEXT: bb:
; CGSCC-NEXT: [[TMP:%.*]] = alloca <4 x i64>, align 32
; CGSCC-NEXT: [[TMP2:%.*]] = alloca <4 x i64>, align 32
; CGSCC-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false)
; CGSCC-NEXT: call void @llvm.memset.p0.i64(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR3]]
; CGSCC-NEXT: [[TMP0:%.*]] = load <4 x i64>, ptr [[TMP]], align 32
; CGSCC-NEXT: call fastcc void @promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], <4 x i64> [[TMP0]]) #[[ATTR3]]
; CGSCC-NEXT: call fastcc void @promote_avx2(ptr noalias nocapture nofree noundef nonnull writeonly align 32 dereferenceable(32) [[TMP2]], <4 x i64> [[TMP0]]) #[[ATTR4]]
; CGSCC-NEXT: [[TMP4:%.*]] = load <4 x i64>, ptr [[TMP2]], align 32
; CGSCC-NEXT: store <4 x i64> [[TMP4]], ptr [[ARG]], align 2
; CGSCC-NEXT: ret void
Expand All @@ -120,10 +120,12 @@ attributes #2 = { argmemonly nounwind }
; TUNIT: attributes #[[ATTR0]] = { inlinehint mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "target-features"="+avx2" }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable }
; TUNIT: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR3]] = { memory(write) }
; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn }
;.
; CGSCC: attributes #[[ATTR0]] = { inlinehint mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "target-features"="+avx2" }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable }
; CGSCC: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
; CGSCC: attributes #[[ATTR3]] = { nounwind }
; CGSCC: attributes #[[ATTR3]] = { memory(write) }
; CGSCC: attributes #[[ATTR4]] = { nounwind }
;.

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ define i32 @main() nounwind {
; TUNIT-NEXT: store i32 1, ptr [[S]], align 32
; TUNIT-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i32 0, i32 1
; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[S]], align 8
; TUNIT-NEXT: [[S_0_1:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i64 0, i32 1
; TUNIT-NEXT: [[TMP1:%.*]] = load i64, ptr [[S_0_1]], align 8
; TUNIT-NEXT: [[S_0_11:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i64 0, i32 1
; TUNIT-NEXT: [[TMP1:%.*]] = load i64, ptr [[S_0_11]], align 8
; TUNIT-NEXT: [[C0:%.*]] = call i32 @f(i32 [[TMP0]], i64 [[TMP1]]) #[[ATTR2:[0-9]+]]
; TUNIT-NEXT: [[TMP2:%.*]] = load i32, ptr [[S]], align 32
; TUNIT-NEXT: [[S_0_11:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i64 0, i32 1
; TUNIT-NEXT: [[TMP3:%.*]] = load i64, ptr [[S_0_11]], align 32
; TUNIT-NEXT: [[S_0_1:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i64 0, i32 1
; TUNIT-NEXT: [[TMP3:%.*]] = load i64, ptr [[S_0_1]], align 32
; TUNIT-NEXT: [[C1:%.*]] = call i32 @g(i32 [[TMP2]], i64 [[TMP3]]) #[[ATTR2]]
; TUNIT-NEXT: [[A:%.*]] = add i32 [[C0]], [[C1]]
; TUNIT-NEXT: ret i32 [[A]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ entry:

;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ define i32 @foo(i1 %C, ptr %P) {
; CGSCC-LABEL: define {{[^@]+}}@foo
; CGSCC-SAME: (i1 noundef [[C:%.*]], ptr nocapture nofree readonly [[P:%.*]]) #[[ATTR1:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(i1 noundef [[C]], ptr nocapture nofree readonly [[P]])
; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(i1 noundef [[C]], ptr nocapture nofree readonly [[P]]) #[[ATTR2:[0-9]+]]
; CGSCC-NEXT: ret i32 [[X]]
;
entry:
Expand All @@ -48,8 +48,9 @@ entry:

;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR2]] = { memory(read) }
;.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define i32 @foo() {
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@foo
; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(i32 noundef 17)
; CGSCC-NEXT: [[X:%.*]] = call i32 @callee(i32 noundef 17) #[[ATTR2:[0-9]+]]
; CGSCC-NEXT: ret i32 [[X]]
;
%A = alloca i32 ; <ptr> [#uses=2]
Expand All @@ -51,6 +51,7 @@ define i32 @foo() {
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { memory(read) }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}
4 changes: 2 additions & 2 deletions llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ declare i32 @wibble(...)
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR2]] = { noreturn nounwind }
; TUNIT: attributes #[[ATTR2]] = { noreturn nounwind memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noreturn nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR4]] = { noreturn nounwind }
; CGSCC: attributes #[[ATTR4]] = { noreturn nounwind memory(none) }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}
5 changes: 3 additions & 2 deletions llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define i32 @main() {
; CGSCC-NEXT: [[F1:%.*]] = getelementptr [[STRUCT_SS]], ptr [[S]], i32 0, i32 1
; CGSCC-NEXT: store i32 1, ptr [[S]], align 4
; CGSCC-NEXT: store i32 2, ptr [[F1]], align 4
; CGSCC-NEXT: [[R:%.*]] = call i32 @f(ptr noalias nocapture nofree noundef nonnull inalloca([[STRUCT_SS]]) align 4 dereferenceable(8) [[S]])
; CGSCC-NEXT: [[R:%.*]] = call i32 @f(ptr noalias nocapture nofree noundef nonnull inalloca([[STRUCT_SS]]) align 4 dereferenceable(8) [[S]]) #[[ATTR3:[0-9]+]]
; CGSCC-NEXT: ret i32 [[R]]
;
entry:
Expand Down Expand Up @@ -92,9 +92,10 @@ entry:
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR3]] = { memory(read) }
;.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ define i32 @callercaller() {
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR3]] = { nounwind }
; CGSCC: attributes #[[ATTR3]] = { nounwind memory(write) }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}
18 changes: 10 additions & 8 deletions llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define i32 @caller(ptr %p) {
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
; CGSCC-LABEL: define {{[^@]+}}@caller
; CGSCC-SAME: (ptr nocapture nofree readonly [[P:%.*]]) #[[ATTR1:[0-9]+]] {
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @test(ptr nocapture nofree readonly [[P]])
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @test(ptr nocapture nofree readonly [[P]]) #[[ATTR5:[0-9]+]]
; CGSCC-NEXT: ret i32 [[V]]
;
%v = musttail call i32 @test(%T* %p)
Expand Down Expand Up @@ -89,7 +89,7 @@ define i32 @caller2(ptr %g) {
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
; CGSCC-LABEL: define {{[^@]+}}@caller2
; CGSCC-SAME: (ptr nocapture nofree readonly align 4 [[G:%.*]]) #[[ATTR1]] {
; CGSCC-NEXT: [[V:%.*]] = call noundef i32 @test2(ptr nocapture nofree readonly [[G]], i32 noundef 0)
; CGSCC-NEXT: [[V:%.*]] = call noundef i32 @test2(ptr nocapture nofree readonly [[G]], i32 noundef 0) #[[ATTR5]]
; CGSCC-NEXT: ret i32 [[V]]
;
%v = call i32 @test2(%T* %g, i32 0)
Expand Down Expand Up @@ -138,7 +138,7 @@ define internal i32 @test2b(ptr %p, i32 %p2) {
; CGSCC-NEXT: [[A:%.*]] = load i32, ptr [[A_GEP]], align 4
; CGSCC-NEXT: [[B:%.*]] = load i32, ptr [[B_GEP]], align 4
; CGSCC-NEXT: [[V:%.*]] = add i32 [[A]], [[B]]
; CGSCC-NEXT: [[CA:%.*]] = musttail call noundef i32 @bar(ptr undef, i32 [[V]]) #[[ATTR5:[0-9]+]]
; CGSCC-NEXT: [[CA:%.*]] = musttail call noundef i32 @bar(ptr undef, i32 [[V]]) #[[ATTR6:[0-9]+]]
; CGSCC-NEXT: ret i32 [[CA]]
;
%a.gep = getelementptr %T, %T* %p, i64 0, i32 3
Expand All @@ -154,13 +154,13 @@ define i32 @caller2b(ptr %g) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@caller2b
; TUNIT-SAME: (ptr nocapture nofree readonly [[G:%.*]]) #[[ATTR3]] {
; TUNIT-NEXT: [[V:%.*]] = call noundef i32 @test2b(ptr nocapture nofree readonly [[G]], i32 undef) #[[ATTR5]]
; TUNIT-NEXT: [[V:%.*]] = call noundef i32 @test2b(ptr nocapture nofree readonly [[G]], i32 undef) #[[ATTR6:[0-9]+]]
; TUNIT-NEXT: ret i32 [[V]]
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@caller2b
; CGSCC-SAME: (ptr nocapture nofree readonly align 4 [[G:%.*]]) #[[ATTR4]] {
; CGSCC-NEXT: [[V:%.*]] = call noundef i32 @test2b(ptr nocapture nofree readonly [[G]], i32 noundef 0) #[[ATTR6:[0-9]+]]
; CGSCC-NEXT: [[V:%.*]] = call noundef i32 @test2b(ptr nocapture nofree readonly [[G]], i32 noundef 0) #[[ATTR7:[0-9]+]]
; CGSCC-NEXT: ret i32 [[V]]
;
%v = call i32 @test2b(%T* %g, i32 0)
Expand All @@ -172,13 +172,15 @@ define i32 @caller2b(ptr %g) {
; TUNIT: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; TUNIT: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn memory(read) }
; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR6]] = { nofree nosync nounwind willreturn }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }
; CGSCC: attributes #[[ATTR5]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR6]] = { nounwind }
; CGSCC: attributes #[[ATTR5]] = { memory(read) }
; CGSCC: attributes #[[ATTR6]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR7]] = { nounwind }
;.
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,33 @@ entry:
}

define i32 @unions() nounwind {
; CHECK: Function Attrs: nounwind
; CHECK-LABEL: define {{[^@]+}}@unions
; CHECK-SAME: () #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr @mystr, align 8
; CHECK-NEXT: [[MYSTR_0_1:%.*]] = getelementptr [[STRUCT_MYSTR:%.*]], ptr @mystr, i64 0, i32 1
; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[MYSTR_0_1]], align 8
; CHECK-NEXT: call void @vfu1(i8 [[TMP0]], i32 [[TMP1]]) #[[ATTR0]]
; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr @mystr, align 8
; CHECK-NEXT: [[MYSTR_0_11:%.*]] = getelementptr [[STRUCT_MYSTR]], ptr @mystr, i64 0, i32 1
; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[MYSTR_0_11]], align 8
; CHECK-NEXT: [[RESULT:%.*]] = call i32 @vfu2(i8 [[TMP2]], i32 [[TMP3]]) #[[ATTR0]]
; CHECK-NEXT: ret i32 [[RESULT]]
; TUNIT: Function Attrs: nounwind
; TUNIT-LABEL: define {{[^@]+}}@unions
; TUNIT-SAME: () #[[ATTR0]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[TMP0:%.*]] = load i8, ptr @mystr, align 8
; TUNIT-NEXT: [[MYSTR_0_1:%.*]] = getelementptr [[STRUCT_MYSTR:%.*]], ptr @mystr, i64 0, i32 1
; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[MYSTR_0_1]], align 8
; TUNIT-NEXT: call void @vfu1(i8 [[TMP0]], i32 [[TMP1]]) #[[ATTR0]]
; TUNIT-NEXT: [[TMP2:%.*]] = load i8, ptr @mystr, align 8
; TUNIT-NEXT: [[MYSTR_0_11:%.*]] = getelementptr [[STRUCT_MYSTR]], ptr @mystr, i64 0, i32 1
; TUNIT-NEXT: [[TMP3:%.*]] = load i32, ptr [[MYSTR_0_11]], align 8
; TUNIT-NEXT: [[RESULT:%.*]] = call i32 @vfu2(i8 [[TMP2]], i32 [[TMP3]]) #[[ATTR2:[0-9]+]]
; TUNIT-NEXT: ret i32 [[RESULT]]
;
; CGSCC: Function Attrs: nounwind
; CGSCC-LABEL: define {{[^@]+}}@unions
; CGSCC-SAME: () #[[ATTR0]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[TMP0:%.*]] = load i8, ptr @mystr, align 8
; CGSCC-NEXT: [[MYSTR_0_1:%.*]] = getelementptr [[STRUCT_MYSTR:%.*]], ptr @mystr, i64 0, i32 1
; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[MYSTR_0_1]], align 8
; CGSCC-NEXT: call void @vfu1(i8 [[TMP0]], i32 [[TMP1]]) #[[ATTR0]]
; CGSCC-NEXT: [[TMP2:%.*]] = load i8, ptr @mystr, align 8
; CGSCC-NEXT: [[MYSTR_0_11:%.*]] = getelementptr [[STRUCT_MYSTR]], ptr @mystr, i64 0, i32 1
; CGSCC-NEXT: [[TMP3:%.*]] = load i32, ptr [[MYSTR_0_11]], align 8
; CGSCC-NEXT: [[RESULT:%.*]] = call i32 @vfu2(i8 [[TMP2]], i32 [[TMP3]]) #[[ATTR0]]
; CGSCC-NEXT: ret i32 [[RESULT]]
;
entry:
call void @vfu1(ptr byval(%struct.MYstr) align 4 @mystr) nounwind
Expand Down Expand Up @@ -125,13 +139,13 @@ define i32 @unions_v2() nounwind {
; TUNIT-SAME: () #[[ATTR0]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[TMP0:%.*]] = load i8, ptr @mystr, align 8
; TUNIT-NEXT: [[MYSTR_0_1:%.*]] = getelementptr [[STRUCT_MYSTR:%.*]], ptr @mystr, i64 0, i32 1
; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[MYSTR_0_1]], align 8
; TUNIT-NEXT: [[MYSTR_0_11:%.*]] = getelementptr [[STRUCT_MYSTR:%.*]], ptr @mystr, i64 0, i32 1
; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[MYSTR_0_11]], align 8
; TUNIT-NEXT: call void @vfu1(i8 [[TMP0]], i32 [[TMP1]]) #[[ATTR0]]
; TUNIT-NEXT: [[TMP2:%.*]] = load i8, ptr @mystr, align 8
; TUNIT-NEXT: [[MYSTR_0_11:%.*]] = getelementptr [[STRUCT_MYSTR]], ptr @mystr, i64 0, i32 1
; TUNIT-NEXT: [[TMP3:%.*]] = load i32, ptr [[MYSTR_0_11]], align 8
; TUNIT-NEXT: [[RESULT:%.*]] = call i32 @vfu2_v2(i8 [[TMP2]], i32 [[TMP3]]) #[[ATTR0]]
; TUNIT-NEXT: [[MYSTR_0_1:%.*]] = getelementptr [[STRUCT_MYSTR]], ptr @mystr, i64 0, i32 1
; TUNIT-NEXT: [[TMP3:%.*]] = load i32, ptr [[MYSTR_0_1]], align 8
; TUNIT-NEXT: [[RESULT:%.*]] = call i32 @vfu2_v2(i8 [[TMP2]], i32 [[TMP3]]) #[[ATTR2]]
; TUNIT-NEXT: ret i32 [[RESULT]]
;
; CGSCC: Function Attrs: nounwind
Expand All @@ -148,6 +162,10 @@ entry:
ret i32 %result
}
;.
; CHECK: attributes #[[ATTR0]] = { nounwind }
; CHECK: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; TUNIT: attributes #[[ATTR0]] = { nounwind }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; TUNIT: attributes #[[ATTR2]] = { nounwind memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { nounwind }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
;.
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ entry:
; TUNIT: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind memory(argmem: readwrite) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind null_pointer_is_valid }
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind }
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { nofree nosync nounwind memory(argmem: readwrite) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ define internal i16 @vararg_no_prop(i16 %p1, i16 %p2, ...) {

;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ define void @caller(i1 %C) personality ptr @__gxx_personality_v0 {
; CGSCC-NEXT: [[W:%.*]] = call align 4 ptr @incdec(i1 noundef [[C]], ptr nofree noundef nonnull align 4 dereferenceable(4) [[Q]]) #[[ATTR3:[0-9]+]]
; CGSCC-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2)
; CGSCC-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0
; CGSCC-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR3]]
; CGSCC-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR4:[0-9]+]]
; CGSCC-NEXT: br label [[OK:%.*]]
; CGSCC: OK:
; CGSCC-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0
Expand Down Expand Up @@ -126,6 +126,7 @@ declare i32 @__gxx_personality_v0(...)
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree nosync nounwind willreturn }
; CGSCC: attributes #[[ATTR3]] = { nounwind }
; CGSCC: attributes #[[ATTR4]] = { nounwind memory(none) }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ define i1 @caller(i1 %C) {
declare i32 @__gxx_personality_v0(...)
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { nounwind }
; TUNIT: attributes #[[ATTR1]] = { nounwind memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { nounwind }
; CGSCC: attributes #[[ATTR2]] = { nounwind memory(none) }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ define i32 @caller2(i1 %Q) {
}
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
Expand Down
8 changes: 5 additions & 3 deletions llvm/test/Transforms/Attributor/align.ll
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ define i32 @musttail_caller_1(ptr %p) {
; CGSCC-NEXT: [[C:%.*]] = load i1, ptr @cnd, align 1
; CGSCC-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
; CGSCC: mt:
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]])
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR14:[0-9]+]]
; CGSCC-NEXT: ret i32 [[V]]
; CGSCC: exit:
; CGSCC-NEXT: ret i32 0
Expand Down Expand Up @@ -1076,7 +1076,7 @@ define ptr @aligned_8_return_caller(ptr align(16) %a, i1 %c1, i1 %c2) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@aligned_8_return_caller
; TUNIT-SAME: (ptr nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR10]] {
; TUNIT-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR12]]
; TUNIT-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR13:[0-9]+]]
; TUNIT-NEXT: ret ptr [[R]]
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
Expand Down Expand Up @@ -1119,7 +1119,8 @@ attributes #2 = { null_pointer_is_valid }
; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR10]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind willreturn memory(read) }
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind willreturn }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable }
Expand All @@ -1135,4 +1136,5 @@ attributes #2 = { null_pointer_is_valid }
; CGSCC: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree nosync nounwind willreturn memory(read) }
; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR14]] = { memory(read) }
;.
34 changes: 14 additions & 20 deletions llvm/test/Transforms/Attributor/assumes_info.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ define dso_local void @entry(i1 %cond) #0 {
; CHECK-LABEL: define {{[^@]+}}@entry
; CHECK-SAME: (i1 [[COND:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @foo(i1 [[COND]])
; CHECK-NEXT: call void @bar()
; CHECK-NEXT: call void @qux() #[[ATTR1:[0-9]+]]
; CHECK-NEXT: call void @foo(i1 [[COND]]) #[[ATTR1:[0-9]+]]
; CHECK-NEXT: call void @bar() #[[ATTR2:[0-9]+]]
; CHECK-NEXT: call void @qux() #[[ATTR1]]
; CHECK-NEXT: ret void
;
entry:
Expand All @@ -19,17 +19,11 @@ entry:
}

define internal void @foo(i1 %cond) #1 {
; TUNIT-LABEL: define {{[^@]+}}@foo
; TUNIT-SAME: (i1 [[COND:%.*]]) #[[ATTR1]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: call void @baz(i1 [[COND]])
; TUNIT-NEXT: ret void
;
; CGSCC-LABEL: define {{[^@]+}}@foo
; CGSCC-SAME: (i1 [[COND:%.*]]) #[[ATTR1]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: call void @baz(i1 [[COND]]) #[[ATTR1]]
; CGSCC-NEXT: ret void
; CHECK-LABEL: define {{[^@]+}}@foo
; CHECK-SAME: (i1 [[COND:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @baz(i1 [[COND]]) #[[ATTR1]]
; CHECK-NEXT: ret void
;
entry:
call void @baz(i1 %cond)
Expand All @@ -38,7 +32,7 @@ entry:

define internal void @bar() #2 {
; CHECK-LABEL: define {{[^@]+}}@bar
; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
; CHECK-SAME: () #[[ATTR2]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @baz(i1 noundef false) #[[ATTR2]]
; CHECK-NEXT: ret void
Expand All @@ -55,10 +49,10 @@ define internal void @baz(i1 %Cond) {
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp ne i1 [[COND]], false
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
; TUNIT-NEXT: call void @baz(i1 noundef false)
; TUNIT-NEXT: call void @baz(i1 noundef false) #[[ATTR1]]
; TUNIT-NEXT: br label [[IF_END]]
; TUNIT: if.end:
; TUNIT-NEXT: call void @qux()
; TUNIT-NEXT: call void @qux() #[[ATTR1]]
; TUNIT-NEXT: ret void
;
; CGSCC-LABEL: define {{[^@]+}}@baz
Expand All @@ -67,7 +61,7 @@ define internal void @baz(i1 %Cond) {
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp ne i1 [[COND]], false
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; CGSCC: if.then:
; CGSCC-NEXT: call void @baz(i1 noundef false)
; CGSCC-NEXT: call void @baz(i1 noundef false) #[[ATTR3]]
; CGSCC-NEXT: br label [[IF_END]]
; CGSCC: if.end:
; CGSCC-NEXT: call void @qux() #[[ATTR3]]
Expand All @@ -90,12 +84,12 @@ define internal void @qux() {
; TUNIT-LABEL: define {{[^@]+}}@qux
; TUNIT-SAME: () #[[ATTR1]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: call void @call()
; TUNIT-NEXT: call void @call() #[[ATTR2]]
; TUNIT-NEXT: ret void
;
; CGSCC-LABEL: define {{[^@]+}}@qux() {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: call void @call()
; CGSCC-NEXT: call void @call() #[[ATTR2]]
; CGSCC-NEXT: ret void
;
entry:
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Transforms/Attributor/call-simplify-pointer-info.ll
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ define i8 @call_simplifiable_1() {
; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
; CGSCC-NEXT: [[I0:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 2
; CGSCC-NEXT: store i8 2, i8* [[I0]], align 2
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg(i8* nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]])
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg(i8* nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]]) #[[ATTR4:[0-9]+]]
; CGSCC-NEXT: ret i8 [[R]]
;
entry:
Expand Down Expand Up @@ -77,7 +77,7 @@ define internal i8 @sum_two_same_loads(i8* %p) {
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
; CGSCC-LABEL: define {{[^@]+}}@sum_two_same_loads
; CGSCC-SAME: (i8* nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P:%.*]]) #[[ATTR2:[0-9]+]] {
; CGSCC-NEXT: [[X:%.*]] = call i8 @read_arg_1(i8* nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR4:[0-9]+]]
; CGSCC-NEXT: [[X:%.*]] = call i8 @read_arg_1(i8* nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR4]]
; CGSCC-NEXT: [[Y:%.*]] = call i8 @read_arg_1(i8* nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR4]]
; CGSCC-NEXT: [[Z:%.*]] = add nsw i8 [[X]], [[Y]]
; CGSCC-NEXT: ret i8 [[Z]]
Expand Down Expand Up @@ -107,7 +107,7 @@ define i8 @call_simplifiable_2() {
; CGSCC-NEXT: store i8 2, i8* [[I0]], align 2
; CGSCC-NEXT: [[I1:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 3
; CGSCC-NEXT: store i8 3, i8* [[I1]], align 1
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_same_loads(i8* nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]])
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_same_loads(i8* nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]]) #[[ATTR4]]
; CGSCC-NEXT: ret i8 [[R]]
;
entry:
Expand Down Expand Up @@ -137,7 +137,7 @@ define i8 @call_simplifiable_3() {
; CGSCC-NEXT: [[I0:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0
; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 2
; CGSCC-NEXT: store i8 2, i8* [[I2]], align 2
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg_index(i8* nocapture nofree noundef nonnull readonly align 16 dereferenceable(1024) [[I0]])
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg_index(i8* nocapture nofree noundef nonnull readonly align 16 dereferenceable(1024) [[I0]]) #[[ATTR4]]
; CGSCC-NEXT: ret i8 [[R]]
;
entry:
Expand Down Expand Up @@ -219,7 +219,7 @@ define i8 @call_partially_simplifiable_1() {
; CGSCC-NEXT: store i8 3, i8* [[I3]], align 1
; CGSCC-NEXT: [[I4:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 4
; CGSCC-NEXT: store i8 4, i8* [[I4]], align 4
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(i8* nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I2]], i8* nocapture nofree noundef nonnull readonly dereferenceable(1021) [[I3]])
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(i8* nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I2]], i8* nocapture nofree noundef nonnull readonly dereferenceable(1021) [[I3]]) #[[ATTR4]]
; CGSCC-NEXT: ret i8 [[R]]
;
entry:
Expand Down Expand Up @@ -264,7 +264,7 @@ define i8 @call_partially_simplifiable_2(i1 %cond) {
; CGSCC-NEXT: [[I54:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 54
; CGSCC-NEXT: store i8 4, i8* [[I54]], align 2
; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[COND]], i8* [[I51]], i8* [[I52]]
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(i8* nocapture nofree noundef nonnull readonly dereferenceable(972) [[SEL]], i8* nocapture nofree noundef nonnull readonly dereferenceable(971) [[I53]])
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(i8* nocapture nofree noundef nonnull readonly dereferenceable(972) [[SEL]], i8* nocapture nofree noundef nonnull readonly dereferenceable(971) [[I53]]) #[[ATTR4]]
; CGSCC-NEXT: ret i8 [[R]]
;
entry:
Expand All @@ -286,7 +286,7 @@ entry:
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; TUNIT: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn memory(read) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/cb_liveness_disabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ attributes #0 = { noinline nounwind sspstrong uwtable}
; TUNIT_: !1 = !{i32 100, i32 201}
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind sspstrong willreturn memory(none) uwtable }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/cb_liveness_enabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ attributes #0 = { noinline nounwind sspstrong uwtable}
; TUNIT_: !1 = !{i32 100, i32 201}
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind sspstrong willreturn memory(none) uwtable }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/cb_range_disabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ define i32 @test2_ncheck(i32 %unknown) {
}
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/cb_range_enabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ define i32 @test2_ncheck(i32 %unknown) {
}
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn memory(none) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
Expand Down
93 changes: 33 additions & 60 deletions llvm/test/Transforms/Attributor/dereferenceable-1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,16 @@ define void @call_fill_range(ptr nocapture %p, ptr nocapture readonly %range) {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[TMP0:%.*]] = load i64, ptr [[RANGE]], align 8, !range [[RNG0:![0-9]+]]
; TUNIT-NEXT: tail call void @fill_range_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR8:[0-9]+]]
; TUNIT-NEXT: tail call void @fill_range_not_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR9:[0-9]+]]
; TUNIT-NEXT: tail call void @fill_range_not_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR8]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@call_fill_range
; CGSCC-SAME: (ptr nocapture nofree writeonly [[P:%.*]], ptr nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[RANGE:%.*]]) #[[ATTR4:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[TMP0:%.*]] = load i64, ptr [[RANGE]], align 8, !range [[RNG0:![0-9]+]]
; CGSCC-NEXT: tail call void @fill_range_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR7]]
; CGSCC-NEXT: tail call void @fill_range_not_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR7]]
; CGSCC-NEXT: tail call void @fill_range_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR8:[0-9]+]]
; CGSCC-NEXT: tail call void @fill_range_not_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR8]]
; CGSCC-NEXT: ret void
;
entry:
Expand Down Expand Up @@ -633,59 +633,32 @@ if.end8: ; preds = %if.then5, %if.else6
; }
; FIXME: %ptr should be dereferenceable(4)
define dso_local void @rec-branch-2(i32 %a, i32 %b, i32 %c, ptr %ptr) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(argmem: write)
; TUNIT-LABEL: define {{[^@]+}}@rec-branch-2
; TUNIT-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], ptr nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR5:[0-9]+]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A]], 0
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE3:%.*]], label [[IF_THEN:%.*]]
; TUNIT: if.then:
; TUNIT-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[B]], 0
; TUNIT-NEXT: br i1 [[TOBOOL1]], label [[IF_ELSE:%.*]], label [[IF_THEN2:%.*]]
; TUNIT: if.then2:
; TUNIT-NEXT: store i32 1, ptr [[PTR]], align 4
; TUNIT-NEXT: br label [[IF_END8:%.*]]
; TUNIT: if.else:
; TUNIT-NEXT: store i32 2, ptr [[PTR]], align 4
; TUNIT-NEXT: br label [[IF_END8]]
; TUNIT: if.else3:
; TUNIT-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[C]], 0
; TUNIT-NEXT: br i1 [[TOBOOL4]], label [[IF_ELSE6:%.*]], label [[IF_THEN5:%.*]]
; TUNIT: if.then5:
; TUNIT-NEXT: store i32 3, ptr [[PTR]], align 4
; TUNIT-NEXT: br label [[IF_END8]]
; TUNIT: if.else6:
; TUNIT-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, ptr nocapture nofree writeonly [[PTR]]) #[[ATTR10:[0-9]+]]
; TUNIT-NEXT: br label [[IF_END8]]
; TUNIT: if.end8:
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(argmem: write)
; CGSCC-LABEL: define {{[^@]+}}@rec-branch-2
; CGSCC-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], ptr nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR5:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A]], 0
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE3:%.*]], label [[IF_THEN:%.*]]
; CGSCC: if.then:
; CGSCC-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[B]], 0
; CGSCC-NEXT: br i1 [[TOBOOL1]], label [[IF_ELSE:%.*]], label [[IF_THEN2:%.*]]
; CGSCC: if.then2:
; CGSCC-NEXT: store i32 1, ptr [[PTR]], align 4
; CGSCC-NEXT: br label [[IF_END8:%.*]]
; CGSCC: if.else:
; CGSCC-NEXT: store i32 2, ptr [[PTR]], align 4
; CGSCC-NEXT: br label [[IF_END8]]
; CGSCC: if.else3:
; CGSCC-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[C]], 0
; CGSCC-NEXT: br i1 [[TOBOOL4]], label [[IF_ELSE6:%.*]], label [[IF_THEN5:%.*]]
; CGSCC: if.then5:
; CGSCC-NEXT: store i32 3, ptr [[PTR]], align 4
; CGSCC-NEXT: br label [[IF_END8]]
; CGSCC: if.else6:
; CGSCC-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, ptr nocapture nofree writeonly [[PTR]]) #[[ATTR8:[0-9]+]]
; CGSCC-NEXT: br label [[IF_END8]]
; CGSCC: if.end8:
; CGSCC-NEXT: ret void
; CHECK: Function Attrs: nofree nosync nounwind memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@rec-branch-2
; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], ptr nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR5:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A]], 0
; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE3:%.*]], label [[IF_THEN:%.*]]
; CHECK: if.then:
; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[B]], 0
; CHECK-NEXT: br i1 [[TOBOOL1]], label [[IF_ELSE:%.*]], label [[IF_THEN2:%.*]]
; CHECK: if.then2:
; CHECK-NEXT: store i32 1, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8:%.*]]
; CHECK: if.else:
; CHECK-NEXT: store i32 2, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8]]
; CHECK: if.else3:
; CHECK-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[C]], 0
; CHECK-NEXT: br i1 [[TOBOOL4]], label [[IF_ELSE6:%.*]], label [[IF_THEN5:%.*]]
; CHECK: if.then5:
; CHECK-NEXT: store i32 3, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8]]
; CHECK: if.else6:
; CHECK-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, ptr nocapture nofree writeonly [[PTR]]) #[[ATTR9:[0-9]+]]
; CHECK-NEXT: br label [[IF_END8]]
; CHECK: if.end8:
; CHECK-NEXT: ret void
;
entry:
%tobool = icmp eq i32 %a, 0
Expand Down Expand Up @@ -848,9 +821,8 @@ f:
; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind memory(argmem: write) }
; TUNIT: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; TUNIT: attributes #[[ATTR7]] = { nounwind }
; TUNIT: attributes #[[ATTR8]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR9]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR10]] = { nofree nosync nounwind memory(write) }
; TUNIT: attributes #[[ATTR8]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR9]] = { nofree nosync nounwind memory(write) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1:[0-9]+]] = { nounwind willreturn }
Expand All @@ -860,7 +832,8 @@ f:
; CGSCC: attributes #[[ATTR5]] = { nofree nosync nounwind memory(argmem: write) }
; CGSCC: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; CGSCC: attributes #[[ATTR7]] = { nounwind }
; CGSCC: attributes #[[ATTR8]] = { nofree nosync nounwind memory(write) }
; CGSCC: attributes #[[ATTR8]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR9]] = { nofree nosync nounwind memory(write) }
;.
; CHECK: [[META0:![0-9]+]] = !{i64 10, i64 100}
;.
21 changes: 10 additions & 11 deletions llvm/test/Transforms/Attributor/internal-noalias.ll
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ define dso_local i32 @visible(ptr noalias %A, ptr noalias %B) #0 {
; CGSCC-LABEL: define {{[^@]+}}@visible
; CGSCC-SAME: (ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A:%.*]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B:%.*]]) #[[ATTR0:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]])
; CGSCC-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]])
; CGSCC-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5:[0-9]+]]
; CGSCC-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5]]
; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]
; CGSCC-NEXT: ret i32 [[ADD]]
;
Expand Down Expand Up @@ -47,7 +47,7 @@ define private i32 @noalias_args(ptr %A, ptr %B) #0 {
; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 4
; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 4
; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]
; CGSCC-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5:[0-9]+]]
; CGSCC-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5]]
; CGSCC-NEXT: [[ADD2:%.*]] = add nsw i32 [[ADD]], [[CALL]]
; CGSCC-NEXT: ret i32 [[ADD2]]
;
Expand Down Expand Up @@ -94,8 +94,8 @@ define dso_local i32 @visible_local(ptr %A) #0 {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 4
; TUNIT-NEXT: store i32 5, ptr [[B]], align 4
; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr nocapture nofree readonly align 4 [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5:[0-9]+]]
; TUNIT-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr nocapture nofree readonly align 4 [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5]]
; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr nocapture nofree readonly align 4 [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR4]]
; TUNIT-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr nocapture nofree readonly align 4 [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR4]]
; TUNIT-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]
; TUNIT-NEXT: ret i32 [[ADD]]
;
Expand All @@ -105,7 +105,7 @@ define dso_local i32 @visible_local(ptr %A) #0 {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[B:%.*]] = alloca i32, align 4
; CGSCC-NEXT: store i32 5, ptr [[B]], align 4
; CGSCC-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]])
; CGSCC-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR5]]
; CGSCC-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]])
; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]
; CGSCC-NEXT: ret i32 [[ADD]]
Expand Down Expand Up @@ -148,7 +148,7 @@ define i32 @visible_local_2() {
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@visible_local_2
; CGSCC-SAME: () #[[ATTR3:[0-9]+]] {
; CGSCC-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 noundef 5, i32 noundef 5)
; CGSCC-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 noundef 5, i32 noundef 5) #[[ATTR5]]
; CGSCC-NEXT: ret i32 [[CALL]]
;
%B = alloca i32, align 4
Expand Down Expand Up @@ -180,7 +180,7 @@ define i32 @visible_local_3() {
; TUNIT-LABEL: define {{[^@]+}}@visible_local_3
; TUNIT-SAME: () #[[ATTR2]] {
; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 4
; TUNIT-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_rn(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[B]]) #[[ATTR6:[0-9]+]]
; TUNIT-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_rn(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[B]]) #[[ATTR5:[0-9]+]]
; TUNIT-NEXT: ret i32 5
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
Expand All @@ -204,9 +204,8 @@ attributes #1 = { argmemonly noinline nounwind uwtable willreturn}
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable }
; TUNIT: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR3]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: write) uwtable }
; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind }
; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind memory(read) }
; TUNIT: attributes #[[ATTR6]] = { nofree nosync nounwind memory(write) }
; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind memory(read) }
; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind memory(write) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline nosync nounwind willreturn memory(argmem: read) uwtable }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/internalize.ll
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ define linkonce_odr hidden void @__clang_call_terminate() {
; CGSCC_ENABLED: attributes #[[ATTR2]] = { nofree norecurse noreturn nosync nounwind readnone willreturn }
;.
; CHECK_ENABLED: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CHECK_ENABLED: attributes #[[ATTR1:[0-9]+]] = { nounwind }
; CHECK_ENABLED: attributes #[[ATTR1:[0-9]+]] = { nounwind memory(none) }
;.
3 changes: 1 addition & 2 deletions llvm/test/Transforms/Attributor/liveness_chains.ll
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define i32 @chain_alive(i32 %arg) {
; CHECK: Function Attrs: nounwind memory(read)
; CHECK-LABEL: define {{[^@]+}}@chain_alive
; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[INIT:%.*]] = call i32 @source() #[[ATTR2:[0-9]+]]
; CHECK-NEXT: [[INIT:%.*]] = call i32 @source() #[[ATTR0]]
; CHECK-NEXT: [[V0:%.*]] = add i32 [[ARG]], [[INIT]]
; CHECK-NEXT: [[V1:%.*]] = add i32 [[INIT]], [[V0]]
; CHECK-NEXT: [[V2:%.*]] = add i32 [[V0]], [[V1]]
Expand Down Expand Up @@ -59,7 +59,6 @@ define i32 @chain_alive(i32 %arg) {
;.
; CHECK: attributes #[[ATTR0]] = { nounwind memory(read) }
; CHECK: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; CHECK: attributes #[[ATTR2]] = { nounwind }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CGSCC: {{.*}}
Expand Down
17 changes: 8 additions & 9 deletions llvm/test/Transforms/Attributor/memory_locations.ll
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ define i8 @readnone_caller(i1 %c) {
; TUNIT-LABEL: define {{[^@]+}}@readnone_caller
; TUNIT-SAME: (i1 [[C:%.*]]) #[[ATTR9:[0-9]+]] {
; TUNIT-NEXT: [[A:%.*]] = alloca i8, align 1
; TUNIT-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal(ptr noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR13:[0-9]+]]
; TUNIT-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal(ptr noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR12]]
; TUNIT-NEXT: ret i8 [[R]]
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(none)
Expand Down Expand Up @@ -662,7 +662,7 @@ define i8 @readnone_caller2(i1 %c) {
; TUNIT: Function Attrs: nofree norecurse nosync nounwind memory(none)
; TUNIT-LABEL: define {{[^@]+}}@readnone_caller2
; TUNIT-SAME: (i1 [[C:%.*]]) #[[ATTR9]] {
; TUNIT-NEXT: [[R:%.*]] = call i8 @recursive_readnone_internal2(ptr undef, i1 [[C]]) #[[ATTR13]]
; TUNIT-NEXT: [[R:%.*]] = call i8 @recursive_readnone_internal2(ptr undef, i1 [[C]]) #[[ATTR12]]
; TUNIT-NEXT: ret i8 [[R]]
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(none)
Expand Down Expand Up @@ -716,7 +716,7 @@ define i8 @readnone_caller3(i1 %c) {
; TUNIT-LABEL: define {{[^@]+}}@readnone_caller3
; TUNIT-SAME: (i1 [[C:%.*]]) #[[ATTR9]] {
; TUNIT-NEXT: [[ALLOC:%.*]] = alloca i8, align 1
; TUNIT-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal3(ptr noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR13]]
; TUNIT-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal3(ptr noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR12]]
; TUNIT-NEXT: ret i8 [[R]]
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(none)
Expand All @@ -742,15 +742,15 @@ define internal void @argmemonly_before_ipconstprop(ptr %p) argmemonly {
ret void
}

define void @argmemonky_caller() {
define void @argmemonly_caller() {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; TUNIT-LABEL: define {{[^@]+}}@argmemonky_caller
; TUNIT-LABEL: define {{[^@]+}}@argmemonly_caller
; TUNIT-SAME: () #[[ATTR6]] {
; TUNIT-NEXT: call void @argmemonly_before_ipconstprop() #[[ATTR11]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write)
; CGSCC-LABEL: define {{[^@]+}}@argmemonky_caller
; CGSCC-LABEL: define {{[^@]+}}@argmemonly_caller
; CGSCC-SAME: () #[[ATTR8]] {
; CGSCC-NEXT: call void @argmemonly_before_ipconstprop() #[[ATTR12]]
; CGSCC-NEXT: ret void
Expand Down Expand Up @@ -804,9 +804,8 @@ f:
; TUNIT: attributes #[[ATTR8]] = { nofree nosync nounwind memory(argmem: write) }
; TUNIT: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind memory(none) }
; TUNIT: attributes #[[ATTR10]] = { nosync memory(argmem: write) }
; TUNIT: attributes #[[ATTR11]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR11]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind memory(write) }
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind }
;.
; CGSCC: attributes #[[ATTR0]] = { memory(inaccessiblemem: readwrite) }
; CGSCC: attributes #[[ATTR1]] = { memory(argmem: readwrite, inaccessiblemem: readwrite) }
Expand All @@ -820,6 +819,6 @@ f:
; CGSCC: attributes #[[ATTR9]] = { nofree nosync nounwind memory(argmem: write) }
; CGSCC: attributes #[[ATTR10]] = { nofree nosync nounwind memory(none) }
; CGSCC: attributes #[[ATTR11]] = { nosync memory(argmem: write) }
; CGSCC: attributes #[[ATTR12]] = { nounwind }
; CGSCC: attributes #[[ATTR12]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR13]] = { nofree nosync nounwind memory(write) }
;.
5 changes: 2 additions & 3 deletions llvm/test/Transforms/Attributor/misc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ define void @external(ptr %fp) {
; CGSCC-SAME: (ptr [[FP:%.*]]) {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 4
; CGSCC-NEXT: call void @foo(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR2:[0-9]+]]
; CGSCC-NEXT: call void @foo(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1]]
; CGSCC-NEXT: call void @callback1(ptr noundef nonnull @foo)
; CGSCC-NEXT: call void @callback2(ptr noundef @foo)
; CGSCC-NEXT: call void @callback2(ptr [[FP]])
Expand Down Expand Up @@ -101,9 +101,8 @@ declare void @callback1(ptr)
declare void @callback2(ptr)
;.
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(write) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; CGSCC: attributes #[[ATTR1]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR2]] = { nounwind }
;.
6 changes: 3 additions & 3 deletions llvm/test/Transforms/Attributor/misc_crash.ll
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ define i32 @func3(i1 %false) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; CHECK-LABEL: define {{[^@]+}}@func3
; CHECK-SAME: (i1 [[FALSE:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 (ptr, ...) @func2a(ptr nocapture nofree nonnull writeonly align 4 dereferenceable(4) undef) #[[ATTR3:[0-9]+]]
; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 (ptr, ...) @func2a(ptr nocapture nofree nonnull writeonly align 4 dereferenceable(4) undef) #[[ATTR2]]
; CHECK-NEXT: br i1 [[FALSE]], label [[USE_BB:%.*]], label [[RET_BB:%.*]]
; CHECK: use_bb:
; CHECK-NEXT: ret i32 [[TMP1]]
Expand Down Expand Up @@ -107,7 +107,7 @@ define i16 @foo3() {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@foo3
; CHECK-SAME: () #[[ATTR0]] {
; CHECK-NEXT: [[CALL:%.*]] = call i16 @bar3() #[[ATTR3]]
; CHECK-NEXT: [[CALL:%.*]] = call i16 @bar3() #[[ATTR3:[0-9]+]]
; CHECK-NEXT: ret i16 [[CALL]]
;
%call = call i16 @bar3()
Expand All @@ -129,5 +129,5 @@ declare void @func6(ptr)
; CHECK: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CHECK: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; CHECK: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(write) }
; CHECK: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn }
; CHECK: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn memory(none) }
;.
57 changes: 30 additions & 27 deletions llvm/test/Transforms/Attributor/noalias.ll
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,15 @@ define i32 @i2p(ptr %arg) {
; TUNIT-SAME: (ptr nofree readonly [[ARG:%.*]]) #[[ATTR4:[0-9]+]] {
; TUNIT-NEXT: [[C:%.*]] = call i32 @p2i(ptr noalias nofree readnone [[ARG]]) #[[ATTR10:[0-9]+]]
; TUNIT-NEXT: [[I2P:%.*]] = inttoptr i32 [[C]] to ptr
; TUNIT-NEXT: [[CALL:%.*]] = call i32 @ret(ptr nocapture nofree readonly align 4 [[I2P]]) #[[ATTR10]]
; TUNIT-NEXT: [[CALL:%.*]] = call i32 @ret(ptr nocapture nofree readonly align 4 [[I2P]]) #[[ATTR11:[0-9]+]]
; TUNIT-NEXT: ret i32 [[CALL]]
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read)
; CGSCC-LABEL: define {{[^@]+}}@i2p
; CGSCC-SAME: (ptr nofree readonly [[ARG:%.*]]) #[[ATTR5:[0-9]+]] {
; CGSCC-NEXT: [[C:%.*]] = call i32 @p2i(ptr noalias nofree readnone [[ARG]])
; CGSCC-NEXT: [[I2P:%.*]] = inttoptr i32 [[C]] to ptr
; CGSCC-NEXT: [[CALL:%.*]] = call i32 @ret(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[I2P]])
; CGSCC-NEXT: [[CALL:%.*]] = call i32 @ret(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[I2P]]) #[[ATTR11:[0-9]+]]
; CGSCC-NEXT: ret i32 [[CALL]]
;
%c = call i32 @p2i(ptr %arg)
Expand Down Expand Up @@ -569,7 +569,7 @@ define internal fastcc double @strtox(ptr %s, ptr %p, i32 %prec) unnamed_addr {
; CHECK-SAME: (ptr [[S:%.*]]) unnamed_addr {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[F:%.*]] = alloca [[STRUCT__IO_FILE:%.*]], align 8
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 144, ptr nocapture nofree noundef nonnull align 8 dereferenceable(240) [[F]]) #[[ATTR11:[0-9]+]]
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 144, ptr nocapture nofree noundef nonnull align 8 dereferenceable(240) [[F]]) #[[ATTR12:[0-9]+]]
; CHECK-NEXT: [[CALL:%.*]] = call i32 @sh_fromstring(ptr noundef nonnull align 8 dereferenceable(240) [[F]], ptr [[S]])
; CHECK-NEXT: call void @__shlim(ptr noundef nonnull align 8 dereferenceable(240) [[F]], i64 noundef 0)
; CHECK-NEXT: [[CALL1:%.*]] = call double @__floatscan(ptr noundef nonnull align 8 dereferenceable(240) [[F]], i32 noundef 1, i32 noundef 1)
Expand Down Expand Up @@ -661,10 +661,10 @@ define void @test15_caller(ptr noalias %p, i32 %c) {
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; TUNIT: if.then:
; TUNIT-NEXT: tail call void @only_store(ptr noalias nocapture nofree writeonly align 4 [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @only_store(ptr noalias nocapture nofree writeonly align 4 [[P]]) #[[ATTR13:[0-9]+]]
; TUNIT-NEXT: br label [[IF_END]]
; TUNIT: if.end:
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR13]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write)
Expand All @@ -673,10 +673,10 @@ define void @test15_caller(ptr noalias %p, i32 %c) {
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; CGSCC: if.then:
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13:[0-9]+]]
; CGSCC-NEXT: br label [[IF_END]]
; CGSCC: if.end:
; CGSCC-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR13]]
; CGSCC-NEXT: ret void
;
%tobool = icmp eq i32 %c, 0
Expand Down Expand Up @@ -718,14 +718,14 @@ define internal void @test16_sub(ptr noalias %p, i32 %c1, i32 %c2) {
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C1]], 0
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; TUNIT: if.then:
; TUNIT-NEXT: tail call void @only_store(ptr noalias nocapture nofree writeonly align 4 [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly align 4 [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @only_store(ptr noalias nocapture nofree writeonly align 4 [[P]]) #[[ATTR13]]
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly align 4 [[P]]) #[[ATTR13]]
; TUNIT-NEXT: br label [[IF_END]]
; TUNIT: if.end:
; TUNIT-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[C2]], 0
; TUNIT-NEXT: br i1 [[TOBOOL1]], label [[IF_THEN2:%.*]], label [[IF_END3:%.*]]
; TUNIT: if.then2:
; TUNIT-NEXT: tail call void @only_store(ptr nocapture nofree writeonly align 4 [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @only_store(ptr nocapture nofree writeonly align 4 [[P]]) #[[ATTR13]]
; TUNIT-NEXT: br label [[IF_END3]]
; TUNIT: if.end3:
; TUNIT-NEXT: ret void
Expand All @@ -736,14 +736,14 @@ define internal void @test16_sub(ptr noalias %p, i32 %c1, i32 %c2) {
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C1]], 0
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
; CGSCC: if.then:
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR12:[0-9]+]]
; CGSCC-NEXT: tail call void @make_alias(ptr nofree nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13]]
; CGSCC-NEXT: tail call void @make_alias(ptr nofree nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13]]
; CGSCC-NEXT: br label [[IF_END]]
; CGSCC: if.end:
; CGSCC-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[C2]], 0
; CGSCC-NEXT: br i1 [[TOBOOL1]], label [[IF_THEN2:%.*]], label [[IF_END3:%.*]]
; CGSCC: if.then2:
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR12]]
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13]]
; CGSCC-NEXT: br label [[IF_END3]]
; CGSCC: if.end3:
; CGSCC-NEXT: ret void
Expand Down Expand Up @@ -772,13 +772,13 @@ define void @test16_caller(ptr %p, i32 %c) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; TUNIT-LABEL: define {{[^@]+}}@test16_caller
; TUNIT-SAME: (ptr nofree writeonly [[P:%.*]], i32 [[C:%.*]]) #[[ATTR7]] {
; TUNIT-NEXT: tail call void @test16_sub(ptr noalias nofree writeonly [[P]], i32 [[C]], i32 [[C]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @test16_sub(ptr noalias nofree writeonly [[P]], i32 [[C]], i32 [[C]]) #[[ATTR13]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write)
; CGSCC-LABEL: define {{[^@]+}}@test16_caller
; CGSCC-SAME: (ptr nofree writeonly [[P:%.*]], i32 [[C:%.*]]) #[[ATTR10]] {
; CGSCC-NEXT: tail call void @test16_sub(ptr noalias nofree writeonly [[P]], i32 [[C]], i32 [[C]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @test16_sub(ptr noalias nofree writeonly [[P]], i32 [[C]], i32 [[C]]) #[[ATTR13]]
; CGSCC-NEXT: ret void
;
tail call void @test16_sub(ptr %p, i32 %c, i32 %c)
Expand Down Expand Up @@ -812,10 +812,10 @@ define void @test17_caller(ptr noalias %p, i32 %c) {
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
; TUNIT: l1:
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR13]]
; TUNIT-NEXT: br label [[L3:%.*]]
; TUNIT: l2:
; TUNIT-NEXT: tail call void @only_store(ptr noalias nocapture nofree writeonly align 4 [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @only_store(ptr noalias nocapture nofree writeonly align 4 [[P]]) #[[ATTR13]]
; TUNIT-NEXT: br label [[L3]]
; TUNIT: l3:
; TUNIT-NEXT: ret void
Expand All @@ -827,10 +827,10 @@ define void @test17_caller(ptr noalias %p, i32 %c) {
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
; CGSCC: l1:
; CGSCC-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR13]]
; CGSCC-NEXT: br label [[L3:%.*]]
; CGSCC: l2:
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13]]
; CGSCC-NEXT: br label [[L3]]
; CGSCC: l3:
; CGSCC-NEXT: ret void
Expand Down Expand Up @@ -885,10 +885,10 @@ define void @test18_caller(ptr noalias %p, i32 %c) {
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
; TUNIT: l1:
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @make_alias(ptr nofree writeonly [[P]]) #[[ATTR13]]
; TUNIT-NEXT: br label [[L2]]
; TUNIT: l2:
; TUNIT-NEXT: tail call void @only_store(ptr nocapture nofree writeonly align 4 [[P]]) #[[ATTR10]]
; TUNIT-NEXT: tail call void @only_store(ptr nocapture nofree writeonly align 4 [[P]]) #[[ATTR13]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write)
Expand All @@ -898,10 +898,10 @@ define void @test18_caller(ptr noalias %p, i32 %c) {
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
; CGSCC: l1:
; CGSCC-NEXT: tail call void @make_alias(ptr nofree nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @make_alias(ptr nofree nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13]]
; CGSCC-NEXT: br label [[L2]]
; CGSCC: l2:
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]]
; CGSCC-NEXT: tail call void @only_store(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P]]) #[[ATTR13]]
; CGSCC-NEXT: ret void
;
entry:
Expand All @@ -928,8 +928,10 @@ l2:
; TUNIT: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR8]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR10]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR11]] = { memory(readwrite) }
; TUNIT: attributes #[[ATTR10]] = { nofree nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR11]] = { nofree nosync nounwind willreturn memory(read) }
; TUNIT: attributes #[[ATTR12]] = { memory(readwrite) }
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind willreturn memory(write) }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { nounwind uwtable }
Expand All @@ -942,6 +944,7 @@ l2:
; CGSCC: attributes #[[ATTR8]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR9]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
; CGSCC: attributes #[[ATTR10]] = { mustprogress nofree nosync nounwind willreturn memory(write) }
; CGSCC: attributes #[[ATTR11]] = { memory(readwrite) }
; CGSCC: attributes #[[ATTR12]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR11]] = { memory(read) }
; CGSCC: attributes #[[ATTR12]] = { memory(readwrite) }
; CGSCC: attributes #[[ATTR13]] = { nounwind memory(write) }
;.
22 changes: 12 additions & 10 deletions llvm/test/Transforms/Attributor/nocapture-1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ define i1 @c6(ptr %q, i8 %bit) personality ptr @__gxx_personality_v0 {
; TUNIT: Function Attrs: memory(read)
; TUNIT-LABEL: define {{[^@]+}}@c6
; TUNIT-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR3:[0-9]+]] personality ptr @__gxx_personality_v0 {
; TUNIT-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]])
; TUNIT-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]]) #[[ATTR3]]
; TUNIT-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
; TUNIT: ret0:
; TUNIT-NEXT: ret i1 false
Expand All @@ -145,7 +145,7 @@ define i1 @c6(ptr %q, i8 %bit) personality ptr @__gxx_personality_v0 {
; CGSCC: Function Attrs: memory(read)
; CGSCC-LABEL: define {{[^@]+}}@c6
; CGSCC-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
; CGSCC-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]])
; CGSCC-NEXT: invoke void @throw_if_bit_set(ptr readonly [[Q]], i8 [[BIT]]) #[[ATTR4]]
; CGSCC-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
; CGSCC: ret0:
; CGSCC-NEXT: ret i1 false
Expand Down Expand Up @@ -293,13 +293,13 @@ define void @nc2(ptr %p, ptr %q) {
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
; TUNIT-LABEL: define {{[^@]+}}@nc2
; TUNIT-SAME: (ptr nocapture nofree [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR4]] {
; TUNIT-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree [[P]], i1 noundef false) #[[ATTR14]]
; TUNIT-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree [[P]], i1 noundef false) #[[ATTR16:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
; CGSCC-LABEL: define {{[^@]+}}@nc2
; CGSCC-SAME: (ptr nocapture nofree align 4 [[P:%.*]], ptr nofree [[Q:%.*]]) #[[ATTR7:[0-9]+]] {
; CGSCC-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree align 4 [[P]], i1 noundef false) #[[ATTR17]]
; CGSCC-NEXT: [[TMP1:%.*]] = call i32 @nc1(ptr nofree [[Q]], ptr nocapture nofree align 4 [[P]], i1 noundef false) #[[ATTR18:[0-9]+]]
; CGSCC-NEXT: ret void
;
%1 = call i32 @nc1(ptr %q, ptr %p, i1 0) ; <i32> [#uses=0]
Expand All @@ -324,13 +324,13 @@ define void @nc4(ptr %p) {
; TUNIT: Function Attrs: nounwind memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@nc4
; TUNIT-SAME: (ptr [[P:%.*]]) #[[ATTR5:[0-9]+]] {
; TUNIT-NEXT: call void @external(ptr readonly [[P]]) #[[ATTR16:[0-9]+]]
; TUNIT-NEXT: call void @external(ptr readonly [[P]]) #[[ATTR17:[0-9]+]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nounwind memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@nc4
; CGSCC-SAME: (ptr [[P:%.*]]) #[[ATTR8:[0-9]+]] {
; CGSCC-NEXT: call void @external(ptr readonly [[P]]) #[[ATTR17]]
; CGSCC-NEXT: call void @external(ptr readonly [[P]]) #[[ATTR18]]
; CGSCC-NEXT: ret void
;
call void @external(ptr %p)
Expand Down Expand Up @@ -836,9 +836,10 @@ declare ptr @llvm.strip.invariant.group.p0(ptr)
; TUNIT: attributes #[[ATTR11]] = { mustprogress nounwind willreturn }
; TUNIT: attributes #[[ATTR12:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }
; TUNIT: attributes #[[ATTR13:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR15]] = { nofree nounwind willreturn }
; TUNIT: attributes #[[ATTR16]] = { nounwind }
; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn memory(write) }
; TUNIT: attributes #[[ATTR15]] = { nofree nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR16]] = { nofree nosync nounwind willreturn }
; TUNIT: attributes #[[ATTR17]] = { nounwind }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
Expand All @@ -857,5 +858,6 @@ declare ptr @llvm.strip.invariant.group.p0(ptr)
; CGSCC: attributes #[[ATTR14]] = { mustprogress nounwind willreturn }
; CGSCC: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(inaccessiblemem: readwrite) }
; CGSCC: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
; CGSCC: attributes #[[ATTR17]] = { nounwind }
; CGSCC: attributes #[[ATTR17]] = { nounwind memory(write) }
; CGSCC: attributes #[[ATTR18]] = { nounwind }
;.
Loading