[PATCH] MergeFunc: Avoid invalid merge of functions using different range metadata
Stepan Dyatkovskiy
stpworld at narod.ru
Mon Jun 9 15:05:59 PDT 2014
Hi Bjorn,
You have found really interesting point :-)
For this changes set, please, read inline comments.
In general. We **can** merge such cases (and it's good to merge them), but we also have to merge metadata.
Two loads:
1.: %0 = load i8* %check_place, !range !0
2.: %0 = load i8* %check_place, !range !1
With metadata:
!0 = metadata !{i8 0, i8 2}
!1 = metadata !{i8 5, i8 7}
Could be merged into:
%0 = load i8* %check_place, !range !0
With metadata:
!0 = metadata !{i8 0, i8 2, i8 5, i8 7}
I think you could do this check "MergeFunctions::insert": if destination or source function contains load with "range" - extend 'range' metadata with new values.
Could you provide such patch after this one?
================
Comment at: test/Transforms/MergeFunc/ranges.ll:12
@@ +11,3 @@
+; CHECK-LABEL: @cmp_no_range
+; CHECK-NOT: call
+entry-block:
----------------
This is valid check, but IMHO it's a bit fragile.
Could you check full function contents here. It has only 5 lines :-)
================
Comment at: test/Transforms/MergeFunc/ranges.ll:22
@@ +21,3 @@
+; CHECK-LABEL: @cmp_different_range
+; CHECK-NOT: call
+entry-block:
----------------
The same. I'd prefer to see that whole function remains unchanged.
http://reviews.llvm.org/D4062
More information about the llvm-commits
mailing list