This is an archive of the discontinued LLVM Phabricator instance.

Teach computeKnownBits to use new align attribute/metadata
ClosedPublic

Authored by apilipenko on Oct 6 2015, 6:33 AM.

Details

Summary

Teach computeKnownBits to use align attribute on return values and align metadata on loads. This fixes the following bug: https://llvm.org/bugs/show_bug.cgi?id=25068

Diff Detail

Repository
rL LLVM

Event Timeline

apilipenko updated this revision to Diff 36618.Oct 6 2015, 6:33 AM
apilipenko retitled this revision from to Teach computeKnownBits to use new align attribute/metadata.
apilipenko updated this object.
apilipenko added a reviewer: reames.
apilipenko added a subscriber: llvm-commits.
reames accepted this revision.Oct 6 2015, 10:43 AM
reames edited edge metadata.

LGTM w/comments addressed and one part separated into a follow on change as noted inline.

lib/Analysis/ValueTracking.cpp
1412 ↗(On Diff #36618)

The changes to this function LGTM w/appropriate test cases.

2981 ↗(On Diff #36618)

I'm not sure the GlobalVariable code is equivalent to the other case. I would prefer you separate the refactoring to use getAlignment into a separate patch. It seems slightly higher risk.

(My concern comes from the difference between BaseAlign and Align. I haven't looked at these carefully and I'm worried that your getAlignment is computing Align not BaseAlign.)

test/Transforms/InstCombine/assume-redundant.ll
52 ↗(On Diff #36618)

Please add versions of this test for both load w/metadata and allocas.

This revision is now accepted and ready to land.Oct 6 2015, 10:43 AM
This revision was automatically updated to reflect the committed changes.