[llvm-commits] [dragonegg] r115763 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Oct 6 00:16:46 PDT 2010


Author: baldrick
Date: Wed Oct  6 02:16:46 2010
New Revision: 115763

URL: http://llvm.org/viewvc/llvm-project?rev=115763&view=rev
Log:
Port commit 104726 (bwilson) from llvm-gcc:
Set the sideeffect flag on an inline asm when replacing an output constraint
for a register variable with the specific register to which that variable has
been pinned.  Otherwise, the asm may appear to be unused and may be removed
as dead code.  Testcase to follow.  Radar 8026855.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=115763&r1=115762&r2=115763&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Wed Oct  6 02:16:46 2010
@@ -6792,6 +6792,7 @@
   std::string NewAsmStr = ConvertInlineAsmStr(stmt, outputs, inputs, labels,
                                               NumOutputs+NumInputs);
   std::string ConstraintStr;
+  bool HasSideEffects = gimple_asm_volatile_p(stmt) || !outputs;
 
   // StoreCallResultAddr - The pointer to store the result of the call through.
   SmallVector<Value *, 4> StoreCallResultAddrs;
@@ -6841,6 +6842,8 @@
         NewConstraint[RegNameLen+2] = '}';
         NewConstraint[RegNameLen+3] = 0;
         SimplifiedConstraint = NewConstraint;
+        // This output will now be implicit; set the sideffect flag on the asm.
+        HasSideEffects = true;
         // We should no longer consider mem constraints.
         AllowsMem = false;
       } else {
@@ -7085,8 +7088,7 @@
     return;
   }
 
-  Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr,
-                              gimple_asm_volatile_p(stmt) || !outputs);
+  Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr, HasSideEffects);
   CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(),
                                     CallResultTypes.empty() ? "" : "asmtmp");
   CV->setDoesNotThrow();





More information about the llvm-commits mailing list