[llvm] 0425ea4 - [NFC][OpaquePtr][Evaluator] Remove call to PointerType::getElementType
Senran Zhang via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 18 18:34:10 PST 2021
Author: Senran Zhang
Date: 2021-11-19T10:32:55+08:00
New Revision: 0425ea462197e605d597719f1630c68dbcc25ed8
URL: https://github.com/llvm/llvm-project/commit/0425ea462197e605d597719f1630c68dbcc25ed8
DIFF: https://github.com/llvm/llvm-project/commit/0425ea462197e605d597719f1630c68dbcc25ed8.diff
LOG: [NFC][OpaquePtr][Evaluator] Remove call to PointerType::getElementType
There are still another 2 uses of PointerType::getElementType in
Evaluator when evaluating BitCast's on pointers. BitCast's on pointers
should be removed when opaque ptr is ready, so I just keep them as is.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D114131
Added:
Modified:
llvm/lib/Transforms/Utils/Evaluator.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/Evaluator.cpp b/llvm/lib/Transforms/Utils/Evaluator.cpp
index 766de8a96702..9c8aed94708e 100644
--- a/llvm/lib/Transforms/Utils/Evaluator.cpp
+++ b/llvm/lib/Transforms/Utils/Evaluator.cpp
@@ -128,11 +128,6 @@ isSimpleEnoughValueToCommit(Constant *C,
/// globals and GEP's of globals. This should be kept up to date with
/// CommitValueTo.
static bool isSimpleEnoughPointerToCommit(Constant *C, const DataLayout &DL) {
- // Conservatively, avoid aggregate types. This is because we don't
- // want to worry about them partially overlapping other stores.
- if (!cast<PointerType>(C->getType())->getElementType()->isSingleValueType())
- return false;
-
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
// Do not allow weak/*_odr/linkonce linkage or external globals.
return GV->hasUniqueInitializer();
@@ -343,7 +338,10 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst, BasicBlock *&NextBB,
Ptr = FoldedPtr;
LLVM_DEBUG(dbgs() << "; To: " << *Ptr << "\n");
}
- if (!isSimpleEnoughPointerToCommit(Ptr, DL)) {
+ // Conservatively, avoid aggregate types. This is because we don't
+ // want to worry about them partially overlapping other stores.
+ if (!SI->getValueOperand()->getType()->isSingleValueType() ||
+ !isSimpleEnoughPointerToCommit(Ptr, DL)) {
// If this is too complex for us to commit, reject it.
LLVM_DEBUG(
dbgs() << "Pointer is too complex for us to evaluate store.");
More information about the llvm-commits
mailing list