| # RUN: llc -mtriple=x86_64-- -run-pass=peephole-opt -o - %s | FileCheck %s | |
| # A compare whose source is an undef register with no def must not crash the | |
| # compare-optimization while it looks for an earlier flags-defining instruction | |
| # to reuse. | |
| --- | |
| name: undef_cmp | |
| tracksRegLiveness: true | |
| body: | | |
| bb.0: | |
| ; CHECK-LABEL: name: undef_cmp | |
| ; CHECK: TEST32rr undef %{{[0-9]+}}:gr32, undef %{{[0-9]+}}:gr32, implicit-def $eflags | |
| successors: %bb.1, %bb.2 | |
| TEST32rr undef %0:gr32, undef %0:gr32, implicit-def $eflags | |
| JCC_1 %bb.1, 4, implicit $eflags | |
| JMP_1 %bb.2 | |
| bb.1: | |
| RET64 | |
| bb.2: | |
| RET64 | |
| ... |