mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
940c24167e
Summary: This patch removes two remaining places where pointer value comparisons are used to order functions: comparing range annotation metadata, and comparing block address constants. (These are both rare cases, and so no actual non-determinism was observed from either case). The fix for range metadata is simple: the annotation always consists of a pair of integers, so we just order by those integers. The fix for block addresses is more subtle. Two constants are the same if they are the same basic block in the same function, or if they refer to corresponding basic blocks in each respective function. Note that in the first case, merging is trivially correct. In the second, the correctness of merging relies on the fact that the the values of block addresses cannot be compared. This change is actually an enhancement, as these functions could not previously be merged (see merge-block-address.ll). There is still a problem with cross function block addresses, in that constants pointing to a basic block in a merged function is not updated. This also more robustly compares floating point constants by all fields of their semantics, and fixes a dyn_cast/cast mixup. Author: jrkoenig Reviewers: dschuff, nlewycky, jfb Subscribers llvm-commits Differential revision: http://reviews.llvm.org/D12376 llvm-svn: 246305
50 lines
1.0 KiB
LLVM
50 lines
1.0 KiB
LLVM
; RUN: opt -S -mergefunc < %s | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define i32 @_Z1fi(i32 %i) #0 {
|
|
entry:
|
|
%retval = alloca i32, align 4
|
|
%i.addr = alloca i32, align 4
|
|
store i32 %i, i32* %i.addr, align 4
|
|
%0 = load i32, i32* %i.addr, align 4
|
|
%cmp = icmp eq i32 %0, 1
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
store i32 3, i32* %retval
|
|
br label %return
|
|
|
|
if.end:
|
|
%1 = load i32, i32* %i.addr, align 4
|
|
%cmp1 = icmp eq i32 %1, 3
|
|
br i1 %cmp1, label %if.then.2, label %if.end.3
|
|
|
|
if.then.2:
|
|
store i32 56, i32* %retval
|
|
br label %return
|
|
|
|
if.end.3:
|
|
store i32 0, i32* %retval
|
|
br label %return
|
|
|
|
return:
|
|
%2 = load i32, i32* %retval
|
|
ret i32 %2
|
|
}
|
|
|
|
|
|
define internal i8* @Afunc(i32* %P) {
|
|
store i32 1, i32* %P
|
|
store i32 3, i32* %P
|
|
ret i8* blockaddress(@_Z1fi, %if.then.2)
|
|
}
|
|
|
|
define internal i8* @Bfunc(i32* %P) {
|
|
; CHECK-NOT: @Bfunc
|
|
store i32 1, i32* %P
|
|
store i32 3, i32* %P
|
|
ret i8* blockaddress(@_Z1fi, %if.then.2)
|
|
}
|