aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-07-18 11:35:03 +0200
committerNikita Popov <npopov@redhat.com>2023-07-18 11:35:03 +0200
commite65cabbbb577c8e5a93227d071e325c0d248df4c (patch)
treea3346f80bce4342afcaed004b1081f4710127f49 /llvm/lib
parent6f653d91ed66b1d6ebc5033968de8d012049f418 (diff)
downloadllvm-e65cabbbb577c8e5a93227d071e325c0d248df4c.zip
llvm-e65cabbbb577c8e5a93227d071e325c0d248df4c.tar.gz
llvm-e65cabbbb577c8e5a93227d071e325c0d248df4c.tar.bz2
[ConstantFolding] Remove some typed pointer handling (NFC)
No need to insert a bitcast.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 432be1e..514d449 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1001,18 +1001,8 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
}
// Create a GEP.
- Constant *C = ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs,
- InBounds, InRangeIndex);
- assert(
- cast<PointerType>(C->getType())->isOpaqueOrPointeeTypeMatches(ElemTy) &&
- "Computed GetElementPtr has unexpected type!");
-
- // If we ended up indexing a member with a type that doesn't match
- // the type of what the original indices indexed, add a cast.
- if (C->getType() != ResTy)
- C = FoldBitCast(C, ResTy, DL);
-
- return C;
+ return ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, InBounds,
+ InRangeIndex);
}
/// Attempt to constant fold an instruction with the