CodeGen: Fix a silly typo when emitting subs of block addresses.

Part of PR14005.

llvm-svn: 165117
This commit is contained in:
Benjamin Kramer 2012-10-03 14:15:39 +00:00
parent 90a415e7ca
commit daa0961244
2 changed files with 14 additions and 2 deletions

View File

@ -4919,7 +4919,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (!LHSValue.Offset.isZero() || !RHSValue.Offset.isZero())
return false;
const Expr *LHSExpr = LHSValue.Base.dyn_cast<const Expr*>();
const Expr *RHSExpr = LHSValue.Base.dyn_cast<const Expr*>();
const Expr *RHSExpr = RHSValue.Base.dyn_cast<const Expr*>();
if (!LHSExpr || !RHSExpr)
return false;
const AddrLabelExpr *LHSAddrExpr = dyn_cast<AddrLabelExpr>(LHSExpr);

View File

@ -1,4 +1,16 @@
// RUN: %clang_cc1 %s -emit-llvm -o %t
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// CHECK: @a.a = internal global i8* blockaddress(@a, %A)
int a() {
A:;static void* a = &&A;
}
// PR14005
// CHECK: @b.ar = internal global {{.*}} sub (i{{..}} ptrtoint (i8* blockaddress(@b, %l2) to i{{..}}), i{{..}} ptrtoint (i8* blockaddress(@b, %l1) to i{{..}}))
int b() {
static int ar = &&l2 - &&l1;
l1:
return 10;
l2:
return 11;
}