[llvm] 14dee0a - [NewGVN] Avoid AA query on non-pointers (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 06:22:02 PDT 2025


Author: Nikita Popov
Date: 2025-04-23T15:21:52+02:00
New Revision: 14dee0aeaaef2ebd5c3295edca4c5d3762464934

URL: https://github.com/llvm/llvm-project/commit/14dee0aeaaef2ebd5c3295edca4c5d3762464934
DIFF: https://github.com/llvm/llvm-project/commit/14dee0aeaaef2ebd5c3295edca4c5d3762464934.diff

LOG: [NewGVN] Avoid AA query on non-pointers (NFCI)

In order for the instruction result to alias with the pointer it
needs to be a pointer.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/NewGVN.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 58de4c0aab221..61ba3698a0340 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1533,7 +1533,7 @@ NewGVN::performSymbolicLoadCoercion(Type *LoadType, Value *LoadPtr,
   // All of the below are only true if the loaded pointer is produced
   // by the dependent instruction.
   if (LoadPtr != lookupOperandLeader(DepInst) &&
-      !AA->isMustAlias(LoadPtr, DepInst))
+      DepInst->getType()->isPointerTy() && !AA->isMustAlias(LoadPtr, DepInst))
     return nullptr;
   // If this load really doesn't depend on anything, then we must be loading an
   // undef value.  This can happen when loading for a fresh allocation with no


        


More information about the llvm-commits mailing list