Fix PR5262: when folding select into PHI, make sure all operands are available
[oota-llvm.git] / lib / Transforms / Scalar / Reassociate.cpp
index e6ffac251b7bb07035fd3abd66b82752c794979d..00d450812c050dfb7ec84d66d3238e0d7ee42b9e 100644 (file)
@@ -29,6 +29,7 @@
 #include "llvm/IntrinsicInst.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/Pass.h"
+#include "llvm/Analysis/MallocHelper.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Debug.h"
@@ -121,7 +122,7 @@ static bool isUnmovableInstruction(Instruction *I) {
   if (I->getOpcode() == Instruction::PHI ||
       I->getOpcode() == Instruction::Alloca ||
       I->getOpcode() == Instruction::Load ||
-      I->getOpcode() == Instruction::Malloc ||
+      isMalloc(I) ||
       I->getOpcode() == Instruction::Invoke ||
       (I->getOpcode() == Instruction::Call &&
        !isa<DbgInfoIntrinsic>(I)) ||