This is special optimization for below situation:
bb1:
bb2: x = phi [x1, bb1], [x2, bb2] x2 = x+1; after de-ssa: bb2: mov x, x-copy add x2, x, 1 mov x-copy, x2 obviously x2, x-copy and x2 can be mapped to same virtual register.
v2: only coaleasce if the source register comes from insn def. add check "if (phiDef->empty()) continue;" to skip no-def phiDef.
6b93aea GBE: optimize phi elimination.
backend/src/llvm/llvm_gen_backend.cpp | 70 ++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 2 deletions(-)
Upstream: cgit.freedesktop.org