Files
Florian Hahn a38bfad26b [LV] Update test to not have trivially simplify-able/dead instrs (NFC) (#195136)
Make a few tests more robust w.r.t. simplifications/DCE by adding users
and adjust a trivially simplify-able AND.
2026-04-30 18:18:06 +00:00

76 lines
2.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 6
; RUN: opt -S -passes=loop-vectorize < %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc18.0.0"
@sink = external global double
define void @test1() #0 personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: define void @test1(
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] personality ptr @__CxxFrameHandler3 {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: invoke void @_CxxThrowException(ptr null, ptr null)
; CHECK-NEXT: to label %[[UNREACHABLE:.*]] unwind label %[[CATCH_DISPATCH:.*]]
; CHECK: [[CATCH_DISPATCH]]:
; CHECK-NEXT: [[TMP0:%.*]] = catchswitch within none [label %[[CATCH:.*]]] unwind to caller
; CHECK: [[CATCH]]:
; CHECK-NEXT: [[TMP1:%.*]] = catchpad within [[TMP0]] [ptr null, i32 64, ptr null]
; CHECK-NEXT: br label %[[FOR_BODY:.*]]
; CHECK: [[FOR_BODY]]:
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
; CHECK: [[VECTOR_BODY]]:
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, %[[FOR_BODY]] ], [ [[INC:%.*]], %[[VECTOR_BODY]] ]
; CHECK-NEXT: [[TMP2:%.*]] = call <16 x double> @llvm.floor.v16f64(<16 x double> splat (double 1.000000e+00)) [ "funclet"(token [[TMP1]]) ]
; CHECK-NEXT: [[INC]] = add nuw i32 [[INDEX]], 16
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1024
; CHECK-NEXT: br i1 [[EXITCOND]], label %[[TRY_CONT:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
; CHECK: [[TRY_CONT]]:
; CHECK-NEXT: [[TMP4:%.*]] = extractelement <16 x double> [[TMP2]], i64 15
; CHECK-NEXT: br label %[[EXIT:.*]]
; CHECK: [[EXIT]]:
; CHECK-NEXT: store double [[TMP4]], ptr @sink, align 8
; CHECK-NEXT: catchret from [[TMP1]] to label %[[TRY_CONT1:.*]]
; CHECK: [[TRY_CONT1]]:
; CHECK-NEXT: ret void
; CHECK: [[UNREACHABLE]]:
; CHECK-NEXT: unreachable
;
entry:
invoke void @_CxxThrowException(ptr null, ptr null)
to label %unreachable unwind label %catch.dispatch
catch.dispatch:
%0 = catchswitch within none [label %catch] unwind to caller
catch:
%1 = catchpad within %0 [ptr null, i32 64, ptr null]
br label %loop
loop:
%iv = phi i32 [ 0, %catch ], [ %inc, %loop ]
%call = call double @floor(double 1.0) #1 [ "funclet"(token %1) ]
%inc = add nuw nsw i32 %iv, 1
%exitcond = icmp eq i32 %inc, 1024
br i1 %exitcond, label %exit, label %loop
exit:
store double %call, ptr @sink
catchret from %1 to label %try.cont
try.cont:
ret void
unreachable:
unreachable
}
declare x86_stdcallcc void @_CxxThrowException(ptr, ptr)
declare i32 @__CxxFrameHandler3(...)
declare double @floor(double) #1
attributes #0 = { "target-features"="+sse2" }
attributes #1 = { nounwind readnone }