Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update diff December 23rd 2023, 3:18:28 pm #35

Open
github-actions bot opened this issue Dec 23, 2023 · 3 comments · May be fixed by llvm/llvm-project#76299
Open

Update diff December 23rd 2023, 3:18:28 pm #35

github-actions bot opened this issue Dec 23, 2023 · 3 comments · May be fixed by llvm/llvm-project#76299

Comments

@github-actions
Copy link
Contributor

from: llvm/llvm-project@ed6dc62
to: llvm/llvm-project@fbcf8a8
commit: ec93d04

Change Logs

from ed6dc6286264f0b6e94bb786a462d9975144ee7d to fbcf8a8cbb2461730bfd0603b396842925a88ef2

fbcf8a8cbb2461730bfd0603b396842925a88ef2 [ConstraintElim] Add (UGE, var, 0) to unsigned system for new vars. (#76262)

@dtcxzyw
Copy link
Owner

dtcxzyw commented Dec 23, 2023

; ModuleID = 'test.ll'
source_filename = "../../llvm-opt-benchmark/bench/velox/original/BaseVector.cpp.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.boost::intrusive_ptr" = type { ptr }
%"class.facebook::velox::Buffer" = type { ptr, ptr, ptr, i64, i64, %"struct.std::atomic", i8, [2 x i64] }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.std::_Optional_payload_base.330" = type <{ %"union.std::_Optional_payload_base<std::shared_ptr<void>>::_Storage", i8, [7 x i8] }>
%"union.std::_Optional_payload_base<std::shared_ptr<void>>::_Storage" = type { %"class.std::shared_ptr.69" }
%"class.std::shared_ptr.69" = type { %"class.std::__shared_ptr.70" }
%"class.std::__shared_ptr.70" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::_Sp_counted_base" = type { ptr, i32, i32 }

$_ZN8facebook5velox13AlignedBuffer10reallocateISt10shared_ptrIvEEEvPN5boost13intrusive_ptrINS0_6BufferEEEmRKSt8optionalIT_E = comdat any

@__libc_single_threaded = external local_unnamed_addr global i8, align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare void @_ZN8facebook5velox13AlignedBuffer8allocateISt10shared_ptrIvEEEN5boost13intrusive_ptrINS0_6BufferEEEmPNS0_6memory10MemoryPoolERKSt8optionalIT_E(ptr noalias sret(%"class.boost::intrusive_ptr") align 8, i64 noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define weak_odr void @_ZN8facebook5velox13AlignedBuffer10reallocateISt10shared_ptrIvEEEvPN5boost13intrusive_ptrINS0_6BufferEEEmRKSt8optionalIT_E(ptr noundef %buffer, i64 noundef %numElements, ptr noundef nonnull align 8 dereferenceable(24) %initValue) local_unnamed_addr #4 comdat align 2 personality ptr @__gxx_personality_v0 {
entry:
  %newBuffer = alloca %"class.boost::intrusive_ptr", align 8
  %0 = icmp ugt i64 %numElements, 1152921504606846975
  br i1 %0, label %if.then.i, label %_ZN8facebook5velox15checkedMultiplyImEET_RKS2_S4_PKc.exit

if.then.i:                                        ; preds = %entry
  tail call void @llvm.trap()
  unreachable

_ZN8facebook5velox15checkedMultiplyImEET_RKS2_S4_PKc.exit: ; preds = %entry
  %1 = shl nuw i64 %numElements, 4
  %2 = load ptr, ptr %buffer, align 8
  %tobool.not = icmp eq ptr %2, null
  br i1 %tobool.not, label %if.then, label %if.end

if.then:                                          ; preds = %_ZN8facebook5velox15checkedMultiplyImEET_RKS2_S4_PKc.exit
  tail call void @llvm.trap()
  unreachable

if.end:                                           ; preds = %_ZN8facebook5velox15checkedMultiplyImEET_RKS2_S4_PKc.exit
  %size_.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %2, i64 0, i32 3
  %3 = load i64, ptr %size_.i, align 8
  %cmp = icmp ugt i64 %1, %3
  br i1 %cmp, label %land.lhs.true, label %if.end13

land.lhs.true:                                    ; preds = %if.end
  %capacity_.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %2, i64 0, i32 4
  %4 = load i64, ptr %capacity_.i, align 8
  %cmp4 = icmp ult i64 %1, %4
  br i1 %cmp4, label %land.lhs.true5, label %if.end13

land.lhs.true5:                                   ; preds = %land.lhs.true
  %referenceCount_.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %2, i64 0, i32 5
  %5 = load atomic i32, ptr %referenceCount_.i seq_cst, align 4
  %cmp.i = icmp eq i32 %5, 1
  br i1 %cmp.i, label %if.then7, label %if.end13

if.then7:                                         ; preds = %land.lhs.true5
  %vtable = load ptr, ptr %2, align 8
  %vfn = getelementptr inbounds ptr, ptr %vtable, i64 3
  %6 = load ptr, ptr %vfn, align 8
  %call8 = tail call noundef zeroext i1 %6(ptr noundef nonnull align 8 dereferenceable(64) %2)
  br i1 %call8, label %if.then11, label %if.end12

if.then11:                                        ; preds = %if.then7
  tail call void @llvm.trap()
  unreachable

if.end12:                                         ; preds = %if.then7
  %7 = load i64, ptr %capacity_.i, align 8
  %cmp.not.i = icmp ult i64 %7, %1
  br i1 %cmp.not.i, label %if.then.i14, label %if.end.i

if.then.i14:                                      ; preds = %if.end12
  tail call void @llvm.trap()
  unreachable

if.end.i:                                         ; preds = %if.end12
  %cmp2.not.i = icmp ult i64 %1, %3
  br i1 %cmp2.not.i, label %if.then4.i, label %if.end9.i

if.then4.i:                                       ; preds = %if.end.i
  tail call void @llvm.trap()
  unreachable

if.end9.i:                                        ; preds = %if.end.i
  %rem10.i = and i64 %3, 15
  %cmp11.not.i = icmp eq i64 %rem10.i, 0
  br i1 %cmp11.not.i, label %if.end14.i, label %if.then13.i

if.then13.i:                                      ; preds = %if.end9.i
  tail call void @llvm.trap()
  unreachable

if.end14.i:                                       ; preds = %if.end9.i
  %vtable.i.i = load ptr, ptr %2, align 8
  %vfn.i.i = getelementptr inbounds ptr, ptr %vtable.i.i, i64 3
  %8 = load ptr, ptr %vfn.i.i, align 8
  %call.i.i = tail call noundef zeroext i1 %8(ptr noundef nonnull align 8 dereferenceable(64) %2)
  br i1 %call.i.i, label %if.then.i.i, label %_ZNK8facebook5velox6Buffer9asMutableISt10shared_ptrIvEEEPT_v.exit.i

if.then.i.i:                                      ; preds = %if.end14.i
  tail call void @llvm.trap()
  unreachable

_ZNK8facebook5velox6Buffer9asMutableISt10shared_ptrIvEEEPT_v.exit.i: ; preds = %if.end14.i
  %conv16.i = trunc i64 %numElements to i32
  %div11.i = lshr exact i64 %3, 4
  %conv.i = trunc i64 %div11.i to i32
  %data_.i.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %2, i64 0, i32 2
  %9 = load ptr, ptr %data_.i.i, align 8
  %cmp1813.i = icmp slt i32 %conv.i, %conv16.i
  br i1 %cmp1813.i, label %for.body.lr.ph.i, label %_ZN8facebook5velox19NonPODAlignedBufferISt10shared_ptrIvEE13fillNewMemoryIS3_EEvmmRKSt8optionalIT_E.exit

for.body.lr.ph.i:                                 ; preds = %_ZNK8facebook5velox6Buffer9asMutableISt10shared_ptrIvEEEPT_v.exit.i
  %_M_engaged.i.i.i = getelementptr inbounds %"struct.std::_Optional_payload_base.330", ptr %initValue, i64 0, i32 1
  %_M_refcount3.i.i.i = getelementptr inbounds %"class.std::__shared_ptr.70", ptr %initValue, i64 0, i32 1
  %sext.i = shl i64 %3, 28
  %10 = ashr exact i64 %sext.i, 32
  %sext16.i = shl i64 %numElements, 32
  %wide.trip.count.i = ashr exact i64 %sext16.i, 32
  br label %for.body.i

for.body.i:                                       ; preds = %for.inc.i, %for.body.lr.ph.i
  %indvars.iv.i = phi i64 [ %10, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.inc.i ]
  %11 = load i8, ptr %_M_engaged.i.i.i, align 8
  %12 = and i8 %11, 1
  %tobool.i.i.not.i = icmp eq i8 %12, 0
  %add.ptr23.i = getelementptr inbounds %"class.std::shared_ptr.69", ptr %9, i64 %indvars.iv.i
  br i1 %tobool.i.i.not.i, label %if.else.i, label %if.then20.i

if.then20.i:                                      ; preds = %for.body.i
  %13 = load ptr, ptr %initValue, align 8
  store ptr %13, ptr %add.ptr23.i, align 8
  %_M_refcount.i.i.i = getelementptr inbounds %"class.std::__shared_ptr.70", ptr %add.ptr23.i, i64 0, i32 1
  %14 = load ptr, ptr %_M_refcount3.i.i.i, align 8
  store ptr %14, ptr %_M_refcount.i.i.i, align 8
  %cmp.not.i.i.i.i = icmp eq ptr %14, null
  br i1 %cmp.not.i.i.i.i, label %for.inc.i, label %if.then.i.i.i.i

if.then.i.i.i.i:                                  ; preds = %if.then20.i
  %_M_use_count.i.i.i.i.i = getelementptr inbounds %"class.std::_Sp_counted_base", ptr %14, i64 0, i32 1
  %15 = load i8, ptr @__libc_single_threaded, align 1
  %tobool.i.i.not.i.i.i.i.i = icmp eq i8 %15, 0
  br i1 %tobool.i.i.not.i.i.i.i.i, label %if.else.i.i.i.i.i.i, label %if.then.i.i.i.i.i.i

if.then.i.i.i.i.i.i:                              ; preds = %if.then.i.i.i.i
  %16 = load i32, ptr %_M_use_count.i.i.i.i.i, align 4
  %add.i.i.i.i.i.i = add nsw i32 %16, 1
  store i32 %add.i.i.i.i.i.i, ptr %_M_use_count.i.i.i.i.i, align 4
  br label %for.inc.i

if.else.i.i.i.i.i.i:                              ; preds = %if.then.i.i.i.i
  %17 = atomicrmw volatile add ptr %_M_use_count.i.i.i.i.i, i32 1 acq_rel, align 4
  br label %for.inc.i

if.else.i:                                        ; preds = %for.body.i
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %add.ptr23.i, i8 0, i64 16, i1 false)
  br label %for.inc.i

for.inc.i:                                        ; preds = %if.else.i, %if.else.i.i.i.i.i.i, %if.then.i.i.i.i.i.i, %if.then20.i
  %indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
  %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
  br i1 %exitcond.not.i, label %_ZN8facebook5velox19NonPODAlignedBufferISt10shared_ptrIvEE13fillNewMemoryIS3_EEvmmRKSt8optionalIT_E.exit, label %for.body.i, !llvm.loop !4

_ZN8facebook5velox19NonPODAlignedBufferISt10shared_ptrIvEE13fillNewMemoryIS3_EEvmmRKSt8optionalIT_E.exit: ; preds = %for.inc.i, %_ZNK8facebook5velox6Buffer9asMutableISt10shared_ptrIvEEEPT_v.exit.i
  store i64 %1, ptr %size_.i, align 8
  br label %return

if.end13:                                         ; preds = %land.lhs.true5, %land.lhs.true, %if.end
  %pool_.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %2, i64 0, i32 1
  %18 = load ptr, ptr %pool_.i, align 8
  call void @_ZN8facebook5velox13AlignedBuffer8allocateISt10shared_ptrIvEEEN5boost13intrusive_ptrINS0_6BufferEEEmPNS0_6memory10MemoryPoolERKSt8optionalIT_E(ptr nonnull sret(%"class.boost::intrusive_ptr") align 8 %newBuffer, i64 noundef %numElements, ptr noundef %18, ptr noundef nonnull align 8 dereferenceable(24) %initValue)
  %19 = load ptr, ptr %newBuffer, align 8
  %20 = load i64, ptr %size_.i, align 8
  %.sroa.speculated = call i64 @llvm.umin.i64(i64 %20, i64 %1)
  %vtable19 = load ptr, ptr %19, align 8
  %vfn20 = getelementptr inbounds ptr, ptr %vtable19, i64 7
  %21 = load ptr, ptr %vfn20, align 8
  invoke void %21(ptr noundef nonnull align 8 dereferenceable(64) %19, ptr noundef nonnull %2, i64 noundef %.sroa.speculated)
          to label %invoke.cont unwind label %lpad

invoke.cont:                                      ; preds = %if.end13
  %22 = load ptr, ptr %newBuffer, align 8
  %size_22 = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %22, i64 0, i32 3
  store i64 %1, ptr %size_22, align 8
  store ptr null, ptr %newBuffer, align 8
  %23 = load ptr, ptr %buffer, align 8
  store ptr %22, ptr %buffer, align 8
  %cmp.not.i.i = icmp eq ptr %23, null
  br i1 %cmp.not.i.i, label %return, label %if.then.i.i17

if.then.i.i17:                                    ; preds = %invoke.cont
  %referenceCount_.i.i.i.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %23, i64 0, i32 5
  %24 = atomicrmw sub ptr %referenceCount_.i.i.i.i, i32 1 seq_cst, align 4
  %cmp.i.i.i.i = icmp eq i32 %24, 1
  br i1 %cmp.i.i.i.i, label %if.then.i.i.i.i18, label %_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEEaSEOS4_.exit

if.then.i.i.i.i18:                                ; preds = %if.then.i.i17
  %vtable.i.i.i.i = load ptr, ptr %23, align 8
  %vfn.i.i.i.i = getelementptr inbounds ptr, ptr %vtable.i.i.i.i, i64 8
  %25 = load ptr, ptr %vfn.i.i.i.i, align 8
  invoke void %25(ptr noundef nonnull align 8 dereferenceable(64) %23)
          to label %.noexc.i.i unwind label %terminate.lpad.i.i

.noexc.i.i:                                       ; preds = %if.then.i.i.i.i18
  %pool_.i.i.i.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %23, i64 0, i32 1
  %26 = load ptr, ptr %pool_.i.i.i.i, align 8
  %tobool.not.i.i.i.i = icmp eq ptr %26, null
  %vtable5.i.i.i.i = load ptr, ptr %23, align 8
  br i1 %tobool.not.i.i.i.i, label %delete.notnull.i.i.i.i, label %if.then2.i.i.i.i

if.then2.i.i.i.i:                                 ; preds = %.noexc.i.i
  %vfn4.i.i.i.i = getelementptr inbounds ptr, ptr %vtable5.i.i.i.i, i64 6
  %27 = load ptr, ptr %vfn4.i.i.i.i, align 8
  invoke void %27(ptr noundef nonnull align 8 dereferenceable(64) %23)
          to label %_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEEaSEOS4_.exit unwind label %terminate.lpad.i.i

delete.notnull.i.i.i.i:                           ; preds = %.noexc.i.i
  %vfn6.i.i.i.i = getelementptr inbounds ptr, ptr %vtable5.i.i.i.i, i64 1
  %28 = load ptr, ptr %vfn6.i.i.i.i, align 8
  call void %28(ptr noundef nonnull align 8 dereferenceable(64) %23) #6
  br label %_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEEaSEOS4_.exit

terminate.lpad.i.i:                               ; preds = %if.then2.i.i.i.i, %if.then.i.i.i.i18
  %29 = landingpad { ptr, i32 }
          catch ptr null
  %30 = extractvalue { ptr, i32 } %29, 0
  call void @__clang_call_terminate(ptr %30) #7
  unreachable

_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEEaSEOS4_.exit: ; preds = %delete.notnull.i.i.i.i, %if.then2.i.i.i.i, %if.then.i.i17
  %.pr = load ptr, ptr %newBuffer, align 8
  %cmp.not.i19 = icmp eq ptr %.pr, null
  br i1 %cmp.not.i19, label %return, label %if.then.i20

if.then.i20:                                      ; preds = %_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEEaSEOS4_.exit
  %referenceCount_.i.i.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %.pr, i64 0, i32 5
  %31 = atomicrmw sub ptr %referenceCount_.i.i.i, i32 1 seq_cst, align 4
  %cmp.i.i.i = icmp eq i32 %31, 1
  br i1 %cmp.i.i.i, label %if.then.i.i.i, label %return

if.then.i.i.i:                                    ; preds = %if.then.i20
  %vtable.i.i.i = load ptr, ptr %.pr, align 8
  %vfn.i.i.i = getelementptr inbounds ptr, ptr %vtable.i.i.i, i64 8
  %32 = load ptr, ptr %vfn.i.i.i, align 8
  invoke void %32(ptr noundef nonnull align 8 dereferenceable(64) %.pr)
          to label %.noexc.i unwind label %terminate.lpad.i

.noexc.i:                                         ; preds = %if.then.i.i.i
  %pool_.i.i.i = getelementptr inbounds %"class.facebook::velox::Buffer", ptr %.pr, i64 0, i32 1
  %33 = load ptr, ptr %pool_.i.i.i, align 8
  %tobool.not.i.i.i = icmp eq ptr %33, null
  %vtable5.i.i.i = load ptr, ptr %.pr, align 8
  br i1 %tobool.not.i.i.i, label %delete.notnull.i.i.i, label %if.then2.i.i.i

if.then2.i.i.i:                                   ; preds = %.noexc.i
  %vfn4.i.i.i = getelementptr inbounds ptr, ptr %vtable5.i.i.i, i64 6
  %34 = load ptr, ptr %vfn4.i.i.i, align 8
  invoke void %34(ptr noundef nonnull align 8 dereferenceable(64) %.pr)
          to label %return unwind label %terminate.lpad.i

delete.notnull.i.i.i:                             ; preds = %.noexc.i
  %vfn6.i.i.i = getelementptr inbounds ptr, ptr %vtable5.i.i.i, i64 1
  %35 = load ptr, ptr %vfn6.i.i.i, align 8
  call void %35(ptr noundef nonnull align 8 dereferenceable(64) %.pr) #6
  br label %return

terminate.lpad.i:                                 ; preds = %if.then2.i.i.i, %if.then.i.i.i
  %36 = landingpad { ptr, i32 }
          catch ptr null
  %37 = extractvalue { ptr, i32 } %36, 0
  call void @__clang_call_terminate(ptr %37) #7
  unreachable

lpad:                                             ; preds = %if.end13
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %newBuffer) #6
  resume { ptr, i32 } %38

return:                                           ; preds = %delete.notnull.i.i.i, %if.then2.i.i.i, %if.then.i20, %_ZN5boost13intrusive_ptrIN8facebook5velox6BufferEEaSEOS4_.exit, %invoke.cont, %_ZN8facebook5velox19NonPODAlignedBufferISt10shared_ptrIvEE13fillNewMemoryIS3_EEvmmRKSt8optionalIT_E.exit
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #5

attributes #0 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #1 = { mustprogress nounwind uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+avx,+avx2,+bmi2,+cmov,+crc32,+cx8,+f16c,+fma,+fxsr,+lzcnt,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { noreturn nounwind uwtable "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+avx,+avx2,+bmi2,+cmov,+crc32,+cx8,+f16c,+fma,+fxsr,+lzcnt,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+avx,+avx2,+bmi2,+cmov,+crc32,+cx8,+f16c,+fma,+fxsr,+lzcnt,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"uwtable", i32 2}
!3 = !{i32 7, !"frame-pointer", i32 2}
!4 = distinct !{!4, !5}
!5 = !{!"llvm.loop.mustprogress"}

%cmp2.not.i = icmp ult i64 %1, %3 should always evaluate to false.

@dtcxzyw
Copy link
Owner

dtcxzyw commented Dec 23, 2023

Minimal reproducible example:

define void @f(i64 %a3, i64 %numElements) {
 entry:
  %cond = icmp ule i64 %numElements, 1152921504606846975
  call void @llvm.assume(i1 %cond)
  %a1 = shl nuw i64 %numElements, 4
  br label %if.end
  
 if.end:
  %cmp = icmp ugt i64 %a1, %a3
  br i1 %cmp, label %if.end.i, label %abort

 if.end.i:
   %cmp2.not.i = icmp ult i64 %a1, %a3
   br i1 %cmp2.not.i, label %abort, label %exit

 abort:
   tail call void @llvm.trap()
   unreachable

 exit:
   ret void
}

declare void @llvm.trap()
declare void @llvm.assume(i1)

@dtcxzyw
Copy link
Owner

dtcxzyw commented Dec 23, 2023

with assumption:
Processing condition to simplify:   %cmp2.not.i = icmp ult i64 %a1, %a3
Checking   %cmp2.not.i = icmp ult i64 %a1, %a3
---
-1 * %a3 <= 0
-1 * %numElements <= 0
%numElements <= 1152921504606846975
%a3 + -16 * %numElements <= -1
%a3 + -16 * %numElements <= 0
sat
---
-1 * %a3 <= 0
-1 * %numElements <= 0
%numElements <= 1152921504606846975
%a3 + -16 * %numElements <= -1
-1 * %a3 + 16 * %numElements <= -1
sat

without assumption:
Processing condition to simplify:   %cmp2.not.i = icmp ult i64 %a1, %a3
Checking   %cmp2.not.i = icmp ult i64 %a1, %a3
---
-1 * %a3 <= 0
-1 * %numElements <= 0
%a3 + -16 * %numElements <= -1
%a3 + -16 * %numElements <= 0
sat
---
-1 * %a3 <= 0
-1 * %numElements <= 0
%a3 + -16 * %numElements <= -1
-1 * %a3 + 16 * %numElements <= -1
unsat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant