[PATCH] D36443: [InstCombine] Support pulling left shifts through a subtract with constant LHS
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 11:13:29 PDT 2017
efriedma added a comment.
For reference, http://rise4fun.com/Alive/8l5 .
This transform throws nsw/nuw flags; can we preserve them in some situations?
================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:525
+ return BinaryOperator::CreateSub(NewRHS, NewShift);
+ }
}
----------------
Maybe add a comment writing out the transform in mathematical terms? (e.g. "2 * (A - B)" -> "2 * A - 2 * B").
================
Comment at: test/Transforms/InstCombine/sub.ll:1082
+ %D = sub i32 2, %C
+ ret i32 %D
+}
----------------
This could use a couple more tests, to specifically show the transform this patch adds.
https://reviews.llvm.org/D36443
More information about the llvm-commits
mailing list