This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Remove some code from PerformCMOVCombine
AbandonedPublic

Authored by samparker on Jul 16 2018, 8:22 AM.

Details

Summary

There is a small piece of combine code that is no longer covered by the existing tests and which also looks incorrect. The provided test case was performing movne r0, r0 for the return value.

Diff Detail

Event Timeline

samparker created this revision.Jul 16 2018, 8:22 AM

The code in question is hit pretty frequently; see http://lab.llvm.org:8080/coverage/coverage-reports/all/coverage/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/ARM/ARMISelLowering.cpp.html#L12550 . Maybe we don't have any tests which check this particular aspect of the output, though.

The provided test case was performing movne r0, r0 for the return value.

That's obviously not ideal, but deleting the transform isn't really improving the situation. (https://rise4fun.com/Alive/slIT ).

I'm happy to move it somewhere general, but where would be suitable, InstCombine?

If you want to specifically detect a "no-op" select, like your testcase, instcombine is probably appropriate. (I think we already have that combine, but maybe it doesn't look through zero-extensions.)

The redundant mov is really a property of ARM specifically, though: unlike other architectures, like AArch64, a conditional mov is a two-address instruction on ARM, so we want to reuse an existing register if possible. And we don't really represent the "conditional-move" aspect until after legalization, so I'm not sure where we would move this code to, despite the FIXME.

samparker abandoned this revision.Jul 18 2018, 8:39 AM

Ok, thanks for the clarification. I'll have a look in instcombine.