[PATCH] D23134: Make cltz and cttz zero undef when the operand cannot be zero in InstCombine
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 08:21:13 PDT 2016
spatel added a comment.
> No as we don't want to go though replacing the instruction by itself and we especially don't want to replace false by true in the program.
I don't understand the 2nd comment. For the first, I'm not suggesting that you replace the instruction by itself.
Looking around InstCombine, the common pattern I see is:
I.setOperand(1, X);
return &I;
This adheres to the 'visit' function comments:
// Visitation implementation - Implement instruction combining for different
// instruction types. The semantics are as follows:
// Return Value:
// null - No change was made
// I - Change was made, I is still valid, I may be dead though
// otherwise - Change was made, replace I with returned instruction
I think we'd have to change the helper function signature to return an Instruction* for this to work, so I'll defer to @majnemer on whether the code here is an acceptable substitute. I have no further comments for this patch.
https://reviews.llvm.org/D23134
More information about the llvm-commits
mailing list