[llvm] r256032 - Revert "Enhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst"

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 13:23:32 PST 2015


Author: rafael
Date: Fri Dec 18 15:23:32 2015
New Revision: 256032

URL: http://llvm.org/viewvc/llvm-project?rev=256032&view=rev
Log:
Revert "Enhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst"

This reverts commit r256028.

It broke:

    LLVM :: CodeGen/Mips/eh.ll
    LLVM :: CodeGen/Mips/insn-zero-size-bb.ll

Modified:
    llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp
    llvm/trunk/test/Analysis/BranchProbabilityInfo/noreturn.ll
    llvm/trunk/test/CodeGen/X86/catchret-empty-fallthrough.ll

Modified: llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp?rev=256032&r1=256031&r2=256032&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Fri Dec 18 15:23:32 2015
@@ -147,16 +147,6 @@ bool BranchProbabilityInfo::calcUnreacha
   if (TI->getNumSuccessors() == 1 || UnreachableEdges.empty())
     return false;
 
-  // If the terminator is an InvokeInst, check only the normal destination block
-  // as the unwind edge of InvokeInst is also very unlikely taken.
-  if (auto *II = dyn_cast<InvokeInst>(TI))
-    if (PostDominatedByUnreachable.count(II->getNormalDest())) {
-      PostDominatedByUnreachable.insert(BB);
-      // Return false here so that edge weights for InvokeInst could be decided
-      // in calcInvokeHeuristics().
-      return false;
-    }
-
   uint32_t UnreachableWeight =
     std::max(UR_TAKEN_WEIGHT / (unsigned)UnreachableEdges.size(), MIN_WEIGHT);
   for (SmallVectorImpl<unsigned>::iterator I = UnreachableEdges.begin(),

Modified: llvm/trunk/test/Analysis/BranchProbabilityInfo/noreturn.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/BranchProbabilityInfo/noreturn.ll?rev=256032&r1=256031&r2=256032&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/BranchProbabilityInfo/noreturn.ll (original)
+++ llvm/trunk/test/Analysis/BranchProbabilityInfo/noreturn.ll Fri Dec 18 15:23:32 2015
@@ -77,48 +77,3 @@ abort:
 exit:
   ret i32 %b
 }
-
- at _ZTIi = external global i8*
-
-; CHECK-LABEL: throwSmallException
-; CHECK-NOT: invoke i32 @smallFunction
-define i32 @throwSmallException(i32 %idx, i32 %limit) #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
-entry:
-  %cmp = icmp sge i32 %idx, %limit
-  br i1 %cmp, label %if.then, label %if.end
-; CHECK: edge entry -> if.then probability is 0x00000800 / 0x80000000 = 0.00%
-; CHECK: edge entry -> if.end probability is 0x7ffff800 / 0x80000000 = 100.00% [HOT edge]
-
-if.then:                                          ; preds = %entry
-  %exception = call i8* @__cxa_allocate_exception(i64 1) #0
-  invoke i32 @smallFunction(i32 %idx)
-          to label %invoke.cont unwind label %lpad
-; CHECK: edge if.then -> invoke.cont probability is 0x7ffff800 / 0x80000000 = 100.00% [HOT edge]
-; CHECK: edge if.then -> lpad probability is 0x00000800 / 0x80000000 = 0.00%
-
-invoke.cont:                                      ; preds = %if.then
-  call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi  to i8*), i8* null) #1
-  unreachable
-
-lpad:                                             ; preds = %if.then
-  %ll = landingpad { i8*, i32 }
-          cleanup
-  ret i32 %idx
-
-if.end:                                           ; preds = %entry
-  ret i32 %idx
-}
-
- at a = global i32 4
-define i32 @smallFunction(i32 %a) {
-entry:
-  %r = load volatile i32, i32* @a
-  ret i32 %r
-}
-
-attributes #0 = { nounwind }
-attributes #1 = { noreturn }
-
-declare i8* @__cxa_allocate_exception(i64)
-declare i32 @__gxx_personality_v0(...)
-declare void @__cxa_throw(i8*, i8*, i8*)

Modified: llvm/trunk/test/CodeGen/X86/catchret-empty-fallthrough.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/catchret-empty-fallthrough.ll?rev=256032&r1=256031&r2=256032&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/catchret-empty-fallthrough.ll (original)
+++ llvm/trunk/test/CodeGen/X86/catchret-empty-fallthrough.ll Fri Dec 18 15:23:32 2015
@@ -34,14 +34,12 @@ return:
 
 ; CHECK-LABEL: foo: # @foo
 ; CHECK: testb $1, %cl
-; CHECK: je .LBB0_[[try:[0-9]+]]
-; CHECK: .LBB0_[[return:[0-9]+]]:
-; CHECK: retq
-; CHECK: .LBB0_[[try]]:
+; CHECK: jne .LBB0_[[return:[0-9]+]]
 ; CHECK: .Ltmp0:
 ; CHECK: callq bar
 ; CHECK: .Ltmp1:
 ; CHECK: .LBB0_[[catch:[0-9]+]]:
+; CHECK: .LBB0_[[return]]:
 
 ; CHECK: .seh_handlerdata
 ; CHECK-NEXT: .Lfoo$parent_frame_offset = 32




More information about the llvm-commits mailing list