aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
diff options
context:
space:
mode:
authorThéo Degioanni <theo.degioanni@nextsilicon.com>2023-07-03 10:48:16 +0200
committerThéo Degioanni <theo.degioanni@nextsilicon.com>2023-07-03 11:12:39 +0200
commitfb047e4ae1b2a17ed068d560f94cc8e9fd94d0e6 (patch)
tree9582c2bf75d99cea8f295e4d300ed8fd39448391 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
parentdb32d11a386ed20bb44448e671a641cc895d65f8 (diff)
downloadllvm-fb047e4ae1b2a17ed068d560f94cc8e9fd94d0e6.zip
llvm-fb047e4ae1b2a17ed068d560f94cc8e9fd94d0e6.tar.gz
llvm-fb047e4ae1b2a17ed068d560f94cc8e9fd94d0e6.tar.bz2
[mlir][llvm] Type consistency transformations
This revision introduces new rewrites to improve the type consistency of a program expressed in the LLVM dialect. Type consistency means that a given opaque pointer is consistently used assuming the same pointee type, in a best effort basis. The introduced rewrites modify the program to improve type consistency while preserving the same semantics. This is useful for two main reasons: - Transformation passes in the LLVM dialect like SROA or Mem2Reg can analyse code better if type information and structure is used in a consistent manner. Opaque pointers make this difficult to enforce, but type consistency improvements increase the amount of occurences where reasonable analysis can pick up on transformable patterns. - While LLVM IR is not particularly picky about inconsistent type uses, it may be of interest to lift LLVM IR into higher level dialects. Having more instances of consistent type information would help lifting into dialects that do care about consistent types. In order to detect cases of inconsistent uses, operations returning an LLVMPointer can implement the GetResultPtrElementType interface, which allows getting a hint of which type the provided pointer should see its pointee as, if such hint is available. The provided rewrites will then use this hint to attempt to modify operations using the pointers so they use the hinted type when dealing with the pointer. Two transformations have been implemented in this revision: - When a load/store uses a struct ptr directly to write to the first element of the struct, introduce a GEP to the first element so the type structure is preserved. - When a GEP statically indexes in a pointer with a base type inconsistent with the hint, try to find indices using the hint as a base type that would result in the same offset, and replace the GEP with this indexing. More transformations are possible and I hope this is only a beginning for this simplification effort. Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D153973
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h')
0 files changed, 0 insertions, 0 deletions