Add validation of clobber accesses as expensive check.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks for this!
lib/Analysis/MemorySSA.cpp | ||
---|---|---|
456 ↗ | (On Diff #162756) | LLVM_ATTRIBUTE_UNUSED is probably unneeded; we have a member function that calls this regardless of whether NDEBUG/EXPENSIVE_CHECKS are on |
463 ↗ | (On Diff #162756) | Is it reasonable to not involve the walker here at all? :) I ask because, if EXPENSIVE_CHECKS are on, the walker should already be calling checkClobberSanity on everything it hands back. So I think the only coverage we need out of this "we have these accesses that report isOptimized() == true. Let's make sure that the optimization is valid." (which it might have been originally, but then the IR+MemorySSA were changed and now it's not) |
1710 ↗ | (On Diff #162756) | This appears unused? |
1716 ↗ | (On Diff #162756) | It seems a bit awkward that we're casting this to a MUD, then extracting the instruction, then looking the MUD back up, then casting it to a MUD (in checkClobberSanityInstruction). Since this is the only user of checkClobberSanityInstruction, would it make sense to manually inline it in this function and simplify a bit? |
lib/Analysis/MemorySSA.cpp | ||
---|---|---|
1710 ↗ | (On Diff #162756) | I was using this locally in a unittest, but it doesn't make sense to have unittests assert, so removing it. |
lib/Analysis/MemorySSA.cpp | ||
---|---|---|
1705 ↗ | (On Diff #162960) | Nit: keep the const up until upward_defs_begin and const_cast there? |
LGTM after the requested nit. Thanks again!
lib/Analysis/MemorySSA.cpp | ||
---|---|---|
1705 ↗ | (On Diff #162960) |
Yes, please. Also please add a FIXME or note that, given infinite free time, we should probably refactor to make upward_defs_iterator respect constness... It's a slightly larger change, but it pushes this const_cast as close to the point of "here's where this isn't annotated with const but logically is" as we can easily get it, which makes the safety of the const_cast a bit easier to reason about IMO (and keeps the API a bit cleaner). |