Since EH_LABELs (and other labels) no longer have "side-effects", they
should be checked for separately.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318801
91177308-0d34-0410-b5e6-
96231b3b80d8
bool DeadCodeElimination::isLiveInstr(const MachineInstr *MI) const {
if (MI->mayStore() || MI->isBranch() || MI->isCall() || MI->isReturn())
return true;
- if (MI->hasOrderedMemoryRef() || MI->hasUnmodeledSideEffects())
+ if (MI->hasOrderedMemoryRef() || MI->hasUnmodeledSideEffects() ||
+ MI->isPosition())
return true;
if (MI->isPHI())
return false;
--- /dev/null
+# RUN: llc -march=hexagon -run-pass hexagon-rdf-opt -o - %s | FileCheck %s
+
+# Check that EH_LABELs are not removed as dead (since they are no longer
+# marked as having side-effects):
+# CHECK-LABEL: fred
+# CHECK: EH_LABEL
+
+---
+name: fred
+tracksRegLiveness: true
+
+body: |
+ bb.0:
+ %r0 = A2_tfrsi 0
+ EH_LABEL 0
+...
+