[llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c

Chris Lattner lattner at cs.uiuc.edu
Wed Sep 28 00:17:13 PDT 2005



Changes in directory llvm-gcc/gcc:

llvm-expand.c updated: 1.116 -> 1.117
---
Log message:

Fix a bug I introduced that could cause generation of invalid LLVM code for
code like "false || foo()"


---
Diffs of the changes:  (+9 -1)

 llvm-expand.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm-gcc/gcc/llvm-expand.c
diff -u llvm-gcc/gcc/llvm-expand.c:1.116 llvm-gcc/gcc/llvm-expand.c:1.117
--- llvm-gcc/gcc/llvm-expand.c:1.116	Sat Sep 24 16:41:53 2005
+++ llvm-gcc/gcc/llvm-expand.c	Wed Sep 28 02:16:59 2005
@@ -1814,7 +1814,7 @@
   llvm_emit_label(Fn, getLabelDeclBlock(Label));
 }
 
-/* Generate RTL for the start of a loop.  EXIT_FLAG is nonzero if this
+/* Generate LLVM for the start of a loop.  EXIT_FLAG is nonzero if this
    loop should be exited by `break_something'.  This is a loop for which
    `expand_continue' will jump to the top of the loop.
 
@@ -3402,6 +3402,14 @@
 
 
   /* Add a PHI node to merge together the two computed values */
+  if (CondBr->NumOperands == 1 && CondBr->Operands[0] != DoneBlock) {
+    /* The cond branch terminating FromBlock was folded to not go to the done
+     * block at all.  This code is only reachable from the TestBlock.
+     */
+    return cast_if_type_not_equal(Fn, SecondOp,
+                                  llvm_type_get_from_tree(TREE_TYPE(exp)));
+  }
+  
   PHI = llvm_instruction_new(BoolTy, "shortcirc_val", O_PHINode, 4);
   PHI->Operands[0] = isAndExpr ? llvm_constant_bool_false :
                                  llvm_constant_bool_true;






More information about the llvm-commits mailing list