This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Fold a chain of two G_PTR_ADDs of constant offsets.
ClosedPublic

Authored by aemerson on Jan 7 2020, 11:01 AM.

Details

Summary

E.g.

%addr1 = G_PTR_ADD %base, G_CONSTANT 20
%addr2 = G_PTR_ADD %addr1, G_CONSTANT 8
    -->
%addr2 = G_PTR_ADD %base, G_CONSTANT 28

Diff Detail

Event Timeline

aemerson created this revision.Jan 7 2020, 11:01 AM
paquette added inline comments.Jan 7 2020, 11:35 AM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
1356

Why not getConstantVRegValWithLookThrough?

1366

Why not getConstantVRegValWithLookThrough?

aemerson updated this revision to Diff 236656.Jan 7 2020, 11:51 AM

Use getConstantVRegValWithLookThrough.

This revision is now accepted and ready to land.Jan 7 2020, 11:52 AM
arsenm added a subscriber: arsenm.Jan 7 2020, 12:11 PM
arsenm added inline comments.
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-ptradd-chain.mir
27

Could use a case that uses the look through, and one with a second pair to fold

aemerson marked 2 inline comments as done.Jan 7 2020, 12:21 PM
aemerson added inline comments.
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-ptradd-chain.mir
27

Ok, will add those tests when I commit.

This revision was automatically updated to reflect the committed changes.
aemerson marked an inline comment as done.