This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] Do not shrink shift amount in ShrinkDemandedOp
AbandonedPublic

Authored by bcl5980 on Nov 4 2022, 9:54 PM.

Details

Summary

Shift amout is determined by TLI.getShiftAmountTy. We can't truncate it.

Diff Detail

Event Timeline

bcl5980 created this revision.Nov 4 2022, 9:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 9:54 PM
bcl5980 requested review of this revision.Nov 4 2022, 9:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 9:54 PM
bcl5980 added a comment.EditedNov 4 2022, 9:56 PM

I haven't find any real case to test it. Does anyone has suggestion for that?

This is only called for constant shift amounts. Won't LegalizeDAG fix it if DAG combine changes it after legalization? Have you seen a failure in a larger test?

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
586

amout->amount

588

This function is never called for SRL or SRA.

This is only called for constant shift amounts. Won't LegalizeDAG fix it if DAG combine changes it after legalization? Have you seen a failure in a larger test?

The motivation of this change comes from D136014. I compare two shift amount by apint trigged an assert. It happens in DAGCombiner, LegalizeDAG haven't executed yet.

bcl5980 abandoned this revision.Nov 23 2022, 6:15 PM