diff options
author | Nikita Popov <npopov@redhat.com> | 2023-03-06 10:46:22 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-03-16 10:32:08 +0100 |
commit | bbfb13a5ffbccf1759ca6b75262a3ffdbe20496e (patch) | |
tree | 7b86a9e7b80e0b6684cd784606065d471f85c471 /llvm/lib/IR/Constants.cpp | |
parent | b293c6280d06f49c5ca7290855911341ab0bdffa (diff) | |
download | llvm-bbfb13a5ffbccf1759ca6b75262a3ffdbe20496e.zip llvm-bbfb13a5ffbccf1759ca6b75262a3ffdbe20496e.tar.gz llvm-bbfb13a5ffbccf1759ca6b75262a3ffdbe20496e.tar.bz2 |
[ConstExpr] Remove select constant expression
This removes the select constant expression, as part of
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
Uses of this expressions have already been removed in advance,
so this just removes related infrastructure and updates tests.
Differential Revision: https://reviews.llvm.org/D145382
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 9348d1a..51ad3a12 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -547,8 +547,6 @@ void llvm::deleteConstant(Constant *C) { delete static_cast<CastConstantExpr *>(C); else if (isa<BinaryConstantExpr>(C)) delete static_cast<BinaryConstantExpr *>(C); - else if (isa<SelectConstantExpr>(C)) - delete static_cast<SelectConstantExpr *>(C); else if (isa<ExtractElementConstantExpr>(C)) delete static_cast<ExtractElementConstantExpr *>(C); else if (isa<InsertElementConstantExpr>(C)) @@ -1488,8 +1486,6 @@ Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, case Instruction::BitCast: case Instruction::AddrSpaceCast: return ConstantExpr::getCast(getOpcode(), Ops[0], Ty, OnlyIfReduced); - case Instruction::Select: - return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2], OnlyIfReducedTy); case Instruction::InsertElement: return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2], OnlyIfReducedTy); @@ -2441,23 +2437,6 @@ Constant *ConstantExpr::getCompare(unsigned short Predicate, Constant *C1, } } -Constant *ConstantExpr::getSelect(Constant *C, Constant *V1, Constant *V2, - Type *OnlyIfReducedTy) { - assert(!SelectInst::areInvalidOperands(C, V1, V2)&&"Invalid select operands"); - - if (Constant *SC = ConstantFoldSelectInstruction(C, V1, V2)) - return SC; // Fold common cases - - if (OnlyIfReducedTy == V1->getType()) - return nullptr; - - Constant *ArgVec[] = { C, V1, V2 }; - ConstantExprKeyType Key(Instruction::Select, ArgVec); - - LLVMContextImpl *pImpl = C->getContext().pImpl; - return pImpl->ExprConstants.getOrCreate(V1->getType(), Key); -} - Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, ArrayRef<Value *> Idxs, bool InBounds, std::optional<unsigned> InRangeIndex, @@ -3439,8 +3418,6 @@ Instruction *ConstantExpr::getAsInstruction(Instruction *InsertBefore) const { case Instruction::AddrSpaceCast: return CastInst::Create((Instruction::CastOps)getOpcode(), Ops[0], getType(), "", InsertBefore); - case Instruction::Select: - return SelectInst::Create(Ops[0], Ops[1], Ops[2], "", InsertBefore); case Instruction::InsertElement: return InsertElementInst::Create(Ops[0], Ops[1], Ops[2], "", InsertBefore); case Instruction::ExtractElement: |