1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -passes='instcombine' -S < %s | FileCheck %s 3 4define target("aarch64.svcount") @test_alloca_store_reload(target("aarch64.svcount") %val) nounwind { 5; CHECK-LABEL: @test_alloca_store_reload( 6; CHECK-NEXT: ret target("aarch64.svcount") [[VAL:%.*]] 7; 8 %ptr = alloca target("aarch64.svcount"), align 1 9 store target("aarch64.svcount") %val, ptr %ptr 10 %res = load target("aarch64.svcount"), ptr %ptr 11 ret target("aarch64.svcount") %res 12} 13 14; Test that instcombine doesn't try to query the (scalable) size of target("aarch64.svcount") 15; in foldSelectInstWithICmp. 16define target("aarch64.svcount") @test_combine_on_select(target("aarch64.svcount") %x, target("aarch64.svcount") %y, i32 %k) { 17; CHECK-LABEL: @test_combine_on_select( 18; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[K:%.*]], 42 19; CHECK-NEXT: [[X_Y:%.*]] = select i1 [[CMP]], target("aarch64.svcount") [[X:%.*]], target("aarch64.svcount") [[Y:%.*]] 20; CHECK-NEXT: ret target("aarch64.svcount") [[X_Y]] 21; 22 %cmp = icmp sgt i32 %k, 42 23 %x.y = select i1 %cmp, target("aarch64.svcount") %x, target("aarch64.svcount") %y 24 ret target("aarch64.svcount") %x.y 25} 26