Skip to content

Commit ab27905

Browse files
committed
[clang][wip] Refactor CGDecl to limit freeze_bits emission
Initialize local integer variable alloca to freeze poison and disable freeze_bits on subsequent loads. Function parameters of integer type forgo alloca initialization with freeze poison and disable freeze_bits on subsequent loads. The following functions are modified: * CodeGenFunction::EmitAutoVarAlloca * CodeGenFunction::EmitParmDecl
1 parent b8d748d commit ab27905

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,9 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
15641564
// building the instruction so that it's there even in no-asserts
15651565
// builds.
15661566
address = CreateTempAlloca(allocaTy, allocaAlignment, D.getName(),
1567-
/*ArraySize=*/nullptr, &AllocaAddr);
1567+
/*ArraySize=*/nullptr, &AllocaAddr,
1568+
allocaTy->isIntegerTy());
1569+
address.setIsNondeterministicInit(allocaTy->isIntegerTy());
15681570

15691571
// Don't emit lifetime markers for MSVC catch parameters. The lifetime of
15701572
// the catch parameter starts in the catchpad instruction, and we can't
@@ -2644,7 +2646,8 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, ParamValue Arg,
26442646
} else {
26452647
// Otherwise, create a temporary to hold the value.
26462648
DeclPtr = CreateMemTemp(Ty, getContext().getDeclAlign(&D),
2647-
D.getName() + ".addr", &AllocaPtr);
2649+
D.getName() + ".addr", &AllocaPtr, false);
2650+
DeclPtr.setIsNondeterministicInit(true);
26482651
}
26492652
DoStore = true;
26502653
}

0 commit comments

Comments
 (0)