@@ -100,6 +100,10 @@ static cl::opt<bool> PrintProfData(
100100 " print-prof-data" , cl::Hidden,
101101 cl::desc (" Pretty print perf data (branch weights, etc) when dumping" ));
102102
103+ static cl::opt<bool > PrintFPMemoryEffects (
104+ " print-fp-memory-effects" , cl::Hidden,
105+ cl::desc (" Pretty print floating-point memory effects when dumping" ));
106+
103107// Make virtual table appear in this compilation unit.
104108AssemblyAnnotationWriter::~AssemblyAnnotationWriter () = default ;
105109
@@ -4359,6 +4363,25 @@ void AssemblyWriter::printGCRelocateComment(const GCRelocateInst &Relocate) {
43594363 Out << " )" ;
43604364}
43614365
4366+ static void printFPMemoryEffects (raw_ostream &Out, MemoryEffects ME) {
4367+ ModRefInfo MR = ME.getModRef (IRMemLocation::InaccessibleMem);
4368+ Out << " ; fpe=[" ;
4369+ switch (MR) {
4370+ case ModRefInfo::NoModRef:
4371+ break ;
4372+ case ModRefInfo::Ref:
4373+ Out << " r" ;
4374+ break ;
4375+ case ModRefInfo::Mod:
4376+ Out << " w" ;
4377+ break ;
4378+ case ModRefInfo::ModRef:
4379+ Out << " rw" ;
4380+ break ;
4381+ }
4382+ Out << " ]" ;
4383+ }
4384+
43624385// / printInfoComment - Print a little comment after the instruction indicating
43634386// / which slot it occupies.
43644387void AssemblyWriter::printInfoComment (const Value &V) {
@@ -4389,30 +4412,14 @@ void AssemblyWriter::printInfoComment(const Value &V) {
43894412 if (PrintInstAddrs)
43904413 Out << " ; " << &V;
43914414
4392- if (auto *CI = dyn_cast<CallInst>(&V))
4393- if (Intrinsic::ID IID = CI->getIntrinsicID ())
4394- if (IntrinsicInst::isFloatingPointOperation (IID))
4395- if (const BasicBlock *BB = CI->getParent ())
4396- if (const Function *F = BB->getParent ())
4397- if (F->hasFnAttribute (Attribute::StrictFP)) {
4398- MemoryEffects ME = CI->getMemoryEffects ();
4399- ModRefInfo MR = ME.getModRef (IRMemLocation::InaccessibleMem);
4400- Out << " ; fpe=[" ;
4401- switch (MR) {
4402- case ModRefInfo::NoModRef:
4403- break ;
4404- case ModRefInfo::Ref:
4405- Out << " r" ;
4406- break ;
4407- case ModRefInfo::Mod:
4408- Out << " w" ;
4409- break ;
4410- case ModRefInfo::ModRef:
4411- Out << " rw" ;
4412- break ;
4413- }
4414- Out << " ]" ;
4415- }
4415+ if (PrintFPMemoryEffects) {
4416+ if (auto *CI = dyn_cast<CallInst>(&V))
4417+ if (Intrinsic::ID IID = CI->getIntrinsicID ())
4418+ if (const Function *F = CI->getFunction ())
4419+ if (IntrinsicInst::isFloatingPointOperation (IID) &&
4420+ F->hasFnAttribute (Attribute::StrictFP))
4421+ printFPMemoryEffects (Out, CI->getMemoryEffects ());
4422+ }
44164423}
44174424
44184425static void maybePrintCallAddrSpace (const Value *Operand, const Instruction *I,
0 commit comments