This is an archive of the discontinued LLVM Phabricator instance.

[TypePromotion] Replace Zext to Truncate for the case src bitwidth is larger
ClosedPublic

Authored by bcl5980 on Nov 7 2022, 11:21 PM.

Diff Detail

Event Timeline

bcl5980 created this revision.Nov 7 2022, 11:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 11:21 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
bcl5980 requested review of this revision.Nov 7 2022, 11:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 11:21 PM
samtebbs added inline comments.Nov 8 2022, 2:43 AM
llvm/lib/CodeGen/TypePromotion.cpp
582

Small nit: "need replace to" to "need to be replaced with"

llvm/test/Transforms/TypePromotion/AArch64/pr58843.ll
2

Since this is a midend change I think a target-agnostic test would be better.

bcl5980 added inline comments.Nov 8 2022, 4:56 AM
llvm/test/Transforms/TypePromotion/AArch64/pr58843.ll
2

This pass need some target-dependent informations like RegisterBitWidth, TLI->getTypeAction(*Ctx, SrcVT).
And the crash can't be reproduced on x86_64 and riscv64. So a target-agnostic test is a little tricky here I think.

bcl5980 edited the summary of this revision. (Show Details)Nov 8 2022, 4:57 AM
samtebbs added inline comments.Nov 8 2022, 5:54 AM
llvm/test/Transforms/TypePromotion/AArch64/pr58843.ll
2

OK that makes sense, I'm happy with this change with the two other minor changes suggested.

5

It looks like other tests in this directory remove this line and instead add -mtriple=aarch64 to the RUN line.

bcl5980 updated this revision to Diff 473986.Nov 8 2022, 6:27 AM

address comments.

samtebbs accepted this revision.Nov 8 2022, 6:31 AM

Nice one, LGTM.

This revision is now accepted and ready to land.Nov 8 2022, 6:31 AM