Three (or more) operand getelementptrs could plausibly also be handled, but handling only two-operand fits in easily with the existing BinaryOperator handling.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
---|---|---|
346–348 ↗ | (On Diff #122652) | Please consistently brace. |
347–348 ↗ | (On Diff #122652) | Don't else after a return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return |
351–353 ↗ | (On Diff #122652) | Is this clang-format'd? |
354–355 ↗ | (On Diff #122652) | Brace this too. |
Comment Actions
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 ↗ | (On Diff #122841) | 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. |
Comment Actions
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.