[llvm] [Attributor]: allow more than one offset for a pass through user in AAPointerInfo (PR #94416)

Vidush Singhal via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 17:38:02 PDT 2024


================
@@ -52,12 +52,34 @@ define void @bar(ptr noundef byval(%struct.test.a) align 8 %dev) {
   store i32 1, ptr %1
   ret void
 }
+
+
+define void @multiple_access_bins_for_select_when_pass_through_instruction(i1 %cond) {
+; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
+; CHECK-LABEL: define {{[^@]+}}@multiple_access_bins_for_select_when_pass_through_instruction
+; CHECK-SAME: (i1 [[COND:%.*]]) #[[ATTR2:[0-9]+]] {
+; CHECK-NEXT:    [[TMP1:%.*]] = alloca [10 x i8], align 4
+; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr inbounds [10 x i8], ptr [[TMP1]], i64 0, i64 5
+; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr inbounds [10 x i8], ptr [[TMP1]], i64 0, i64 2
+; CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[COND]], ptr [[TMP2]], ptr [[TMP3]]
+; CHECK-NEXT:    store i8 100, ptr [[TMP4]], align 1
+; CHECK-NEXT:    ret void
+;
+%2 = alloca [10 x i8], align 4
+%3 = getelementptr inbounds [10 x i8], ptr %2, i64 0, i64 5
+%4 = getelementptr inbounds [10 x i8], ptr %2, i64 0, i64 2
+%5 = select i1 %cond, ptr %3, ptr %4
+store i8 100, ptr %5
+ret void
+}
----------------
vidsinghal wrote:

I don't know of a case that will show up differently in IR with just AApointer info. 
With AAalloca info, yes, but that's not implemented in the PR. 
Is there a way to print any debug output that might show the difference?

https://github.com/llvm/llvm-project/pull/94416


More information about the llvm-commits mailing list