[PATCH] D15597: [ValueTracking] Handle opaque types in isDereferenceableAndAlignedPointer.

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 03:38:45 PST 2015

apilipenko accepted this revision.
apilipenko added a comment.
This revision is now accepted and ready to land.

LGTM with one check converted to an assertion.

Comment at: lib/Analysis/ValueTracking.cpp:3195-3196
@@ +3194,4 @@
+  Type *Ty = Base->getType();
+  if (!Ty->isSized())
+    return false;
+  APInt Offset(DL.getTypeStoreSizeInBits(Ty), 0);
There is a difference in this check and the check in the other isAligned function. Here you check that the Base type is sized. This function should be called for pointer only. Pointers are always sized, so you just need to assert that Base is a pointer.

In the other function you check that pointer element type is sized, which is not guaranteed, so the check is required.


More information about the llvm-commits mailing list