Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/apint-and-or-and.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

51 lines
1.2 KiB
LLVM

; If we have an 'and' of the result of an 'or', and one of the 'or' operands
; cannot have contributed any of the resultant bits, delete the or. This
; occurs for very common C/C++ code like this:
;
; struct foo { int A : 16; int B : 16; };
; void test(struct foo *F, int X, int Y) {
; F->A = X; F->B = Y;
; }
;
; Which corresponds to test1.
;
; This tests arbitrary precision integers.
; RUN: opt < %s -passes=instcombine -S | not grep "or "
; END.
define i17 @test1(i17 %X, i17 %Y) {
%A = and i17 %X, 7
%B = and i17 %Y, 8
%C = or i17 %A, %B
%D = and i17 %C, 7 ;; This cannot include any bits from %Y!
ret i17 %D
}
define i49 @test3(i49 %X, i49 %Y) {
%B = shl i49 %Y, 1
%C = or i49 %X, %B
%D = and i49 %C, 1 ;; This cannot include any bits from %Y!
ret i49 %D
}
define i67 @test4(i67 %X, i67 %Y) {
%B = lshr i67 %Y, 66
%C = or i67 %X, %B
%D = and i67 %C, 2 ;; This cannot include any bits from %Y!
ret i67 %D
}
define i231 @or_test1(i231 %X, i231 %Y) {
%A = and i231 %X, 1
%B = or i231 %A, 1 ;; This cannot include any bits from X!
ret i231 %B
}
define i7 @or_test2(i7 %X, i7 %Y) {
%A = shl i7 %X, 6
%B = or i7 %A, 64 ;; This cannot include any bits from X!
ret i7 %B
}