This is an archive of the discontinued LLVM Phabricator instance.

Return Undef from isBytewiseValue for empty arrays or structs
ClosedPublic

Authored by vitalybuka on Jul 1 2019, 6:06 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

vitalybuka created this revision.Jul 1 2019, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2019, 6:06 PM
efriedma added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
3187 ↗(On Diff #207449)

Does this work recursively? For example, [5 x [0 x i32]]. It might be easier to just check the size of the type.

Actually, we should probably constant-fold [0 x i8] zeroinitializer etc., to [0 x i8] undef, since there isn't any actual data anyway. That would make this check unnecessary.

vitalybuka updated this revision to Diff 207664.Jul 2 2019, 5:15 PM

Use size instead of getNumElements

vitalybuka marked 2 inline comments as done.Jul 2 2019, 5:21 PM
vitalybuka added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
3187 ↗(On Diff #207449)

Yep, recursive did not work and size looks simpler.

This is not a lot of code, so LGTM, but I agree that constant folding would be even better.

This revision is now accepted and ready to land.Jul 11 2019, 4:38 PM
This revision was automatically updated to reflect the committed changes.
vitalybuka marked an inline comment as done.