[PATCH] D43451: [ARM] Mark -1 as cheap in xor's for thumb1

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 10:24:24 PST 2018


dmgreen added a comment.

In https://reviews.llvm.org/D43451#1012076, @spatel wrote:

> This is the same motivating case as https://reviews.llvm.org/D42951 - abandon that patch?


Yep. This is part one out of two or three. I'm not sure yet, depends on how part 2 looks. I don't think it will solve the register pressure part of the problem (not entirely at least), but it should always be a net gain when it comes up.

> I haven't looked at ConstantHoisting much, but this seems like a good solution to the problem. I wonder if we could generalize this for all targets by checking if a 'not' op is available.

Hmm. I didn't even consider other targets. I think the problem is getIntImmCost above (without an opcode) returning 2 for thumb1 targets. Everything else (Thumb2/Arm) is going to treat -1 as a cheap constant anyway. For other targets, I believe the default is to return Free for all constants.

> Might want to commit the tests first with auto-generated output using utils/update_llc_test_checks.py, so we just see the improvement here.

Sure, sounds sensible. Like I said it's just loop_2 that's updated here.

> There's a FIXME note about global isel for the div-by-constant case, so this problem also disappears once we have that? Maybe the whole thing disappears, so it's not worth repeating the comment.

Yeah I think so. I presume global ISel will have a much better time looking across basic blocks and a lot of codegen prepare/constant merge wont be needed any more. I think that comment applies to all costs in this function.


https://reviews.llvm.org/D43451





More information about the llvm-commits mailing list