aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-06-04 11:35:46 +0200
committerNikita Popov <npopov@redhat.com>2024-06-04 14:08:33 +0200
commite57308b063bb2399b9524222d757609797d331fc (patch)
tree45d9062edd460a8c60bcd16a0475868714298f5d /llvm/lib/IR/Constants.cpp
parent3b020d51f1c96980b1813e5148dbbd6af91669cf (diff)
downloadllvm-e57308b063bb2399b9524222d757609797d331fc.zip
llvm-e57308b063bb2399b9524222d757609797d331fc.tar.gz
llvm-e57308b063bb2399b9524222d757609797d331fc.tar.bz2
[IR] Accept GEPNoWrapFlags in creation APIs
Add overloads of GetElementPtrInst::Create() that accept GEPNoWrapFlags, and switch the bool parameters in IRBuilder to accept it instead as well. As a sample use, switch GEP i8 canonicalization in InstCombine to preserve the original flags.
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index ecc15f0..a76be44 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -3361,11 +3361,8 @@ Instruction *ConstantExpr::getAsInstruction() const {
case Instruction::GetElementPtr: {
const auto *GO = cast<GEPOperator>(this);
- if (GO->isInBounds())
- return GetElementPtrInst::CreateInBounds(GO->getSourceElementType(),
- Ops[0], Ops.slice(1), "");
return GetElementPtrInst::Create(GO->getSourceElementType(), Ops[0],
- Ops.slice(1), "");
+ Ops.slice(1), GO->getNoWrapFlags(), "");
}
default:
assert(getNumOperands() == 2 && "Must be binary operator?");