diff options
author | Nikita Popov <npopov@redhat.com> | 2024-06-20 08:59:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 08:59:29 +0200 |
commit | 76d3ab2cc33336c1eece6484c9a55577eac7e79a (patch) | |
tree | 86deabd1829435f46a787d9f76773791fcad282e /llvm/lib/IR/Constants.cpp | |
parent | 930dd3fd873c91556b878444d57b1d12651b266f (diff) | |
download | llvm-76d3ab2cc33336c1eece6484c9a55577eac7e79a.zip llvm-76d3ab2cc33336c1eece6484c9a55577eac7e79a.tar.gz llvm-76d3ab2cc33336c1eece6484c9a55577eac7e79a.tar.bz2 |
[IR] Remove support for shl constant expressions (#96037)
Remove support for shl constant expressions, as part of:
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index fed3670..bc91f90 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -2285,12 +2285,6 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2, assert(C1->getType()->isIntOrIntVectorTy() && "Tried to create a logical operation on a non-integral type!"); break; - case Instruction::Shl: - case Instruction::LShr: - case Instruction::AShr: - assert(C1->getType()->isIntOrIntVectorTy() && - "Tried to create a shift operation on a non-integer type!"); - break; default: break; } @@ -2351,11 +2345,11 @@ bool ConstantExpr::isSupportedBinOp(unsigned Opcode) { case Instruction::Or: case Instruction::LShr: case Instruction::AShr: + case Instruction::Shl: return false; case Instruction::Add: case Instruction::Sub: case Instruction::Mul: - case Instruction::Shl: case Instruction::Xor: return true; default: @@ -2589,13 +2583,6 @@ Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) { return get(Instruction::Xor, C1, C2); } -Constant *ConstantExpr::getShl(Constant *C1, Constant *C2, - bool HasNUW, bool HasNSW) { - unsigned Flags = (HasNUW ? OverflowingBinaryOperator::NoUnsignedWrap : 0) | - (HasNSW ? OverflowingBinaryOperator::NoSignedWrap : 0); - return get(Instruction::Shl, C1, C2, Flags); -} - Constant *ConstantExpr::getExactLogBase2(Constant *C) { Type *Ty = C->getType(); const APInt *IVal; |