Follow-up fix to r165928: handle memset rewriting for widened integers,
[oota-llvm.git] / lib / Transforms / InstCombine / InstCombineCompares.cpp
index 3fc1357eae0bc331fca2ce31312f8da3ebf249bd..4d5ffddc4c7b6abd16cd4e00d8e9073a2a1a5c2b 100644 (file)
@@ -16,7 +16,7 @@
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Analysis/InstructionSimplify.h"
 #include "llvm/Analysis/MemoryBuiltins.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
@@ -474,7 +474,7 @@ FoldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP, GlobalVariable *GV,
 /// If we can't emit an optimized form for this expression, this returns null.
 ///
 static Value *EvaluateGEPOffsetExpression(User *GEP, InstCombiner &IC) {
-  TargetData &TD = *IC.getTargetData();
+  DataLayout &TD = *IC.getDataLayout();
   gep_type_iterator GTI = gep_type_begin(GEP);
 
   // Check to see if this gep only has a single variable index.  If so, and if
@@ -2990,7 +2990,7 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
         CallInst *CI = cast<CallInst>(LHSI);
         LibFunc::Func Func;
         // Various optimization for fabs compared with zero.
-        if (RHSC->isNullValue() && CI->hasOneUse() &&
+        if (RHSC->isNullValue() && CI->getCalledFunction() &&
             TLI->getLibFunc(CI->getCalledFunction()->getName(), Func) &&
             TLI->has(Func)) {
           if (Func == LibFunc::fabs || Func == LibFunc::fabsf ||