The new IR with And removes a use of the input variable, which is better for analysis.
|60 ms||x64 debian > Flang.Examples::feature-list-class.f90|
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/flang-new -fc1 -load /var/lib/buildkite-agent/builds/llvm-project/build/lib/flangFeatureList.so -plugin feature-list /var/lib/buildkite-agent/builds/llvm-project/flang/test/Examples/feature-list-class.f90 2>&1 | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/flang/test/Examples/feature-list-class.f90
|60 ms||x64 debian > Flang.Examples::feature-list-functions.f90|
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/flang-new -fc1 -load /var/lib/buildkite-agent/builds/llvm-project/build/lib/flangFeatureList.so -plugin feature-list /var/lib/buildkite-agent/builds/llvm-project/flang/test/Examples/feature-list-functions.f90 2>&1 | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/flang/test/Examples/feature-list-functions.f90
Can you split the tests into two commits so we can see the diff from the patch?
The new IR with and removes a use of the input variable, which is better for analysis.
"and" -> And (otherwise it looks like the conjugation, not the operator.
Please add a vector test, this is probably going to crash. (Can use getScalarSizeInBits instead.)
I.getPrediate() -> Pred.
Missing commuted test case (negation on RHS), multi-use test case and negative tests (e.g. non-equality predicate).
1、Add more cases (also update on D146268)
2、update with getScalarSizeInBits and add related vector case
3、use ICmpInst::isEquality(Pred) to replace Pred == ICmpInst::ICMP_EQ
4、I.getPredicate() --> Pred
isEquality() means "EQ" or "NE". You don't need to check for ICMP_NE separately.
These end up not actually commuted due to complexity-based canonicalization. Grep for thwart complexity-based canonicalization for how to avoid it.
1、delete the repeat ICMP_NE check, as isEquality() already include it
2、use "thwart complexity-based canonicalization" for commuted case
How about this pattern ?
Also reduce one usage but it works for any minuend.
Yes, I think this case is similar, but it seems the llvm doesn't have the issue end-to-end for C source, https://godbolt.org/z/EYMo9bd9c.
Apply your comment, thanks