aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorBjörn Pettersson <bjorn.a.pettersson@ericsson.com>2024-06-25 10:05:14 +0200
committerGitHub <noreply@github.com>2024-06-25 10:05:14 +0200
commit7f1a74429dfd62a410d4b51d2e75d3677429a51a (patch)
treecaabfca423bdb39610388ce849b7d932aac27e30 /clang/lib/CodeGen/CodeGenModule.cpp
parent01fb5290eb86f056e6ba8757011273bcb7f4f2ee (diff)
downloadllvm-7f1a74429dfd62a410d4b51d2e75d3677429a51a.zip
llvm-7f1a74429dfd62a410d4b51d2e75d3677429a51a.tar.gz
llvm-7f1a74429dfd62a410d4b51d2e75d3677429a51a.tar.bz2
[TailDup][MachineSSAUpdater] Let RewriteUse insert a COPY when needed (#95553)
When running early-tailduplication we've seen problems with machine verifier errors due to register class mismatches after doing the machine SSA updates. Typical scenario is that there is a PHI node and another instruction that is using the same vreg: %othervreg:otherclass = PHI %vreg:origclass, %bb MInstr %vreg:origclass but then after TailDuplicator::tailDuplicateAndUpdate we get %othervreg:otherclass = PHI %vreg:origclass, %bb, ... MInstr %othervreg:otherclass Such rewrites are only valid if 'otherclass' is equal to (or a subclass of) 'origclass'. The solution here is based on adding a COPY instruction to make sure we satisfy constraints given by 'MInstr' in the example. So if 'otherclass' isn't equal to (or a subclass of) 'origclass' we insert a copy after the PHI like this: %othervreg:otherclass = PHI %vreg:origclass, %bb, ... %newvreg:origclass = COPY %othervreg:otherclass MInstr %newvreg:origclass A special case is when it is possible to constrain the register class instead of inserting a COPY. We currently prefer to constrain the register class instead of inserting a COPY, even if it is a bit unclear if that always is better (considering register pressure for the constrained class etc.). Fixes: https://github.com/llvm/llvm-project/issues/62712
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions