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

False positive for the same GEP pointer after unrolling the loop #961

Closed
XChy opened this issue Nov 14, 2023 · 1 comment
Closed

False positive for the same GEP pointer after unrolling the loop #961

XChy opened this issue Nov 14, 2023 · 1 comment
Labels
memory Memory Model

Comments

@XChy
Copy link

XChy commented Nov 14, 2023

https://alive2.llvm.org/ce/z/c8xStZ

In this example, I think %arrayidx104 should be equivalent to %arrayidx84. But it reported target is more poisonous after unrolling the loop.

@nunoplopes nunoplopes added the memory Memory Model label Nov 18, 2023
@nunoplopes
Copy link
Member

So this doesn't get lost; a reduced version:

define ptr @src(ptr noundef %a, i32 noundef %b, i1 noundef %cmp86) {
lr.ph:
  br label %for.body
for.body:
  %indvars.iv = phi i32 [ 0, %lr.ph ], [ 8, %for.inc93 ]
  %arrayidx84 = getelementptr inbounds ptr, ptr %a, i32 %indvars.iv
  br i1 %cmp86, label %if.end98, label %for.inc93

for.inc93:
  %indvars.iv.next = add i32 %indvars.iv, 8
  %exitcond.not = icmp ugt i32 %indvars.iv.next, %b
  br i1 %exitcond.not, label %cleanup, label %for.body

if.end98:
  %arrayidx104 = getelementptr inbounds ptr, ptr %a, i32 %indvars.iv
  ret ptr %arrayidx104

cleanup:
  ret ptr null
}

define ptr @tgt(ptr noundef %a, i32 noundef %b, i1 noundef %cmp86) {
lr.ph:
  br label %for.body
for.body:
  %indvars.iv = phi i32 [ 0, %lr.ph ], [ 8, %for.inc93 ]
  %arrayidx84 = getelementptr inbounds ptr, ptr %a, i32 %indvars.iv
  br i1 %cmp86, label %if.end98, label %for.inc93

for.inc93:
  %indvars.iv.next = add i32 %indvars.iv, 8
  %exitcond.not = icmp ugt i32 %indvars.iv.next, %b
  br i1 %exitcond.not, label %cleanup, label %for.body

if.end98:
  ret ptr %arrayidx84

cleanup:
  ret ptr null
}

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

No branches or pull requests

2 participants