diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-01 10:22:01 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-01 10:22:01 +0000 |
| commit | d71315f2ae8a14ca4b55f316ab00faf56c4f6208 (patch) | |
| tree | df816ea81faf0c8f473274a16a4d83336c94b1bb /llvm/lib | |
| parent | d6d5eddcdba75cdfbbf32135ef61b6aaef14bb99 (diff) | |
| download | bcm5719-llvm-d71315f2ae8a14ca4b55f316ab00faf56c4f6208.tar.gz bcm5719-llvm-d71315f2ae8a14ca4b55f316ab00faf56c4f6208.zip | |
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
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index ee0ad322f4e..54814bbdaf3 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<Constant>(CondV->getOperand(i)); - if (!Cond) break; + auto *Cond = cast<Constant>(CondV->getOperand(i)); if (V1Element == V2Element) { V = V1Element; } else if (isa<UndefValue>(Cond)) { |

