This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] If sign extended values that return from calls, remove sign extended node
AbandonedPublic

Authored by liaolucy on Oct 8 2022, 6:50 AM.

Details

Reviewers
craig.topper
asb
Summary

Call = callseq_start + CALL + callseq_end

(sign_extend_inreg(CopyFromReg(callseq_end X), X10), i32) ->(CopyFromReg(callseq_end X), X10)

Diff Detail

Event Timeline

liaolucy created this revision.Oct 8 2022, 6:50 AM
liaolucy requested review of this revision.Oct 8 2022, 6:50 AM
liaolucy retitled this revision from Add isel pattern for (setne/eq (sext_inreg GPR), 0) to remove sext_inreg to [RISCV] Add isel pattern for (setne/eq (sext_inreg GPR), 0) to remove sext_inreg.Oct 8 2022, 6:51 AM

This isn’t correct. For example if rs is 0x8000000000000000, it’s not 0. But sext_inreg of 0x8000000000000000 is 0.

craig.topper requested changes to this revision.Oct 8 2022, 10:08 AM
This revision now requires changes to proceed.Oct 8 2022, 10:08 AM
liaolucy updated this revision to Diff 468403.Oct 17 2022, 8:36 PM

refactor. If sign extended values that return from calls, remove sign extended node.

liaolucy retitled this revision from [RISCV] Add isel pattern for (setne/eq (sext_inreg GPR), 0) to remove sext_inreg to [RISCV] If sign extended values that return from calls, remove sign extended node.Oct 17 2022, 8:36 PM
liaolucy edited the summary of this revision. (Show Details)
liaolucy added inline comments.
llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
331

I do not know how to teach the pass.

craig.topper added inline comments.Oct 17 2022, 8:49 PM
llvm/test/CodeGen/RISCV/libcall-tail-calls.ll
89

This isn't a valid transform. __muldi3 returns a full 64-bit value. The sign extend is not removable.

craig.topper requested changes to this revision.Oct 17 2022, 8:55 PM
This revision now requires changes to proceed.Oct 17 2022, 8:55 PM
liaolucy abandoned this revision.Wed, Nov 22, 1:25 AM