llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

VirtRegMap.cpp should not just remove an identity copy which also has a impl-def of a super-reg

Open JonPsson opened this issue 10 years ago • 1 comments

Bugzilla Link 27156
Version trunk
OS Linux
Attachments clang input, Patch to make COPY -> IMPLICIT_DEF when needed
CC @hfinkel,@MatzeB

Extended Description

VirtRegMap removes identity copies, but that leads to machine-verifier complaints if there is a def of a super reg as well.

I am not sure what the best fix is, but the patch attached seems to fix this by transforming the COPY to an IMPLICIT_DEF when there is a def of a super-reg. The patch assumes (arbitrarily) that there could only be one extra operand - not sure if this is always true...

./bin/clang -cc1 -triple s390x-ibm-linux -S -disable-free -main-file-name expr.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu z13 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -O3 -ferror-limit 19 -fmessage-length 238 -funroll-loops -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o expr.s -x ir ./expr.bc -mllvm -verify-machineinstrs

JonPsson avatar Mar 31 '16 11:03 JonPsson

VirtRegRewriter::handleIdentityCopy replaces identity copies with implicit operands with KILL now

arsenm avatar Aug 08 '23 21:08 arsenm