[PATCH] D136095: [GVN] Patch for invalid GVN replacement

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 07:42:17 PDT 2022


nikic added a comment.

Haven't looked into this deeply yet, but here is a reduced test case:

  declare void @use(i32)
  
  define void @test1(i1 %c, i32 %arg) {
    br i1 %c, label %bb1, label %bb2
  
  bb1:
    %shl1 = shl i32 %arg, 2
    br label %bb3
  
  bb2:
    %shl2 = shl i32 %arg, 2
    call void @use(i32 %shl2)
    br label %bb3
  
  bb3:
    %shl3 = shl i32 %arg, 2
    %gep = getelementptr i32, ptr null, i32 %shl3
    %v = load i32, ptr %gep, align 4
    call void @use(i32 %v)
    br label %bb2
  }

Probably the presence of irreducible control-flow is the important bit.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136095/new/

https://reviews.llvm.org/D136095



More information about the llvm-commits mailing list