================
@@ -2197,19 +2197,23 @@ TemplateInstantiator::TransformLoopHintAttr(const
LoopHintAttr *LH) {
// Generate error if there is a problem with the value.
if (getSema().CheckLoopHintExpr(TransformedExpr, LH->getLocation(),
- LH->getSemanticSpelling() ==
+ /*AllowZero=*/LH->getSemanticSpelling() ==
LoopHintAttr::Pragma_unroll))
return LH;
LoopHintAttr::OptionType Option = LH->getOption();
LoopHintAttr::LoopHintState State = LH->getState();
- llvm::APSInt ValueAPS =
- TransformedExpr->EvaluateKnownConstInt(getSema().getASTContext());
- // The values of 0 and 1 block any unrolling of the loop.
- if (ValueAPS.isZero() || ValueAPS.isOne()) {
- Option = LoopHintAttr::Unroll;
- State = LoopHintAttr::Disable;
+ if (Option == LoopHintAttr::UnrollCount &&
----------------
brunodf-snps wrote:
I actually think that was a bug, this code would disable unrolling in cases
where it's not appropriate. Compare the loop metadata in these two functions:
https://godbolt.org/z/cWTrYMThb
https://github.com/llvm/llvm-project/pull/172289
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits