[PATCH RFC 1/1] utils: Fix segfault in flattencfg
Matt Arsenault
arsenm2 at gmail.com
Mon Aug 4 15:30:56 PDT 2014
On Aug 4, 2014, at 3:24 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> ---
>
> Not sure if it's the right fix. Looks more like ductaping over some bigger problem.
> Fixes segfault I hit with mad_sat libclc patch
>
> lib/Transforms/Utils/FlattenCFG.cpp | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/Transforms/Utils/FlattenCFG.cpp b/lib/Transforms/Utils/FlattenCFG.cpp
> index 51ead40..ce49a40 100644
> --- a/lib/Transforms/Utils/FlattenCFG.cpp
> +++ b/lib/Transforms/Utils/FlattenCFG.cpp
> @@ -241,6 +241,8 @@ bool FlattenCFGOpt::FlattenParallelAndOr(BasicBlock *BB, IRBuilder<> &Builder,
> while (1) {
> BranchInst *BI = dyn_cast<BranchInst>(CurrBlock->getTerminator());
> CmpInst *CI = dyn_cast<CmpInst>(BI->getCondition());
> + if (!CI)
> + break;
This needs a test. I’m guessing this is a branch on a constant? I’ve encountered problems like this from those in all of the GPU CFG passes
> CmpInst::Predicate Predicate = CI->getPredicate();
> // Canonicalize icmp_ne -> icmp_eq, fcmp_one -> fcmp_oeq
> if ((Predicate == CmpInst::ICMP_NE) || (Predicate == CmpInst::FCMP_ONE)) {
> --
> 1.9.3
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list