diff options
author | Rodrigo Caetano Rocha <rcor.cs@gmail.com> | 2019-12-07 16:47:00 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-12-07 16:54:49 +0000 |
commit | d714aa0dfdb16270fc279e8e91d4a83ace531529 (patch) | |
tree | 20cfa25ed25d3fbad2a1b80413ca41a9b084784e /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 071dca24cea9dcabe25cbe98c4053d874183be37 (diff) | |
download | bcm5719-llvm-d714aa0dfdb16270fc279e8e91d4a83ace531529.tar.gz bcm5719-llvm-d714aa0dfdb16270fc279e8e91d4a83ace531529.zip |
[SimplifyCFG] Handle AssumptionCache being null.
AssumptionCache can be null in SimplifyCFGOptions. However, FoldCondBranchOnPHI() was not properly handling that when passing a null AssumptionCache to simplifyCFG.
Patch by Rodrigo Caetano Rocha <rcor.cs@gmail.com>
Reviewers: fhahn, lebedev.ri, spatel
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D69963
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 79d4857c2c8..16044210f52 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2274,9 +2274,8 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const DataLayout &DL, EdgeBB->getInstList().insert(InsertPt, N); // Register the new instruction with the assumption cache if necessary. - if (auto *II = dyn_cast_or_null<IntrinsicInst>(N)) - if (II->getIntrinsicID() == Intrinsic::assume) - AC->registerAssumption(II); + if (AC && match(N, m_Intrinsic<Intrinsic::assume>())) + AC->registerAssumption(cast<IntrinsicInst>(N)); } // Loop over all of the edges from PredBB to BB, changing them to branch |