[llvm] r318174 - Set hasSideEffects=0 for TargetOpcode::{CFI_INSTRUCTION, EH_LABEL, GC_LABEL, ANNOTATION_LABEL}
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 11:16:08 PST 2017
Author: asb
Date: Tue Nov 14 11:16:08 2017
New Revision: 318174
URL: http://llvm.org/viewvc/llvm-project?rev=318174&view=rev
Log:
Set hasSideEffects=0 for TargetOpcode::{CFI_INSTRUCTION,EH_LABEL,GC_LABEL,ANNOTATION_LABEL}
D37065 (committed as rL317674) explicitly set hasSideEffects for all
TargetOpcode::* instructions where it was inferred previously. This is a
follow-up to that patch, setting hasSideEffects=0 for CFI_INSTRUCTION,
EH_LABEL, GC_LABEL and ANNOTATION_LABEL. All LLVM tests pass after this
change.
This patch also modifies MachineInstr::isLabel returns true for a
TargetOpcode::ANNOTATION_LABEL, which ensures that an annotation label won't
be incorrectly considered safe to move.
Differential Revision: https://reviews.llvm.org/D39941
Modified:
llvm/trunk/include/llvm/CodeGen/MachineInstr.h
llvm/trunk/include/llvm/Target/Target.td
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=318174&r1=318173&r2=318174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Nov 14 11:16:08 2017
@@ -797,9 +797,14 @@ public:
bool isEHLabel() const { return getOpcode() == TargetOpcode::EH_LABEL; }
bool isGCLabel() const { return getOpcode() == TargetOpcode::GC_LABEL; }
+ bool isAnnotationLabel() const {
+ return getOpcode() == TargetOpcode::ANNOTATION_LABEL;
+ }
/// Returns true if the MachineInstr represents a label.
- bool isLabel() const { return isEHLabel() || isGCLabel(); }
+ bool isLabel() const {
+ return isEHLabel() || isGCLabel() || isAnnotationLabel();
+ }
bool isCFIInstruction() const {
return getOpcode() == TargetOpcode::CFI_INSTRUCTION;
Modified: llvm/trunk/include/llvm/Target/Target.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=318174&r1=318173&r2=318174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/Target.td (original)
+++ llvm/trunk/include/llvm/Target/Target.td Tue Nov 14 11:16:08 2017
@@ -906,7 +906,7 @@ def CFI_INSTRUCTION : Instruction {
let InOperandList = (ins i32imm:$id);
let AsmString = "";
let hasCtrlDep = 1;
- let hasSideEffects = 1;
+ let hasSideEffects = 0;
let isNotDuplicable = 1;
}
def EH_LABEL : Instruction {
@@ -914,7 +914,7 @@ def EH_LABEL : Instruction {
let InOperandList = (ins i32imm:$id);
let AsmString = "";
let hasCtrlDep = 1;
- let hasSideEffects = 1;
+ let hasSideEffects = 0;
let isNotDuplicable = 1;
}
def GC_LABEL : Instruction {
@@ -922,7 +922,7 @@ def GC_LABEL : Instruction {
let InOperandList = (ins i32imm:$id);
let AsmString = "";
let hasCtrlDep = 1;
- let hasSideEffects = 1;
+ let hasSideEffects = 0;
let isNotDuplicable = 1;
}
def ANNOTATION_LABEL : Instruction {
@@ -930,7 +930,7 @@ def ANNOTATION_LABEL : Instruction {
let InOperandList = (ins i32imm:$id);
let AsmString = "";
let hasCtrlDep = 1;
- let hasSideEffects = 1;
+ let hasSideEffects = 0;
let isNotDuplicable = 1;
}
def KILL : Instruction {
More information about the llvm-commits
mailing list