[PATCH] Remove redundant folding of bswap(bswap(x))
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Wed Aug 13 10:54:05 PDT 2014
> // bswap(trunc(bswap(x))) -> trunc(lshr(x, c))
> if (match(IIOperand, m_Trunc(m_BSwap(m_Value(X))))) {
> unsigned C = X->getType()->getPrimitiveSizeInBits() -
> Index: test/Transforms/InstSimplify/call.ll
> ===================================================================
> --- test/Transforms/InstSimplify/call.ll
> +++ test/Transforms/InstSimplify/call.ll
> @@ -102,6 +102,17 @@
> ret float %r4
> }
>
> +declare i32 @llvm.bswap.i32(i32) nounwind readnone
> +
> +; CHECK-LABEL: @test_idempotence_2(
> +; CHECK: bswap
What does this match? Didn't we remove the bswap?
In general, it is probably better to match the code that is generated
in a bit more detail. In particular, this function is so small that
you should be able to just use a few CHECK-NEXT until the ret.
> +; CHECK-NOT: bswap
> +define i32 @test_idempotence_2(i32 %a) {
> + %a0 = call i32 @llvm.bswap.i32(i32 %a)
> + %a1 = call i32 @llvm.bswap.i32(i32 %a0)
> + ret i32 %a1
> +}
> +
http://reviews.llvm.org/D4887
More information about the llvm-commits
mailing list