This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Don't transform code if DoTransform is false
ClosedPublic

Authored by Carrot on Jun 18 2021, 12:53 PM.

Details

Summary

In patch https://reviews.llvm.org/D72396, it doesn't check DoTransform before transforming the code, and generates wrong result for the attached test case.

Diff Detail

Event Timeline

Carrot created this revision.Jun 18 2021, 12:53 PM
Carrot requested review of this revision.Jun 18 2021, 12:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2021, 12:53 PM
lebedev.ri accepted this revision.Jun 18 2021, 1:04 PM

LG
I think that function is misdesigned, but i can't suggest an easy good alternative.

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
959

Please add a comment to the function explaining this weird DoTransform behaviour.

This revision is now accepted and ready to land.Jun 18 2021, 1:04 PM
Carrot updated this revision to Diff 353092.Jun 18 2021, 1:56 PM
Carrot marked an inline comment as done.

Thanks for the quick review!
Will commit this version.

This revision was landed with ongoing or failed builds.Jun 18 2021, 6:03 PM
This revision was automatically updated to reflect the committed changes.