diff options
author | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2017-05-12 22:43:58 +0000 |
---|---|---|
committer | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2017-05-12 22:43:58 +0000 |
commit | 479ddd20fc60dfb57d1f92188277acea91370a5b (patch) | |
tree | 3bc95e2843aadc03dab4e356f63d0084ab99f2e9 /llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp | |
parent | 12aa9554a6b5d5845181f5b634788706b8c4c3aa (diff) | |
download | bcm5719-llvm-479ddd20fc60dfb57d1f92188277acea91370a5b.tar.gz bcm5719-llvm-479ddd20fc60dfb57d1f92188277acea91370a5b.zip |
[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
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp index 718d2c7e1b0..4d459104229 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp @@ -162,7 +162,7 @@ bool LegalizerInfo::isLegal(const MachineInstr &MI, return std::get<0>(getAction(MI, MRI)) == Legal; } -LLT LegalizerInfo::findLegalType(const InstrAspect &Aspect, +Optional<LLT> LegalizerInfo::findLegalType(const InstrAspect &Aspect, LegalizeAction Action) const { switch(Action) { default: |