[llvm] b5c2a19 - [InstCombine] Remove some typed pointer handling (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 07:04:06 PDT 2023
Author: Nikita Popov
Date: 2023-08-09T16:03:57+02:00
New Revision: b5c2a19fedc2ee615d9edc9bb72c60982b128b1f
URL: https://github.com/llvm/llvm-project/commit/b5c2a19fedc2ee615d9edc9bb72c60982b128b1f
DIFF: https://github.com/llvm/llvm-project/commit/b5c2a19fedc2ee615d9edc9bb72c60982b128b1f.diff
LOG: [InstCombine] Remove some typed pointer handling (NFC)
This bitcast is no longer needed.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 3b0d957831b00f..6617a7ed5aff1c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -577,16 +577,9 @@ LoadInst *InstCombinerImpl::combineLoadToNewType(LoadInst &LI, Type *NewTy,
assert((!LI.isAtomic() || isSupportedAtomicType(NewTy)) &&
"can't fold an atomic load to requested type");
- Value *Ptr = LI.getPointerOperand();
- unsigned AS = LI.getPointerAddressSpace();
- Type *NewPtrTy = NewTy->getPointerTo(AS);
- Value *NewPtr = nullptr;
- if (!(match(Ptr, m_BitCast(m_Value(NewPtr))) &&
- NewPtr->getType() == NewPtrTy))
- NewPtr = Builder.CreateBitCast(Ptr, NewPtrTy);
-
- LoadInst *NewLoad = Builder.CreateAlignedLoad(
- NewTy, NewPtr, LI.getAlign(), LI.isVolatile(), LI.getName() + Suffix);
+ LoadInst *NewLoad =
+ Builder.CreateAlignedLoad(NewTy, LI.getPointerOperand(), LI.getAlign(),
+ LI.isVolatile(), LI.getName() + Suffix);
NewLoad->setAtomic(LI.getOrdering(), LI.getSyncScopeID());
copyMetadataForLoad(*NewLoad, LI);
return NewLoad;
More information about the llvm-commits
mailing list