1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/InstCombine/pr38677.ll
Craig Topper da9171ac7d [ValueTracking] Fix assert message and add test case for r340546 and PR38677.
The bug was already fixed. This just adds a test case for it.

llvm-svn: 340556
2018-08-23 17:45:53 +00:00

34 lines
1.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
;RUN: opt -instcombine -S %s | FileCheck %s
@A = extern_weak global i32, align 4
@B = extern_weak global i32, align 4
define i32 @foo(i1 %which) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 true, label [[FINAL:%.*]], label [[DELAY:%.*]]
; CHECK: delay:
; CHECK-NEXT: br label [[FINAL]]
; CHECK: final:
; CHECK-NEXT: [[USE2:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), [[DELAY]] ]
; CHECK-NEXT: [[B7:%.*]] = mul i32 [[USE2]], 2147483647
; CHECK-NEXT: [[C3:%.*]] = icmp eq i32 [[B7]], 0
; CHECK-NEXT: store i1 [[C3]], i1* undef, align 1
; CHECK-NEXT: ret i32 [[USE2]]
;
entry:
br i1 true, label %final, label %delay
delay: ; preds = %entry
br label %final
final: ; preds = %delay, %entry
%use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
%value = select i1 %use2, i32 2, i32 1
%B7 = mul i32 %value, 2147483647
%C3 = icmp ule i32 %B7, 0
store i1 %C3, i1* undef
ret i32 %value
}