llvm.org GIT mirror llvm / e3bf8ea
[msan] Fix handling of phi in blacklisted functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212454 91177308-0d34-0410-b5e6-96231b3b80d8 Evgeniy Stepanov 5 years ago
2 changed file(s) with 28 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
715715
716716 // Finalize PHI nodes.
717717 for (PHINode *PN : ShadowPHINodes) {
718 Value *S = getShadow(PN);
719 if (isa(S)) continue;
720718 PHINode *PNS = cast(getShadow(PN));
721719 PHINode *PNO = MS.TrackOrigins ? cast(getOrigin(PN)) : nullptr;
722720 size_t NumValues = PN->getNumIncomingValues();
23952393
23962394 void visitPHINode(PHINode &I) {
23972395 IRBuilder<> IRB(&I);
2396 if (!PropagateShadow) {
2397 setShadow(&I, getCleanShadow(&I));
2398 return;
2399 }
2400
23982401 ShadowPHINodes.push_back(&I);
23992402 setShadow(&I, IRB.CreatePHI(getShadowTy(&I), I.getNumIncomingValues(),
24002403 "_msphi_s"));
740740 ; CHECK: store i32 0, i32* {{.*}} @__msan_param_tls
741741 ; CHECK: call i32 @NoSanitizeMemoryUndefHelper(i32 undef)
742742 ; CHECK: ret i32
743
744
745 ; Test PHINode instrumentation in blacklisted functions
746
747 define i32 @NoSanitizeMemoryPHI(i32 %x) {
748 entry:
749 %tobool = icmp ne i32 %x, 0
750 br i1 %tobool, label %cond.true, label %cond.false
751
752 cond.true: ; preds = %entry
753 br label %cond.end
754
755 cond.false: ; preds = %entry
756 br label %cond.end
757
758 cond.end: ; preds = %cond.false, %cond.true
759 %cond = phi i32 [ undef, %cond.true ], [ undef, %cond.false ]
760 ret i32 %cond
761 }
762
763 ; CHECK: [[A:%.*]] = phi i32 [ undef, %cond.true ], [ undef, %cond.false ]
764 ; CHECK: store i32 0, i32* bitcast {{.*}} @__msan_retval_tls
765 ; CHECK: ret i32 [[A]]
743766
744767
745768 ; Test argument shadow alignment