[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.
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 58de4c0..61ba369 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1533,7 +1533,7 @@
// 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