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 | 3821e478a574b80d7f8bc96fa42731291cfccfe8 (patch) | |
tree | d2605ab4e41fde7469dc434d812d733040ef71e6 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | ca60967eeaec26db53082a35424d10e485d7fbea (diff) |
Not all constants are legal immediates in load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f11976fe87..e7e9886e31 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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 |