Revert "Correct dwarf unwind information in function epilogue for X86"
authorReid Kleckner <rnk@google.com>
Wed, 8 Nov 2017 21:31:14 +0000 (21:31 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 8 Nov 2017 21:31:14 +0000 (21:31 +0000)
commit7adb2fdbbadd0c588a2137c7362a9099574d79ae
tree51b8a7eec92f22bbf2869969130a0fce1886de6b
parenta702fa17f31abd5efce302ef3d4cf2fbaf167368
Revert "Correct dwarf unwind information in function epilogue for X86"

This reverts r317579, originally committed as r317100.

There is a design issue with marking CFI instructions duplicatable. Not
all targets support the CFIInstrInserter pass, and targets like Darwin
can't cope with duplicated prologue setup CFI instructions. The compact
unwind info emission fails.

When the following code is compiled for arm64 on Mac at -O3, the CFI
instructions end up getting tail duplicated, which causes compact unwind
info emission to fail:
  int a, c, d, e, f, g, h, i, j, k, l, m;
  void n(int o, int *b) {
    if (g)
      f = 0;
    for (; f < o; f++) {
      m = a;
      if (l > j * k > i)
        j = i = k = d;
      h = b[c] - e;
    }
  }

We get assembly that looks like this:
; BB#1:                                 ; %if.then
Lloh3:
adrp x9, _f@GOTPAGE
Lloh4:
ldr x9, [x9, _f@GOTPAGEOFF]
mov  w8, wzr
Lloh5:
str wzr, [x9]
stp x20, x19, [sp, #-16]!   ; 8-byte Folded Spill
.cfi_def_cfa_offset 16
.cfi_offset w19, -8
.cfi_offset w20, -16
cmp w8, w0
b.lt LBB0_3
b LBB0_7
LBB0_2:                                 ; %entry.if.end_crit_edge
Lloh6:
adrp x8, _f@GOTPAGE
Lloh7:
ldr x8, [x8, _f@GOTPAGEOFF]
Lloh8:
ldr w8, [x8]
stp x20, x19, [sp, #-16]!   ; 8-byte Folded Spill
.cfi_def_cfa_offset 16
.cfi_offset w19, -8
.cfi_offset w20, -16
cmp w8, w0
b.ge LBB0_7
LBB0_3:                                 ; %for.body.lr.ph

Note the multiple .cfi_def* directives. Compact unwind info emission
can't handle that.

llvm-svn: 317726
101 files changed:
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/CodeGen/TargetFrameLowering.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Target/Target.td
llvm/lib/CodeGen/BranchFolding.cpp
llvm/lib/CodeGen/CFIInstrInserter.cpp [deleted file]
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/CodeGen.cpp
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/TailDuplicator.cpp
llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/lib/Target/X86/X86FrameLowering.h
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll
llvm/test/CodeGen/X86/2011-10-19-widen_vselect.ll
llvm/test/CodeGen/X86/GlobalISel/add-scalar.ll
llvm/test/CodeGen/X86/GlobalISel/brcond.ll
llvm/test/CodeGen/X86/GlobalISel/callingconv.ll
llvm/test/CodeGen/X86/GlobalISel/frameIndex.ll
llvm/test/CodeGen/X86/O0-pipeline.ll
llvm/test/CodeGen/X86/TruncAssertZext.ll
llvm/test/CodeGen/X86/avx512-mask-op.ll
llvm/test/CodeGen/X86/avx512-regcall-Mask.ll
llvm/test/CodeGen/X86/avx512-regcall-NoMask.ll
llvm/test/CodeGen/X86/avx512-schedule.ll
llvm/test/CodeGen/X86/avx512-select.ll
llvm/test/CodeGen/X86/avx512-vbroadcast.ll
llvm/test/CodeGen/X86/avx512bw-intrinsics-fast-isel.ll
llvm/test/CodeGen/X86/avx512bw-intrinsics-upgrade.ll
llvm/test/CodeGen/X86/avx512bw-intrinsics.ll
llvm/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll
llvm/test/CodeGen/X86/avx512vl-vbroadcast.ll
llvm/test/CodeGen/X86/avx512vl-vec-masked-cmp.ll
llvm/test/CodeGen/X86/bitcast-and-setcc-256.ll
llvm/test/CodeGen/X86/bitcast-and-setcc-512.ll
llvm/test/CodeGen/X86/bitcast-int-to-vector-bool-zext.ll
llvm/test/CodeGen/X86/bitcast-setcc-256.ll
llvm/test/CodeGen/X86/bitcast-setcc-512.ll
llvm/test/CodeGen/X86/bool-vector.ll
llvm/test/CodeGen/X86/cmp.ll
llvm/test/CodeGen/X86/emutls-pie.ll
llvm/test/CodeGen/X86/emutls.ll
llvm/test/CodeGen/X86/epilogue-cfi-fp.ll [deleted file]
llvm/test/CodeGen/X86/epilogue-cfi-no-fp.ll [deleted file]
llvm/test/CodeGen/X86/fast-isel-int-float-conversion.ll
llvm/test/CodeGen/X86/fast-isel-store.ll
llvm/test/CodeGen/X86/frame-lowering-debug-intrinsic-2.ll
llvm/test/CodeGen/X86/frame-lowering-debug-intrinsic.ll
llvm/test/CodeGen/X86/haddsub-2.ll
llvm/test/CodeGen/X86/hipe-cc64.ll
llvm/test/CodeGen/X86/illegal-bitfield-loadstore.ll
llvm/test/CodeGen/X86/imul.ll
llvm/test/CodeGen/X86/lea-opt-cse1.ll
llvm/test/CodeGen/X86/lea-opt-cse2.ll
llvm/test/CodeGen/X86/lea-opt-cse3.ll
llvm/test/CodeGen/X86/lea-opt-cse4.ll
llvm/test/CodeGen/X86/legalize-shift-64.ll
llvm/test/CodeGen/X86/live-out-reg-info.ll
llvm/test/CodeGen/X86/load-combine.ll
llvm/test/CodeGen/X86/masked_gather_scatter.ll
llvm/test/CodeGen/X86/memset-nonzero.ll
llvm/test/CodeGen/X86/merge-consecutive-loads-128.ll
llvm/test/CodeGen/X86/movtopush.ll
llvm/test/CodeGen/X86/mul-constant-result.ll
llvm/test/CodeGen/X86/mul-i256.ll
llvm/test/CodeGen/X86/mul128.ll
llvm/test/CodeGen/X86/pr21792.ll
llvm/test/CodeGen/X86/pr29061.ll
llvm/test/CodeGen/X86/pr29112.ll
llvm/test/CodeGen/X86/pr30430.ll
llvm/test/CodeGen/X86/pr32241.ll
llvm/test/CodeGen/X86/pr32256.ll
llvm/test/CodeGen/X86/pr32282.ll
llvm/test/CodeGen/X86/pr32284.ll
llvm/test/CodeGen/X86/pr32329.ll
llvm/test/CodeGen/X86/pr32345.ll
llvm/test/CodeGen/X86/pr32451.ll
llvm/test/CodeGen/X86/pr34088.ll
llvm/test/CodeGen/X86/pr34653.ll
llvm/test/CodeGen/X86/pr9743.ll
llvm/test/CodeGen/X86/push-cfi-debug.ll
llvm/test/CodeGen/X86/push-cfi-obj.ll
llvm/test/CodeGen/X86/push-cfi.ll
llvm/test/CodeGen/X86/return-ext.ll
llvm/test/CodeGen/X86/rtm.ll
llvm/test/CodeGen/X86/select-mmx.ll
llvm/test/CodeGen/X86/setcc-lowering.ll
llvm/test/CodeGen/X86/shrink_vmul.ll
llvm/test/CodeGen/X86/statepoint-call-lowering.ll
llvm/test/CodeGen/X86/statepoint-gctransition-call-lowering.ll
llvm/test/CodeGen/X86/statepoint-invoke.ll
llvm/test/CodeGen/X86/throws-cfi-fp.ll [deleted file]
llvm/test/CodeGen/X86/throws-cfi-no-fp.ll [deleted file]
llvm/test/CodeGen/X86/vector-sext.ll
llvm/test/CodeGen/X86/vector-shuffle-avx512.ll
llvm/test/CodeGen/X86/vector-shuffle-v1.ll
llvm/test/CodeGen/X86/wide-integer-cmp.ll
llvm/test/CodeGen/X86/x86-framelowering-trap.ll
llvm/test/CodeGen/X86/x86-interleaved-access.ll
llvm/test/CodeGen/X86/x86-no_caller_saved_registers-preserve.ll