[PATCH] D114131: [NFC][OpaquePtr][Evaluator] Remove PointerType::getElementType

Senran Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 18 18:34:20 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0425ea462197: [NFC][OpaquePtr][Evaluator] Remove call to PointerType::getElementType (authored by zsrkmyn).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114131/new/

https://reviews.llvm.org/D114131

Files:
  llvm/lib/Transforms/Utils/Evaluator.cpp


Index: llvm/lib/Transforms/Utils/Evaluator.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Evaluator.cpp
+++ llvm/lib/Transforms/Utils/Evaluator.cpp
@@ -128,11 +128,6 @@
 /// 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 @@
         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.");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114131.388361.patch
Type: text/x-patch
Size: 1397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211119/78026468/attachment.bin>


More information about the llvm-commits mailing list