-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
bugSomething isn't workingSomething isn't workingperformanceIssues related to performance of generated codeIssues related to performance of generated code
Description
As the title says.
E.g., consider the following:
pub def list(ar:array(T)):list(T) = ls where {
if { [?x | ?ar] = ar ::
?ls = list(ar)
[x | ls] = ?ls
| else ::
?ls = []
}
}
The compiler generates the following:
list > public (1 calls)
0: opt.list<0>
list(ar##0:wybe.array(T), ?#result##0:wybe.list(T))<{}; {}>:
AliasPairs: []
InterestingCallProperties: [InterestingUnaliased 0]
MultiSpeczDepInfo: [(0,(wybe.array.[|]<0>,fromList [NonAliasedParamCond 2 [0]])),(1,(opt.list<0>,fromList [NonAliasedParamCond 0 []]))]
wybe.array.[|]<0>(?x##0:T, ?ar##1:wybe.array(T), ~ar##0:wybe.array(T), ?tmp#3##0:wybe.bool) #0 @opt:16:10
case ~tmp#3##0:wybe.bool of
0:
foreign llvm move(0:wybe.list(T), ?#result##0:wybe.list(T)) @opt:15:5
1:
opt.list<0>[410bae77d3](~ar##1:wybe.array(T), ?tmp#0##0:wybe.list(T)) #1 @opt:17:15
foreign lpvm alloc(16:wybe.int, ?tmp#6##0:wybe.list(T)) @list:9:27
foreign lpvm mutate(~tmp#6##0:wybe.list(T), ?tmp#7##0:wybe.list(T), 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~x##0:T) @list:9:27
foreign lpvm mutate(~tmp#7##0:wybe.list(T), ?#result##0:wybe.list(T), 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~tmp#0##0:wybe.list(T)) @list:9:27
However with -xno-multi-specz, the compiler can use the TCMC optimisation. The only difference is the multi-specz call in the body.
list > public (1 calls)
0: opt.list<0>
list(ar##0:wybe.array(T), outByReference #result##0:wybe.list(T))<{}; {}>:
AliasPairs: []
InterestingCallProperties: [InterestingUnaliased 0]
MultiSpeczDepInfo: [(0,(wybe.array.[|]<0>,fromList [NonAliasedParamCond 2 [0]])),(1,(opt.list<0>,fromList [NonAliasedParamCond 0 []]))]
wybe.array.[|]<0>(?x##0:T, ?ar##1:wybe.array(T), ~ar##0:wybe.array(T), ?tmp#3##0:wybe.bool) #0 @opt:16:10
case ~tmp#3##0:wybe.bool of
0:
foreign llvm move(0:wybe.list(T), ?#result##0:wybe.list(T)) @opt:15:5
1:
foreign lpvm alloc(16:wybe.int, ?tmp#6##0:wybe.list(T)) @list:9:27
foreign lpvm mutate(~tmp#6##0:wybe.list(T), ?tmp#7##0:wybe.list(T), 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~x##0:T) @list:9:27
opt.list<0>(~ar##1:wybe.array(T), outByReference tmp#0##0:wybe.list(T)) #1 @opt:17:15
foreign lpvm mutate(~tmp#7##0:wybe.list(T), ?#result##0:wybe.list(T), 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~takeReference tmp#0##0:wybe.list(T)) @list:9:27
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingperformanceIssues related to performance of generated codeIssues related to performance of generated code