[llvm] [CodeGen] Correctly handle non-standard cases in RemoveLoadsIntoFakeUses (PR #111551)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 04:48:27 PST 2024


================
@@ -0,0 +1,74 @@
+# Ensure that loads into FAKE_USEs are correctly removed by the
+# remove-loads-into-fake-uses pass.
+# RUN: llc -run-pass remove-loads-into-fake-uses -mtriple=x86_64-unknown-linux -debug-only=remove-loads-into-fake-uses 2>&1 -o - %s | FileCheck %s --implicit-check-not=DELETING
+# REQUIRES: asserts
+#
+## We ensure that the load into the FAKE_USE is removed, along with the FAKE_USE
+## itself, even when the FAKE_USE is for a subregister of the move, and that we
+## correctly handle situations where FAKE_USE has additional `killed` operands
+## added by other passes.
+
+# CHECK: DELETING: renamable $rax = MOV64rm $rbp
+# CHECK: DELETING: FAKE_USE renamable $eax
----------------
jmorse wrote:

This is a solid test; but there have been requests in the past that tests do not use LLVM_DEBUG outputs to check the compilers behaviour, as the (rare) situations where the debug-text-output is wrong allows regressions to slip through. I think this is testable with a more-precise checking that the relevant instructions no longer appear in the relevant block; thus we should take that approach.

(IIRC debug-output testing is acceptable when it's hard to identify/check-for properties of the program that can easily be printed during passes).

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


More information about the llvm-commits mailing list