diff options
author | Chris Lattner <sabre@nondot.org> | 2005-08-08 06:25:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-08-08 06:25:50 +0000 |
commit | 14203e85b283c19703f03207a7d252dad6afdbe4 (patch) | |
tree | 3c09b21e4f01678b5c0c4a62a43cc38aa63808e1 /llvm/lib | |
parent | ac86efb6a37fef3f77ab5300f1f906458f794953 (diff) | |
download | bcm5719-llvm-14203e85b283c19703f03207a7d252dad6afdbe4.tar.gz bcm5719-llvm-14203e85b283c19703f03207a7d252dad6afdbe4.zip |
Not all constants are legal immediates in load/store instructions.
llvm-svn: 22704
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f11976fe879..e7e9886e314 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -435,7 +435,13 @@ void BasedUser::RewriteInstructionToUseNewBase(Value *NewBase, static bool isTargetConstant(const SCEVHandle &V) { // FIXME: Look at the target to decide if &GV is a legal constant immediate. - if (isa<SCEVConstant>(V)) return true; + if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) { + // PPC allows a sign-extended 16-bit immediate field. + if ((int64_t)SC->getValue()->getRawValue() > -(1 << 16) && + (int64_t)SC->getValue()->getRawValue() < (1 << 16)-1) + return true; + return false; + } return false; // ENABLE this for x86 |