[PATCH] D66146: [Attributor][NFC] Add merge/join/clamp operators to the
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 14:36:55 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe1e844d6b099: [Attributor][NFC] Add merge/join/clamp operators to the IntegerState (authored by jdoerfert).
Changed prior to commit:
https://reviews.llvm.org/D66146?vs=214850&id=215253#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66146/new/
https://reviews.llvm.org/D66146
Files:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1650,6 +1650,30 @@
return this->DerefBytesState == R.DerefBytesState &&
this->GlobalState == R.GlobalState;
}
+
+ /// Inequality for IntegerState.
+ bool operator!=(const DerefState &R) { return !(*this == R); }
+
+ /// See IntegerState::operator^=
+ DerefState operator^=(const DerefState &R) {
+ DerefBytesState ^= R.DerefBytesState;
+ GlobalState ^= R.GlobalState;
+ return *this;
+ }
+
+ /// See IntegerState::operator&=
+ DerefState operator&=(const DerefState &R) {
+ DerefBytesState &= R.DerefBytesState;
+ GlobalState &= R.GlobalState;
+ return *this;
+ }
+
+ /// See IntegerState::operator|=
+ DerefState operator|=(const DerefState &R) {
+ DerefBytesState |= R.DerefBytesState;
+ GlobalState |= R.GlobalState;
+ return *this;
+ }
};
struct AADereferenceableImpl : AADereferenceable, DerefState {
Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -887,6 +887,31 @@
this->getKnown() == R.getKnown();
}
+ /// Inequality for IntegerState.
+ bool operator!=(const IntegerState &R) const { return !(*this == R); }
+
+ /// "Clamp" this state with \p R. The result is the maximum of the known
+ /// information but the minimum of the assumed.
+ IntegerState operator^=(const IntegerState &R) {
+ takeKnownMaximum(R.Known);
+ takeAssumedMinimum(R.Assumed);
+ return *this;
+ }
+
+ /// Make this the minimum, known and assumed, of this state and \p R.
+ IntegerState operator&=(const IntegerState &R) {
+ Known = std::min(Known, R.Known);
+ Assumed = std::min(Assumed, R.Assumed);
+ return *this;
+ }
+
+ /// Make this the maximum, known and assumed, of this state and \p R.
+ IntegerState operator|=(const IntegerState &R) {
+ Known = std::max(Known, R.Known);
+ Assumed = std::max(Assumed, R.Assumed);
+ return *this;
+ }
+
private:
/// The known state encoding in an integer of type base_t.
base_t Known = getWorstState();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66146.215253.patch
Type: text/x-patch
Size: 2329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190814/525c7471/attachment.bin>
More information about the llvm-commits
mailing list