[llvm] [AArch64] Add tests for redundant csel instructions. NFC (PR #101014)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 12:00:09 PDT 2024


================
@@ -0,0 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64 < %s | FileCheck %s
+
+define void @peephole_csel(ptr %dst, i1 %0, i1 %cmp) {
+; CHECK-LABEL: peephole_csel:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    tst w2, #0x1
+; CHECK-NEXT:    mov w8, #1 // =0x1
+; CHECK-NEXT:    csel x9, xzr, xzr, eq
+; CHECK-NEXT:    tst w1, #0x1
+; CHECK-NEXT:    csel x8, x8, x9, eq
+; CHECK-NEXT:    str x8, [x0]
+; CHECK-NEXT:    ret
+entry:
+  br i1 %0, label %then, label %exit
+
+then:                                             ; preds = %entry
+  %cmp1 = icmp eq i32 0, 0
+  br i1 %cmp, label %true, label %exit
+
+true:                                             ; preds = %then
+  %and.i = lshr i64 0, 0
----------------
fhahn wrote:

Does the issue still when storing the result here? Or doing a function call instead the of the dead lshr

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


More information about the llvm-commits mailing list