[PATCH] D40670: Let Alloca treated as nonnull for any alloca addr space value

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 12:06:41 PST 2017


yaxunl added a comment.

How about introduce nullptr value for each addr space in data layout? E.g., assume alloca addr space is 3 and nullptr value of addr space 3 is -1. alloca of addr space 3 could return 0, but never return -1.

Then this code

  if (isa<AllocaInst>(V) && Q.DL.getAllocaAddrSpace() == 0)

can be changed as

  if (isa<AllocaInst>(V) && Q.DL.getAllocaNullPointerValue() == 0)

This assumes that alloca never returns nullptr value.

Nuno, Sean, will this work for you?

Thanks.


https://reviews.llvm.org/D40670





More information about the llvm-commits mailing list