summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2017-10-30 23:59:51 +0000
committerPhilip Reames <listmail@philipreames.com>2017-10-30 23:59:51 +0000
commit9c3cbeea3943dcfa096634eb94c8acc5ff8bf640 (patch)
tree5b22227e9913884476f782da3708c7414c95e999 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp
parentc38ba6697fc8b9f5cb577d27c07dc9ff46ae6b17 (diff)
downloadbcm5719-llvm-9c3cbeea3943dcfa096634eb94c8acc5ff8bf640.tar.gz
bcm5719-llvm-9c3cbeea3943dcfa096634eb94c8acc5ff8bf640.zip
[CGP] Fix crash on i96 bit multiply
Issue found by llvm-isel-fuzzer on OSS fuzz, https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3725 If anyone actually cares about > 64 bit arithmetic, there's a lot more to do in this area. There's a bunch of obviously wrong code in the same function. I don't have the time to fix all of them and am just using this to understand what the workflow for fixing fuzzer cases might look like. llvm-svn: 316967
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index 47bdac00ae1..57deddc80d9 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -1690,8 +1690,13 @@ SCEVExpander::FindValueInExprValueMap(const SCEV *S,
// the LCSSA form.
for (auto const &VOPair : *Set) {
Value *V = VOPair.first;
+ dbgs() << "found " << *V << "\n";
ConstantInt *Offset = VOPair.second;
Instruction *EntInst = nullptr;
+ if (V && isa<Constant>(V))
+ return {V, Offset};
+ if (V && isa<Argument>(V))
+ return {V, Offset};
if (V && isa<Instruction>(V) && (EntInst = cast<Instruction>(V)) &&
S->getType() == V->getType() &&
EntInst->getFunction() == InsertPt->getFunction() &&
@@ -1702,6 +1707,9 @@ SCEVExpander::FindValueInExprValueMap(const SCEV *S,
}
}
}
+ if (auto *C = dyn_cast<SCEVConstant>(S))
+ return {C->getValue(), nullptr};
+ dbgs() << "Reject: " << *S << "\n";
return {nullptr, nullptr};
}
OpenPOWER on IntegriCloud