To avoid trigger "No default SetCC type for vectors!" assertion for vector comparison.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Target/RISCV/RISCVISelLowering.h | ||
---|---|---|
54 | The LLVM Coding Standards doc isn't explicit in its guidance on doxygen comments about whether to duplicate them in subclasses. I'd generally prefer not to personally, but will ask on the mailing list for clarification on general policy. See question here. If the comment is going to stay, the current LLVM style is to avoid duplicating the function name. I also think the version of the comment in include/llvm/CodeGen/TargetLowering.h is clearer "/// Return the ValueType of the result of SETCC operations." | |
test/CodeGen/RISCV/get-setcc-result-type.ll | ||
2 | The CHECK lines don't seem to have been generated by update_llc_test_checks.py. Even though it's a little verbose, I'd recommend leaving the full check output from update_llc_test_checks.py. All other codegen tests do this, and I've found that overall the advantage of being able to trivially regenerate a test outweighs any disadvantage in terms of brittleness or verbose output. Besides, the subset of instructions currently checked in this patch aren't really enough for the casual reader to verify that the expected code is being produced. | |
6 | I tend to prefer dropping any attributes that aren't necessary for the test - in this case define void @getSetCCResultType(<4 x i32>* %p, <4 x i32>* %q) results in identical codegen. |
lib/Target/RISCV/RISCVISelLowering.h | ||
---|---|---|
54 | Remove the comments for the override function. | |
test/CodeGen/RISCV/get-setcc-result-type.ll | ||
2 | Update the test case with full context assembly output. | |
6 | Remove the attributes of test case IR. |
Hi Shiva. update_llc_test_checks.py basically generates CHECK lines for you according to the RUN lines in the file. This is a fairly minor benefit when writing a test for the first time, but the biggest benefit comes from maintaining the test. When there is a codegen change, test files that contain all instructions are much easier to review.
Previous workflow:
- Create and commit a test, manually write CHECK lines, typically picking out a subset of instructions to CHECK
- A change is later made that affects codegen. Typically you would manually inspect the previous and new output, then manually update CHECK lines
New work flow:
- Create a test, have update_llc_test_checks.py generate CHECK lines for you. Double-check they are as expected before committing
- A change is later made that affects codegen. I normally immediately use update_llc_test_checks.py to update a file, then use git diff to review the change for correctness.
- As an example, the use of update_llc_test_checks.py made it totally trivial to update all codegen tests when @niosHD introduced pseudoinstruction aliases
The risk of update_llc_test_checks.py is that by checking each instruction, tests are more brittle to codegen changes. I haven't found this to be an issue in practice, and flagging up even minor codegen differences can be an advantage. An increasing number of tests for other backends (especially x86) are moving over to doing this for the maintainability benefits.
Assuming your LLVM build dir is within your LLVM checkout (e.g. build), you can invoke update_llc_test_checks.py like: ../utils/update_llc_test_checks.py --llc-binary=./bin/llc ../test/CodeGen/RISCV/get-setcc-result-type.ll.
This looks good to commit to me, once the two trivial comments I've added on the test are addressed. Thanks!
test/CodeGen/RISCV/get-setcc-result-type.ll | ||
---|---|---|
2 | -disable-block-placement has no codegen impact for this test, so remove the option. | |
7–28 | Whitespace here doesn't match the output of update_llc_test_checks.py, meaning we'll get unwanted diffs the next time the test is regenerated. Use the invocation I explain in my other comment to regenerate. |
Hi Alex. Thanks for your detail explanation, I really appreciate that. This is a great tool we should use. The commit version has reflected comments.
The LLVM Coding Standards doc isn't explicit in its guidance on doxygen comments about whether to duplicate them in subclasses. I'd generally prefer not to personally, but will ask on the mailing list for clarification on general policy. See question here.
If the comment is going to stay, the current LLVM style is to avoid duplicating the function name. I also think the version of the comment in include/llvm/CodeGen/TargetLowering.h is clearer "/// Return the ValueType of the result of SETCC operations."