This is to simplify icmp instructions in the form like:
%cmp = icmp eq i32 (i8*, i8*)* bitcast (i32 (i32**, i32**)* @f32 to i32 (i8*, i8*)), bitcast (i32 (i64**, i64**) @f64 to i32 (i8*, i8*)*)
Here @f32 and @f64 are two functions.
Paths
| Differential D87850
[ConstantFold] Fold the comparison of bitcasted global values ClosedPublic Authored by scui on Sep 17 2020, 12:24 PM.
Details Summary This is to simplify icmp instructions in the form like: %cmp = icmp eq i32 (i8*, i8*)* bitcast (i32 (i32**, i32**)* @f32 to i32 (i8*, i8*)), bitcast (i32 (i64**, i64**) @f64 to i32 (i8*, i8*)*) Here @f32 and @f64 are two functions.
Diff Detail
Unit TestsFailed Event Timelinejsji retitled this revision from Fold the comparison of bitcasted global values to [ConstantFold] Fold the comparison of bitcasted global values . efriedma added inline comments.
Comment Actions LGTM Do you have commit access? If not, I can commit it for you; what should I put in the git "Author" line? This revision is now accepted and ready to land.Oct 9 2020, 2:04 PM Comment Actions
Thanks. I don't have commit access. The author line should be --author="Shimin Cui <scui@ca.ibm.com>". Closed by commit rG95bda510fb7b: [ConstantFold] Fold the comparison of bitcasted global values (authored by scui, committed by efriedma). · Explain WhyOct 20 2020, 12:44 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 292580 llvm/lib/IR/ConstantFold.cpp
llvm/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll
llvm/test/Transforms/InstCombine/icmp-bitcast-func.ll
llvm/test/Transforms/InstCombine/pr32686.ll
llvm/test/Transforms/SCCP/ip-ranges-select.ll
llvm/test/Transforms/SCCP/undef-resolve.ll
llvm/test/Transforms/SimplifyCFG/PR17073.ll
|
I guess this handles the case where both operands are bitcasts due to other folds?
Is it possible to end up in a situation where one operand is a bitcast, and the other is a GEP? I guess we could leave that as an area for future improvement.