[llvm] r264583 - NFC: skip FenceInst up-front in AtomicExpandPass.

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 08:05:30 PDT 2016


Author: jyknight
Date: Mon Mar 28 10:05:30 2016
New Revision: 264583

URL: http://llvm.org/viewvc/llvm-project?rev=264583&view=rev
Log:
NFC: skip FenceInst up-front in AtomicExpandPass.

Modified:
    llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp

Modified: llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp?rev=264583&r1=264582&r2=264583&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp Mon Mar 28 10:05:30 2016
@@ -86,9 +86,10 @@ bool AtomicExpand::runOnFunction(Functio
 
   // Changing control-flow while iterating through it is a bad idea, so gather a
   // list of all atomic instructions before we start.
-  for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
-    if (I->isAtomic())
-      AtomicInsts.push_back(&*I);
+  for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) {
+    Instruction *I = &*II;
+    if (I->isAtomic() && !isa<FenceInst>(I))
+      AtomicInsts.push_back(I);
   }
 
   bool MadeChange = false;
@@ -97,8 +98,7 @@ bool AtomicExpand::runOnFunction(Functio
     auto SI = dyn_cast<StoreInst>(I);
     auto RMWI = dyn_cast<AtomicRMWInst>(I);
     auto CASI = dyn_cast<AtomicCmpXchgInst>(I);
-    assert((LI || SI || RMWI || CASI || isa<FenceInst>(I)) &&
-           "Unknown atomic instruction");
+    assert((LI || SI || RMWI || CASI) && "Unknown atomic instruction");
 
     if (TLI->shouldInsertFencesForAtomic(I)) {
       auto FenceOrdering = Monotonic;




More information about the llvm-commits mailing list