Skip to content

Instantly share code, notes, and snippets.

@Zoxc
Created February 6, 2020 03:54
Show Gist options
  • Save Zoxc/473087dd905c880be5fb2c6a2cf4cece to your computer and use it in GitHub Desktop.
Save Zoxc/473087dd905c880be5fb2c6a2cf4cece to your computer and use it in GitHub Desktop.
LLVM infinite loop
; ModuleID = '../../../../output-func.ll'
source_filename = "rustc_mir.anxkd8ga-cgu.7"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
; Function Attrs: nounwind uwtable
define hidden fastcc void @_ZN5alloc5slice5merge17hae3c4424e1deafb6E([0 x i32]* nonnull align 4 %0, i64 %1, i64 %2, i32* %3) {
%5 = shl i64 %2, 2
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* undef to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %6, i8* nonnull align 4 %7, i64 %5, i1 false)
%8 = getelementptr inbounds i32, i32* %3, i64 %2
%9 = ptrtoint i32* %3 to i64
%10 = ptrtoint i32* %8 to i64
br label %11
11: ; preds = %19, %4
%12 = phi i32* [ undef, %4 ], [ %27, %19 ]
%13 = phi i32* [ undef, %4 ], [ %30, %19 ]
%14 = phi i64 [ %9, %4 ], [ %28, %19 ]
%15 = inttoptr i64 %14 to i32*
%16 = icmp ult i32* %15, %8
%17 = icmp ult i32* %12, undef
%18 = and i1 %16, %17
br label %19
19: ; preds = %11
%20 = icmp ne i32* %12, null
%21 = load i32, i32* %12, align 4
%22 = load i32, i32* %15, align 4
%23 = icmp ult i32 %21, %22
%24 = getelementptr inbounds i32, i32* %12, i64 1
%25 = getelementptr inbounds i32, i32* %15, i64 1
%26 = ptrtoint i32* %25 to i64
%27 = select i1 %23, i32* %24, i32* %12
%28 = select i1 %23, i64 %14, i64 %26
%29 = select i1 %23, i32* %12, i32* %15
%30 = getelementptr inbounds i32, i32* %13, i64 1
%31 = bitcast i32* %13 to i8*
%32 = bitcast i32* %29 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %31, i8* align 4 %32, i64 4, i1 false)
br label %11
}
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment