[llvm] [BasicAA] Fix handling of indirect assumption based results (PR #100130)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 00:52:37 PDT 2024
================
@@ -0,0 +1,127 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=slp-vectorizer < %s | FileCheck %s
+
+target triple = "x86_64-redhat-linux-gnu"
+
+; Should not get vectorized.
+define void @test(ptr %arg, i64 %arg1, i64 %arg2) {
+; CHECK-LABEL: define void @test(
+; CHECK-SAME: ptr [[ARG:%.*]], i64 [[ARG1:%.*]], i64 [[ARG2:%.*]]) {
+; CHECK-NEXT: [[_PREHEADER48_PREHEADER:.*]]:
+; CHECK-NEXT: br label %[[DOTLOOPEXIT49:.*]]
+; CHECK: [[DOTLOOPEXIT49]]:
+; CHECK-NEXT: [[I:%.*]] = phi ptr [ [[I21:%.*]], %[[BB20:.*]] ], [ null, %[[_PREHEADER48_PREHEADER]] ]
+; CHECK-NEXT: br i1 false, label %[[BB22:.*]], label %[[DOTPREHEADER48_PREHEADER:.*]]
+; CHECK: [[_PREHEADER48_PREHEADER1:.*:]]
+; CHECK-NEXT: br [[DOTLOOPEXIT50:label %.*]]
+; CHECK: [[_LOOPEXIT49:.*]]:
+; CHECK-NEXT: br [[DOTLOOPEXIT50]]
+; CHECK: [[_PREHEADER48_PREHEADER_1:.*:]]
+; CHECK-NEXT: [[I5:%.*]] = phi ptr [ [[I]], %[[_LOOPEXIT49]] ], [ [[I]], %[[DOTPREHEADER48_PREHEADER]] ]
+; CHECK-NEXT: br label %[[DOTLOOPEXIT49_1:.*]]
+; CHECK: [[_LOOPEXIT42_1:.*:]]
+; CHECK-NEXT: br [[DOTLOOPEXIT49_2:label %.*]]
+; CHECK: [[_LOOPEXIT49_1:.*:]]
+; CHECK-NEXT: br i1 false, [[DOTLOOPEXIT49_2]], label %[[BB20]]
+; CHECK: [[_LOOPEXIT49_2:.*:]]
+; CHECK-NEXT: [[I6:%.*]] = phi ptr [ [[I5]], [[DOTLOOPEXIT42_1:%.*]] ], [ [[I5]], %[[DOTLOOPEXIT49_1]] ]
+; CHECK-NEXT: [[I7:%.*]] = getelementptr inbounds i8, ptr [[I6]], i64 [[ARG1]]
+; CHECK-NEXT: br label %[[BB8:.*]]
+; CHECK: [[BB8]]:
+; CHECK-NEXT: br label %[[BB10:.*]]
+; CHECK: [[DEAD2:.*]]:
+; CHECK-NEXT: br label %[[BB10]]
+; CHECK: [[BB10]]:
+; CHECK-NEXT: [[I11:%.*]] = phi ptr [ [[I7]], %[[BB8]] ], [ null, %[[DEAD2]] ]
+; CHECK-NEXT: br label %[[BB13:.*]]
+; CHECK: [[BB13]]:
+; CHECK-NEXT: [[I14:%.*]] = phi ptr [ [[ARG]], %[[BB13]] ], [ [[I11]], %[[BB10]] ]
+; CHECK-NEXT: [[I15:%.*]] = phi ptr [ null, %[[BB13]] ], [ [[I6]], %[[BB10]] ]
+; CHECK-NEXT: [[I16:%.*]] = getelementptr inbounds i8, ptr [[I14]], i64 8
+; CHECK-NEXT: [[I17:%.*]] = load i64, ptr [[I16]], align 1
+; CHECK-NEXT: store i64 [[I17]], ptr [[I15]], align 1
+; CHECK-NEXT: [[I18:%.*]] = getelementptr inbounds i8, ptr [[I15]], i64 8
+; CHECK-NEXT: [[I19:%.*]] = load i64, ptr [[I14]], align 1
+; CHECK-NEXT: store i64 [[I19]], ptr [[I18]], align 1
+; CHECK-NEXT: br i1 false, label %[[BB13]], label %[[BB20]]
+; CHECK: [[BB20]]:
+; CHECK-NEXT: [[I21]] = phi ptr [ [[I5]], [[DOTLOOPEXIT42_1]] ], [ [[I6]], %[[BB13]] ]
+; CHECK-NEXT: br label %[[DOTLOOPEXIT49]]
+; CHECK: [[BB22]]:
+; CHECK-NEXT: [[I23:%.*]] = getelementptr inbounds i8, ptr [[I]], i64 [[ARG2]]
+; CHECK-NEXT: [[I25:%.*]] = getelementptr inbounds i8, ptr [[I23]], i64 8
+; CHECK-NEXT: br label %[[BB26:.*]]
+; CHECK: [[BB26]]:
+; CHECK-NEXT: [[I27:%.*]] = phi ptr [ null, %[[BB26]] ], [ [[I25]], %[[BB22]] ]
+; CHECK-NEXT: store i64 0, ptr [[I27]], align 1
+; CHECK-NEXT: [[I28:%.*]] = getelementptr inbounds i8, ptr [[I27]], i64 8
+; CHECK-NEXT: [[I29:%.*]] = load i64, ptr [[I23]], align 1
+; CHECK-NEXT: store i64 0, ptr [[I28]], align 1
+; CHECK-NEXT: br label %[[BB26]]
+;
+entry:
+ br label %loop1
+
+loop1: ; preds = %bb20, %entry
+ %i = phi ptr [ %i21, %bb20 ], [ null, %entry ]
----------------
fhahn wrote:
Might be good to avoid null pointers here and elsewhere if possible?
https://github.com/llvm/llvm-project/pull/100130
More information about the llvm-commits
mailing list