This is an archive of the discontinued LLVM Phabricator instance.

ConstantFolding: Don't crash when encountering vector GEP
ClosedPublic

Authored by loladiro on Dec 3 2016, 9:16 PM.

Details

Summary

ConstantFolding tried to cast one of the scalar indices to a vector
type. Instead, use the vector type only for the first index (which
is the only one allowed to be a vector) and use its scalar type
otherwise.

Fixes PR31250.

Diff Detail

Repository
rL LLVM

Event Timeline

loladiro updated this revision to Diff 80197.Dec 3 2016, 9:16 PM
loladiro retitled this revision from to ConstantFolding: Don't crash when encountering vector GEP.
loladiro updated this object.
loladiro added reviewers: delena, pcc, majnemer.
loladiro added a subscriber: llvm-commits.
davide added a subscriber: davide.Dec 6 2016, 9:29 PM

This seems is fixing the same problem of https://reviews.llvm.org/D26060
Probably I like your fix better, anyway, I'm happy as long as one of the two reviews land.

majnemer accepted this revision.Dec 7 2016, 12:10 PM
majnemer edited edge metadata.

LGTM

lib/Analysis/ConstantFolding.cpp
735–736 ↗(On Diff #80197)

I believe this can be simplified to IntPtrScalarTy = IntPtrTy->getScalarType();

This revision is now accepted and ready to land.Dec 7 2016, 12:10 PM
This revision was automatically updated to reflect the committed changes.