[llvm] r370015 - [Attributor] Clamp operator to extend known state
Hideto Ueno via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 23:02:56 PDT 2019
Author: uenoku
Date: Mon Aug 26 23:02:56 2019
New Revision: 370015
URL: http://llvm.org/viewvc/llvm-project?rev=370015&view=rev
Log:
[Attributor] Clamp operator to extend known state
Summary:
Similar to `^=` operator for IntegerState, this patch introduces a `+=` operator to "clamp" known information.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66635
Modified:
llvm/trunk/include/llvm/Transforms/IPO/Attributor.h
Modified: llvm/trunk/include/llvm/Transforms/IPO/Attributor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/Attributor.h?rev=370015&r1=370014&r2=370015&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/Attributor.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/Attributor.h Mon Aug 26 23:02:56 2019
@@ -940,6 +940,13 @@ struct IntegerState : public AbstractSta
return *this;
}
+ /// "Clamp" this state with \p R. The result is the maximum of the known
+ /// information but not more than what was assumed before.
+ IntegerState operator+=(const IntegerState &R) {
+ takeKnownMaximum(R.Known);
+ 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);
@@ -1445,6 +1452,13 @@ struct DerefState : AbstractState {
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;
More information about the llvm-commits
mailing list