R600/SI: Custom lower SI_IF and SI_ELSE to avoid machine verifier errors
authorTom Stellard <thomas.stellard@amd.com>
Tue, 29 Apr 2014 23:12:53 +0000 (23:12 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 29 Apr 2014 23:12:53 +0000 (23:12 +0000)
commit40e455d992c4e95ede50c7de32ac1a312a674276
tree2ff1cbdd313d1891e5639f18680cabc7e40b4ced
parent2a90e446c0e4110ba741166254c88e346799bc81
R600/SI: Custom lower SI_IF and SI_ELSE to avoid machine verifier errors

SI_IF and SI_ELSE are terminators which also produce a value.  For
these instructions ISel always inserts a COPY to move their value
to another basic block.  This COPY ends up between SI_(IF|ELSE)
and the S_BRANCH* instruction at the end of the block.

This breaks MachineBasicBlock::getFirstTerminator() and also the
machine verifier which assumes that terminators are grouped together at
the end of blocks.

To solve this we coalesce the copy away right after ISel to make sure
there are no instructions in between terminators at the end of blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207591 91177308-0d34-0410-b5e6-96231b3b80d8
27 files changed:
lib/Target/R600/SIISelLowering.cpp
lib/Target/R600/SIInstructions.td
test/CodeGen/R600/add_i64.ll
test/CodeGen/R600/address-space.ll
test/CodeGen/R600/array-ptr-calc-i64.ll
test/CodeGen/R600/call.ll
test/CodeGen/R600/extload.ll
test/CodeGen/R600/extract_vector_elt_i16.ll
test/CodeGen/R600/gep-address-space.ll
test/CodeGen/R600/insert_vector_elt_f64.ll
test/CodeGen/R600/llvm.sqrt.ll
test/CodeGen/R600/load-i1.ll
test/CodeGen/R600/local-64.ll
test/CodeGen/R600/loop-idiom.ll
test/CodeGen/R600/register-count-comments.ll
test/CodeGen/R600/schedule-vs-if-nested-loop-failure.ll
test/CodeGen/R600/setcc.ll
test/CodeGen/R600/setcc64.ll
test/CodeGen/R600/sgpr-copy-duplicate-operand.ll
test/CodeGen/R600/sgpr-copy.ll
test/CodeGen/R600/si-annotate-cf-assertion.ll
test/CodeGen/R600/store-v3i64.ll
test/CodeGen/R600/store-vector-ptrs.ll
test/CodeGen/R600/trunc-store-i1.ll
test/CodeGen/R600/uaddo.ll
test/CodeGen/R600/udivrem64.ll
test/CodeGen/R600/unaligned-load-store.ll