[PATCH] D13358: InstCombine: Fold comparisons between unguessable allocas and other pointers

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 17:54:00 PDT 2015


hans added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:780
@@ +779,3 @@
+      // Storing *to* the pointer is fine, but storing the pointer escapes it.
+      if (SI->getValueOperand() == U->get())
+        return nullptr;
----------------
majnemer wrote:
> Is this sufficient?  What if `getValueOperand` is not `U->get()` but, say, a bitcast of `U->get()` ?
I think so. Such a bitcast would show up as a use of our value, so we'd track it and see if it ends up getting stored.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:792-793
@@ +791,4 @@
+        case Intrinsic::dbg_declare: case Intrinsic::dbg_value:
+        case Intrinsic::memcpy: case Intrinsic::memmove: case Intrinsic::memset:
+          continue;
+        default:
----------------
majnemer wrote:
> Can't `memcpy` escape the value just like a `StoreInst` would?
It's not possible to memcpy the value directly. The value would have to be stored in an object, and then that could be memcpy'd. But we'd notice the value escaping through the store.


http://reviews.llvm.org/D13358





More information about the llvm-commits mailing list