This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Fix invalid usage of VectorType::getNumElements() in InstCombine
ClosedPublic

Authored by ctetreau on Apr 30 2020, 12:54 PM.

Details

Summary

Make foldVectorBinop return null if the instruction type is a scalable
vector. It is unclear what, if any, of this function works with scalable
vectors.

Identified by test LLVM.Transforms/InstCombine::nsw.ll

Diff Detail

Event Timeline

ctetreau created this revision.Apr 30 2020, 12:54 PM
Herald added a project: Restricted Project. · View Herald Transcript
ctetreau marked an inline comment as done.Apr 30 2020, 12:55 PM
ctetreau added inline comments.
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
1438–1441

the reasoning for the change to getElementCount is to ensure that the LHS and RHS are the same sort of vector as the Inst vector. (i.e., not scalable)

This revision is now accepted and ready to land.Apr 30 2020, 1:09 PM
This revision was automatically updated to reflect the committed changes.