[all-commits] [llvm/llvm-project] fa45bf: InstCombine: Fix a crash in `PointerReplacer` when...

Changpeng Fang via All-commits all-commits at lists.llvm.org
Sun Mar 9 20:21:58 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa45bf430081ed5a37c50719dfd3a8ca32271126
      https://github.com/llvm/llvm-project/commit/fa45bf430081ed5a37c50719dfd3a8ca32271126
  Author: Changpeng Fang <changpeng.fang at amd.com>
  Date:   2025-03-09 (Sun, 09 Mar 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    A llvm/test/Transforms/InstCombine/AMDGPU/phi-with-incoming-from-load.ll

  Log Message:
  -----------
  InstCombine: Fix a crash in `PointerReplacer` when constructing a new PHI (#130256)

When constructing a PHI node in `PointerReplacer::replace`, the incoming
operands are expected to have already been replaced and in the
replacement map. However, when one of the incoming operands is a load,
the search of the map is unsuccessful, and a nullptr is returned from
`getReplacement`. The reason is that, when a load is replaced, all the
uses of the load has been actually replaced by the new load. It is
useless to insert the original load into the map. Instead, we should
place the new load into the map to meet the expectation of the later map
search.

Fixes: SWDEV-516420



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