[PATCH] D158527: [InstCombine] Add a cl::opt to control calls to getOrEnforceKnownAlignment in LoadInst and StoreInst
Dhruv Chawla via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 23:42:42 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0104f37f1626: [InstCombine] Use a cl::opt to control calls to getOrEnforceKnownAlignment in… (authored by 0xdc03).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158527/new/
https://reviews.llvm.org/D158527
Files:
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
Index: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -36,6 +36,8 @@
cl::desc("Maximum users to visit in copy from constant transform"),
cl::Hidden);
+extern cl::opt<bool> EnableInferAlignmentPass;
+
/// isOnlyCopiedFromConstantMemory - Recursively walk the uses of a (derived)
/// pointer to an alloca. Ignore any reads of the pointer, return false if we
/// see any stores or other unknown uses. If we see pointer arithmetic, keep
@@ -1048,11 +1050,13 @@
if (Instruction *Res = combineLoadToOperationType(*this, LI))
return Res;
- // Attempt to improve the alignment.
- Align KnownAlign = getOrEnforceKnownAlignment(
- Op, DL.getPrefTypeAlign(LI.getType()), DL, &LI, &AC, &DT);
- if (KnownAlign > LI.getAlign())
- LI.setAlignment(KnownAlign);
+ if (!EnableInferAlignmentPass) {
+ // Attempt to improve the alignment.
+ Align KnownAlign = getOrEnforceKnownAlignment(
+ Op, DL.getPrefTypeAlign(LI.getType()), DL, &LI, &AC, &DT);
+ if (KnownAlign > LI.getAlign())
+ LI.setAlignment(KnownAlign);
+ }
// Replace GEP indices if possible.
if (Instruction *NewGEPI = replaceGEPIdxWithZero(*this, Op, LI))
@@ -1445,11 +1449,13 @@
if (combineStoreToValueType(*this, SI))
return eraseInstFromFunction(SI);
- // Attempt to improve the alignment.
- const Align KnownAlign = getOrEnforceKnownAlignment(
- Ptr, DL.getPrefTypeAlign(Val->getType()), DL, &SI, &AC, &DT);
- if (KnownAlign > SI.getAlign())
- SI.setAlignment(KnownAlign);
+ if (!EnableInferAlignmentPass) {
+ // Attempt to improve the alignment.
+ const Align KnownAlign = getOrEnforceKnownAlignment(
+ Ptr, DL.getPrefTypeAlign(Val->getType()), DL, &SI, &AC, &DT);
+ if (KnownAlign > SI.getAlign())
+ SI.setAlignment(KnownAlign);
+ }
// Try to canonicalize the stored type.
if (unpackStoreToAggregate(*this, SI))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158527.557094.patch
Type: text/x-patch
Size: 2103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230920/49ccd43f/attachment.bin>
More information about the llvm-commits
mailing list