1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/test/CodeGen/X86/branchfolding-undef.mir
Matthias Braun 140d944d08 BranchFolder: Fix invalid undef flags after merge.
It is legal to merge instructions with different undef flags; However we
must drop the undef flag from the merged instruction if it isn't present
everywhere.

This fixes http://llvm.org/PR30199

llvm-svn: 281957
2016-09-20 01:14:42 +00:00

30 lines
584 B
YAML

# RUN: llc -o - %s -march=x86 -run-pass branch-folder | FileCheck %s
# Test that tail merging drops undef flags that aren't present on all
# instructions to be merged.
--- |
define void @func() { ret void }
...
---
# CHECK-LABEL: name: func
# CHECK: bb.1:
# CHECK: %eax = MOV32ri 2
# CHECK-NOT: RET
# CHECK: bb.2:
# CHECK-NOT: RET 0, undef %eax
# CHECK: RET 0, %eax
name: func
tracksRegLiveness: true
body: |
bb.0:
successors: %bb.1, %bb.2
JE_1 %bb.1, implicit undef %eflags
JMP_1 %bb.2
bb.1:
%eax = MOV32ri 2
RET 0, %eax
bb.2:
RET 0, undef %eax
...