Let the fallthrough handle whether or not we've changed anything
authorEric Christopher <echristo@apple.com>
Sat, 6 Mar 2010 10:59:25 +0000 (10:59 +0000)
committerEric Christopher <echristo@apple.com>
Sat, 6 Mar 2010 10:59:25 +0000 (10:59 +0000)
before we try to optimize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97876 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCalls.cpp

index e57ab58628f211e449934beb9254a70e8ab82025..e2b7d3d60db822f60dae1b07702a6fa9a5d89078 100644 (file)
@@ -948,7 +948,9 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
   // delete the instruction now.
   if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction())) {
     Instruction *I = tryOptimizeCall(CI, TD);
-    return I ? EraseInstFromFunction(*I): 0;
+    // If we changed something return the result, etc. Otherwise let
+    // the fallthrough check.
+    if (I) return EraseInstFromFunction(*I);
   }
 
   return Changed ? CS.getInstruction() : 0;