diff options
author | yronglin <yronglin777@gmail.com> | 2024-04-29 22:00:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-29 22:00:41 +0800 |
commit | c4c8d08b81e622529aaf0bfc3020d2b9e87267b3 (patch) | |
tree | 49c627d4c28ba7ed5a4968d83c5fd3a24c1c0baa /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | e71840305d621dcc43d5253e332db990220b7fcb (diff) | |
download | llvm-c4c8d08b81e622529aaf0bfc3020d2b9e87267b3.zip llvm-c4c8d08b81e622529aaf0bfc3020d2b9e87267b3.tar.gz llvm-c4c8d08b81e622529aaf0bfc3020d2b9e87267b3.tar.bz2 |
[Clang] Fix incorrect handling of #pragma {GCC} unroll N in dependent context (#90240)
PR https://github.com/llvm/llvm-project/pull/89567 fix the `#pragma
unroll N` crash issue in dependent context, but it's introduce an new
issue:
Since https://github.com/llvm/llvm-project/pull/89567, if `N` is value
dependent, 'option' and 'state' were ` (LoopHintAttr::Unroll,
LoopHintAttr::Enable)`. Therefor, clang's code generator generated
incorrect IR metadata.
For the situation `#pragma {GCC} unroll {0|1}`, before template
instantiation, this PR tweak the 'option' to `LoopHintAttr::UnrollCount`
and 'state' to `LoopHintAttr::Numeric`. During template instantiation
and if unroll count is 0 or 1 this PR tweak 'option' to
`LoopHintAttr::Unroll` and 'state' to `LoopHintAttr::Disable`. We don't
use `LoopHintAttr::UnrollCount` here because it's will emit an redundant
LLVM IR metadata `!{!"llvm.loop.unroll.count", i32 1}` when unroll count
is 1.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
0 files changed, 0 insertions, 0 deletions