[llvm-commits] [llvm] r95591 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Dan Gohman
gohman at apple.com
Mon Feb 8 14:19:11 PST 2010
Author: djg
Date: Mon Feb 8 16:19:11 2010
New Revision: 95591
URL: http://llvm.org/viewvc/llvm-project?rev=95591&view=rev
Log:
ConstantFoldConstantExpression can theoretically return the original
expression; don't go into an infinite loop if it does.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=95591&r1=95590&r2=95591&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Feb 8 16:19:11 2010
@@ -892,8 +892,10 @@
// If the code isn't optimized, there may be outstanding folding
// opportunities. Attempt to fold the expression using TargetData as a
// last resort before giving up.
- if (Constant *C = ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
- return LowerConstant(C, AP);
+ if (Constant *C =
+ ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
+ if (C != CE)
+ return LowerConstant(C, AP);
#ifndef NDEBUG
CE->dump();
#endif
More information about the llvm-commits
mailing list