[SVE] Fix invalid usage of getNumElements() in InstCombineMulDivRem
authorChristopher Tetreault <ctetreau@quicinc.com>
Tue, 5 May 2020 21:21:59 +0000 (14:21 -0700)
committerChristopher Tetreault <ctetreau@quicinc.com>
Tue, 5 May 2020 22:19:01 +0000 (15:19 -0700)
commit855e02e799b9b05babc39cba1cb121ad7ef50f57
treef3bbaec1190a367483d39e975d232d029c4c90a8
parent645ad5badbabdeca31de5c98ea8135c5a6e7d710
[SVE] Fix invalid usage of getNumElements() in InstCombineMulDivRem

Summary:
getLogBase2 tries to iterate over the number of vector elements. Since
the number of elements of a scalable vector is unknown at compile time,
we must return null if the input type is scalable.

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

Reviewers: efriedma, fpetrogalli, kmclaughlin, spatel

Reviewed By: efriedma, fpetrogalli

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79197
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/udiv-pow2-vscale.ll [new file with mode: 0644]