Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Unified Diff: lib/Transforms/InstCombine/InstCombineCompares.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Transforms/IPO/FunctionAttrs.cpp ('k') | lib/Transforms/LLVMBuild.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/InstCombine/InstCombineCompares.cpp
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 682820a25ca24bb2eaf41a6017306377608eb062..0a7e99413feddd430dda44b061c5927b9dcbe7ae 100644
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -13,6 +13,7 @@
#include "InstCombine.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/Triple.h" // @LOCALMOD
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
@@ -1635,6 +1636,11 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
// smaller constant, which will be target friendly.
unsigned Amt = ShAmt->getLimitedValue(TypeBits-1);
if (LHSI->hasOneUse() &&
+ // @LOCALMOD-BEGIN
+ // We don't want to introduce non-power-of-two integer sizes for PNaCl's
+ // stable wire format, so modify this transformation for NaCl.
+ isPowerOf2_32(TypeBits - Amt) && (TypeBits - Amt) >= 8 &&
+ // @LOCALMOD-END
Amt != 0 && RHSV.countTrailingZeros() >= Amt) {
Type *NTy = IntegerType::get(ICI.getContext(), TypeBits - Amt);
Constant *NCI = ConstantExpr::getTrunc(
@@ -2677,6 +2683,12 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
//
// sum = a + b
// if (sum+128 >u 255) ... -> llvm.sadd.with.overflow.i8
+ // @LOCALMOD-BEGIN
+ // This is disabled for PNaCl, because we don't support the
+ // with.overflow intrinsics in PNaCl's stable ABI.
+ Triple T(I.getParent()->getParent()->getParent()->getTargetTriple());
+ if (T.getArch() != Triple::le32)
+ // @LOCALMOD-END
{
ConstantInt *CI2; // I = icmp ugt (add (add A, B), CI2), CI
if (I.getPredicate() == ICmpInst::ICMP_UGT &&
@@ -3417,6 +3429,11 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
return new ICmpInst(I.getPredicate(), ConstantExpr::getNot(RHSC), A);
}
+ // @LOCALMOD-BEGIN
+ // This is disabled for PNaCl, because we don't support the
+ // with.overflow intrinsics in PNaCl's stable ABI.
+ Triple T(I.getParent()->getParent()->getParent()->getTargetTriple());
+ if (T.getArch() != Triple::le32) {
// (a+b) <u a --> llvm.uadd.with.overflow.
// (a+b) <u b --> llvm.uadd.with.overflow.
if (I.getPredicate() == ICmpInst::ICMP_ULT &&
@@ -3442,6 +3459,8 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
if (Instruction *R = ProcessUMulZExtIdiom(I, Op1, Op0, *this))
return R;
}
+ }
+ // @LOCALMOD-END
}
if (I.isEquality()) {
« no previous file with comments | « lib/Transforms/IPO/FunctionAttrs.cpp ('k') | lib/Transforms/LLVMBuild.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698