IndVarSimplify: Avoid UB from binding a reference to a null pointer
authorJustin Bogner <mail@justinbogner.com>
Sat, 20 Jun 2015 06:24:05 +0000 (06:24 +0000)
committerJustin Bogner <mail@justinbogner.com>
Sat, 20 Jun 2015 06:24:05 +0000 (06:24 +0000)
commit40f8babe9ae3bbf56966c223af7c11cc1308c7bc
treef8238d97caf219ec3b12b5b6d60610ca93a178a1
parentac5e008dfdd7da587680a8f2437d54243a4a4436
IndVarSimplify: Avoid UB from binding a reference to a null pointer

Calling operator* on a WeakVH whose Value is null hits undefined
behaviour, since we bind the value to a reference. Instead, go through
`operator Value*` so that we work with the pointer itself.

Found by ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240214 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp