This is an archive of the discontinued LLVM Phabricator instance.

[X86] Update LiveVariables in more cases in convertToThreeAddress
ClosedPublic

Authored by foad on Oct 24 2022, 7:05 AM.

Details

Summary

Following on from D129634, this patch fixes more X86 CodeGen test
failures with D129213 applied, which adds verification of LiveIntervals
after the TwoAddressInstruction pass runs. These failures only showed up
with LLVM_ENABLE_EXPENSIVE_CHECKS=ON which adds the equivalent of an
implicit -verify-machineinstrs on all tests.

Diff Detail

Event Timeline

foad created this revision.Oct 24 2022, 7:05 AM
foad requested review of this revision.Oct 24 2022, 7:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 7:05 AM
RKSimon accepted this revision.Oct 24 2022, 9:11 AM

LGTM

This revision is now accepted and ready to land.Oct 24 2022, 9:11 AM
yubing added a subscriber: yubing.Oct 31 2022, 12:30 AM
yubing added inline comments.
llvm/lib/Target/X86/X86InstrInfo.cpp
1699

seems it should be "NumRegOperands = 3"
the 3rd operand of VPBROADCASTDZrmk is i32mem:$src instead of a register.

foad added inline comments.Oct 31 2022, 2:25 AM
llvm/lib/Target/X86/X86InstrInfo.cpp
1699

It needs to be at least 4 for some other opcodes like:

%4:vr512 = VBLENDMPSZrmk killed %3:vk16wm, killed %2:vr512, killed %1:gr64, 1, $noreg, 0, $noreg

Is this causing a problem? If so, maybe the loop at line 1769 needs an Op.isReg() check.

yubing added inline comments.Oct 31 2022, 5:49 AM
llvm/lib/Target/X86/X86InstrInfo.cpp
1699

adding Op.isReg() check works for me!
my guilty MIR is:

%22:vr512 = VPBROADCASTDZrmk %21:vr512(tied-def 0), killed %20:vk16wm, %stack.1, 1, $noreg, 0, $noreg :: (load (s32) from %stack.1, align 64)