diff options
author | Sanjay Patel <spatel@rotateright.com> | 2014-09-03 01:06:50 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2014-09-03 01:06:50 +0000 |
commit | a982d992f0052cd467f12b1a2abb645cc50c35bb (patch) | |
tree | f46986c5bf4ff1be4cfc0aa623ef7bac526ce5c7 /llvm/lib/IR/Instructions.cpp | |
parent | 54209533030e05c75183f515f9487593754316c7 (diff) | |
download | bcm5719-llvm-a982d992f0052cd467f12b1a2abb645cc50c35bb.tar.gz bcm5719-llvm-a982d992f0052cd467f12b1a2abb645cc50c35bb.zip |
Change name of copyFlags() to copyIRFlags(). Add convenience method for logical 'and' of all flags. NFC.
Adding 'IR' to the names in an attempt to be less ambiguous about the flags we're dealing with here.
The 'and' method is needed by the SLPVectorizer (PR20802) and possibly other passes.
llvm-svn: 217004
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index b113d51d416..be32dee0638 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -2030,7 +2030,7 @@ bool BinaryOperator::isExact() const { return cast<PossiblyExactOperator>(this)->isExact(); } -void BinaryOperator::copyFlags(const Value *V) { +void BinaryOperator::copyIRFlags(const Value *V) { // Copy the wrapping flags. if (auto *OB = dyn_cast<OverflowingBinaryOperator>(V)) { setHasNoSignedWrap(OB->hasNoSignedWrap()); @@ -2046,6 +2046,23 @@ void BinaryOperator::copyFlags(const Value *V) { copyFastMathFlags(FP->getFastMathFlags()); } +void BinaryOperator::andIRFlags(const Value *V) { + if (auto *OB = dyn_cast<OverflowingBinaryOperator>(V)) { + setHasNoSignedWrap(hasNoSignedWrap() & OB->hasNoSignedWrap()); + setHasNoUnsignedWrap(hasNoUnsignedWrap() & OB->hasNoUnsignedWrap()); + } + + if (auto *PE = dyn_cast<PossiblyExactOperator>(V)) + setIsExact(isExact() & PE->isExact()); + + if (auto *FP = dyn_cast<FPMathOperator>(V)) { + FastMathFlags FM = getFastMathFlags(); + FM &= FP->getFastMathFlags(); + copyFastMathFlags(FM); + } +} + + //===----------------------------------------------------------------------===// // FPMathOperator Class //===----------------------------------------------------------------------===// |