[llvm] [SelectionDAG] Fix and improve TargetLowering::SimplifySetCC (PR #87646)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 14:09:08 PDT 2024


================
@@ -189,7 +191,7 @@ define i1 @test_48_16_8(ptr %y) {
 ; CHECK-LE-LABEL: test_48_16_8:
 ; CHECK-LE:       @ %bb.0:
 ; CHECK-LE-NEXT:    ldrh r0, [r0, #1]
-; CHECK-LE-NEXT:    cmp r0, #0
+; CHECK-LE-NEXT:    lsls r0, r0, #8
----------------
bjope wrote:

Maybe the difference is that this patch checks the Fast result from the allowsMemoryAccess check. But DAGCombiner::isLegalNarrowLdSt is only checking if it is legal (not if the narrowed, not naturally aligned, access also is considered as Fast).
So the new optimization in this patch is a bit more strict, and then we suffer from DAGCombiner::reduceLoadWidth introducing a SHL that isn't really needed.

https://github.com/llvm/llvm-project/pull/87646


More information about the llvm-commits mailing list