commit | bf55e6dee136d081b0858f62fcc362d74a708894 | [log] [tgz] |
---|---|---|
author | Sanjay Patel <spatel@rotateright.com> | Mon May 14 13:43:32 2018 +0000 |
committer | Sanjay Patel <spatel@rotateright.com> | Mon May 14 13:43:32 2018 +0000 |
tree | f9d4d6d2d7c440cde8fda1711cbc39744cfe3f3e | |
parent | 8f2b2f4e048522b542b5dd948acfc4eca33fd14b [diff] [blame] |
[AggressiveInstCombine] avoid crashing on unsimplified code (PR37446) This bug: https://bugs.llvm.org/show_bug.cgi?id=37446 ...raises another question: why do we run aggressive-instcombine before regular instcombine? llvm-svn: 332243
diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp index 16e50c2..cad1731 100644 --- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp +++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -108,6 +108,10 @@ if (!MOps.Root) MOps.Root = Candidate; + // The shift constant is out-of-range? This code hasn't been simplified. + if (BitIndex >= MOps.Mask.getBitWidth()) + return false; + // Fill in the mask bit derived from the shift constant. MOps.Mask.setBit(BitIndex); return MOps.Root == Candidate;