[PATCH] D66132: [CodeGen] Add `isSpeculativeExecutionForbidden()` to `TargetTransformInfo`
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 03:26:35 PDT 2019
anton-afanasyev updated this revision to Diff 214795.
anton-afanasyev added a comment.
Update comment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66132/new/
https://reviews.llvm.org/D66132
Files:
llvm/include/llvm/CodeGen/TargetInstrInfo.h
llvm/lib/CodeGen/MachineCSE.cpp
Index: llvm/lib/CodeGen/MachineCSE.cpp
===================================================================
--- llvm/lib/CodeGen/MachineCSE.cpp
+++ llvm/lib/CodeGen/MachineCSE.cpp
@@ -887,8 +887,10 @@
DT = &getAnalysis<MachineDominatorTree>();
MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
LookAheadLimit = TII->getMachineCSELookAheadLimit();
- bool ChangedPRE, ChangedCSE;
- ChangedPRE = PerformSimplePRE(DT);
+ bool ChangedPRE = false, ChangedCSE;
+ if (!TII->isSpeculativeExecutionForbidden()) {
+ ChangedPRE = PerformSimplePRE(DT);
+ }
ChangedCSE = PerformCSE(DT->getRootNode());
return ChangedPRE || ChangedCSE;
}
Index: llvm/include/llvm/CodeGen/TargetInstrInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -1022,6 +1022,11 @@
/// even if it has glue.
virtual bool canCopyGluedNodeDuringSchedule(SDNode *N) const { return false; }
+ /// Return true if speculative execution of target instructions is forbidden.
+ /// This prevents MIR code from SimplePRE optimization leading to possible
+ /// speculative execution of instructions.
+ virtual bool isSpeculativeExecutionForbidden() const { return false; }
+
protected:
/// Target-dependent implementation for foldMemoryOperand.
/// Target-independent code in foldMemoryOperand will
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66132.214795.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190813/1e2aaa91/attachment.bin>
More information about the llvm-commits
mailing list