This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Fix assertion when bitcast is converted to gep
ClosedPublic

Authored by Gerolf on May 16 2016, 11:37 PM.

Details

Summary

When an aggregate contains an opaque type its size cannot be
determined. This triggers an "Invalid GetElementPtrInst indices for type" assert
in function checkGEPType. The patch suppresses the conversion in this case.

Diff Detail

Event Timeline

Gerolf updated this revision to Diff 57435.May 16 2016, 11:37 PM
Gerolf retitled this revision from to [InstCombine] Fix assertion when bitcast is converted to gep.
Gerolf updated this object.
Gerolf added a reviewer: llvm-commits.
mcrosier added a subscriber: mcrosier.

+David who owns InstCombine.

majnemer accepted this revision.May 19 2016, 9:12 AM
majnemer edited edge metadata.

LGTM

test/Transforms/InstCombine/opaque.ll
1

I'd prefer if we made this a FileCheck test even though the input should approximately be it's output. However, I don't feel particularly strongly about it.

This revision is now accepted and ready to land.May 19 2016, 9:12 AM
Gerolf added a subscriber: Gerolf.May 23 2016, 12:30 PM

Committed revision 270479

Thanks, David!