ConstantFold - ConstantFoldSelectInstruction - assume constant vector elements are constant. NFCI.

Goes a bit further than rL372743 which added the early out - elements should be Constant so use cast<Constant> instead (and rely on the assert if anything fails).

llvm-svn: 373321
This commit is contained in:
Simon Pilgrim 2019-10-01 10:22:01 +00:00
parent d6d5eddcdb
commit d71315f2ae
1 changed files with 1 additions and 2 deletions

View File

@ -746,8 +746,7 @@ Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond,
ConstantInt::get(Ty, i));
Constant *V2Element = ConstantExpr::getExtractElement(V2,
ConstantInt::get(Ty, i));
Constant *Cond = dyn_cast<Constant>(CondV->getOperand(i));
if (!Cond) break;
auto *Cond = cast<Constant>(CondV->getOperand(i));
if (V1Element == V2Element) {
V = V1Element;
} else if (isa<UndefValue>(Cond)) {