[all-commits] [llvm/llvm-project] c23da6: [Attributor] Add support for compound assignment f...
Shilei Tian via All-commits
all-commits at lists.llvm.org
Thu Jul 15 20:52:00 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c23da666b5be4da631c2ff8db4d129a90f319777
https://github.com/llvm/llvm-project/commit/c23da666b5be4da631c2ff8db4d129a90f319777
Author: Shilei Tian <tianshilei1992 at gmail.com>
Date: 2021-07-15 (Thu, 15 Jul 2021)
Changed paths:
M llvm/include/llvm/Transforms/IPO/Attributor.h
M llvm/lib/Transforms/IPO/Attributor.cpp
M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Log Message:
-----------
[Attributor] Add support for compound assignment for ChangeStatus
A common use of `ChangeStatus` is as follows:
```
ChangeStatus Changed = ChangeStatus::UNCHANGED;
Changed |= foo();
```
where `foo` returns `ChangeStatus` as well. Currently `ChangeStatus` doesn't
support compound assignment, we have to write as
```
Changed = Changed | foo();
```
which is not that convenient.
This patch add the support for compound assignment for `ChangeStatus`. Compound
assignment is usually implemented as a member function, and binary arithmetic
operator is therefore implemented using compound assignment. However, unlike
regular C++ class, enum class doesn't support member functions. As a result, they
can only be implemented in the way shown in the patch.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106109
More information about the All-commits
mailing list