[PATCH] D114194: [SystemZ] Add range checks for PC-relative fixups

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 16:23:56 PST 2021


jonpa updated this revision to Diff 389064.
jonpa added a comment.

I ran into a bit of problems trying to test the 32-bit PCRel range. Since this is encoded as halfwords, 32 bits will actually overflow, and unfortunately common-code has currently some 32-bit types for offsets. I could for now make the test pass with some common-code changes, but the (SmallVector) Contents vector should probably also be fixed then to have a 64-bit template type. This is the vector that holds the encoded bytes.

The 32-bit PCRel test kind of exploded in compile time (~10 mins). It seems the main part of this is in the table-generated SystemZAsmParser::MatchInstructionImp. The 24-bit test takes 2-3 seconds.

Not sure if/how we should proceed with the 32-bit case...

GAS is faster, but seems to print broken diagnostics with the big test case ('between 0 and -2' is weird):

  time as ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s -o out.o -march=zEC12
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s: Assembler messages:
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:15: Error: operand out of range (4096 not between -4096 and 4094)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:22: Error: operand out of range (-4098 not between -4096 and 4094)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:31: Error: operand out of range (16777220 not between -16777216 and 16777214)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:38: Error: operand out of range (-16777222 not between -16777216 and 16777214)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:47: Error: operand out of range (65540 not between -65536 and 65534)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:54: Error: operand out of range (-65542 not between -65536 and 65534)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:63: Error: operand out of range (4294967300 not between 0 and -2)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:63: Error: value of 4294967300 too large for field of 4 bytes at 16846898
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:70: Error: operand out of range (-4294967302 not between 0 and -2)
  ./llvm/test/MC/SystemZ/fixups-out-of-range-02.s:70: Error: value of -4294967302 too large for field of 4 bytes at 4311814206
  
  real	2m32.105s
  user	2m23.702s
  sys	0m8.365s


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114194/new/

https://reviews.llvm.org/D114194

Files:
  llvm/include/llvm/MC/MCFixup.h
  llvm/lib/MC/MCAssembler.cpp
  llvm/lib/MC/MCObjectStreamer.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp
  llvm/test/MC/SystemZ/fixups-out-of-range-01.s
  llvm/test/MC/SystemZ/fixups-out-of-range-02.s
  llvm/test/MC/SystemZ/fixups-out-of-range.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114194.389064.patch
Type: text/x-patch
Size: 7049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/81e2e0ce/attachment.bin>


More information about the llvm-commits mailing list