Allows constant folding of such instructions when estimating user bonus.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
237 | This could perhaps be I.getNumOperands() - 1 but I see no harm as is in case NumOperands == 1 (call with no parameters, operands[0] is the calledOperand). Thinking more about it I believe that's an impossible scenario since we got here (visitCallBase) becase the call must have at least one parameter, so in total at least two operands. Unless the use which brought us here is the calledOperand operand itself. Hmm, don't know. Anyhow too much thinking for such a minor detail. Ignore me. |
LGTM with comments.
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
241–243 | nit: | |
llvm/unittests/Transforms/IPO/FunctionSpecializationTest.cpp | ||
239–245 | It will be better to test the invalid case. e.g., the freeze inst may be position or undef. And the call inst may not be constant. We can test that everything is still fine. |
This could perhaps be I.getNumOperands() - 1 but I see no harm as is in case NumOperands == 1 (call with no parameters, operands[0] is the calledOperand). Thinking more about it I believe that's an impossible scenario since we got here (visitCallBase) becase the call must have at least one parameter, so in total at least two operands. Unless the use which brought us here is the calledOperand operand itself. Hmm, don't know. Anyhow too much thinking for such a minor detail. Ignore me.