diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2010-01-30 04:42:39 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2010-01-30 04:42:39 +0000 |
| commit | 56600a15ad9a59db89c5b1cf5b8432019168379f (patch) | |
| tree | 01095dae473994fe3a01f03bfef81ecd6df6354c /llvm/lib/Transforms/Scalar | |
| parent | a18f0fbca2c916136fb523dc56e931a851fbe1d6 (diff) | |
| download | bcm5719-llvm-56600a15ad9a59db89c5b1cf5b8432019168379f.tar.gz bcm5719-llvm-56600a15ad9a59db89c5b1cf5b8432019168379f.zip | |
Check alignment of loads when deciding whether it is safe to execute them
unconditionally. Besides checking the offset, also check that the underlying
object is aligned as much as the load itself.
llvm-svn: 94875
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 9c184526650..6e709523af3 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1651,7 +1651,8 @@ bool GVN::processNonLocalLoad(LoadInst *LI, if (!allSingleSucc && // FIXME: REEVALUTE THIS. !isSafeToLoadUnconditionally(LoadPtr, - UnavailablePred->getTerminator(), TD)) { + UnavailablePred->getTerminator(), + LI->getAlignment(), TD)) { assert(NewInsts.empty() && "Should not have inserted instructions"); return false; } diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp index 4119cb9db41..162d902cfa4 100644 --- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -211,7 +211,8 @@ bool TailCallElim::CanMoveAboveCall(Instruction *I, CallInst *CI) { // FIXME: Writes to memory only matter if they may alias the pointer // being loaded from. if (CI->mayWriteToMemory() || - !isSafeToLoadUnconditionally(L->getPointerOperand(), L)) + !isSafeToLoadUnconditionally(L->getPointerOperand(), L, + L->getAlignment())) return false; } } |

