ahatanak added inline comments.

================
Comment at: clang/lib/CodeGen/CGExpr.cpp:1723
+      Addr =
+          Addr.withPointer(Builder.CreateThreadLocalAddress(GV), KnownNonNull);
 
----------------
ahatanak wrote:
> `KnownNonNull` is being passed here because the address of a load must be 
> non-null. Do we have to check that the function doesn't have 
> `null_pointer_is_valid` here?
I don't think we should pass `KnownNonNull` unless we know for sure the address 
of the global variable is non-null, which isn't always true (for example, when 
it's extern weak).

We can set `KnownNonNull` below this line if we know `NullPointerIsValid` is 
false.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142584

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to