[llvm-commits] [llvm] r76502 - in /llvm/trunk/lib/CodeGen/SelectionDAG: SelectionDAGBuild.cpp TargetLowering.cpp

Dale Johannesen dalej at apple.com
Mon Jul 20 16:27:40 PDT 2009


Author: johannes
Date: Mon Jul 20 18:27:39 2009
New Revision: 76502

URL: http://llvm.org/viewvc/llvm-project?rev=76502&view=rev
Log:
Move stripping of bitcasts in inline asm arguments
to a place where it affects everything.  Occurs
only on calls AFAIK.


Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=76502&r1=76501&r2=76502&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Jul 20 18:27:39 2009
@@ -5059,6 +5059,11 @@
     // If this is an input or an indirect output, process the call argument.
     // BasicBlocks are labels, currently appearing only in asm's.
     if (OpInfo.CallOperandVal) {
+      // Strip bitcasts, if any.  This mostly comes up for functions.
+      ConstantExpr* CE = NULL;
+      while ((CE = dyn_cast<ConstantExpr>(OpInfo.CallOperandVal)) &&
+             CE->getOpcode()==Instruction::BitCast)
+        OpInfo.CallOperandVal = CE->getOperand(0);
       if (BasicBlock *BB = dyn_cast<BasicBlock>(OpInfo.CallOperandVal)) {
         OpInfo.CallOperand = DAG.getBasicBlock(FuncInfo.MBBMap[BB]);
       } else {

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=76502&r1=76501&r2=76502&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Mon Jul 20 18:27:39 2009
@@ -2406,20 +2406,10 @@
   
   // 'X' matches anything.
   if (OpInfo.ConstraintCode == "X" && OpInfo.CallOperandVal) {
-    // Look through bitcasts over functions.  In the context of an asm
-    // argument we don't care about bitcasting function types; the parameters
-    // to the function, if any, will have been handled elsewhere.
-    Value *v = OpInfo.CallOperandVal;
-    ConstantExpr *CE = NULL;
-    while ((CE = dyn_cast<ConstantExpr>(v)) &&
-           CE->getOpcode()==Instruction::BitCast)
-      v = CE->getOperand(0);
-    if (!isa<Function>(v))
-      v = OpInfo.CallOperandVal;
     // Labels and constants are handled elsewhere ('X' is the only thing
     // that matches labels).  For Functions, the type here is the type of
-    // the result, which is not what we want to look at; leave them alone
-    // (minus any bitcasts).
+    // the result, which is not what we want to look at; leave them alone.
+    Value *v = OpInfo.CallOperandVal;
     if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) {
       OpInfo.CallOperandVal = v;
       return;





More information about the llvm-commits mailing list