[all-commits] [llvm/llvm-project] 9df1c8: [SelectionDAG] Combine range metadata when loads a...

Craig Topper via All-commits all-commits at lists.llvm.org
Fri Jun 27 08:58:27 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9df1c81fee5b304ca412f45eb922d8069b0aa996
      https://github.com/llvm/llvm-project/commit/9df1c81fee5b304ca412f45eb922d8069b0aa996
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2025-06-27 (Fri, 27 Jun 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAGNodes.h
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    A llvm/test/CodeGen/RISCV/pr145363.ll

  Log Message:
  -----------
  [SelectionDAG] Combine range metadata when loads are CSEd. (#146026)

When CSEing a load with an existing load with different range
metadata, clear the range metadata on the existing
load.

This is conservative, alternatively we could calculate new range
metadata using MDNode::getMostGenericRange. Without a test case I wasn't
sure it was worth it.

MDnode::getMostGenericRange takes a non-const MDNode*, but all of
SelectionDAG
uses const MDNode*. A const_cast will need to be used somewhere or
we need to make the codebase consistent about whether MDNode pointers
should be const or not.

I'm sure this isn't the only place that needs to be updated to handle
the CSE.
    
Fixes #145363.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list