-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SandboxIR] Add pointer-diff utility function #110176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
240 commits
Select commit
Hold shift + click to select a range
cba50ef
[SandboxIR] Add pointer-diff utility function.
Sterling-Augustine c210047
Address comments
Sterling-Augustine 910caea
[mlir][scf] Fix loop iteration calculation for negative step in LoopP…
sjw36 6280035
[SandboxIR] Implement Module (#109716)
9d15da5
[gn build] Port 7e5df5bcc3be
llvmgnsyncbot 031161e
[BOLT][merge-fdata] Initialize YAML profile header (#109613)
maksfb 2405d6a
[sanitizer] Extract SANITIZER_FREEBSD version of ThreadDescriptorSize…
vitalybuka d2609d6
[llvm][cmake] Do not emit error on `libc`'s use of project + runtime …
jhuber6 bda7a74
[SLP]Initial support for non-power-of-2 (but still whole register) nu…
alexey-bataev dc1a266
[BOLT] Allow sections in --print-only flag (#109622)
maksfb 275c57d
[ctx_prof] Simple ICP criteria during module inliner (#109881)
mtrofin 79f6901
[libc] Fix %m on CPUs with float128 but no int128 (#110053)
michaelrj-google 53fa037
[libc] Fix errno_macros.h include paths. (#110057)
michaelrj-google 7995061
[SandboxIR] Add more functions to sandboxir:Instruction class. (#110050)
tmsri c9c1810
[VPlan] Implement VPWidenLoad/StoreEVLRecipe::computeCost(). (#109644)
ElvisWang123 04c90f1
[Lint][AMDGPU] No store to const addrspace (#109181)
jofrn c44741e
[RISCV] Reuse Factor variable instead of hardcoding 2 in other places…
topperc 131c020
[SandboxIR] Fix failing unittest introduced by 51039101cf32
425a399
[NVPTX] Support !"cluster_dim_{x,y,z}" metadata (#109548)
AlexMaclean 33b678c
[SandboxIR][NFC] Move Context class into a separate file (#110049)
6d98e45
[gn build] Port 165a912807ee
llvmgnsyncbot d9927df
[AMDGPU] Move renamedInGFX9 from TableGen to SIInstrInfo helper funct…
CRobeck c1bd049
[libc] Fix missing dependency on the nvlink-wrapper (#110056)
jhuber6 41398fa
[SPIR-V][NFC] More efficient getPaddedLen (#105823)
bwlodarcz 996c0f3
[SPIR-V] Support for multiple DebugCompilationUnit in DI (#109645)
bwlodarcz b88d4ce
[Clang] Bugfixes and improved support for `AttributedType`s in lambda…
Sirraide 4702aae
[nfc][ctx_prof] Remove unnecessary include
mtrofin 499a895
[Clang] Set target in test (#110068)
Sirraide e41dad3
[BOLT] Fix tests broken by abe0dd1 (#110071)
tex3d b1fdcd8
[X86][IPRA] Add getIPRACSRegs since frame registers are risked to be …
FreddyLeaf 3e9c2f6
[X86] Fix missing immediate qualifier in #108593 (#110072)
phoebewang e86209e
[lldb] fix one-off error in vformat specifier
jasonmolenda 8afa3de
[RISCV] Minor cleanups to lowerInterleaveIntrinsicToStore and lowerDe…
topperc 21e6a0a
[lldb] [Mach-O corefiles] Sanity check malformed dyld
jasonmolenda 7d4742f
Reapply "Deprecate the `-fbasic-block-sections=labels` option." (#110…
rlavaee e54ae3c
[ELF] Pass Ctx & to Driver
MaskRay ba38c92
[AMDGPU] Merge the conditions used for deciding CS spills for amdgpu_…
cdevadas 3c95326
[mlir][LLVM] Add operand bundle support (#108933)
Lancern c0ff3ae
[mlir] Fix a warning
kazutakahirata 1777605
[TSan] fix the module map of main executable on darwin platforms (#10…
pudge62 d48388e
[clang][bytecode][NFC] Remove a useless cast
tbaederr a0d8b51
[clang][analyzer] FixedAddressChecker: no warning if system macro is …
balazske e3ea7b3
[clang] [Modules] Don't assume an overriden module file can not be ou…
ChuanqiXu9 b8bb874
[AArch64] Update and regenerate f16-instructions.ll. NFC
davemgreen c3b13af
[DebugInfo] Don't emit .loc directive with all values zero (#109978)
ostannard 3e838a1
[MLIR][Transform] Hoist Pad generates linalg.transpose (#109669)
nujaa e398058
[LLD][COFF] Add support for ARM64EC import call thunks with extended …
cjacek db4f031
[SPIR-V] Allow intrinsics with aggregate return type to reach GlobalI…
VyacheslavLevytskyy a6d5647
[AArch64][GlobalISel] Regenerate legalize-fp-arith-fp16.mir. NFC
davemgreen 70e1391
[flang][debug] Allow variable length for dummy char arguments. (#109448)
abidh b75fa37
[flang] add fir.proc_attrs attributes to func.func (#110002)
jeanPerier 9befaba
[NFC] Reapply 3f37c517f, SmallDenseMap speedups
jmorse 9b0c0ff
Revert "[clang] Extend diagnose_if to accept more detailed warning in…
kadircet 6f1b507
[flang][OpenMP] Delayed privatization MLIR lowering support for `dist…
ergawy 5a17b1d
[clang][RISCV] Introduce command line options for RISC-V Zicfilp CFI
mylai-mtk a7da534
[VPlan] Remove duplicated ExtractFromEnd handling from unoll (NFC).
fhahn 6784dba
[lldb][AArch64] Add register fields for the fpmr register (#109934)
DavidSpickett c4f127d
[clang][bytecode] Don't call dtors of anonymous unions (#110087)
tbaederr 581f2cc
[SLP]Fix a crash when trying to identify one source order
alexey-bataev 5bcf414
[SCEV] Add tests with non-power-of-2 steps for #108777.
fhahn 2f40c44
[analyzer] Moving TaintPropagation checker out of alpha (#67352)
dkrupp b0326ba
[lldb][AArch64] Fix crash loading core files on 32 bit systems
DavidSpickett c870a82
[llvm][ARM][NFC] Renaming FeaturePrefLoopAlignment (#109932)
nasherm 35999e7
[analyzer] [MallocChecker] Assume functions with `ownership_returns` …
pskrgag dbb2a59
[clang-tidy] Add user-defined functions to `bugprone-unsafe-function…
Discookie f8ea07b
[clangd] Add some regression tests for clang-tidy finding severities
kadircet c56a942
[clang][CodeGen][SPIR-V] Fix incorrect SYCL usage, implement missing …
AlexVlx 49a926b
[RISCV][NFC] Fix typo: ILP64E => LP64E
asb 3a39ecf
[llvm][docs] Convert LLVM release notes to Markdown (#109107)
DavidSpickett eed075e
[AMDGPU] Implement isSDNodeAlwaysUniform for INTRINSIC_W_CHAIN (#110114)
jayfoad 668caaa
[MLIR][GPU] Lower subgroup query ops in gpu-to-llvm-spv (#108839)
FMarno 7dd0d13
[flang][Frontend] Move LangOptions from Frontend to Common (#110012)
kparzysz ed7f100
[flang][Semantics] Add LangOptions to SemanticsContext (#110013)
kparzysz 6dc9f69
[flang][OpenMP] Add version checks for clauses (#110015)
kparzysz d94ad93
[SimplifyCFG] Add additional store speculation tests (NFC)
nikic cfb62e3
[libc] Fix 'fgets' test on the GPU for some C libraries (#110118)
jhuber6 bef4cfe
[LLVM][TableGen] Change InstrInfoEmitter to use const RecordKeeper (#…
jurahul 3d97e75
[llvm-dis][NFC] Avoid unnecessary copies while iterating (#109860)
AmrDeveloper cfe206e
[clang][bytecode] Add a source location to destructor calls (#110121)
tbaederr 41b0431
[CodeGen] Avoid repeated hash lookups (NFC) (#110074)
kazutakahirata f6ac7c2
[Mips] Avoid repeated map lookups (NFC) (#110075)
kazutakahirata a914c7a
[Coroutines] Avoid repeated hash lookps (NFC) (#110076)
kazutakahirata 50211f4
[X86] Avoid repeated hash lookups (NFC) (#110077)
kazutakahirata 880fc1c
ValueTracking/test: cover known-high-bits of rem (#109006)
artagnon e4e017e
[mlir][Linalg] Refine how broadcast dims are treated (#99015)
banach-space 8a8f14e
[mlir][tensor] Refine the semantics of `createPadHighOp` (#109667)
banach-space 3d570e8
[AArch64] Implement NEON vscale intrinsics (#100347)
Lukacma 9d161db
Fix "[AArch64] Implement NEON vscale intrinsics" (#110136)
Lukacma 98c0c75
[lldb] Don't flush llvm::raw_string_ostream (NFC) (#110128)
JOE1994 0c0b52f
[Driver][test] Replace legacy -target with --target=
MaskRay 670eb8c
[mlir] Use std::optional::value_or (NFC) (#109893)
kazutakahirata 85bc57b
[Flang][Offload][Tests] Set default OpenMP version to 5.2 (52) (#110138)
agozillon e8a3c35
[libc++][modules] Rewrite the modulemap to have fewer top-level modul…
ldionne 05425c2
[NFC][CodeLayout] Remove unused parameter (#110145)
ellishg d700a02
[rtsan] Only print out unique stack traces (#110028)
cjappl 022d52d
[NFC] [Flang] [Semantics] [OpenMP] Fix typo in error message. (#110147)
raghavendhra e749565
[mlir] Improvements to the 'quant' dialect (#100667)
rafaelubalmw c0608b0
Use %errc to get text for system errors (#109852)
perry-ca a236280
[VPlan] Unify mayWriteToMemory and mayHaveSideEffects logic for VPInst.
fhahn fda9766
[llvm] use 64-bit types for result of getDwarfRegNum (NFC) (#109494)
willghatch 1cfebe6
[NVPTX] add support for encoding PTX registers for DWARF (#109495)
willghatch e454e00
[OpenMP] Add critical region lock for NVPTX targets (#110148)
jhuber6 71f3eca
[SandboxIR][NFC] Move Value class into a separate file (#110059)
b99c48b
[gn build] Port c5b417c4f604
llvmgnsyncbot c791604
[flang][Driver] Support -fdiagnostics-color
tarunprabhu 2cf6df5
[MLIR][SCF] Fold dim ops of iter_args to respective init_args (#109973)
pashu123 977d80e
[MLIR] Add MLIRConversionPassIncGen to cmake deps for FrozenRewritePa…
leonardt 30f0df4
[MC, NVPTX] Fix warnings
kazutakahirata 6546c8a
Revert "[mlir][tensor] Refine the semantics of `createPadHighOp`" (#1…
hanhanW 610e48f
[SLP]Use number of scalars as a vector length for minbw cast
alexey-bataev e342c3d
Update input names from input to input1 for Table, Reverse, Slice (#1…
Jerry-Ge 525cf28
[llvm] Replace uses of Type::getPointerTo() (NFC) (#110163)
JOE1994 c4bc73a
[lldb] Fix minor runCmd error message formatting (#110150)
kastiglione 340a30f
Reapply "[MemProf] Streamline and avoid unnecessary context id duplic…
teresajohnson 0da32fa
[LLVM][TableGen] Change DXILEmitter to use const Record pointers (#11…
jurahul 7bf9925
[HLSL] Remove `__builtin_hlsl_create_handle` (#109910)
hekota 8029b33
Update BUILD.bazel (#110170)
norx1991 26cde9b
[DirectX] Data Scalarization of Vectors in Global Scope (#110029)
farzonl 924f56f
Fix BUILD.bazel error (#110172)
norx1991 53cd952
[SandboxIR][NFC] Move User into a separate file (#110157)
b04e524
[gn build] Port 7a2c5c69ce01
llvmgnsyncbot 21c2240
[LLDB][Minidump] Add Multiplatform test to ensure determinism (#108602)
Jlalond c2c6388
[HLSL] Allow resource type attributes only on `__hlsl_resource_t` (#1…
hekota d560303
[SandboxIR][NFC] Move Region from SandboxVectorizer to SandboxIR. (#1…
slackito 79a63d8
Revert "[SandboxIR][NFC] Move Region from SandboxVectorizer to Sandbo…
slackito 1633a43
[SPIRV] Add atan2 function lowering (p2) (#110037)
tex3d 87d09d4
[mlir] NFC: Fix layering check / parse headers violations (#110117)
googlewalt 73b1eb3
[clang] implement current direction of CWG2765 for string literal com…
zygoloid e60a7bc
[bazel][SandboxIR] Add cc_test rule for SandboxIR tests. (#110184)
slackito b10fec1
[SandboxIR][NFC] Move Argument into a separate file (#110174)
c471ee4
[gn build] Port 14afac0d1a5d
llvmgnsyncbot 8441270
[HLSL] Vector Usual Arithmetic Conversions (#108659)
llvm-beanz 0a62d9f
[RISCV] Handle f16/bf16 extract_vector_elt when scalar type is legal …
lukel97 cceabf6
Revert "[HLSL] Vector Usual Arithmetic Conversions" (#110191)
llvm-beanz e94be78
[SandboxVec][Interval] Convert InstrInterval class to a class templat…
e46f1ef
[SandboxIR][NFC] Move Constant and derived classes into a separate fi…
ddd7fc5
[gn build] Port 049fc920e631
llvmgnsyncbot 16d02e0
[gn build] Port 3c66a51054d7
llvmgnsyncbot ddc1f9a
Reapply "[SandboxIR][NFC] Move Region from SandboxVectorizer to Sandb…
slackito a58ba84
[gn build] Port 9efc761d4249
llvmgnsyncbot 30836d6
[WebAssembly] Unify type checking in AsmTypeCheck (#110094)
aheejin 66fc44e
[RISCV] Fold vfmv.f.s into load from stack (#110129)
lukel97 800c002
[mlir][linalg] fix segmentation fault in isContractionBody function (…
3bf02ee
[nvlink-wrapper] Use a symbolic link instead of copying the file (#11…
jhuber6 1e48e06
[NVPTX] add address class for variables with a single register locati…
willghatch 5912fc9
[WebAssembly] Update type checker message in notypecheck.s
aheejin 804efae
[clang-tidy][bugprone-posix-return] support integer literals as LHS (…
HerrCai0907 8aca558
[rtsan][NFC] Remove unncessary namespace specifiers (#110197)
cjappl 7e192e3
[DWARF] Don't emit DWARF5 symbols for DWARF2/3 + non-lldb (#110120)
linsinan1995 e44ae80
[clang][bytecode] Refuse to contruct objects with virtual bases (#110…
tbaederr 3238a12
[libc++][NFC] Rename fold.h to ranges_fold.h (#109696)
ldionne e8fb5c6
[RISCV] Software guard direct calls in large code model (#109377)
jaidTw cdcddf6
[gn build] Port 24bc3244d4e2
llvmgnsyncbot 9e24c18
[alpha.webkit.UncountedCallArgsChecker] Use canonical type (#109393)
rniwa b1c73e8
[AArch64] Use MCRegister. NFC
topperc 98ac59b
[RISCV] Add 16 bit GPR sub-register for Zhinx. (#107446)
topperc e2bc4cd
[llvm][cmake] Properly place clang runtime directory on linker comman…
glandium d7a9fe8
[LLVM][NFC] Remove redundant copy parameter in lambda (#110156)
AmrDeveloper 2a513a4
[C++20][Modules] Fix non-determinism in serialized AST (#110131)
dmpolukhin e1ba42b
[AArch64][GlobalISel] Lower fp16 abs and neg without fullfp16. (#110096)
davemgreen fbbe43d
[MCJIT][ORC] Change test guards to 'UNSUPPORTED: system-darwin'.
lhames fdb714b
WebKit Checkers should set DeclWithIssue. (#109389)
rniwa b620f43
[clang] return first Decl for CanonicalDecl in TranslationUnitDecl (#…
Vipul-Cariappa 30c7bcd
[clang][CGExpr] Avoid Type::getPointerTo() (NFC) (#110209)
JOE1994 ebd82f1
[alpha.webkit.NoUncheckedPtrMemberChecker] Introduce member variable …
rniwa d518788
[LangRef] Disallow accessing byval arguments from tail-called functio…
ostannard 92d0f8d
[AMDGPU][SIPreEmitPeephole][NFC] remove useless declaration in test
jmmartinez 81029c5
[clang][bytecode] Start implementing fixed point types (#110216)
tbaederr 9dfe86e
Fix LLVM_ENABLE_ABI_BREAKING_CHECKS macro check: use #if instead of #…
joker-eph cb8ad32
[AArch64] Factor out the emission of MOV and MOVZ/MOVK instructions (…
atrosinenko a94e10c
LICM: hoist BO assoc for FAdd and FMul (#108415)
artagnon c3bee3a
[ArgPromotion] Perform alias analysis on actual arguments of Calls (#…
hazzlim c63bad4
[Nomination] Update Intel representation in the security group (#109281)
wphuhn-intel e857c73
KnownBits: refine srem for high-bits (#109121)
artagnon 4bcce92
[clang][test] add TestLanguage.def to specify all tested language ver…
5chmidti bbf6eb3
[SLP]Look for vector user when estimating the cost
alexey-bataev dce7424
[clang][test] remove unused `run` overload in `BoundNodesCallback` (#…
5chmidti 8413d18
[clang][bytecode] Implement fixed point negation (#110237)
tbaederr 40ecb4e
[clang][test] add testing for the AST matcher reference (#94248)
5chmidti 125c696
[MLIR] Dump sass (#110227)
grypp 73c13f1
Revert "[clang][test] add testing for the AST matcher reference (#942…
5chmidti be2f01e
[LV] Vectorize histogram operations (#99851)
huntergr-arm 9ba78f4
[ADT] Add more useful methods to SmallSet API (#108601)
vhscampos 4166d23
Reland "[NVPTX] deprecate nvvm.rotate.* intrinsics, cleanup funnel-sh…
AlexMaclean 9198cde
[lldb][Docs] Convert AArch64 Linux doc to Markdown
DavidSpickett 754ff3b
[libc++] Add an ABI setting to harden unique_ptr<T[]>::operator[] (#9…
ldionne 920b0d3
[libc++] Add availability mapping for LLVM 18 on Apple platforms (#11…
ldionne 398f134
[libc++] Fix AppleClang version number when checking for __builtin_ve…
ldionne 2028330
[gn build] Port 45a09d1811d5
llvmgnsyncbot afbb8fd
[libunwind][CMake] Remove LIBUNWIND_BUILD_32_BITS which has been an e…
ldionne f0c2d26
[libunwind] Introduce LIBUNWIND_LIBRARY_VERSION and drop outdated App…
ldionne 6d35507
[AMDGPU] Overload resource descriptor in image intrinsics. (#107255)
sstipano 9e56ccc
[BranchRelaxation] Remove quadratic behavior in relaxation pass (#96250)
dhoekwater bb39af2
[LLVM][TableGen] Change a few emitters to use const Record pointers (…
jurahul 3e584e4
[MemCpyOpt] Use BatchAA in one more place (NFCI)
nikic 498087d
[RISCV][TTI] Avoid an infinite recursion issue in getCastInstrCost (#…
preames 08866fd
[libc] Fix memory leak and accidentally ignoring dimensions in loader
jhuber6 e799269
[MemCpyOpt] Add additional tests for earliest escape (NFC)
nikic 9a122c1
[flang][driver] Make the -J option less restrictive so we would not h…
pawosm-arm 8b85630
[mlir] Refactor LegalizeToF32 to specify extra supported float types…
dhernandez0 a4778ec
[nfc][ctx_prof] Efficient profile traversal and update (#110052)
mtrofin b161fd2
[Bazel] Port 5e9813667958688f5ab0e0b776b509b2b909d1e4
619eb8b
[FMV][AArch64] Remove feature sha1 from FMV. (#108383)
labrinea 36c9b90
[mlir][vector] Add pattern for dropping unit dims from for loops (#10…
qedawkins cd2f52b
[clang][bytecode] Don't produce a null type when checking new exprs (…
tbaederr bacb4e9
[compiler-rt][FMV][AArch64] Remove sha1 from fuchsia and apple target…
labrinea 79647a4
[Flang][Driver][Offload] Support -Xoffload-linker argument in Flang (…
agozillon 473e810
Fix issues with GlobalMerge on Mach-O. (#110046)
jyknight 9613bd5
[Bazel] Port 7dfdca1961aadc75ca397818bfb9bd32f1879248
f58749d
[SandboxIR][NFC] Move BasicBlock class into a separate file (#110194)
c164f32
[bazel] Fix mlir build (#110293)
keith 0a81ecd
Update contact email address
MaskRay ff466ce
[clang][bytecode] Implement zero-init for fixed point types (#110257)
tbaederr 4f3581b
Add docs describing how the thread plan stack affects stepping (#110167)
jimingham 5620cc4
[gn build] Port 491375cc4eb2
llvmgnsyncbot f4012da
[clang][test] add testing for the AST matcher reference (#110258)
5chmidti 9d757af
[libc++] LWG4025: Move assignment operator of `std::expected<cv void,…
xiaoyang-sde 79a29c6
[libclang/python] Improve test coverage (#109846)
DeinAlptraum f582280
[rtsan] Fix comment in fcntl, fix va_args type (#108440)
cjappl 47e5bba
[nvlink-wrapper] Remove use of symlinks
jhuber6 06072fe
[AMDGPU][MC] Implement fft and rotate modes for ds_swizzle_b32 (#108064)
jwanggit86 7044efd
[RISCV][TTI] Adjust constant materialization cost for (z/s)ext from i…
preames 89ad77e
[SandboxIR][NFC] Move Instruction classes into a separate file (#110294)
746ee2a
[gn build] Port eba106d461f7
llvmgnsyncbot f50c950
InstCombine/Demanded: simplify srem case (NFC) (#110260)
artagnon 1d3dd08
VPlan/PatternMatch: mark match functions const (NFC) (#108191)
artagnon b2718d8
Revert "Fix LLVM_ENABLE_ABI_BREAKING_CHECKS macro check: use #if inst…
joker-eph b072111
[MemProf] Refactor context node creation into a new helper (NFC) (#10…
teresajohnson c2af11d
[LV] Remove noalias intrinsics handling from scalarizeInstruction (NFC).
fhahn 06f1889
[SandboxIR][NFC] Delete SandboxIR.h (#110309)
6c9d4ab
Revert "[SandboxIR][NFC] Delete SandboxIR.h (#110309)"
84fb022
[SLP]Check if number of elements forms a full register
alexey-bataev b76743e
[SCEV] Re-organize tests requiring remainder predicates.
fhahn 1f26a95
[libc++][Apple] Add missing availabilty mappings for Apple platforms …
ldionne 561ec92
[libc++] Don't use aligned_alloc on iOS versions before 13 (#110315)
Un1q32 2ab2a86
[libclang/python] Do not rely on `ctypes`' `errcheck` (#105490)
DeinAlptraum ca0ffdd
Reapply "[SandboxIR][NFC] Delete SandboxIR.h (#110309)"
a351d17
[mlir] Avoid Type::getPointerTo() (NFC)
JOE1994 99bd6d6
[SandboxIR] Add pointer-diff utility function.
Sterling-Augustine d036f43
Merge and address comments
Sterling-Augustine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,14 @@ | |
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "llvm/SandboxIR/Utils.h" | ||
| #include "llvm/Analysis/AssumptionCache.h" | ||
| #include "llvm/Analysis/BasicAliasAnalysis.h" | ||
| #include "llvm/Analysis/LoopInfo.h" | ||
| #include "llvm/Analysis/TargetLibraryInfo.h" | ||
| #include "llvm/AsmParser/Parser.h" | ||
| #include "llvm/IR/BasicBlock.h" | ||
| #include "llvm/IR/DataLayout.h" | ||
| #include "llvm/IR/Dominators.h" | ||
| #include "llvm/IR/Function.h" | ||
| #include "llvm/IR/Instruction.h" | ||
| #include "llvm/IR/Module.h" | ||
|
|
@@ -54,3 +59,77 @@ define void @foo(ptr %arg0) { | |
| EXPECT_EQ(sandboxir::Utils::memoryLocationGetOrNone(Ld), | ||
| MemoryLocation::getOrNone(LLVMLd)); | ||
| } | ||
|
|
||
| TEST_F(UtilsTest, GetPointerDiffInBytes) { | ||
| parseIR(C, R"IR( | ||
| define void @foo(ptr %ptr) { | ||
| %gep0 = getelementptr inbounds float, ptr %ptr, i64 0 | ||
| %gep1 = getelementptr inbounds float, ptr %ptr, i64 1 | ||
| %gep2 = getelementptr inbounds float, ptr %ptr, i64 2 | ||
| %gep3 = getelementptr inbounds float, ptr %ptr, i64 3 | ||
|
|
||
| %ld0 = load float, ptr %gep0 | ||
| %ld1 = load float, ptr %gep1 | ||
| %ld2 = load float, ptr %gep2 | ||
| %ld3 = load float, ptr %gep3 | ||
|
|
||
| %v2ld0 = load <2 x float>, ptr %gep0 | ||
| %v2ld1 = load <2 x float>, ptr %gep1 | ||
| %v2ld2 = load <2 x float>, ptr %gep2 | ||
| %v2ld3 = load <2 x float>, ptr %gep3 | ||
|
|
||
| %v3ld0 = load <3 x float>, ptr %gep0 | ||
| %v3ld1 = load <3 x float>, ptr %gep1 | ||
| %v3ld2 = load <3 x float>, ptr %gep2 | ||
| %v3ld3 = load <3 x float>, ptr %gep3 | ||
| ret void | ||
| } | ||
| )IR"); | ||
| llvm::Function &LLVMF = *M->getFunction("foo"); | ||
| DominatorTree DT(LLVMF); | ||
| TargetLibraryInfoImpl TLII; | ||
| TargetLibraryInfo TLI(TLII); | ||
| DataLayout DL(M->getDataLayout()); | ||
| AssumptionCache AC(LLVMF); | ||
| BasicAAResult BAA(DL, LLVMF, TLI, AC, &DT); | ||
| AAResults AA(TLI); | ||
| AA.addAAResult(BAA); | ||
| LoopInfo LI(DT); | ||
| ScalarEvolution SE(LLVMF, TLI, AC, DT, LI); | ||
| sandboxir::Context Ctx(C); | ||
|
|
||
| auto &F = *Ctx.createFunction(&LLVMF); | ||
| auto &BB = *F.begin(); | ||
| auto It = std::next(BB.begin(), 4); | ||
| auto *L0 = cast<sandboxir::LoadInst>(&*It++); | ||
| auto *L1 = cast<sandboxir::LoadInst>(&*It++); | ||
| auto *L2 = cast<sandboxir::LoadInst>(&*It++); | ||
| [[maybe_unused]] auto *L3 = cast<sandboxir::LoadInst>(&*It++); | ||
|
|
||
| auto *V2L0 = cast<sandboxir::LoadInst>(&*It++); | ||
| auto *V2L1 = cast<sandboxir::LoadInst>(&*It++); | ||
| auto *V2L2 = cast<sandboxir::LoadInst>(&*It++); | ||
| auto *V2L3 = cast<sandboxir::LoadInst>(&*It++); | ||
|
|
||
| [[maybe_unused]] auto *V3L0 = cast<sandboxir::LoadInst>(&*It++); | ||
| auto *V3L1 = cast<sandboxir::LoadInst>(&*It++); | ||
| [[maybe_unused]] auto *V3L2 = cast<sandboxir::LoadInst>(&*It++); | ||
| [[maybe_unused]] auto *V3L3 = cast<sandboxir::LoadInst>(&*It++); | ||
|
|
||
| // getPointerDiffInBytes | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(L0, L1, SE, DL), 4); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(L0, L2, SE, DL), 8); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(L1, L0, SE, DL), -4); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(L0, V2L0, SE, DL), 0); | ||
|
|
||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(L0, V2L1, SE, DL), 4); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(L0, V3L1, SE, DL), 4); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(V2L0, V2L2, SE, DL), 8); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(V2L0, V2L3, SE, DL), 12); | ||
| EXPECT_EQ(*sandboxir::Utils::getPointerDiffInBytes(V2L3, V2L0, SE, DL), -12); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about tests for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
|
||
| // atLowerAddress | ||
| EXPECT_TRUE(sandboxir::Utils::atLowerAddress(L0, L1, SE, DL)); | ||
| EXPECT_FALSE(sandboxir::Utils::atLowerAddress(L1, L0, SE, DL)); | ||
| EXPECT_FALSE(sandboxir::Utils::atLowerAddress(L3, V3L3, SE, DL)); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
std::is_same_v<LoadOrStoreT, LoadInst>to make it briefer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done