This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] improve undef/poison analysis for constant vectors
ClosedPublic

Authored by spatel on Mar 24 2020, 7:02 AM.

Details

Summary

This overlaps with D76010, but I wanted to check if I'm missing any known corner cases for poison/undef. If so, I can add tests and/or improve the LangRef to make that more obvious.

Diff Detail

Event Timeline

spatel created this revision.Mar 24 2020, 7:02 AM

As D76010's review is taking time, I'm fine with shipping this first.

llvm/lib/Analysis/ValueTracking.cpp
4633

We should check whether the constant or an element of it is not constexpr too.

spatel updated this revision to Diff 252341.Mar 24 2020, 8:58 AM
spatel marked an inline comment as done.

Patch updated:
Disallow constant expressions or constant expression elements in a vector (tests added with rG6c3c7a0).
Could we unwrap the ConstExpr by opcode similar to what we are doing for Instruction as a follow-up improvement?

Could we unwrap the ConstExpr by opcode similar to what we are doing for Instruction as a follow-up improvement?

Oh yes, I agree it will be great.

llvm/lib/Analysis/ValueTracking.cpp
4633

Just realized that struct values can be given to freeze operation as well, sorry. Fully implementing this will require recursive call of this function.
What about covering ConstantDataVector first? The case which raised https://reviews.llvm.org/D76483 's regression was related with constant vector only.

spatel updated this revision to Diff 252361.Mar 24 2020, 10:07 AM
spatel retitled this revision from [ValueTracking] improve undef/poison analysis for constants to [ValueTracking] improve undef/poison analysis for constant vectors.

Patch updated:
Just whitelist vector constants in this patch.

aqjune accepted this revision.Mar 24 2020, 10:13 AM

Thank you. I'll update the relevant part at D76010.

This revision is now accepted and ready to land.Mar 24 2020, 10:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2020, 10:44 AM