[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopRotation.cpp
Devang Patel
dpatel at apple.com
Mon Apr 9 09:42:04 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
LoopRotation.cpp updated: 1.3 -> 1.4
---
Log message:
Fix future bug. Of course, Chris spotted this.
Handle Argument or Undef as an incoming PHI value.
---
Diffs of the changes: (+12 -11)
LoopRotation.cpp | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
Index: llvm/lib/Transforms/Scalar/LoopRotation.cpp
diff -u llvm/lib/Transforms/Scalar/LoopRotation.cpp:1.3 llvm/lib/Transforms/Scalar/LoopRotation.cpp:1.4
--- llvm/lib/Transforms/Scalar/LoopRotation.cpp:1.3 Mon Apr 9 11:21:29 2007
+++ llvm/lib/Transforms/Scalar/LoopRotation.cpp Mon Apr 9 11:41:46 2007
@@ -369,7 +369,6 @@
return true;
}
-
/// Make sure all Exit block PHINodes have required incoming values.
/// If incoming value is constant or defined outside the loop then
/// PHINode may not have an entry for new pre-header.
@@ -382,20 +381,22 @@
if (!PN)
break;
- if (PN->getBasicBlockIndex(NewPreHeader) == -1) {
- Value *V = PN->getIncomingValueForBlock(OrigHeader);
- if (isa<Constant>(V))
- PN->addIncoming(V, NewPreHeader);
- else {
- RenameData *ILoopHeaderInfo = findReplacementData(cast<Instruction>(V));
- assert (ILoopHeaderInfo && ILoopHeaderInfo->PreHeader && "Missing New Preheader Instruction");
- PN->addIncoming(ILoopHeaderInfo->PreHeader, NewPreHeader);
- }
+ // There is already one incoming value from new pre-header block.
+ if (PN->getBasicBlockIndex(NewPreHeader) != -1)
+ return;
+
+ RenameData *ILoopHeaderInfo;
+ Value *V = PN->getIncomingValueForBlock(OrigHeader);
+ if (isa<Instruction>(V) &&
+ (ILoopHeaderInfo = findReplacementData(cast<Instruction>(V)))) {
+ assert (ILoopHeaderInfo->PreHeader && "Missing New Preheader Instruction");
+ PN->addIncoming(ILoopHeaderInfo->PreHeader, NewPreHeader);
+ } else {
+ PN->addIncoming(V, NewPreHeader);
}
}
}
-
/// Initialize local data
void LoopRotate::initialize() {
L = NULL;
More information about the llvm-commits
mailing list