[PATCH] D31946: [legalize-types] Make softening result use a single map for replacements.

Chih-Hung Hsieh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 16:32:57 PDT 2017


chh added a comment.

I think now I understand your goal, which still seems not exactly
explained by "use a single map for replacements".

Please take a look of my patches
https://reviews.llvm.org/D15134
https://reviews.llvm.org/D11438
and their review history.

Current code is a compromise of various reviewer comments and
to avoid larger risky changes of the existing legalization process.
When I worked on those patches I also wished to have some clean up
of the legalization and type "soften" process. Other reviewers also
have suggested what you are trying to do now, but we never have
found a simpler and low risk change.

The difficulty was due to our limited knowledge of the
current complicated "type legalization" code,
and our limited resource to test on all targets.

I tested this patch against Android open source today and it failed to
compile 15 source files in bionic/libm/upstream-freebsd/lib/msun/src
for the x86_64 target. We need more consistent changes to all those
switch cases, to have a better chance to avoid errors. Still, it is
quite time consuming to go through one Android build test.

From those 15 failed cases,
I copy only 3 instruction selection fatal errors like:

bionic/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c

fatal error: error in backend: Cannot select: 0x5d43570: i32 = truncate 0x5d43a50

  0x5d43a50: f128 = srl 0x5d48468, Constant:i8<112>
    0x5d48468: f128,ch,glue = CopyFromReg 0x5d48c20, Register:f128 %XMM0, 0x5d48c20:1
      0x5d48878: f128 = Register %XMM0
      0x5d48c20: ch,glue = callseq_end 0x5d43368, TargetConstant:i64<0>, TargetConstant:i64<0>, 0x5d43368:1
        0x5d488e0: i64 = TargetConstant<0>
        0x5d488e0: i64 = TargetConstant<0>
        0x5d43368: ch,glue = X86ISD::CALL 0x5d43c58, TargetExternalSymbol:i64'__multf3' [TF=6], Register:f128 %XMM0, Register:f128 %XMM1, RegisterMask:Untyped, 0x5d43c58:1
          0x5d48a80: i64 = TargetExternalSymbol'__multf3' [TF=6]
          0x5d48878: f128 = Register %XMM0
          0x5d50758: f128 = Register %XMM1
          0x5d44270: Untyped = RegisterMask
          0x5d43c58: ch,glue = CopyToReg 0x5d48810, Register:f128 %XMM1, 0x5d49030, 0x5d48810:1
            0x5d50758: f128 = Register %XMM1
            0x5d49030: f128,ch = load<LD16[ConstantPool]> 0x5c5f028, 0x5d49238, undef:i64
              0x5d49238: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<fp128 0xL00000000000000004201000000000000> 0
                0x5d440d0: i64 = TargetConstantPool<fp128 0xL00000000000000004201000000000000> 0
              0x5d50620: i64 = undef
            0x5d48810: ch,glue = CopyToReg 0x5d43300, Register:f128 %XMM0, 0x5d43d90
              0x5d48878: f128 = Register %XMM0
              0x5d43d90: f128,ch = CopyFromReg 0x5c5f028, Register:f128 %vreg108
                0x5d48dc0: f128 = Register %vreg108
    0x5d48fc8: i8 = Constant<112>

In function: __hldtoa

bionic/libm/upstream-freebsd/lib/msun/src/s_cbrtl.c
fatal error: error in backend: Cannot select: 0x3ed5838: i64 = truncate 0x3ed5b10

  0x3ed5b10: f128 = srl 0x3ed5de8, Constant:i8<64>
    0x3ed5de8: f128,ch,glue = CopyFromReg 0x3ed6058, Register:f128 %XMM0, 0x3ed6058:1
      0x3eda090: f128 = Register %XMM0
      0x3ed6058: ch,glue = callseq_end 0x3ed6128, TargetConstant:i64<0>, TargetConstant:i64<0>, 0x3ed6128:1
        0x3eda028: i64 = TargetConstant<0>
        0x3eda028: i64 = TargetConstant<0>
        0x3ed6128: ch,glue = X86ISD::CALL 0x3ed6398, TargetExternalSymbol:i64'__multf3' [TF=6], Register:f128 %XMM0, Register:f128 %XMM1, RegisterMask:Untyped, 0x3ed6398:1
          0x3ed5d80: i64 = TargetExternalSymbol'__multf3' [TF=6]
          0x3eda090: f128 = Register %XMM0
          0x3ed9fc0: f128 = Register %XMM1
          0x3ed54f8: Untyped = RegisterMask
          0x3ed6398: ch,glue = CopyToReg 0x3ed6400, Register:f128 %XMM1, 0x3ed5490, 0x3ed6400:1
            0x3ed9fc0: f128 = Register %XMM1
            0x3ed5490: f128,ch = load<LD16[ConstantPool]> 0x3e2ed08, 0x3ed5970, undef:i64
              0x3ed5970: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<fp128 0xL00000000000000004201000000000000> 0
                0x3ed5560: i64 = TargetConstantPool<fp128 0xL00000000000000004201000000000000> 0
              0x3ed5b78: i64 = undef
            0x3ed6400: ch,glue = CopyToReg 0x3ed57d0, Register:f128 %XMM0, 0x3ed5700
              0x3eda090: f128 = Register %XMM0
              0x3ed5700: f128,ch = CopyFromReg 0x3e2ed08, Register:f128 %vreg21
                0x3eda160: f128 = Register %vreg21
    0x3eda0f8: i8 = Constant<64>

In function: cbrtl

bionic/libm/upstream-freebsd/lib/msun/src/e_hypotl.c
fatal error: error in backend: Cannot select: 0x44159a0: ch = store<ST8[FixedStack11+8], trunc to i64> 0x4368b88, 0x44197d0, 0x4415868, undef:i64

  0x44197d0: f128 = srl 0x4415590, Constant:i8<64>
    0x4415590: f128,ch,glue = CopyFromReg 0x44151e8, Register:f128 %XMM0, 0x44151e8:1
      0x44156c8: f128 = Register %XMM0
      0x44151e8: ch,glue = callseq_end 0x44198a0, TargetConstant:i64<0>, TargetConstant:i64<0>, 0x44198a0:1
        0x4419d18: i64 = TargetConstant<0>
        0x4419d18: i64 = TargetConstant<0>
        0x44198a0: ch,glue = X86ISD::CALL 0x44150b0, TargetExternalSymbol:i64'__addtf3' [TF=6], Register:f128 %XMM0, Register:f128 %XMM1, RegisterMask:Untyped, 0x44150b0:1
          0x4419ff0: i64 = TargetExternalSymbol'__addtf3' [TF=6]
          0x44156c8: f128 = Register %XMM0
          0x4415800: f128 = Register %XMM1
          0x4414f78: Untyped = RegisterMask
          0x44150b0: ch,glue = CopyToReg 0x4419b10, Register:f128 %XMM1, 0x441a400, 0x4419b10:1
            0x4415800: f128 = Register %XMM1
            0x441a400: f128,ch = CopyFromReg 0x4368b88, Register:f128 %vreg25
              0x4419b78: f128 = Register %vreg25
            0x4419b10: ch,glue = CopyToReg 0x441a398, Register:f128 %XMM0, 0x441a400
              0x44156c8: f128 = Register %XMM0
              0x441a400: f128,ch = CopyFromReg 0x4368b88, Register:f128 %vreg25
                0x4419b78: f128 = Register %vreg25
    0x4415798: i8 = Constant<64>
  0x4415868: i64 = or FrameIndex:i64<11>, Constant:i64<8>
    0x441a4d0: i64 = FrameIndex<11>
    0x4414c38: i64 = Constant<8>
  0x4414ca0: i64 = undef

In function: hypotl


https://reviews.llvm.org/D31946





More information about the llvm-commits mailing list