Check for !isa<Constant> instead of isa<Instruction>. This
authorDan Gohman <gohman@apple.com>
Tue, 4 Aug 2009 23:23:56 +0000 (23:23 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 4 Aug 2009 23:23:56 +0000 (23:23 +0000)
matches what the comment says, and it avoids spurious BitCast
instructions for Argument values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78121 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 6554d6a45273ac1989094f6ec296689172ac22e2..f8be95fc0d33e5c7c4624577f0bd52663f25ff70 100644 (file)
@@ -1637,7 +1637,7 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEV *const &Stride,
       // do this by forcing a BitCast (noop cast) to be inserted into the
       // preheader in this case.
       if (!fitsInAddressMode(Base, getAccessType(Inst), TLI, false) &&
-          !isa<Instruction>(BaseV)) {
+          isa<Constant>(BaseV)) {
         // We want this constant emitted into the preheader! This is just
         // using cast as a copy so BitCast (no-op cast) is appropriate
         BaseV = new BitCastInst(BaseV, BaseV->getType(), "preheaderinsert",