[all-commits] [llvm/llvm-project] b81a33: [LoopUnroll] Avoid UB when converting from WeakVH ...

Justin Bogner via All-commits all-commits at lists.llvm.org
Thu Jan 23 10:36:55 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b81a337be7bcc84b2ab052103ce918c9fbfc839a
      https://github.com/llvm/llvm-project/commit/b81a337be7bcc84b2ab052103ce918c9fbfc839a
  Author: Justin Bogner <mail at justinbogner.com>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M llvm/include/llvm/IR/ValueHandle.h
    M llvm/lib/Transforms/Utils/LoopUnroll.cpp
    A llvm/test/Transforms/LoopUnroll/partial-unroll-dead-instructions.ll

  Log Message:
  -----------
  [LoopUnroll] Avoid UB when converting from WeakVH to `Value *`

Calling `operator*` on a WeakVH with a null value yields a null
reference, which is UB. Avoid this by implicitly converting the WeakVH
to a `Value *` rather than dereferencing and then taking the address
for the type conversion.

Differential Revision: https://reviews.llvm.org/D73280




More information about the All-commits mailing list