This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix ldst optimization of non-immediate store offset
ClosedPublic

Authored by wwei on Sep 18 2020, 7:24 AM.

Details

Summary

When matching store instruction for ldst opt, we should make sure store instr is in 'reg+imm' form as load instr,
otherwise, it will have assertion in isLdOffsetInRangeOfSt while it will use getImm() directly.

Diff Detail

Event Timeline

wwei created this revision.Sep 18 2020, 7:24 AM
wwei requested review of this revision.Sep 18 2020, 7:24 AM
efriedma added inline comments.Sep 18 2020, 2:13 PM
llvm/test/CodeGen/AArch64/arm64-ldst-opt-match.ll
20 ↗(On Diff #292785)

This testcase seems extremely fragile; can we use an MIR testcase instead? (There are a bunch of in-tree examples of using -run-pass=aarch64-ldst-opt.)

efriedma added inline comments.Sep 18 2020, 2:18 PM
llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
1190

Also, maybe fix this comment to clarify what the problem is. The store should be an opcode that can use an immediate operand. The problem is that the "immediate" might actually be the address of a global variable.

wwei updated this revision to Diff 293379.Sep 22 2020, 1:51 AM
wwei added a comment.Sep 22 2020, 1:55 AM

Update test case by using MIR

llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
1190

fixed.

This revision is now accepted and ready to land.Sep 22 2020, 11:55 AM