I've added another test to the non-array-vtable file, I hope that's the correct place.
Details
Diff Detail
Event Timeline
lib/Transforms/IPO/WholeProgramDevirt.cpp | ||
---|---|---|
427–433 | All this code could be factored out into a separate function. | |
434 | I think you also want to check that SL->getElementOffset(Op) == GlobalSlotOffset. Please add negative tests for that case and the out-of-bounds case you have above. | |
test/Transforms/WholeProgramDevirt/non-array-vtable.ll | ||
44 | Please put your test in a separate file and rename this to something like non-aggregate-vtable.ll. |
lib/Transforms/IPO/WholeProgramDevirt.cpp | ||
---|---|---|
434 | I haven't been able to come up with a way to access the table mid-element via a GEP but have added the check anyway. |
lib/Transforms/IPO/WholeProgramDevirt.cpp | ||
---|---|---|
434 | See e.g. the unaligned test in bad-read-from-vtable.ll. |
lib/Transforms/IPO/WholeProgramDevirt.cpp | ||
---|---|---|
386 | Could be simpler to return a const Constant * from this function. | |
428–431 | These two could be folded into the only use (after applying my suggestion above). | |
test/Transforms/WholeProgramDevirt/non-array-vtable.ll | ||
1 | struct-vtable.ll would be a better name for this test. |
lib/Transforms/IPO/WholeProgramDevirt.cpp | ||
---|---|---|
386 | I suppose you meant const Value * since that's what getOperand returns. |
LGTM with nit
lib/Transforms/IPO/WholeProgramDevirt.cpp | ||
---|---|---|
386 | getOperand on a constant will only ever return a constant; you could cast it below. |
It doesn't look like you have commit access, so I committed in r289162. I had to remove some of the const qualification to make it compile.
Could be simpler to return a const Constant * from this function.