[PATCH] D44627: [CallSiteSplitting] Only record conditions up to the IDom(call site).

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 28 09:50:39 PDT 2018


junbuml added inline comments.


================
Comment at: test/Transforms/CallSiteSplitting/callsite-split-or-phi.ll:46
 ;CHECK: ret i32 %[[MERGED]]
 define i32 @test_eq_eq_eq(i32* %a, i32 %v, i32 %p) {
 Header:
----------------
fhahn wrote:
> junbuml wrote:
> > We may want to keep this test as it is.  With this patch, the call sites split will take %a, instead of null. null value might be propagated to the callsite later in the pipeline, but there is no reason not to pass the known null value early in the pipeline.  If the callee  has early exit condition with null check. Inliner may have better opportunity to get this callee inlined by passing null. 
> > 
> > 
> > 
> Ah yes, if we split anyways, we could also propagate other known constraints.

This may show that inliner fail to inline the callee with this change. 

```

define i32 @test_eq_eq_eq(i32* %a, i32 %v, i32 %p) {
Header:
  %tobool1 = icmp eq i32* %a, null
  br i1 %tobool1, label %Header2, label %End

Header2:
  %tobool2 = icmp eq i32 %p, 10
  call void @dummy()
  br i1 %tobool2, label %Tail, label %TBB

TBB:
  %cmp = icmp eq i32 %v, 1
  call void @dummy()
  br i1 %cmp, label %Tail, label %End

Tail:
  %r = call i32 @callee(i32* %a, i32 %v, i32 %p)
  ret i32 %r

End:
  ret i32 %v
}


define i32 @callee(i32* %a, i32 %v, i32 %p) {
entry:
  %c = icmp eq i32* %a, null
  br i1 %c, label %BB1, label %BB2

BB1:
  ret i32 0

BB2:
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  call void @dummy2(i32 %v, i32 %p)
  br label %End

End:
  ret i32 %p
}

declare void @dummy()
declare void @dummy2(i32, i32)
```


https://reviews.llvm.org/D44627





More information about the llvm-commits mailing list