[PATCH] D54588: [llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 16 09:26:02 PST 2018


lebedev.ri added inline comments.


================
Comment at: include/llvm/IR/IRBuilder.h:2132
+    /// of the offset value) is the alignment check performed?
+    Value *PtrIntValue = nullptr;
+    /// The alignment check itself (`i1`), which is then used in the assumption.
----------------
hfinkel wrote:
> Also, it's not clear to me why you need this. A sanitizer should get the both the original pointer and the offset to give maximum information to the user. No?
> A sanitizer should get the both the original pointer and the offset

Exactly, *both*. In clang, i know the original pointer, the offset (may be 0), and the alignment.

But the alignment check is performed not on the original pointer, but on `f(pointer, offset)`,
which is in this case `(((uintptr_t)pointer) - offset)`. So if i don't capture the `PtrIntValue`
(which *is* `(((uintptr_t)pointer) - offset)`), i will need to re-calculate it elsewhere,
and ensure that both of the calculations stay in sync.

Seems best to re-use the actual existing pre-computed values.

Please see D54590 for the actual compiler-rt tests that show the actual diag output.


Repository:
  rL LLVM

https://reviews.llvm.org/D54588





More information about the llvm-commits mailing list