File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -1221,8 +1221,15 @@ AliasResult BasicAAResult::aliasGEP(
12211221 if (!Overflow && Off.uge (UpperRange))
12221222 return AliasResult::NoAlias;
12231223 APInt LowerRange = CR.getUnsignedMin ().umul_ov (LSizeMin, Overflow);
1224- if (!Overflow && Off.ult (LowerRange))
1225- return AliasResult::PartialAlias;
1224+ if (!Overflow && Off.ult (LowerRange)) {
1225+ AliasResult AR = AliasResult::PartialAlias;
1226+ if (VRightSize.hasValue () && !VRightSize.isScalable () &&
1227+ Off.ule (INT32_MAX) && (Off + VRightSize.getValue ()).ule (LSizeMin)) {
1228+ AR.setOffset (-Off.getSExtValue ());
1229+ AR.swap (Swapped);
1230+ }
1231+ return AR;
1232+ }
12261233 }
12271234
12281235 // VScale Alias Analysis - Given one scalable offset between accesses and a
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ define void @gep_alloca_const_offset_2() {
3232}
3333
3434; CHECK-LABEL: gep_alloca_const_offset_3
35- ; CHECK-DAG: MustAlias: <vscale x 4 x i32>* %alloc, <vscale x 4 x i32>* %gep1
36- ; CHECK-DAG: PartialAlias: <vscale x 4 x i32>* %alloc, i32* %gep2
37- ; CHECK-DAG: PartialAlias: <vscale x 4 x i32>* %gep1, i32* %gep2
35+ ; CHECK-DAG: MustAlias: <vscale x 4 x i32>* %alloc, <vscale x 4 x i32>* %gep1
36+ ; CHECK-DAG: PartialAlias (off 4) : <vscale x 4 x i32>* %alloc, i32* %gep2
37+ ; CHECK-DAG: PartialAlias (off 4) : <vscale x 4 x i32>* %gep1, i32* %gep2
3838define void @gep_alloca_const_offset_3 () {
3939 %alloc = alloca <vscale x 4 x i32 >
4040 %gep1 = getelementptr <vscale x 4 x i32 >, ptr %alloc , i64 0
You can’t perform that action at this time.
0 commit comments