Details
- Reviewers
• tstellarAMD jlebar
Diff Detail
Event Timeline
lib/Transforms/Scalar/InferAddressSpaces.cpp | ||
---|---|---|
570 | Instead of "handle updating uses", can we just say "Updates uses"? | |
573 | How about we call this updateMemIntrinsicUse, or updateIfIsMemIntrinsic? We can add other stuff to other functions. | |
574 | The nesting here, and particularly the llvm_unreachable after the else below, is pretty hard for me to read. Could we restructure the control flow as auto *MI = dyn_cast<MemIntrinsic>(&U); if (!MI || MI->isVolatile()) return false; ... ? | |
584 | auto* with dyn_cast, here and elsewhere? | |
587 | Would you mind adding /*foo=*/false here and below? See my now five-year-old screed, http://jlebar.com/2011/12/16/Boolean_parameters_to_API_functions_considered_harmful..html | |
589 | Nit: self-to-self | |
679 | It's not just intrinsic users, right? Regular Instructions could have the same problem? How would you feel if we restructured this to be Use &U = *I; ++I; while (I != E && I->getUser() == CurUser) ++I; if (updateSimplePtrUse(U) || updateMemIntrinsicUse(U)) continue; ... This seems to be a consistent level of abstraction, instead of having one function which does an update and the other which just does a check and leaves the update to the caller. And it's also obvious how to extend this code to handle other cases -- just add a new updateFoo function to the if statement. |
lib/Transforms/Scalar/InferAddressSpaces.cpp | ||
---|---|---|
679 | My definition of "SimplePtrUse" was that it has a single pointer operand that can be trivially replaced, so this was specifically avoiding that problem and treating multi users as the complex case. My patches for icmp/select have that problem, and they are handled separately from updateSimplePtrUse |
lib/Transforms/Scalar/InferAddressSpaces.cpp | ||
---|---|---|
679 | I understand, but there's no harm in running the loop even in this case, right? It just seems to me much simpler conceptually to say:
|
lib/Transforms/Scalar/InferAddressSpaces.cpp | ||
---|---|---|
587 | Missed a spot, got the other 2 |
lib/Transforms/Scalar/InferAddressSpaces.cpp | ||
---|---|---|
669 | I've moved the comment out of skipToNextUser onto the call site |
lib/Transforms/Scalar/InferAddressSpaces.cpp | ||
---|---|---|
616 | s/E/End/? Otherwise, I like the way you've decomposed it here. |
Instead of "handle updating uses", can we just say "Updates uses"?