Files
clang-p2996/llvm/test/Analysis/LazyCallGraph/blockaddress.ll
Nikita Popov b569ec6de6 [SCCP] Infer nuw for gep nusw with non-negative offsets (#118819)
If the GEP is nusw/inbounds and has all-non-negative offsets infer nuw
as well.

This doesn't have measurable compile-time impact.

Proof: https://alive2.llvm.org/ce/z/ihztLy
2024-12-06 09:52:32 +01:00

29 lines
914 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes="cgscc(function(sccp,simplifycfg))" < %s -S | FileCheck %s
define i32 @baz(i32 %y, i1 %b) {
; CHECK-LABEL: @baz(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[B:%.*]], label [[LAB:%.*]], label [[FOR_COND:%.*]]
; CHECK: for.cond:
; CHECK-NEXT: [[P_0:%.*]] = phi ptr [ null, [[FOR_COND]] ], [ blockaddress(@baz, [[LAB]]), [[ENTRY:%.*]] ]
; CHECK-NEXT: [[INCDEC_PTR:%.*]] = getelementptr inbounds nuw i8, ptr [[P_0]], i64 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: lab:
; CHECK-NEXT: ret i32 0
;
entry:
br i1 %b, label %lab, label %for.cond.preheader
for.cond.preheader:
br label %for.cond
for.cond:
%p.0 = phi ptr [ null, %for.cond ], [ blockaddress(@baz, %lab), %for.cond.preheader ]
%incdec.ptr = getelementptr inbounds i8, ptr %p.0, i64 1
br label %for.cond
lab:
ret i32 0
}