Commit Gabor Greif's patch to use iterators in lowering intrinsics.
authorNate Begeman <natebegeman@mac.com>
Thu, 24 Mar 2005 20:07:16 +0000 (20:07 +0000)
committerNate Begeman <natebegeman@mac.com>
Thu, 24 Mar 2005 20:07:16 +0000 (20:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20816 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPC32ISelSimple.cpp

index f2b5cec2e1990a533d34a17fdeacd62d47341116..4793e4b73c9f1597f05d41ca165005776a58aa28 100644 (file)
@@ -1928,15 +1928,16 @@ void PPC32ISel::LowerUnknownIntrinsicFunctionCalls(Function &F) {
             BB->getInstList().erase(CI);
             break;
           }
-          default:
+          default: {
             // All other intrinsic calls we must lower.
-            Instruction *Before = CI->getPrev();
+            BasicBlock::iterator me(CI);
+            bool atBegin(BB->begin() == me);
+            if (!atBegin)
+              --me;
             TM.getIntrinsicLowering().LowerIntrinsicCall(CI);
-            if (Before) {        // Move iterator to instruction after call
-              I = Before; ++I;
-            } else {
-              I = BB->begin();
-            }
+            // Move iterator to instruction after call
+            I = atBegin ? BB->begin() : ++me;
+          }
           }
 }