ConstantRange uses `[-1, -1)` as the canonical form of a full set. Therefore, the `for (APInt I = Lower; I != Upper; ++I)` idiom doesn't work for full ranges. This patch fixes the value enumeration in `ConstantComparesGatherer` to prevent missing values for full sets. Closes https://github.com/llvm/llvm-project/issues/166369.
38 lines
766 B
LLVM
38 lines
766 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt -S -passes=simplifycfg < %s | FileCheck %s
|
|
|
|
; Make sure we handle full-set ranges correctly.
|
|
define void @test_i1() {
|
|
; CHECK-LABEL: define void @test_i1() {
|
|
; CHECK-NEXT: [[BB:.*:]]
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
bb:
|
|
%icmp = icmp ugt i1 false, true
|
|
br label %bb5
|
|
|
|
bb5:
|
|
%select = select i1 %icmp, i1 %icmp, i1 false
|
|
br i1 %select, label %bb5, label %bb6
|
|
|
|
bb6:
|
|
ret void
|
|
}
|
|
|
|
define void @test_i3() {
|
|
; CHECK-LABEL: define void @test_i3() {
|
|
; CHECK-NEXT: [[BB:.*:]]
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
bb:
|
|
%icmp = icmp ugt i3 0, 7
|
|
br label %bb5
|
|
|
|
bb5:
|
|
%select = select i1 %icmp, i1 %icmp, i1 false
|
|
br i1 %select, label %bb5, label %bb6
|
|
|
|
bb6:
|
|
ret void
|
|
}
|