1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00
llvm-mirror/test/Transforms/SCCP/apint-select.ll
Florian Hahn 61a834b1e0 Recommit "[SCCP] Remove forcedconstant, go to overdefined instead"
This includes a fix for cases where things get marked as overdefined in
ResolvedUndefsIn, but we later discover a constant. To avoid crashing,
we consistently bail out on overdefined values in the visitors. This is
similar to the previous behavior with forcedconstant.

This reverts the revert commit 02b72f564c8be0b4f4337d5c4a3fcf7e8018a818.
2020-02-15 18:36:44 +01:00

30 lines
718 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -sccp -S | FileCheck %s
@A = constant i32 10
define i712 @test1() {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[BB:%.*]] = and i64 ptrtoint (i32* @A to i64), undef
; CHECK-NEXT: [[C:%.*]] = icmp sge i64 [[BB]], 0
; CHECK-NEXT: [[X:%.*]] = select i1 [[C]], i712 0, i712 1
; CHECK-NEXT: ret i712 [[X]]
;
%P = getelementptr i32, i32* @A, i32 0
%B = ptrtoint i32* %P to i64
%BB = and i64 %B, undef
%C = icmp sge i64 %BB, 0
%X = select i1 %C, i712 0, i712 1
ret i712 %X
}
define i712 @test2(i1 %C) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: ret i712 0
;
%X = select i1 %C, i712 0, i712 undef
ret i712 %X
}