Skip to content

Commit fb24662

Browse files
author
git apple-llvm automerger
committed
Merge commit '2b3a07675bcd' from apple/master into swift/master-next
2 parents f476b7c + 2b3a076 commit fb24662

File tree

10 files changed

+101
-52
lines changed

10 files changed

+101
-52
lines changed

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3086,6 +3086,38 @@ struct AADereferenceableCallSiteReturned final
30863086

30873087
// ------------------------ Align Argument Attribute ------------------------
30883088

3089+
static unsigned int getKnownAlignForUse(Attributor &A,
3090+
AbstractAttribute &QueryingAA,
3091+
Value &AssociatedValue, const Use *U,
3092+
const Instruction *I, bool &TrackUse) {
3093+
if (ImmutableCallSite ICS = ImmutableCallSite(I)) {
3094+
if (ICS.isBundleOperand(U) || ICS.isCallee(U))
3095+
return 0;
3096+
3097+
unsigned ArgNo = ICS.getArgumentNo(U);
3098+
IRPosition IRP = IRPosition::callsite_argument(ICS, ArgNo);
3099+
// As long as we only use known information there is no need to track
3100+
// dependences here.
3101+
auto &AlignAA = A.getAAFor<AAAlign>(QueryingAA, IRP,
3102+
/* TrackDependence */ false);
3103+
return AlignAA.getKnownAlign();
3104+
}
3105+
3106+
// We need to follow common pointer manipulation uses to the accesses they
3107+
// feed into.
3108+
// TODO: Consider gep instruction
3109+
if (isa<CastInst>(I)) {
3110+
TrackUse = true;
3111+
return 0;
3112+
}
3113+
3114+
if (auto *SI = dyn_cast<StoreInst>(I))
3115+
return SI->getAlignment();
3116+
else if (auto *LI = dyn_cast<LoadInst>(I))
3117+
return LI->getAlignment();
3118+
3119+
return 0;
3120+
}
30893121
struct AAAlignImpl : AAAlign {
30903122
AAAlignImpl(const IRPosition &IRP) : AAAlign(IRP) {}
30913123

@@ -3143,6 +3175,15 @@ struct AAAlignImpl : AAAlign {
31433175
Attrs.emplace_back(
31443176
Attribute::getWithAlignment(Ctx, Align(getAssumedAlign())));
31453177
}
3178+
/// See AAFromMustBeExecutedContext
3179+
bool followUse(Attributor &A, const Use *U, const Instruction *I) {
3180+
bool TrackUse = false;
3181+
3182+
unsigned int KnownAlign = getKnownAlignForUse(A, *this, getAssociatedValue(), U, I, TrackUse);
3183+
takeKnownMaximum(KnownAlign);
3184+
3185+
return TrackUse;
3186+
}
31463187

31473188
/// See AbstractAttribute::getAsStr().
31483189
const std::string getAsStr() const override {
@@ -3153,11 +3194,14 @@ struct AAAlignImpl : AAAlign {
31533194
};
31543195

31553196
/// Align attribute for a floating value.
3156-
struct AAAlignFloating : AAAlignImpl {
3157-
AAAlignFloating(const IRPosition &IRP) : AAAlignImpl(IRP) {}
3197+
struct AAAlignFloating : AAFromMustBeExecutedContext<AAAlign, AAAlignImpl> {
3198+
using Base = AAFromMustBeExecutedContext<AAAlign, AAAlignImpl>;
3199+
AAAlignFloating(const IRPosition &IRP) : Base(IRP) {}
31583200

31593201
/// See AbstractAttribute::updateImpl(...).
31603202
ChangeStatus updateImpl(Attributor &A) override {
3203+
Base::updateImpl(A);
3204+
31613205
const DataLayout &DL = A.getDataLayout();
31623206

31633207
auto VisitValueCB = [&](Value &V, AAAlign::StateType &T,
@@ -3203,9 +3247,12 @@ struct AAAlignReturned final
32033247

32043248
/// Align attribute for function argument.
32053249
struct AAAlignArgument final
3206-
: AAArgumentFromCallSiteArguments<AAAlign, AAAlignImpl> {
3250+
: AAArgumentFromCallSiteArgumentsAndMustBeExecutedContext<AAAlign,
3251+
AAAlignImpl> {
32073252
AAAlignArgument(const IRPosition &IRP)
3208-
: AAArgumentFromCallSiteArguments<AAAlign, AAAlignImpl>(IRP) {}
3253+
: AAArgumentFromCallSiteArgumentsAndMustBeExecutedContext<AAAlign,
3254+
AAAlignImpl>(
3255+
IRP) {}
32093256

32103257
/// See AbstractAttribute::trackStatistics()
32113258
void trackStatistics() const override { STATS_DECLTRACK_ARG_ATTR(aligned) }
@@ -3224,30 +3271,22 @@ struct AAAlignCallSiteArgument final : AAAlignFloating {
32243271
};
32253272

32263273
/// Align attribute deduction for a call site return value.
3227-
struct AAAlignCallSiteReturned final : AAAlignImpl {
3228-
AAAlignCallSiteReturned(const IRPosition &IRP) : AAAlignImpl(IRP) {}
3274+
struct AAAlignCallSiteReturned final
3275+
: AACallSiteReturnedFromReturnedAndMustBeExecutedContext<AAAlign,
3276+
AAAlignImpl> {
3277+
using Base =
3278+
AACallSiteReturnedFromReturnedAndMustBeExecutedContext<AAAlign,
3279+
AAAlignImpl>;
3280+
AAAlignCallSiteReturned(const IRPosition &IRP) : Base(IRP) {}
32293281

32303282
/// See AbstractAttribute::initialize(...).
32313283
void initialize(Attributor &A) override {
3232-
AAAlignImpl::initialize(A);
3284+
Base::initialize(A);
32333285
Function *F = getAssociatedFunction();
32343286
if (!F)
32353287
indicatePessimisticFixpoint();
32363288
}
32373289

3238-
/// See AbstractAttribute::updateImpl(...).
3239-
ChangeStatus updateImpl(Attributor &A) override {
3240-
// TODO: Once we have call site specific value information we can provide
3241-
// call site specific liveness information and then it makes
3242-
// sense to specialize attributes for call sites arguments instead of
3243-
// redirecting requests to the callee argument.
3244-
Function *F = getAssociatedFunction();
3245-
const IRPosition &FnPos = IRPosition::returned(*F);
3246-
auto &FnAA = A.getAAFor<AAAlign>(*this, FnPos);
3247-
return clampStateAndIndicateChange(
3248-
getState(), static_cast<const AAAlign::StateType &>(FnAA.getState()));
3249-
}
3250-
32513290
/// See AbstractAttribute::trackStatistics()
32523291
void trackStatistics() const override { STATS_DECLTRACK_CS_ATTR(align); }
32533292
};

llvm/test/Transforms/FunctionAttrs/align.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,12 @@ e:
330330
ret i32* %phi
331331
}
332332

333+
334+
; ATTRIBUTOR: define i64 @test11(i32* nocapture nofree nonnull readonly align 8 dereferenceable(8) %p)
335+
define i64 @test11(i32* %p) {
336+
%p-cast = bitcast i32* %p to i64*
337+
%ret = load i64, i64* %p-cast, align 8
338+
ret i64 %ret
339+
}
333340
attributes #0 = { nounwind uwtable noinline }
334341
attributes #1 = { uwtable noinline }

llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ declare i32 @printf(i8* nocapture, ...)
244244
; }
245245
;
246246
; There should *not* be a no-capture attribute on %a
247-
; CHECK: define nonnull dereferenceable(8) i64* @not_captured_but_returned_0(i64* nofree nonnull returned writeonly dereferenceable(8) "no-capture-maybe-returned" %a)
247+
; CHECK: define nonnull align 8 dereferenceable(8) i64* @not_captured_but_returned_0(i64* nofree nonnull returned writeonly align 8 dereferenceable(8) "no-capture-maybe-returned" %a)
248248

249249
define i64* @not_captured_but_returned_0(i64* %a) #0 {
250250
entry:
@@ -260,7 +260,8 @@ entry:
260260
; }
261261
;
262262
; There should *not* be a no-capture attribute on %a
263-
; CHECK: define nonnull dereferenceable(8) i64* @not_captured_but_returned_1(i64* nofree nonnull writeonly dereferenceable(16) "no-capture-maybe-returned" %a)
263+
; FIXME: %a should have align 8
264+
; CHECK: define nonnull align 8 dereferenceable(8) i64* @not_captured_but_returned_1(i64* nofree nonnull writeonly dereferenceable(16) "no-capture-maybe-returned" %a)
264265
define i64* @not_captured_but_returned_1(i64* %a) #0 {
265266
entry:
266267
%add.ptr = getelementptr inbounds i64, i64* %a, i64 1
@@ -320,7 +321,7 @@ entry:
320321
; }
321322
;
322323
; There should *not* be a no-capture attribute on %a
323-
; CHECK: define nonnull dereferenceable(8) i64* @negative_test_not_captured_but_returned_call_1a(i64* nofree writeonly "no-capture-maybe-returned" %a)
324+
; CHECK: define nonnull align 8 dereferenceable(8) i64* @negative_test_not_captured_but_returned_call_1a(i64* nofree writeonly "no-capture-maybe-returned" %a)
324325
define i64* @negative_test_not_captured_but_returned_call_1a(i64* %a) #0 {
325326
entry:
326327
%call = call i64* @not_captured_but_returned_1(i64* %a)

llvm/test/Transforms/FunctionAttrs/arg_returned.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ return: ; preds = %cond.end, %if.then3
254254
;
255255
; FNATTR: define i32* @rt0(i32* readonly %a)
256256
; BOTH: Function Attrs: nofree noinline norecurse noreturn nosync nounwind readonly uwtable
257-
; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt0(i32* nocapture nofree nonnull readonly dereferenceable(4) %a)
257+
; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt0(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %a)
258258
define i32* @rt0(i32* %a) #0 {
259259
entry:
260260
%v = load i32, i32* %a, align 4
@@ -272,7 +272,7 @@ entry:
272272
;
273273
; FNATTR: define noalias i32* @rt1(i32* nocapture readonly %a)
274274
; BOTH: Function Attrs: nofree noinline norecurse noreturn nosync nounwind readonly uwtable
275-
; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt1(i32* nocapture nofree nonnull readonly dereferenceable(4) %a)
275+
; BOTH-NEXT: define noalias nonnull align 536870912 dereferenceable(4294967295) i32* @rt1(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %a)
276276
define i32* @rt1(i32* %a) #0 {
277277
entry:
278278
%v = load i32, i32* %a, align 4

llvm/test/Transforms/FunctionAttrs/dereferenceable.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ if.false:
189189
}
190190

191191
define i32* @f7_3() {
192-
; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @f7_3()
192+
; ATTRIBUTOR: define nonnull align 16 dereferenceable(4) i32* @f7_3()
193193
%ptr = tail call i32* @unkown_ptr()
194194
store i32 10, i32* %ptr, align 16
195195
ret i32* %ptr

llvm/test/Transforms/FunctionAttrs/internal-noalias.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ entry:
88
ret i32 %add
99
}
1010

11-
; CHECK: define private i32 @noalias_args(i32* nocapture nofree nonnull readonly dereferenceable(4) %A, i32* noalias nocapture nofree nonnull readonly dereferenceable(4) %B)
11+
; CHECK: define private i32 @noalias_args(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %A, i32* noalias nocapture nofree nonnull readonly align 4 dereferenceable(4) %B)
1212

1313
define private i32 @noalias_args(i32* %A, i32* %B) #0 {
1414
entry:
@@ -23,7 +23,7 @@ entry:
2323

2424
; FIXME: Should be something like this.
2525
; define internal i32 @noalias_args_argmem(i32* noalias nocapture readonly %A, i32* noalias nocapture readonly %B)
26-
; CHECK: define internal i32 @noalias_args_argmem(i32* nocapture nofree nonnull readonly dereferenceable(4) %A, i32* nocapture nofree nonnull readonly dereferenceable(4) %B)
26+
; CHECK: define internal i32 @noalias_args_argmem(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %A, i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %B)
2727

2828
;
2929
define internal i32 @noalias_args_argmem(i32* %A, i32* %B) #1 {

llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,31 +241,31 @@ define void @f2() #0 {
241241
}
242242

243243
; TEST 12 NoFree argument - positive.
244-
; ATTRIBUTOR: define double @test12(double* nocapture nofree nonnull readonly dereferenceable(8) %a)
244+
; ATTRIBUTOR: define double @test12(double* nocapture nofree nonnull readonly align 8 dereferenceable(8) %a)
245245
define double @test12(double* nocapture readonly %a) {
246246
entry:
247-
%0 = load double, double* %a, align 8
248-
%call = tail call double @cos(double %0) #2
249-
ret double %call
247+
%0 = load double, double* %a, align 8
248+
%call = tail call double @cos(double %0) #2
249+
ret double %call
250250
}
251251

252252
declare double @cos(double) nobuiltin nounwind nofree
253253

254254
; FIXME: %a should be nofree.
255255
; TEST 13 NoFree argument - positive.
256-
; ATTRIBUTOR: define noalias i32* @test13(i64* nocapture nonnull readonly dereferenceable(8) %a)
256+
; ATTRIBUTOR: define noalias i32* @test13(i64* nocapture nonnull readonly align 8 dereferenceable(8) %a)
257257
define noalias i32* @test13(i64* nocapture readonly %a) {
258258
entry:
259-
%0 = load i64, i64* %a, align 8
260-
%call = tail call noalias i8* @malloc(i64 %0) #2
261-
%1 = bitcast i8* %call to i32*
262-
ret i32* %1
259+
%0 = load i64, i64* %a, align 8
260+
%call = tail call noalias i8* @malloc(i64 %0) #2
261+
%1 = bitcast i8* %call to i32*
262+
ret i32* %1
263263
}
264264

265265
; ATTRIBUTOR: define void @test14(i8* nocapture %0, i8* nocapture nofree readnone %1)
266266
define void @test14(i8* nocapture %0, i8* nocapture %1) {
267-
tail call void @free(i8* %0) #1
268-
ret void
267+
tail call void @free(i8* %0) #1
268+
ret void
269269
}
270270

271271
declare noalias i8* @malloc(i64)

llvm/test/Transforms/FunctionAttrs/nosync.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ entry:
4545
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
4646
; FNATTR-NEXT: define i32 @load_monotonic(i32* nocapture readonly %0)
4747
; ATTRIBUTOR: Function Attrs: nofree norecurse nosync nounwind uwtable
48-
; ATTRIBUTOR-NEXT: define i32 @load_monotonic(i32* nocapture nofree nonnull readonly dereferenceable(4) %0)
48+
; ATTRIBUTOR-NEXT: define i32 @load_monotonic(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %0)
4949
define i32 @load_monotonic(i32* nocapture readonly %0) norecurse nounwind uwtable {
5050
%2 = load atomic i32, i32* %0 monotonic, align 4
5151
ret i32 %2
@@ -61,7 +61,7 @@ define i32 @load_monotonic(i32* nocapture readonly %0) norecurse nounwind uwtabl
6161
; FNATTR: Function Attrs: nofree norecurse nounwind uwtable
6262
; FNATTR-NEXT: define void @store_monotonic(i32* nocapture %0)
6363
; ATTRIBUTOR: Function Attrs: nofree norecurse nosync nounwind uwtable
64-
; ATTRIBUTOR-NEXT: define void @store_monotonic(i32* nocapture nofree nonnull writeonly dereferenceable(4) %0)
64+
; ATTRIBUTOR-NEXT: define void @store_monotonic(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) %0)
6565
define void @store_monotonic(i32* nocapture %0) norecurse nounwind uwtable {
6666
store atomic i32 10, i32* %0 monotonic, align 4
6767
ret void
@@ -78,7 +78,7 @@ define void @store_monotonic(i32* nocapture %0) norecurse nounwind uwtable {
7878
; FNATTR-NEXT: define i32 @load_acquire(i32* nocapture readonly %0)
7979
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
8080
; ATTRIBUTOR-NOT: nosync
81-
; ATTRIBUTOR-NEXT: define i32 @load_acquire(i32* nocapture nofree nonnull readonly dereferenceable(4) %0)
81+
; ATTRIBUTOR-NEXT: define i32 @load_acquire(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) %0)
8282
define i32 @load_acquire(i32* nocapture readonly %0) norecurse nounwind uwtable {
8383
%2 = load atomic i32, i32* %0 acquire, align 4
8484
ret i32 %2
@@ -94,7 +94,7 @@ define i32 @load_acquire(i32* nocapture readonly %0) norecurse nounwind uwtable
9494
; FNATTR-NEXT: define void @load_release(i32* nocapture %0)
9595
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
9696
; ATTRIBUTOR-NOT: nosync
97-
; ATTRIBUTOR-NEXT: define void @load_release(i32* nocapture nofree writeonly %0)
97+
; ATTRIBUTOR-NEXT: define void @load_release(i32* nocapture nofree writeonly align 4 %0)
9898
define void @load_release(i32* nocapture %0) norecurse nounwind uwtable {
9999
store atomic volatile i32 10, i32* %0 release, align 4
100100
ret void
@@ -106,7 +106,7 @@ define void @load_release(i32* nocapture %0) norecurse nounwind uwtable {
106106
; FNATTR-NEXT: define void @load_volatile_release(i32* nocapture %0)
107107
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
108108
; ATTRIBUTOR-NOT: nosync
109-
; ATTRIBUTOR-NEXT: define void @load_volatile_release(i32* nocapture nofree writeonly %0)
109+
; ATTRIBUTOR-NEXT: define void @load_volatile_release(i32* nocapture nofree writeonly align 4 %0)
110110
define void @load_volatile_release(i32* nocapture %0) norecurse nounwind uwtable {
111111
store atomic volatile i32 10, i32* %0 release, align 4
112112
ret void
@@ -122,7 +122,7 @@ define void @load_volatile_release(i32* nocapture %0) norecurse nounwind uwtable
122122
; FNATTR-NEXT: define void @volatile_store(i32* %0)
123123
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
124124
; ATTRIBUTOR-NOT: nosync
125-
; ATTRIBUTOR-NEXT: define void @volatile_store(i32* nofree %0)
125+
; ATTRIBUTOR-NEXT: define void @volatile_store(i32* nofree align 4 %0)
126126
define void @volatile_store(i32* %0) norecurse nounwind uwtable {
127127
store volatile i32 14, i32* %0, align 4
128128
ret void
@@ -139,7 +139,7 @@ define void @volatile_store(i32* %0) norecurse nounwind uwtable {
139139
; FNATTR-NEXT: define i32 @volatile_load(i32* %0)
140140
; ATTRIBUTOR: Function Attrs: nofree norecurse nounwind uwtable
141141
; ATTRIBUTOR-NOT: nosync
142-
; ATTRIBUTOR-NEXT: define i32 @volatile_load(i32* nofree %0)
142+
; ATTRIBUTOR-NEXT: define i32 @volatile_load(i32* nofree align 4 %0)
143143
define i32 @volatile_load(i32* %0) norecurse nounwind uwtable {
144144
%2 = load volatile i32, i32* %0, align 4
145145
ret i32 %2
@@ -224,7 +224,7 @@ define void @scc2(i32* %0) noinline nounwind uwtable {
224224
; FNATTR: Function Attrs: nofree norecurse nounwind
225225
; FNATTR-NEXT: define void @foo1(i32* nocapture %0, %"struct.std::atomic"* nocapture %1)
226226
; ATTRIBUTOR-NOT: nosync
227-
; ATTRIBUTOR: define void @foo1(i32* nocapture nofree nonnull writeonly dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
227+
; ATTRIBUTOR: define void @foo1(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
228228

229229
define void @foo1(i32* %0, %"struct.std::atomic"* %1) {
230230
store i32 100, i32* %0, align 4
@@ -257,7 +257,7 @@ define void @bar(i32* %0, %"struct.std::atomic"* %1) {
257257
; FNATTR: Function Attrs: nofree norecurse nounwind
258258
; FNATTR-NEXT: define void @foo1_singlethread(i32* nocapture %0, %"struct.std::atomic"* nocapture %1)
259259
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind willreturn
260-
; ATTRIBUTOR: define void @foo1_singlethread(i32* nocapture nofree nonnull writeonly dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
260+
; ATTRIBUTOR: define void @foo1_singlethread(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) %0, %"struct.std::atomic"* nocapture nofree nonnull writeonly dereferenceable(1) %1)
261261

262262
define void @foo1_singlethread(i32* %0, %"struct.std::atomic"* %1) {
263263
store i32 100, i32* %0, align 4

llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ return: ; preds = %if.end, %if.then
7070
}
7171

7272
; CHECK: Function Attrs: nofree nosync nounwind
73-
; CHECK-NEXT: define internal i32* @internal_ret1_rrw(i32* nofree nonnull dereferenceable(4) %r0, i32* nofree returned %r1, i32* nofree %w0)
73+
; CHECK-NEXT: define internal i32* @internal_ret1_rrw(i32* nofree nonnull align 4 dereferenceable(4) %r0, i32* nofree returned %r1, i32* nofree %w0)
7474
define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) {
7575
entry:
7676
%0 = load i32, i32* %r0, align 4
@@ -121,7 +121,7 @@ return: ; preds = %if.end, %if.then
121121
}
122122

123123
; CHECK: Function Attrs: nofree nosync nounwind
124-
; CHECK-NEXT: define internal i32* @internal_ret1_rw(i32* nofree nonnull dereferenceable(4) %r0, i32* nofree returned %w0)
124+
; CHECK-NEXT: define internal i32* @internal_ret1_rw(i32* nofree nonnull align 4 dereferenceable(4) %r0, i32* nofree returned %w0)
125125
define internal i32* @internal_ret1_rw(i32* %r0, i32* %w0) {
126126
entry:
127127
%0 = load i32, i32* %r0, align 4

llvm/test/Transforms/InferFunctionAttrs/dereferenceable.ll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
define <4 x double> @PR21780(double* %ptr) {
1010
; CHECK-LABEL: @PR21780(double* %ptr)
11-
; ATTRIBUTOR-LABEL: @PR21780(double* nocapture nofree nonnull readonly dereferenceable(32) %ptr)
11+
; ATTRIBUTOR-LABEL: @PR21780(double* nocapture nofree nonnull readonly align 8 dereferenceable(32) %ptr)
1212

1313
; GEP of index 0 is simplified away.
1414
%arrayidx1 = getelementptr inbounds double, double* %ptr, i64 1
@@ -31,6 +31,7 @@ define <4 x double> @PR21780(double* %ptr) {
3131

3232
define double @PR21780_only_access3_with_inbounds(double* %ptr) {
3333
; CHECK-LABEL: @PR21780_only_access3_with_inbounds(double* %ptr)
34+
; FIXME: %ptr should have align 8
3435
; ATTRIBUTOR-LABEL: @PR21780_only_access3_with_inbounds(double* nocapture nofree nonnull readonly dereferenceable(32) %ptr)
3536

3637
%arrayidx3 = getelementptr inbounds double, double* %ptr, i64 3
@@ -40,6 +41,7 @@ define double @PR21780_only_access3_with_inbounds(double* %ptr) {
4041

4142
define double @PR21780_only_access3_without_inbounds(double* %ptr) {
4243
; CHECK-LABEL: @PR21780_only_access3_without_inbounds(double* %ptr)
44+
; FIXME: %ptr should have align 8
4345
; ATTRIBUTOR-LABEL: @PR21780_only_access3_without_inbounds(double* nocapture nofree readonly %ptr)
4446
%arrayidx3 = getelementptr double, double* %ptr, i64 3
4547
%t3 = load double, double* %arrayidx3, align 8
@@ -49,7 +51,7 @@ define double @PR21780_only_access3_without_inbounds(double* %ptr) {
4951
define double @PR21780_without_inbounds(double* %ptr) {
5052
; CHECK-LABEL: @PR21780_without_inbounds(double* %ptr)
5153
; FIXME: this should be @PR21780_without_inbounds(double* nonnull dereferenceable(32) %ptr)
52-
; ATTRIBUTOR-LABEL: @PR21780_without_inbounds(double* nocapture nofree nonnull readonly dereferenceable(8) %ptr)
54+
; ATTRIBUTOR-LABEL: @PR21780_without_inbounds(double* nocapture nofree nonnull readonly align 8 dereferenceable(8) %ptr)
5355

5456
%arrayidx1 = getelementptr double, double* %ptr, i64 1
5557
%arrayidx2 = getelementptr double, double* %ptr, i64 2

0 commit comments

Comments
 (0)