[polly] r314116 - [ScopInfo] Allow uniform branch conditions
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 07:58:47 PDT 2017
2017-09-25 18:37 GMT+02:00 Tobias Grosser via llvm-commits
<llvm-commits at lists.llvm.org>:
> + if (auto *PHI = dyn_cast<PHINode>(Condition)) {
> + auto *Unique = dyn_cast<ConstantInt>(
> + getUniqueNonErrorValue(PHI, &S.getRegion(), *S.getLI(), *S.getDT()));
> +
> + if (Unique->isZero())
If getUniqueNonErrorValue returns something else than a ConstantInt,
dyn_cast<ConstantInt> returns nullptr and the line above trigger
indefined behaviour.
If getUniqueNonErrorValue always returns ConstantInt in this use case,
we should use cast<ConstantInt> instead.
If it may return something else, we need to handle that case. Is it:
if (Unique && Unique->isZero())
what you intended?
Michael
More information about the llvm-commits
mailing list