Three (or more) operand getelementptrs could plausibly also be handled, but handling only two-operand fits in easily with the existing BinaryOperator handling.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
---|---|---|
346–348 | Please consistently brace. | |
347–348 | Don't else after a return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return | |
351–353 | Is this clang-format'd? | |
354–355 | Brace this too. |
Update based on comments:
- Use auto when RHS is a cast
- Use cast instead of dyn_cast once we know we're dealing with GetElementPtrInst.
lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
---|---|---|
349 | I could do that, but that would make GetElementPtrInst be in essence the default case which doesn't really make sense, especially if we end up supporting other instructions here as well. |
I added the tests with current output in rL322733. Can you rebase here so we just see the diffs (please use the script at utils/update_test_checks.py to regenerate the check lines)? I think we'll be good then.
Please consistently brace.