// Use the static create method.
auto &AA = AAType::createForPosition(IRP, *this);
+ // Always register a new attribute to make sure we clean up the allocated
+ // memory properly.
+ registerAA(AA);
+
// If we are currenty seeding attributes, enforce seeding rules.
if (Phase == AttributorPhase::SEEDING && !shouldSeedAttribute(AA)) {
AA.getState().indicatePessimisticFixpoint();
return AA;
}
- registerAA(AA);
-
// For now we ignore naked and optnone functions.
bool Invalidate =
Configuration.Allowed && !Configuration.Allowed->count(&AAType::ID);
Attributor::~Attributor() {
// The abstract attributes are allocated via the BumpPtrAllocator Allocator,
// thus we cannot delete them. We can, and want to, destruct them though.
- for (auto &DepAA : DG.SyntheticRoot.Deps) {
- AbstractAttribute *AA = cast<AbstractAttribute>(DepAA.getPointer());
+ for (auto &It : AAMap) {
+ AbstractAttribute *AA = It.getSecond();
AA->~AbstractAttribute();
}
}
; CHECK_DISABLED_FUNCTION-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP2]]
;
-; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind memory(none) uwtable
+; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test
-; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR0:[0-9]+]] {
-; CHECK_ENABLED_FUNCTION-NEXT: ret i32 1
+; CHECK_ENABLED_FUNCTION-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
+; CHECK_ENABLED_FUNCTION-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
+; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP2]]
;
%1 = icmp sgt i32 %a, 100
%2 = zext i1 %1 to i32
; CHECK_DISABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
; CHECK_DISABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
;
-; CHECK_ENABLED_FUNCTION: Function Attrs: nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable
+; CHECK_ENABLED_FUNCTION: Function Attrs: noinline norecurse nounwind uwtable
; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1
; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR1:[0-9]+]] {
-; CHECK_ENABLED_FUNCTION-NEXT: ret i32 1
+; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 noundef 123) #[[ATTR2:[0-9]+]]
+; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
;
%1 = call i32 @range_test(i32 123)
ret i32 %1
;
; CHECK_ENABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
; CHECK_ENABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2
-; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR2:[0-9]+]] {
-; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test()
+; CHECK_ENABLED_FUNCTION-SAME: () #[[ATTR0]] {
+; CHECK_ENABLED_FUNCTION-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
; CHECK_ENABLED_FUNCTION-NEXT: ret i32 [[TMP1]]
;
%1 = call i32 @range_test(i32 123)
;.
; CHECK_DISABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable }
;.
-; CHECK_ENABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind memory(none) uwtable }
-; CHECK_ENABLED_FUNCTION: attributes #[[ATTR1]] = { nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
-; CHECK_ENABLED_FUNCTION: attributes #[[ATTR2]] = { noinline nounwind uwtable }
+; CHECK_ENABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable }
+; CHECK_ENABLED_FUNCTION: attributes #[[ATTR1]] = { noinline norecurse nounwind uwtable }
+; CHECK_ENABLED_FUNCTION: attributes #[[ATTR2]] = { nounwind }
;.