llvm.org GIT mirror llvm / fc375d2
Do not reassociate expressions with i1 type. SimplifyCFG converts some short-circuited conditions to AND/OR expressions, and those expressions are often converted back to a short-circuited form in code gen. The original source order may have been optimized to take advantage of the expected values, and if we reassociate them, we change the order and subvert that optimization. Radar 7497329. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95333 91177308-0d34-0410-b5e6-96231b3b80d8 Bob Wilson 10 years ago
1 changed file(s) with 9 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
932932 isa(BI->getType()))
933933 continue; // Floating point ops are not associative.
935 // Do not reassociate boolean (i1) expressions. We want to preserve the
936 // original order of evaluation for short-circuited comparisons that
937 // SimplifyCFG has folded to AND/OR expressions. If the expression
938 // is not further optimized, it is likely to be transformed back to a
939 // short-circuited form for code gen, and the source order may have been
940 // optimized for the most likely conditions.
941 if (BI->getType()->isInteger(1))
942 continue;
935944 // If this is a subtract instruction which is not already in negate form,
936945 // see if we can convert it to X+-Y.
937946 if (BI->getOpcode() == Instruction::Sub) {