[GlobalISel] Add a combine for sext_inreg(load x), c --> sextload x
authorAmara Emerson <amara@apple.com>
Fri, 14 Aug 2020 09:00:07 +0000 (02:00 -0700)
committerAmara Emerson <amara@apple.com>
Tue, 18 Aug 2020 17:42:15 +0000 (10:42 -0700)
commit04a6ea5d77e7613a5e1398ddf2a0fcb4e1cea41c
tree3ec1ed1bcc7a493ccf381e1c94f8e7d2f1872ca0
parent40e269ea6db9c755c27e2ee1e201a640ac085afd
[GlobalISel] Add a combine for sext_inreg(load x), c --> sextload x

This is restricted to single use loads, which if we fold to sextloads we can
find more optimal addressing modes on AArch64.

This also fixes an overload the MachineFunction::getMachineMemOperand() method
which was incorrectly using the MF alignment instead of the MMO alignment.

Differential Revision: https://reviews.llvm.org/D85966
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-sextload-from-sextinreg.mir [new file with mode: 0644]