[PATCH] D77560: [SCEV] don't try to query getSCEV() for incomplete PHIs
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 07:15:22 PDT 2020
lebedev.ri added a comment.
Somewhat better test (although needs further manual cleanup), that produces different results with/without the fix:
; RUN: opt %s -loop-reduce -S | FileCheck %s
target datalayout = "e-m:e-i64:64-n32:64"
target triple = "powerpc64le-unknown-linux-gnu"
%0 = type <{ float }>
define void @foo([0 x %0]* %arg) {
bb:
%i = getelementptr inbounds [0 x %0], [0 x %0]* %arg, i64 0, i64 -1
%i1 = bitcast %0* %i to i8*
%i2 = getelementptr i8, i8* %i1, i64 4
br label %bb3
bb3: ; preds = %bb18, %bb
%i4 = phi i64 [ %i20, %bb18 ], [ 0, %bb ]
%i5 = phi i64 [ %i21, %bb18 ], [ 1, %bb ]
br label %bb6
bb6: ; preds = %bb3
br i1 undef, label %bb7, label %bb8
bb7: ; preds = %bb17, %bb6
br label %bb22
bb8: ; preds = %bb6
br label %bb9
bb9: ; preds = %bb9, %bb8
%i10 = phi i64 [ 0, %bb8 ], [ %i16, %bb9 ]
%i11 = add i64 %i10, %i4
%i12 = shl i64 %i11, 2
%i13 = getelementptr i8, i8* %i2, i64 %i12
%i14 = bitcast i8* %i13 to float*
%i15 = bitcast float* %i14 to <4 x float>*
store <4 x float> undef, <4 x float>* %i15, align 4
%i16 = add i64 %i10, 32
br i1 true, label %bb17, label %bb9
bb17: ; preds = %bb9
br i1 undef, label %bb18, label %bb7
bb18: ; preds = %bb17
%i19 = add i64 undef, %i4
%i20 = add i64 %i19, %i5
%i21 = add nuw nsw i64 %i5, 1
br label %bb3
bb22: ; preds = %bb22, %bb7
%i23 = phi i64 [ %i26, %bb22 ], [ undef, %bb7 ]
%i24 = add nsw i64 %i23, %i4
%i25 = getelementptr %0, %0* %i, i64 %i24, i32 0
store float undef, float* %i25, align 4
%i26 = add nuw nsw i64 %i23, 1
br label %bb22
}
I would think `getSCEV()` should be returning `nullptr` if it is asked about an instruction that is currently being created, but i don't know.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77560/new/
https://reviews.llvm.org/D77560
More information about the llvm-commits
mailing list