[PATCH] D34515: [ARM] Materialise some boolean values to avoid a branch

Roger Ferrer Ibanez via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 09:07:12 PDT 2017


rogfer01 added inline comments.


================
Comment at: test/CodeGen/ARM/cmn.ll:10
   %cmp = icmp sgt i32 %a, -78
-  %. = zext i1 %cmp to i32
-  ret i32 %.
+  %ret = select i1 %cmp, i32 42, i32 24
+  ret i32 %ret
----------------
samparker wrote:
> Why change the input?
By doing an artificial `select` we avoid triggering the new combiner while forcing the previous `cmn` to appear.


================
Comment at: test/CodeGen/ARM/cmpxchg-O0.ll:23
+; CHECK:     clz [[CMP2:r[0-9]+]], [[CMP1]]
+; CHECK:     lsr{{(s)?}} {{r[0-9]+}}, [[CMP2]], #5
 ; CHECK:     dmb ish
----------------
samparker wrote:
> Is this still beneficial when conditional moves are available? This test makes it look like an extra instruction is used.
I've just reduced the scope of this change to only Thumb1 for this case as it is less obvious for Arm that this is an improvement.


https://reviews.llvm.org/D34515





More information about the llvm-commits mailing list