aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2016-04-12 00:03:26 +0000
committerJF Bastien <jfb@google.com>2016-04-12 00:03:26 +0000
commit4f43cfd2c2b8cfe63c1bb5d6dfbdf8ac6f9c4e76 (patch)
tree7a35c3aaf52027c74e784bd9b8e2f541831267a2 /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parentd52f4128d651348a653e7625e13dc45bafd5e513 (diff)
downloadllvm-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.cpp15
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;