[llvm] [StackSafetyAnalysis] Don't call getTruncateOrZeroExtend for pointers of different sizes (PR #79804)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 03:38:23 PST 2024


================
@@ -273,6 +273,14 @@ ConstantRange StackSafetyLocalAnalysis::offsetFrom(Value *Addr, Value *Base) {
     return UnknownRange;
 
   auto *PtrTy = PointerType::getUnqual(SE.getContext());
+
+  // FIXME: Pass does not deal with pointers from different address spaces that
+  // don't have the same size.
+  if (DL.getTypeSizeInBits(Addr->getType()) != PointerSize ||
----------------
Pierre-vh wrote:

This pass works fine for same size AS I think, because `getTruncateOrZeroExtend` will not try to do anything as it just checks the type size and not the types themselves.

I guess the easiest thing then is to just reject any AS != 0 explicitly 

https://github.com/llvm/llvm-project/pull/79804


More information about the llvm-commits mailing list