From: Philip Reames Date: Mon, 10 Jun 2019 23:17:10 +0000 (+0000) Subject: [Tests] Adjust LFTR dead-iv tests to bypass undef cases X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85a2f58ba7a4cd828ce3b184385b2ed0691806bd;p=llvm [Tests] Adjust LFTR dead-iv tests to bypass undef cases As pointed out by Nikita in review, undef and poison need to be handled separately. Since we're no longer expecting any test improvements - just fixes for miscompiles - update the tests to bypass the existing undef check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363002 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/IndVarSimplify/lftr-dead-ivs.ll b/test/Transforms/IndVarSimplify/lftr-dead-ivs.ll index 42e71ee7f17..6fe4b898522 100644 --- a/test/Transforms/IndVarSimplify/lftr-dead-ivs.ll +++ b/test/Transforms/IndVarSimplify/lftr-dead-ivs.ll @@ -20,7 +20,7 @@ target datalayout = "n8:16:32:64" ;; IV which dependends on that poison computation in a manner which might ;; trigger UB would be incorrect. ;; FIXME: This currently shows a miscompile! -define void @neg_dynamically_dead_inbounds(i8* %a, i8** %x, i1 %always_false) #0 { +define void @neg_dynamically_dead_inbounds(i1 %always_false) #0 { ; CHECK-LABEL: @neg_dynamically_dead_inbounds( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]] @@ -102,17 +102,15 @@ exit: ret void } -define void @dom_store_preinc(i8* %a) #0 { +define void @dom_store_preinc() #0 { ; CHECK-LABEL: @dom_store_preinc( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ] ; CHECK-NEXT: store volatile i8 0, i8* [[P_0]] ; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1 -; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[TMP4]], -10 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 246) ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -122,7 +120,7 @@ entry: loop: %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ] - %p.0 = phi i8* [ %a, %entry ], [ %tmp3, %loop ] + %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ] store volatile i8 0, i8* %p.0 %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1 %tmp4 = add i8 %i.0, 1 @@ -133,17 +131,15 @@ exit: ret void } -define void @dom_store_postinc(i8* %a) #0 { +define void @dom_store_postinc() #0 { ; CHECK-LABEL: @dom_store_postinc( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1 ; CHECK-NEXT: store volatile i8 0, i8* [[TMP3]] -; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[TMP4]], -10 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 246) ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: ret void @@ -153,7 +149,7 @@ entry: loop: %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ] - %p.0 = phi i8* [ %a, %entry ], [ %tmp3, %loop ] + %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ] %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1 store volatile i8 0, i8* %tmp3 %tmp4 = add i8 %i.0, 1 @@ -164,17 +160,15 @@ exit: ret void } -define i8 @dom_load(i8* %a) #0 { +define i8 @dom_load() #0 { ; CHECK-LABEL: @dom_load( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: -; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1 ; CHECK-NEXT: [[V:%.*]] = load i8, i8* [[TMP3]] -; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1 -; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[TMP4]], -10 +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 246) ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]] ; CHECK: exit: ; CHECK-NEXT: [[V_LCSSA:%.*]] = phi i8 [ [[V]], [[LOOP]] ] @@ -185,7 +179,7 @@ entry: loop: %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ] - %p.0 = phi i8* [ %a, %entry ], [ %tmp3, %loop ] + %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ] %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1 %v = load i8, i8* %tmp3 %tmp4 = add i8 %i.0, 1 @@ -196,13 +190,13 @@ exit: ret i8 %v } -define i64 @dom_div(i64 %a) #0 { +define i64 @dom_div(i64 %input) #0 { ; CHECK-LABEL: @dom_div( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]] ; CHECK: loop: ; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ] -; CHECK-NEXT: [[I_1:%.*]] = phi i64 [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[I_1:%.*]] = phi i64 [ [[INPUT:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ] ; CHECK-NEXT: [[TMP3]] = add nuw nsw i64 [[I_1]], 1 ; CHECK-NEXT: [[V:%.*]] = udiv i64 5, [[TMP3]] ; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1 @@ -217,7 +211,7 @@ entry: loop: %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ] - %i.1 = phi i64 [ %a, %entry ], [ %tmp3, %loop ] + %i.1 = phi i64 [ %input, %entry ], [ %tmp3, %loop ] %tmp3 = add nsw nuw i64 %i.1, 1 %v = udiv i64 5, %tmp3 %tmp4 = add i8 %i.0, 1 @@ -230,7 +224,7 @@ exit: ; For integer IVs, we handle this trigger case by stripping the problematic ; flags which removes the potential introduction of UB. -define void @neg_dead_int_iv(i64 %a) #0 { +define void @neg_dead_int_iv() #0 { ; CHECK-LABEL: @neg_dead_int_iv( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[LOOP:%.*]]