One more attempt to fix UBSan reports: make sure DenseMapInfo::getEmptyKey()
and DenseMapInfo::getTombstoneKey() doesn't do any upcasts/downcasts to/from Value*.
Details
Diff Detail
Event Timeline
include/llvm/IR/ValueHandle.h | ||
---|---|---|
239–248 | I think you need to use DenseMapInfo<Value *> here? |
include/llvm/IR/ValueHandle.h | ||
---|---|---|
192–203 | I would define helpers here for getRawValPtr and setRawValPtr which do the indirection between NDEBUG and debug builds. Then use them below (see comments). | |
240–275 | All of these NDEBUG vs. not can go away by using helpers defined once in the class above to get the raw Value* and set the raw Value*. I also think you want to have both isEqual and getHashValue use the raw Value* and delegate to DenseMapInfo<Value *>. |
LGTM as well, thanks!!! Sorry for the circles this round around in!
include/llvm/IR/ValueHandle.h | ||
---|---|---|
240–275 | As Duncan said, I think that would be weird. I might go further and say I think using such an AssertingVH<MyValue> would be a bug. We can't both test for equality using their delegated routine *and* not use their type's pointers. I think it is reasonable to insist for simplicity that Value subclasses that want DenseMaps of AssertingVHs must be happy with DenseMapInfo<Value*> or generally DenseMapInfo<T*>. |
Thanks, submitting this now!
include/llvm/IR/ValueHandle.h | ||
---|---|---|
240–275 | Right, I agree with that, just wanted to double-check my understanding. |
I would define helpers here for getRawValPtr and setRawValPtr which do the indirection between NDEBUG and debug builds. Then use them below (see comments).