[PATCH] D40730: Propagate IntrHasSideEffects into Attribute of Function

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 07:54:02 PST 2017


jonpa created this revision.
Herald added subscribers: javed.absar, mehdi_amini.

The SystemZ intrinsics int_s390_sfpc and int_s390_efpc do not touch memory, but they read/write non-modeled registers, and so demands the InstrHasSideEffects property.

I added it to the intrinsics definitions in IntrinsicsSystemZ.td, but found that this attribute does actually not get generated at all. It seems to only be used internally by Tablegen for sorting intrinsics.

Assuming this would be good to have, I made an attempt to fix this by trying to duplicate what is done for similar attributes.

This is quite some work, considering all the surrounding needed things like the bitcode reader/writer (not to mention tests), so I am not quite sure this is even worth the effort...

Before going further, I would appreciate some review on how this looks so far, and if this is even a welcome change.

NB: this is incomplete and it breaks things. For one thing the intrinsic is now simply erased by the DAGCombiner, and I assume this to be because it has now the IntrNoMem flag, while the DAGCombiner is not yet aware of the new Attribute. I wonder how many places would be needed to fix...

(bin/llc test/CodeGen/SystemZ/fpc-intrinsics.ll -mtriple=s390x-linux-gnu)


https://reviews.llvm.org/D40730

Files:
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/Attributes.td
  include/llvm/IR/Function.h
  include/llvm/IR/IntrinsicsSystemZ.td
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/IR/Attributes.cpp
  lib/IR/Verifier.cpp
  lib/Target/SystemZ/SystemZInstrFP.td
  utils/TableGen/IntrinsicEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40730.125144.patch
Type: text/x-patch
Size: 10108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171201/181760ef/attachment.bin>


More information about the llvm-commits mailing list