C.f. https://bugs.llvm.org/show_bug.cgi?id=47765
Added a case for handling the sign-extend (Shl+AShr) for multiple uses, to optimize it away for an individual use, when the demanded bits aren't affected by sign-extend.
Differential D91343
[InstCombine] Optimize away the unnecessary multi-use sign-extend Bhramar.vatsa on Nov 12 2020, 6:06 AM. Authored by
Details C.f. https://bugs.llvm.org/show_bug.cgi?id=47765 Added a case for handling the sign-extend (Shl+AShr) for multiple uses, to optimize it away for an individual use, when the demanded bits aren't affected by sign-extend.
Diff Detail Event TimelineComment Actions vector tests?
Comment Actions Can the test cases be simplified? I'm not sure you need the multiple blocks to just check for multiuse? Comment Actions Note that I posted an alternate version at D91364 and added tests for it. Unless I missed some corner case covered by these tests, they should not be needed now. Comment Actions LGTM
Comment Actions Please do say if you need help landing this (state the name e@ma.il to be used for the git commit's Author field).
Comment Actions Added the missing computation of Known bits for the case Instruction::AShr. This should result in no change of functionality except when intended. Thanks @lebedev.ri , please help in landing this. Please use Name: Bhramar Vatsa, e-mail : Bhramar.Vatsa@synopsys.com
Comment Actions Apologies for wrong patch (repeat of previous). I have now put up the latest patch. Please review and accept. Comment Actions This appears to cause the following crash: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32759 It would be great if you could take a look. Reproducer test case linked on the page is https://oss-fuzz.com/download?testcase_id=5658887807172608 , crashes when running opt -instcombine
|
s/if the demanded bits are already within original operand/if we do not demand any of the new sign bits/