Files
clang-p2996/llvm/test/Transforms/IndVarSimplify/X86/deterministic-scev-verify.ll
Nikita Popov d1e880acaa [SCEV] Enable verification in LoopPM
Currently, we hardly ever actually run SCEV verification, even in
tests with -verify-scev. This is because the NewPM LPM does not
verify SCEV. The reason for this is that SCEV verification can
actually change the result of subsequent SCEV queries, which means
that you see different transformations depending on whether
verification is enabled or not.

To allow verification in the LPM, this limits verification to
BECounts that have actually been cached. It will not calculate
new BECounts.

BackedgeTakenInfo::getExact() is still not entirely readonly,
it still calls getUMinFromMismatchedTypes(). But I hope that this
is not problematic in the same way. (This could be avoided by
performing the umin in the other SCEV instance, but this would
require duplicating some of the code.)

Differential Revision: https://reviews.llvm.org/D120551
2022-03-07 09:46:20 +01:00

34 lines
799 B
LLVM

; RUN: opt -indvars -S < %s | FileCheck %s
; Check that IndVarSimplify's result is not influenced by stray calls to
; ScalarEvolution in debug builds. However, -verify-indvars may still do
; such calls.
; llvm.org/PR44815
; In this test, adding -verify-indvars causes %tmp13 to not be optimized away.
; CHECK-LABEL: @foo
; CHECK-NOT: phi i32
target triple = "x86_64-unknown-linux-gnu"
@b = external dso_local local_unnamed_addr global i32
define dso_local void @foo() {
tmp0:
br label %tmp12
tmp7:
%tmp8 = add nuw nsw i32 %tmp13, 1
store i32 undef, i32* @b
br label %tmp12
tmp12:
%tmp13 = phi i32 [ 2, %tmp0 ], [ %tmp8, %tmp7 ]
%tmp14 = phi i32 [ 1, %tmp0 ], [ %tmp13, %tmp7 ]
%tmp15 = icmp ult i32 %tmp14, undef
br i1 %tmp15, label %tmp7, label %tmp16
tmp16:
ret void
}