[PATCH] D115527: [Instruction] Split out 'and' of non-poison generating flags (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 10 08:05:03 PST 2021
fhahn created this revision.
fhahn added reviewers: nikic, reames, nlopes, spatel.
Herald added subscribers: dexonsmith, hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.
This patch moves the code to perform a logical and of non-poison
generating flags out to a separate helper, to be used in D115247 <https://reviews.llvm.org/D115247>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115527
Files:
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/Instruction.cpp
Index: llvm/lib/IR/Instruction.cpp
===================================================================
--- llvm/lib/IR/Instruction.cpp
+++ llvm/lib/IR/Instruction.cpp
@@ -316,6 +316,16 @@
DestGEP->setIsInBounds(SrcGEP->isInBounds() || DestGEP->isInBounds());
}
+void Instruction::andNonPoisonGeneratingIRFlags(const Value *V) {
+ if (auto *FP = dyn_cast<FPMathOperator>(V)) {
+ if (isa<FPMathOperator>(this)) {
+ FastMathFlags FM = getFastMathFlags();
+ FM &= FP->getFastMathFlags();
+ copyFastMathFlags(FM);
+ }
+ }
+}
+
void Instruction::andIRFlags(const Value *V) {
if (auto *OB = dyn_cast<OverflowingBinaryOperator>(V)) {
if (isa<OverflowingBinaryOperator>(this)) {
@@ -328,17 +338,11 @@
if (isa<PossiblyExactOperator>(this))
setIsExact(isExact() && PE->isExact());
- if (auto *FP = dyn_cast<FPMathOperator>(V)) {
- if (isa<FPMathOperator>(this)) {
- FastMathFlags FM = getFastMathFlags();
- FM &= FP->getFastMathFlags();
- copyFastMathFlags(FM);
- }
- }
-
if (auto *SrcGEP = dyn_cast<GetElementPtrInst>(V))
if (auto *DestGEP = dyn_cast<GetElementPtrInst>(this))
DestGEP->setIsInBounds(SrcGEP->isInBounds() && DestGEP->isInBounds());
+
+ andNonPoisonGeneratingIRFlags(V);
}
const char *Instruction::getOpcodeName(unsigned OpCode) {
Index: llvm/include/llvm/IR/Instruction.h
===================================================================
--- llvm/include/llvm/IR/Instruction.h
+++ llvm/include/llvm/IR/Instruction.h
@@ -495,6 +495,10 @@
/// V and this instruction.
void andIRFlags(const Value *V);
+ /// Logical 'and' of non poison generating flags, like fast-math flags, of
+ /// V and this instruction.
+ void andNonPoisonGeneratingIRFlags(const Value *V);
+
/// Merge 2 debug locations and apply it to the Instruction. If the
/// instruction is a CallIns, we need to traverse the inline chain to find
/// the common scope. This is not efficient for N-way merging as each time
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115527.393496.patch
Type: text/x-patch
Size: 2006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211210/d06937eb/attachment.bin>
More information about the llvm-commits
mailing list