[llvm] 27d7b61 - [GVN][NFC] Use LoadInst::getProperties() when creating PRE load (#208605)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 19:16:38 PDT 2026
Author: Harrison Hao
Date: 2026-07-17T10:16:33+08:00
New Revision: 27d7b61322f1528cc582a62d1b74683d24cc987b
URL: https://github.com/llvm/llvm-project/commit/27d7b61322f1528cc582a62d1b74683d24cc987b
DIFF: https://github.com/llvm/llvm-project/commit/27d7b61322f1528cc582a62d1b74683d24cc987b.diff
LOG: [GVN][NFC] Use LoadInst::getProperties() when creating PRE load (#208605)
Use load's properties via getProperties() instead of individually
forwarding isVolatile(), getAlign(), getOrdering() and getSyncScopeID().
Reference: https://github.com/llvm/llvm-project/pull/206470
Added:
Modified:
llvm/lib/Transforms/Scalar/GVN.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 1b7bcb10be8f8..0f33f340149f8 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1627,10 +1627,10 @@ void GVNPass::eliminatePartiallyRedundantLoad(
BasicBlock *UnavailableBlock = AvailableLoad.first;
Value *LoadPtr = AvailableLoad.second;
- auto *NewLoad = new LoadInst(
- Load->getType(), LoadPtr, Load->getName() + ".pre", Load->isVolatile(),
- Load->getAlign(), Load->getOrdering(), Load->getSyncScopeID(),
- UnavailableBlock->getTerminator()->getIterator());
+ auto *NewLoad =
+ new LoadInst(Load->getType(), LoadPtr, Load->getName() + ".pre",
+ Load->getProperties(),
+ UnavailableBlock->getTerminator()->getIterator());
NewLoad->setDebugLoc(Load->getDebugLoc());
if (MSSAU) {
auto *NewAccess = MSSAU->createMemoryAccessInBB(
More information about the llvm-commits
mailing list