[PATCH] [IC] Turn non-null MD on pointer loads to range MD on integer loads.

Chandler Carruth chandlerc at gmail.com
Mon Feb 23 17:45:16 PST 2015


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:351-353
@@ -343,5 +350,5 @@
 
     case LLVMContext::MD_range:
       // FIXME: It would be nice to propagate this in some way, but the type
       // conversions make it hard.
       break;
----------------
cdavis5x wrote:
> chandlerc wrote:
> > Do you want to handle the inverse in this patch? That would then make for a nice round-trip test that we can go from pointer -> int -> pointer and preserve non-null.
> That would be nice, but I think I'd like to be conservative in this patch for now. I'll see about turning `!range` MD into `!nonnull` MD later.
> 
> Besides, this raises some questions of its own, like: if we're converting an integer load to a pointer load, and the integer load has a `!range` other than `!{iPTR 1, iPTR -1}` (but that still doesn't include 0, or whatever `ptrtoint null` is), should we then convert the `!range` to `!nonnull` MD? (I think we should, but the problem is that we lose some information there. I suspect this is part of why you held off on that. :)
This really raises a whole host of problems.

Is it even correct to translate !nonnull -> an integer range that doesn't include zero? Do we guarantee that ptrtoint always produces a zero integer for a null pointer? I don't think we do. And in practice, I don't think that is always safe.

I'm starting to think this entire endeavor is not safe, and we need to take several steps back.

http://reviews.llvm.org/D7621

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list