Page MenuHomePhabricator

InstCombineCast AShr transformation
AbandonedPublic

Authored by marksl on Apr 19 2017, 12:43 PM.

Details

Reviewers
majnemer
Summary

Transform:

%shr26 = lshr i32 %0, 16                        ; [#uses=1 type=i32]
%conv4 = trunc i32 %shr26 to i16                ; [#uses=1 type=i16]
%3 = sext i16 %conv4 to i32                     ; [#uses=N type=i32]

To:

%3 = ashr i32 %0, 16

Diff Detail

Repository
rL LLVM

Event Timeline

marksl created this revision.Apr 19 2017, 12:43 PM

This needs a testcase.

InstCombineCasts.cpp
1258–1262

Please use more regular register names and elide the commends.

1263

I'd recommend using m_APInt so that it will match against vectors.

1267

This will explode if the ConstantInt is bigger than an i64

marksl updated this revision to Diff 95826.Apr 19 2017, 2:54 PM
marksl updated this revision to Diff 95832.Apr 19 2017, 3:06 PM

Added test case

marksl updated this revision to Diff 95834.Apr 19 2017, 3:09 PM

Now with transform and test case.

efriedma added inline comments.Apr 19 2017, 3:20 PM
cast.ll
1443 ↗(On Diff #95834)

This testcase passes on trunk. What are you trying to fix?

marksl abandoned this revision.Apr 19 2017, 4:28 PM

This does not appear to be an issue on the trunk.