diff options
author | JF Bastien <jfb@google.com> | 2016-04-12 00:03:26 +0000 |
---|---|---|
committer | JF Bastien <jfb@google.com> | 2016-04-12 00:03:26 +0000 |
commit | 4f43cfd2c2b8cfe63c1bb5d6dfbdf8ac6f9c4e76 (patch) | |
tree | 7a35c3aaf52027c74e784bd9b8e2f541831267a2 /llvm/lib/Transforms/IPO/MergeFunctions.cpp | |
parent | d52f4128d651348a653e7625e13dc45bafd5e513 (diff) | |
download | llvm-4f43cfd2c2b8cfe63c1bb5d6dfbdf8ac6f9c4e76.zip llvm-4f43cfd2c2b8cfe63c1bb5d6dfbdf8ac6f9c4e76.tar.gz llvm-4f43cfd2c2b8cfe63c1bb5d6dfbdf8ac6f9c4e76.tar.bz2 |
MergeFunctions: test alloca better
r237193 fix handling of alloca size / align in MergeFunctions, but only tested one and didn't follow FunctionComparator::cmpOperations's usual comparison pattern. It also didn't update Instruction.cpp:haveSameSpecialState which I'll do separately.
llvm-svn: 266022
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index d68c050..63e610c 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -921,15 +921,6 @@ int FunctionComparator::cmpOperations(const Instruction *L, R->getRawSubclassOptionalData())) return Res; - if (const AllocaInst *AI = dyn_cast<AllocaInst>(L)) { - if (int Res = cmpTypes(AI->getAllocatedType(), - cast<AllocaInst>(R)->getAllocatedType())) - return Res; - if (int Res = - cmpNumbers(AI->getAlignment(), cast<AllocaInst>(R)->getAlignment())) - return Res; - } - // We have two instructions of identical opcode and #operands. Check to see // if all operands are the same type for (unsigned i = 0, e = L->getNumOperands(); i != e; ++i) { @@ -939,6 +930,12 @@ int FunctionComparator::cmpOperations(const Instruction *L, } // Check special state that is a part of some instructions. + if (const AllocaInst *AI = dyn_cast<AllocaInst>(L)) { + if (int Res = cmpTypes(AI->getAllocatedType(), + cast<AllocaInst>(R)->getAllocatedType())) + return Res; + return cmpNumbers(AI->getAlignment(), cast<AllocaInst>(R)->getAlignment()); + } if (const LoadInst *LI = dyn_cast<LoadInst>(L)) { if (int Res = cmpNumbers(LI->isVolatile(), cast<LoadInst>(R)->isVolatile())) return Res; |