[X86] Don't zero out %eax if both %al and %ah are used
authorBill Wendling <morbo@google.com>
Tue, 13 Dec 2022 23:06:29 +0000 (15:06 -0800)
committerBill Wendling <morbo@google.com>
Tue, 13 Dec 2022 23:06:53 +0000 (15:06 -0800)
commit14d4cddc5506fb0fd3c4ac556b4edd970aa151eb
treeddcd63f98ed1c64138c7b0ba4a029a0b960e2585
parentb34bfc603cbf44dc6718e592fa9fcc6bfabcce39
[X86] Don't zero out %eax if both %al and %ah are used

The iterator over super and sub registers doesn't include both 8-bit
registers in its list. So if both registers are used and only one of
them is live on return, then we need to make sure that the other 8-bit
register is also marked as live and not zeroed out.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D139679
llvm/lib/CodeGen/PrologEpilogInserter.cpp
llvm/test/CodeGen/X86/zero-call-used-regs-i386.ll [new file with mode: 0644]