[PATCH] D37097: Set hasSideEffects=0 for PHI and fix passes relying isSafeToMove/hasUnmodeledSideEffects being true for PHI
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 01:24:26 PDT 2017
asb updated this revision to Diff 112513.
asb added a comment.
Attach the correct patch.
https://reviews.llvm.org/D37097
Files:
include/llvm/Target/Target.td
lib/CodeGen/MachineLICM.cpp
lib/CodeGen/MachineSink.cpp
lib/Target/Hexagon/HexagonBitSimplify.cpp
Index: lib/Target/Hexagon/HexagonBitSimplify.cpp
===================================================================
--- lib/Target/Hexagon/HexagonBitSimplify.cpp
+++ lib/Target/Hexagon/HexagonBitSimplify.cpp
@@ -1319,7 +1319,7 @@
if (MI->getOpcode() == TargetOpcode::COPY)
continue;
- if (MI->hasUnmodeledSideEffects() || MI->isInlineAsm())
+ if (MI->isPHI() || MI->hasUnmodeledSideEffects() || MI->isInlineAsm())
continue;
unsigned NumD = MI->getDesc().getNumDefs();
if (NumD != 1)
@@ -1329,8 +1329,7 @@
if (!BT.has(RD.Reg))
continue;
const BitTracker::RegisterCell &DC = BT.lookup(RD.Reg);
- auto At = MI->isPHI() ? B.getFirstNonPHI()
- : MachineBasicBlock::iterator(MI);
+ auto At = MachineBasicBlock::iterator(MI);
// Find a source operand that is equal to the result.
for (auto &Op : MI->uses()) {
Index: lib/CodeGen/MachineSink.cpp
===================================================================
--- lib/CodeGen/MachineSink.cpp
+++ lib/CodeGen/MachineSink.cpp
@@ -754,7 +754,7 @@
return false;
// Check if it's safe to move the instruction.
- if (!MI.isSafeToMove(AA, SawStore))
+ if (MI.isPHI() || !MI.isSafeToMove(AA, SawStore))
return false;
// Convergent operations may not be made control-dependent on additional
Index: lib/CodeGen/MachineLICM.cpp
===================================================================
--- lib/CodeGen/MachineLICM.cpp
+++ lib/CodeGen/MachineLICM.cpp
@@ -856,7 +856,7 @@
bool MachineLICM::IsLICMCandidate(MachineInstr &I) {
// Check if it's safe to move the instruction.
bool DontMoveAcrossStore = true;
- if (!I.isSafeToMove(AA, DontMoveAcrossStore))
+ if (I.isPHI() || !I.isSafeToMove(AA, DontMoveAcrossStore))
return false;
// If it is load then check if it is guaranteed to execute by making sure that
Index: include/llvm/Target/Target.td
===================================================================
--- include/llvm/Target/Target.td
+++ include/llvm/Target/Target.td
@@ -815,7 +815,7 @@
let OutOperandList = (outs unknown:$dst);
let InOperandList = (ins variable_ops);
let AsmString = "PHINODE";
- let hasSideEffects = 1;
+ let hasSideEffects = 0;
}
def INLINEASM : Instruction {
let OutOperandList = (outs);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37097.112513.patch
Type: text/x-patch
Size: 2320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170824/3f249854/attachment.bin>
More information about the llvm-commits
mailing list