dim 3864e9bcfd Pull in r354756 from upstream llvm trunk (by Craig Topper):
[X86] Fix tls variable lowering issue with large code model

  Summary:
  The problem here is the lowering for tls variable. Below is the DAG
  for the code. SelectionDAG has 11 nodes:

  t0: ch = EntryToken
	t8: i64,ch = load<(load 8 from `i8 addrspace(257)* null`,
	addrspace 257)> t0, Constant:i64<0>, undef:i64
	  t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32*
	  @x> 0 [TF=10]
	t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64
      t12: i64 = add t8, t11
    t4: i32,ch = load<(dereferenceable load 4 from @x)> t0, t12,
    undef:i64
  t6: ch = CopyToReg t0, Register:i32 %0, t4

  And when mcmodel is large, below instruction can NOT be folded.

    t10: i64 = X86ISD::WrapperRIP TargetGlobalTLSAddress:i64<i32* @x> 0
    [TF=10]
  t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64

  So "t11: i64,ch = load<(load 8 from got)> t0, t10, undef:i64" is
  lowered to " Morphed node: t11: i64,ch = MOV64rm<Mem:(load 8 from
  got)> t10, TargetConstant:i8<1>, Register:i64 $noreg,
  TargetConstant:i32<0>, Register:i32 $noreg, t0"

  When llvm start to lower "t10: i64 = X86ISD::WrapperRIP
  TargetGlobalTLSAddress:i64<i32* @x> 0 [TF=10]", it fails.

  The patch is to fold the load and X86ISD::WrapperRIP.

  Fixes PR26906

  Patch by LuoYuanke

  Reviewers: craig.topper, rnk, annita.zhang, wxiao3

  Reviewed By: rnk

  Subscribers: llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D58336

This should fix "fatal error: error in backend: Cannot select" messages
when compiling <ctype.h> functions using -mcmodel=large.

Reported by:	phk
PR:		233143
MFC after:	3 days
2019-02-24 21:22:16 +00:00
..
2018-12-23 01:05:52 +00:00
2017-05-31 19:37:23 +00:00
2018-10-20 20:49:46 +00:00
2018-09-19 06:42:05 +00:00
2018-11-04 18:24:11 +00:00
2018-08-08 01:33:36 +00:00
2018-10-19 00:37:47 +00:00
2018-02-19 05:10:22 +00:00
2019-02-13 07:37:33 +00:00
2018-05-31 09:11:21 +00:00
2018-08-14 18:58:01 +00:00
2018-08-21 02:38:07 +00:00
2018-11-26 15:33:55 +00:00
2018-01-28 03:16:54 +00:00
2017-06-28 09:22:45 +00:00
2018-12-18 01:12:30 +00:00
2018-05-08 04:52:52 +00:00
2018-09-19 07:01:22 +00:00
2018-12-31 07:57:37 +00:00
2018-12-09 06:45:49 +00:00
2017-09-10 01:25:15 +00:00