From: Simon Pilgrim Date: Tue, 1 Oct 2019 10:22:01 +0000 (+0000) Subject: ConstantFold - ConstantFoldSelectInstruction - assume constant vector elements are... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d71315f2ae8a14ca4b55f316ab00faf56c4f6208;p=platform%2Fupstream%2Fllvm.git 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 instead (and rely on the assert if anything fails). llvm-svn: 373321 --- diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index ee0ad32..54814bb 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -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(CondV->getOperand(i)); - if (!Cond) break; + auto *Cond = cast(CondV->getOperand(i)); if (V1Element == V2Element) { V = V1Element; } else if (isa(Cond)) {