[all-commits] [llvm/llvm-project] db5610: [GlobalOpt] Handle non-instruction MTI source (PR5...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Mar 28 05:29:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db561064f60dff6c65e9b31c709cfbd72dd24b73
      https://github.com/llvm/llvm-project/commit/db561064f60dff6c65e9b31c709cfbd72dd24b73
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-03-28 (Mon, 28 Mar 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/GlobalOpt.cpp
    A llvm/test/Transforms/GlobalOpt/pr54572.ll

  Log Message:
  -----------
  [GlobalOpt] Handle non-instruction MTI source (PR54572)

This was reusing a cast to GlobalVariable to check for an
Instruction, which means we'll try to dereference a null pointer
if it's not actually a GlobalVariable. We should be casting
MTI->getSource() instead.

I don't think this problem is really specific to opaque pointers,
but it certainly makes it a lot easier to reproduce.

Fixes https://github.com/llvm/llvm-project/issues/54572.




More information about the All-commits mailing list