When abs source comes from (x - y) , we need to check if exist x > y dominating the instruction or not.
Details
Diff Detail
Unit Tests
Time | Test | |
---|---|---|
60,410 ms | x64 debian > Clang.CodeGen/RISCV/rvv-intrinsics::vluxseg_mask_mf.c |
Event Timeline
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
430 | where are the actual codegen checks? |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
430 | ; CHECK-NOT: llvm.abs.i32 |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
430 | Checks in InstCombine tests are usually autogenerated with utils/update_test_checks.py as the top of this file says. Please use that. |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
430 | I'm sorry for the terrible test case. I'm an beginner on llvm so can someone tell me how the update_test_checks.py works and what should I do next? Or is there any document or sample to show how it works? |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
445 | I think the nsw flag is required to make this transform valid, but code doesn't check for it. |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
430 | With my build directory at llvm-project/build, I run something like this. You can name the tests you want to autogenerate as parameters. ./llvm/utils/update_test_checks.py --opt-binary=build/bin/opt llvm/test/Transforms/InstCombine/abs-intrinsic.ll |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
430 | Thanks for the sample |
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | ||
---|---|---|
794–796 | This code would be shorter using 'match': Value *X, *Y; if (match(Op, m_NSWSub(m_Value(X), m_Value(Y)))) return isImpliedByDomCondition(ICmpInst::ICMP_SLT, X, Y, CxtI, DL); | |
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
429 | We should have at least 3 more tests:
|
Do you have commit access? It would be good to push the original tests as a preliminary patch.
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
473 | Why did the 'add' operand change from %y to %x? |
I have no commit access, can you help me to do this?
name: chenglin.bi
email: chenglin.bi@cixcomputing.com
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
473 | when I change the condition code from sgt to slt, it become x < y |
Sure - let's make one small change, and then I can commit for you.
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
473 | I see. It's fine to include a test with the 'add' from the motivating bug report, but the 'add' is not part of the minimal transform. We should remove it completely from at least these first 2 tests, so we can check that only this transform is tested. |
I committed the tests with baseline CHECK lines:
01a2ba5dfbee
...and one more test:
c4d74a93f65c
Please rebase and test with Alive2 that we have correct behavior when the 2nd parameter to abs is 'false'.
llvm/test/Transforms/InstCombine/abs-intrinsic.ll | ||
---|---|---|
426–453 | This should have propagated the 'nsw', right? If this is an existing problem (but might be invisible before this patch), I think it is ok to mark this with a 'TODO' comment. |
llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp | ||
---|---|---|
241 ↗ | (On Diff #417314) | This change should be an independent patch with its own minimal tests: |
This code would be shorter using 'match':