summaryrefslogtreecommitdiff
path: root/libclc
diff options
context:
space:
mode:
authorMichael Liao <michael.hliao@gmail.com>2020-09-10 23:11:22 -0400
committerMichael Liao <michael.hliao@gmail.com>2020-09-10 23:30:56 -0400
commit41e68f7ee7b3bb33e9acb0502339a858806e8523 (patch)
tree0e5093139306697ee328447a08226a93fd3a4975 /libclc
parent3f7c3e84ad69f1ffa767b1b7ce3aa36de6c30f87 (diff)
downloadllvm-41e68f7ee7b3bb33e9acb0502339a858806e8523.tar.gz
[EarlyCSE] Fix and recommit the revised c9826829d74e637163fdb0351870b8204e62d6e6
In addition to calculate hash consistently by swapping SELECT's operands, we also need to inverse the select pattern favor to match the original logic. [EarlyCSE] Equivalent SELECTs should hash equally DenseMap<SimpleValue> assumes that, if its isEqual method returns true for two elements, then its getHashValue method must return the same value for them. This invariant is broken when one SELECT node is a min/max operation, and the other can be transformed into an equivalent min/max by inverting its predicate and swapping its operands. This patch fixes an assertion failure that would occur intermittently while compiling the following IR: define i32 @t(i32 %i) { %cmp = icmp sle i32 0, %i %twin1 = select i1 %cmp, i32 %i, i32 0 %cmpinv = icmp sgt i32 0, %i %twin2 = select i1 %cmpinv, i32 0, i32 %i %sink = add i32 %twin1, %twin2 ret i32 %sink } Differential Revision: https://reviews.llvm.org/D86843
Diffstat (limited to 'libclc')
0 files changed, 0 insertions, 0 deletions