This PR removes the old `nocapture` attribute, replacing it with the new `captures` attribute introduced in #116990. This change is intended to be essentially NFC, replacing existing uses of `nocapture` with `captures(none)` without adding any new analysis capabilities. Making use of non-`none` values is left for a followup. Some notes: * `nocapture` will be upgraded to `captures(none)` by the bitcode reader. * `nocapture` will also be upgraded by the textual IR reader. This is to make it easier to use old IR files and somewhat reduce the test churn in this PR. * Helper APIs like `doesNotCapture()` will check for `captures(none)`. * MLIR import will convert `captures(none)` into an `llvm.nocapture` attribute. The representation in the LLVM IR dialect should be updated separately.
20 lines
772 B
LLVM
20 lines
772 B
LLVM
; RUN: opt %s -passes=instcombine -mtriple=riscv64-unknown-linux-gnu -S | FileCheck %s
|
|
|
|
declare signext i32 @memcmp(ptr, ptr, i64)
|
|
|
|
; Make sure we use signext attribute for the bcmp result.
|
|
define signext i32 @test_bcmp(ptr %mem1, ptr %mem2, i64 %size) {
|
|
; CHECK-LABEL: define {{[^@]+}}@test_bcmp(
|
|
; CHECK-NEXT: [[BCMP:%.*]] = call i32 @bcmp(ptr [[MEM1:%.*]], ptr [[MEM2:%.*]], i64 [[SIZE:%.*]])
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[BCMP]], 0
|
|
; CHECK-NEXT: [[ZEXT:%.*]] = zext i1 [[CMP]] to i32
|
|
; CHECK-NEXT: ret i32 [[ZEXT]]
|
|
;
|
|
%call = call signext i32 @memcmp(ptr %mem1, ptr %mem2, i64 %size)
|
|
%cmp = icmp eq i32 %call, 0
|
|
%zext = zext i1 %cmp to i32
|
|
ret i32 %zext
|
|
}
|
|
|
|
; CHECK: declare signext i32 @bcmp(ptr captures(none), ptr captures(none), i64)
|