[llvm] bdd4dda - [InstSimplify] Update comments, remove redundant tests

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 16 08:10:25 PST 2021


I do not understand what this change is doing,
i would recommend going through https://reviews.llvm.org/.

On Sat, Jan 16, 2021 at 6:31 PM Dávid Bolvanský via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Dávid Bolvanský
> Date: 2021-01-16T16:31:23+01:00
> New Revision: bdd4dda58b0de08bd3474fb8d4589a9ba9349e88
>
> URL: https://github.com/llvm/llvm-project/commit/bdd4dda58b0de08bd3474fb8d4589a9ba9349e88
> DIFF: https://github.com/llvm/llvm-project/commit/bdd4dda58b0de08bd3474fb8d4589a9ba9349e88.diff
>
> LOG: [InstSimplify] Update comments, remove redundant tests
>
> Added:
>
>
> Modified:
>     llvm/lib/Analysis/InstructionSimplify.cpp
>     llvm/test/Transforms/InstCombine/or.ll
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
> index 6266e922f8c9..73f046dcb8de 100644
> --- a/llvm/lib/Analysis/InstructionSimplify.cpp
> +++ b/llvm/lib/Analysis/InstructionSimplify.cpp
> @@ -2264,6 +2264,8 @@ static Value *SimplifyOrInst(Value *Op0, Value *Op1, const SimplifyQuery &Q,
>
>    // (~A & B) | ~(A | B) --> ~A
>    // (~A & B) | ~(B | A) --> ~A
> +  // (B & ~A) | ~(A | B) --> ~A
> +  // (B & ~A) | ~(B | A) --> ~A
>    if (match(Op0, m_And(m_Not(m_Value(A)), m_Value(B))) &&
>        match(Op1, m_Not(m_c_Or(m_Specific(A), m_Specific(B)))))
>      return cast<BinaryOperator>(Op0)->getOperand(0);
>
> diff  --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll
> index 0fc75fe082f8..22ba395ebe9f 100644
> --- a/llvm/test/Transforms/InstCombine/or.ll
> +++ b/llvm/test/Transforms/InstCombine/or.ll
> @@ -1369,113 +1369,3 @@ define i32 @test5_use3(i32 %x, i32 %y) {
>    %or1 = or i32 %xor, %neg
>    ret i32 %or1
>  }
> -
> -define i32 @test6(i32 %A, i32 %B) {
> -; CHECK-LABEL: @test6(
> -; CHECK-NEXT:    [[I:%.*]] = xor i32 [[B:%.*]], -1
> -; CHECK-NEXT:    [[I2:%.*]] = and i32 [[I]], [[A:%.*]]
> -; CHECK-NEXT:    [[I3:%.*]] = or i32 [[B]], [[A]]
> -; CHECK-NEXT:    [[I4:%.*]] = xor i32 [[I3]], -1
> -; CHECK-NEXT:    [[I5:%.*]] = or i32 [[I2]], [[I4]]
> -; CHECK-NEXT:    ret i32 [[I5]]
> -;
> -  %i = xor i32 %B, -1
> -  %i2 = and i32 %i, %A
> -  %i3 = or i32 %B, %A
> -  %i4 = xor i32 %i3, -1
> -  %i5 = or i32 %i2, %i4
> -  ret i32 %i5
> -}
> -
> -define i32 @test7(i32 %A, i32 %B) {
> -; CHECK-LABEL: @test7(
> -; CHECK-NEXT:    [[I:%.*]] = xor i32 [[A:%.*]], -1
> -; CHECK-NEXT:    [[I2:%.*]] = and i32 [[I]], [[B:%.*]]
> -; CHECK-NEXT:    [[I3:%.*]] = or i32 [[B]], [[A]]
> -; CHECK-NEXT:    [[I4:%.*]] = xor i32 [[I3]], -1
> -; CHECK-NEXT:    [[I5:%.*]] = or i32 [[I2]], [[I4]]
> -; CHECK-NEXT:    ret i32 [[I5]]
> -;
> -  %i = xor i32 %A, -1
> -  %i2 = and i32 %i, %B
> -  %i3 = or i32 %B, %A
> -  %i4 = xor i32 %i3, -1
> -  %i5 = or i32 %i2, %i4
> -  ret i32 %i5
> -}
> -
> -define <4 x i32> @test8_vec(<4 x i32> %A, <4 x i32> %B) {
> -; CHECK-LABEL: @test8_vec(
> -; CHECK-NEXT:    [[I:%.*]] = xor <4 x i32> [[A:%.*]], <i32 -1, i32 -1, i32 -1, i32 -1>
> -; CHECK-NEXT:    [[I2:%.*]] = and <4 x i32> [[I]], [[B:%.*]]
> -; CHECK-NEXT:    [[I3:%.*]] = or <4 x i32> [[B]], [[A]]
> -; CHECK-NEXT:    [[I4:%.*]] = xor <4 x i32> [[I3]], <i32 -1, i32 -1, i32 -1, i32 -1>
> -; CHECK-NEXT:    [[I5:%.*]] = or <4 x i32> [[I2]], [[I4]]
> -; CHECK-NEXT:    ret <4 x i32> [[I5]]
> -;
> -  %i = xor <4 x i32> %A, <i32 -1, i32 -1, i32 -1, i32 -1>
> -  %i2 = and <4 x i32> %i, %B
> -  %i3 = or <4 x i32> %B, %A
> -  %i4 = xor <4 x i32> %i3, <i32 -1, i32 -1, i32 -1, i32 -1>
> -  %i5 = or <4 x i32> %i2, %i4
> -  ret <4 x i32> %i5
> -}
> -
> -define i32 @test9_use(i32 %A, i32 %B) {
> -; CHECK-LABEL: @test9_use(
> -; CHECK-NEXT:    [[I:%.*]] = xor i32 [[A:%.*]], -1
> -; CHECK-NEXT:    [[I2:%.*]] = and i32 [[I]], [[B:%.*]]
> -; CHECK-NEXT:    tail call void @use(i32 [[I2]])
> -; CHECK-NEXT:    [[I3:%.*]] = or i32 [[B]], [[A]]
> -; CHECK-NEXT:    [[I4:%.*]] = xor i32 [[I3]], -1
> -; CHECK-NEXT:    [[I5:%.*]] = or i32 [[I2]], [[I4]]
> -; CHECK-NEXT:    ret i32 [[I5]]
> -;
> -  %i = xor i32 %A, -1
> -  %i2 = and i32 %i, %B
> -  tail call void @use(i32 %i2)
> -  %i3 = or i32 %B, %A
> -  %i4 = xor i32 %i3, -1
> -  %i5 = or i32 %i2, %i4
> -  ret i32 %i5
> -}
> -
> -define i32 @test9_use2(i32 %A, i32 %B) {
> -; CHECK-LABEL: @test9_use2(
> -; CHECK-NEXT:    [[I:%.*]] = or i32 [[B:%.*]], [[A:%.*]]
> -; CHECK-NEXT:    [[I2:%.*]] = xor i32 [[I]], -1
> -; CHECK-NEXT:    tail call void @use(i32 [[I2]])
> -; CHECK-NEXT:    [[I3:%.*]] = xor i32 [[A]], -1
> -; CHECK-NEXT:    [[I4:%.*]] = and i32 [[I3]], [[B]]
> -; CHECK-NEXT:    [[I5:%.*]] = or i32 [[I4]], [[I2]]
> -; CHECK-NEXT:    ret i32 [[I5]]
> -;
> -  %i = or i32 %B, %A
> -  %i2 = xor i32 %i, -1
> -  tail call void @use(i32 %i2)
> -  %i3 = xor i32 %A, -1
> -  %i4 = and i32 %i3, %B
> -  %i5 = or i32 %i4, %i2
> -  ret i32 %i5
> -}
> -
> -define i32 @test9_use3(i32 %A, i32 %B) {
> -; CHECK-LABEL: @test9_use3(
> -; CHECK-NEXT:    [[I:%.*]] = or i32 [[B:%.*]], [[A:%.*]]
> -; CHECK-NEXT:    [[I2:%.*]] = xor i32 [[I]], -1
> -; CHECK-NEXT:    tail call void @use(i32 [[I2]])
> -; CHECK-NEXT:    [[I3:%.*]] = xor i32 [[A]], -1
> -; CHECK-NEXT:    [[I4:%.*]] = and i32 [[I3]], [[B]]
> -; CHECK-NEXT:    tail call void @use(i32 [[I4]])
> -; CHECK-NEXT:    [[I5:%.*]] = or i32 [[I4]], [[I2]]
> -; CHECK-NEXT:    ret i32 [[I5]]
> -;
> -  %i = or i32 %B, %A
> -  %i2 = xor i32 %i, -1
> -  tail call void @use(i32 %i2)
> -  %i3 = xor i32 %A, -1
> -  %i4 = and i32 %i3, %B
> -  tail call void @use(i32 %i4)
> -  %i5 = or i32 %i4, %i2
> -  ret i32 %i5
> -}
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list