aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/ExpandMemCmp.cpp
diff options
context:
space:
mode:
authorYoungsuk Kim <youngsuk.kim@hpe.com>2023-06-23 21:52:43 -0400
committerJOE1994 <joseph942010@gmail.com>2023-06-23 22:32:29 -0400
commitd22a236ae72157fa0309d98ca244f387d66f3532 (patch)
tree99fd20bfea28296b6e0e0d7f9201395213b189f2 /llvm/lib/CodeGen/ExpandMemCmp.cpp
parent91ae1f5d08d98daae2122b0ab3779b8e1603a045 (diff)
downloadllvm-d22a236ae72157fa0309d98ca244f387d66f3532.zip
llvm-d22a236ae72157fa0309d98ca244f387d66f3532.tar.gz
llvm-d22a236ae72157fa0309d98ca244f387d66f3532.tar.bz2
[llvm] Replace use of Type::getPointerTo() (NFC)
Partial progress towards replacing in-tree uses of `Type::getPointerTo()`. If `getPointerTo()` is used solely to support an unnecessary bitcast, remove the bitcast. Reviewed By: barannikov88, nikic Differential Revision: https://reviews.llvm.org/D153307
Diffstat (limited to 'llvm/lib/CodeGen/ExpandMemCmp.cpp')
-rw-r--r--llvm/lib/CodeGen/ExpandMemCmp.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/ExpandMemCmp.cpp b/llvm/lib/CodeGen/ExpandMemCmp.cpp
index 6ebcc4f..500f31b 100644
--- a/llvm/lib/CodeGen/ExpandMemCmp.cpp
+++ b/llvm/lib/CodeGen/ExpandMemCmp.cpp
@@ -288,17 +288,11 @@ MemCmpExpansion::LoadPair MemCmpExpansion::getLoadPair(Type *LoadSizeType,
Align RhsAlign = RhsSource->getPointerAlignment(DL);
if (OffsetBytes > 0) {
auto *ByteType = Type::getInt8Ty(CI->getContext());
- LhsSource = Builder.CreateConstGEP1_64(
- ByteType, Builder.CreateBitCast(LhsSource, ByteType->getPointerTo()),
- OffsetBytes);
- RhsSource = Builder.CreateConstGEP1_64(
- ByteType, Builder.CreateBitCast(RhsSource, ByteType->getPointerTo()),
- OffsetBytes);
+ LhsSource = Builder.CreateConstGEP1_64(ByteType, LhsSource, OffsetBytes);
+ RhsSource = Builder.CreateConstGEP1_64(ByteType, RhsSource, OffsetBytes);
LhsAlign = commonAlignment(LhsAlign, OffsetBytes);
RhsAlign = commonAlignment(RhsAlign, OffsetBytes);
}
- LhsSource = Builder.CreateBitCast(LhsSource, LoadSizeType->getPointerTo());
- RhsSource = Builder.CreateBitCast(RhsSource, LoadSizeType->getPointerTo());
// Create a constant or a load from the source.
Value *Lhs = nullptr;