Page MenuHomePhabricator

Return Undef from isBytewiseValue for empty arrays or structs
ClosedPublic

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

Diff Detail

Repository
rL LLVM

Event Timeline

vitalybuka created this revision.Mon, Jul 1, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Jul 1, 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.Tue, Jul 2, 5:15 PM

Use size instead of getNumElements

vitalybuka marked 2 inline comments as done.Tue, Jul 2, 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.Thu, Jul 11, 4:38 PM
This revision was automatically updated to reflect the committed changes.
vitalybuka marked an inline comment as done.