summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-06-26 16:39:29 +0000
committerSanjay Patel <spatel@rotateright.com>2018-06-26 16:39:29 +0000
commit9adea01c9fb4838b042273dae7104441ceff1570 (patch)
tree96fd5e564e7f2778db4d24d52bb8fb061a88f6c9
parent3575f0c0b3787b97084c0e25c6d8fcb31e99ea62 (diff)
downloadbcm5719-llvm-9adea01c9fb4838b042273dae7104441ceff1570.tar.gz
bcm5719-llvm-9adea01c9fb4838b042273dae7104441ceff1570.zip
[InstCombine] simplify code for urem fold; NFCI
llvm-svn: 335623
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 9833bbc2a15..65046f26259 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -1303,11 +1303,8 @@ Instruction *InstCombiner::visitURem(BinaryOperator &I) {
}
// 1 urem X -> zext(X != 1)
- if (match(Op0, m_One())) {
- Value *Cmp = Builder.CreateICmpNE(Op1, Op0);
- Value *Ext = Builder.CreateZExt(Cmp, Ty);
- return replaceInstUsesWith(I, Ext);
- }
+ if (match(Op0, m_One()))
+ return CastInst::CreateZExtOrBitCast(Builder.CreateICmpNE(Op1, Op0), Ty);
// X urem C -> X < C ? X : X - C, where C >= signbit.
if (match(Op1, m_Negative())) {
OpenPOWER on IntegriCloud