Skip to content

Conversation

@jdoerfert
Copy link
Member

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Feb 28, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Johannes Doerfert (jdoerfert)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/129165.diff

1 Files Affected:

  • (modified) llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll (+18)
diff --git a/llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll b/llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll
index f04ac4d73340f..b2190802715cd 100644
--- a/llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll
+++ b/llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll
@@ -15,6 +15,9 @@ define i8 @select_offsets_simplifiable_1(i1 %cnd1, i1 %cnd2) {
 ; CHECK-NEXT:    store i8 23, ptr [[GEP23]], align 4
 ; CHECK-NEXT:    [[GEP29:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 29
 ; CHECK-NEXT:    store i8 29, ptr [[GEP29]], align 4
+; CHECK-NEXT:    [[GEP9:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 9
+; CHECK-NEXT:    [[GEP6:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 6
+; CHECK-NEXT:    store i16 6, ptr [[GEP6]], align 4
 ; CHECK-NEXT:    [[GEP7:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 7
 ; CHECK-NEXT:    store i8 7, ptr [[GEP7]], align 4
 ; CHECK-NEXT:    [[GEP31:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 31
@@ -31,6 +34,12 @@ entry:
   store i8 23, ptr %gep23, align 4
   %gep29 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 29
   store i8 29, ptr %gep29, align 4
+  ;; This store is redundant, hence removed.
+  %gep9 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 9
+  store i8 9, ptr %gep9, align 4
+  ;; This store is not redundant.
+  %gep6 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 6
+  store i16 6, ptr %gep6, align 4
   %gep7 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 7
   store i8 7, ptr %gep7, align 4
 
@@ -53,6 +62,9 @@ define i8 @select_offsets_simplifiable_2(i1 %cnd1, i1 %cnd2) {
 ; CHECK-NEXT:    [[BYTES:%.*]] = alloca [1024 x i8], align 16
 ; CHECK-NEXT:    [[GEP23:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 23
 ; CHECK-NEXT:    store i8 23, ptr [[GEP23]], align 4
+; CHECK-NEXT:    [[GEP9:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 9
+; CHECK-NEXT:    [[GEP6:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 6
+; CHECK-NEXT:    store i16 6, ptr [[GEP6]], align 4
 ; CHECK-NEXT:    [[GEP29:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 29
 ; CHECK-NEXT:    store i8 29, ptr [[GEP29]], align 4
 ; CHECK-NEXT:    [[GEP7:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 7
@@ -70,6 +82,12 @@ entry:
 
   %gep23 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 23
   store i8 23, ptr %gep23, align 4
+  ;; This store is redundant, hence removed.
+  %gep9 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 9
+  store i8 9, ptr %gep9, align 4
+  ;; This store is not redundant.
+  %gep6 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 6
+  store i16 6, ptr %gep6, align 4
   %gep29 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 29
   store i8 29, ptr %gep29, align 4
   %gep7 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 7

; CHECK-NEXT: store i8 23, ptr [[GEP23]], align 4
; CHECK-NEXT: [[GEP29:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 29
; CHECK-NEXT: store i8 29, ptr [[GEP29]], align 4
; CHECK-NEXT: [[GEP9:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it is not removed yet. Expected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it overlaps with index 7 (due to the i16). More coverage for the case the index doesn't match but there is an overlap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants