[PATCH] D34904: [CGP] use subtract of cmps for result of memcmp expansion

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 22:08:53 PDT 2017


nemanjai added a comment.

We have patches that will eventually land that improve our handling of zero-extending `i1` in the PPC back end so I'm not overly concern about the slightly poorer code here. However, I'd like to make sure I understand the reason for this change.

1. On targets that will expand selects to branches, we want to avoid introducing selects to reduce branching
2. Recreating a select in the DAG is possible and getting rid of the select in the DAG is impossible on targets that expand it to branches
3. Making this choice conditional on something like an IR-level version of `canInsertSelect()` (maybe something called `shouldInsertSelect()`...) introduces unnecessary complexity

Does that evaluation roughly cover the motivation for this patch?



================
Comment at: test/CodeGen/PowerPC/memcmp.ll:15
+; CHECK-NEXT:    subf 3, 3, 4
+; CHECK-NEXT:    extsw 3, 3
 ; CHECK-NEXT:    blr
----------------
I wouldn't worry about this sign extension. This is something that happens all over the PPC back end and we have a patch in the pipeline that will eliminate it.


https://reviews.llvm.org/D34904





More information about the llvm-commits mailing list