[llvm-commits] [llvm] r90990 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Dan Gohman
gohman at apple.com
Wed Dec 9 14:55:02 PST 2009
Author: djg
Date: Wed Dec 9 16:55:01 2009
New Revision: 90990
URL: http://llvm.org/viewvc/llvm-project?rev=90990&view=rev
Log:
Dereference loopHeader after checking for null rather than before.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=90990&r1=90989&r2=90990&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Dec 9 16:55:01 2009
@@ -404,12 +404,13 @@
bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
initLoopData();
- Function *F = loopHeader->getParent();
// If LoopSimplify was unable to form a preheader, don't do any unswitching.
if (!loopPreheader)
return false;
+ Function *F = loopHeader->getParent();
+
// If the condition is trivial, always unswitch. There is no code growth for
// this case.
if (!IsTrivialUnswitchCondition(LoopCond)) {
More information about the llvm-commits
mailing list