[GISel]: Fix undefined behavior while accessing DefaultAction map
authorAditya Nandakumar <aditya_nandakumar@apple.com>
Fri, 12 May 2017 22:43:58 +0000 (22:43 +0000)
committerAditya Nandakumar <aditya_nandakumar@apple.com>
Fri, 12 May 2017 22:43:58 +0000 (22:43 +0000)
commit479ddd20fc60dfb57d1f92188277acea91370a5b
tree3bc95e2843aadc03dab4e356f63d0084ab99f2e9
parent12aa9554a6b5d5845181f5b634788706b8c4c3aa
[GISel]: Fix undefined behavior while accessing DefaultAction map

We end up dereferencing the end iterator here when the Aspect doesn't exist in the DefaultAction map.
Change the API to return Optional<LLT> and return None when not found.
Also update the callers to handle the None case

llvm-svn: 302963
llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp