mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
8e51f27003
artifacts along with DCE Legalization Artifacts are all those insts that are there to make the type system happy. Currently, the target needs to say all combinations of extends and truncs are legal and there's no way of verifying that post legalization, we only have *truly* legal instructions. This patch changes roughly the legalization algorithm to process all illegal insts at one go, and then process all truncs/extends that were added to satisfy the type constraints separately trying to combine trivial cases until they converge. This has the added benefit that, the target legalizerinfo can only say which truncs and extends are okay and the artifact combiner would combine away other exts and truncs. Updated legalization algorithm to roughly the following pseudo code. WorkList Insts, Artifacts; collect_all_insts_and_artifacts(Insts, Artifacts); do { for (Inst in Insts) legalizeInstrStep(Inst, Insts, Artifacts); for (Artifact in Artifacts) tryCombineArtifact(Artifact, Insts, Artifacts); } while(!Insts.empty()); Also, wrote a simple wrapper equivalent to SetVector, except for erasing, it avoids moving all elements over by one and instead just nulls them out. llvm-svn: 318210
56 lines
1.9 KiB
YAML
56 lines
1.9 KiB
YAML
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
|
# RUN: llc -O0 -mtriple=aarch64-apple-ios -run-pass=legalizer -global-isel %s -o - | FileCheck %s
|
|
|
|
---
|
|
name: test_scalar_or_small
|
|
body: |
|
|
bb.0:
|
|
liveins: %x0, %x1, %x2, %x3
|
|
; CHECK-LABEL: name: test_scalar_or_small
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY %x0
|
|
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY %x1
|
|
; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
|
|
; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
|
|
; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[TRUNC]], [[TRUNC1]]
|
|
; CHECK: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[OR]](s32)
|
|
; CHECK: %x0 = COPY [[TRUNC2]](s8)
|
|
%0:_(s64) = COPY %x0
|
|
%1:_(s64) = COPY %x1
|
|
%2:_(s8) = G_TRUNC %0
|
|
%3:_(s8) = G_TRUNC %1
|
|
%4:_(s8) = G_OR %2, %3
|
|
%x0 = COPY %4
|
|
...
|
|
|
|
---
|
|
name: test_big_scalar_power_of_2
|
|
body: |
|
|
bb.0:
|
|
liveins: %x0, %x1, %x2, %x3
|
|
; We have a temporary G_MERGE_VALUES in the legalizer that gets
|
|
; cleaned up with the G_UNMERGE_VALUES, so we end up directly
|
|
; copying the results of the G_OR ops.
|
|
|
|
; CHECK-LABEL: name: test_big_scalar_power_of_2
|
|
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY %x0
|
|
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY %x1
|
|
; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY %x2
|
|
; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY %x3
|
|
; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[COPY2]]
|
|
; CHECK: [[OR1:%[0-9]+]]:_(s64) = G_OR [[COPY1]], [[COPY3]]
|
|
; CHECK: %x0 = COPY [[OR]](s64)
|
|
; CHECK: %x1 = COPY [[OR1]](s64)
|
|
; CHECK: RET_ReallyLR implicit %x0, implicit %x1
|
|
%0:_(s64) = COPY %x0
|
|
%1:_(s64) = COPY %x1
|
|
%2:_(s64) = COPY %x2
|
|
%3:_(s64) = COPY %x3
|
|
%4:_(s128) = G_MERGE_VALUES %0, %1
|
|
%5:_(s128) = G_MERGE_VALUES %2, %3
|
|
%6:_(s128) = G_OR %4, %5
|
|
%7:_(s64), %8:_(s64) = G_UNMERGE_VALUES %6
|
|
%x0 = COPY %7
|
|
%x1 = COPY %8
|
|
RET_ReallyLR implicit %x0, implicit %x1
|
|
...
|