Skip to content

Instantly share code, notes, and snippets.

@brunodf-snps
Created April 26, 2024 10:38
Show Gist options
  • Save brunodf-snps/4a045f596a4c568fdeda86f691d9d118 to your computer and use it in GitHub Desktop.
Save brunodf-snps/4a045f596a4c568fdeda86f691d9d118 to your computer and use it in GitHub Desktop.
target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
define dso_local void @v1(i32 noundef %n, ptr noundef %A, i32 noundef %val) local_unnamed_addr {
entry:
%cmp3 = icmp slt i32 0, %n
br i1 %cmp3, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry
ret void
for.body: ; preds = %entry, %for.cond.cleanup3
%i.04 = phi i32 [ %inc7, %for.cond.cleanup3 ], [ 0, %entry ]
br label %for.body4
for.cond.cleanup3: ; preds = %for.body4
%inc7 = add nsw i32 %i.04, 1
%cmp = icmp slt i32 %inc7, %n
br i1 %cmp, label %for.body, label %for.cond.cleanup
for.body4: ; preds = %for.body, %for.body4
%j.02 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%mul = mul nsw i32 %i.04, %n
%add = add nsw i32 %mul, %j.02
%arrayidx = getelementptr inbounds i32, ptr %A, i32 %add
%0 = load i32, ptr %arrayidx, align 4
%add5 = add nsw i32 %0, %val
store i32 %add5, ptr %arrayidx, align 4
%inc = add nsw i32 %j.02, 1
%cmp2 = icmp slt i32 %inc, %n
br i1 %cmp2, label %for.body4, label %for.cond.cleanup3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment